Author: ion
Date: Fri Jul 22 10:10:15 2011
New Revision: 52779
URL: http://svn.reactos.org/svn/reactos?rev=52779&view=rev
Log:
[KERNEL32]: Clarify the difference between the macro and Basep8BitStringToStaticUnicodeString.
Modified:
trunk/reactos/dll/win32/kernel32/include/base_x.h
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] Fri Jul 22 10:10:15 2011
@@ -21,6 +21,14 @@
//
// It returns the correct ERROR_FILENAME_EXCED_RANGE Win32 error when the path
// is too long.
+//
+// Note that Basep8BitStringToStaticUnicodeString looks deceptively similar.
+// However, that function was designed for File APIs, which can be switched into
+// a special "OEM" mode, that uses different NLS files/encoding, and thus calls
+// RtlOemStringToAnsiString (see SetFileApisToOEM). Thererefore, this macro and
+// that function are not interchangeable. As a separate note, that function uses
+// the *Ex version of the Rtl conversion APIs, which does stricter checking that
+// is not done when this macro is used.
//
#define ConvertAnsiToUnicodePrologue \
{ \
Author: ion
Date: Fri Jul 22 09:09:05 2011
New Revision: 52777
URL: http://svn.reactos.org/svn/reactos?rev=52777&view=rev
Log:
[KERNEL32]: Fix Bug #2: FindFirstChangeNotificationA actually returns FALSE instead of INVALID_HANDLE_VALUE if the name conversion failed. In fact, up until Win7, all the *A object APIs do so, even though MSDN has always claimed the APIs return INVALID_HANDLE_VALUE. Since we don't have the Shim Database Microsoft has to unbreak apps on Win7 that probably depend on the old behavior, we'll keep the old behavior (especially since we target NT 5.2 -- and even Vista does it this way).
[KERNEL32]: Bug was fixed by using the new macros implemented last commit.
Modified:
trunk/reactos/dll/win32/kernel32/client/file/cnotify.c
trunk/reactos/dll/win32/kernel32/include/base_x.h
Modified: trunk/reactos/dll/win32/kernel32/client/file/cnotify.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/cnotify.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/file/cnotify.c [iso-8859-1] Fri Jul 22 09:09:05 2011
@@ -43,26 +43,11 @@
IN BOOL bWatchSubtree,
IN DWORD dwNotifyFilter)
{
- NTSTATUS Status;
- ANSI_STRING PathNameString;
-
- RtlInitAnsiString(&PathNameString, lpPathName);
- Status = RtlAnsiStringToUnicodeString(&(NtCurrentTeb()->StaticUnicodeString), &PathNameString, FALSE);
- if (!NT_SUCCESS(Status))
- {
- if (Status != STATUS_BUFFER_OVERFLOW)
- {
- SetLastError(ERROR_FILENAME_EXCED_RANGE);
- }
- else
- {
- BaseSetLastNTError(Status);
- }
- return INVALID_HANDLE_VALUE;
- }
-
- return FindFirstChangeNotificationW(NtCurrentTeb()->StaticUnicodeString.Buffer,
- bWatchSubtree, dwNotifyFilter);
+ /* Call the W(ide) function */
+ ConvertWin32AnsiChangeApiToUnicodeApi(FindFirstChangeNotification,
+ lpPathName,
+ bWatchSubtree,
+ dwNotifyFilter);
}
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] Fri Jul 22 09:09:05 2011
@@ -50,3 +50,13 @@
if (NT_SUCCESS(Status)) return Create##obj##W(args, UnicodeCache->Buffer); \
ConvertAnsiToUnicodeEpilogue
+//
+// This macro uses the ConvertAnsiToUnicode macros above to convert a FindFirst*A
+// Win32 API into its equivalent FindFirst*W API.
+//
+#define ConvertWin32AnsiChangeApiToUnicodeApi(obj, name, args...) \
+ ConvertAnsiToUnicodePrologue \
+ ConvertAnsiToUnicodeBody(name) \
+ if (NT_SUCCESS(Status)) return obj##W(UnicodeCache->Buffer, args); \
+ ConvertAnsiToUnicodeEpilogue
+