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