Commit 55a14edd authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Use exception handler for GlobalUnlock, GlobalFree.

parent ae1c12c4
......@@ -1106,12 +1106,12 @@ BOOL WINAPI GlobalUnlock(
PGLOBAL32_INTERN pintern;
BOOL locked;
if(ISPOINTER(hmem))
return FALSE;
if (ISPOINTER(hmem)) return FALSE;
__TRY
{
/* HeapLock(GetProcessHeap()); */
pintern=HANDLE_TO_INTERN(hmem);
if(pintern->Magic==MAGIC_GLOBAL_USED)
{
if((pintern->LockCount<GLOBAL_LOCK_MAX)&&(pintern->LockCount>0))
......@@ -1127,6 +1127,14 @@ BOOL WINAPI GlobalUnlock(
locked=FALSE;
}
/* HeapUnlock(GetProcessHeap()); */
}
__EXCEPT(page_fault)
{
ERR("page fault occurred ! Caused by bug ?\n");
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
__ENDTRY
return locked;
}
......@@ -1306,8 +1314,11 @@ HGLOBAL WINAPI GlobalFree(
HGLOBAL hmem /* [in] Handle of global memory object */
) {
PGLOBAL32_INTERN pintern;
HGLOBAL hreturned = 0;
HGLOBAL hreturned;
__TRY
{
hreturned = 0;
if(ISPOINTER(hmem)) /* POINTER */
{
if(!HeapFree(GetProcessHeap(), 0, (LPVOID) hmem)) hmem = 0;
......@@ -1320,8 +1331,8 @@ HGLOBAL WINAPI GlobalFree(
if(pintern->Magic==MAGIC_GLOBAL_USED)
{
/* WIN98 does not make this test. That is you can free a */
/* block you have not unlocked. Go figure!! */
/* WIN98 does not make this test. That is you can free a */
/* block you have not unlocked. Go figure!! */
/* if(pintern->LockCount!=0) */
/* SetLastError(ERROR_INVALID_HANDLE); */
......@@ -1333,6 +1344,14 @@ HGLOBAL WINAPI GlobalFree(
}
/* HeapUnlock(heap); */
}
}
__EXCEPT(page_fault)
{
ERR("page fault occurred ! Caused by bug ?\n");
SetLastError( ERROR_INVALID_PARAMETER );
return hmem;
}
__ENDTRY
return hreturned;
}
......
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