Fixed a simple bug in the implementation of the ShellView objects.
[wine/dcerpc.git] / win32 / process.c
blobd5e1379f716cf32d6f0b10e030c7452c5bf72786
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"
22 /**********************************************************************
23 * ContinueDebugEvent [KERNEL32.146]
25 BOOL WINAPI ContinueDebugEvent(DWORD pid,DWORD tid,DWORD contstatus) {
26 FIXME(win32,"(0x%lx,%ld,%ld): stub\n",pid,tid,contstatus);
27 return TRUE;
30 /*********************************************************************
31 * Process_ClockTimeToFileTime
32 * (olorin@fandra.org, 20-Sep-1998)
33 * Converts clock_t into FILETIME.
34 * Used by GetProcessTime.
35 * Differences to UnixTimeToFileTime:
36 * 1) Divided by CLK_TCK
37 * 2) Time is relative. There is no 'starting date', so there is
38 * no need in offset correction, like in UnixTimeToFileTime
39 * FIXME: This function should be moved to a more appropriate .c file
40 * FIXME: On floating point operations, it is assumed that
41 * floating values are truncated on convertion to integer.
43 void Process_ClockTimeToFileTime( clock_t unix_time, LPFILETIME filetime )
45 double td = (unix_time*10000000.0)/CLK_TCK;
46 /* Yes, double, because long int might overflow here. */
47 #if (SIZEOF_LONG_LONG >= 8)
48 unsigned long long t = td;
49 filetime->dwLowDateTime = (UINT) t;
50 filetime->dwHighDateTime = (UINT) (t >> 32);
51 #else
52 double divider = 1. * (1 << 16) * (1 << 16);
53 filetime->dwHighDateTime = (UINT) (td / divider);
54 filetime->dwLowDateTime = (UINT) (td - filetime->dwHighDateTime*divider);
55 /* using floor() produces wierd results, better leave this as it is
56 * ( with (UINT32) convertion )
58 #endif
61 /*********************************************************************
62 * GetProcessTimes [KERNEL32.262]
64 * FIXME: lpCreationTime, lpExitTime are NOT INITIALIZED.
65 * olorin@fandra.org: Would be nice to substract the cpu time,
66 * used by Wine at startup.
67 * Also, there is a need to separate times
68 * used by different applications.
70 BOOL WINAPI GetProcessTimes(
71 HANDLE hprocess,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,
72 LPFILETIME lpKernelTime, LPFILETIME lpUserTime
73 ) {
74 struct tms tms;
76 times(&tms);
77 Process_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
78 Process_ClockTimeToFileTime(tms.tms_stime,lpKernelTime);
79 return TRUE;