mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 13:27:35 +00:00
FindResourceExA/W should search for the specified language resource only.
FindResourceA/W should search for any language resource.
This commit is contained in:
parent
77e3cd8cd0
commit
f1fd89db42
5 changed files with 20 additions and 23 deletions
|
@ -33,7 +33,7 @@ extern BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG);
|
|||
extern BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG);
|
||||
extern BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG);
|
||||
extern BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG);
|
||||
extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
|
||||
extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD,BOOL);
|
||||
extern DWORD PE_SizeofResource(HMODULE,HRSRC);
|
||||
extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
|
||||
extern void PE_UnloadLibrary(struct _wine_modref *);
|
||||
|
|
|
@ -116,10 +116,10 @@ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA( PIMAGE_RESOURCE_DIRECTORY resdirptr,
|
|||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_FindResourceEx32W
|
||||
* PE_FindResourceExW
|
||||
*/
|
||||
HANDLE PE_FindResourceExW(
|
||||
WINE_MODREF *wm,LPCWSTR name,LPCWSTR type,WORD lang
|
||||
WINE_MODREF *wm,LPCWSTR name,LPCWSTR type,WORD lang, BOOL allowdefault
|
||||
) {
|
||||
PIMAGE_RESOURCE_DIRECTORY resdirptr;
|
||||
DWORD root;
|
||||
|
@ -137,14 +137,8 @@ HANDLE PE_FindResourceExW(
|
|||
return 0;
|
||||
result = (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT)lang, root, FALSE);
|
||||
|
||||
/* Try with only the primary language set */
|
||||
if (!result)
|
||||
{
|
||||
lang = MAKELANGID(PRIMARYLANGID(lang), SUBLANG_DEFAULT);
|
||||
result = (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT)lang, root, FALSE);
|
||||
}
|
||||
/* Try LANG_NEUTRAL, too */
|
||||
if(!result)
|
||||
if(!result && allowdefault)
|
||||
return (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)0, root, TRUE);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ static WINE_EXCEPTION_FILTER(page_fault)
|
|||
|
||||
static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD lang,
|
||||
BOOL bUnicode, BOOL bRet16 )
|
||||
BOOL bUnicode, BOOL bRet16, BOOL allowdefault )
|
||||
{
|
||||
HRSRC hRsrc = 0;
|
||||
HMODULE16 hMod16 = MapHModuleLS( hModule );
|
||||
|
@ -141,14 +141,15 @@ static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
|
|||
WINE_MODREF *wm = pModule && pModule->module32?
|
||||
MODULE32_LookupHMODULE( pModule->module32 ) : NULL;
|
||||
|
||||
TRACE("(%08x %s, %08x%s, %08x%s, %04x, %s, %s)\n",
|
||||
TRACE("(%08x %s, %08x%s, %08x%s, %04x, %s, %s, %s)\n",
|
||||
hModule,
|
||||
pModule ? (char *)NE_MODULE_NAME(pModule) : "NULL dereference",
|
||||
(UINT)type, HIWORD(type)? (bUnicode? debugstr_w((LPWSTR)type) : debugstr_a(type)) : "",
|
||||
(UINT)name, HIWORD(name)? (bUnicode? debugstr_w((LPWSTR)name) : debugstr_a(name)) : "",
|
||||
lang,
|
||||
bUnicode? "W" : "A",
|
||||
bRet16? "NE" : "PE" );
|
||||
bRet16? "NE" : "PE",
|
||||
allowdefault ? "allow default" : "NOT allowdefault" );
|
||||
|
||||
if (pModule)
|
||||
{
|
||||
|
@ -166,7 +167,7 @@ static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
|
|||
else
|
||||
nameStr = (LPWSTR)name;
|
||||
|
||||
hRsrc = PE_FindResourceExW( wm, nameStr, typeStr, lang );
|
||||
hRsrc = PE_FindResourceExW( wm, nameStr, typeStr, lang, allowdefault );
|
||||
|
||||
if ( HIWORD( type ) && !bUnicode )
|
||||
HeapFree( GetProcessHeap(), 0, typeStr );
|
||||
|
@ -214,12 +215,12 @@ static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
|
|||
|
||||
static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD lang,
|
||||
BOOL bUnicode, BOOL bRet16 )
|
||||
BOOL bUnicode, BOOL bRet16, BOOL allowdefault )
|
||||
{
|
||||
HRSRC hRsrc;
|
||||
__TRY
|
||||
{
|
||||
hRsrc = RES_FindResource2(hModule, type, name, lang, bUnicode, bRet16);
|
||||
hRsrc = RES_FindResource2(hModule, type, name, lang, bUnicode, bRet16, allowdefault);
|
||||
}
|
||||
__EXCEPT(page_fault)
|
||||
{
|
||||
|
@ -447,7 +448,7 @@ HRSRC16 WINAPI FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type )
|
|||
LPCSTR typeStr = HIWORD(type)? PTR_SEG_TO_LIN(type) : (LPCSTR)type;
|
||||
|
||||
return RES_FindResource( hModule, typeStr, nameStr,
|
||||
GetSystemDefaultLangID(), FALSE, TRUE );
|
||||
GetSystemDefaultLangID(), FALSE, TRUE, TRUE );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -456,7 +457,7 @@ HRSRC16 WINAPI FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type )
|
|||
HANDLE WINAPI FindResourceA( HMODULE hModule, LPCSTR name, LPCSTR type )
|
||||
{
|
||||
return RES_FindResource( hModule, type, name,
|
||||
GetSystemDefaultLangID(), FALSE, FALSE );
|
||||
GetSystemDefaultLangID(), FALSE, FALSE, TRUE );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -466,7 +467,7 @@ HANDLE WINAPI FindResourceExA( HMODULE hModule,
|
|||
LPCSTR type, LPCSTR name, WORD lang )
|
||||
{
|
||||
return RES_FindResource( hModule, type, name,
|
||||
lang, FALSE, FALSE );
|
||||
lang, FALSE, FALSE, FALSE );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -476,7 +477,7 @@ HRSRC WINAPI FindResourceExW( HMODULE hModule,
|
|||
LPCWSTR type, LPCWSTR name, WORD lang )
|
||||
{
|
||||
return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name,
|
||||
lang, TRUE, FALSE );
|
||||
lang, TRUE, FALSE, FALSE );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -485,7 +486,7 @@ HRSRC WINAPI FindResourceExW( HMODULE hModule,
|
|||
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
|
||||
{
|
||||
return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name,
|
||||
GetSystemDefaultLangID(), TRUE, FALSE );
|
||||
GetSystemDefaultLangID(), TRUE, FALSE, TRUE );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
|
@ -240,7 +240,7 @@ int MAIN_GetLanguageID(LPCSTR Lang,LPCSTR Country,LPCSTR Charset,LPCSTR Dialect)
|
|||
|
||||
#define LANG_ENTRY_BEGIN(x,y) if(!strcmp(lang, x )) { \
|
||||
if (!country[0]) { \
|
||||
ret=LANG_##y ; \
|
||||
ret=MAKELANGID(LANG_##y, SUBLANG_DEFAULT); \
|
||||
goto end_MAIN_GetLanguageID; \
|
||||
}
|
||||
#define LANG_SUB_ENTRY(x,y,z) if (!strcmp(country, x )) { \
|
||||
|
|
|
@ -360,7 +360,9 @@ INT WINAPI GetLocaleInfoA(LCID lcid,LCTYPE LCType,LPSTR buf,INT len)
|
|||
if(!retString)
|
||||
FIXME("Unkown LC type %lX\n", LCType);
|
||||
else
|
||||
ERR("'%s' not supported for your language (%04X)\n",
|
||||
FIXME("'%s' is not defined for your language (%04X).\n"
|
||||
"Please define it in dlls/kernel/nls/YourLanguage.nls\n"
|
||||
"and submit patch for inclusion into the next Wine release.\n",
|
||||
retString, LOWORD(lcid));
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue