[advapi32] Fix returnvalue of RegOpenKeyA (with tests)
Paul Vriens
Paul.Vriens at xs4all.nl
Wed Jul 5 07:16:59 CDT 2006
Hi,
I thought before going back to NtOpenKey, I'd start with RegOpenKeyA.
I assume more-or-less the same fixes will be needed for RegOpenKeyW and
RegOpenKeyEx*.
Changelog
Fix returnvalue of RegOpenKeyA (with tests)
Cheers,
Paul
---
dlls/advapi32/registry.c | 3 +++
dlls/advapi32/tests/registry.c | 11 +++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c
index e99cce7..ad112aa 100644
--- a/dlls/advapi32/registry.c
+++ b/dlls/advapi32/registry.c
@@ -380,6 +380,9 @@ DWORD WINAPI RegOpenKeyW( HKEY hkey, LPC
*/
DWORD WINAPI RegOpenKeyA( HKEY hkey, LPCSTR name, PHKEY retkey )
{
+ if (!retkey)
+ return ERROR_INVALID_PARAMETER;
+
if (!name || !*name)
{
*retkey = hkey;
diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index 577838d..9a7f640 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -538,6 +538,17 @@ static void test_reg_open_key(void)
ok(hkResult == NULL, "expected hkResult == NULL\n");
}
+ /* Some NULL checks */
+
+ ret = RegOpenKeyA(NULL, NULL, NULL);
+ ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
+
+ ret = RegOpenKeyA(HKEY_CURRENT_USER, NULL, NULL);
+ ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
+
+ ret = RegOpenKeyA(NULL, "Software\\Wine\\Test", NULL);
+ ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
+
/* only send NULL hKey
* the value of hkResult remains unchanged
*/
--
1.4.1
More information about the wine-patches
mailing list