Commit 7521a42e authored by Alexandre Julliard's avatar Alexandre Julliard

Changed the USER_HEAP_* macros to use HANDLEs instead of HANDLE16s.

parent 61d92562
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
extern WORD USER_HeapSel; extern WORD USER_HeapSel;
#define USER_HEAP_ALLOC(size) \ #define USER_HEAP_ALLOC(size) \
LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ) ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ))
#define USER_HEAP_REALLOC(handle,size) \ #define USER_HEAP_REALLOC(handle,size) \
LOCAL_ReAlloc( USER_HeapSel, (handle), (size), LMEM_FIXED ) ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED ))
#define USER_HEAP_FREE(handle) \ #define USER_HEAP_FREE(handle) \
LOCAL_Free( USER_HeapSel, (handle) ) LOCAL_Free( USER_HeapSel, LOWORD(handle) )
#define USER_HEAP_LIN_ADDR(handle) \ #define USER_HEAP_LIN_ADDR(handle) \
((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, (handle))) : NULL) ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL)
#define GET_WORD(ptr) (*(WORD *)(ptr)) #define GET_WORD(ptr) (*(WORD *)(ptr))
#define GET_DWORD(ptr) (*(DWORD *)(ptr)) #define GET_DWORD(ptr) (*(DWORD *)(ptr))
......
...@@ -595,7 +595,7 @@ inline static LRESULT call_hook( HOOKDATA *data, INT fromtype, INT code, ...@@ -595,7 +595,7 @@ inline static LRESULT call_hook( HOOKDATA *data, INT fromtype, INT code,
*/ */
static HHOOK HOOK_GetNextHook( HHOOK hook ) static HHOOK HOOK_GetNextHook( HHOOK hook )
{ {
HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR(HHOOK_16(hook)); HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hook );
if (!data || !hook) return 0; if (!data || !hook) return 0;
if (data->next) return HHOOK_32(data->next); if (data->next) return HHOOK_32(data->next);
...@@ -696,7 +696,7 @@ static BOOL HOOK_RemoveHook( HHOOK hook ) ...@@ -696,7 +696,7 @@ static BOOL HOOK_RemoveHook( HHOOK hook )
TRACE("Removing hook %04x\n", hook ); TRACE("Removing hook %04x\n", hook );
if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR(HHOOK_16(hook)))) return FALSE; if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook))) return FALSE;
if (data->flags & HOOK_INUSE) if (data->flags & HOOK_INUSE)
{ {
/* Mark it for deletion later on */ /* Mark it for deletion later on */
...@@ -724,7 +724,7 @@ static BOOL HOOK_RemoveHook( HHOOK hook ) ...@@ -724,7 +724,7 @@ static BOOL HOOK_RemoveHook( HHOOK hook )
if (!*prevHandle) return FALSE; if (!*prevHandle) return FALSE;
*prevHandle = data->next; *prevHandle = data->next;
USER_HEAP_FREE(HHOOK_16(hook)); USER_HEAP_FREE( hook );
return TRUE; return TRUE;
} }
...@@ -738,7 +738,7 @@ static HHOOK HOOK_FindValidHook( HHOOK hook ) ...@@ -738,7 +738,7 @@ static HHOOK HOOK_FindValidHook( HHOOK hook )
for (;;) for (;;)
{ {
if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR(HHOOK_16(hook)))) return 0; if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hook ))) return 0;
if (data->proc) return hook; if (data->proc) return hook;
hook = HHOOK_32(data->next); hook = HHOOK_32(data->next);
} }
...@@ -754,7 +754,7 @@ static LRESULT HOOK_CallHook( HHOOK hook, INT fromtype, INT code, ...@@ -754,7 +754,7 @@ static LRESULT HOOK_CallHook( HHOOK hook, INT fromtype, INT code,
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
HANDLE16 prevHandle; HANDLE16 prevHandle;
HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR(HHOOK_16(hook)); HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hook );
LRESULT ret; LRESULT ret;
if (!(queue = QUEUE_Current())) return 0; if (!(queue = QUEUE_Current())) return 0;
...@@ -883,7 +883,7 @@ void HOOK_FreeQueueHooks(void) ...@@ -883,7 +883,7 @@ void HOOK_FreeQueueHooks(void)
{ {
next = HOOK_GetNextHook(hook); next = HOOK_GetNextHook(hook);
hptr = (HOOKDATA *)USER_HEAP_LIN_ADDR(HHOOK_16(hook)); hptr = (HOOKDATA *)USER_HEAP_LIN_ADDR( hook );
if( hptr && hptr->ownerQueue ) if( hptr && hptr->ownerQueue )
{ {
hptr->flags &= HOOK_MAPTYPE; hptr->flags &= HOOK_MAPTYPE;
...@@ -977,7 +977,7 @@ BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc ) ...@@ -977,7 +977,7 @@ BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc )
while (hook) while (hook)
{ {
HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR(HHOOK_16(hook)); HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hook );
if (data->proc == proc) break; if (data->proc == proc) break;
hook = HOOK_GetNextHook( hook ); hook = HOOK_GetNextHook( hook );
} }
...@@ -1034,7 +1034,7 @@ LRESULT WINAPI CallNextHookEx( HHOOK hhook, INT code, WPARAM wParam, ...@@ -1034,7 +1034,7 @@ LRESULT WINAPI CallNextHookEx( HHOOK hhook, INT code, WPARAM wParam,
if (!(next = HOOK_GetNextHook(hhook))) return 0; if (!(next = HOOK_GetNextHook(hhook))) return 0;
oldhook = (HOOKDATA *)USER_HEAP_LIN_ADDR(HHOOK_16(hhook)); oldhook = (HOOKDATA *)USER_HEAP_LIN_ADDR( hhook );
fromtype = oldhook->flags & HOOK_MAPTYPE; fromtype = oldhook->flags & HOOK_MAPTYPE;
if (fromtype == HOOK_WIN16) if (fromtype == HOOK_WIN16)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment