Make FindResource and FindResourceEx fully windows compatible.
diff --git a/loader/resource.c b/loader/resource.c
index 512c2ea..cec6f6c 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -194,7 +194,14 @@
else
nameStr = (LPWSTR)name;
- hRsrc = PE_FindResourceExW( hModule, nameStr, typeStr, lang );
+ /* Here is the real difference between FindResouce and FindResourceEx */
+ if(lang == MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) ||
+ lang == MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) ||
+ lang == MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT) ||
+ lang == MAKELANGID(LANG_NEUTRAL, 3)) /* FIXME: real name? */
+ hRsrc = PE_FindResourceW( hModule, nameStr, typeStr );
+ else
+ hRsrc = PE_FindResourceExW( hModule, nameStr, typeStr, lang );
if ( HIWORD( type ) && !bUnicode )
HeapFree( GetProcessHeap(), 0, typeStr );
@@ -319,7 +326,7 @@
LPCSTR typeStr = HIWORD(type)? PTR_SEG_TO_LIN(type) : (LPCSTR)type;
return RES_FindResource( hModule, typeStr, nameStr,
- GetSystemDefaultLangID(), FALSE, TRUE );
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), FALSE, TRUE );
}
/**********************************************************************
@@ -328,7 +335,7 @@
HANDLE WINAPI FindResourceA( HMODULE hModule, LPCSTR name, LPCSTR type )
{
return RES_FindResource( hModule, type, name,
- GetSystemDefaultLangID(), FALSE, FALSE );
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), FALSE, FALSE );
}
/**********************************************************************
@@ -357,7 +364,7 @@
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
{
return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name,
- GetSystemDefaultLangID(), TRUE, FALSE );
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), TRUE, FALSE );
}
/**********************************************************************