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
ef1da879
Commit
ef1da879
authored
Jul 26, 2005
by
Paul Vriens
Committed by
Alexandre Julliard
Jul 26, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup and some additional tests.
parent
2d088c02
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
34 deletions
+74
-34
info.c
dlls/version/tests/info.c
+74
-34
No files found.
dlls/version/tests/info.c
View file @
ef1da879
...
...
@@ -238,83 +238,123 @@ static void test_info(void)
static
void
test_32bit_win
(
void
)
{
DWORD
hdlA
,
retvalA
;
DWORD
hdlW
,
retvalW
;
DWORD
hdlW
,
retvalW
=
0
;
BOOL
retA
,
retW
;
PVOID
pVersionInfoA
=
NULL
;
PVOID
pVersionInfoW
=
NULL
;
char
*
pBufA
;
WCHAR
*
pBufW
;
UINT
uiLength
;
UINT
uiLength
A
,
uiLengthW
;
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
rootA
[]
=
"
\\
"
;
WCHAR
rootW
[]
=
{
'\\'
,
0
};
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
WineVarFileInfoA
[]
=
{
0x09
,
0x04
,
0xE4
,
0x04
};
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
};
BOOL
is_unicode_enabled
=
TRUE
;
/* If we call GetFileVersionInfoA on a system that supports Unicode (NT/W2K/XP/W2K3 by default)
* then the versioninfo will contain Unicode strings.
* Wine however always converts a VersionInfo32 to VersionInfo16 when called through GetFileVersionInfoA
* regardless of Windows version
*
The test is to call both the A and W versions, which should have the same Version Information,
* on systems that support both calls.
*
Part of the test is to call both the A and W versions, which should have the same Version Information
*
for some requests,
on systems that support both calls.
*/
/* First get the versioninfo via the W versions */
GetModuleFileNameW
(
NULL
,
mypathW
,
MAX_PATH
);
if
(
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
trace
(
"GetModuleFileNameW not existing on this platform, skipping
rest of test
\n
"
);
return
;
trace
(
"GetModuleFileNameW not existing on this platform, skipping
comparison between A- and W-calls
\n
"
);
is_unicode_enabled
=
FALSE
;
}
retvalW
=
GetFileVersionInfoSizeW
(
mypathW
,
&
hdlW
);
pVersionInfoW
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
retvalW
);
retW
=
GetFileVersionInfoW
(
mypathW
,
0
,
retvalW
,
pVersionInfoW
);
if
(
is_unicode_enabled
)
{
retvalW
=
GetFileVersionInfoSizeW
(
mypathW
,
&
hdlW
);
pVersionInfoW
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
retvalW
);
retW
=
GetFileVersionInfoW
(
mypathW
,
0
,
retvalW
,
pVersionInfoW
);
}
/* And now via the A versions */
GetModuleFileNameA
(
NULL
,
mypathA
,
MAX_PATH
);
retvalA
=
GetFileVersionInfoSizeA
(
mypathA
,
&
hdlA
);
pVersionInfoA
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
retvalA
);
retA
=
GetFileVersionInfoA
(
mypathA
,
0
,
retvalA
,
pVersionInfoA
);
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
);
ok
(
!
memcmp
(
pVersionInfoA
,
pVersionInfoW
,
retvalA
),
"Both structs should be the same, they aren't
\n
"
);
if
(
is_unicode_enabled
)
{
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
);
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.
* The change i
n the Windows structure i
s in this not needed part.
*
* Although the structures contain Unicode strings, VerQueryValueA will return normal strings,
* VerQueryValueW will
return Unicode ones
.
* Although the structures contain Unicode strings, VerQueryValueA will
always
return normal strings,
* VerQueryValueW will
always return Unicode ones. (That means everything returned for StringFileInfo requests)
.
*/
retA
=
VerQueryValueA
(
pVersionInfoA
,
varfileinfoA
,
(
LPVOID
*
)
&
pBufA
,
&
uiLength
);
/* Get the VS_FIXEDFILEINFO information, this must be the same for both A- and W-Calls */
retA
=
VerQueryValueA
(
pVersionInfoA
,
rootA
,
(
LPVOID
*
)
&
pBufA
,
&
uiLengthA
);
ok
(
retA
,
"VerQueryValueA failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
ok
(
uiLengthA
==
sizeof
(
VS_FIXEDFILEINFO
),
"Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct (%d)
\n
"
,
uiLengthA
,
sizeof
(
VS_FIXEDFILEINFO
));
if
(
is_unicode_enabled
)
{
retW
=
VerQueryValueW
(
pVersionInfoW
,
rootW
,
(
LPVOID
*
)
&
pBufW
,
&
uiLengthW
);
ok
(
retW
,
"VerQueryValueW failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
ok
(
uiLengthA
==
sizeof
(
VS_FIXEDFILEINFO
),
"Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct (%d)
\n
"
,
uiLengthA
,
sizeof
(
VS_FIXEDFILEINFO
));
ok
(
uiLengthA
==
uiLengthW
,
"The size of VS_FIXEDFILEINFO should be the same for both A/W calls, it is (%d) vs. (%d)
\n
"
,
uiLengthA
,
uiLengthW
);
ok
(
!
memcmp
(
pBufA
,
pBufW
,
uiLengthA
),
"Both values should be the same, they aren't
\n
"
);
}
retA
=
VerQueryValueA
(
pVersionInfoA
,
FileDescriptionA
,
(
LPVOID
*
)
&
pBufA
,
&
uiLength
);
/* Get some VarFileInfo information, this must be the same for both A- and W-Calls */
retA
=
VerQueryValueA
(
pVersionInfoA
,
varfileinfoA
,
(
LPVOID
*
)
&
pBufA
,
&
uiLengthA
);
ok
(
retA
,
"VerQueryValueA failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
ok
(
!
lstrcmpA
(
WineFileDescriptionA
,
pBufA
),
"FileDescription should have been 'Wine version test'
\n
"
);
ok
(
!
memcmp
(
pBufA
,
WineVarFileInfoA
,
uiLengthA
),
"The VarFileInfo should have matched 0904e404 (non case sensitive)
\n
"
);
if
(
is_unicode_enabled
)
{
retW
=
VerQueryValueW
(
pVersionInfoW
,
varfileinfoW
,
(
LPVOID
*
)
&
pBufW
,
&
uiLengthW
);
ok
(
retW
,
"VerQueryValueW failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
ok
(
uiLengthA
==
uiLengthW
,
"The size of the VarFileInfo information should be the same for both A/W calls, it is (%d) vs. (%d)
\n
"
,
uiLengthA
,
uiLengthW
);
ok
(
!
memcmp
(
pBufA
,
pBufW
,
uiLengthA
),
"Both values should be the same, they aren't
\n
"
);
}
/*
And the W-way
*/
/*
Get some StringFileInfo information, this will be ANSI for A-Calls and Unicode for W-Calls
*/
retW
=
VerQueryValueW
(
pVersionInfoW
,
varfileinfoW
,
(
LPVOID
*
)
&
pBufW
,
&
uiLength
);
ok
(
retW
,
"VerQueryValueW failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
retA
=
VerQueryValueA
(
pVersionInfoA
,
FileDescriptionA
,
(
LPVOID
*
)
&
pBufA
,
&
uiLengthA
);
ok
(
retA
,
"VerQueryValueA failed: GetLastError = 0x%08lx
\n
"
,
GetLastError
());
ok
(
!
lstrcmpA
(
WineFileDescriptionA
,
pBufA
),
"FileDescription should have been 'Wine version test'
\n
"
);
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
"
);
if
(
is_unicode_enabled
)
{
retW
=
VerQueryValueW
(
pVersionInfoW
,
FileDescriptionW
,
(
LPVOID
*
)
&
pBufW
,
&
uiLengthW
);
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
);
if
(
is_unicode_enabled
)
HeapFree
(
GetProcessHeap
(),
0
,
pVersionInfoW
);
}
START_TEST
(
info
)
...
...
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