Added a few DirectInput 7 definitions and C++ fixes.
[wine.git] / win32 / newfns.c
blob11e099941683580c8186c7a3595840c97b6590a4
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 * SetComputerNameA [KERNEL32.621]
232 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
234 LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
235 BOOL ret = SetComputerNameW(lpComputerNameW);
236 HeapFree(GetProcessHeap(),0,lpComputerNameW);
237 return ret;
241 /******************************************************************************
242 * SetComputerNameW [KERNEL32.622]
244 * PARAMS
245 * lpComputerName [I] Address of new computer name
247 * RETURNS STD
249 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
251 FIXME("(%s): stub\n", debugstr_w(lpComputerName));
252 return TRUE;
255 /******************************************************************************
256 * EnumPortsA
258 BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
259 FIXME("(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
260 return FALSE;
263 /******************************************************************************
264 * CreateIoCompletionPort
266 HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
267 HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
268 DWORD dwNumberOfConcurrentThreads)
270 FIXME("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
271 return (HANDLE)NULL;