static void Main() { SYSTEM_TIME_INFORMATION sti = new SYSTEM_TIME_INFORMATION(); UInt32 ret = 0; DateTime now = DateTime.Now; if (NativeMethods.NtQuerySystemInformation( (UInt32)3, //SystemTimeInformation out sti, (UInt32)Marshal.SizeOf(sti), out ret ) < 0) { Console.WriteLine("NtQuerySystemInformation failed."); return; } AssemblyInfo ai = new AssemblyInfo(); Console.WriteLine("{0} v{1} - {2}\n{3}\n", ai.Title, ai.Version, ai.Description, ai.Copyright); Console.WriteLine(now - DateTime.FromFileTime(sti.liKeBootTime.QuadPart)); }
internal static extern Int32 NtQuerySystemInformation( UInt32 SystemInformationClass, out SYSTEM_TIME_INFORMATION SystemInformation, UInt32 SystemInformationLength, out UInt32 ReturnLength );