#include "ndissys.h"
+#include <ntifs.h>
+
#define PARAMETERS_KEY L"Parameters" /* The parameters subkey under the device-specific key */
/*
PMINIPORT_CONFIGURATION_CONTEXT ConfigurationContext;
PNDIS_WRAPPER_CONTEXT WrapperContext = (PNDIS_WRAPPER_CONTEXT)WrapperConfigurationContext;
HANDLE RootKeyHandle = WrapperContext->RegistryHandle;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING NoName = RTL_CONSTANT_STRING(L"");
NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
*ConfigurationHandle = NULL;
- *Status = ZwDuplicateObject(NtCurrentProcess(), RootKeyHandle,
- NtCurrentProcess(), &KeyHandle, 0, 0,
- DUPLICATE_SAME_ACCESS);
+ InitializeObjectAttributes(&ObjectAttributes,
+ &NoName,
+ OBJ_KERNEL_HANDLE,
+ RootKeyHandle,
+ NULL);
+ *Status = ZwOpenKey(&KeyHandle, KEY_ALL_ACCESS, &ObjectAttributes);
if(!NT_SUCCESS(*Status))
{
NDIS_DbgPrint(MIN_TRACE, ("Failed to open registry configuration for this miniport\n"));
RtlCopyUnicodeString(&KeyNameU, ProtocolSection);
RtlAppendUnicodeToString(&KeyNameU, PARAMETERS_KEY);
- InitializeObjectAttributes(&KeyAttributes, &KeyNameU, OBJ_CASE_INSENSITIVE, NULL, NULL);
+ InitializeObjectAttributes(&KeyAttributes, &KeyNameU, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);
*Status = ZwOpenKey(&KeyHandle, KEY_ALL_ACCESS, &KeyAttributes);
PMINIPORT_CONFIGURATION_CONTEXT ConfigurationContext = (PMINIPORT_CONFIGURATION_CONTEXT)ConfigurationHandle;
PVOID Buffer;
- *ParameterValue = NULL;
+ //*ParameterValue = NULL;
*Status = NDIS_STATUS_FAILURE;
NDIS_DbgPrint(MAX_TRACE,("requested read of %wZ\n", Keyword));
(*ParameterValue)->ParameterData.StringData.Buffer = Buffer;
(*ParameterValue)->ParameterData.StringData.Length = KeyInformation->DataLength;
}
+ else if (KeyInformation->Type == REG_DWORD)
+ {
+ ASSERT(KeyInformation->DataLength == sizeof(ULONG));
+ NDIS_DbgPrint(MAX_TRACE, ("NdisParameterInteger\n"));
+ (*ParameterValue)->ParameterType = NdisParameterInteger;
+ (*ParameterValue)->ParameterData.IntegerData = * (ULONG *) &KeyInformation->Data[0];
+ }
else if (KeyInformation->Type == REG_SZ)
{
UNICODE_STRING str;
wcsncpy(KeyName->Buffer, KeyInformation->Name, KeyName->MaximumLength/sizeof(WCHAR));
KeyName->Length = (USHORT)min(KeyInformation->NameLength, KeyName->MaximumLength);
- InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE, ConfigurationHandle, NULL);
+ InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, ConfigurationHandle, NULL);
*Status = ZwOpenKey(&RegKeyHandle, KEY_ALL_ACCESS, &KeyAttributes);
*KeyHandle = NULL;
- InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE, ConfigurationHandle, 0);
+ InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, ConfigurationHandle, 0);
*Status = ZwOpenKey(&RegKeyHandle, KEY_ALL_ACCESS, &KeyAttributes);
if(*Status != STATUS_SUCCESS)