2 * environment.c: System.Environment support internal calls
5 * Dick Porter (dick@ximian.com)
6 * Sebastien Pouliot (sebastien@ximian.com)
8 * (C) 2002 Ximian, Inc.
9 * (C) 2004 Novell (http://www.novell.com)
15 #include <mono/metadata/appdomain.h>
16 #include <mono/metadata/environment.h>
17 #include <mono/metadata/exception.h>
19 #ifndef PLATFORM_WIN32
20 #include <sys/utsname.h>
23 static gint32 exitcode=0;
25 gint32 mono_environment_exitcode_get (void)
30 void mono_environment_exitcode_set (gint32 value)
35 /* note: we better manipulate the string in managed code (easier and safer) */
37 ves_icall_System_Environment_GetOSVersionString (void)
40 OSVERSIONINFO verinfo;
44 verinfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
45 if (GetVersionEx (&verinfo)) {
47 /* maximum string length is 35 bytes
48 3 x 10 bytes per number, 1 byte for 0, 3 x 1 byte for dots, 1 for NULL */
49 sprintf (version, "%ld.%ld.%ld.0",
50 verinfo.dwMajorVersion,
51 verinfo.dwMinorVersion,
52 verinfo.dwBuildNumber);
53 return mono_string_new (mono_domain_get (), version);
60 if (uname (&name) == 0) {
61 return mono_string_new (mono_domain_get (), name.release);
64 return mono_string_new (mono_domain_get (), "0.0.0.0");