Author: hpoussin Date: Thu Oct 12 03:11:59 2006 New Revision: 24491
URL: http://svn.reactos.org/svn/reactos?rev=24491&view=rev Log: 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...
Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c
Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg.... ============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c Thu Oct 12 03:11:59 2006 @@ -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 @@
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 @@ &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 @@
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 @@ &SubKeyString, OBJ_CASE_INSENSITIVE, (HANDLE)ParentKey, - (PSECURITY_DESCRIPTOR)lpSecurityAttributes); + lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); Status = CreateNestedKey(phkResult, &Attributes, (lpClass == NULL)? NULL : &ClassString,