2 using System.Runtime.InteropServices;
4 using System.Security.Permissions;
9 [DllImport ("libc", SetLastError=true)]
10 public static extern uint getuid ();
13 [DllImport ("kernel32.dll", SetLastError=true)]
14 public static extern uint GetTickCount ();
16 static bool RunningOnMono ()
18 bool mono = (Type.GetType ("Mono.Math.BigInteger") != null);
19 Console.WriteLine ("Running on {0} runtime...", mono ? "Mono" : "Microsoft");
26 uint u = (RunningOnMono ()) ? getuid () : GetTickCount ();
27 Console.WriteLine ("*1* P/Invoke: {0}", u);
30 catch (SecurityException se) {
31 Console.WriteLine ("*0* Expected SecurityException\n{0}", se);
35 Console.WriteLine ("*2* Unexpected exception\n{0}", e);
40 [SecurityPermission (SecurityAction.Deny, UnmanagedCode=true)]