none
RtlQueryRegistryValues read DWORD from registry RRS feed

  • Question

  • 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?

    Sunday, August 18, 2013 2:28 PM

Answers

  • The OS comes with a uart 16550 driver, serial.sys. It is not a simple driver to get right, i strongly recommend using the inbox driver vs writing your own. With that said, a simple %d or %u or %i should be sufficient. Long and int are the same size on Windows. If all else fails, step through the code with a debugger and inspect the value.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Sunday, August 18, 2013 5:03 PM