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
1f302856
Commit
1f302856
authored
Feb 27, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Feb 28, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advpack: Factor out loading the program files directory.
parent
7787ca61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
23 deletions
+22
-23
advpack.c
dlls/advpack/tests/advpack.c
+22
-23
No files found.
dlls/advpack/tests/advpack.c
View file @
1f302856
...
...
@@ -35,6 +35,22 @@ static HRESULT (WINAPI *pOpenINFEngine)(PCSTR,PCSTR,DWORD,HINF*,PVOID);
static
HRESULT
(
WINAPI
*
pTranslateInfString
)(
LPSTR
,
LPSTR
,
LPSTR
,
LPSTR
,
LPSTR
,
DWORD
,
LPDWORD
,
LPVOID
);
static
HRESULT
(
WINAPI
*
pTranslateInfStringEx
)(
HINF
,
PCSTR
,
PCSTR
,
PCSTR
,
PSTR
,
DWORD
,
PDWORD
,
PVOID
);
static
CHAR
PROG_FILES
[
MAX_PATH
];
static
DWORD
PROG_FILES_LEN
;
static
void
get_progfiles_dir
(
void
)
{
HKEY
hkey
;
DWORD
size
=
MAX_PATH
;
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
&
hkey
);
RegQueryValueExA
(
hkey
,
"ProgramFilesDir"
,
NULL
,
NULL
,
(
LPBYTE
)
PROG_FILES
,
&
size
);
RegCloseKey
(
hkey
);
lstrcatA
(
PROG_FILES
,
TEST_STRING1
);
PROG_FILES_LEN
=
lstrlenA
(
PROG_FILES
)
+
1
;
}
static
BOOL
init_function_pointers
(
void
)
{
HMODULE
hAdvPack
=
LoadLibraryA
(
"advpack.dll"
);
...
...
@@ -247,20 +263,8 @@ static void translateinfstring_test()
if
(
hr
==
ERROR_SUCCESS
)
{
HKEY
key
;
DWORD
len
=
MAX_PATH
;
char
cmpbuffer
[
MAX_PATH
];
LONG
res
=
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
&
key
);
if
(
res
==
ERROR_SUCCESS
)
{
res
=
RegQueryValueExA
(
key
,
"ProgramFilesDir"
,
NULL
,
NULL
,
(
LPBYTE
)
cmpbuffer
,
&
len
);
if
(
res
==
ERROR_SUCCESS
)
{
strcat
(
cmpbuffer
,
TEST_STRING1
);
ok
(
!
strcmp
(
buffer
,
cmpbuffer
),
"Expected '%s', got '%s'
\n
"
,
cmpbuffer
,
buffer
);
ok
(
dwSize
==
(
strlen
(
cmpbuffer
)
+
1
),
"Expected size %d, got %ld
\n
"
,
strlen
(
cmpbuffer
)
+
1
,
dwSize
);
}
RegCloseKey
(
key
);
}
ok
(
!
strcmp
(
buffer
,
PROG_FILES
),
"Expected '%s', got '%s'
\n
"
,
PROG_FILES
,
buffer
);
ok
(
dwSize
==
PROG_FILES_LEN
,
"Expected size %ld, got %ld
\n
"
,
PROG_FILES_LEN
,
dwSize
);
}
buffer
[
0
]
=
0
;
...
...
@@ -281,17 +285,11 @@ static void translateinfstring_test()
static
void
translateinfstringex_test
(
void
)
{
HINF
hinf
;
HKEY
hkey
;
HRESULT
hr
;
char
buffer
[
MAX_PATH
];
char
progfiles
[
MAX_PATH
];
DWORD
size
=
MAX_PATH
;
create_inf_file
();
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
&
hkey
);
RegQueryValueExA
(
hkey
,
"ProgramFilesDir"
,
NULL
,
NULL
,
(
LPBYTE
)
progfiles
,
&
size
);
lstrcatA
(
progfiles
,
TEST_STRING1
);
/* need to see if there are any flags */
...
...
@@ -381,9 +379,8 @@ static void translateinfstringex_test(void)
hr
=
pTranslateInfStringEx
(
hinf
,
"c:
\\
test.inf"
,
"Options.NTx86"
,
"InstallDir"
,
buffer
,
size
,
&
size
,
NULL
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %ld
\n
"
,
hr
);
ok
(
!
strcmp
(
buffer
,
progfiles
),
"Expected %s, got %s
\n
"
,
progfiles
,
buffer
);
ok
(
size
==
lstrlenA
(
progfiles
)
+
1
,
"Expected size %i, got %ld
\n
"
,
lstrlenA
(
progfiles
)
+
1
,
size
);
ok
(
!
strcmp
(
buffer
,
PROG_FILES
),
"Expected %s, got %s
\n
"
,
PROG_FILES
,
buffer
);
ok
(
size
==
PROG_FILES_LEN
,
"Expected size %ld, got %ld
\n
"
,
PROG_FILES_LEN
,
size
);
/* close the INF again */
hr
=
pCloseINFEngine
(
hinf
);
...
...
@@ -397,6 +394,8 @@ START_TEST(advpack)
if
(
!
init_function_pointers
())
return
;
get_progfiles_dir
();
version_test
();
delnode_test
();
translateinfstring_test
();
...
...
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