2 using System.Runtime.InteropServices;
8 [DllImport ("libc", SetLastError=true)]
9 public static extern uint getuid ();
12 [DllImport ("kernel32.dll", SetLastError=true)]
13 public static extern uint GetTickCount ();
15 static bool RunningOnWindows ()
17 int p = (int) Environment.OSVersion.Platform;
18 bool win = ((p != 4) && (p != 128));
19 Console.WriteLine ("Running on {0}...", Environment.OSVersion);
26 uint u = (RunningOnWindows () ? GetTickCount () : getuid ());
27 Console.WriteLine ("*0* P/Invoke: {0}", u);
30 catch (SecurityException se) {
31 Console.WriteLine ("*1* Unexpected SecurityException\n{0}", se);
35 Console.WriteLine ("*2* Unexpected exception\n{0}", e);