Commit fd3c7be0 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

user32: Allocate buffer on heap.

parent a8a2ca72
...@@ -2028,9 +2028,10 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2028,9 +2028,10 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
struct user_thread_info *thread_info = get_user_thread_info(); struct user_thread_info *thread_info = get_user_thread_info();
struct received_message_info info, *old_info; struct received_message_info info, *old_info;
unsigned int hw_id = 0; /* id of previous hardware message */ unsigned int hw_id = 0; /* id of previous hardware message */
char local_buffer[256]; void *buffer;
void *buffer = local_buffer; size_t buffer_size = 256;
size_t buffer_size = sizeof(local_buffer);
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size ))) return FALSE;
if (!first && !last) last = ~0; if (!first && !last) last = ~0;
...@@ -2070,7 +2071,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2070,7 +2071,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
if (res) if (res)
{ {
if (buffer != local_buffer) HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
if (res != STATUS_BUFFER_OVERFLOW) return FALSE; if (res != STATUS_BUFFER_OVERFLOW) return FALSE;
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size ))) return FALSE; if (!(buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size ))) return FALSE;
continue; continue;
...@@ -2163,7 +2164,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2163,7 +2164,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
thread_info->GetMessagePosVal = MAKELONG( info.msg.pt.x, info.msg.pt.y ); thread_info->GetMessagePosVal = MAKELONG( info.msg.pt.x, info.msg.pt.y );
thread_info->GetMessageTimeVal = info.msg.time; thread_info->GetMessageTimeVal = info.msg.time;
thread_info->GetMessageExtraInfoVal = msg_data->hardware.info; thread_info->GetMessageExtraInfoVal = msg_data->hardware.info;
if (buffer != local_buffer) HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE ); HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE );
return TRUE; return TRUE;
} }
...@@ -2194,7 +2195,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags ...@@ -2194,7 +2195,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
msg->pt.y = (short)HIWORD( thread_info->GetMessagePosVal ); msg->pt.y = (short)HIWORD( thread_info->GetMessagePosVal );
thread_info->GetMessageTimeVal = info.msg.time; thread_info->GetMessageTimeVal = info.msg.time;
thread_info->GetMessageExtraInfoVal = 0; thread_info->GetMessageExtraInfoVal = 0;
if (buffer != local_buffer) HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE ); HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE );
return TRUE; return TRUE;
} }
......
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