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"
18 DEFAULT_DEBUG_CHANNEL(win32);
19 DECLARE_DEBUG_CHANNEL(debug);
22 /****************************************************************************
23 * QueryPerformanceCounter (KERNEL32.564)
25 BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
29 gettimeofday(&tv,NULL);
30 counter->s.LowPart = tv.tv_usec+tv.tv_sec*1000000;
31 counter->s.HighPart = 0;
35 /****************************************************************************
36 * QueryPerformanceFrequency (KERNEL32.565)
38 BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
40 frequency->s.LowPart = 1000000;
41 frequency->s.HighPart = 0;
45 /****************************************************************************
46 * FlushInstructionCache (KERNEL32.261)
48 BOOL WINAPI FlushInstructionCache(DWORD x,DWORD y,DWORD z) {
49 FIXME_(debug)("(0x%08lx,0x%08lx,0x%08lx): stub\n",x,y,z);
53 /***********************************************************************
54 * CreateNamedPipeA (KERNEL32.168)
56 HANDLE WINAPI CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode,
57 DWORD dwPipeMode, DWORD nMaxInstances,
58 DWORD nOutBufferSize, DWORD nInBufferSize,
59 DWORD nDefaultTimeOut,
60 LPSECURITY_ATTRIBUTES lpSecurityAttributes)
62 FIXME("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
63 debugstr_a(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
64 nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes);
65 /* if (nMaxInstances > PIPE_UNLIMITED_INSTANCES) {
66 SetLastError (ERROR_INVALID_PARAMETER);
67 return INVALID_HANDLE_VALUE;
70 SetLastError (ERROR_UNKNOWN);
71 return INVALID_HANDLE_VALUE;
74 /***********************************************************************
75 * CreateNamedPipeW (KERNEL32.169)
77 HANDLE WINAPI CreateNamedPipeW (LPCWSTR lpName, DWORD dwOpenMode,
78 DWORD dwPipeMode, DWORD nMaxInstances,
79 DWORD nOutBufferSize, DWORD nInBufferSize,
80 DWORD nDefaultTimeOut,
81 LPSECURITY_ATTRIBUTES lpSecurityAttributes)
83 FIXME("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
84 debugstr_w(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
85 nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes);
87 SetLastError (ERROR_UNKNOWN);
88 return INVALID_HANDLE_VALUE;
91 /***********************************************************************
92 * PeekNamedPipe (KERNEL32.552)
94 BOOL WINAPI PeekNamedPipe (HANDLE hPipe,
95 LPVOID lpvBuffer, DWORD cbBuffer,
96 LPDWORD lpcbRead, LPDWORD lpcbAvail, LPDWORD lpcbMessage)
98 FIXME("(%08x, %p, %08lx, %p, %p, %p): stub\n",
99 hPipe, lpvBuffer, cbBuffer, lpcbRead, lpcbAvail, lpcbMessage);
101 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
106 /***********************************************************************
107 * GetSystemPowerStatus (KERNEL32.621)
109 BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
111 return FALSE; /* no power management support */
115 /***********************************************************************
116 * SetSystemPowerState (KERNEL32.630)
118 BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
121 /* suspend_or_hibernate flag: w95 does not support
122 this feature anyway */
137 /******************************************************************************
138 * CreateMailslotA [KERNEL32.164]
140 HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
141 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa)
143 FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
144 nMaxMessageSize, lReadTimeout, sa);
149 /******************************************************************************
150 * CreateMailslotW [KERNEL32.165] Creates a mailslot with specified name
153 * lpName [I] Pointer to string for mailslot name
154 * nMaxMessageSize [I] Maximum message size
155 * lReadTimeout [I] Milliseconds before read time-out
156 * sa [I] Pointer to security structure
159 * Success: Handle to mailslot
160 * Failure: INVALID_HANDLE_VALUE
162 HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
163 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa )
165 FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName),
166 nMaxMessageSize, lReadTimeout, sa);
171 /******************************************************************************
172 * GetMailslotInfo [KERNEL32.347] Retrieves info about specified mailslot
175 * hMailslot [I] Mailslot handle
176 * lpMaxMessageSize [O] Address of maximum message size
177 * lpNextSize [O] Address of size of next message
178 * lpMessageCount [O] Address of number of messages
179 * lpReadTimeout [O] Address of read time-out
185 BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
186 LPDWORD lpNextSize, LPDWORD lpMessageCount,
187 LPDWORD lpReadTimeout )
189 FIXME("(%04x): stub\n",hMailslot);
190 if (lpMaxMessageSize) *lpMaxMessageSize = (DWORD)NULL;
191 if (lpNextSize) *lpNextSize = (DWORD)NULL;
192 if (lpMessageCount) *lpMessageCount = (DWORD)NULL;
193 if (lpReadTimeout) *lpReadTimeout = (DWORD)NULL;
198 /******************************************************************************
199 * GetCompressedFileSizeA [KERNEL32.291]
202 * This should call the W function below
204 DWORD WINAPI GetCompressedFileSizeA(
206 LPDWORD lpFileSizeHigh)
208 FIXME("(...): stub\n");
213 /******************************************************************************
214 * GetCompressedFileSizeW [KERNEL32.292]
217 * Success: Low-order doubleword of number of bytes
218 * Failure: 0xffffffff
220 DWORD WINAPI GetCompressedFileSizeW(
221 LPCWSTR lpFileName, /* [in] Pointer to name of file */
222 LPDWORD lpFileSizeHigh) /* [out] Receives high-order doubleword of size */
224 FIXME("(%s,%p): stub\n",debugstr_w(lpFileName),lpFileSizeHigh);
229 /******************************************************************************
230 * GetProcessWindowStation [USER32.280] Returns handle of window station
233 * Docs say the return value is HWINSTA
236 * Success: Handle to window station associated with calling process
239 DWORD WINAPI GetProcessWindowStation(void)
241 FIXME("(void): stub\n");
246 /******************************************************************************
247 * GetThreadDesktop [USER32.295] Returns handle to desktop
250 * Docs say the return value is HDESK
253 * dwThreadId [I] Thread identifier
256 * Success: Handle to desktop associated with specified thread
259 DWORD WINAPI GetThreadDesktop( DWORD dwThreadId )
261 FIXME("(%lx): stub\n",dwThreadId);
266 /******************************************************************************
267 * SetDebugErrorLevel [USER32.475]
268 * Sets the minimum error level for generating debugging events
271 * dwLevel [I] Debugging error level
273 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
275 FIXME("(%ld): stub\n", dwLevel);
279 /******************************************************************************
280 * SetComputerNameA [KERNEL32.621]
282 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
284 LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
285 BOOL ret = SetComputerNameW(lpComputerNameW);
286 HeapFree(GetProcessHeap(),0,lpComputerNameW);
291 /******************************************************************************
292 * SetComputerNameW [KERNEL32.622]
295 * lpComputerName [I] Address of new computer name
299 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
301 FIXME("(%s): stub\n", debugstr_w(lpComputerName));
305 /******************************************************************************
308 BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
309 FIXME("(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
313 /******************************************************************************
314 * OpenDesktopA [USER32.408]
317 * Return type should be HDESK
319 * Not supported on Win9x - returns NULL and calls SetLastError.
321 HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
322 BOOL fInherit, DWORD dwDesiredAccess )
324 FIXME("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
325 fInherit,dwDesiredAccess);
327 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
332 /******************************************************************************
333 * SetUserObjectInformationA
335 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, INT nIndex,
336 LPVOID pvInfo, DWORD nLength )
338 FIXME("(%x,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
342 /******************************************************************************
345 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
347 FIXME("(%x): stub\n",hDesktop);
351 /******************************************************************************
352 * CreateIoCompletionPort
354 HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
355 HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
356 DWORD dwNumberOfConcurrentThreads)
358 FIXME("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
363 /******************************************************************************
364 * GetProcessDefaultLayout [USER32.802]
366 * Gets the default layout for parentless windows.
367 * Right now, just returns 0 (left-to-right).
376 BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
378 if ( !pdwDefaultLayout ) {
379 SetLastError( ERROR_INVALID_PARAMETER );
382 FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
383 *pdwDefaultLayout = 0;
388 /******************************************************************************
389 * SetProcessDefaultLayout [USER32.803]
391 * Sets the default layout for parentless windows.
392 * Right now, only accepts 0 (left-to-right).
401 BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
403 if ( dwDefaultLayout == 0 )
405 FIXME( "( %08lx ): No BiDi\n", dwDefaultLayout );
406 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );