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
fb8db0ac
Commit
fb8db0ac
authored
Mar 22, 2009
by
James Hawkins
Committed by
Alexandre Julliard
Mar 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Don't try to release a NULL record, with tests (Coverity 536).
parent
baf86bd5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
1 deletion
+112
-1
package.c
dlls/msi/package.c
+2
-1
package.c
dlls/msi/tests/package.c
+110
-0
No files found.
dlls/msi/package.c
View file @
fb8db0ac
...
@@ -1345,7 +1345,8 @@ UINT MSI_SetPropertyW( MSIPACKAGE *package, LPCWSTR szName, LPCWSTR szValue)
...
@@ -1345,7 +1345,8 @@ UINT MSI_SetPropertyW( MSIPACKAGE *package, LPCWSTR szName, LPCWSTR szValue)
msiobj_release
(
&
view
->
hdr
);
msiobj_release
(
&
view
->
hdr
);
}
}
msiobj_release
(
&
row
->
hdr
);
if
(
row
)
msiobj_release
(
&
row
->
hdr
);
if
(
rc
==
ERROR_SUCCESS
&&
(
!
lstrcmpW
(
szName
,
cszSourceDir
)))
if
(
rc
==
ERROR_SUCCESS
&&
(
!
lstrcmpW
(
szName
,
cszSourceDir
)))
msi_reset_folders
(
package
,
TRUE
);
msi_reset_folders
(
package
,
TRUE
);
...
...
dlls/msi/tests/package.c
View file @
fb8db0ac
...
@@ -11374,6 +11374,115 @@ static void test_MsiGetProductProperty(void)
...
@@ -11374,6 +11374,115 @@ static void test_MsiGetProductProperty(void)
DeleteFileA
(
msifile
);
DeleteFileA
(
msifile
);
}
}
static
void
test_MsiSetProperty
(
void
)
{
MSIHANDLE
hpkg
,
hdb
,
hrec
;
CHAR
buf
[
MAX_PATH
];
LPCSTR
query
;
DWORD
size
;
UINT
r
;
hpkg
=
package_from_db
(
create_package_db
());
ok
(
hpkg
!=
0
,
"Expected a valid package
\n
"
);
/* invalid hInstall */
r
=
MsiSetPropertyA
(
0
,
"Prop"
,
"Val"
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got %d
\n
"
,
r
);
/* invalid hInstall */
r
=
MsiSetPropertyA
(
0xdeadbeef
,
"Prop"
,
"Val"
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got %d
\n
"
,
r
);
/* szName is NULL */
r
=
MsiSetPropertyA
(
hpkg
,
NULL
,
"Val"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* both szName and szValue are NULL */
r
=
MsiSetPropertyA
(
hpkg
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* szName is empty */
r
=
MsiSetPropertyA
(
hpkg
,
""
,
"Val"
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"Expected ERROR_FUNCTION_FAILED, got %d
\n
"
,
r
);
/* szName is empty and szValue is NULL */
r
=
MsiSetPropertyA
(
hpkg
,
""
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* set a property */
r
=
MsiSetPropertyA
(
hpkg
,
"Prop"
,
"Val"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* get the property */
size
=
MAX_PATH
;
r
=
MsiGetPropertyA
(
hpkg
,
"Prop"
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
"Val"
),
"Expected
\"
Val
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
size
==
3
,
"Expected 3, got %d
\n
"
,
size
);
/* update the property */
r
=
MsiSetPropertyA
(
hpkg
,
"Prop"
,
"Nuvo"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* get the property */
size
=
MAX_PATH
;
r
=
MsiGetPropertyA
(
hpkg
,
"Prop"
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
"Nuvo"
),
"Expected
\"
Nuvo
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
size
==
4
,
"Expected 4, got %d
\n
"
,
size
);
hdb
=
MsiGetActiveDatabase
(
hpkg
);
ok
(
hdb
!=
0
,
"Expected a valid database handle
\n
"
);
/* set prop is not in the _Property table */
query
=
"SELECT * FROM `_Property` WHERE `Property` = 'Prop'"
;
r
=
do_query
(
hdb
,
query
,
&
hrec
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
/* set prop is not in the Property table */
query
=
"SELECT * FROM `Property` WHERE `Property` = 'Prop'"
;
r
=
do_query
(
hdb
,
query
,
&
hrec
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
MsiCloseHandle
(
hdb
);
/* szValue is an empty string */
r
=
MsiSetPropertyA
(
hpkg
,
"Prop"
,
""
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* try to get the property */
size
=
MAX_PATH
;
r
=
MsiGetPropertyA
(
hpkg
,
"Prop"
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
size
==
0
,
"Expected 0, got %d
\n
"
,
size
);
/* reset the property */
r
=
MsiSetPropertyA
(
hpkg
,
"Prop"
,
"BlueTap"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* delete the property */
r
=
MsiSetPropertyA
(
hpkg
,
"Prop"
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* try to get the property */
size
=
MAX_PATH
;
r
=
MsiGetPropertyA
(
hpkg
,
"Prop"
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
size
==
0
,
"Expected 0, got %d
\n
"
,
size
);
MsiCloseHandle
(
hpkg
);
DeleteFileA
(
msifile
);
}
START_TEST
(
package
)
START_TEST
(
package
)
{
{
GetCurrentDirectoryA
(
MAX_PATH
,
CURR_DIR
);
GetCurrentDirectoryA
(
MAX_PATH
,
CURR_DIR
);
...
@@ -11406,4 +11515,5 @@ START_TEST(package)
...
@@ -11406,4 +11515,5 @@ START_TEST(package)
test_access
();
test_access
();
test_emptypackage
();
test_emptypackage
();
test_MsiGetProductProperty
();
test_MsiGetProductProperty
();
test_MsiSetProperty
();
}
}
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