VxDCall functions do not need to be 'register'.
[wine/dcerpc.git] / win32 / process.c
blob98325b94bcb7fbc47385118960a892b134d5f543
1 /*
2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis
5 */
7 #include <string.h>
8 #include <unistd.h>
9 #include <sys/times.h>
10 #include "winbase.h"
11 #include "winerror.h"
12 #include "heap.h"
13 #include "thread.h"
14 #include "process.h"
15 #include "pe_image.h"
16 #include "file.h"
17 #include "task.h"
18 #include "toolhelp.h"
19 #include "debug.h"
21 DEFAULT_DEBUG_CHANNEL(win32)
24 /**********************************************************************
25 * ContinueDebugEvent [KERNEL32.146]
27 BOOL WINAPI ContinueDebugEvent(DWORD pid,DWORD tid,DWORD contstatus) {
28 FIXME(win32,"(0x%lx,%ld,%ld): stub\n",pid,tid,contstatus);
29 return TRUE;
32 /*********************************************************************
33 * Process_ClockTimeToFileTime
34 * (olorin@fandra.org, 20-Sep-1998)
35 * Converts clock_t into FILETIME.
36 * Used by GetProcessTime.
37 * Differences to UnixTimeToFileTime:
38 * 1) Divided by CLK_TCK
39 * 2) Time is relative. There is no 'starting date', so there is
40 * no need in offset correction, like in UnixTimeToFileTime
41 * FIXME: This function should be moved to a more appropriate .c file
42 * FIXME: On floating point operations, it is assumed that
43 * floating values are truncated on convertion to integer.
45 void Process_ClockTimeToFileTime( clock_t unix_time, LPFILETIME filetime )
47 double td = (unix_time*10000000.0)/CLK_TCK;
48 /* Yes, double, because long int might overflow here. */
49 #if (SIZEOF_LONG_LONG >= 8)
50 unsigned long long t = td;
51 filetime->dwLowDateTime = (UINT) t;
52 filetime->dwHighDateTime = (UINT) (t >> 32);
53 #else
54 double divider = 1. * (1 << 16) * (1 << 16);
55 filetime->dwHighDateTime = (UINT) (td / divider);
56 filetime->dwLowDateTime = (UINT) (td - filetime->dwHighDateTime*divider);
57 /* using floor() produces wierd results, better leave this as it is
58 * ( with (UINT32) convertion )
60 #endif
63 /*********************************************************************
64 * GetProcessTimes [KERNEL32.262]
66 * FIXME: lpCreationTime, lpExitTime are NOT INITIALIZED.
67 * olorin@fandra.org: Would be nice to substract the cpu time,
68 * used by Wine at startup.
69 * Also, there is a need to separate times
70 * used by different applications.
72 BOOL WINAPI GetProcessTimes(
73 HANDLE hprocess,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,
74 LPFILETIME lpKernelTime, LPFILETIME lpUserTime
75 ) {
76 struct tms tms;
78 times(&tms);
79 Process_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
80 Process_ClockTimeToFileTime(tms.tms_stime,lpKernelTime);
81 return TRUE;