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
34d50c1e
Commit
34d50c1e
authored
Feb 24, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Feb 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Validate the parameters of MsiSourceListAddMediaDisk.
parent
1fced5cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
46 deletions
+29
-46
source.c
dlls/msi/source.c
+11
-1
source.c
dlls/msi/tests/source.c
+18
-45
No files found.
dlls/msi/source.c
View file @
34d50c1e
...
...
@@ -978,6 +978,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
HKEY
mediakey
;
UINT
rc
;
WCHAR
szIndex
[
10
];
WCHAR
squished_pc
[
GUID_SIZE
];
static
const
WCHAR
fmt
[]
=
{
'%'
,
'i'
,
0
};
static
const
WCHAR
disk_fmt
[]
=
{
'%'
,
's'
,
';'
,
'%'
,
's'
,
0
};
static
const
WCHAR
empty
[
1
]
=
{
0
};
...
...
@@ -989,7 +990,16 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
debugstr_w
(
szUserSid
),
dwContext
,
dwOptions
,
dwDiskId
,
debugstr_w
(
szVolumeLabel
),
debugstr_w
(
szDiskPrompt
));
if
(
!
szProduct
||
lstrlenW
(
szProduct
)
>
39
)
if
(
!
szProduct
||
!
squash_guid
(
szProduct
,
squished_pc
))
return
ERROR_INVALID_PARAMETER
;
if
(
dwOptions
!=
MSICODE_PRODUCT
&&
dwOptions
!=
MSICODE_PATCH
)
return
ERROR_INVALID_PARAMETER
;
if
((
szVolumeLabel
&&
!*
szVolumeLabel
)
||
(
szDiskPrompt
&&
!*
szDiskPrompt
))
return
ERROR_INVALID_PARAMETER
;
if
((
dwContext
&
MSIINSTALLCONTEXT_MACHINE
)
&&
szUserSid
)
return
ERROR_INVALID_PARAMETER
;
if
(
dwOptions
&
MSICODE_PATCH
)
...
...
dlls/msi/tests/source.c
View file @
34d50c1e
...
...
@@ -1965,30 +1965,21 @@ static void test_MsiSourceListAddMediaDisk(void)
/* empty szProductCodeOrPatchCode */
r
=
MsiSourceListAddMediaDiskA
(
""
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
1
,
"label"
,
"prompt"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* garbage szProductCodeOrPatchCode */
r
=
MsiSourceListAddMediaDiskA
(
"garbage"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
1
,
"label"
,
"prompt"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* guid without brackets */
r
=
MsiSourceListAddMediaDiskA
(
"51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
1
,
"label"
,
"prompt"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* guid with brackets */
r
=
MsiSourceListAddMediaDiskA
(
"{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}"
,
...
...
@@ -2002,33 +1993,24 @@ static void test_MsiSourceListAddMediaDisk(void)
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
|
MSISOURCETYPE_NETWORK
,
1
,
"label"
,
"prompt"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* dwOptions has MSISOURCETYPE_URL */
r
=
MsiSourceListAddMediaDiskA
(
"{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
|
MSISOURCETYPE_URL
,
1
,
"label"
,
"prompt"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* dwOptions has MSISOURCETYPE_MEDIA */
r
=
MsiSourceListAddMediaDiskA
(
"{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
|
MSISOURCETYPE_MEDIA
,
1
,
"label"
,
"prompt"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
...
...
@@ -2119,11 +2101,8 @@ static void test_MsiSourceListAddMediaDisk(void)
r
=
MsiSourceListAddMediaDiskA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
1
,
"etikett"
,
""
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* update dwDiskId 1, szVolumeLable is NULL */
r
=
MsiSourceListAddMediaDiskA
(
prodcode
,
usersid
,
...
...
@@ -2140,11 +2119,8 @@ static void test_MsiSourceListAddMediaDisk(void)
r
=
MsiSourceListAddMediaDiskA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
1
,
""
,
"provoquer"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* szUserSid is NULL */
r
=
MsiSourceListAddMediaDiskA
(
prodcode
,
NULL
,
...
...
@@ -2248,11 +2224,8 @@ static void test_MsiSourceListAddMediaDisk(void)
r
=
MsiSourceListAddMediaDiskA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_MACHINE
,
MSICODE_PRODUCT
,
1
,
"label"
,
"prompt"
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
RegDeleteValueA
(
media
,
"1"
);
RegDeleteKeyA
(
media
,
""
);
...
...
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