I'm writing a Uart16550 driver, and one of the things I have to do is read from the registry some initialization parameters using RtlQueryRegistryValues.
(a lot of code skipped...)
RTL_QUERY_REGISTRY_TABLE table[2];
and
table[1].QueryRoutine = NULL;
table[1].Name = NULL;
The parameter is stored in the registry as a REG_DWORD and I'm trying to set my table with:
unsigned long buffer;
(because DWORD is not defined in ntddk.h and I'm not sure if I break anything including WinDef.h)
and
table[0].EntryContext = &buffer;
The status of the call to RtlQueryRegistryValues is STATUS_SUCCESS
status = RtlQueryRegistryValues(
RTL_REGISTRY_ABSOLUTE,
path,
table,
NULL,
NULL);
but when I try to
DbgPrint("registry: %lu", buffer)
I get way too big numbers (I expected the result to be 1 or 2).
Am I doing something wrong with the DbgPrint, or my parameters aren't set correctly for the query table?
And where is the RED_DWORD data type defined?
EDIT:
WCHAR keyname[20] = "parameter";
CHAR def[20] = "parameter";
WCHAR path[100] = L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\hello\\Parameters";
unsigned long buffer;
table[0].QueryRoutine = NULL;
table[0].Name = keyname;
table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
table[0].EntryContext = &buffer;
table[0].DefaultType = REG_DWORD;
table[0].DefaultData = def;
table[0].DefaultLength = strlen(def) + 1;