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
e804e9a5
Commit
e804e9a5
authored
Feb 13, 2017
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Feb 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version/tests: Add tests for GetFileVersionInfoEx.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8e1335b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
0 deletions
+101
-0
info.c
dlls/version/tests/info.c
+101
-0
No files found.
dlls/version/tests/info.c
View file @
e804e9a5
/*
* Copyright (C) 2004 Stefan Leichter
* Copyright (C) 2017 Akihiro Sagawa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -23,7 +24,9 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "winver.h"
#include "verrsrc.h"
#include "wine/test.h"
#define MY_LAST_ERROR ((DWORD)-1)
...
...
@@ -624,6 +627,103 @@ static void test_extra_block(void)
HeapFree
(
GetProcessHeap
(),
0
,
ver
);
}
static
void
test_GetFileVersionInfoEx
(
void
)
{
char
*
ver
,
*
p
;
BOOL
ret
;
UINT
size
,
translation
,
i
;
HMODULE
mod
;
BOOL
(
WINAPI
*
pGetFileVersionInfoExW
)(
DWORD
,
LPCWSTR
,
DWORD
,
DWORD
,
LPVOID
);
DWORD
(
WINAPI
*
pGetFileVersionInfoSizeExW
)(
DWORD
,
LPCWSTR
,
LPDWORD
);
const
LANGID
lang
=
GetUserDefaultUILanguage
();
const
LANGID
english
=
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
);
const
WORD
unicode
=
1200
;
/* = UNICODE */
const
WCHAR
kernel32W
[]
=
{
'k'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
const
DWORD
test_flags
[]
=
{
0
,
FILE_VER_GET_LOCALISED
,
FILE_VER_GET_NEUTRAL
,
FILE_VER_GET_LOCALISED
|
FILE_VER_GET_NEUTRAL
,
0xdeadbeef
,
/* invalid value (ignored) */
};
char
desc
[
MAX_PATH
];
size
=
GetFileVersionInfoSizeW
(
kernel32W
,
NULL
);
ok
(
size
,
"GetFileVersionInfoSize(kernel32) error %u
\n
"
,
GetLastError
());
ver
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
assert
(
ver
);
ret
=
GetFileVersionInfoW
(
kernel32W
,
0
,
size
,
ver
);
ok
(
ret
,
"GetFileVersionInfo error %u
\n
"
,
GetLastError
());
ret
=
VerQueryValueA
(
ver
,
"
\\
VarFileInfo
\\
Translation"
,
(
void
**
)
&
p
,
&
size
);
translation
=
*
(
UINT
*
)
p
;
ok
(
ret
,
"VerQueryValue error %u
\n
"
,
GetLastError
());
ok
(
size
==
4
,
"VerQueryValue returned %u, expected 4
\n
"
,
size
);
/* test default version resource */
todo_wine_if
(
lang
!=
english
)
ok
(
LOWORD
(
translation
)
==
lang
,
"got %u, expected lang is %u
\n
"
,
LOWORD
(
translation
),
lang
);
todo_wine
ok
(
HIWORD
(
translation
)
==
unicode
,
"got %u, expected codepage is %u
\n
"
,
HIWORD
(
translation
),
unicode
);
HeapFree
(
GetProcessHeap
(),
0
,
ver
);
mod
=
GetModuleHandleA
(
"version.dll"
);
assert
(
mod
);
/* prefer W-version as A-version is not available on Windows 7 */
pGetFileVersionInfoExW
=
(
void
*
)
GetProcAddress
(
mod
,
"GetFileVersionInfoExW"
);
pGetFileVersionInfoSizeExW
=
(
void
*
)
GetProcAddress
(
mod
,
"GetFileVersionInfoSizeExW"
);
if
(
!
pGetFileVersionInfoExW
&&
!
pGetFileVersionInfoSizeExW
)
{
win_skip
(
"GetFileVersionInfoEx family is not available
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
test_flags
)
/
sizeof
(
test_flags
[
0
]);
i
++
)
{
size
=
pGetFileVersionInfoSizeExW
(
test_flags
[
i
],
kernel32W
,
NULL
);
ok
(
size
,
"[%u] GetFileVersionInfoSizeEx(kernel32) error %u
\n
"
,
i
,
GetLastError
());
ver
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
assert
(
ver
);
ret
=
pGetFileVersionInfoExW
(
test_flags
[
i
],
kernel32W
,
0
,
size
,
ver
);
ok
(
ret
,
"[%u] GetFileVersionInfoEx error %u
\n
"
,
i
,
GetLastError
());
ret
=
VerQueryValueA
(
ver
,
"
\\
VarFileInfo
\\
Translation"
,
(
void
**
)
&
p
,
&
size
);
ok
(
ret
,
"[%u] VerQueryValue error %u
\n
"
,
i
,
GetLastError
());
ok
(
size
==
4
,
"[%u] VerQueryValue returned %u, expected 4
\n
"
,
i
,
size
);
translation
=
*
(
UINT
*
)
p
;
/* test MUI version resource */
todo_wine_if
((
test_flags
[
i
]
&
FILE_VER_GET_LOCALISED
)
&&
lang
!=
english
)
if
(
test_flags
[
i
]
&
FILE_VER_GET_LOCALISED
)
ok
(
LOWORD
(
translation
)
==
lang
,
"[%u] got %u, expected lang is %u
\n
"
,
i
,
LOWORD
(
translation
),
lang
);
else
ok
(
LOWORD
(
translation
)
==
english
,
"[%u] got %u, expected lang is %u
\n
"
,
i
,
LOWORD
(
translation
),
english
);
todo_wine
ok
(
HIWORD
(
translation
)
==
unicode
,
"[%u] got %u, expected codepage is %u
\n
"
,
i
,
HIWORD
(
translation
),
unicode
);
/* test string info using translation info */
size
=
0
;
sprintf
(
desc
,
"
\\
StringFileInfo
\\
%04x%04x
\\
FileDescription"
,
LOWORD
(
translation
),
HIWORD
(
translation
));
ret
=
VerQueryValueA
(
ver
,
desc
,
(
void
**
)
&
p
,
&
size
);
ok
(
ret
,
"[%u] VerQueryValue error %u
\n
"
,
i
,
GetLastError
());
ok
(
size
==
strlen
(
p
)
+
1
,
"[%u] VerQueryValue returned %u
\n
"
,
i
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
ver
);
}
return
;
}
START_TEST
(
info
)
{
test_info_size
();
...
...
@@ -631,4 +731,5 @@ START_TEST(info)
test_32bit_win
();
test_VerQueryValueA
();
test_extra_block
();
test_GetFileVersionInfoEx
();
}
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