Note that there are some explanatory texts on larger screens.

plurals
  1. POKeyInformation parameter of NtEnumerateKey()
    primarykey
    data
    text
    <p>I'm curious to know how the <code>KeyInformation</code> parameter should be passed to <code>NtEnumerateKey()</code>. When I run the following code, <code>NtEnumerateKey()</code> returns <code>NTSTATUS = 0xC000000D</code> with the error message <i>"An invalid parameter was passed to a service or function."</i></p> <p>I'm using Windows 7. Although the following code uses Delphi language, you can answer my question in C language too. My question is not specific to a programming language.</p> <pre><code>type KEY_NAME_INFORMATION = record NameLength: ULONG; Name: array[0..254] of WCHAR; end; PKEY_NAME_INFORMATION = ^KEY_NAME_INFORMATION; var iNtStatus: LONG; hKeyResult: THandle; KeyNameInfo: KEY_NAME_INFORMATION; iResultLen: ULONG; iNtStatus := NtOpenKey(@hKeyResult, (KEY_ENUMERATE_SUB_KEYS) and not SYNCHRONIZE, @rObjAttrs); if hKeyResult = 0 then Exit; iNtStatus := NtEnumerateKey(hKeyResult, 0, KeyNameInformation, @KeyNameInfo, // I'm asking about this parameter, SizeOf(KEY_NAME_INFORMATION), // and also this parameter @iResultLen); </code></pre> <h2>UPDATED: Weird Thing</h2> <p>If I pass <code>KeyBasicInformation</code> instead of <code>KeyNameInformation</code>, <code>NtEnumerateKey()</code> returns <code>STATUS_SUCCESS</code>. Does not <code>NtEnumerateKey()</code> support the <code>KeyNameInformation</code>?</p> <pre><code>type KEY_BASIC_INFORMATION = record LastWriteTime: LARGE_INTEGER; TitleIndex: ULONG; NameLength: ULONG; Name: array[0..254] of WCHAR; end; PKEY_BASIC_INFORMATION = ^KEY_BASIC_INFORMATION; var KeyBasicInfo: KEY_BASIC_INFORMATION; iNtStatus := NtEnumerateKey(hKeyResult, 0, KeyBasicInformation, // Note this! @KeyBasicInfo, // Note this! SizeOf(KEY_BASIC_INFORMATION), // Note this! @iResultLen); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload