2 using System.Runtime.InteropServices;
4 using System.Security.Permissions;
6 [assembly: SecurityPermission (SecurityAction.RequestRefuse, UnmanagedCode=true)]
11 [DllImport ("libc", SetLastError=true)]
12 public static extern uint getuid ();
15 [DllImport ("kernel32.dll", SetLastError=true)]
16 public static extern uint GetTickCount ();
18 static bool RunningOnMono ()
20 bool mono = (Type.GetType ("Mono.Math.BigInteger") != null);
21 Console.WriteLine ("Running on {0} runtime...", mono ? "Mono" : "Microsoft");
28 uint u = (RunningOnMono ()) ? getuid () : GetTickCount ();
29 Console.WriteLine ("*0* P/Invoke: {0}", u);
32 catch (SecurityException se) {
33 Console.WriteLine ("*1* Unexpected SecurityException\n{0}", se);
37 Console.WriteLine ("*2* Unexpected exception\n{0}", e);