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
+