使用Microsoft.Win32.RegistryKey
(或任何相关的类),如何查询注册表项的上次写入时间?
答案 0 :(得分:8)
您需要使用P / Invoke来调用Win32 API:
MSDN: RegQueryInfoKey
function
来自pinvoke.net的签名:
[DllImport("advapi32.dll", EntryPoint="RegQueryInfoKey", CallingConvention=CallingConvention.Winapi, SetLastError=true)]
extern private static int RegQueryInfoKey(
UIntPtr hkey,
out StringBuilder lpClass,
ref uint lpcbClass,
IntPtr lpReserved,
out uint lpcSubKeys,
out uint lpcbMaxSubKeyLen,
out uint lpcbMaxClassLen,
out uint lpcValues,
out uint lpcbMaxValueNameLen,
out uint lpcbMaxValueLen,
out uint lpcbSecurityDescriptor,
IntPtr lpftLastWriteTime);