Fixed pixmap leak with the 1x1 bitmap in memory DCs.
[wine/multimedia.git] / win32 / newfns.c
blob9dd357989d5877e330ccfcf06a4a695e49089be0
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 * 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 * CreateMailslotA [KERNEL32.164]
125 HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
126 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa)
128 FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
129 nMaxMessageSize, lReadTimeout, sa);
130 return 1;
134 /******************************************************************************
135 * CreateMailslotW [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("(%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("(%04x): stub\n",hMailslot);
175 if (lpMaxMessageSize) *lpMaxMessageSize = (DWORD)NULL;
176 if (lpNextSize) *lpNextSize = (DWORD)NULL;
177 if (lpMessageCount) *lpMessageCount = (DWORD)NULL;
178 if (lpReadTimeout) *lpReadTimeout = (DWORD)NULL;
179 return TRUE;
183 /******************************************************************************
184 * GetCompressedFileSizeA [KERNEL32.291]
186 * NOTES
187 * This should call the W function below
189 DWORD WINAPI GetCompressedFileSizeA(
190 LPCSTR lpFileName,
191 LPDWORD lpFileSizeHigh)
193 FIXME("(...): stub\n");
194 return 0xffffffff;
198 /******************************************************************************
199 * GetCompressedFileSizeW [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("(%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("(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("(%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("(%ld): stub\n", dwLevel);
264 /******************************************************************************
265 * SetComputerNameA [KERNEL32.621]
267 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
269 LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
270 BOOL ret = SetComputerNameW(lpComputerNameW);
271 HeapFree(GetProcessHeap(),0,lpComputerNameW);
272 return ret;
276 /******************************************************************************
277 * SetComputerNameW [KERNEL32.622]
279 * PARAMS
280 * lpComputerName [I] Address of new computer name
282 * RETURNS STD
284 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
286 FIXME("(%s): stub\n", debugstr_w(lpComputerName));
287 return TRUE;
290 /******************************************************************************
291 * EnumPortsA
293 BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
294 FIXME("(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
295 return FALSE;
298 /******************************************************************************
299 * OpenDesktopA [USER32.408]
301 * NOTES
302 * Return type should be HDESK
304 * Not supported on Win9x - returns NULL and calls SetLastError.
306 HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
307 BOOL fInherit, DWORD dwDesiredAccess )
309 FIXME("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
310 fInherit,dwDesiredAccess);
312 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
313 return 0;
317 /******************************************************************************
318 * SetUserObjectInformationA
320 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, INT nIndex,
321 LPVOID pvInfo, DWORD nLength )
323 FIXME("(%x,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
324 return TRUE;
327 /******************************************************************************
328 * SetThreadDesktop
330 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
332 FIXME("(%x): stub\n",hDesktop);
333 return TRUE;
336 /******************************************************************************
337 * CreateIoCompletionPort
339 HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
340 HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
341 DWORD dwNumberOfConcurrentThreads)
343 FIXME("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
344 return (HANDLE)NULL;
348 /******************************************************************************
349 * GetProcessDefaultLayout [USER32.802]
351 * Gets the default layout for parentless windows.
352 * Right now, just returns 0 (left-to-right).
354 * RETURNS
355 * Success: Nonzero
356 * Failure: Zero
358 * BUGS
359 * No RTL
361 BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
363 if ( !pdwDefaultLayout ) {
364 SetLastError( ERROR_INVALID_PARAMETER );
365 return FALSE;
367 FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
368 *pdwDefaultLayout = 0;
369 return TRUE;
373 /******************************************************************************
374 * SetProcessDefaultLayout [USER32.803]
376 * Sets the default layout for parentless windows.
377 * Right now, only accepts 0 (left-to-right).
379 * RETURNS
380 * Success: Nonzero
381 * Failure: Zero
383 * BUGS
384 * No RTL
386 BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
388 if ( dwDefaultLayout == 0 )
389 return TRUE;
390 FIXME( "( %08lx ): No BiDi\n", dwDefaultLayout );
391 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
392 return FALSE;