Remember owner HWND when creating and use this hwnd for the WM_NOTIFY
[wine] / win32 / newfns.c
1 /*
2  * Win32 miscellaneous functions
3  *
4  * Copyright 1995 Thomas Sandford (tdgsandf@prds-grn.demon.co.uk)
5  */
6
7 /* Misc. new functions - they should be moved into appropriate files
8 at a later date. */
9
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
18 DEFAULT_DEBUG_CHANNEL(win32);
19 DECLARE_DEBUG_CHANNEL(debug);
20
21
22 /****************************************************************************
23  *              QueryPerformanceCounter (KERNEL32.564)
24  */
25 BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
26 {
27     struct timeval tv;
28
29     gettimeofday(&tv,NULL);
30     counter->s.LowPart = tv.tv_usec+tv.tv_sec*1000000;
31     counter->s.HighPart = 0;
32     return TRUE;
33 }
34
35 /****************************************************************************
36  *              QueryPerformanceFrequency (KERNEL32.565)
37  */
38 BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
39 {
40         frequency->s.LowPart    = 1000000;
41         frequency->s.HighPart   = 0;
42         return TRUE;
43 }
44
45 /****************************************************************************
46  *              FlushInstructionCache (KERNEL32.261)
47  */
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;
51 }
52
53 /***********************************************************************
54  *           GetSystemPowerStatus      (KERNEL32.621)
55  */
56 BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr)
57 {
58     return FALSE;   /* no power management support */
59 }
60
61
62 /***********************************************************************
63  *           SetSystemPowerState      (KERNEL32.630)
64  */
65 BOOL WINAPI SetSystemPowerState(BOOL suspend_or_hibernate,
66                                   BOOL force_flag)
67 {
68     /* suspend_or_hibernate flag: w95 does not support
69        this feature anyway */
70
71     for ( ;0; )
72     {
73         if ( force_flag )
74         {
75         }
76         else
77         {
78         }
79     }
80     return TRUE;
81 }
82
83
84 /******************************************************************************
85  * CreateMailslotA [KERNEL32.164]
86  */
87 HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
88                                    DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa)
89 {
90     FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_a(lpName),
91           nMaxMessageSize, lReadTimeout, sa);
92     return 1;
93 }
94
95
96 /******************************************************************************
97  * CreateMailslotW [KERNEL32.165]  Creates a mailslot with specified name
98  * 
99  * PARAMS
100  *    lpName          [I] Pointer to string for mailslot name
101  *    nMaxMessageSize [I] Maximum message size
102  *    lReadTimeout    [I] Milliseconds before read time-out
103  *    sa              [I] Pointer to security structure
104  *
105  * RETURNS
106  *    Success: Handle to mailslot
107  *    Failure: INVALID_HANDLE_VALUE
108  */
109 HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize,
110                                    DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa )
111 {
112     FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName), 
113           nMaxMessageSize, lReadTimeout, sa);
114     return 1;
115 }
116
117
118 /******************************************************************************
119  * GetMailslotInfo [KERNEL32.347]  Retrieves info about specified mailslot
120  *
121  * PARAMS
122  *    hMailslot        [I] Mailslot handle
123  *    lpMaxMessageSize [O] Address of maximum message size
124  *    lpNextSize       [O] Address of size of next message
125  *    lpMessageCount   [O] Address of number of messages
126  *    lpReadTimeout    [O] Address of read time-out
127  * 
128  * RETURNS
129  *    Success: TRUE
130  *    Failure: FALSE
131  */
132 BOOL WINAPI GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize,
133                                LPDWORD lpNextSize, LPDWORD lpMessageCount,
134                                LPDWORD lpReadTimeout )
135 {
136     FIXME("(%04x): stub\n",hMailslot);
137     if (lpMaxMessageSize) *lpMaxMessageSize = (DWORD)NULL;
138     if (lpNextSize) *lpNextSize = (DWORD)NULL;
139     if (lpMessageCount) *lpMessageCount = (DWORD)NULL;
140     if (lpReadTimeout) *lpReadTimeout = (DWORD)NULL;
141     return TRUE;
142 }
143
144
145 /******************************************************************************
146  * GetCompressedFileSizeA [KERNEL32.291]
147  *
148  * NOTES
149  *    This should call the W function below
150  */
151 DWORD WINAPI GetCompressedFileSizeA(
152     LPCSTR lpFileName,
153     LPDWORD lpFileSizeHigh)
154 {
155     FIXME("(...): stub\n");
156     return 0xffffffff;
157 }
158
159
160 /******************************************************************************
161  * GetCompressedFileSizeW [KERNEL32.292]  
162  * 
163  * RETURNS
164  *    Success: Low-order doubleword of number of bytes
165  *    Failure: 0xffffffff
166  */
167 DWORD WINAPI GetCompressedFileSizeW(
168     LPCWSTR lpFileName,     /* [in]  Pointer to name of file */
169     LPDWORD lpFileSizeHigh) /* [out] Receives high-order doubleword of size */
170 {
171     FIXME("(%s,%p): stub\n",debugstr_w(lpFileName),lpFileSizeHigh);
172     return 0xffffffff;
173 }
174
175
176 /******************************************************************************
177  * SetComputerNameA [KERNEL32.621]  
178  */
179 BOOL WINAPI SetComputerNameA( LPCSTR lpComputerName )
180 {
181     LPWSTR lpComputerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpComputerName);
182     BOOL ret = SetComputerNameW(lpComputerNameW);
183     HeapFree(GetProcessHeap(),0,lpComputerNameW);
184     return ret;
185 }
186
187
188 /******************************************************************************
189  * SetComputerNameW [KERNEL32.622]
190  *
191  * PARAMS
192  *    lpComputerName [I] Address of new computer name
193  * 
194  * RETURNS STD
195  */
196 BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
197 {
198     FIXME("(%s): stub\n", debugstr_w(lpComputerName));
199     return TRUE;
200 }
201
202 /******************************************************************************
203  *              EnumPortsA
204  */
205 BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE ports,DWORD bufsize,LPDWORD bufneeded,LPDWORD bufreturned) {
206         FIXME("(%s,%ld,%p,%ld,%p,%p), stub!\n",name,level,ports,bufsize,bufneeded,bufreturned);
207         return FALSE;
208 }
209
210 /******************************************************************************
211  *              CreateIoCompletionPort
212  */
213 HANDLE WINAPI CreateIoCompletionPort(HANDLE hFileHandle,
214 HANDLE hExistingCompletionPort, DWORD dwCompletionKey,
215 DWORD dwNumberOfConcurrentThreads)
216 {
217     FIXME("(%04x, %04x, %08lx, %08lx): stub.\n", hFileHandle, hExistingCompletionPort, dwCompletionKey, dwNumberOfConcurrentThreads);
218     return (HANDLE)NULL;
219 }