mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:03:12 +00:00
Fixed a crash in NtCreateKey() when an existing key is opened
svn path=/trunk/; revision=1932
This commit is contained in:
parent
2c92d6e39b
commit
553aab4bb7
1 changed files with 39 additions and 69 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: registry.c,v 1.58 2001/05/05 09:31:19 ekohl Exp $
|
/* $Id: registry.c,v 1.59 2001/05/30 14:40:36 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -424,7 +424,7 @@ DPRINT("Creating HKU\n");
|
||||||
NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys;
|
NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys;
|
||||||
NewKey->Name=ExAllocatePool(PagedPool,strlen("User"));
|
NewKey->Name=ExAllocatePool(PagedPool,strlen("User"));
|
||||||
NewKey->NameSize=strlen("User");
|
NewKey->NameSize=strlen("User");
|
||||||
memcpy(NewKey->Name,"Machine",strlen("User"));
|
memcpy(NewKey->Name,"User",strlen("User"));
|
||||||
CmiAddKeyToList(CmiRootKey,NewKey);
|
CmiAddKeyToList(CmiRootKey,NewKey);
|
||||||
CmiUserKey=NewKey;
|
CmiUserKey=NewKey;
|
||||||
|
|
||||||
|
@ -536,17 +536,14 @@ CmShutdownRegistry(VOID)
|
||||||
DPRINT("CmShutdownRegistry()...\n");
|
DPRINT("CmShutdownRegistry()...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtCreateKey(OUT PHANDLE KeyHandle,
|
||||||
NtCreateKey (
|
IN ACCESS_MASK DesiredAccess,
|
||||||
OUT PHANDLE KeyHandle,
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||||
IN ACCESS_MASK DesiredAccess,
|
IN ULONG TitleIndex,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
IN PUNICODE_STRING Class,
|
||||||
IN ULONG TitleIndex,
|
IN ULONG CreateOptions,
|
||||||
IN PUNICODE_STRING Class,
|
OUT PULONG Disposition)
|
||||||
IN ULONG CreateOptions,
|
|
||||||
OUT PULONG Disposition
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID Object;
|
PVOID Object;
|
||||||
|
@ -564,17 +561,24 @@ NtCreateKey (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
DPRINT("RP=%wZ\n",&RemainingPath);
|
DPRINT("RP=%wZ\n",&RemainingPath);
|
||||||
if(RemainingPath.Buffer[0] ==0)
|
if ((RemainingPath.Buffer == NULL) || (RemainingPath.Buffer[0] ==0))
|
||||||
{
|
{
|
||||||
if (Disposition) *Disposition = REG_OPENED_EXISTING_KEY;
|
/* Fail if the key has been deleted */
|
||||||
Status = ObCreateHandle(
|
if (((PKEY_OBJECT)Object)->Flags & KO_MARKED_FOR_DELETE)
|
||||||
PsGetCurrentProcess(),
|
{
|
||||||
Object,
|
ObDereferenceObject(Object);
|
||||||
DesiredAccess,
|
return STATUS_UNSUCCESSFUL;
|
||||||
FALSE,
|
}
|
||||||
KeyHandle
|
if (Disposition)
|
||||||
);
|
*Disposition = REG_OPENED_EXISTING_KEY;
|
||||||
|
Status = ObCreateHandle(PsGetCurrentProcess(),
|
||||||
|
Object,
|
||||||
|
DesiredAccess,
|
||||||
|
FALSE,
|
||||||
|
KeyHandle);
|
||||||
|
DPRINT("Status=%x\n",Status);
|
||||||
ObDereferenceObject(Object);
|
ObDereferenceObject(Object);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
/* if RemainingPath contains \ : must return error */
|
/* if RemainingPath contains \ : must return error */
|
||||||
if((RemainingPath.Buffer[0])=='\\')
|
if((RemainingPath.Buffer[0])=='\\')
|
||||||
|
@ -652,11 +656,8 @@ DPRINT("NCK %S parent=%x\n",RemainingPath.Buffer,Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtDeleteKey(IN HANDLE KeyHandle)
|
||||||
NtDeleteKey (
|
|
||||||
IN HANDLE KeyHandle
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKEY_OBJECT KeyObject;
|
PKEY_OBJECT KeyObject;
|
||||||
|
@ -1040,11 +1041,8 @@ NtEnumerateValueKey (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtFlushKey(IN HANDLE KeyHandle)
|
||||||
NtFlushKey (
|
|
||||||
IN HANDLE KeyHandle
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKEY_OBJECT KeyObject;
|
PKEY_OBJECT KeyObject;
|
||||||
|
@ -1172,40 +1170,15 @@ END FIXME*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
NtOpenKey (
|
IN ACCESS_MASK DesiredAccess,
|
||||||
OUT PHANDLE KeyHandle,
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
IN ACCESS_MASK DesiredAccess,
|
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID Object;
|
PVOID Object;
|
||||||
UNICODE_STRING RemainingPath;
|
UNICODE_STRING RemainingPath;
|
||||||
|
|
||||||
/*
|
|
||||||
if (ObjectAttributes->RootDirectory == HKEY_LOCAL_MACHINE)
|
|
||||||
{
|
|
||||||
Status = ObCreateHandle(
|
|
||||||
PsGetCurrentProcess(),
|
|
||||||
CmiMachineKey,
|
|
||||||
KEY_ALL_ACCESS,
|
|
||||||
FALSE,
|
|
||||||
&ObjectAttributes->RootDirectory
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (ObjectAttributes->RootDirectory == HKEY_USERS)
|
|
||||||
{
|
|
||||||
Status = ObCreateHandle(
|
|
||||||
PsGetCurrentProcess(),
|
|
||||||
CmiUserKey,
|
|
||||||
KEY_ALL_ACCESS,
|
|
||||||
FALSE,
|
|
||||||
&ObjectAttributes->RootDirectory
|
|
||||||
);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
RemainingPath.Buffer=NULL;
|
RemainingPath.Buffer=NULL;
|
||||||
Status = ObFindObject(ObjectAttributes,&Object,&RemainingPath,CmiKeyType);
|
Status = ObFindObject(ObjectAttributes,&Object,&RemainingPath,CmiKeyType);
|
||||||
DPRINT("NTOpenKey : after ObFindObject\n");
|
DPRINT("NTOpenKey : after ObFindObject\n");
|
||||||
|
@ -1834,12 +1807,9 @@ NtInitializeRegistry (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlCheckRegistryKey(IN ULONG RelativeTo,
|
||||||
RtlCheckRegistryKey (
|
IN PWSTR Path)
|
||||||
IN ULONG RelativeTo,
|
|
||||||
IN PWSTR Path
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
HANDLE KeyHandle;
|
HANDLE KeyHandle;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -2116,7 +2086,7 @@ static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
/* Create new key object and put into linked list */
|
/* Create new key object and put into linked list */
|
||||||
DPRINT("COP %s;",cPath);
|
DPRINT("CmiObjectParse %s\n",cPath);
|
||||||
FoundObject = ObCreateObject(NULL,
|
FoundObject = ObCreateObject(NULL,
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2139,7 +2109,7 @@ DPRINT("COP %s;",cPath);
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
NULL,
|
NULL,
|
||||||
UserMode);
|
UserMode);
|
||||||
DPRINT("COP %6.6s ;",FoundObject->Name);
|
DPRINT("CmiObjectParse %s\n",FoundObject->Name);
|
||||||
if (end != NULL)
|
if (end != NULL)
|
||||||
{
|
{
|
||||||
*end = '\\';
|
*end = '\\';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue