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
d6bfc17b
Commit
d6bfc17b
authored
Jan 13, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Jan 13, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advpack: Add initial tests for AdvInstallFile.
parent
3e8b588d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
files.c
dlls/advpack/tests/files.c
+51
-0
No files found.
dlls/advpack/tests/files.c
View file @
d6bfc17b
...
...
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <windows.h>
#include <advpub.h>
#include <fci.h>
#include "wine/test.h"
...
...
@@ -30,6 +31,7 @@
/* function pointers */
HMODULE
hAdvPack
;
static
HRESULT
(
WINAPI
*
pExtractFiles
)(
LPCSTR
,
LPCSTR
,
DWORD
,
LPCSTR
,
LPVOID
,
DWORD
);
static
HRESULT
(
WINAPI
*
pAdvInstallFile
)(
HWND
,
LPCSTR
,
LPCSTR
,
LPCSTR
,
LPCSTR
,
DWORD
,
DWORD
);
CHAR
CURR_DIR
[
MAX_PATH
];
...
...
@@ -40,6 +42,7 @@ static void init_function_pointers()
if
(
hAdvPack
)
{
pExtractFiles
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"ExtractFiles"
);
pAdvInstallFile
=
(
void
*
)
GetProcAddress
(
hAdvPack
,
"AdvInstallFile"
);
}
}
...
...
@@ -372,6 +375,53 @@ static void test_ExtractFiles()
ok
(
!
RemoveDirectoryA
(
"dest
\\
testdir"
),
"Exepected dest
\\
testdir to not exist
\n
"
);
}
static
void
test_AdvInstallFile
(
void
)
{
HRESULT
hr
;
char
CURR_DIR
[
MAX_PATH
];
char
destFolder
[
MAX_PATH
];
GetCurrentDirectoryA
(
MAX_PATH
,
CURR_DIR
);
lstrcpyA
(
destFolder
,
CURR_DIR
);
lstrcatA
(
destFolder
,
"
\\
"
);
lstrcatA
(
destFolder
,
"dest"
);
createTestFile
(
"source.txt"
);
/* try invalid source directory */
hr
=
pAdvInstallFile
(
NULL
,
NULL
,
"source.txt"
,
destFolder
,
"destination.txt"
,
0
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %ld
\n
"
,
hr
);
ok
(
!
DeleteFileA
(
"dest
\\
destination.txt"
),
"Expected dest
\\
destination.txt to not exist
\n
"
);
/* try invalid source file */
hr
=
pAdvInstallFile
(
NULL
,
CURR_DIR
,
NULL
,
destFolder
,
"destination.txt"
,
0
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %ld
\n
"
,
hr
);
ok
(
!
DeleteFileA
(
"dest
\\
destination.txt"
),
"Expected dest
\\
destination.txt to not exist
\n
"
);
/* try invalid destination directory */
hr
=
pAdvInstallFile
(
NULL
,
CURR_DIR
,
"source.txt"
,
NULL
,
"destination.txt"
,
0
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %ld
\n
"
,
hr
);
ok
(
!
DeleteFileA
(
"dest
\\
destination.txt"
),
"Expected dest
\\
destination.txt to not exist
\n
"
);
/* try copying to nonexistent destination directory */
hr
=
pAdvInstallFile
(
NULL
,
CURR_DIR
,
"source.txt"
,
destFolder
,
"destination.txt"
,
0
,
0
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %ld
\n
"
,
hr
);
ok
(
DeleteFileA
(
"dest
\\
destination.txt"
),
"Expected dest
\\
destination.txt to exist
\n
"
);
/* native windows screws up if the source file doesn't exist */
/* test AIF_NOOVERWRITE behavior, asks the user to overwrite if AIF_QUIET is not specified */
createTestFile
(
"dest
\\
destination.txt"
);
hr
=
pAdvInstallFile
(
NULL
,
CURR_DIR
,
"source.txt"
,
destFolder
,
"destination.txt"
,
AIF_NOOVERWRITE
|
AIF_QUIET
,
0
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %ld
\n
"
,
hr
);
ok
(
DeleteFileA
(
"dest
\\
destination.txt"
),
"Expected dest
\\
destination.txt to exist
\n
"
);
ok
(
RemoveDirectoryA
(
"dest"
),
"Expected dest to exist
\n
"
);
DeleteFileA
(
"source.txt"
);
}
START_TEST
(
files
)
{
init_function_pointers
();
...
...
@@ -379,6 +429,7 @@ START_TEST(files)
create_cab_file
();
test_ExtractFiles
();
test_AdvInstallFile
();
delete_test_files
();
}
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