title: RtlQueryRegistryValues read REG_DWORD
body: <p>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.</p>
  
  <p>(a lot of code skipped...)</p>
  
  <pre><code>RTL_QUERY_REGISTRY_TABLE table[2];
  </code></pre>
  
  <p>and</p>
  
  <pre><code>table[1].QueryRoutine = NULL;
  table[1].Name = NULL;
  </code></pre>
  
  <p>The parameter is stored in the registry as a REG_DWORD and I'm trying to set my table with:</p>
  
  <pre><code>unsigned long buffer;
  </code></pre>
  
  <p>(because DWORD is not defined in ntddk.h and I'm not sure if I break anything including WinDef.h)
  and</p>
  
  <pre><code>table[0].EntryContext = &amp;buffer;
  </code></pre>
  
  <p>The status of the call to RtlQueryRegistryValues is STATUS_SUCCESS</p>
  
  <pre><code>status =  RtlQueryRegistryValues(
      RTL_REGISTRY_ABSOLUTE,
      path,
      table,
      NULL,
      NULL);
  </code></pre>
  
  <p>but when I try to</p>
  
  <pre><code>DbgPrint("registry: %lu", buffer)
  </code></pre>
  
  <p>I get way too big numbers (I expected the result to be 1 or 2).</p>
  
  <p>Am I doing something wrong with the DbgPrint, or my parameters aren't set correctly for the query table?</p>
  
  <p>And where is the RED_DWORD data type defined?</p>
  
  <p>EDIT:</p>
  
  <pre><code>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 = &amp;buffer; 
  table[0].DefaultType = REG_DWORD; 
  table[0].DefaultData = def; 
  table[0].DefaultLength = strlen(def) + 1;
  </code></pre>