Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7811de1b
Commit
7811de1b
authored
Mar 23, 2017
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Mar 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version: Add support for FILE_VER_GET_LOCALISED flag.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e0b4a352
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
29 deletions
+53
-29
version.c
dlls/version/version.c
+53
-29
No files found.
dlls/version/version.c
View file @
7811de1b
...
...
@@ -127,22 +127,30 @@ static inline int push_language( WORD *list, int pos, WORD lang )
* 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 @@ static BOOL find_ne_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
/***********************************************************************
* 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 @@ static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
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 @@ static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
/***********************************************************************
* 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 @@ static DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset )
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 @@ typedef struct
*/
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 GetFileVersionInfoSizeW( LPCWSTR filename, LPDWORD handle )
*/
DWORD
WINAPI
GetFileVersionInfoSizeA
(
LPCSTR
filename
,
LPDWORD
handle
)
{
return
GetFileVersionInfoSizeExA
(
0
,
filename
,
handle
);
return
GetFileVersionInfoSizeExA
(
FILE_VER_GET_LOCALISED
,
filename
,
handle
);
}
/******************************************************************************
...
...
@@ -642,19 +650,27 @@ DWORD WINAPI GetFileVersionInfoSizeExW( DWORD flags, LPCWSTR filename, LPDWORD h
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
;
...
...
@@ -736,12 +752,12 @@ BOOL WINAPI GetFileVersionInfoExW( DWORD flags, LPCWSTR filename, DWORD handle,
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
)
);
...
...
@@ -751,8 +767,16 @@ BOOL WINAPI GetFileVersionInfoExW( DWORD flags, LPCWSTR filename, DWORD handle,
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
);
...
...
@@ -820,7 +844,7 @@ BOOL WINAPI GetFileVersionInfoExA( DWORD flags, LPCSTR filename, DWORD handle, D
*/
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
);
}
/***********************************************************************
...
...
@@ -828,7 +852,7 @@ BOOL WINAPI GetFileVersionInfoW( LPCWSTR filename, DWORD handle, DWORD datasize,
*/
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
);
}
/***********************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment