Fixed THUNK_SetDCHook when using native USER.
[wine/multimedia.git] / win32 / newfns.c
blobdc87993a932ce1deee4b6d47ce1076b306c949ca
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"
17 #include "debugstr.h"
19 DECLARE_DEBUG_CHANNEL(debug)
20 DECLARE_DEBUG_CHANNEL(win32)
23 /****************************************************************************
24 * QueryPerformanceCounter (KERNEL32.564)
26 BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
28 struct timeval tv;
30 gettimeofday(&tv,NULL);
31 counter->LowPart = tv.tv_usec+tv.tv_sec*1000000;
32 counter->HighPart = 0;
33 return TRUE;
36 /****************************************************************************
37 * QueryPerformanceFrequency (KERNEL32.565)
39 BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
41 frequency->LowPart = 1000000;
42 frequency->HighPart = 0;
43 return TRUE;
46 /****************************************************************************
47 * FlushInstructionCache (KERNEL32.261)
49 BOOL WINAPI FlushInstructionCache(DWORD x,DWORD y,DWORD z) {
50 FIXME_(debug)("(0x%08lx,0x%08lx,0x%08lx): stub\n",x,y,z);
51 return TRUE;
54 /***********************************************************************
55 * CreateNamedPipeA (KERNEL32.168)
57 HANDLE WINAPI CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode,
58 DWORD dwPipeMode, DWORD nMaxInstances,
59 DWORD nOutBufferSize, DWORD nInBufferSize,
60 DWORD nDefaultTimeOut,
61 LPSECURITY_ATTRIBUTES lpSecurityAttributes)
63 FIXME_(win32)("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
64 debugstr_a(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
65 nOutBufferSize, nInBufferSize, nDefaultTimeOut,
66 lpSecurityAttributes);
67 /* if (nMaxInstances > PIPE_UNLIMITED_INSTANCES) {
68 SetLastError (ERROR_INVALID_PARAMETER);
69 return INVALID_HANDLE_VALUE;
70 } */
72 SetLastError (ERROR_UNKNOWN);
73 return INVALID_HANDLE_VALUE;
76 /***********************************************************************
77 * CreateNamedPipeW (KERNEL32.169)
79 HANDLE WINAPI CreateNamedPipeW (LPCWSTR lpName, DWORD dwOpenMode,
80 DWORD dwPipeMode, DWORD nMaxInstances,
81 DWORD nOutBufferSize, DWORD nInBufferSize,
82 DWORD nDefaultTimeOut,
83 LPSECURITY_ATTRIBUTES lpSecurityAttributes)
85 FIXME_(win32)("(Name=%s, OpenMode=%#08lx, dwPipeMode=%#08lx, MaxInst=%ld, OutBSize=%ld, InBuffSize=%ld, DefTimeOut=%ld, SecAttr=%p): stub\n",
86 debugstr_w(lpName), dwOpenMode, dwPipeMode, nMaxInstances,
87 nOutBufferSize, nInBufferSize, nDefaultTimeOut,
88 lpSecurityAttributes);
90 SetLastError (ERROR_UNKNOWN);
91 return INVALID_HANDLE_VALUE;
94 /***********************************************************************
95 * GetSystemPowerStatus (KERNEL32.621)
97 BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
99 return FALSE; /* no power management support */
103 /***********************************************************************
104 * SetSystemPowerState (KERNEL32.630)
106 BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
107 BOOL force_flag)
109 /* suspend_or_hibernate flag: w95 does not support
110 this feature anyway */
112 for ( ;0; )
114 if ( force_flag )
117 else
121 return TRUE;
125 /******************************************************************************
126 * CreateMailslot32A [KERNEL32.164]
128 HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
129 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa)
131 FIXME_(win32)("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
132 nMaxMessageSize, lReadTimeout, sa);
133 return 1;
137 /******************************************************************************
138 * CreateMailslot32W [KERNEL32.165] Creates a mailslot with specified name
140 * PARAMS
141 * lpName [I] Pointer to string for mailslot name
142 * nMaxMessageSize [I] Maximum message size
143 * lReadTimeout [I] Milliseconds before read time-out
144 * sa [I] Pointer to security structure
146 * RETURNS
147 * Success: Handle to mailslot
148 * Failure: INVALID_HANDLE_VALUE
150 HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
151 DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa )
153 FIXME_(win32)("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName),
154 nMaxMessageSize, lReadTimeout, sa);
155 return 1;
159 /******************************************************************************
160 * GetMailslotInfo [KERNEL32.347] Retrieves info about specified mailslot
162 * PARAMS
163 * hMailslot [I] Mailslot handle
164 * lpMaxMessageSize [O] Address of maximum message size
165 * lpNextSize [O] Address of size of next message
166 * lpMessageCount [O] Address of number of messages
167 * lpReadTimeout [O] Address of read time-out
169 * RETURNS
170 * Success: TRUE
171 * Failure: FALSE
173 BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
174 LPDWORD lpNextSize, LPDWORD lpMessageCount,
175 LPDWORD lpReadTimeout )
177 FIXME_(win32)("(%04x): stub\n",hMailslot);
178 if (lpMaxMessageSize) *lpMaxMessageSize = (DWORD)NULL;
179 if (lpNextSize) *lpNextSize = (DWORD)NULL;
180 if (lpMessageCount) *lpMessageCount = (DWORD)NULL;
181 if (lpReadTimeout) *lpReadTimeout = (DWORD)NULL;
182 return TRUE;
186 /******************************************************************************
187 * GetCompressedFileSize32A [KERNEL32.291]
189 * NOTES
190 * This should call the W function below
192 DWORD WINAPI GetCompressedFileSizeA(
193 LPCSTR lpFileName,
194 LPDWORD lpFileSizeHigh)
196 FIXME_(win32)("(...): stub\n");
197 return 0xffffffff;
201 /******************************************************************************
202 * GetCompressedFileSize32W [KERNEL32.292]
204 * RETURNS
205 * Success: Low-order doubleword of number of bytes
206 * Failure: 0xffffffff
208 DWORD WINAPI GetCompressedFileSizeW(
209 LPCWSTR lpFileName, /* [in] Pointer to name of file */
210 LPDWORD lpFileSizeHigh) /* [out] Receives high-order doubleword of size */
212 FIXME_(win32)("(%s,%p): stub\n",debugstr_w(lpFileName),lpFileSizeHigh);
213 return 0xffffffff;
217 /******************************************************************************
218 * GetProcessWindowStation [USER32.280] Returns handle of window station
220 * NOTES
221 * Docs say the return value is HWINSTA
223 * RETURNS
224 * Success: Handle to window station associated with calling process
225 * Failure: NULL
227 DWORD WINAPI GetProcessWindowStation(void)
229 FIXME_(win32)("(void): stub\n");
230 return 1;
234 /******************************************************************************
235 * GetThreadDesktop [USER32.295] Returns handle to desktop
237 * NOTES
238 * Docs say the return value is HDESK
240 * PARAMS
241 * dwThreadId [I] Thread identifier
243 * RETURNS
244 * Success: Handle to desktop associated with specified thread
245 * Failure: NULL
247 DWORD WINAPI GetThreadDesktop( DWORD dwThreadId )
249 FIXME_(win32)("(%lx): stub\n",dwThreadId);
250 return 1;
254 /******************************************************************************
255 * SetDebugErrorLevel [USER32.475]
256 * Sets the minimum error level for generating debugging events
258 * PARAMS
259 * dwLevel [I] Debugging error level
261 VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
263 FIXME_(win32)("(%ld): stub\n", dwLevel);
267 /******************************************************************************
268 * WaitForDebugEvent [KERNEL32.720]
269 * Waits for a debugging event to occur in a process being debugged
271 * PARAMS
272 * lpDebugEvent [I] Address of structure for event information
273 * dwMilliseconds [I] Number of milliseconds to wait for event
275 * RETURNS STD
277 BOOL WINAPI WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent,
278 DWORD dwMilliseconds )
280 FIXME_(win32)("(%p,%ld): stub\n", lpDebugEvent, dwMilliseconds);
281 return FALSE;
285 /******************************************************************************
286 * SetComputerName32A [KERNEL32.621]
288 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
290 LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
291 BOOL ret = SetComputerNameW(lpComputerNameW);
292 HeapFree(GetProcessHeap(),0,lpComputerNameW);
293 return ret;
297 /******************************************************************************
298 * SetComputerName32W [KERNEL32.622]
300 * PARAMS
301 * lpComputerName [I] Address of new computer name
303 * RETURNS STD
305 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
307 FIXME_(win32)("(%s): stub\n", debugstr_w(lpComputerName));
308 return TRUE;
312 BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
313 FIXME_(win32)("(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
314 return FALSE;
317 /******************************************************************************
318 * IsDebuggerPresent [KERNEL32.827]
321 BOOL WINAPI IsDebuggerPresent() {
322 FIXME_(win32)(" ... no debuggers yet, returning FALSE.\n");
323 return FALSE;
326 /******************************************************************************
327 * OpenDesktop32A [USER32.408]
329 * NOTES
330 * Return type should be HDESK
332 HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
333 BOOL fInherit, DWORD dwDesiredAccess )
335 FIXME_(win32)("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
336 fInherit,dwDesiredAccess);
337 return 1;
341 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, int nIndex,
342 LPVOID pvInfo, DWORD nLength )
344 FIXME_(win32)("(%x,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
345 return TRUE;
349 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
351 FIXME_(win32)("(%x): stub\n",hDesktop);
352 return TRUE;
355 HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
356 HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
357 DWORD dwNumberOfConcurrentThreads)
359 FIXME_(win32)("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
360 return (HANDLE)NULL;