Commit 985bd97c authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Retrieve Wine version strings through NtQuerySystemInformation().

parent beff5c56
...@@ -1623,9 +1623,9 @@ ...@@ -1623,9 +1623,9 @@
@ cdecl -syscall __wine_locked_recvmsg(long ptr long) @ cdecl -syscall __wine_locked_recvmsg(long ptr long)
# Version # Version
@ cdecl -syscall wine_get_version() @ cdecl wine_get_version()
@ cdecl -syscall wine_get_build_id() @ cdecl wine_get_build_id()
@ cdecl -syscall wine_get_host_version(ptr ptr) @ cdecl wine_get_host_version(ptr ptr)
# Filesystem # Filesystem
@ cdecl -syscall wine_nt_to_unix_file_name(ptr ptr ptr long) @ cdecl -syscall wine_nt_to_unix_file_name(ptr ptr ptr long)
......
...@@ -51,9 +51,6 @@ ...@@ -51,9 +51,6 @@
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h> #include <sys/wait.h>
#endif #endif
...@@ -335,48 +332,6 @@ static void init_paths( char *argv[] ) ...@@ -335,48 +332,6 @@ static void init_paths( char *argv[] )
} }
/*********************************************************************
* wine_get_version
*/
const char * CDECL wine_get_version(void)
{
return PACKAGE_VERSION;
}
/*********************************************************************
* wine_get_build_id
*/
const char * CDECL wine_get_build_id(void)
{
extern const char wine_build[];
return wine_build;
}
/*********************************************************************
* wine_get_host_version
*/
void CDECL wine_get_host_version( const char **sysname, const char **release )
{
#ifdef HAVE_SYS_UTSNAME_H
static struct utsname buf;
static BOOL init_done;
if (!init_done)
{
uname( &buf );
init_done = TRUE;
}
if (sysname) *sysname = buf.sysname;
if (release) *release = buf.release;
#else
if (sysname) *sysname = "";
if (release) *release = "";
#endif
}
static void preloader_exec( char **argv ) static void preloader_exec( char **argv )
{ {
if (use_preloader) if (use_preloader)
...@@ -2107,7 +2062,8 @@ static void check_command_line( int argc, char *argv[] ) ...@@ -2107,7 +2062,8 @@ static void check_command_line( int argc, char *argv[] )
} }
if (!strcmp( argv[1], "--version" )) if (!strcmp( argv[1], "--version" ))
{ {
printf( "%s\n", wine_get_build_id() ); extern const char wine_build[];
printf( "%s\n", wine_build );
exit(0); exit(0);
} }
} }
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
#ifdef HAVE_SYS_SYSCTL_H #ifdef HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h> # include <sys/sysctl.h>
#endif #endif
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#ifdef HAVE_MACHINE_CPU_H #ifdef HAVE_MACHINE_CPU_H
# include <machine/cpu.h> # include <machine/cpu.h>
#endif #endif
...@@ -2809,6 +2812,21 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, ...@@ -2809,6 +2812,21 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
ret = STATUS_SUCCESS; ret = STATUS_SUCCESS;
break; break;
/* Wine extensions */
case SystemWineVersionInformation:
{
static const char version[] = PACKAGE_VERSION;
extern const char wine_build[];
struct utsname buf;
uname( &buf );
len = strlen(version) + strlen(wine_build) + strlen(buf.sysname) + strlen(buf.release) + 4;
snprintf( info, size, "%s%c%s%c%s%c%s", version, 0, wine_build, 0, buf.sysname, 0, buf.release );
if (size < len) ret = STATUS_INFO_LENGTH_MISMATCH;
break;
}
default: default:
FIXME( "(0x%08x,%p,0x%08x,%p) stub\n", class, info, size, ret_size ); FIXME( "(0x%08x,%p,0x%08x,%p) stub\n", class, info, size, ret_size );
......
...@@ -207,6 +207,41 @@ static const struct { WCHAR name[12]; WINDOWS_VERSION ver; } version_names[] = ...@@ -207,6 +207,41 @@ static const struct { WCHAR name[12]; WINDOWS_VERSION ver; } version_names[] =
/* initialized to null so that we crash if we try to retrieve the version too early at startup */ /* initialized to null so that we crash if we try to retrieve the version too early at startup */
static const RTL_OSVERSIONINFOEXW *current_version; static const RTL_OSVERSIONINFOEXW *current_version;
static char wine_version[256];
/*********************************************************************
* wine_get_version
*/
const char * CDECL wine_get_version(void)
{
return wine_version;
}
/*********************************************************************
* wine_get_build_id
*/
const char * CDECL wine_get_build_id(void)
{
const char *p = wine_version;
p += strlen(p) + 1; /* skip version */
return p;
}
/*********************************************************************
* wine_get_host_version
*/
void CDECL wine_get_host_version( const char **sysname, const char **release )
{
const char *p = wine_version;
p += strlen(p) + 1; /* skip version */
p += strlen(p) + 1; /* skip build id */
if (sysname) *sysname = p;
p += strlen(p) + 1;
if (release) *release = p;
}
/********************************************************************** /**********************************************************************
* get_nt_registry_version * get_nt_registry_version
...@@ -430,6 +465,8 @@ void version_init(void) ...@@ -430,6 +465,8 @@ void version_init(void)
const WCHAR *p, *appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer; const WCHAR *p, *appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
WCHAR appversion[MAX_PATH+20]; WCHAR appversion[MAX_PATH+20];
NtQuerySystemInformation( SystemWineVersionInformation, wine_version, sizeof(wine_version), NULL );
current_version = &VersionData[WIN7]; current_version = &VersionData[WIN7];
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root ); RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
......
...@@ -1693,7 +1693,9 @@ typedef enum _SYSTEM_INFORMATION_CLASS { ...@@ -1693,7 +1693,9 @@ typedef enum _SYSTEM_INFORMATION_CLASS {
SystemDifRemovePluginVerificationOnDriver = 220, SystemDifRemovePluginVerificationOnDriver = 220,
SystemShadowStackInformation = 221, SystemShadowStackInformation = 221,
SystemBuildVersionInformation = 222, SystemBuildVersionInformation = 222,
SystemInformationClassMax #ifdef __WINESRC__
SystemWineVersionInformation = 1000,
#endif
} SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS; } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
typedef enum _THREADINFOCLASS { typedef enum _THREADINFOCLASS {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment