Hi all,
I want to read in my driver a key value (like configuration info) and created in my RegistryPath->Buffer
(which is \REGISTRY\MACHINE\SYSTEM\ControlSet004\Services\myDriver) a new REG_DWORD key “Test”,
set its value to 5, but paramTable[0].DefaultData returns something wrong.
What I’m doing wrong? Could someone make it clear please?
RTL_QUERY_REGISTRY_TABLE paramTable[1];
ULONG zero = 0;
PWCHAR path;
NTSTATUS status;
if (path = (PWCHAR)ExAllocatePool(
PagedPool,
RegistryPath->Length+sizeof(WCHAR)
)) {
RtlZeroMemory(
¶mTable[0],
sizeof(paramTable)
);
RtlZeroMemory(
path,
RegistryPath->Length+sizeof(WCHAR)
);
RtlMoveMemory(
path,
RegistryPath->Buffer,
RegistryPath->Length
);
paramTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
paramTable[0].Name = L"Test";
paramTable[0].DefaultType = REG_DWORD;
paramTable[0].DefaultLength = sizeof(ULONG);
status = RtlQueryRegistryValues(
RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL,
path,
¶mTable[0],
NULL,
NULL
);
DbgPrint(“RtlQueryRegistryValues status: %08x\n”,status);
DbgPrint(“paramTable[0].DefaultData = %08x”, paramTable[0].DefaultData);
}
Thank you