/********************************************************************** * RES_LoadResource */ static HGLOBAL RES_LoadResource( HMODULE hModule, HRSRC hRsrc, BOOL bRet16 ) { HGLOBAL hMem = 0; TRACE("(%08x, %08x, %s)\n", hModule, hRsrc, bRet16? "NE" : "PE" ); if (!hRsrc) return 0; if (!HIWORD(hModule)) { HMODULE16 hMod16 = MapHModuleLS( hModule ); NE_MODULE *pModule = NE_GetPtr( hMod16 ); if (!pModule) return 0; if (!pModule->module32) { /* 16-bit NE module */ /* If we got a 32-bit hRsrc, we don't need to convert it */ hMem = NE_LoadResource( pModule, hRsrc ); /* If we are to return a 32-bit resource, we should probably convert it but we don't for now. FIXME !!! */ return hMem; } else { /* If we got a 16-bit hRsrc, convert it */ HRSRC hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc ); hMem = PE_LoadResource( pModule->module32, hRsrc32 ); /* If we need to return a 16-bit resource, convert it */ if ( bRet16 ) { WORD type = MapHRsrc16ToType( pModule, hRsrc ); DWORD size = SizeofResource( hModule, hRsrc ); LPVOID bits = LockResource( hMem ); hMem = NE_LoadPEResource( pModule, type, bits, size ); } } } else { /* 32-bit PE module */ hMem = PE_LoadResource( hModule, hRsrc ); } return hMem; }
/********************************************************************** * RES_LoadResource */ static HGLOBAL RES_LoadResource( HMODULE hModule, HRSRC hRsrc) { HGLOBAL hMem = 0; HRSRC hRsrc32; WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); if ( !hModule || !hRsrc ) return 0; /* 32-bit PE module */ /* If we got a 16-bit hRsrc, convert it */ // hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc ); if(!HIWORD(hRsrc)) { printf("16-bit hRsrcs not supported\n"); return 0; } hMem = PE_LoadResource( wm, hRsrc ); return hMem; }