Author: ion
Date: Tue Feb 21 19:19:44 2012
New Revision: 55791
URL:
http://svn.reactos.org/svn/reactos?rev=55791&view=rev
Log:
[KERNEL32]: Use macro for CreateMailSlotA->CreateMailSlotW.
Modified:
trunk/reactos/dll/win32/kernel32/client/file/mailslot.c
trunk/reactos/dll/win32/kernel32/include/base_x.h
Modified: trunk/reactos/dll/win32/kernel32/client/file/mailslot.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/mailslot.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/file/mailslot.c [iso-8859-1] Tue Feb 21
19:19:44 2012
@@ -26,32 +26,8 @@
IN DWORD lReadTimeout,
IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
- PUNICODE_STRING NameU;
- ANSI_STRING NameA;
- NTSTATUS Status;
-
- NameU = &NtCurrentTeb()->StaticUnicodeString;
-
- RtlInitAnsiString(&NameA, (LPSTR)lpName);
- Status = RtlAnsiStringToUnicodeString(NameU, &NameA, FALSE);
- if (!NT_SUCCESS(Status))
- {
- if (Status == STATUS_BUFFER_OVERFLOW)
- {
- SetLastError(ERROR_FILENAME_EXCED_RANGE);
- }
- else
- {
- BaseSetLastNTError(Status);
- }
-
- return INVALID_HANDLE_VALUE;
- }
-
- return CreateMailslotW(NameU->Buffer,
- nMaxMessageSize,
- lReadTimeout,
- lpSecurityAttributes);
+ /* Call the W(ide) function */
+ ConvertWin32AnsiObjectApiToUnicodeApi2(Mailslot, lpName, nMaxMessageSize,
lReadTimeout, lpSecurityAttributes);
}
/*
Modified: trunk/reactos/dll/win32/kernel32/include/base_x.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/include/base_x.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/include/base_x.h [iso-8859-1] Tue Feb 21 19:19:44
2012
@@ -56,6 +56,17 @@
if (!name) return Create##obj##W(__VA_ARGS__, NULL); \
ConvertAnsiToUnicodeBody(name) \
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
//