2 using System.Runtime.InteropServices;
4 using System.Security.Permissions;
9 [DllImport ("libc", SetLastError=true)]
10 [SuppressUnmanagedCodeSecurity]
11 public static extern uint getuid ();
14 [DllImport ("kernel32.dll", SetLastError=true)]
15 [SuppressUnmanagedCodeSecurity]
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);
42 [SecurityPermission (SecurityAction.Deny, UnmanagedCode=true)]