Some fixes and additions.
[wine/multimedia.git] / win32 / newfns.c
blob902a79b812843d7071a944e249423ab24c0b89ce
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 "wintypes.h"
14 #include "winerror.h"
15 #include "heap.h"
16 #include "debug.h"
17 #include "debugstr.h"
20 /****************************************************************************
21 * QueryPerformanceCounter (KERNEL32.564)
23 BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
25 struct timeval tv;
27 gettimeofday(&tv,NULL);
28 counter->LowPart = tv.tv_usec+tv.tv_sec*1000000;
29 counter->HighPart = 0;
30 return TRUE;
33 /****************************************************************************
34 * QueryPerformanceFrequency (KERNEL32.565)
36 BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
38 frequency->LowPart = 1000000;
39 frequency->HighPart = 0;
40 return TRUE;
43 /****************************************************************************
44 * FlushInstructionCache (KERNEL32.261)
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;
51 /***********************************************************************
52 * CreateNamedPipeA (KERNEL32.168)
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)
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 } */
69 SetLastError (ERROR_UNKNOWN);
70 return INVALID_HANDLE_VALUE;
73 /***********************************************************************
74 * CreateNamedPipeW (KERNEL32.169)
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)
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);
87 SetLastError (ERROR_UNKNOWN);
88 return INVALID_HANDLE_VALUE;
91 /***********************************************************************
92 * GetSystemPowerStatus (KERNEL32.621)
94 BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
96 return FALSE; /* no power management support */
100 /***********************************************************************
101 * SetSystemPowerState (KERNEL32.630)
103 BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
104 BOOL force_flag)
106 /* suspend_or_hibernate flag: w95 does not support
107 this feature anyway */
109 for ( ;0; )
111 if ( force_flag )
114 else
118 return TRUE;
122 /******************************************************************************
123 * CreateMailslot32A [KERNEL32.164]
125 HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
126 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa)
128 FIXME(win32, "(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
129 nMaxMessageSize, lReadTimeout, sa);
130 return 1;
134 /******************************************************************************
135 * CreateMailslot32W [KERNEL32.165] Creates a mailslot with specified name
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
143 * RETURNS
144 * Success: Handle to mailslot
145 * Failure: INVALID_HANDLE_VALUE
147 HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
148 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa )
150 FIXME(win32, "(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName),
151 nMaxMessageSize, lReadTimeout, sa);
152 return 1;
156 /******************************************************************************
157 * GetMailslotInfo [KERNEL32.347] Retrieves info about specified mailslot
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
166 * RETURNS
167 * Success: TRUE
168 * Failure: FALSE
170 BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
171 LPDWORD lpNextSize, LPDWORD lpMessageCount,
172 LPDWORD lpReadTimeout )
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;
183 /******************************************************************************
184 * GetCompressedFileSize32A [KERNEL32.291]
186 * NOTES
187 * This should call the W function below
189 DWORD WINAPI GetCompressedFileSizeA(
190 LPCSTR lpFileName,
191 LPDWORD lpFileSizeHigh)
193 FIXME(win32, "(...): stub\n");
194 return 0xffffffff;
198 /******************************************************************************
199 * GetCompressedFileSize32W [KERNEL32.292]
201 * RETURNS
202 * Success: Low-order doubleword of number of bytes
203 * Failure: 0xffffffff
205 DWORD WINAPI GetCompressedFileSizeW(
206 LPCWSTR lpFileName, /* [in] Pointer to name of file */
207 LPDWORD lpFileSizeHigh) /* [out] Receives high-order doubleword of size */
209 FIXME(win32, "(%s,%p): stub\n",debugstr_w(lpFileName),lpFileSizeHigh);
210 return 0xffffffff;
214 /******************************************************************************
215 * GetProcessWindowStation [USER32.280] Returns handle of window station
217 * NOTES
218 * Docs say the return value is HWINSTA
220 * RETURNS
221 * Success: Handle to window station associated with calling process
222 * Failure: NULL
224 DWORD WINAPI GetProcessWindowStation(void)
226 FIXME(win32, "(void): stub\n");
227 return 1;
231 /******************************************************************************
232 * GetThreadDesktop [USER32.295] Returns handle to desktop
234 * NOTES
235 * Docs say the return value is HDESK
237 * PARAMS
238 * dwThreadId [I] Thread identifier
240 * RETURNS
241 * Success: Handle to desktop associated with specified thread
242 * Failure: NULL
244 DWORD WINAPI GetThreadDesktop( DWORD dwThreadId )
246 FIXME(win32, "(%lx): stub\n",dwThreadId);
247 return 1;
251 /******************************************************************************
252 * SetDebugErrorLevel [USER32.475]
253 * Sets the minimum error level for generating debugging events
255 * PARAMS
256 * dwLevel [I] Debugging error level
258 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
260 FIXME(win32, "(%ld): stub\n", dwLevel);
264 /******************************************************************************
265 * WaitForDebugEvent [KERNEL32.720]
266 * Waits for a debugging event to occur in a process being debugged
268 * PARAMS
269 * lpDebugEvent [I] Address of structure for event information
270 * dwMilliseconds [I] Number of milliseconds to wait for event
272 * RETURNS STD
274 BOOL WINAPI WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent,
275 DWORD dwMilliseconds )
277 FIXME(win32, "(%p,%ld): stub\n", lpDebugEvent, dwMilliseconds);
278 return FALSE;
282 /******************************************************************************
283 * SetComputerName32A [KERNEL32.621]
285 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
287 LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
288 BOOL ret = SetComputerNameW(lpComputerNameW);
289 HeapFree(GetProcessHeap(),0,lpComputerNameW);
290 return ret;
294 /******************************************************************************
295 * SetComputerName32W [KERNEL32.622]
297 * PARAMS
298 * lpComputerName [I] Address of new computer name
300 * RETURNS STD
302 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
304 FIXME(win32, "(%s): stub\n", debugstr_w(lpComputerName));
305 return TRUE;
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;
314 /******************************************************************************
315 * IsDebuggerPresent [KERNEL32.827]
318 BOOL WINAPI IsDebuggerPresent() {
319 FIXME(win32," ... no debuggers yet, returning FALSE.\n");
320 return FALSE;
323 /******************************************************************************
324 * OpenDesktop32A [USER32.408]
326 * NOTES
327 * Return type should be HDESK
329 HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
330 BOOL fInherit, DWORD dwDesiredAccess )
332 FIXME(win32,"(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
333 fInherit,dwDesiredAccess);
334 return 1;
338 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, int nIndex,
339 LPVOID pvInfo, DWORD nLength )
341 FIXME(win32,"(%x,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
342 return TRUE;
346 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
348 FIXME(win32,"(%x): stub\n",hDesktop);
349 return TRUE;