Author: akhaldi
Date: Sun Jun 4 01:47:19 2017
New Revision: 74855
URL:
http://svn.reactos.org/svn/reactos?rev=74855&view=rev
Log:
[VERSION] Sync with Wine Staging 2.9. CORE-13362
7811de1 version: Add support for FILE_VER_GET_LOCALISED flag.
Modified:
trunk/reactos/dll/win32/version/version.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/version/version.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/version.…
==============================================================================
--- trunk/reactos/dll/win32/version/version.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/version/version.c [iso-8859-1] Sun Jun 4 01:47:19 2017
@@ -127,22 +127,30 @@
* find_entry_language
*/
static const IMAGE_RESOURCE_DIRECTORY *find_entry_language( const
IMAGE_RESOURCE_DIRECTORY *dir,
- const void *root )
+ const void *root, DWORD flags
)
{
const IMAGE_RESOURCE_DIRECTORY *ret;
WORD list[9];
int i, pos = 0;
- /* cf. LdrFindResource_U */
- pos = push_language( list, pos, MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ) );
- pos = push_language( list, pos, LANGIDFROMLCID( NtCurrentTeb()->CurrentLocale )
);
- pos = push_language( list, pos, GetUserDefaultLangID() );
- pos = push_language( list, pos, MAKELANGID( PRIMARYLANGID(GetUserDefaultLangID()),
SUBLANG_NEUTRAL ));
- pos = push_language( list, pos, MAKELANGID( PRIMARYLANGID(GetUserDefaultLangID()),
SUBLANG_DEFAULT ));
- pos = push_language( list, pos, GetSystemDefaultLangID() );
- pos = push_language( list, pos, MAKELANGID( PRIMARYLANGID(GetSystemDefaultLangID()),
SUBLANG_NEUTRAL ));
- pos = push_language( list, pos, MAKELANGID( PRIMARYLANGID(GetSystemDefaultLangID()),
SUBLANG_DEFAULT ));
- pos = push_language( list, pos, MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ) );
+ if (flags & FILE_VER_GET_LOCALISED)
+ {
+ /* cf. LdrFindResource_U */
+ pos = push_language( list, pos, MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ) );
+ pos = push_language( list, pos, LANGIDFROMLCID( NtCurrentTeb()->CurrentLocale
) );
+ pos = push_language( list, pos, GetUserDefaultLangID() );
+ pos = push_language( list, pos, MAKELANGID(
PRIMARYLANGID(GetUserDefaultLangID()), SUBLANG_NEUTRAL ));
+ pos = push_language( list, pos, MAKELANGID(
PRIMARYLANGID(GetUserDefaultLangID()), SUBLANG_DEFAULT ));
+ pos = push_language( list, pos, GetSystemDefaultLangID() );
+ pos = push_language( list, pos, MAKELANGID(
PRIMARYLANGID(GetSystemDefaultLangID()), SUBLANG_NEUTRAL ));
+ pos = push_language( list, pos, MAKELANGID(
PRIMARYLANGID(GetSystemDefaultLangID()), SUBLANG_DEFAULT ));
+ pos = push_language( list, pos, MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ) );
+ }
+ else
+ {
+ /* FIXME: resolve LN file here */
+ pos = push_language( list, pos, MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ) );
+ }
for (i = 0; i < pos; i++) if ((ret = find_entry_by_id( dir, list[i], root )))
return ret;
return find_entry_default( dir, root );
@@ -254,7 +262,7 @@
/***********************************************************************
* find_pe_resource [internal]
*/
-static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
+static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff, DWORD flags )
{
union
{
@@ -356,7 +364,7 @@
TRACE("No resid entry found\n" );
goto done;
}
- resPtr = find_entry_language( resPtr, resDir );
+ resPtr = find_entry_language( resPtr, resDir, flags );
if ( !resPtr )
{
TRACE("No default language entry found\n" );
@@ -393,7 +401,7 @@
/***********************************************************************
* find_version_resource [internal]
*/
-static DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset )
+static DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset, DWORD flags
)
{
DWORD magic = read_xx_header( lzfd );
@@ -403,7 +411,7 @@
if (!find_ne_resource( lzfd, reslen, offset )) magic = 0;
break;
case IMAGE_NT_SIGNATURE:
- if (!find_pe_resource( lzfd, reslen, offset )) magic = 0;
+ if (!find_pe_resource( lzfd, reslen, offset, flags )) magic = 0;
break;
}
return magic;
@@ -607,7 +615,7 @@
*/
DWORD WINAPI GetFileVersionInfoSizeW( LPCWSTR filename, LPDWORD handle )
{
- return GetFileVersionInfoSizeExW( 0, filename, handle );
+ return GetFileVersionInfoSizeExW( FILE_VER_GET_LOCALISED, filename, handle );
}
/***********************************************************************
@@ -615,7 +623,7 @@
*/
DWORD WINAPI GetFileVersionInfoSizeA( LPCSTR filename, LPDWORD handle )
{
- return GetFileVersionInfoSizeExA( 0, filename, handle );
+ return GetFileVersionInfoSizeExA( FILE_VER_GET_LOCALISED, filename, handle );
}
/******************************************************************************
@@ -642,19 +650,27 @@
SetLastError(ERROR_BAD_PATHNAME);
return 0;
}
- if (flags)
- FIXME("flags 0x%x ignored\n", flags);
+ if (flags & ~FILE_VER_GET_LOCALISED)
+ FIXME("flags 0x%x ignored\n", flags & ~FILE_VER_GET_LOCALISED);
if ((lzfd = LZOpenFileW( (LPWSTR)filename, &ofs, OF_READ )) != HFILE_ERROR)
{
- magic = find_version_resource( lzfd, &len, &offset );
+ magic = find_version_resource( lzfd, &len, &offset, flags );
LZClose( lzfd );
}
if ((magic == 1) && (hModule = LoadLibraryExW( filename, 0,
LOAD_LIBRARY_AS_DATAFILE )))
{
- HRSRC hRsrc = FindResourceW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
- (LPWSTR)VS_FILE_INFO );
+ HRSRC hRsrc = NULL;
+ if (!(flags & FILE_VER_GET_LOCALISED))
+ {
+ LANGID english = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
+ hRsrc = FindResourceExW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
+ (LPWSTR)VS_FILE_INFO, english );
+ }
+ if (!hRsrc)
+ hRsrc = FindResourceW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
+ (LPWSTR)VS_FILE_INFO );
if (hRsrc)
{
magic = IMAGE_NT_SIGNATURE;
@@ -741,12 +757,12 @@
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
- if (flags)
- FIXME("flags 0x%x ignored\n", flags);
+ if (flags & ~FILE_VER_GET_LOCALISED)
+ FIXME("flags 0x%x ignored\n", flags & ~FILE_VER_GET_LOCALISED);
if ((lzfd = LZOpenFileW( (LPWSTR)filename, &ofs, OF_READ )) != HFILE_ERROR)
{
- if ((magic = find_version_resource( lzfd, &len, &offset )) > 1)
+ if ((magic = find_version_resource( lzfd, &len, &offset, flags )) >
1)
{
LZSeek( lzfd, offset, 0 /* SEEK_SET */ );
len = LZRead( lzfd, data, min( len, datasize ) );
@@ -756,8 +772,16 @@
if ((magic == 1) && (hModule = LoadLibraryExW( filename, 0,
LOAD_LIBRARY_AS_DATAFILE )))
{
- HRSRC hRsrc = FindResourceW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
- (LPWSTR)VS_FILE_INFO );
+ HRSRC hRsrc = NULL;
+ if (!(flags & FILE_VER_GET_LOCALISED))
+ {
+ LANGID english = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
+ hRsrc = FindResourceExW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
+ (LPWSTR)VS_FILE_INFO, english );
+ }
+ if (!hRsrc)
+ hRsrc = FindResourceW( hModule, MAKEINTRESOURCEW(VS_VERSION_INFO),
+ (LPWSTR)VS_FILE_INFO );
if (hRsrc)
{
HGLOBAL hMem = LoadResource( hModule, hRsrc );
@@ -825,7 +849,7 @@
*/
BOOL WINAPI GetFileVersionInfoW( LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID
data )
{
- return GetFileVersionInfoExW(0, filename, handle, datasize, data);
+ return GetFileVersionInfoExW(FILE_VER_GET_LOCALISED, filename, handle, datasize,
data);
}
/***********************************************************************
@@ -833,7 +857,7 @@
*/
BOOL WINAPI GetFileVersionInfoA( LPCSTR filename, DWORD handle, DWORD datasize, LPVOID
data )
{
- return GetFileVersionInfoExA(0, filename, handle, datasize, data);
+ return GetFileVersionInfoExA(FILE_VER_GET_LOCALISED, filename, handle, datasize,
data);
}
/***********************************************************************
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 4 01:47:19 2017
@@ -192,7 +192,7 @@
reactos/dll/win32/usp10 # Synced to WineStaging-2.9
reactos/dll/win32/uxtheme # Forked
reactos/dll/win32/vbscript # Synced to WineStaging-2.9
-reactos/dll/win32/version # Synced to WineStaging-2.2
+reactos/dll/win32/version # Synced to WineStaging-2.9
reactos/dll/win32/vssapi # Synced to WineStaging-1.9.11
reactos/dll/win32/wbemdisp # Synced to WineStaging-2.2
reactos/dll/win32/wbemprox # Synced to WineStaging-2.2