Module: wine Branch: master Commit: 5aa70b3d8045dd2922543befd7d0f1c3cf269b09 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5aa70b3d8045dd2922543befd7...
Author: Alexandre Julliard julliard@winehq.org Date: Fri May 18 18:09:03 2007 +0200
ntdll: Setup the shared user data structure at 0x7ffe0000.
---
dlls/ntdll/loader.c | 2 ++ dlls/ntdll/ntdll_misc.h | 2 +- dlls/ntdll/thread.c | 16 +++++++++++++++- dlls/ntdll/version.c | 8 ++++++++ 4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 8d72936..0f50653 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -40,6 +40,7 @@ #include "wine/debug.h" #include "wine/server.h" #include "ntdll_misc.h" +#include "ddk/wdm.h"
WINE_DEFAULT_DEBUG_CHANNEL(module); WINE_DECLARE_DEBUG_CHANNEL(relay); @@ -2307,6 +2308,7 @@ void __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir ) LPWSTR buffer, p;
RtlCreateUnicodeString( &system_dir, sysdir ); + strcpyW( user_shared_data->NtSystemRoot, windir );
/* prepend the system dir to the name of the already created modules */ mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList; diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 741aec4..c6ef77c 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -25,7 +25,6 @@ #include "windef.h" #include "winnt.h" #include "winternl.h" -#include "winioctl.h" #include "wine/server.h"
#define MAX_NT_PATH_LENGTH 277 @@ -117,6 +116,7 @@ extern NTSTATUS DIR_get_unix_cwd( char **cwd ); extern NTSTATUS VIRTUAL_HandleFault(LPCVOID addr); extern void VIRTUAL_SetForceExec( BOOL enable ); extern void VIRTUAL_UseLargeAddressSpace(void); +extern struct _KUSER_SHARED_DATA *user_shared_data;
/* code pages */ extern int ntdll_umbstowcs(DWORD flags, const char* src, int srclen, WCHAR* dst, int dstlen); diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index fa30e53..30e441d 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -40,11 +40,14 @@ #include "wine/pthread.h" #include "wine/debug.h" #include "ntdll_misc.h" +#include "ddk/wdm.h" #include "wine/exception.h"
WINE_DEFAULT_DEBUG_CHANNEL(thread); WINE_DECLARE_DEBUG_CHANNEL(relay);
+struct _KUSER_SHARED_DATA *user_shared_data = NULL; + /* info passed to a starting thread */ struct startup_info { @@ -225,6 +228,7 @@ HANDLE thread_init(void) void *addr; SIZE_T size, info_size; HANDLE exe_file = 0; + LARGE_INTEGER now; struct ntdll_thread_data *thread_data; struct ntdll_thread_regs *thread_regs; struct wine_pthread_thread_info thread_info; @@ -236,7 +240,8 @@ HANDLE thread_init(void)
addr = (void *)0x7ffe0000; size = 0x10000; - NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_RESERVE, PAGE_READONLY ); + NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE ); + user_shared_data = addr;
/* allocate and initialize the PEB */
@@ -325,6 +330,15 @@ HANDLE thread_init(void) /* initialize LDT locking */ wine_ldt_init_locking( ldt_lock, ldt_unlock );
+ /* initialize time values in user_shared_data */ + NtQuerySystemTime( &now ); + user_shared_data->SystemTime.LowPart = now.LowPart; + user_shared_data->SystemTime.High1Time = user_shared_data->SystemTime.High2Time = now.HighPart; + user_shared_data->u.TickCountQuad = (now.QuadPart - server_start_time) / 10000; + user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time; + user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart; + user_shared_data->TickCountMultiplier = 1 << 24; + return exe_file; }
diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c index f29b495..0f18833 100644 --- a/dlls/ntdll/version.c +++ b/dlls/ntdll/version.c @@ -34,6 +34,7 @@ #include "wine/unicode.h" #include "wine/debug.h" #include "ntdll_misc.h" +#include "ddk/wdm.h"
WINE_DEFAULT_DEBUG_CHANNEL(ver);
@@ -505,6 +506,13 @@ done: NtCurrentTeb()->Peb->OSBuildNumber = current_version->dwBuildNumber; NtCurrentTeb()->Peb->OSPlatformId = current_version->dwPlatformId;
+ user_shared_data->NtProductType = current_version->wProductType; + user_shared_data->ProductTypeIsValid = TRUE; + user_shared_data->MajorNtVersion = current_version->dwMajorVersion; + user_shared_data->MinorNtVersion = current_version->dwMinorVersion; + user_shared_data->MinorNtVersion = current_version->dwMinorVersion; + user_shared_data->SuiteMask = current_version->wSuiteMask; + TRACE( "got %d.%d plaform %d build %x name %s service pack %d.%d product %d\n", current_version->dwMajorVersion, current_version->dwMinorVersion, current_version->dwPlatformId, current_version->dwBuildNumber,