Wrap an exception handler around FindResource.
This commit is contained in:
parent
72e1be10ea
commit
c775e1ec7f
@ -18,6 +18,7 @@
|
||||
#include "winuser.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/winuser16.h"
|
||||
#include "wine/exception.h"
|
||||
#include "ldt.h"
|
||||
#include "global.h"
|
||||
#include "heap.h"
|
||||
@ -124,15 +125,19 @@ static WORD MapHRsrc16ToType( NE_MODULE *pModule, HRSRC16 hRsrc16 )
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* RES_FindResource
|
||||
*/
|
||||
static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type,
|
||||
/* filter for page-fault exceptions */
|
||||
static WINE_EXCEPTION_FILTER(page_fault)
|
||||
{
|
||||
if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD lang,
|
||||
BOOL bUnicode, BOOL bRet16 )
|
||||
{
|
||||
HRSRC hRsrc = 0;
|
||||
|
||||
HMODULE16 hMod16 = MapHModuleLS( hModule );
|
||||
NE_MODULE *pModule = NE_GetPtr( hMod16 );
|
||||
WINE_MODREF *wm = pModule && pModule->module32?
|
||||
@ -147,8 +152,8 @@ static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type,
|
||||
bUnicode? "W" : "A",
|
||||
bRet16? "NE" : "PE" );
|
||||
|
||||
if ( !pModule ) return 0;
|
||||
|
||||
if (pModule)
|
||||
{
|
||||
if ( wm )
|
||||
{
|
||||
/* 32-bit PE module */
|
||||
@ -201,7 +206,30 @@ static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type,
|
||||
/* If we need to return 32-bit HRSRC, no conversion is necessary,
|
||||
we simply use the 16-bit HRSRC as 32-bit HRSRC */
|
||||
}
|
||||
}
|
||||
return hRsrc;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RES_FindResource
|
||||
*/
|
||||
|
||||
static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD lang,
|
||||
BOOL bUnicode, BOOL bRet16 )
|
||||
{
|
||||
HRSRC hRsrc;
|
||||
__TRY
|
||||
{
|
||||
hRsrc = RES_FindResource2(hModule, type, name, lang, bUnicode, bRet16);
|
||||
}
|
||||
__EXCEPT(page_fault)
|
||||
{
|
||||
WARN("page fault\n");
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
__ENDTRY
|
||||
return hRsrc;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user