- Add missing OBJ_KERNEL_HANDLE and close handles accordingly
CORE-10207

svn path=/trunk/; revision=69523
This commit is contained in:
Thomas Faber 2015-10-14 09:26:56 +00:00
parent c8e6c59728
commit ac979ac9f9

View file

@ -594,7 +594,7 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&TcpipRegistryPath, &TcpipRegistryPath,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
0, 0,
NULL); NULL);
@ -1074,7 +1074,7 @@ OpenRegistryKey( PNDIS_STRING RegistryPath, PHANDLE RegHandle ) {
OBJECT_ATTRIBUTES Attributes; OBJECT_ATTRIBUTES Attributes;
NTSTATUS Status; NTSTATUS Status;
InitializeObjectAttributes(&Attributes, RegistryPath, OBJ_CASE_INSENSITIVE, 0, 0); InitializeObjectAttributes(&Attributes, RegistryPath, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, 0, 0);
Status = ZwOpenKey(RegHandle, KEY_ALL_ACCESS, &Attributes); Status = ZwOpenKey(RegHandle, KEY_ALL_ACCESS, &Attributes);
return Status; return Status;
} }
@ -1198,8 +1198,8 @@ cleanup:
RtlFreeUnicodeString( &RootDevice ); RtlFreeUnicodeString( &RootDevice );
RtlFreeUnicodeString( &LinkageKeyName ); RtlFreeUnicodeString( &LinkageKeyName );
RtlFreeUnicodeString( &DescKeyName ); RtlFreeUnicodeString( &DescKeyName );
if( LinkageKey ) NtClose( LinkageKey ); if( LinkageKey ) ZwClose( LinkageKey );
if( DescKey ) NtClose( DescKey ); if( DescKey ) ZwClose( DescKey );
TI_DbgPrint(DEBUG_DATALINK,("Returning %x\n", Status)); TI_DbgPrint(DEBUG_DATALINK,("Returning %x\n", Status));
@ -1242,7 +1242,7 @@ static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
Kbio = ExAllocatePool( NonPagedPool, KbioLength ); Kbio = ExAllocatePool( NonPagedPool, KbioLength );
if( !Kbio ) { if( !Kbio ) {
TI_DbgPrint(DEBUG_DATALINK,("Failed to allocate memory\n")); TI_DbgPrint(DEBUG_DATALINK,("Failed to allocate memory\n"));
NtClose( EnumKey ); ZwClose( EnumKey );
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
} }
@ -1251,7 +1251,7 @@ static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
if( !NT_SUCCESS(Status) ) { if( !NT_SUCCESS(Status) ) {
TI_DbgPrint(DEBUG_DATALINK,("Couldn't enum key child %d\n", i)); TI_DbgPrint(DEBUG_DATALINK,("Couldn't enum key child %d\n", i));
NtClose( EnumKey ); ZwClose( EnumKey );
ExFreePool( Kbio ); ExFreePool( Kbio );
return Status; return Status;
} }
@ -1265,14 +1265,14 @@ static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
Status = CheckForDeviceDesc Status = CheckForDeviceDesc
( &EnumKeyName, &TargetKeyName, Name, DeviceDesc ); ( &EnumKeyName, &TargetKeyName, Name, DeviceDesc );
if( NT_SUCCESS(Status) ) { if( NT_SUCCESS(Status) ) {
NtClose( EnumKey ); ZwClose( EnumKey );
ExFreePool( Kbio ); ExFreePool( Kbio );
return Status; return Status;
} else Status = STATUS_SUCCESS; } else Status = STATUS_SUCCESS;
} }
} }
NtClose( EnumKey ); ZwClose( EnumKey );
ExFreePool( Kbio ); ExFreePool( Kbio );
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }