From cc0716b65d18871f3124a02dcbb2c717a6c38c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 11 Oct 2006 23:11:59 +0000 Subject: [PATCH] Send right security descriptor to InitializeObjectAttributes, so ntoskrnl won't fail The code was working because we never tried to call RegCreateKeyEx with a security descriptor... svn path=/trunk/; revision=24491 --- reactos/dll/win32/advapi32/reg/reg.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/advapi32/reg/reg.c b/reactos/dll/win32/advapi32/reg/reg.c index bc6552379b0..f83ab44ba56 100644 --- a/reactos/dll/win32/advapi32/reg/reg.c +++ b/reactos/dll/win32/advapi32/reg/reg.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/advapi32/reg/reg.c @@ -981,6 +980,9 @@ RegCreateKeyExA (HKEY hKey, TRACE("RegCreateKeyExA() called\n"); + if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) + return ERROR_INVALID_USER_BUFFER; + /* get the real parent key */ Status = MapDefaultKey (&ParentKey, hKey); @@ -1002,7 +1004,7 @@ RegCreateKeyExA (HKEY hKey, &SubKeyString, OBJ_CASE_INSENSITIVE, (HANDLE)ParentKey, - (PSECURITY_DESCRIPTOR)lpSecurityAttributes); + lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); Status = CreateNestedKey(phkResult, &Attributes, (lpClass == NULL)? NULL : &ClassString, @@ -1051,6 +1053,9 @@ RegCreateKeyExW (HKEY hKey, TRACE("RegCreateKeyExW() called\n"); + if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) + return ERROR_INVALID_USER_BUFFER; + /* get the real parent key */ Status = MapDefaultKey (&ParentKey, hKey); @@ -1068,7 +1073,7 @@ RegCreateKeyExW (HKEY hKey, &SubKeyString, OBJ_CASE_INSENSITIVE, (HANDLE)ParentKey, - (PSECURITY_DESCRIPTOR)lpSecurityAttributes); + lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); Status = CreateNestedKey(phkResult, &Attributes, (lpClass == NULL)? NULL : &ClassString,