Moved the server start time to the init_thread request and got rid of the init_process request (based on a patch by Felix Nawothnig).
diff --git a/dlls/kernel/kernel_main.c b/dlls/kernel/kernel_main.c index b043894..2fc8fcb 100644 --- a/dlls/kernel/kernel_main.c +++ b/dlls/kernel/kernel_main.c
@@ -28,6 +28,10 @@ #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif +#include <time.h> +#ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +#endif #include <signal.h> #include "windef.h" @@ -56,6 +60,8 @@ }; static CRITICAL_SECTION ldt_section = { &critsect_debug, -1, 0, 0, 0, 0 }; +static DWORD server_start_time; + /*********************************************************************** * locking for LDT routines */ @@ -102,6 +108,10 @@ { HMODULE16 hModule; SYSTEM_INFO si; + SYSTEM_TIMEOFDAY_INFORMATION sti; + + NtQuerySystemInformation( SystemTimeOfDayInformation, &sti, sizeof(sti), NULL ); + RtlTimeToSecondsSince1970( &sti.liKeBootTime, &server_start_time ); /* FIXME: should probably be done in ntdll */ GetSystemInfo( &si ); @@ -263,3 +273,28 @@ if ((ret > 2147483647) || (ret < -2147483647)) return -1; return ret; } + + +/*********************************************************************** + * GetSystemMSecCount (SYSTEM.6) + * GetTickCount (KERNEL32.@) + * + * Get the number of milliseconds the system has been running. + * + * PARAMS + * None. + * + * RETURNS + * The current tick count. + * + * NOTES + * -The value returned will wrap arounf every 2^32 milliseconds. + * -Under Windows, tick 0 is the moment at which the system is rebooted. + * Under Wine, tick 0 begins at the moment the wineserver process is started, + */ +DWORD WINAPI GetTickCount(void) +{ + struct timeval t; + gettimeofday( &t, NULL ); + return ((t.tv_sec - server_start_time) * 1000) + (t.tv_usec / 1000); +}
diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index a05804c..436f587 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c
@@ -64,7 +64,6 @@ static DWORD shutdown_priority = 0x280; static DWORD process_dword; -static unsigned int server_startticks; int main_create_flags = 0; HMODULE kernel32_handle = 0; @@ -933,7 +932,6 @@ static BOOL process_init(void) { static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2',0}; - BOOL ret; PEB *peb = NtCurrentTeb()->Peb; RTL_USER_PROCESS_PARAMETERS *params = peb->ProcessParameters; extern void __wine_dbg_kernel32_init(void); @@ -946,17 +944,6 @@ setbuf(stderr,NULL); setlocale(LC_CTYPE,""); - /* Retrieve startup info from the server */ - SERVER_START_REQ( init_process ) - { - if ((ret = !wine_server_call_err( req ))) - { - server_startticks = reply->server_start; - } - } - SERVER_END_REQ; - if (!ret) return FALSE; - if (!params->AllocationSize) { /* This is wine specific: we have no parent (we're started from unix) @@ -2888,31 +2875,6 @@ /*********************************************************************** - * GetSystemMSecCount (SYSTEM.6) - * GetTickCount (KERNEL32.@) - * - * Get the number of milliseconds the system has been running. - * - * PARANS - * None. - * - * RETURNS - * The current tick count. - * - * NOTES - * -The value returned will wrap arounf every 2^32 milliseconds. - * -Under Windows, tick 0 is the moment at which the system is rebooted. - * Under Wine, tick 0 begins at the moment the wineserver process is started, - */ -DWORD WINAPI GetTickCount(void) -{ - struct timeval t; - gettimeofday( &t, NULL ); - return ((t.tv_sec * 1000) + (t.tv_usec / 1000)) - server_startticks; -} - - -/*********************************************************************** * GetCurrentProcess (KERNEL32.@) * * Get a handle to the current process.