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