Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8e541c8a
Commit
8e541c8a
authored
Jul 20, 2005
by
Paul Vriens
Committed by
Alexandre Julliard
Jul 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for VerQueryValue[AW].
Don't convert the struct to a win16 one in GetFileVersionInfoA. Convert the struct to win16 in VerQueryValueA (for now).
parent
47c09063
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
27 deletions
+53
-27
info.c
dlls/version/info.c
+9
-20
info.c
dlls/version/tests/info.c
+44
-7
No files found.
dlls/version/info.c
View file @
8e541c8a
...
...
@@ -564,6 +564,9 @@ DWORD WINAPI GetFileVersionInfoSizeW( LPCWSTR filename, LPDWORD handle )
DWORD
WINAPI
GetFileVersionInfoSizeA
(
LPCSTR
filename
,
LPDWORD
handle
)
{
UNICODE_STRING
filenameW
;
DWORD
retval
;
TRACE
(
"(%s,%p)
\n
"
,
debugstr_a
(
filename
),
handle
);
if
(
filename
)
RtlCreateUnicodeStringFromAsciiz
(
&
filenameW
,
filename
);
else
filenameW
.
Buffer
=
NULL
;
retval
=
GetFileVersionInfoSizeW
(
filenameW
.
Buffer
,
handle
);
...
...
@@ -609,14 +612,9 @@ BOOL WINAPI GetFileVersionInfoA( LPCSTR filename, DWORD handle,
}
}
if
(
datasize
>=
sizeof
(
VS_VERSION_INFO_STRUCT16
)
&&
datasize
>=
((
VS_VERSION_INFO_STRUCT16
*
)
data
)
->
wLength
&&
!
VersionInfoIs16
(
data
)
)
{
/* convert resource from PE format to NE format */
ConvertVersionInfo32To16
(
(
VS_VERSION_INFO_STRUCT32
*
)
data
,
(
VS_VERSION_INFO_STRUCT16
*
)
data
);
}
/* Don't convert a possible win32 to a win16 stucture, Windows always uses win32
* for storing the structure on a unicode enabled system
*/
SetLastError
(
0
);
return
TRUE
;
...
...
@@ -769,19 +767,10 @@ DWORD WINAPI VerQueryValueA( LPVOID pBlock, LPCSTR lpSubBlock,
if
(
!
VersionInfoIs16
(
info
)
)
{
INT
len
;
LPWSTR
wide_str
;
DWORD
give
;
/* <lawson_whitney@juno.com> Feb 2001 */
/* AOL 5.0 does this, expecting to get this: */
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpSubBlock
,
-
1
,
NULL
,
0
);
wide_str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
lpSubBlock
,
-
1
,
wide_str
,
len
);
/* FIXME : The conversion is maybe a bit overkill, we only need 1 value */
give
=
VerQueryValueW
(
pBlock
,
wide_str
,
lplpBuffer
,
puLen
);
HeapFree
(
GetProcessHeap
(),
0
,
wide_str
);
return
give
;
ConvertVersionInfo32To16
(
(
VS_VERSION_INFO_STRUCT32
*
)
info
,
(
VS_VERSION_INFO_STRUCT16
*
)
info
);
}
return
VersionInfo16_QueryValue
(
info
,
lpSubBlock
,
lplpBuffer
,
puLen
);
...
...
dlls/version/tests/info.c
View file @
8e541c8a
...
...
@@ -235,15 +235,27 @@ static void test_info(void)
#endif
}
static
void
test_
unicode
(
void
)
static
void
test_
32bit_win
(
void
)
{
DWORD
hdlA
,
retvalA
;
DWORD
hdlW
,
retvalW
;
BOOL
retA
,
retW
;
PVOID
pVersionInfoA
=
NULL
;
PVOID
pVersionInfoW
=
NULL
;
char
mypathA
[
MAX_PATH
]
=
""
;
char
*
pBufA
;
WCHAR
*
pBufW
;
UINT
uiLength
;
char
mypathA
[
MAX_PATH
];
WCHAR
mypathW
[
MAX_PATH
];
char
varfileinfoA
[]
=
"
\\\\
VarFileInfo
\\\\
Translation"
;
WCHAR
varfileinfoW
[]
=
{
'\\'
,
'\\'
,
'V'
,
'a'
,
'r'
,
'F'
,
'i'
,
'l'
,
'e'
,
'I'
,
'n'
,
'f'
,
'o'
,
'\\'
,
'\\'
,
'T'
,
'r'
,
'a'
,
'n'
,
's'
,
'l'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
char
FileDescriptionA
[]
=
"
\\\\
StringFileInfo
\\\\
040904E4
\\\\
FileDescription"
;
WCHAR
FileDescriptionW
[]
=
{
'\\'
,
'\\'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
'F'
,
'i'
,
'l'
,
'e'
,
'I'
,
'n'
,
'f'
,
'o'
,
'\\'
,
'\\'
,
'0'
,
'4'
,
'0'
,
'9'
,
'0'
,
'4'
,
'e'
,
'4'
,
'\\'
,
'\\'
,
'F'
,
'i'
,
'l'
,
'e'
,
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
char
WineFileDescriptionA
[]
=
"Wine version test"
;
WCHAR
WineFileDescriptionW
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
' '
,
'v'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
' '
,
't'
,
'e'
,
's'
,
't'
,
0
};
/* If we call GetFileVersionInfoA on a system that supports Unicode (NT/W2K/XP/W2K3 by default)
* then the versioninfo will contain Unicode strings.
...
...
@@ -274,10 +286,32 @@ static void test_unicode(void)
ok
(
retvalA
==
retvalW
,
"The size of the struct should be the same for both A/W calls, it is (%ld) vs. (%ld)
\n
"
,
retvalA
,
retvalW
);
todo_wine
{
ok
(
!
memcmp
(
pVersionInfoA
,
pVersionInfoW
,
retvalA
),
"Both structs should be the same, they aren't
\n
"
);
}
ok
(
!
memcmp
(
pVersionInfoA
,
pVersionInfoW
,
retvalA
),
"Both structs should be the same, they aren't
\n
"
);
/* The structs are the same but that will mysteriously change with the next calls on Windows (not on Wine).
* The structure on windows is way bigger then needed, so there must be something to it. As we do not
* seem to need this bigger structure, we can leave that as is.
* The change is in this not needed part.
*
* Although the structures contain Unicode strings, VerQueryValueA will return normal strings,
* VerQueryValueW will return Unicode ones.
*/
retA
=
VerQueryValueA
(
pVersionInfoA
,
varfileinfoA
,
(
LPVOID
*
)
&
pBufA
,
&
uiLength
);
ok
(
retA
,
"VerQueryValueA failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
retA
=
VerQueryValueA
(
pVersionInfoA
,
FileDescriptionA
,
(
LPVOID
*
)
&
pBufA
,
&
uiLength
);
ok
(
retA
,
"VerQueryValueA failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
ok
(
!
lstrcmpA
(
WineFileDescriptionA
,
pBufA
),
"FileDescription should have been 'Wine version test'
\n
"
);
/* And the W-way */
retW
=
VerQueryValueW
(
pVersionInfoW
,
varfileinfoW
,
(
LPVOID
*
)
&
pBufW
,
&
uiLength
);
ok
(
retW
,
"VerQueryValueW failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
retW
=
VerQueryValueW
(
pVersionInfoW
,
FileDescriptionW
,
(
LPVOID
*
)
&
pBufW
,
&
uiLength
);
ok
(
retW
,
"VerQueryValueW failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
ok
(
!
lstrcmpW
(
WineFileDescriptionW
,
pBufW
),
"FileDescription should have been 'Wine version test' (unicode)
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
pVersionInfoA
);
HeapFree
(
GetProcessHeap
(),
0
,
pVersionInfoW
);
...
...
@@ -287,5 +321,8 @@ START_TEST(info)
{
test_info_size
();
test_info
();
test_unicode
();
/* Test GetFileVersionInfoSize[AW] and GetFileVersionInfo[AW] on a 32 bit windows executable */
trace
(
"Testing 32 bit windows application
\n
"
);
test_32bit_win
();
}
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