Implementation of custom dialog messages and notifications.
[wine.git] / win32 / newfns.c
blobcd25162c954a6ec63962e9076e74c02d8f935179
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->s.LowPart = tv.tv_usec+tv.tv_sec*1000000;
32 counter->s.HighPart = 0;
33 return TRUE;
36 /****************************************************************************
37 * QueryPerformanceFrequency (KERNEL32.565)
39 BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
41 frequency->s.LowPart = 1000000;
42 frequency->s.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 * SetComputerName32A [KERNEL32.621]
270 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
272 LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
273 BOOL ret = SetComputerNameW(lpComputerNameW);
274 HeapFree(GetProcessHeap(),0,lpComputerNameW);
275 return ret;
279 /******************************************************************************
280 * SetComputerName32W [KERNEL32.622]
282 * PARAMS
283 * lpComputerName [I] Address of new computer name
285 * RETURNS STD
287 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
289 FIXME_(win32)("(%s): stub\n", debugstr_w(lpComputerName));
290 return TRUE;
294 BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
295 FIXME_(win32)("(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
296 return FALSE;
299 /******************************************************************************
300 * IsDebuggerPresent [KERNEL32.827]
303 BOOL WINAPI IsDebuggerPresent() {
304 FIXME_(win32)(" ... no debuggers yet, returning FALSE.\n");
305 return FALSE;
308 /******************************************************************************
309 * OpenDesktop32A [USER32.408]
311 * NOTES
312 * Return type should be HDESK
314 * Not supported on Win9x - returns NULL and calls SetLastError.
316 HANDLE WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags,
317 BOOL fInherit, DWORD dwDesiredAccess )
319 FIXME_(win32)("(%s,%lx,%i,%lx): stub\n",debugstr_a(lpszDesktop),dwFlags,
320 fInherit,dwDesiredAccess);
322 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
323 return NULL;
327 BOOL WINAPI SetUserObjectInformationA( HANDLE hObj, int nIndex,
328 LPVOID pvInfo, DWORD nLength )
330 FIXME_(win32)("(%x,%d,%p,%lx): stub\n",hObj,nIndex,pvInfo,nLength);
331 return TRUE;
335 BOOL WINAPI SetThreadDesktop( HANDLE hDesktop )
337 FIXME_(win32)("(%x): stub\n",hDesktop);
338 return TRUE;
341 HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
342 HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
343 DWORD dwNumberOfConcurrentThreads)
345 FIXME_(win32)("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
346 return (HANDLE)NULL;