From 66eb4bd375a379a8cde867f59b6a40015330e124 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 9 Dec 2008 19:33:06 +0100 Subject: [PATCH] ntdll: Add a function to export the host OS type and version. --- configure | 2 ++ configure.ac | 1 + dlls/ntdll/misc.c | 25 +++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 1 + include/config.h.in | 3 +++ 5 files changed, 32 insertions(+) diff --git a/configure b/configure index 1ff8e1fade4..eaa4da73f9e 100755 --- a/configure +++ b/configure @@ -7435,6 +7435,7 @@ done + for ac_header in \ @@ -7543,6 +7544,7 @@ for ac_header in \ sys/times.h \ sys/uio.h \ sys/un.h \ + sys/utsname.h \ sys/vm86.h \ sys/wait.h \ syscall.h \ diff --git a/configure.ac b/configure.ac index 1dce0d13086..071013c47bd 100644 --- a/configure.ac +++ b/configure.ac @@ -344,6 +344,7 @@ AC_CHECK_HEADERS(\ sys/times.h \ sys/uio.h \ sys/un.h \ + sys/utsname.h \ sys/vm86.h \ sys/wait.h \ syscall.h \ diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c index 218c2897bd3..5272c875fb5 100644 --- a/dlls/ntdll/misc.c +++ b/dlls/ntdll/misc.c @@ -22,6 +22,9 @@ #include #include +#ifdef HAVE_SYS_UTSNAME_H +#include +#endif #include "wine/library.h" #include "wine/debug.h" @@ -155,6 +158,28 @@ const char * CDECL NTDLL_wine_get_build_id(void) return wine_get_build_id(); } +/********************************************************************* + * wine_get_host_version (NTDLL.@) + */ +void CDECL NTDLL_wine_get_host_version( const char **sysname, const char **release ) +{ +#ifdef HAVE_SYS_UTSNAME_H + static struct utsname buf; + static int init_done; + + if (!init_done) + { + uname( &buf ); + init_done = 1; + } + if (sysname) *sysname = buf.sysname; + if (release) *release = buf.release; +#else + if (sysname) *sysname = ""; + if (release) *release = ""; +#endif +} + /********************************************************************* * abs (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index d4c8d4e8e7f..442516e5986 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1384,6 +1384,7 @@ # Version @ cdecl wine_get_version() NTDLL_wine_get_version @ cdecl wine_get_build_id() NTDLL_wine_get_build_id +@ cdecl wine_get_host_version(ptr ptr) NTDLL_wine_get_host_version # Codepages @ cdecl __wine_init_codepages(ptr ptr ptr) diff --git a/include/config.h.in b/include/config.h.in index 84c41deb628..c45765ea1ae 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -897,6 +897,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_USER_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UTSNAME_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_VFS_H