ntdll: Setup the shared user data structure at 0x7ffe0000.

This commit is contained in:
Alexandre Julliard 2007-05-18 18:09:03 +02:00
parent bd3a08b355
commit 5aa70b3d80
4 changed files with 26 additions and 2 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;
}

View file

@ -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,