[KERNEL32]
[reactos.git] / dll / win32 / kernel32 / include / base_x.h
index a745719..62ed8f5 100644 (file)
     if (NT_SUCCESS(Status)) return Create##obj##W(__VA_ARGS__, UnicodeCache->Buffer);  \
     ConvertAnsiToUnicodeEpilogue
 
+//
+// This macro uses the ConvertAnsiToUnicode macros above to convert a CreateXxxA
+// Win32 API into its equivalent CreateXxxW API.
+//
+#define ConvertWin32AnsiObjectApiToUnicodeApi2(obj, name, ...)                  \
+    ConvertAnsiToUnicodePrologue                                                \
+    if (!name) return Create##obj##W(NULL, __VA_ARGS__);                        \
+    ConvertAnsiToUnicodeBody(name)                                              \
+    if (NT_SUCCESS(Status)) return Create##obj##W(UnicodeCache->Buffer, __VA_ARGS__);  \
+    ConvertAnsiToUnicodeEpilogue
+
 //
 // This macro uses the ConvertAnsiToUnicode macros above to convert a FindFirst*A
 // Win32 API into its equivalent FindFirst*W API.
@@ -88,7 +99,7 @@
 // wraps the usual code path required to create an NT object based on a Unicode
 // (Wide) Win32 object creation API.
 //
-// It makes use of BasepConvertObjectAttributes and allows for a custom access
+// It makes use of BaseFormatObjectAttributes and allows for a custom access
 // mode to be used, and also sets the correct error codes in case of a collision
 //
 #define CreateNtObjectFromWin32ApiPrologue                                      \
     POBJECT_ATTRIBUTES ObjectAttributes = &LocalAttributes;
 #define CreateNtObjectFromWin32ApiBody(ntobj, sec, name, access, ...)           \
     if (name) RtlInitUnicodeString(&ObjectName, name);                          \
-    ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes,           \
+    ObjectAttributes = BaseFormatObjectAttributes(&LocalAttributes,             \
                                                     sec,                        \
                                                     name ? &ObjectName : NULL); \
     Status = NtCreate##ntobj(&Handle, access, ObjectAttributes, ##__VA_ARGS__);
             SetLastError(ERROR_SUCCESS);                                        \
         return Handle;                                                          \
     }                                                                           \
-    BaseSetLastNTError(Status);                                               \
+    BaseSetLastNTError(Status);                                                 \
     return NULL;                                                                \
 }
 
     CreateNtObjectFromWin32ApiPrologue                                          \
     if (!name)                                                                  \
     {                                                                           \
-        BaseSetLastNTError(STATUS_INVALID_PARAMETER);                         \
+        BaseSetLastNTError(STATUS_INVALID_PARAMETER);                           \
         return NULL;                                                            \
     }                                                                           \
     RtlInitUnicodeString(&ObjectName, name);                                    \
     InitializeObjectAttributes(ObjectAttributes,                                \
                                &ObjectName,                                     \
                                inh ? OBJ_INHERIT : 0,                           \
-                               hBaseDir,                                        \
+                               BaseGetNamedObjectDirectory(),                   \
                                NULL);                                           \
     Status = NtOpen##ntobj(&Handle, acc, ObjectAttributes);                     \
     if (!NT_SUCCESS(Status))                                                    \
     {                                                                           \
-        BaseSetLastNTError(Status);                                           \
+        BaseSetLastNTError(Status);                                             \
         return NULL;                                                            \
     }                                                                           \
     return Handle;                                                              \