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
e806a285
Commit
e806a285
authored
Jul 22, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Jul 22, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Test getting the source path from a package with compressed files.
parent
45f9cb4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
149 additions
and
0 deletions
+149
-0
package.c
dlls/msi/tests/package.c
+141
-0
msidefs.h
include/msidefs.h
+8
-0
No files found.
dlls/msi/tests/package.c
View file @
e806a285
...
...
@@ -5237,12 +5237,30 @@ static void test_complocator(void)
DeleteFileA
(
msifile
);
}
static
void
set_suminfo_prop
(
MSIHANDLE
db
,
DWORD
prop
,
DWORD
val
)
{
MSIHANDLE
summary
;
UINT
r
;
r
=
MsiGetSummaryInformationA
(
db
,
NULL
,
1
,
&
summary
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
prop
,
VT_I4
,
val
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiSummaryInfoPersist
(
summary
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
MsiCloseHandle
(
summary
);
}
static
void
test_MsiGetSourcePath
(
void
)
{
MSIHANDLE
hdb
,
hpkg
;
CHAR
path
[
MAX_PATH
];
CHAR
cwd
[
MAX_PATH
];
CHAR
subsrc
[
MAX_PATH
];
CHAR
sub2
[
MAX_PATH
];
DWORD
size
;
UINT
r
;
...
...
@@ -5253,15 +5271,29 @@ static void test_MsiGetSourcePath(void)
lstrcatA
(
subsrc
,
"subsource"
);
lstrcatA
(
subsrc
,
"
\\
"
);
lstrcpyA
(
sub2
,
subsrc
);
lstrcatA
(
sub2
,
"sub2"
);
lstrcatA
(
sub2
,
"
\\
"
);
/* uncompressed source */
hdb
=
create_package_db
();
ok
(
hdb
,
"failed to create database
\n
"
);
set_suminfo_prop
(
hdb
,
PID_WORDCOUNT
,
0
);
r
=
add_directory_entry
(
hdb
,
"'TARGETDIR', '', 'SourceDir'"
);
ok
(
r
==
S_OK
,
"failed
\n
"
);
r
=
add_directory_entry
(
hdb
,
"'SubDir', 'TARGETDIR', 'subtarget:subsource'"
);
ok
(
r
==
S_OK
,
"failed
\n
"
);
r
=
add_directory_entry
(
hdb
,
"'SubDir2', 'SubDir', 'sub2'"
);
ok
(
r
==
S_OK
,
"failed
\n
"
);
r
=
MsiDatabaseCommit
(
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to commit database
\n
"
);
hpkg
=
package_from_db
(
hdb
);
ok
(
hpkg
,
"failed to create package
\n
"
);
...
...
@@ -5340,6 +5372,15 @@ static void test_MsiGetSourcePath(void)
"Expected path to be unchanged, got
\"
%s
\"\n
"
,
path
);
ok
(
size
==
MAX_PATH
,
"Expected size to be unchanged, got %d
\n
"
,
size
);
/* try SubDir2 */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SubDir2"
,
path
,
&
size
);
ok
(
r
==
ERROR_DIRECTORY
,
"Expected ERROR_DIRECTORY, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
"kiwi"
),
"Expected path to be unchanged, got
\"
%s
\"\n
"
,
path
);
ok
(
size
==
MAX_PATH
,
"Expected size to be unchanged, got %d
\n
"
,
size
);
r
=
MsiDoAction
(
hpkg
,
"CostInitialize"
);
ok
(
r
==
ERROR_SUCCESS
,
"cost init failed
\n
"
);
...
...
@@ -5387,6 +5428,14 @@ static void test_MsiGetSourcePath(void)
ok
(
!
lstrcmpA
(
path
,
subsrc
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
subsrc
,
path
);
ok
(
size
==
lstrlenA
(
subsrc
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
subsrc
),
size
);
/* try SubDir2 after CostInitialize */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SubDir2"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
sub2
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
sub2
,
path
);
ok
(
size
==
lstrlenA
(
sub2
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
sub2
),
size
);
r
=
MsiDoAction
(
hpkg
,
"ResolveSource"
);
ok
(
r
==
ERROR_SUCCESS
,
"file cost failed
\n
"
);
...
...
@@ -5431,6 +5480,14 @@ static void test_MsiGetSourcePath(void)
ok
(
!
lstrcmpA
(
path
,
subsrc
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
subsrc
,
path
);
ok
(
size
==
lstrlenA
(
subsrc
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
subsrc
),
size
);
/* try SubDir2 after ResolveSource */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SubDir2"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
sub2
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
sub2
,
path
);
ok
(
size
==
lstrlenA
(
sub2
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
sub2
),
size
);
r
=
MsiDoAction
(
hpkg
,
"FileCost"
);
ok
(
r
==
ERROR_SUCCESS
,
"file cost failed
\n
"
);
...
...
@@ -5467,6 +5524,14 @@ static void test_MsiGetSourcePath(void)
ok
(
!
lstrcmpA
(
path
,
subsrc
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
subsrc
,
path
);
ok
(
size
==
lstrlenA
(
subsrc
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
subsrc
),
size
);
/* try SubDir2 after FileCost */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SubDir2"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
sub2
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
sub2
,
path
);
ok
(
size
==
lstrlenA
(
sub2
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
sub2
),
size
);
r
=
MsiDoAction
(
hpkg
,
"CostFinalize"
);
ok
(
r
==
ERROR_SUCCESS
,
"file cost failed
\n
"
);
...
...
@@ -5503,6 +5568,14 @@ static void test_MsiGetSourcePath(void)
ok
(
!
lstrcmpA
(
path
,
subsrc
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
subsrc
,
path
);
ok
(
size
==
lstrlenA
(
subsrc
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
subsrc
),
size
);
/* try SubDir2 after CostFinalize */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SubDir2"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
sub2
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
sub2
,
path
);
ok
(
size
==
lstrlenA
(
sub2
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
sub2
),
size
);
/* nonexistent directory */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
...
...
@@ -5553,6 +5626,74 @@ static void test_MsiGetSourcePath(void)
ok
(
size
==
lstrlenA
(
cwd
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
cwd
),
size
);
MsiCloseHandle
(
hpkg
);
/* compressed source */
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_DIRECT
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
set_suminfo_prop
(
hdb
,
PID_WORDCOUNT
,
msidbSumInfoSourceTypeCompressed
);
hpkg
=
package_from_db
(
hdb
);
ok
(
hpkg
,
"failed to create package
\n
"
);
r
=
MsiDoAction
(
hpkg
,
"CostInitialize"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiDoAction
(
hpkg
,
"FileCost"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiDoAction
(
hpkg
,
"CostFinalize"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* try TARGETDIR after CostFinalize */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"TARGETDIR"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
cwd
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
cwd
,
path
);
ok
(
size
==
lstrlenA
(
cwd
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
cwd
),
size
);
/* try SourceDir after CostFinalize */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SourceDir"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
cwd
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
cwd
,
path
);
ok
(
size
==
lstrlenA
(
cwd
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
cwd
),
size
);
/* try SOURCEDIR after CostFinalize */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SOURCEDIR"
,
path
,
&
size
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
path
,
cwd
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
cwd
,
path
);
ok
(
size
==
lstrlenA
(
cwd
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
cwd
),
size
);
}
/* try SubDir after CostFinalize */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SubDir"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmpA
(
path
,
cwd
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
cwd
,
path
);
ok
(
size
==
lstrlenA
(
cwd
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
cwd
),
size
);
}
/* try SubDir2 after CostFinalize */
size
=
MAX_PATH
;
lstrcpyA
(
path
,
"kiwi"
);
r
=
MsiGetSourcePath
(
hpkg
,
"SubDir2"
,
path
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmpA
(
path
,
cwd
),
"Expected
\"
%s
\"
, got
\"
%s
\"\n
"
,
cwd
,
path
);
ok
(
size
==
lstrlenA
(
cwd
),
"Expected %d, got %d
\n
"
,
lstrlenA
(
cwd
),
size
);
}
MsiCloseHandle
(
hpkg
);
DeleteFile
(
msifile
);
}
...
...
include/msidefs.h
View file @
e806a285
...
...
@@ -207,6 +207,14 @@ enum msidbAssemblyAttributes
msidbAssemblyAttributesWin32
=
0x00000001
,
};
enum
msidbSumInfoSourceType
{
msidbSumInfoSourceTypeSFN
=
0x00000001
,
msidbSumInfoSourceTypeCompressed
=
0x00000002
,
msidbSumInfoSourceTypeAdminImage
=
0x00000004
,
msidbSumInfoSourceTypeLUAPackage
=
0x00000008
,
};
/*
* Windows SDK braindamage alert
*
...
...
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