Fixed asm() constraints.
[wine/multimedia.git] / win32 / newfns.c
blob57af990e637ac5cda666b80f37a7e1128b34a5a1
1 /*
2 * Win32 miscellaneous functions
4 * Copyright 1995 Thomas Sandford (tdgsandf@prds-grn.demon.co.uk)
5 */
7 /* Misc. new functions - they should be moved into appropriate files
8 at a later date. */
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 "debugtools.h"
18 DEFAULT_DEBUG_CHANNEL(win32);
19 DECLARE_DEBUG_CHANNEL(debug);
22 /****************************************************************************
23 * QueryPerformanceCounter (KERNEL32.564)
25 BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
27 struct timeval tv;
29 gettimeofday(&tv,NULL);
30 counter->s.LowPart = tv.tv_usec+tv.tv_sec*1000000;
31 counter->s.HighPart = 0;
32 return TRUE;
35 /****************************************************************************
36 * QueryPerformanceFrequency (KERNEL32.565)
38 BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
40 frequency->s.LowPart = 1000000;
41 frequency->s.HighPart = 0;
42 return TRUE;
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);
50 return TRUE;
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;
68 } */
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);
102 return FALSE;
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,
119 BOOL force_flag)
121 /* suspend_or_hibernate flag: w95 does not support
122 this feature anyway */
124 for ( ;0; )
126 if ( force_flag )
129 else
133 return TRUE;
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);
145 return 1;
149 /******************************************************************************
150 * CreateMailslotW [KERNEL32.165] Creates a mailslot with specified name
152 * PARAMS
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
158 * RETURNS
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);
167 return 1;
171 /******************************************************************************
172 * GetMailslotInfo [KERNEL32.347] Retrieves info about specified mailslot
174 * PARAMS
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
181 * RETURNS
182 * Success: TRUE
183 * Failure: FALSE
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;
194 return TRUE;
198 /******************************************************************************
199 * GetCompressedFileSizeA [KERNEL32.291]
201 * NOTES
202 * This should call the W function below
204 DWORD WINAPI GetCompressedFileSizeA(
205 LPCSTR lpFileName,
206 LPDWORD lpFileSizeHigh)
208 FIXME("(...): stub\n");
209 return 0xffffffff;
213 /******************************************************************************
214 * GetCompressedFileSizeW [KERNEL32.292]
216 * RETURNS
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);
225 return 0xffffffff;
229 /******************************************************************************
230 * GetProcessWindowStation [USER32.280] Returns handle of window station
232 * NOTES
233 * Docs say the return value is HWINSTA
235 * RETURNS
236 * Success: Handle to window station associated with calling process
237 * Failure: NULL
239 DWORD WINAPI GetProcessWindowStation(void)
241 FIXME("(void): stub\n");
242 return 1;
246 /******************************************************************************
247 * GetThreadDesktop [USER32.295] Returns handle to desktop
249 * NOTES
250 * Docs say the return value is HDESK
252 * PARAMS
253 * dwThreadId [I] Thread identifier
255 * RETURNS
256 * Success: Handle to desktop associated with specified thread
257 * Failure: NULL
259 DWORD WINAPI GetThreadDesktop( DWORD dwThreadId )
261 FIXME("(%lx): stub\n",dwThreadId);
262 return 1;
266 /******************************************************************************
267 * SetDebugErrorLevel [USER32.475]
268 * Sets the minimum error level for generating debugging events
270 * PARAMS
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);
287 return ret;
291 /******************************************************************************
292 * SetComputerNameW [KERNEL32.622]
294 * PARAMS
295 * lpComputerName [I] Address of new computer name
297 * RETURNS STD
299 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
301 FIXME("(%s): stub\n", debugstr_w(lpComputerName));
302 return TRUE;
305 /******************************************************************************
306 * EnumPortsA
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);
310 return FALSE;
313 /******************************************************************************
314 * OpenDesktopA [USER32.408]
316 * NOTES
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);
328 return 0;
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);
339 return TRUE;
342 /******************************************************************************
343 * SetThreadDesktop
345 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
347 FIXME("(%x): stub\n",hDesktop);
348 return TRUE;
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);
359 return (HANDLE)NULL;
363 /******************************************************************************
364 * GetProcessDefaultLayout [USER32.802]
366 * Gets the default layout for parentless windows.
367 * Right now, just returns 0 (left-to-right).
369 * RETURNS
370 * Success: Nonzero
371 * Failure: Zero
373 * BUGS
374 * No RTL
376 BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
378 if ( !pdwDefaultLayout ) {
379 SetLastError( ERROR_INVALID_PARAMETER );
380 return FALSE;
382 FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
383 *pdwDefaultLayout = 0;
384 return TRUE;
388 /******************************************************************************
389 * SetProcessDefaultLayout [USER32.803]
391 * Sets the default layout for parentless windows.
392 * Right now, only accepts 0 (left-to-right).
394 * RETURNS
395 * Success: Nonzero
396 * Failure: Zero
398 * BUGS
399 * No RTL
401 BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
403 if ( dwDefaultLayout == 0 )
404 return TRUE;
405 FIXME( "( %08lx ): No BiDi\n", dwDefaultLayout );
406 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
407 return FALSE;