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 DEFAULT_DEBUG_CHANNEL(win32
)
20 DECLARE_DEBUG_CHANNEL(debug
)
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("(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
, lpSecurityAttributes
);
66 /* if (nMaxInstances > PIPE_UNLIMITED_INSTANCES) {
67 SetLastError (ERROR_INVALID_PARAMETER);
68 return INVALID_HANDLE_VALUE;
71 SetLastError (ERROR_UNKNOWN
);
72 return INVALID_HANDLE_VALUE
;
75 /***********************************************************************
76 * CreateNamedPipeW (KERNEL32.169)
78 HANDLE WINAPI
CreateNamedPipeW (LPCWSTR lpName
, DWORD dwOpenMode
,
79 DWORD dwPipeMode
, DWORD nMaxInstances
,
80 DWORD nOutBufferSize
, DWORD nInBufferSize
,
81 DWORD nDefaultTimeOut
,
82 LPSECURITY_ATTRIBUTES lpSecurityAttributes
)
84 FIXME("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
85 debugstr_w(lpName
), dwOpenMode
, dwPipeMode
, nMaxInstances
,
86 nOutBufferSize
, nInBufferSize
, nDefaultTimeOut
, lpSecurityAttributes
);
88 SetLastError (ERROR_UNKNOWN
);
89 return INVALID_HANDLE_VALUE
;
92 /***********************************************************************
93 * GetSystemPowerStatus (KERNEL32.621)
95 BOOL WINAPI
GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr
)
97 return FALSE
; /* no power management support */
101 /***********************************************************************
102 * SetSystemPowerState (KERNEL32.630)
104 BOOL WINAPI
SetSystemPowerState(BOOL suspend_or_hibernate
,
107 /* suspend_or_hibernate flag: w95 does not support
108 this feature anyway */
123 /******************************************************************************
124 * CreateMailslot32A [KERNEL32.164]
126 HANDLE WINAPI
CreateMailslotA( LPCSTR lpName
, DWORD nMaxMessageSize
,
127 DWORD lReadTimeout
, LPSECURITY_ATTRIBUTES sa
)
129 FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName
),
130 nMaxMessageSize
, lReadTimeout
, sa
);
135 /******************************************************************************
136 * CreateMailslot32W [KERNEL32.165] Creates a mailslot with specified name
139 * lpName [I] Pointer to string for mailslot name
140 * nMaxMessageSize [I] Maximum message size
141 * lReadTimeout [I] Milliseconds before read time-out
142 * sa [I] Pointer to security structure
145 * Success: Handle to mailslot
146 * Failure: INVALID_HANDLE_VALUE
148 HANDLE WINAPI
CreateMailslotW( LPCWSTR lpName
, DWORD nMaxMessageSize
,
149 DWORD lReadTimeout
, LPSECURITY_ATTRIBUTES sa
)
151 FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName
),
152 nMaxMessageSize
, lReadTimeout
, sa
);
157 /******************************************************************************
158 * GetMailslotInfo [KERNEL32.347] Retrieves info about specified mailslot
161 * hMailslot [I] Mailslot handle
162 * lpMaxMessageSize [O] Address of maximum message size
163 * lpNextSize [O] Address of size of next message
164 * lpMessageCount [O] Address of number of messages
165 * lpReadTimeout [O] Address of read time-out
171 BOOL WINAPI
GetMailslotInfo( HANDLE hMailslot
, LPDWORD lpMaxMessageSize
,
172 LPDWORD lpNextSize
, LPDWORD lpMessageCount
,
173 LPDWORD lpReadTimeout
)
175 FIXME("(%04x): stub\n",hMailslot
);
176 if (lpMaxMessageSize
) *lpMaxMessageSize
= (DWORD
)NULL
;
177 if (lpNextSize
) *lpNextSize
= (DWORD
)NULL
;
178 if (lpMessageCount
) *lpMessageCount
= (DWORD
)NULL
;
179 if (lpReadTimeout
) *lpReadTimeout
= (DWORD
)NULL
;
184 /******************************************************************************
185 * GetCompressedFileSize32A [KERNEL32.291]
188 * This should call the W function below
190 DWORD WINAPI
GetCompressedFileSizeA(
192 LPDWORD lpFileSizeHigh
)
194 FIXME("(...): stub\n");
199 /******************************************************************************
200 * GetCompressedFileSize32W [KERNEL32.292]
203 * Success: Low-order doubleword of number of bytes
204 * Failure: 0xffffffff
206 DWORD WINAPI
GetCompressedFileSizeW(
207 LPCWSTR lpFileName
, /* [in] Pointer to name of file */
208 LPDWORD lpFileSizeHigh
) /* [out] Receives high-order doubleword of size */
210 FIXME("(%s,%p): stub\n",debugstr_w(lpFileName
),lpFileSizeHigh
);
215 /******************************************************************************
216 * GetProcessWindowStation [USER32.280] Returns handle of window station
219 * Docs say the return value is HWINSTA
222 * Success: Handle to window station associated with calling process
225 DWORD WINAPI
GetProcessWindowStation(void)
227 FIXME("(void): stub\n");
232 /******************************************************************************
233 * GetThreadDesktop [USER32.295] Returns handle to desktop
236 * Docs say the return value is HDESK
239 * dwThreadId [I] Thread identifier
242 * Success: Handle to desktop associated with specified thread
245 DWORD WINAPI
GetThreadDesktop( DWORD dwThreadId
)
247 FIXME("(%lx): stub\n",dwThreadId
);
252 /******************************************************************************
253 * SetDebugErrorLevel [USER32.475]
254 * Sets the minimum error level for generating debugging events
257 * dwLevel [I] Debugging error level
259 VOID WINAPI
SetDebugErrorLevel( DWORD dwLevel
)
261 FIXME("(%ld): stub\n", dwLevel
);
265 /******************************************************************************
266 * SetComputerName32A [KERNEL32.621]
268 BOOL WINAPI
SetComputerNameA( LPCSTR lpComputerName
)
270 LPWSTR lpComputerNameW
= HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName
);
271 BOOL ret
= SetComputerNameW(lpComputerNameW
);
272 HeapFree(GetProcessHeap(),0,lpComputerNameW
);
277 /******************************************************************************
278 * SetComputerName32W [KERNEL32.622]
281 * lpComputerName [I] Address of new computer name
285 BOOL WINAPI
SetComputerNameW( LPCWSTR lpComputerName
)
287 FIXME("(%s): stub\n", debugstr_w(lpComputerName
));
292 BOOL WINAPI
EnumPortsA(LPSTR name
,DWORD level
,LPBYTE ports
,DWORD bufsize
,LPDWORD bufneeded
,LPDWORD bufreturned
) {
293 FIXME("(%s,%ld,%p,%ld,%p,%p), stub!\n",name
,level
,ports
,bufsize
,bufneeded
,bufreturned
);
297 /******************************************************************************
298 * IsDebuggerPresent [KERNEL32.827]
301 BOOL WINAPI
IsDebuggerPresent() {
302 FIXME(" ... no debuggers yet, returning FALSE.\n");
306 /******************************************************************************
307 * OpenDesktop32A [USER32.408]
310 * Return type should be HDESK
312 * Not supported on Win9x - returns NULL and calls SetLastError.
314 HANDLE WINAPI
OpenDesktopA( LPCSTR lpszDesktop
, DWORD dwFlags
,
315 BOOL fInherit
, DWORD dwDesiredAccess
)
317 FIXME("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop
),dwFlags
,
318 fInherit
,dwDesiredAccess
);
320 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
325 BOOL WINAPI
SetUserObjectInformationA( HANDLE hObj
, int nIndex
,
326 LPVOID pvInfo
, DWORD nLength
)
328 FIXME("(%x,%d,%p,%lx): stub\n",hObj
,nIndex
,pvInfo
,nLength
);
333 BOOL WINAPI
SetThreadDesktop( HANDLE hDesktop
)
335 FIXME("(%x): stub\n",hDesktop
);
339 HANDLE WINAPI
CreateIoCompletionPort(HANDLE hFileHandle
,
340 HANDLE hExistingCompletionPort
, DWORD dwCompletionKey
,
341 DWORD dwNumberOfConcurrentThreads
)
343 FIXME("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle
, hExistingCompletionPort
, dwCompletionKey
, dwNumberOfConcurrentThreads
);
348 /******************************************************************************
349 * GetProcessDefaultLayout [USER32.802]
351 * Gets the default layout for parentless windows.
352 * Right now, just returns 0 (left-to-right).
361 BOOL WINAPI
GetProcessDefaultLayout( DWORD
*pdwDefaultLayout
)
363 if ( !pdwDefaultLayout
) {
364 SetLastError( ERROR_INVALID_PARAMETER
);
367 *pdwDefaultLayout
= 0;
372 /******************************************************************************
373 * SetProcessDefaultLayout [USER32.803]
375 * Sets the default layout for parentless windows.
376 * Right now, only accepts 0 (left-to-right).
385 BOOL WINAPI
SetProcessDefaultLayout( DWORD dwDefaultLayout
)
387 return ( dwDefaultLayout
== 0 );