[DllImport("Netapi32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
private extern static int NetStatisticsGet(
[MarshalAs(UnmanagedType.LPWStr)] string serverName,
[MarshalAs(UnmanagedType.LPWStr)] string service,
int level,
int options,
out IntPtr BufPtr);
Declare Function NetStatisticsGet Lib "Netapi32.dll" (TODO) As TODO
None.
Do you know one? Please contribute it!
None.
Please add some!
//
// I found the following at http://www.codeproject.com/KB/cs/GetLastRebootTime.aspx by Gautham Jayaraman
//
static void Main(string[] args)
{
IntPtr bufPtr = IntPtr.Zero;
int val = NetStatisticsGet(null, "LanmanWorkstation", 0, 0, out bufPtr);
STAT_WORKSTATION_0 wks = new STAT_WORKSTATION_0();
if (val == 0)
{
wks = (STAT_WORKSTATION_0)Marshal.PtrToStructure(bufPtr, typeof(STAT_WORKSTATION_0));
}
DateTime aRebootTime = DateTime.FromFileTime(wks.StatisticsStartTime);
System.Console.WriteLine(aRebootTime);
}
// See STAT_WORKSTATION_0