2 * Win32 miscellaneous functions
4 * Copyright 1995 Thomas Sandford (tdgsandf@prds-grn.demon.co.uk)
7 /* Misc. new functions - they should be moved into appropriate files
16 #include "debugtools.h"
19 DECLARE_DEBUG_CHANNEL(debug
)
20 DECLARE_DEBUG_CHANNEL(win32
)
23 /****************************************************************************
24 * QueryPerformanceCounter (KERNEL32.564)
26 BOOL WINAPI
QueryPerformanceCounter(PLARGE_INTEGER counter
)
30 gettimeofday(&tv
,NULL
);
31 counter
->s
.LowPart
= tv
.tv_usec
+tv
.tv_sec
*1000000;
32 counter
->s
.HighPart
= 0;
36 /****************************************************************************
37 * QueryPerformanceFrequency (KERNEL32.565)
39 BOOL WINAPI
QueryPerformanceFrequency(PLARGE_INTEGER frequency
)
41 frequency
->s
.LowPart
= 1000000;
42 frequency
->s
.HighPart
= 0;
46 /****************************************************************************
47 * FlushInstructionCache (KERNEL32.261)
49 BOOL WINAPI
FlushInstructionCache(DWORD x
,DWORD y
,DWORD z
) {
50 FIXME_(debug
)("(0x%08lx,0x%08lx,0x%08lx): stub\n",x
,y
,z
);
54 /***********************************************************************
55 * CreateNamedPipeA (KERNEL32.168)
57 HANDLE WINAPI
CreateNamedPipeA (LPCSTR lpName
, DWORD dwOpenMode
,
58 DWORD dwPipeMode
, DWORD nMaxInstances
,
59 DWORD nOutBufferSize
, DWORD nInBufferSize
,
60 DWORD nDefaultTimeOut
,
61 LPSECURITY_ATTRIBUTES lpSecurityAttributes
)
63 FIXME_(win32
)("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
64 debugstr_a(lpName
), dwOpenMode
, dwPipeMode
, nMaxInstances
,
65 nOutBufferSize
, nInBufferSize
, nDefaultTimeOut
,
66 lpSecurityAttributes
);
67 /* if (nMaxInstances > PIPE_UNLIMITED_INSTANCES) {
68 SetLastError (ERROR_INVALID_PARAMETER);
69 return INVALID_HANDLE_VALUE;
72 SetLastError (ERROR_UNKNOWN
);
73 return INVALID_HANDLE_VALUE
;
76 /***********************************************************************
77 * CreateNamedPipeW (KERNEL32.169)
79 HANDLE WINAPI
CreateNamedPipeW (LPCWSTR lpName
, DWORD dwOpenMode
,
80 DWORD dwPipeMode
, DWORD nMaxInstances
,
81 DWORD nOutBufferSize
, DWORD nInBufferSize
,
82 DWORD nDefaultTimeOut
,
83 LPSECURITY_ATTRIBUTES lpSecurityAttributes
)
85 FIXME_(win32
)("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
86 debugstr_w(lpName
), dwOpenMode
, dwPipeMode
, nMaxInstances
,
87 nOutBufferSize
, nInBufferSize
, nDefaultTimeOut
,
88 lpSecurityAttributes
);
90 SetLastError (ERROR_UNKNOWN
);
91 return INVALID_HANDLE_VALUE
;
94 /***********************************************************************
95 * GetSystemPowerStatus (KERNEL32.621)
97 BOOL WINAPI
GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr
)
99 return FALSE
; /* no power management support */
103 /***********************************************************************
104 * SetSystemPowerState (KERNEL32.630)
106 BOOL WINAPI
SetSystemPowerState(BOOL suspend_or_hibernate
,
109 /* suspend_or_hibernate flag: w95 does not support
110 this feature anyway */
125 /******************************************************************************
126 * CreateMailslot32A [KERNEL32.164]
128 HANDLE WINAPI
CreateMailslotA( LPCSTR lpName
, DWORD nMaxMessageSize
,
129 DWORD lReadTimeout
, LPSECURITY_ATTRIBUTES sa
)
131 FIXME_(win32
)("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName
),
132 nMaxMessageSize
, lReadTimeout
, sa
);
137 /******************************************************************************
138 * CreateMailslot32W [KERNEL32.165] Creates a mailslot with specified name
141 * lpName [I] Pointer to string for mailslot name
142 * nMaxMessageSize [I] Maximum message size
143 * lReadTimeout [I] Milliseconds before read time-out
144 * sa [I] Pointer to security structure
147 * Success: Handle to mailslot
148 * Failure: INVALID_HANDLE_VALUE
150 HANDLE WINAPI
CreateMailslotW( LPCWSTR lpName
, DWORD nMaxMessageSize
,
151 DWORD lReadTimeout
, LPSECURITY_ATTRIBUTES sa
)
153 FIXME_(win32
)("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName
),
154 nMaxMessageSize
, lReadTimeout
, sa
);
159 /******************************************************************************
160 * GetMailslotInfo [KERNEL32.347] Retrieves info about specified mailslot
163 * hMailslot [I] Mailslot handle
164 * lpMaxMessageSize [O] Address of maximum message size
165 * lpNextSize [O] Address of size of next message
166 * lpMessageCount [O] Address of number of messages
167 * lpReadTimeout [O] Address of read time-out
173 BOOL WINAPI
GetMailslotInfo( HANDLE hMailslot
, LPDWORD lpMaxMessageSize
,
174 LPDWORD lpNextSize
, LPDWORD lpMessageCount
,
175 LPDWORD lpReadTimeout
)
177 FIXME_(win32
)("(%04x): stub\n",hMailslot
);
178 if (lpMaxMessageSize
) *lpMaxMessageSize
= (DWORD
)NULL
;
179 if (lpNextSize
) *lpNextSize
= (DWORD
)NULL
;
180 if (lpMessageCount
) *lpMessageCount
= (DWORD
)NULL
;
181 if (lpReadTimeout
) *lpReadTimeout
= (DWORD
)NULL
;
186 /******************************************************************************
187 * GetCompressedFileSize32A [KERNEL32.291]
190 * This should call the W function below
192 DWORD WINAPI
GetCompressedFileSizeA(
194 LPDWORD lpFileSizeHigh
)
196 FIXME_(win32
)("(...): stub\n");
201 /******************************************************************************
202 * GetCompressedFileSize32W [KERNEL32.292]
205 * Success: Low-order doubleword of number of bytes
206 * Failure: 0xffffffff
208 DWORD WINAPI
GetCompressedFileSizeW(
209 LPCWSTR lpFileName
, /* [in] Pointer to name of file */
210 LPDWORD lpFileSizeHigh
) /* [out] Receives high-order doubleword of size */
212 FIXME_(win32
)("(%s,%p): stub\n",debugstr_w(lpFileName
),lpFileSizeHigh
);
217 /******************************************************************************
218 * GetProcessWindowStation [USER32.280] Returns handle of window station
221 * Docs say the return value is HWINSTA
224 * Success: Handle to window station associated with calling process
227 DWORD WINAPI
GetProcessWindowStation(void)
229 FIXME_(win32
)("(void): stub\n");
234 /******************************************************************************
235 * GetThreadDesktop [USER32.295] Returns handle to desktop
238 * Docs say the return value is HDESK
241 * dwThreadId [I] Thread identifier
244 * Success: Handle to desktop associated with specified thread
247 DWORD WINAPI
GetThreadDesktop( DWORD dwThreadId
)
249 FIXME_(win32
)("(%lx): stub\n",dwThreadId
);
254 /******************************************************************************
255 * SetDebugErrorLevel [USER32.475]
256 * Sets the minimum error level for generating debugging events
259 * dwLevel [I] Debugging error level
261 VOID WINAPI
SetDebugErrorLevel( DWORD dwLevel
)
263 FIXME_(win32
)("(%ld): stub\n", dwLevel
);
267 /******************************************************************************
268 * SetComputerName32A [KERNEL32.621]
270 BOOL WINAPI
SetComputerNameA( LPCSTR lpComputerName
)
272 LPWSTR lpComputerNameW
= HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName
);
273 BOOL ret
= SetComputerNameW(lpComputerNameW
);
274 HeapFree(GetProcessHeap(),0,lpComputerNameW
);
279 /******************************************************************************
280 * SetComputerName32W [KERNEL32.622]
283 * lpComputerName [I] Address of new computer name
287 BOOL WINAPI
SetComputerNameW( LPCWSTR lpComputerName
)
289 FIXME_(win32
)("(%s): stub\n", debugstr_w(lpComputerName
));
294 BOOL WINAPI
EnumPortsA(LPSTR name
,DWORD level
,LPBYTE ports
,DWORD bufsize
,LPDWORD bufneeded
,LPDWORD bufreturned
) {
295 FIXME_(win32
)("(%s,%ld,%p,%ld,%p,%p), stub!\n",name
,level
,ports
,bufsize
,bufneeded
,bufreturned
);
299 /******************************************************************************
300 * IsDebuggerPresent [KERNEL32.827]
303 BOOL WINAPI
IsDebuggerPresent() {
304 FIXME_(win32
)(" ... no debuggers yet, returning FALSE.\n");
308 /******************************************************************************
309 * OpenDesktop32A [USER32.408]
312 * Return type should be HDESK
314 * Not supported on Win9x - returns NULL and calls SetLastError.
316 HANDLE WINAPI
OpenDesktopA( LPCSTR lpszDesktop
, DWORD dwFlags
,
317 BOOL fInherit
, DWORD dwDesiredAccess
)
319 FIXME_(win32
)("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop
),dwFlags
,
320 fInherit
,dwDesiredAccess
);
322 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
327 BOOL WINAPI
SetUserObjectInformationA( HANDLE hObj
, int nIndex
,
328 LPVOID pvInfo
, DWORD nLength
)
330 FIXME_(win32
)("(%x,%d,%p,%lx): stub\n",hObj
,nIndex
,pvInfo
,nLength
);
335 BOOL WINAPI
SetThreadDesktop( HANDLE hDesktop
)
337 FIXME_(win32
)("(%x): stub\n",hDesktop
);
341 HANDLE WINAPI
CreateIoCompletionPort(HANDLE hFileHandle
,
342 HANDLE hExistingCompletionPort
, DWORD dwCompletionKey
,
343 DWORD dwNumberOfConcurrentThreads
)
345 FIXME_(win32
)("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle
, hExistingCompletionPort
, dwCompletionKey
, dwNumberOfConcurrentThreads
);