From 6903156eb5771153cc55d469711c24a64b262369 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 1 Apr 1999 10:08:21 +0000 Subject: [PATCH] Allow NULL NE resource handler; call the default handler directly. Removed WPROCS / Callbacks support for WineLib resource handlers. --- if1632/wprocs.spec | 3 --- loader/module.c | 2 -- loader/ne/resource.c | 23 ++++++++++++++++------- misc/callback.c | 4 +++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/if1632/wprocs.spec b/if1632/wprocs.spec index c9ea5753b0c..32b2c3bc483 100644 --- a/if1632/wprocs.spec +++ b/if1632/wprocs.spec @@ -12,10 +12,7 @@ type win16 24 pascal16 TASK_Reschedule() TASK_Reschedule 27 pascal EntryAddrProc(word word) NE_GetEntryPoint 28 pascal MyAlloc(word word word) NE_AllocateSegment -29 pascal DefResourceHandler(word word word) NE_DefResourceHandler 30 pascal FormatCharDlgProc(word word word long) FormatCharDlgProc16 -31 pascal LoadDIBIconHandler(word word word) LoadDIBIconHandler16 -32 pascal LoadDIBCursorHandler(word word word) LoadDIBCursorHandler16 # Interrupt vectors 0-255 are ordinals 100-355 # The 'word' parameter are the flags pushed on the stack by the interrupt diff --git a/loader/module.c b/loader/module.c index 52d18bee4b6..dfa371949a8 100644 --- a/loader/module.c +++ b/loader/module.c @@ -404,8 +404,6 @@ FARPROC16 MODULE_GetWndProcEntry16( LPCSTR name ) return (FARPROC16)PrintSetupDlgProc16; if (!strcmp(name,"ReplaceTextDlgProc")) return (FARPROC16)ReplaceTextDlgProc16; - if (!strcmp(name,"DefResourceHandler")) - return (FARPROC16)NE_DefResourceHandler; FIXME(module,"No mapping for %s(), add one in library/miscstubs.c\n",name); assert( FALSE ); return NULL; diff --git a/loader/ne/resource.c b/loader/ne/resource.c index b38fad05b66..ddf33eecc3c 100644 --- a/loader/ne/resource.c +++ b/loader/ne/resource.c @@ -26,6 +26,8 @@ #define NEXT_TYPEINFO(pTypeInfo) ((NE_TYPEINFO *)((char*)((pTypeInfo) + 1) + \ (pTypeInfo)->count * sizeof(NE_NAMEINFO))) +static FARPROC16 DefResourceHandlerProc = (FARPROC16)0xffffffff; + /*********************************************************************** * NE_FindNameTableId * @@ -221,13 +223,22 @@ BOOL NE_InitResourceHandler( HMODULE16 hModule ) NE_MODULE *pModule = NE_GetPtr( hModule ); NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); - FARPROC16 handler = MODULE_GetWndProcEntry16("DefResourceHandler"); + if ( DefResourceHandlerProc == (FARPROC16)0xffffffff ) + { + HMODULE16 hModule = GetModuleHandle16( "KERNEL" ); + int ordinal = hModule? NE_GetOrdinal( hModule, "DefResourceHandler" ) : 0; + + if ( ordinal ) + DefResourceHandlerProc = NE_GetEntryPointEx( hModule, ordinal, FALSE ); + else + DefResourceHandlerProc = NULL; + } TRACE(resource,"InitResourceHandler[%04x]\n", hModule ); while(pTypeInfo->type_id) { - pTypeInfo->resloader = handler; + pTypeInfo->resloader = DefResourceHandlerProc; pTypeInfo = NEXT_TYPEINFO(pTypeInfo); } return TRUE; @@ -453,15 +464,13 @@ HGLOBAL16 NE_LoadResource( NE_MODULE *pModule, HRSRC16 hRsrc ) } else { - if (pTypeInfo->resloader) + if ( pTypeInfo->resloader + && pTypeInfo->resloader != DefResourceHandlerProc ) pNameInfo->handle = Callbacks->CallResourceHandlerProc( pTypeInfo->resloader, pNameInfo->handle, pModule->self, hRsrc ); - else /* this is really bad */ - { - ERR(resource, "[%04x]: Missing resource handler!\n", pModule->self); + else pNameInfo->handle = NE_DefResourceHandler( pNameInfo->handle, pModule->self, hRsrc ); - } if (pNameInfo->handle) { diff --git a/misc/callback.c b/misc/callback.c index d19039b4a5b..d6b08b298c9 100644 --- a/misc/callback.c +++ b/misc/callback.c @@ -130,7 +130,9 @@ static HGLOBAL16 WINAPI CALLBACK_CallResourceHandlerProc( FARPROC16 proc, HMODULE16 hModule, HRSRC16 hRsrc ) { - return proc( hMemObj, hModule, hRsrc ); + ERR( relay, "Cannot call a 16-bit resource handler in Winelib\n" ); + assert( FALSE ); + return 0; }