blob: 63da291e8b13528d95cb18e48b8d0048eb8891ac [file] [log] [blame]
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +00001/*
2 * Win32 miscellaneous functions
3 *
4 * Copyright 1995 Thomas Sandford (tdgsandf@prds-grn.demon.co.uk)
5 */
6
7/* Misc. new functions - they should be moved into appropriate files
8at a later date. */
9
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000010#include <string.h>
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000011#include <sys/time.h>
12#include <unistd.h>
Jim Aston2e1cafa1999-03-14 16:35:05 +000013#include "windef.h"
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +000014#include "winerror.h"
Alexandre Julliard46ea8b31998-05-03 19:01:20 +000015#include "heap.h"
Alexandre Julliard06c275a1999-05-02 14:32:27 +000016#include "debugtools.h"
Alexandre Julliardf90efa91998-06-14 15:24:15 +000017#include "debugstr.h"
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +000018
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000019DECLARE_DEBUG_CHANNEL(debug)
20DECLARE_DEBUG_CHANNEL(win32)
21
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000022
Alexandre Julliard77b99181997-09-14 17:17:23 +000023/****************************************************************************
Alexandre Julliarde658d821997-11-30 17:45:40 +000024 * QueryPerformanceCounter (KERNEL32.564)
Alexandre Julliard0e270f41996-08-24 18:26:35 +000025 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000026BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
Alexandre Julliard670cdc41997-08-24 16:00:30 +000027{
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000028 struct timeval tv;
29
30 gettimeofday(&tv,NULL);
31 counter->LowPart = tv.tv_usec+tv.tv_sec*1000000;
32 counter->HighPart = 0;
33 return TRUE;
Alexandre Julliarde658d821997-11-30 17:45:40 +000034}
35
Alexandre Julliarde658d821997-11-30 17:45:40 +000036/****************************************************************************
37 * QueryPerformanceFrequency (KERNEL32.565)
38 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000039BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
Alexandre Julliarde658d821997-11-30 17:45:40 +000040{
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000041 frequency->LowPart = 1000000;
Alexandre Julliarde658d821997-11-30 17:45:40 +000042 frequency->HighPart = 0;
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000043 return TRUE;
Alexandre Julliarde658d821997-11-30 17:45:40 +000044}
45
46/****************************************************************************
Alexandre Julliarda11d7b11998-03-01 20:05:02 +000047 * FlushInstructionCache (KERNEL32.261)
48 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000049BOOL WINAPI FlushInstructionCache(DWORD x,DWORD y,DWORD z) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +000050 FIXME_(debug)("(0x%08lx,0x%08lx,0x%08lx): stub\n",x,y,z);
Alexandre Julliarda11d7b11998-03-01 20:05:02 +000051 return TRUE;
52}
Alexandre Julliard54c27111998-03-29 19:44:57 +000053
54/***********************************************************************
55 * CreateNamedPipeA (KERNEL32.168)
56 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000057HANDLE WINAPI CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode,
Alexandre Julliard54c27111998-03-29 19:44:57 +000058 DWORD dwPipeMode, DWORD nMaxInstances,
59 DWORD nOutBufferSize, DWORD nInBufferSize,
Alexandre Julliardf90efa91998-06-14 15:24:15 +000060 DWORD nDefaultTimeOut,
Alexandre Julliard54c27111998-03-29 19:44:57 +000061 LPSECURITY_ATTRIBUTES lpSecurityAttributes)
62{
Alexandre Julliard06c275a1999-05-02 14:32:27 +000063 FIXME_(win32)("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
Alexandre Julliard46ea8b31998-05-03 19:01:20 +000064 debugstr_a(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
Alexandre Julliardf90efa91998-06-14 15:24:15 +000065 nOutBufferSize, nInBufferSize, nDefaultTimeOut,
Alexandre Julliard46ea8b31998-05-03 19:01:20 +000066 lpSecurityAttributes);
Alexandre Julliard54c27111998-03-29 19:44:57 +000067 /* if (nMaxInstances > PIPE_UNLIMITED_INSTANCES) {
68 SetLastError (ERROR_INVALID_PARAMETER);
69 return INVALID_HANDLE_VALUE;
70 } */
71
72 SetLastError (ERROR_UNKNOWN);
Alexandre Julliarda3960291999-02-26 11:11:13 +000073 return INVALID_HANDLE_VALUE;
Alexandre Julliard54c27111998-03-29 19:44:57 +000074}
75
76/***********************************************************************
77 * CreateNamedPipeW (KERNEL32.169)
78 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000079HANDLE WINAPI CreateNamedPipeW (LPCWSTR lpName, DWORD dwOpenMode,
Alexandre Julliard54c27111998-03-29 19:44:57 +000080 DWORD dwPipeMode, DWORD nMaxInstances,
81 DWORD nOutBufferSize, DWORD nInBufferSize,
Alexandre Julliardf90efa91998-06-14 15:24:15 +000082 DWORD nDefaultTimeOut,
Alexandre Julliard54c27111998-03-29 19:44:57 +000083 LPSECURITY_ATTRIBUTES lpSecurityAttributes)
84{
Alexandre Julliard06c275a1999-05-02 14:32:27 +000085 FIXME_(win32)("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
Alexandre Julliard46ea8b31998-05-03 19:01:20 +000086 debugstr_w(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
Alexandre Julliardf90efa91998-06-14 15:24:15 +000087 nOutBufferSize, nInBufferSize, nDefaultTimeOut,
Alexandre Julliard46ea8b31998-05-03 19:01:20 +000088 lpSecurityAttributes);
Alexandre Julliard54c27111998-03-29 19:44:57 +000089
90 SetLastError (ERROR_UNKNOWN);
Alexandre Julliarda3960291999-02-26 11:11:13 +000091 return INVALID_HANDLE_VALUE;
Alexandre Julliard54c27111998-03-29 19:44:57 +000092}
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000093
94/***********************************************************************
95 * GetSystemPowerStatus (KERNEL32.621)
96 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000097BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000098{
99 return FALSE; /* no power management support */
100}
101
102
103/***********************************************************************
104 * SetSystemPowerState (KERNEL32.630)
105 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000106BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
107 BOOL force_flag)
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000108{
109 /* suspend_or_hibernate flag: w95 does not support
110 this feature anyway */
111
112 for ( ;0; )
113 {
114 if ( force_flag )
115 {
116 }
117 else
118 {
119 }
120 }
121 return TRUE;
122}
123
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000124
125/******************************************************************************
126 * CreateMailslot32A [KERNEL32.164]
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000127 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000128HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000129 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa)
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000130{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000131 FIXME_(win32)("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000132 nMaxMessageSize, lReadTimeout, sa);
133 return 1;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000134}
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000135
136
137/******************************************************************************
138 * CreateMailslot32W [KERNEL32.165] Creates a mailslot with specified name
139 *
140 * PARAMS
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
145 *
146 * RETURNS
147 * Success: Handle to mailslot
148 * Failure: INVALID_HANDLE_VALUE
149 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000150HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000151 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa )
152{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000153 FIXME_(win32)("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName),
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000154 nMaxMessageSize, lReadTimeout, sa);
155 return 1;
156}
157
158
159/******************************************************************************
160 * GetMailslotInfo [KERNEL32.347] Retrieves info about specified mailslot
161 *
162 * PARAMS
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
168 *
169 * RETURNS
170 * Success: TRUE
171 * Failure: FALSE
172 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000173BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000174 LPDWORD lpNextSize, LPDWORD lpMessageCount,
175 LPDWORD lpReadTimeout )
176{
Andreas Mohr99920811999-05-04 16:54:39 +0000177 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;
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000182 return TRUE;
183}
184
185
186/******************************************************************************
187 * GetCompressedFileSize32A [KERNEL32.291]
188 *
189 * NOTES
190 * This should call the W function below
191 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000192DWORD WINAPI GetCompressedFileSizeA(
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000193 LPCSTR lpFileName,
194 LPDWORD lpFileSizeHigh)
195{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000196 FIXME_(win32)("(...): stub\n");
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000197 return 0xffffffff;
198}
199
200
201/******************************************************************************
202 * GetCompressedFileSize32W [KERNEL32.292]
203 *
204 * RETURNS
205 * Success: Low-order doubleword of number of bytes
206 * Failure: 0xffffffff
207 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000208DWORD WINAPI GetCompressedFileSizeW(
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000209 LPCWSTR lpFileName, /* [in] Pointer to name of file */
210 LPDWORD lpFileSizeHigh) /* [out] Receives high-order doubleword of size */
211{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000212 FIXME_(win32)("(%s,%p): stub\n",debugstr_w(lpFileName),lpFileSizeHigh);
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000213 return 0xffffffff;
214}
215
216
217/******************************************************************************
218 * GetProcessWindowStation [USER32.280] Returns handle of window station
219 *
220 * NOTES
221 * Docs say the return value is HWINSTA
222 *
223 * RETURNS
224 * Success: Handle to window station associated with calling process
225 * Failure: NULL
226 */
227DWORD WINAPI GetProcessWindowStation(void)
228{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000229 FIXME_(win32)("(void): stub\n");
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000230 return 1;
231}
232
233
234/******************************************************************************
235 * GetThreadDesktop [USER32.295] Returns handle to desktop
236 *
237 * NOTES
238 * Docs say the return value is HDESK
239 *
240 * PARAMS
241 * dwThreadId [I] Thread identifier
242 *
243 * RETURNS
244 * Success: Handle to desktop associated with specified thread
245 * Failure: NULL
246 */
247DWORD WINAPI GetThreadDesktop( DWORD dwThreadId )
248{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000249 FIXME_(win32)("(%lx): stub\n",dwThreadId);
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000250 return 1;
251}
252
253
254/******************************************************************************
255 * SetDebugErrorLevel [USER32.475]
256 * Sets the minimum error level for generating debugging events
257 *
258 * PARAMS
259 * dwLevel [I] Debugging error level
260 */
261VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
262{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000263 FIXME_(win32)("(%ld): stub\n", dwLevel);
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000264}
265
266
267/******************************************************************************
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000268 * SetComputerName32A [KERNEL32.621]
269 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000270BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000271{
272 LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000273 BOOL ret = SetComputerNameW(lpComputerNameW);
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000274 HeapFree(GetProcessHeap(),0,lpComputerNameW);
275 return ret;
276}
277
278
279/******************************************************************************
280 * SetComputerName32W [KERNEL32.622]
281 *
282 * PARAMS
283 * lpComputerName [I] Address of new computer name
284 *
285 * RETURNS STD
286 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000287BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000288{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000289 FIXME_(win32)("(%s): stub\n", debugstr_w(lpComputerName));
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000290 return TRUE;
291}
292
Alexandre Julliarda845b881998-06-01 10:44:35 +0000293
Alexandre Julliarda3960291999-02-26 11:11:13 +0000294BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000295 FIXME_(win32)("(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
Alexandre Julliarda845b881998-06-01 10:44:35 +0000296 return FALSE;
297}
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000298
299/******************************************************************************
300 * IsDebuggerPresent [KERNEL32.827]
301 *
302 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000303BOOL WINAPI IsDebuggerPresent() {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000304 FIXME_(win32)(" ... no debuggers yet, returning FALSE.\n");
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000305 return FALSE;
306}
307
Alexandre Julliard642d3131998-07-12 19:29:36 +0000308/******************************************************************************
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000309 * OpenDesktop32A [USER32.408]
310 *
311 * NOTES
312 * Return type should be HDESK
313 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000314HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
315 BOOL fInherit, DWORD dwDesiredAccess )
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000316{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000317 FIXME_(win32)("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000318 fInherit,dwDesiredAccess);
319 return 1;
320}
321
322
Alexandre Julliarda3960291999-02-26 11:11:13 +0000323BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, int nIndex,
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000324 LPVOID pvInfo, DWORD nLength )
325{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000326 FIXME_(win32)("(%x,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000327 return TRUE;
328}
329
330
Alexandre Julliarda3960291999-02-26 11:11:13 +0000331BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000332{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000333 FIXME_(win32)("(%x): stub\n",hDesktop);
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000334 return TRUE;
335}
336
Andreas Mohr702aec61999-03-28 13:11:46 +0000337HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
338HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
339DWORD dwNumberOfConcurrentThreads)
340{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000341 FIXME_(win32)("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
Andreas Mohr702aec61999-03-28 13:11:46 +0000342 return (HANDLE)NULL;
343}