mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 19:49:50 +00:00
kernel32: Lock heap and validate pointer in LocalHandle.
This commit is contained in:
parent
d918919de0
commit
c7eb844ce0
1 changed files with 6 additions and 2 deletions
|
@ -343,6 +343,7 @@ UINT WINAPI LocalFlags( HLOCAL handle )
|
|||
*/
|
||||
HLOCAL WINAPI LocalHandle( const void *ptr )
|
||||
{
|
||||
HANDLE heap = GetProcessHeap();
|
||||
HLOCAL handle = (HANDLE)ptr;
|
||||
ULONG flags;
|
||||
|
||||
|
@ -354,11 +355,14 @@ HLOCAL WINAPI LocalHandle( const void *ptr )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!RtlGetUserInfoHeap( GetProcessHeap(), 0, (void *)ptr, &handle, &flags ))
|
||||
RtlLockHeap( heap );
|
||||
if (!HeapValidate( heap, HEAP_NO_SERIALIZE, ptr ) ||
|
||||
!RtlGetUserInfoHeap( heap, HEAP_NO_SERIALIZE, (void *)ptr, &handle, &flags ))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_HANDLE );
|
||||
return 0;
|
||||
handle = 0;
|
||||
}
|
||||
RtlUnlockHeap( heap );
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue