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
ac9e4219
Commit
ac9e4219
authored
Jul 07, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Jul 10, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advpack: Add tests for different configurations of INF filenames and
working directories for install functions.
parent
58c64190
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
160 additions
and
9 deletions
+160
-9
install.c
dlls/advpack/install.c
+17
-8
install.c
dlls/advpack/tests/install.c
+143
-1
No files found.
dlls/advpack/install.c
View file @
ac9e4219
...
...
@@ -43,6 +43,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack);
#define ADV_HRESULT(x) ((x & SPAPI_ERROR) ? HRESULT_FROM_SPAPI(x) : HRESULT_FROM_WIN32(x))
#define ADV_SUCCESS 0
#define ADV_FAILURE 1
/* contains information about a specific install instance */
typedef
struct
_ADVInfo
{
...
...
@@ -636,6 +639,9 @@ INT WINAPI LaunchINFSectionA(HWND hWnd, HINSTANCE hInst, LPSTR cmdline, INT show
TRACE
(
"(%p, %p, %s, %i)
\n
"
,
hWnd
,
hInst
,
debugstr_a
(
cmdline
),
show
);
if
(
!
cmdline
)
return
ADV_FAILURE
;
RtlCreateUnicodeStringFromAsciiz
(
&
cmd
,
cmdline
);
hr
=
LaunchINFSectionW
(
hWnd
,
hInst
,
cmd
.
Buffer
,
show
);
...
...
@@ -657,8 +663,8 @@ INT WINAPI LaunchINFSectionA(HWND hWnd, HINSTANCE hInst, LPSTR cmdline, INT show
* show [I] How the window should be shown.
*
* RETURNS
* Success:
S_OK
.
* Failure:
S_FALSE
* Success:
ADV_SUCCESS
.
* Failure:
ADV_FAILURE.
*
* NOTES
* INF - Filename of the INF to launch.
...
...
@@ -681,7 +687,7 @@ INT WINAPI LaunchINFSectionW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT sho
TRACE
(
"(%p, %p, %s, %d)
\n
"
,
hWnd
,
hInst
,
debugstr_w
(
cmdline
),
show
);
if
(
!
cmdline
)
return
E_INVALIDARG
;
return
ADV_FAILURE
;
cmdline_copy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
cmdline
)
+
1
)
*
sizeof
(
WCHAR
));
cmdline_ptr
=
cmdline_copy
;
...
...
@@ -710,7 +716,7 @@ done:
install_release
(
&
info
);
HeapFree
(
GetProcessHeap
(),
0
,
cmdline_copy
);
return
hr
;
return
SUCCEEDED
(
hr
)
?
ADV_SUCCESS
:
ADV_FAILURE
;
}
/***********************************************************************
...
...
@@ -725,6 +731,9 @@ HRESULT WINAPI LaunchINFSectionExA(HWND hWnd, HINSTANCE hInst, LPSTR cmdline, IN
TRACE
(
"(%p, %p, %s, %i)
\n
"
,
hWnd
,
hInst
,
debugstr_a
(
cmdline
),
show
);
if
(
!
cmdline
)
return
ADV_FAILURE
;
RtlCreateUnicodeStringFromAsciiz
(
&
cmd
,
cmdline
);
hr
=
LaunchINFSectionExW
(
hWnd
,
hInst
,
cmd
.
Buffer
,
show
);
...
...
@@ -746,8 +755,8 @@ HRESULT WINAPI LaunchINFSectionExA(HWND hWnd, HINSTANCE hInst, LPSTR cmdline, IN
* show [I] How the window should be shown.
*
* RETURNS
* Success:
S_OK
.
* Failure:
E_FAIL
.
* Success:
ADV_SUCCESS
.
* Failure:
ADV_FAILURE
.
*
* NOTES
* INF - Filename of the INF to launch.
...
...
@@ -771,7 +780,7 @@ HRESULT WINAPI LaunchINFSectionExW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, I
TRACE
(
"(%p, %p, %s, %d)
\n
"
,
hWnd
,
hInst
,
debugstr_w
(
cmdline
),
show
);
if
(
!
cmdline
)
return
E_INVALIDARG
;
return
ADV_FAILURE
;
cmdline_copy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
cmdline
)
+
1
)
*
sizeof
(
WCHAR
));
cmdline_ptr
=
cmdline_copy
;
...
...
@@ -802,7 +811,7 @@ HRESULT WINAPI LaunchINFSectionExW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, I
done:
HeapFree
(
GetProcessHeap
(),
0
,
cmdline_copy
);
return
hr
;
return
SUCCEEDED
(
hr
)
?
ADV_SUCCESS
:
ADV_FAILURE
;
}
HRESULT
launch_exe
(
LPCWSTR
cmd
,
LPCWSTR
dir
,
HANDLE
*
phEXE
)
...
...
dlls/advpack/tests/install.c
View file @
ac9e4219
...
...
@@ -25,6 +25,10 @@
/* function pointers */
static
HRESULT
(
WINAPI
*
pRunSetupCommand
)(
HWND
,
LPCSTR
,
LPCSTR
,
LPCSTR
,
LPCSTR
,
HANDLE
*
,
DWORD
,
LPVOID
);
static
HRESULT
(
WINAPI
*
pLaunchINFSection
)(
HWND
,
HINSTANCE
,
LPSTR
,
INT
);
static
HRESULT
(
WINAPI
*
pLaunchINFSectionEx
)(
HWND
,
HINSTANCE
,
LPSTR
,
INT
);
static
char
CURR_DIR
[
MAX_PATH
];
static
BOOL
init_function_pointers
()
{
...
...
@@ -33,8 +37,10 @@ static BOOL init_function_pointers()
return
FALSE
;
pRunSetupCommand
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"RunSetupCommand"
);
pLaunchINFSection
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"LaunchINFSection"
);
pLaunchINFSectionEx
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"LaunchINFSectionEx"
);
if
(
!
pRunSetupCommand
)
if
(
!
pRunSetupCommand
||
!
pLaunchINFSection
||
!
pLaunchINFSectionEx
)
return
FALSE
;
return
TRUE
;
...
...
@@ -48,10 +54,38 @@ static BOOL is_spapi_err(DWORD err)
return
(((
err
&
SPAPI_MASK
)
^
SPAPI_PREFIX
)
==
0
);
}
static
void
append_str
(
char
**
str
,
const
char
*
data
)
{
sprintf
(
*
str
,
data
);
*
str
+=
strlen
(
*
str
);
}
static
void
create_inf_file
(
LPSTR
filename
)
{
char
data
[
1024
];
char
*
ptr
=
data
;
DWORD
dwNumberOfBytesWritten
;
HANDLE
hf
=
CreateFile
(
filename
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
append_str
(
&
ptr
,
"[Version]
\n
"
);
append_str
(
&
ptr
,
"Signature=
\"
$Chicago$
\"\n
"
);
append_str
(
&
ptr
,
"AdvancedINF=2.5
\n
"
);
append_str
(
&
ptr
,
"[DefaultInstall]
\n
"
);
append_str
(
&
ptr
,
"RegisterOCXs=RegisterOCXsSection
\n
"
);
append_str
(
&
ptr
,
"[RegisterOCXsSection]
\n
"
);
append_str
(
&
ptr
,
"%%11%%
\\
ole32.dll
\n
"
);
WriteFile
(
hf
,
data
,
ptr
-
data
,
&
dwNumberOfBytesWritten
,
NULL
);
CloseHandle
(
hf
);
}
static
void
test_RunSetupCommand
()
{
HRESULT
hr
;
HANDLE
hexe
;
char
path
[
MAX_PATH
];
char
dir
[
MAX_PATH
];
/* try an invalid cmd name */
hr
=
pRunSetupCommand
(
NULL
,
NULL
,
"Install"
,
"Dir"
,
"Title"
,
NULL
,
0
,
NULL
);
...
...
@@ -90,6 +124,111 @@ static void test_RunSetupCommand()
ok
(
hr
==
S_ASYNCHRONOUS
,
"Expected S_ASYNCHRONOUS, got %ld
\n
"
,
hr
);
ok
(
hexe
!=
NULL
,
"Expected hexe to be non-NULL
\n
"
);
ok
(
TerminateProcess
(
hexe
,
0
),
"Expected TerminateProcess to succeed
\n
"
);
CreateDirectoryA
(
"one"
,
NULL
);
create_inf_file
(
"one
\\
test.inf"
);
/* try a full path to the INF, with working dir provided */
lstrcpy
(
path
,
CURR_DIR
);
lstrcat
(
path
,
"
\\
one
\\
test.inf"
);
lstrcpy
(
dir
,
CURR_DIR
);
lstrcat
(
dir
,
"
\\
one"
);
hr
=
pRunSetupCommand
(
NULL
,
path
,
"DefaultInstall"
,
dir
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %ld
\n
"
,
hr
);
/* try a full path to the INF, NULL working dir */
hr
=
pRunSetupCommand
(
NULL
,
path
,
"DefaultInstall"
,
NULL
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld
\n
"
,
hr
);
/* try a full path to the INF, empty working dir */
hr
=
pRunSetupCommand
(
NULL
,
path
,
"DefaultInstall"
,
""
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %ld
\n
"
,
hr
);
/* try a relative path to the INF, with working dir provided */
hr
=
pRunSetupCommand
(
NULL
,
"one
\\
test.inf"
,
"DefaultInstall"
,
dir
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %ld
\n
"
,
hr
);
/* try a relative path to the INF, NULL working dir */
hr
=
pRunSetupCommand
(
NULL
,
"one
\\
test.inf"
,
"DefaultInstall"
,
NULL
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld
\n
"
,
hr
);
/* try a relative path to the INF, empty working dir */
hr
=
pRunSetupCommand
(
NULL
,
"one
\\
test.inf"
,
"DefaultInstall"
,
""
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %ld
\n
"
,
hr
);
/* try only the INF filename, with working dir provided */
hr
=
pRunSetupCommand
(
NULL
,
"test.inf"
,
"DefaultInstall"
,
dir
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld
\n
"
,
hr
);
/* try only the INF filename, NULL working dir */
hr
=
pRunSetupCommand
(
NULL
,
"test.inf"
,
"DefaultInstall"
,
NULL
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld
\n
"
,
hr
);
/* try only the INF filename, empty working dir */
hr
=
pRunSetupCommand
(
NULL
,
"test.inf"
,
"DefaultInstall"
,
""
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
todo_wine
{
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld
\n
"
,
hr
);
}
DeleteFileA
(
"one
\\
test.inf"
);
RemoveDirectoryA
(
"one"
);
create_inf_file
(
"test.inf"
);
/* try INF file in the current directory, working directory provided */
hr
=
pRunSetupCommand
(
NULL
,
"test.inf"
,
"DefaultInstall"
,
CURR_DIR
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld
\n
"
,
hr
);
/* try INF file in the current directory, NULL working directory */
hr
=
pRunSetupCommand
(
NULL
,
"test.inf"
,
"DefaultInstall"
,
NULL
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld
\n
"
,
hr
);
/* try INF file in the current directory, empty working directory */
hr
=
pRunSetupCommand
(
NULL
,
"test.inf"
,
"DefaultInstall"
,
CURR_DIR
,
"Title"
,
NULL
,
RSC_FLAG_INF
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld
\n
"
,
hr
);
}
static
void
test_LaunchINFSection
()
{
HRESULT
hr
;
char
cmdline
[
MAX_PATH
];
/* try an invalid cmdline */
hr
=
pLaunchINFSection
(
NULL
,
NULL
,
NULL
,
0
);
ok
(
hr
==
1
,
"Expected 1, got %ld
\n
"
,
hr
);
CreateDirectoryA
(
"one"
,
NULL
);
create_inf_file
(
"one
\\
test.inf"
);
/* try a full path to the INF */
lstrcpy
(
cmdline
,
CURR_DIR
);
lstrcat
(
cmdline
,
"
\\
"
);
lstrcat
(
cmdline
,
"one
\\
test.inf,DefaultInstall,,4"
);
hr
=
pLaunchINFSection
(
NULL
,
NULL
,
cmdline
,
0
);
ok
(
hr
==
0
,
"Expected 0, got %ld
\n
"
,
hr
);
DeleteFileA
(
"one
\\
test.inf"
);
RemoveDirectoryA
(
"one"
);
create_inf_file
(
"test.inf"
);
/* try just the INF filename */
hr
=
pLaunchINFSection
(
NULL
,
NULL
,
"test.inf,DefaultInstall,4,0"
,
0
);
todo_wine
{
ok
(
hr
==
0
,
"Expected 0, got %ld
\n
"
,
hr
);
}
DeleteFileA
(
"test.inf"
);
}
START_TEST
(
install
)
...
...
@@ -97,5 +236,8 @@ START_TEST(install)
if
(
!
init_function_pointers
())
return
;
GetCurrentDirectoryA
(
MAX_PATH
,
CURR_DIR
);
test_RunSetupCommand
();
test_LaunchINFSection
();
}
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