msi 2: Validate MsiQueryProductCode parameters
James Hawkins
truiken at gmail.com
Tue Jun 26 18:30:40 CDT 2007
Hi,
Changelog:
* Validate MsiQueryProductCode parameters.
dlls/msi/msi.c | 9 ++++++---
dlls/msi/tests/msi.c | 15 +++------------
2 files changed, 9 insertions(+), 15 deletions(-)
--
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 2042695..05d3bbf 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -764,13 +764,16 @@ INSTALLSTATE WINAPI MsiQueryProductState
UINT rc;
INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
HKEY hkey = 0;
- static const WCHAR szWindowsInstaller[] = {
- 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 };
DWORD sz;
+ static const int GUID_LEN = 38;
+ static const WCHAR szWindowsInstaller[] = {
+ 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0
+ };
+
TRACE("%s\n", debugstr_w(szProduct));
- if (!szProduct)
+ if (!szProduct || !*szProduct || lstrlenW(szProduct) != GUID_LEN)
return INSTALLSTATE_INVALIDARG;
rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index d905824..06c7276 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -347,24 +347,15 @@ static void test_MsiQueryProductState(vo
/* empty prodcode */
state = MsiQueryProductStateA("");
- todo_wine
- {
- ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* garbage prodcode */
state = MsiQueryProductStateA("garbage");
- todo_wine
- {
- ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* guid without brackets */
state = MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D");
- todo_wine
- {
- ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* guid with brackets */
state = MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");
--
1.4.1
More information about the wine-patches
mailing list