public static extern NtStatus NtQueryKey( SafeKernelObjectHandle KeyHandle, KeyInformationClass KeyInformationClass, SafeBuffer KeyInformation, int Length, out int ResultLength );
private SafeStructureInOutBuffer <T> QueryKey <T>(KeyInformationClass info_class) where T : new() { int return_length; NtStatus status = NtSystemCalls.NtQueryKey(Handle, info_class, SafeHGlobalBuffer.Null, 0, out return_length); if (status != NtStatus.STATUS_BUFFER_OVERFLOW && status != NtStatus.STATUS_INFO_LENGTH_MISMATCH && status != NtStatus.STATUS_BUFFER_TOO_SMALL) { status.ToNtException(); } SafeStructureInOutBuffer <T> buffer = new SafeStructureInOutBuffer <T>(return_length, false); try { NtSystemCalls.NtQueryKey(Handle, info_class, buffer, buffer.Length, out return_length).ToNtException(); return(Interlocked.Exchange(ref buffer, null)); } finally { if (buffer != null) { buffer.Close(); } } }
public static extern NativeResultCode NtQueryKey(UIntPtr KeyHandle, KeyInformationClass KeyInformationClass, IntPtr KeyInformation, int bufferSize, out int resultSize);
public unsafe static extern NTStatus NtQueryKey( RegistryKeyHandle KeyHandle, KeyInformationClass KeyInformationClass, void *KeyInformation, uint Length, out uint ResultLength);