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
3e56d78f
Commit
3e56d78f
authored
Jun 29, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Jul 02, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Validate MsiSourceListGetInfo parameters.
parent
1ff40d15
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
41 deletions
+23
-41
source.c
dlls/msi/source.c
+13
-1
source.c
dlls/msi/tests/source.c
+10
-40
No files found.
dlls/msi/source.c
View file @
3e56d78f
...
...
@@ -214,11 +214,23 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
TRACE
(
"%s %s
\n
"
,
debugstr_w
(
szProduct
),
debugstr_w
(
szProperty
));
if
(
!
szProduct
||
lstrlenW
(
szProduct
)
>
39
)
if
(
!
szProduct
||
!*
szProduct
)
return
ERROR_INVALID_PARAMETER
;
if
(
lstrlenW
(
szProduct
)
!=
GUID_SIZE
-
1
||
(
szProduct
[
0
]
!=
'{'
&&
szProduct
[
GUID_SIZE
-
2
]
!=
'}'
))
return
ERROR_INVALID_PARAMETER
;
if
(
szValue
&&
!
pcchValue
)
return
ERROR_INVALID_PARAMETER
;
if
(
dwContext
!=
MSIINSTALLCONTEXT_USERMANAGED
&&
dwContext
!=
MSIINSTALLCONTEXT_USERUNMANAGED
&&
dwContext
!=
MSIINSTALLCONTEXT_MACHINE
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
szProperty
)
return
ERROR_INVALID_PARAMETER
;
if
(
dwOptions
==
MSICODE_PATCH
)
{
...
...
dlls/msi/tests/source.c
View file @
3e56d78f
...
...
@@ -118,34 +118,22 @@ static void test_MsiSourceListGetInfo(void)
/* empty szProductCodeOrPatchCode */
r
=
MsiSourceListGetInfoA
(
""
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
=
MsiSourceListGetInfoA
(
"garbage"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
);
/* szProductCodeOrPatchCode */
r
=
MsiSourceListGetInfoA
(
"garbage"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
=
MsiSourceListGetInfoA
(
"51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
=
MsiSourceListGetInfoA
(
"{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
...
...
@@ -155,42 +143,27 @@ static void test_MsiSourceListGetInfo(void)
/* same length as guid, but random */
r
=
MsiSourceListGetInfoA
(
"ADKD-2KSDFF2-DKK1KNFJASD9GLKWME-1I3KAD"
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
);
/* invalid context */
r
=
MsiSourceListGetInfoA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_NONE
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
);
/* another invalid context */
r
=
MsiSourceListGetInfoA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_ALLUSERMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
);
/* yet another invalid context */
r
=
MsiSourceListGetInfoA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_ALL
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
);
/* mix two valid contexts */
r
=
MsiSourceListGetInfoA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_USERMANAGED
|
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
INSTALLPROPERTY_PACKAGENAME
,
NULL
,
NULL
);
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
);
/* invalid option */
r
=
MsiSourceListGetInfoA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
...
...
@@ -200,10 +173,7 @@ static void test_MsiSourceListGetInfo(void)
/* NULL property */
r
=
MsiSourceListGetInfoA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSICODE_PRODUCT
,
NULL
,
NULL
,
NULL
);
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
);
/* empty property */
r
=
MsiSourceListGetInfoA
(
prodcode
,
usersid
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
...
...
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