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
76137e55
Commit
76137e55
authored
Nov 02, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Nov 02, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parameter handling in MsiSetTargetPath, and add a test for it.
parent
fd4a2003
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
26 deletions
+41
-26
install.c
dlls/msi/install.c
+17
-26
package.c
dlls/msi/tests/package.c
+24
-0
No files found.
dlls/msi/install.c
View file @
76137e55
...
...
@@ -296,31 +296,23 @@ UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder,
/***********************************************************************
* MsiSetTargetPathA (MSI.@)
*/
UINT
WINAPI
MsiSetTargetPathA
(
MSIHANDLE
hInstall
,
LPCSTR
szFolder
,
LPCSTR
szFolderPath
)
UINT
WINAPI
MsiSetTargetPathA
(
MSIHANDLE
hInstall
,
LPCSTR
szFolder
,
LPCSTR
szFolderPath
)
{
LPWSTR
szwFolder
;
LPWSTR
szwFolderPath
;
UINT
rc
;
LPWSTR
szwFolder
=
NULL
,
szwFolderPath
=
NULL
;
UINT
rc
=
ERROR_OUTOFMEMORY
;
if
(
!
szFolder
)
return
ERROR_FUNCTION_FAILED
;
if
(
hInstall
==
0
)
return
ERROR_FUNCTION_FAILED
;
if
(
!
szFolder
||
!
szFolderPath
)
return
ERROR_INVALID_PARAMETER
;
szwFolder
=
strdupAtoW
(
szFolder
);
if
(
!
szwFolder
)
return
ERROR_FUNCTION_FAILED
;
szwFolderPath
=
strdupAtoW
(
szFolderPath
);
if
(
!
szwFolderPath
)
{
msi_free
(
szwFolder
);
return
ERROR_FUNCTION_FAILED
;
}
if
(
!
szwFolder
||
!
szwFolderPath
)
goto
end
;
rc
=
MsiSetTargetPathW
(
hInstall
,
szwFolder
,
szwFolderPath
);
rc
=
MsiSetTargetPathW
(
hInstall
,
szwFolder
,
szwFolderPath
);
end:
msi_free
(
szwFolder
);
msi_free
(
szwFolderPath
);
...
...
@@ -342,12 +334,6 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
TRACE
(
"(%p %s %s)
\n
"
,
package
,
debugstr_w
(
szFolder
),
debugstr_w
(
szFolderPath
));
if
(
package
==
NULL
)
return
ERROR_INVALID_HANDLE
;
if
(
szFolderPath
[
0
]
==
0
)
return
ERROR_FUNCTION_FAILED
;
attrib
=
GetFileAttributesW
(
szFolderPath
);
if
(
attrib
!=
INVALID_FILE_ATTRIBUTES
&&
(
!
(
attrib
&
FILE_ATTRIBUTE_DIRECTORY
)
||
...
...
@@ -356,9 +342,8 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
return
ERROR_FUNCTION_FAILED
;
path
=
resolve_folder
(
package
,
szFolder
,
FALSE
,
FALSE
,
&
folder
);
if
(
!
path
)
return
ERROR_
INVALID_PARAMETER
;
return
ERROR_
DIRECTORY
;
if
(
attrib
==
INVALID_FILE_ATTRIBUTES
)
{
...
...
@@ -416,7 +401,13 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
TRACE
(
"(%s %s)
\n
"
,
debugstr_w
(
szFolder
),
debugstr_w
(
szFolderPath
));
if
(
!
szFolder
||
!
szFolderPath
)
return
ERROR_INVALID_PARAMETER
;
package
=
msihandle2msiinfo
(
hInstall
,
MSIHANDLETYPE_PACKAGE
);
if
(
!
package
)
return
ERROR_INVALID_HANDLE
;
ret
=
MSI_SetTargetPathW
(
package
,
szFolder
,
szFolderPath
);
msiobj_release
(
&
package
->
hdr
);
return
ret
;
...
...
dlls/msi/tests/package.c
View file @
76137e55
...
...
@@ -326,6 +326,29 @@ static void test_gettargetpath_bad(void)
MsiCloseHandle
(
hpkg
);
}
void
test_settargetpath_bad
(
void
)
{
MSIHANDLE
hpkg
;
UINT
r
;
hpkg
=
package_from_db
(
create_package_db
());
ok
(
hpkg
,
"failed to create package
\n
"
);
r
=
MsiSetTargetPath
(
0
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"wrong return val
\n
"
);
r
=
MsiSetTargetPath
(
0
,
"boo"
,
"C:
\\
bogusx"
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"wrong return val
\n
"
);
r
=
MsiSetTargetPath
(
hpkg
,
"boo"
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"wrong return val
\n
"
);
r
=
MsiSetTargetPath
(
hpkg
,
"boo"
,
"c:
\\
bogusx"
);
ok
(
r
==
ERROR_DIRECTORY
,
"wrong return val
\n
"
);
MsiCloseHandle
(
hpkg
);
}
void
test_condition
(
void
)
{
MSICONDITION
r
;
...
...
@@ -696,5 +719,6 @@ START_TEST(package)
test_getsourcepath
();
test_doaction
();
test_gettargetpath_bad
();
test_settargetpath_bad
();
test_props
();
}
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