Skip to content

Commit 0172338

Browse files
[USER32] Fix pointer truncation (reactos#8421)
Fix `UnregisterDeviceNotification()` crash on x64 due to pointer truncation. Change signature of `CMP_REGNOTIFY` and `CMP_UNREGNOTIFY` to be correct (use `HDEVNOTIFY` instead of `ULONG`).
1 parent 1b2272a commit 0172338

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

win32ss/user/user32/misc/resources.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(resource);
99
#define CR_INVALID_DATA 0x0000001F
1010
#endif
1111

12-
typedef DWORD (WINAPI *CMP_REGNOTIFY) (HANDLE, LPVOID, DWORD, PULONG);
13-
typedef DWORD (WINAPI *CMP_UNREGNOTIFY) (ULONG );
12+
typedef DWORD (WINAPI *CMP_REGNOTIFY) (HANDLE, LPVOID, DWORD, PHDEVNOTIFY);
13+
typedef DWORD (WINAPI *CMP_UNREGNOTIFY) (HDEVNOTIFY);
1414

1515
static HINSTANCE hSetupApi = NULL;
1616

@@ -127,7 +127,7 @@ RegisterDeviceNotificationW(HANDLE hRecipient,
127127
return NULL;
128128
}
129129

130-
ConfigRet = RegNotify(hRecipient, NotificationFilter, Flags, (PULONG) &hDevNotify);
130+
ConfigRet = RegNotify(hRecipient, NotificationFilter, Flags, &hDevNotify);
131131
if (ConfigRet != CR_SUCCESS)
132132
{
133133
switch (ConfigRet)
@@ -175,7 +175,7 @@ UnregisterDeviceNotification(HDEVNOTIFY Handle)
175175
return FALSE;
176176
}
177177

178-
ConfigRet = UnRegNotify((ULONG_PTR)Handle );
178+
ConfigRet = UnRegNotify(Handle);
179179
if (ConfigRet != CR_SUCCESS)
180180
{
181181
switch (ConfigRet)

0 commit comments

Comments
 (0)