Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Download Visual Studio Add-In

RegQueryInfoKey (advapi32)

        [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        static extern int RegQueryInfoKey(UIntPtr hKey, [Out()]StringBuilder lpClass, ref uint lpcchClass,
           IntPtr lpReserved, out uint lpcSubkey, out uint lpcchMaxSubkeyLen,
           out uint lpcchMaxClassLen, out uint lpcValues, out uint lpcchMaxValueNameLen,
           out uint lpcbMaxValueLen, IntPtr lpSecurityDescriptor, IntPtr lpftLastWriteTime);


Add-Type declaration ( LastWriteTime only )

    Add-Type @'
    using Microsoft.Win32.SafeHandles;
    using System;
    using System.Runtime.InteropServices;

    public class API
        [DllImport("Advapi32.dll", SetLastError=true)]
        [return: MarshalAs(UnmanagedType.Error)]
        public static extern int RegQueryInfoKey(
            SafeRegistryHandle      hkey,
            uint p2,uint p3,uint p4,uint p5,uint p6,
            uint p7,uint p8,uint p9,uint p10,uint p11,
            ref long        lpftLastWriteTime


    [long]$LastWrite = 0
    $key = Get-Item 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams'

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version