[DRIVERS] Add some missing OBJ_KERNEL_HANDLE (#4493)

Match Zw*() uses. CORE-10207
This commit is contained in:
Serge Gautherie 2022-05-07 21:12:19 +02:00 committed by GitHub
parent b414e1e4d7
commit 46db6573ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 14 deletions

View file

@ -238,7 +238,7 @@ FsRecRegisterFs(IN PDRIVER_OBJECT DriverObject,
RtlInitUnicodeString(&DeviceName, FsName);
InitializeObjectAttributes(&ObjectAttributes,
&DeviceName,
OBJ_CASE_INSENSITIVE,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
0,
NULL);

View file

@ -26,7 +26,7 @@ RegTGetKeyHandle(
InitializeObjectAttributes(
&ObjectAttributes,
&NameString,
OBJ_CASE_INSENSITIVE,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
hRootKey,
NULL
);
@ -276,4 +276,3 @@ RegTGetStringValue(
}
return retval;
} // end RegTGetStringValue()

View file

@ -649,7 +649,7 @@ UDFDismountDevice(
InitializeObjectAttributes ( &ObjectAttributes,
unicodeCdRomDeviceName,
OBJ_CASE_INSENSITIVE,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL );

View file

@ -265,7 +265,7 @@ KspReadMediaCategory(
RtlFreeUnicodeString(&GuidString);
/* initialize object attributes */
InitializeObjectAttributes(&ObjectAttributes, &Path, OBJ_CASE_INSENSITIVE, NULL, NULL);
InitializeObjectAttributes(&ObjectAttributes, &Path, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);
/* open the key */
Status = ZwOpenKey(&hKey, GENERIC_READ, &ObjectAttributes);
@ -839,4 +839,3 @@ KsHandleSizedListQuery(
return STATUS_BUFFER_TOO_SMALL;
}
}

View file

@ -239,7 +239,7 @@ KsMapModuleName(
RtlAppendUnicodeStringToString(&SubKeyName, ModuleName);
/* initialize subkey attributes */
InitializeObjectAttributes(&ObjectAttributes, &SubKeyName, OBJ_CASE_INSENSITIVE, hKey, NULL);
InitializeObjectAttributes(&ObjectAttributes, &SubKeyName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, hKey, NULL);
/* now open the subkey */
Status = ZwOpenKey(&hSubKey, GENERIC_READ, &ObjectAttributes);
@ -263,6 +263,3 @@ KsMapModuleName(
/* return status */
return Status;
}

View file

@ -296,7 +296,7 @@ SerialPnpStartDevice(
/* Write an entry value under HKLM\HARDWARE\DeviceMap\SERIALCOMM */
/* This step is not mandatory, so don't exit in case of error */
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\HARDWARE\\DeviceMap\\SERIALCOMM");
InitializeObjectAttributes(&objectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, NULL, NULL);
InitializeObjectAttributes(&objectAttributes, &KeyName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);
Status = ZwCreateKey(&hKey, KEY_SET_VALUE, &objectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
if (NT_SUCCESS(Status))
{

View file

@ -129,7 +129,7 @@ OpenKey(
RtlInitUnicodeString(&SubKeyName, lpSubKeyName);
/* initialize key attributes */
InitializeObjectAttributes(&ObjectAttributes, &SubKeyName, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, hKey, NULL);
InitializeObjectAttributes(&ObjectAttributes, &SubKeyName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE | OBJ_OPENIF, hKey, NULL);
/* open the key */
Status = ZwOpenKey(OutKey, DesiredAccess, &ObjectAttributes);

View file

@ -274,7 +274,7 @@ FindProductName(
/* initialize key attributes */
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, NULL, NULL);
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE | OBJ_OPENIF, NULL, NULL);
/* open the key */
Status = ZwOpenKey(&hKey, GENERIC_READ, &ObjectAttributes);
@ -324,7 +324,7 @@ FindProductName(
RtlInitUnicodeString(&SubKeyName, SubKey);
/* initialize key attributes */
InitializeObjectAttributes(&ObjectAttributes, &SubKeyName, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, hKey, NULL);
InitializeObjectAttributes(&ObjectAttributes, &SubKeyName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE | OBJ_OPENIF, hKey, NULL);
/* open the sub key */
Status = ZwOpenKey(&hSubKey, GENERIC_READ, &ObjectAttributes);