Added (empty) stub for OpenVxDHandle.
[wine] / win32 / newfns.c
1 /*
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
8 at a later date. */
9
10 #include <string.h>
11 #include <sys/time.h>
12 #include <unistd.h>
13 #include "windef.h"
14 #include "winerror.h"
15 #include "heap.h"
16 #include "debug.h"
17 #include "debugstr.h"
18
19
20 /****************************************************************************
21  *              QueryPerformanceCounter (KERNEL32.564)
22  */
23 BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
24 {
25     struct timeval tv;
26
27     gettimeofday(&tv,NULL);
28     counter->LowPart = tv.tv_usec+tv.tv_sec*1000000;
29     counter->HighPart = 0;
30     return TRUE;
31 }
32
33 /****************************************************************************
34  *              QueryPerformanceFrequency (KERNEL32.565)
35  */
36 BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
37 {
38         frequency->LowPart      = 1000000;
39         frequency->HighPart     = 0;
40         return TRUE;
41 }
42
43 /****************************************************************************
44  *              FlushInstructionCache (KERNEL32.261)
45  */
46 BOOL WINAPI FlushInstructionCache(DWORD x,DWORD y,DWORD z) {
47         FIXME(debug,"(0x%08lx,0x%08lx,0x%08lx): stub\n",x,y,z);
48         return TRUE;
49 }
50
51 /***********************************************************************
52  *           CreateNamedPipeA   (KERNEL32.168)
53  */
54 HANDLE WINAPI CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode,
55                                   DWORD dwPipeMode, DWORD nMaxInstances,
56                                   DWORD nOutBufferSize, DWORD nInBufferSize,
57                                   DWORD nDefaultTimeOut,
58                                   LPSECURITY_ATTRIBUTES lpSecurityAttributes)
59 {
60   FIXME (win32, "(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
61          debugstr_a(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
62          nOutBufferSize, nInBufferSize, nDefaultTimeOut, 
63          lpSecurityAttributes);
64   /* if (nMaxInstances > PIPE_UNLIMITED_INSTANCES) {
65     SetLastError (ERROR_INVALID_PARAMETER);
66     return INVALID_HANDLE_VALUE;
67   } */
68
69   SetLastError (ERROR_UNKNOWN);
70   return INVALID_HANDLE_VALUE;
71 }
72
73 /***********************************************************************
74  *           CreateNamedPipeW   (KERNEL32.169)
75  */
76 HANDLE WINAPI CreateNamedPipeW (LPCWSTR lpName, DWORD dwOpenMode,
77                                   DWORD dwPipeMode, DWORD nMaxInstances,
78                                   DWORD nOutBufferSize, DWORD nInBufferSize,
79                                   DWORD nDefaultTimeOut,
80                                   LPSECURITY_ATTRIBUTES lpSecurityAttributes)
81 {
82   FIXME (win32, "(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
83          debugstr_w(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
84          nOutBufferSize, nInBufferSize, nDefaultTimeOut, 
85          lpSecurityAttributes);
86
87   SetLastError (ERROR_UNKNOWN);
88   return INVALID_HANDLE_VALUE;
89 }
90
91 /***********************************************************************
92  *           GetSystemPowerStatus      (KERNEL32.621)
93  */
94 BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
95 {
96     return FALSE;   /* no power management support */
97 }
98
99
100 /***********************************************************************
101  *           SetSystemPowerState      (KERNEL32.630)
102  */
103 BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
104                                   BOOL force_flag)
105 {
106     /* suspend_or_hibernate flag: w95 does not support
107        this feature anyway */
108
109     for ( ;0; )
110     {
111         if ( force_flag )
112         {
113         }
114         else
115         {
116         }
117     }
118     return TRUE;
119 }
120
121
122 /******************************************************************************
123  * CreateMailslot32A [KERNEL32.164]
124  */
125 HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
126                                    DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa)
127 {
128     FIXME(win32, "(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
129           nMaxMessageSize, lReadTimeout, sa);
130     return 1;
131 }
132
133
134 /******************************************************************************
135  * CreateMailslot32W [KERNEL32.165]  Creates a mailslot with specified name
136  * 
137  * PARAMS
138  *    lpName          [I] Pointer to string for mailslot name
139  *    nMaxMessageSize [I] Maximum message size
140  *    lReadTimeout    [I] Milliseconds before read time-out
141  *    sa              [I] Pointer to security structure
142  *
143  * RETURNS
144  *    Success: Handle to mailslot
145  *    Failure: INVALID_HANDLE_VALUE
146  */
147 HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
148                                    DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa )
149 {
150     FIXME(win32, "(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName), 
151           nMaxMessageSize, lReadTimeout, sa);
152     return 1;
153 }
154
155
156 /******************************************************************************
157  * GetMailslotInfo [KERNEL32.347]  Retrieves info about specified mailslot
158  *
159  * PARAMS
160  *    hMailslot        [I] Mailslot handle
161  *    lpMaxMessageSize [O] Address of maximum message size
162  *    lpNextSize       [O] Address of size of next message
163  *    lpMessageCount   [O] Address of number of messages
164  *    lpReadTimeout    [O] Address of read time-out
165  * 
166  * RETURNS
167  *    Success: TRUE
168  *    Failure: FALSE
169  */
170 BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
171                                LPDWORD lpNextSize, LPDWORD lpMessageCount,
172                                LPDWORD lpReadTimeout )
173 {
174     FIXME(win32, "(%d): stub\n",hMailslot);
175     *lpMaxMessageSize = (DWORD)NULL;
176     *lpNextSize = (DWORD)NULL;
177     *lpMessageCount = (DWORD)NULL;
178     *lpReadTimeout = (DWORD)NULL;
179     return TRUE;
180 }
181
182
183 /******************************************************************************
184  * GetCompressedFileSize32A [KERNEL32.291]
185  *
186  * NOTES
187  *    This should call the W function below
188  */
189 DWORD WINAPI GetCompressedFileSizeA(
190     LPCSTR lpFileName,
191     LPDWORD lpFileSizeHigh)
192 {
193     FIXME(win32, "(...): stub\n");
194     return 0xffffffff;
195 }
196
197
198 /******************************************************************************
199  * GetCompressedFileSize32W [KERNEL32.292]  
200  * 
201  * RETURNS
202  *    Success: Low-order doubleword of number of bytes
203  *    Failure: 0xffffffff
204  */
205 DWORD WINAPI GetCompressedFileSizeW(
206     LPCWSTR lpFileName,     /* [in]  Pointer to name of file */
207     LPDWORD lpFileSizeHigh) /* [out] Receives high-order doubleword of size */
208 {
209     FIXME(win32, "(%s,%p): stub\n",debugstr_w(lpFileName),lpFileSizeHigh);
210     return 0xffffffff;
211 }
212
213
214 /******************************************************************************
215  * GetProcessWindowStation [USER32.280]  Returns handle of window station
216  *
217  * NOTES
218  *    Docs say the return value is HWINSTA
219  *
220  * RETURNS
221  *    Success: Handle to window station associated with calling process
222  *    Failure: NULL
223  */
224 DWORD WINAPI GetProcessWindowStation(void)
225 {
226     FIXME(win32, "(void): stub\n");
227     return 1;
228 }
229
230
231 /******************************************************************************
232  * GetThreadDesktop [USER32.295]  Returns handle to desktop
233  *
234  * NOTES
235  *    Docs say the return value is HDESK
236  *
237  * PARAMS
238  *    dwThreadId [I] Thread identifier
239  *
240  * RETURNS
241  *    Success: Handle to desktop associated with specified thread
242  *    Failure: NULL
243  */
244 DWORD WINAPI GetThreadDesktop( DWORD dwThreadId )
245 {
246     FIXME(win32, "(%lx): stub\n",dwThreadId);
247     return 1;
248 }
249
250
251 /******************************************************************************
252  * SetDebugErrorLevel [USER32.475]
253  * Sets the minimum error level for generating debugging events
254  *
255  * PARAMS
256  *    dwLevel [I] Debugging error level
257  */
258 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
259 {
260     FIXME(win32, "(%ld): stub\n", dwLevel);
261 }
262
263
264 /******************************************************************************
265  * WaitForDebugEvent [KERNEL32.720]
266  * Waits for a debugging event to occur in a process being debugged
267  *
268  * PARAMS
269  *    lpDebugEvent   [I] Address of structure for event information
270  *    dwMilliseconds [I] Number of milliseconds to wait for event
271  *
272  * RETURNS STD
273  */
274 BOOL WINAPI WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent, 
275                                  DWORD dwMilliseconds )
276 {
277     FIXME(win32, "(%p,%ld): stub\n", lpDebugEvent, dwMilliseconds);
278     return FALSE;
279 }
280
281
282 /******************************************************************************
283  * SetComputerName32A [KERNEL32.621]  
284  */
285 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
286 {
287     LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
288     BOOL ret = SetComputerNameW(lpComputerNameW);
289     HeapFree(GetProcessHeap(),0,lpComputerNameW);
290     return ret;
291 }
292
293
294 /******************************************************************************
295  * SetComputerName32W [KERNEL32.622]
296  *
297  * PARAMS
298  *    lpComputerName [I] Address of new computer name
299  * 
300  * RETURNS STD
301  */
302 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
303 {
304     FIXME(win32, "(%s): stub\n", debugstr_w(lpComputerName));
305     return TRUE;
306 }
307
308
309 BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
310         FIXME(win32,"(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
311         return FALSE;
312 }
313
314 /******************************************************************************
315  * IsDebuggerPresent [KERNEL32.827]
316  *
317  */
318 BOOL WINAPI IsDebuggerPresent() {
319         FIXME(win32," ... no debuggers yet, returning FALSE.\n");
320         return FALSE; 
321 }
322
323 /******************************************************************************
324  * OpenDesktop32A [USER32.408]
325  *
326  * NOTES
327  *    Return type should be HDESK
328  */
329 HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags, 
330                                 BOOL fInherit, DWORD dwDesiredAccess )
331 {
332     FIXME(win32,"(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
333           fInherit,dwDesiredAccess);
334     return 1;
335 }
336
337
338 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, int nIndex, 
339                                            LPVOID pvInfo, DWORD nLength )
340 {
341     FIXME(win32,"(%x,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
342     return TRUE;
343 }
344
345
346 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
347 {
348     FIXME(win32,"(%x): stub\n",hDesktop);
349     return TRUE;
350 }
351
352 HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
353 HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
354 DWORD dwNumberOfConcurrentThreads)
355 {
356     FIXME(win32, "(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
357     return (HANDLE)NULL;
358 }