2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis
22 /**********************************************************************
23 * GetProcessAffinityMask
25 BOOL32 WINAPI
GetProcessAffinityMask(HANDLE32 hProcess
,
26 LPDWORD lpProcessAffinityMask
,
27 LPDWORD lpSystemAffinityMask
)
29 TRACE(task
,"(%x,%lx,%lx)\n",
30 hProcess
,(lpProcessAffinityMask
?*lpProcessAffinityMask
:0),
31 (lpSystemAffinityMask
?*lpSystemAffinityMask
:0));
32 /* It is definitely important for a process to know on what processor
34 if(lpProcessAffinityMask
)
35 *lpProcessAffinityMask
=1;
36 if(lpSystemAffinityMask
)
37 *lpSystemAffinityMask
=1;
41 /**********************************************************************
42 * SetThreadAffinityMask
43 * Works now like the Windows95 (no MP support) version
45 BOOL32 WINAPI
SetThreadAffinityMask(HANDLE32 hThread
, DWORD dwThreadAffinityMask
)
47 THDB
*thdb
= THREAD_GetPtr( hThread
, THREAD_SET_INFORMATION
, NULL
);
51 if (dwThreadAffinityMask
!=1) {
52 WARN(thread
,"(%d,%ld): only 1 processor supported.\n",
53 (int)hThread
,dwThreadAffinityMask
);
54 K32OBJ_DecCount((K32OBJ
*)thdb
);
57 K32OBJ_DecCount((K32OBJ
*)thdb
);
61 /**********************************************************************
62 * ContinueDebugEvent [KERNEL32.146]
64 BOOL32 WINAPI
ContinueDebugEvent(DWORD pid
,DWORD tid
,DWORD contstatus
) {
65 FIXME(win32
,"(0x%lx,%ld,%ld): stub\n",pid
,tid
,contstatus
);
69 /*********************************************************************
70 * Process_ClockTimeToFileTime
71 * (olorin@fandra.org, 20-Sep-1998)
72 * Converts clock_t into FILETIME.
73 * Used by GetProcessTime.
74 * Differences to UnixTimeToFileTime:
75 * 1) Divided by CLK_TCK
76 * 2) Time is relative. There is no 'starting date', so there is
77 * no need in offset correction, like in UnixTimeToFileTime
78 * FIXME: This function should be moved to a more appropriate .c file
79 * FIXME: On floating point operations, it is assumed that
80 * floating values are truncated on convertion to integer.
82 void Process_ClockTimeToFileTime( clock_t unix_time
, LPFILETIME filetime
)
84 double td
= (unix_time
*10000000.0)/CLK_TCK
;
85 /* Yes, double, because long int might overflow here. */
86 #if (SIZEOF_LONG_LONG >= 8)
87 unsigned long long t
= td
;
88 filetime
->dwLowDateTime
= (UINT32
) t
;
89 filetime
->dwHighDateTime
= (UINT32
) (t
>> 32);
91 double divider
= 1. * (1 << 16) * (1 << 16);
92 filetime
->dwHighDateTime
= (UINT32
) (td
/ divider
);
93 filetime
->dwLowDateTime
= (UINT32
) (td
- filetime
->dwHighDateTime
*divider
);
94 /* using floor() produces wierd results, better leave this as it is
95 * ( with (UINT32) convertion )
100 /*********************************************************************
101 * GetProcessTimes [KERNEL32.262]
103 * FIXME: lpCreationTime, lpExitTime are NOT INITIALIZED.
104 * olorin@fandra.org: Would be nice to substract the cpu time,
105 * used by Wine at startup.
106 * Also, there is a need to separate times
107 * used by different applications.
109 BOOL32 WINAPI
GetProcessTimes(
110 HANDLE32 hprocess
,LPFILETIME lpCreationTime
,LPFILETIME lpExitTime
,
111 LPFILETIME lpKernelTime
, LPFILETIME lpUserTime
116 Process_ClockTimeToFileTime(tms
.tms_utime
,lpUserTime
);
117 Process_ClockTimeToFileTime(tms
.tms_stime
,lpKernelTime
);