1 | /*
|
---|
2 | *
|
---|
3 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
4 | *
|
---|
5 | */
|
---|
6 | /*
|
---|
7 | * Win32 compatibility file functions for OS/2
|
---|
8 | *
|
---|
9 | * Copyright 1998 Sander van Leeuven
|
---|
10 | * Copyright 1998 Patrick Haller
|
---|
11 | * Copyright 1998 Peter Fitzsimmons
|
---|
12 | * Copyright 1998 Knut St. Osmundsen
|
---|
13 | *
|
---|
14 | * @(#) KERNEL32.CPP 1.0.1 1998/06/12 PH added HandleManager support
|
---|
15 | */
|
---|
16 |
|
---|
17 |
|
---|
18 | /*****************************************************************************
|
---|
19 | * Includes *
|
---|
20 | *****************************************************************************/
|
---|
21 | #include <os2win.h>
|
---|
22 | #include <winnt.h>
|
---|
23 | #include <winnls.h>
|
---|
24 | #include <stdlib.h>
|
---|
25 | #include <string.h>
|
---|
26 | #include "misc.h"
|
---|
27 | #include "devio.h"
|
---|
28 | #include "except.h"
|
---|
29 | #include <builtin.h>
|
---|
30 | #include "heap.h"
|
---|
31 | #include "handlemanager.h"
|
---|
32 | #include "os2util.h"
|
---|
33 | #include "wprocess.h"
|
---|
34 |
|
---|
35 |
|
---|
36 | /*****************************************************************************
|
---|
37 | * Defines *
|
---|
38 | *****************************************************************************/
|
---|
39 |
|
---|
40 | /* this define enables certain less important debug messages */
|
---|
41 | //#define DEBUG_LOCAL 1
|
---|
42 |
|
---|
43 |
|
---|
44 | /*****************************************************************************
|
---|
45 | * Name : BOOL WIN32API CloseHandle
|
---|
46 | * Purpose : forward call to Open32
|
---|
47 | * Parameters:
|
---|
48 | * Variables :
|
---|
49 | * Result :
|
---|
50 | * Remark : better error checking required
|
---|
51 | * Status :
|
---|
52 | * Mod : 980618PH: fixed mixed-up handles
|
---|
53 | *
|
---|
54 | * Author : Patrick Haller [Fri, 1998/06/12 03:44]
|
---|
55 | *****************************************************************************/
|
---|
56 |
|
---|
57 | BOOL WIN32API CloseHandle(HANDLE hObject)
|
---|
58 | {
|
---|
59 | ULONG rc; /* API returncode */
|
---|
60 | HANDLE hOS2; /* 32-bit OS/2 handle */
|
---|
61 |
|
---|
62 | dprintf(("KERNEL32::CloseHandle(%08xh)\n",
|
---|
63 | hObject));
|
---|
64 |
|
---|
65 | rc = HMHandleTranslateToOS2(hObject, /* translate the handle */
|
---|
66 | &hOS2);
|
---|
67 | if (rc == NO_ERROR) /* check for errors */
|
---|
68 | {
|
---|
69 | /* @@@PH 1998/02/12 Handle Manager support */
|
---|
70 | if (IS_HM_HANDLE(hOS2))
|
---|
71 | rc = HMCloseHandle(hOS2);
|
---|
72 | else
|
---|
73 | rc=O32_CloseHandle(hOS2);
|
---|
74 |
|
---|
75 | /* @@@PH we should check rc here */
|
---|
76 | HMHandleFree(hObject); /* free 16-bit handle from the translation table */
|
---|
77 |
|
---|
78 | return (rc); /* OK */
|
---|
79 | }
|
---|
80 | else
|
---|
81 | {
|
---|
82 | dprintf(("KERNEL32::CloseHandle(%08xh) HMHandleTranslateToOS2 returned %d\n"
|
---|
83 | " trying untranslated handle instead.\n",
|
---|
84 | hObject,
|
---|
85 | rc));
|
---|
86 | /* @@@PH 1998/02/12 Handle Manager support */
|
---|
87 | if (IS_HM_HANDLE(hObject))
|
---|
88 | rc = HMCloseHandle(hObject);
|
---|
89 | else
|
---|
90 | rc=O32_CloseHandle(hObject);
|
---|
91 |
|
---|
92 | return (rc); /* OK */
|
---|
93 | }
|
---|
94 |
|
---|
95 | /* @@@PH SetLastError ? */
|
---|
96 | return (FALSE); /* raise error condition */
|
---|
97 | }
|
---|
98 |
|
---|
99 |
|
---|
100 | /*****************************************************************************
|
---|
101 | * Name : BOOL WIN32API CreateEventA
|
---|
102 | * Purpose : forward call to Open32
|
---|
103 | * Parameters:
|
---|
104 | * Variables :
|
---|
105 | * Result :
|
---|
106 | * Remark :
|
---|
107 | * Status :
|
---|
108 | *
|
---|
109 | * Author : Patrick Haller [Fri, 1998/06/12 03:44]
|
---|
110 | *****************************************************************************/
|
---|
111 |
|
---|
112 | HANDLE WIN32API CreateEventA(LPSECURITY_ATTRIBUTES lpsa,
|
---|
113 | BOOL fManualReset,
|
---|
114 | BOOL fInitialState,
|
---|
115 | LPCTSTR lpszEventName)
|
---|
116 | {
|
---|
117 | ULONG rc; /* API returncode */
|
---|
118 | HANDLE hOS2; /* 32-bit OS/2 handle */
|
---|
119 | HANDLE hWindows; /* 16-bit Windows handle */
|
---|
120 |
|
---|
121 | dprintf(("KERNEL32::CreateEventA(%08xh, %08xh, %08xh, %s)\n",
|
---|
122 | lpsa,
|
---|
123 | fManualReset,
|
---|
124 | fInitialState,
|
---|
125 | lpszEventName));
|
---|
126 |
|
---|
127 | hOS2 = O32_CreateEvent(lpsa, /* create event semaphore */
|
---|
128 | fManualReset,
|
---|
129 | fInitialState,
|
---|
130 | lpszEventName);
|
---|
131 | if (hOS2 != 0) /* check handle */
|
---|
132 | {
|
---|
133 | rc = HMHandleAllocate(&hWindows, /* allocate handle */
|
---|
134 | hOS2);
|
---|
135 | if (rc == NO_ERROR) /* check for errors */
|
---|
136 | return (hWindows); /* return translated handle */
|
---|
137 | else
|
---|
138 | return (0); /* raise error condition */
|
---|
139 | }
|
---|
140 |
|
---|
141 | return (hOS2); /* should have the correct error value here */
|
---|
142 | }
|
---|
143 |
|
---|
144 |
|
---|
145 | /*****************************************************************************
|
---|
146 | * Name : BOOL WIN32API CreateEventW
|
---|
147 | * Purpose : forward call to Open32
|
---|
148 | * Parameters:
|
---|
149 | * Variables :
|
---|
150 | * Result :
|
---|
151 | * Remark : handle translation is done in CreateEventA
|
---|
152 | * Status :
|
---|
153 | *
|
---|
154 | * Author : Patrick Haller [Fri, 1998/06/12 03:44]
|
---|
155 | *****************************************************************************/
|
---|
156 |
|
---|
157 | HANDLE WIN32API CreateEventW(PSECURITY_ATTRIBUTES arg1,
|
---|
158 | BOOL arg2,
|
---|
159 | BOOL arg3,
|
---|
160 | LPCWSTR arg4)
|
---|
161 | {
|
---|
162 | HANDLE rc;
|
---|
163 | char *astring;
|
---|
164 |
|
---|
165 | dprintf(("KERNEL32::CreateEventW>(%08xh, %08xh, %08xh, %s)\n",
|
---|
166 | arg1,
|
---|
167 | arg2,
|
---|
168 | arg3,
|
---|
169 | arg4));
|
---|
170 |
|
---|
171 | astring = UnicodeToAsciiString((LPWSTR)arg4);
|
---|
172 |
|
---|
173 | rc = O32_CreateEvent(arg1,
|
---|
174 | arg2,
|
---|
175 | arg3,
|
---|
176 | astring);
|
---|
177 |
|
---|
178 | FreeAsciiString(astring);
|
---|
179 |
|
---|
180 | return(rc);
|
---|
181 | }
|
---|
182 | ///@@@PH handlemanager
|
---|
183 | //******************************************************************************
|
---|
184 | //******************************************************************************
|
---|
185 | HANDLE WIN32API CreateMutexA(LPSECURITY_ATTRIBUTES lpsa,
|
---|
186 | BOOL fInitialOwner,
|
---|
187 | LPCTSTR lpszMutexName)
|
---|
188 | {
|
---|
189 | dprintf(("KERNEL32: CreateMutex\n"));
|
---|
190 |
|
---|
191 | return(O32_CreateMutex(lpsa,
|
---|
192 | fInitialOwner,
|
---|
193 | lpszMutexName));
|
---|
194 | }
|
---|
195 | //******************************************************************************
|
---|
196 | //******************************************************************************
|
---|
197 | HANDLE WIN32API CreateMutexW(PSECURITY_ATTRIBUTES arg1,
|
---|
198 | BOOL arg2,
|
---|
199 | LPCWSTR arg3)
|
---|
200 | {
|
---|
201 | HANDLE rc;
|
---|
202 | char *astring;
|
---|
203 |
|
---|
204 | dprintf(("KERNEL32: OS2CreateMutexW\n"));
|
---|
205 |
|
---|
206 | astring = UnicodeToAsciiString((LPWSTR)arg3);
|
---|
207 | rc = O32_CreateMutex(arg1,
|
---|
208 | arg2,
|
---|
209 | astring);
|
---|
210 | FreeAsciiString(astring);
|
---|
211 |
|
---|
212 | return(rc);
|
---|
213 | }
|
---|
214 | //******************************************************************************
|
---|
215 | //******************************************************************************
|
---|
216 | HANDLE WIN32API GetModuleHandleA(LPCTSTR lpszModule)
|
---|
217 | {
|
---|
218 | HANDLE hMod;
|
---|
219 |
|
---|
220 | hMod = OS2iGetModuleHandleA( (PSZ) lpszModule);
|
---|
221 | eprintf(("KERNEL32: GetModuleHandle %s returned %X\n", lpszModule, hMod));
|
---|
222 | return(hMod);
|
---|
223 | }
|
---|
224 | //******************************************************************************
|
---|
225 | //******************************************************************************
|
---|
226 | HMODULE WIN32API GetModuleHandleW(LPCWSTR arg1)
|
---|
227 | {
|
---|
228 | HMODULE rc;
|
---|
229 | char *astring;
|
---|
230 |
|
---|
231 | astring = UnicodeToAsciiString((LPWSTR)arg1);
|
---|
232 | rc = O32_GetModuleHandle(astring);
|
---|
233 | dprintf(("KERNEL32: OS2GetModuleHandleW %s returned %X\n", astring, rc));
|
---|
234 | FreeAsciiString(astring);
|
---|
235 | return(rc);
|
---|
236 | }
|
---|
237 | //******************************************************************************
|
---|
238 | //******************************************************************************
|
---|
239 | HANDLE WIN32API GetStdHandle(DWORD fdwDevice)
|
---|
240 | {
|
---|
241 | HANDLE handle;
|
---|
242 |
|
---|
243 | /* @@@PH 1998/02/12 Handle Manager Support */
|
---|
244 | handle = HMGetStdHandle(fdwDevice);
|
---|
245 |
|
---|
246 | //@@@PH translate handle
|
---|
247 |
|
---|
248 | /* handle = GetStdHandle(fdwDevice); */
|
---|
249 | dprintf(("KERNEL32: GetStdHandle for device %X returned %X\n", fdwDevice, handle));
|
---|
250 | return(handle);
|
---|
251 | }
|
---|
252 | //******************************************************************************
|
---|
253 | //******************************************************************************
|
---|
254 | BOOL WIN32API ReleaseMutex(HANDLE mutex)
|
---|
255 | {
|
---|
256 | dprintf(("KERNEL32: ReleaseMutex\n"));
|
---|
257 | return(O32_ReleaseMutex(mutex));
|
---|
258 | }
|
---|
259 | //******************************************************************************
|
---|
260 | //******************************************************************************
|
---|
261 | BOOL WIN32API SetEvent(HANDLE hEvent)
|
---|
262 | {
|
---|
263 | dprintf(("KERNEL32: SetEvent\n"));
|
---|
264 | return(O32_SetEvent(hEvent));
|
---|
265 | }
|
---|
266 | //******************************************************************************
|
---|
267 | //******************************************************************************
|
---|
268 | BOOL WIN32API SetStdHandle(DWORD IDStdHandle,
|
---|
269 | HANDLE hHandle)
|
---|
270 | {
|
---|
271 | dprintf(("KERNEL32: SetStdHandle\n"));
|
---|
272 |
|
---|
273 | ///@@@PH translate handle
|
---|
274 |
|
---|
275 | return (HMSetStdHandle(IDStdHandle,
|
---|
276 | hHandle));
|
---|
277 | }
|
---|
278 | //******************************************************************************
|
---|
279 | //******************************************************************************
|
---|
280 | DWORD WIN32API TlsAlloc()
|
---|
281 | {
|
---|
282 | dprintf(("KERNEL32: TlsAlloc\n"));
|
---|
283 | return(O32_TlsAlloc());
|
---|
284 | }
|
---|
285 | //******************************************************************************
|
---|
286 | //******************************************************************************
|
---|
287 | BOOL WIN32API TlsFree(DWORD index)
|
---|
288 | {
|
---|
289 | dprintf(("KERNEL32: TlsFree\n"));
|
---|
290 | return(O32_TlsFree(index));
|
---|
291 | }
|
---|
292 | //******************************************************************************
|
---|
293 | //******************************************************************************
|
---|
294 | LPVOID WIN32API TlsGetValue(DWORD index)
|
---|
295 | {
|
---|
296 | LPVOID rc;
|
---|
297 |
|
---|
298 | rc = O32_TlsGetValue(index);
|
---|
299 | // dprintf(("KERNEL32: TlsGetValue %d returned %X\n", index, rc));
|
---|
300 | return(rc);
|
---|
301 | }
|
---|
302 | //******************************************************************************
|
---|
303 | //******************************************************************************
|
---|
304 | BOOL WIN32API TlsSetValue(DWORD index, LPVOID val)
|
---|
305 | {
|
---|
306 | // dprintf(("KERNEL32: TlsSetValue\n"));
|
---|
307 | return(O32_TlsSetValue(index, val));
|
---|
308 | }
|
---|
309 | //******************************************************************************
|
---|
310 | //******************************************************************************
|
---|
311 | DWORD WIN32API WaitForSingleObject(HANDLE hObject,
|
---|
312 | DWORD timeout)
|
---|
313 | {
|
---|
314 | dprintf(("KERNEL32: WaitForSingleObject (%08xh, %08xh)\n",
|
---|
315 | hObject,
|
---|
316 | timeout));
|
---|
317 |
|
---|
318 | return(O32_WaitForSingleObject(hObject,
|
---|
319 | timeout));
|
---|
320 | }
|
---|
321 | //******************************************************************************
|
---|
322 |
|
---|
323 |
|
---|
324 | /*****************************************************************************
|
---|
325 | * Name : DWORD OS2WaitForSingleObjectEx
|
---|
326 | * Purpose : The WaitForSingleObjectEx function is an extended wait function
|
---|
327 | * that can be used to perform an alertable wait. This enables the
|
---|
328 | * function to return when the system queues an I/O completion
|
---|
329 | * routine to be executed by the calling thread. The function also
|
---|
330 | * returns when the specified object is in the signaled state or
|
---|
331 | * when the time-out interval elapses.
|
---|
332 | * Parameters: HANDLE hObject handle of object to wait for
|
---|
333 | * DWORD dwTimeout time-out interval in milliseconds
|
---|
334 | * BOOL fAlertable alertable wait flag
|
---|
335 | * Variables :
|
---|
336 | * Result : 0xFFFFFFFF in case of error
|
---|
337 | * Remark : only really required for async I/O
|
---|
338 | * Status : UNTESTED STUB
|
---|
339 | *
|
---|
340 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
341 | *****************************************************************************/
|
---|
342 |
|
---|
343 | DWORD WIN32API WaitForSingleObjectEx(HANDLE hObject,
|
---|
344 | DWORD dwTimeout,
|
---|
345 | BOOL fAlertable)
|
---|
346 | {
|
---|
347 | dprintf(("Kernel32: WaitForSingleObjectEx(%08xh,%08xh,%08xh) not implemented correctly.\n",
|
---|
348 | hObject,
|
---|
349 | dwTimeout,
|
---|
350 | fAlertable));
|
---|
351 |
|
---|
352 | return(O32_WaitForSingleObject(hObject,
|
---|
353 | dwTimeout));
|
---|
354 | }
|
---|
355 |
|
---|
356 | //******************************************************************************
|
---|
357 | //******************************************************************************
|
---|
358 | BOOL WIN32API IsBadWritePtr(LPVOID lpvPtr, UINT cbBytes)
|
---|
359 | {
|
---|
360 | #ifdef DEBUG
|
---|
361 | BOOL rc;
|
---|
362 |
|
---|
363 | rc = O32_IsBadWritePtr(lpvPtr, cbBytes);
|
---|
364 | dprintf(("KERNEL32: IsBadWritePtr: 0x%X size %d rc = %d\n", (int)lpvPtr, cbBytes, rc));
|
---|
365 | return(rc);
|
---|
366 | #else
|
---|
367 | return(O32_IsBadWritePtr(lpvPtr, cbBytes));
|
---|
368 | #endif
|
---|
369 | }
|
---|
370 | //******************************************************************************
|
---|
371 | //******************************************************************************
|
---|
372 | BOOL WIN32API IsBadReadPtr(CONST VOID *lpvPtr, UINT cbBytes)
|
---|
373 | {
|
---|
374 | #ifdef DEBUG
|
---|
375 | BOOL rc;
|
---|
376 |
|
---|
377 | rc = O32_IsBadReadPtr(lpvPtr, cbBytes);
|
---|
378 | dprintf(("KERNEL32: IsBadWritePtr: 0x%X size %d rc = %d\n", (int)lpvPtr, cbBytes, rc));
|
---|
379 | return(rc);
|
---|
380 | #else
|
---|
381 | return(O32_IsBadReadPtr(lpvPtr, cbBytes));
|
---|
382 | #endif
|
---|
383 | }
|
---|
384 | //******************************************************************************
|
---|
385 | //******************************************************************************
|
---|
386 | BOOL WIN32API IsBadCodePtr( FARPROC arg1)
|
---|
387 | {
|
---|
388 | dprintf(("KERNEL32: IsBadCodePtr\n"));
|
---|
389 | return O32_IsBadCodePtr(arg1);
|
---|
390 | }
|
---|
391 | //******************************************************************************
|
---|
392 | //******************************************************************************
|
---|
393 | BOOL WIN32API IsBadStringPtrA( LPCSTR arg1, UINT arg2)
|
---|
394 | {
|
---|
395 | dprintf(("KERNEL32: IsBadStringPtr"));
|
---|
396 | return O32_IsBadStringPtr(arg1, arg2);
|
---|
397 | }
|
---|
398 | //******************************************************************************
|
---|
399 | //******************************************************************************
|
---|
400 | BOOL WIN32API IsBadStringPtrW(LPCWSTR arg1, UINT arg2)
|
---|
401 | {
|
---|
402 | dprintf(("KERNEL32: OS2IsBadStringPtrW"));
|
---|
403 | return O32_IsBadReadPtr((CONST VOID *)arg1, arg2*2+2);
|
---|
404 | }
|
---|
405 | //******************************************************************************
|
---|
406 | //******************************************************************************
|
---|
407 | DWORD WIN32API GetLastError()
|
---|
408 | {
|
---|
409 | DWORD rc;
|
---|
410 |
|
---|
411 | rc = O32_GetLastError();
|
---|
412 | #ifdef DEBUG_LOCAL
|
---|
413 | dprintf(("KERNEL32: GetLastError returned %d\n", rc));
|
---|
414 | #endif
|
---|
415 | return(rc);
|
---|
416 | }
|
---|
417 | //******************************************************************************
|
---|
418 | //******************************************************************************
|
---|
419 | VOID WIN32API SetLastError( DWORD arg1)
|
---|
420 | {
|
---|
421 | // dprintf(("KERNEL32: SetLastError to %d\n", arg1));
|
---|
422 | O32_SetLastError(arg1);
|
---|
423 | }
|
---|
424 | //******************************************************************************
|
---|
425 | //******************************************************************************
|
---|
426 | UINT WIN32API GetOEMCP(VOID)
|
---|
427 | {
|
---|
428 | dprintf(("KERNEL32: GetOEMCP\n"));
|
---|
429 | return(O32_GetOEMCP());
|
---|
430 | }
|
---|
431 | //******************************************************************************
|
---|
432 | //******************************************************************************
|
---|
433 | UINT WIN32API GetACP(VOID)
|
---|
434 | {
|
---|
435 | dprintf(("KERNEL32: GetACP\n"));
|
---|
436 | return(O32_GetACP());
|
---|
437 | }
|
---|
438 | //******************************************************************************
|
---|
439 | //******************************************************************************
|
---|
440 | BOOL WIN32API FlushFileBuffers(HANDLE hFile)
|
---|
441 | {
|
---|
442 | dprintf(("KERNEL32: FlushFileBuffers\n"));
|
---|
443 | return(O32_FlushFileBuffers(hFile));
|
---|
444 | }
|
---|
445 | //******************************************************************************
|
---|
446 | //******************************************************************************
|
---|
447 | LONG WIN32API InterlockedDecrement(LPLONG lplVal)
|
---|
448 | {
|
---|
449 | dprintf(("KERNEL32: InterlockedDecrement\n"));
|
---|
450 | return(O32_InterlockedDecrement(lplVal));
|
---|
451 | }
|
---|
452 | //******************************************************************************
|
---|
453 | //******************************************************************************
|
---|
454 | LONG WIN32API InterlockedIncrement(LPLONG lplVal)
|
---|
455 | {
|
---|
456 | dprintf(("KERNEL32: InterlockedIncrement\n"));
|
---|
457 | return(O32_InterlockedIncrement(lplVal));
|
---|
458 | }
|
---|
459 | //******************************************************************************
|
---|
460 | //******************************************************************************
|
---|
461 | LONG WIN32API InterlockedExchange( PLONG arg1, LONG arg2)
|
---|
462 | {
|
---|
463 | dprintf(("KERNEL32: InterlockedExchange\n"));
|
---|
464 | return O32_InterlockedExchange(arg1, arg2);
|
---|
465 | }
|
---|
466 | //******************************************************************************
|
---|
467 | //******************************************************************************
|
---|
468 | UINT WIN32API SetHandleCount(UINT cHandles)
|
---|
469 | {
|
---|
470 | dprintf(("KERNEL32: GetHandleCount\n"));
|
---|
471 | return(O32_SetHandleCount(cHandles));
|
---|
472 | }
|
---|
473 | //******************************************************************************
|
---|
474 | //******************************************************************************
|
---|
475 | LPWSTR WIN32API GetEnvironmentStringsW(VOID)
|
---|
476 | {
|
---|
477 | char *envstrings = (char *)O32_GetEnvironmentStrings();
|
---|
478 | char *tmp;
|
---|
479 | LPWSTR wenvstrings;
|
---|
480 | int len, i;
|
---|
481 |
|
---|
482 | dprintf(("KERNEL32: GetEnvironmentStringsW\n"));
|
---|
483 |
|
---|
484 | if(envstrings == NULL)
|
---|
485 | return(NULL);
|
---|
486 |
|
---|
487 | tmp = envstrings;
|
---|
488 | len = 0;
|
---|
489 | while(*tmp != 0)
|
---|
490 | {
|
---|
491 | len += strlen(tmp)+1;
|
---|
492 | tmp = envstrings + len;
|
---|
493 | }
|
---|
494 | len++; //terminating 0
|
---|
495 | wenvstrings = (LPWSTR)malloc(len*sizeof(WCHAR));
|
---|
496 | for(i=0;
|
---|
497 | i<len;
|
---|
498 | i++)
|
---|
499 | {
|
---|
500 | wenvstrings[i] = envstrings[i];
|
---|
501 | }
|
---|
502 | return(wenvstrings);
|
---|
503 | }
|
---|
504 | //******************************************************************************
|
---|
505 | //******************************************************************************
|
---|
506 | BOOL WIN32API FreeEnvironmentStringsA(LPSTR envstrings)
|
---|
507 | {
|
---|
508 | dprintf(("KERNEL32: FreeEnvironmentStringsA\n"));
|
---|
509 | return(TRUE);
|
---|
510 | }
|
---|
511 | //******************************************************************************
|
---|
512 | //******************************************************************************
|
---|
513 | BOOL WIN32API FreeEnvironmentStringsW(LPWSTR envstrings)
|
---|
514 | {
|
---|
515 | dprintf(("KERNEL32: FreeEnvironmentStringsW\n"));
|
---|
516 | free(envstrings);
|
---|
517 | return(TRUE);
|
---|
518 | }
|
---|
519 | //******************************************************************************
|
---|
520 | //******************************************************************************
|
---|
521 | BOOL WIN32API GetStringTypeW(DWORD fdwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
522 | {
|
---|
523 | int i;
|
---|
524 |
|
---|
525 | dprintf(("KERNEL32: GetStringTypeW, not properly implemented\n"));
|
---|
526 | if((DWORD)lpSrcStr == (DWORD)lpCharType || !lpSrcStr || !lpCharType) {
|
---|
527 | O32_SetLastError(ERROR_INVALID_PARAMETER);
|
---|
528 | return(FALSE);
|
---|
529 | }
|
---|
530 | if(cchSrc == -1)
|
---|
531 | cchSrc = UniStrlen((UniChar*)lpSrcStr);
|
---|
532 |
|
---|
533 | memset(lpCharType, 0, cchSrc*sizeof(WORD));
|
---|
534 | switch(fdwInfoType) {
|
---|
535 | case CT_CTYPE1:
|
---|
536 | for(i=0;i<cchSrc;i++) {
|
---|
537 | if(lpSrcStr[i] >= (WCHAR)'a' && lpSrcStr[i] <= (WCHAR)'z')
|
---|
538 | lpCharType[i] |= C1_LOWER | C1_ALPHA;
|
---|
539 | else
|
---|
540 | if(lpSrcStr[i] >= (WCHAR)'A' && lpSrcStr[i] <= (WCHAR)'A')
|
---|
541 | lpCharType[i] |= C1_UPPER | C1_ALPHA;
|
---|
542 | else
|
---|
543 | if(lpSrcStr[i] >= (WCHAR)'0' && lpSrcStr[i] <= (WCHAR)'9')
|
---|
544 | lpCharType[i] |= C1_DIGIT;
|
---|
545 | else
|
---|
546 | if(lpSrcStr[i] >= (WCHAR)' ')
|
---|
547 | lpCharType[i] |= C1_SPACE;
|
---|
548 | }
|
---|
549 | break;
|
---|
550 | case CT_CTYPE2:
|
---|
551 | case CT_CTYPE3: //not supported right now
|
---|
552 | break;
|
---|
553 | }
|
---|
554 | return(TRUE);
|
---|
555 | }
|
---|
556 | //******************************************************************************
|
---|
557 | //NOTE: This has one parameter more than the W version! (@#$@#$)
|
---|
558 | //******************************************************************************
|
---|
559 | BOOL WIN32API GetStringTypeA(LCID Locale, DWORD fdwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
560 | {
|
---|
561 | int i;
|
---|
562 |
|
---|
563 | dprintf(("KERNEL32: GetStringTypeA, not properly implemented\n"));
|
---|
564 | if(lpSrcStr == (LPCSTR)lpCharType || !lpSrcStr || !lpCharType) {
|
---|
565 | O32_SetLastError(ERROR_INVALID_PARAMETER);
|
---|
566 | return(FALSE);
|
---|
567 | }
|
---|
568 | if(cchSrc == -1)
|
---|
569 | cchSrc = strlen(lpSrcStr);
|
---|
570 |
|
---|
571 | memset(lpCharType, 0, cchSrc*sizeof(WORD));
|
---|
572 | switch(fdwInfoType) {
|
---|
573 | case CT_CTYPE1:
|
---|
574 | for(i=0;i<cchSrc;i++) {
|
---|
575 | if(lpSrcStr[i] >= 'a' && lpSrcStr[i] <= 'z')
|
---|
576 | lpCharType[i] |= C1_LOWER | C1_ALPHA;
|
---|
577 | else
|
---|
578 | if(lpSrcStr[i] >= 'A' && lpSrcStr[i] <= 'A')
|
---|
579 | lpCharType[i] |= C1_UPPER | C1_ALPHA;
|
---|
580 | else
|
---|
581 | if(lpSrcStr[i] >= '0' && lpSrcStr[i] <= '9')
|
---|
582 | lpCharType[i] |= C1_DIGIT;
|
---|
583 | else
|
---|
584 | if(lpSrcStr[i] >= ' ')
|
---|
585 | lpCharType[i] |= C1_SPACE;
|
---|
586 | }
|
---|
587 | break;
|
---|
588 | case CT_CTYPE2:
|
---|
589 | case CT_CTYPE3: //not supported right now
|
---|
590 | break;
|
---|
591 | }
|
---|
592 | return(TRUE);
|
---|
593 | }
|
---|
594 | //******************************************************************************
|
---|
595 | //******************************************************************************
|
---|
596 | BOOL WIN32API GetStringTypeExW(LCID Locale, DWORD fdwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
597 | {
|
---|
598 | dprintf(("KERNEL32: GetStringTypeExW, not properly implemented\n"));
|
---|
599 | return(GetStringTypeW(fdwInfoType, lpSrcStr, cchSrc, lpCharType));
|
---|
600 | }
|
---|
601 | //******************************************************************************
|
---|
602 | //******************************************************************************
|
---|
603 | BOOL WIN32API GetStringTypeExA(LCID Locale, DWORD fdwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
604 | {
|
---|
605 | dprintf(("KERNEL32: GetStringTypeExA, not properly implemented\n"));
|
---|
606 | return(GetStringTypeA(Locale, fdwInfoType, lpSrcStr, cchSrc, lpCharType));
|
---|
607 | }
|
---|
608 | //******************************************************************************
|
---|
609 | //******************************************************************************
|
---|
610 | VOID WIN32API EnterCriticalSection(CRITICAL_SECTION * lpcsCriticalSection)
|
---|
611 | {
|
---|
612 | //// dprintf(("KERNEL32: EnterCriticalSection\n"));
|
---|
613 | O32_EnterCriticalSection(lpcsCriticalSection);
|
---|
614 | }
|
---|
615 | //******************************************************************************
|
---|
616 | //******************************************************************************
|
---|
617 | VOID WIN32API LeaveCriticalSection(CRITICAL_SECTION * arg1)
|
---|
618 | {
|
---|
619 | //// dprintf(("KERNEL32: LeaveCriticalSection\n"));
|
---|
620 | O32_LeaveCriticalSection(arg1);
|
---|
621 | }
|
---|
622 | //******************************************************************************
|
---|
623 | //******************************************************************************
|
---|
624 | VOID WIN32API InitializeCriticalSection(CRITICAL_SECTION * arg1)
|
---|
625 | {
|
---|
626 | dprintf(("KERNEL32: InitializeCriticalSection\n"));
|
---|
627 | O32_InitializeCriticalSection(arg1);
|
---|
628 | }
|
---|
629 | //******************************************************************************
|
---|
630 | //******************************************************************************
|
---|
631 | BOOL WIN32API SetEnvironmentVariableA(LPCSTR arg1, LPCSTR arg2)
|
---|
632 | {
|
---|
633 | dprintf(("KERNEL32: SetEnvironmentVariable %s to %s\n", arg1, arg2));
|
---|
634 | return O32_SetEnvironmentVariable(arg1, arg2);
|
---|
635 | }
|
---|
636 | //******************************************************************************
|
---|
637 | //******************************************************************************
|
---|
638 | BOOL WIN32API SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue)
|
---|
639 | {
|
---|
640 | char *asciiname, *asciivalue;
|
---|
641 | BOOL rc;
|
---|
642 |
|
---|
643 | dprintf(("KERNEL32: OS2SetEnvironmentVariableW\n"));
|
---|
644 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
645 | asciivalue = UnicodeToAsciiString((LPWSTR)lpValue);
|
---|
646 | rc = O32_SetEnvironmentVariable(asciiname, asciivalue);
|
---|
647 | FreeAsciiString(asciivalue);
|
---|
648 | FreeAsciiString(asciiname);
|
---|
649 | return(rc);
|
---|
650 | }
|
---|
651 | //******************************************************************************
|
---|
652 | VOID WIN32API GlobalMemoryStatus( MEMORYSTATUS *arg1)
|
---|
653 | {
|
---|
654 | dprintf(("KERNEL32: GlobalMemoryStatus\n"));
|
---|
655 | O32_GlobalMemoryStatus(arg1);
|
---|
656 | dprintf(("dwMemoryLoad %X\n", arg1->dwMemoryLoad));
|
---|
657 | dprintf(("dwTotalPhys %X\n", arg1->dwTotalPhys));
|
---|
658 | dprintf(("dwAvailPhys %X\n", arg1->dwAvailPhys));
|
---|
659 | dprintf(("dwTotalPageFile %X\n", arg1->dwTotalPageFile));
|
---|
660 | dprintf(("dwAvailPageFile %X\n", arg1->dwAvailPageFile));
|
---|
661 | dprintf(("dwTotalVirtual %X\n", arg1->dwTotalVirtual));
|
---|
662 | dprintf(("dwAvailVirtual %X\n", arg1->dwAvailVirtual));
|
---|
663 | }
|
---|
664 | //******************************************************************************
|
---|
665 | //******************************************************************************
|
---|
666 | DWORD WIN32API GetEnvironmentVariableA(LPCSTR arg1, LPSTR arg2, DWORD arg3)
|
---|
667 | {
|
---|
668 | dprintf(("KERNEL32: GetEnvironmentVariable %s\n", arg1));
|
---|
669 | return O32_GetEnvironmentVariable(arg1, arg2, arg3);
|
---|
670 | }
|
---|
671 | //******************************************************************************
|
---|
672 | //******************************************************************************
|
---|
673 | DWORD WIN32API GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer,
|
---|
674 | DWORD nSize)
|
---|
675 | {
|
---|
676 | char *astring, *asciibuffer;
|
---|
677 | DWORD rc;
|
---|
678 |
|
---|
679 | dprintf(("KERNEL32: OS2GetEnvironmentVariableW\n"));
|
---|
680 | asciibuffer = (char *)malloc(nSize+1);
|
---|
681 | astring = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
682 |
|
---|
683 | rc = O32_GetEnvironmentVariable(astring, asciibuffer, nSize);
|
---|
684 | AsciiToUnicode(asciibuffer, lpBuffer);
|
---|
685 | FreeAsciiString(astring);
|
---|
686 | free(asciibuffer);
|
---|
687 | return(rc);
|
---|
688 | }
|
---|
689 | //******************************************************************************
|
---|
690 | //******************************************************************************
|
---|
691 | HINSTANCE WIN32API WinExec(LPCSTR arg1, UINT arg2)
|
---|
692 | {
|
---|
693 | dprintf(("KERNEL32: WinExec %s\n", arg1));
|
---|
694 | return (HINSTANCE)O32_WinExec(arg1, arg2);
|
---|
695 | }
|
---|
696 | //******************************************************************************
|
---|
697 | //******************************************************************************
|
---|
698 | BOOL WIN32API GetExitCodeProcess(HANDLE arg1, LPDWORD arg2)
|
---|
699 | {
|
---|
700 | dprintf(("KERNEL32: GetExitCodeProcess\n"));
|
---|
701 | return O32_GetExitCodeProcess(arg1, arg2);
|
---|
702 | }
|
---|
703 | //******************************************************************************
|
---|
704 | //******************************************************************************
|
---|
705 | HANDLE WIN32API GetCurrentProcess(void)
|
---|
706 | {
|
---|
707 | //// dprintf(("KERNEL32: GetCurrentProcess\n"));
|
---|
708 | return O32_GetCurrentProcess();
|
---|
709 | }
|
---|
710 | //******************************************************************************
|
---|
711 | //******************************************************************************
|
---|
712 | DWORD WIN32API GetCurrentProcessId(void)
|
---|
713 | {
|
---|
714 | dprintf(("KERNEL32: GetCurrentProcessId\n"));
|
---|
715 | return O32_GetCurrentProcessId();
|
---|
716 | }
|
---|
717 | //******************************************************************************
|
---|
718 | //******************************************************************************
|
---|
719 | BOOL WIN32API TerminateProcess( HANDLE arg1, DWORD arg2)
|
---|
720 | {
|
---|
721 | dprintf(("KERNEL32: TerminateProcess\n"));
|
---|
722 | return O32_TerminateProcess(arg1, arg2);
|
---|
723 | }
|
---|
724 | //******************************************************************************
|
---|
725 | //******************************************************************************
|
---|
726 | VOID WIN32API Sleep(DWORD arg1)
|
---|
727 | {
|
---|
728 | dprintf(("KERNEL32: Sleep %d\n", arg1));
|
---|
729 | O32_Sleep(arg1);
|
---|
730 | }
|
---|
731 | //******************************************************************************
|
---|
732 | //******************************************************************************
|
---|
733 | DWORD WIN32API GetPriorityClass(HANDLE arg1)
|
---|
734 | {
|
---|
735 | dprintf(("KERNEL32: GetPriorityClass\n"));
|
---|
736 | return O32_GetPriorityClass(arg1);
|
---|
737 | }
|
---|
738 | //******************************************************************************
|
---|
739 | //******************************************************************************
|
---|
740 | BOOL WIN32API SetPriorityClass(HANDLE arg1, DWORD arg2)
|
---|
741 | {
|
---|
742 | dprintf(("KERNEL32: SetPriorityClass\n"));
|
---|
743 | return O32_SetPriorityClass(arg1, arg2);
|
---|
744 | }
|
---|
745 | //******************************************************************************
|
---|
746 | //TODO!
|
---|
747 | //******************************************************************************
|
---|
748 | int WIN32API LCMapStringW(
|
---|
749 | DWORD /*LCID*/ Locale,
|
---|
750 | DWORD dwMapFlags,
|
---|
751 | LPCWSTR lpSrcStr,
|
---|
752 | int cchSrc,
|
---|
753 | LPWSTR lpDestStr,
|
---|
754 | int cchDest)
|
---|
755 | {
|
---|
756 | // quick hack! this code is not done!
|
---|
757 | if(cchSrc == -1)
|
---|
758 | cchSrc = strlen((const char *)lpSrcStr);
|
---|
759 | if(!cchDest)
|
---|
760 | return cchSrc;
|
---|
761 | strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest));
|
---|
762 | return max(cchSrc, cchDest);
|
---|
763 | }
|
---|
764 | //******************************************************************************
|
---|
765 | //TODO!
|
---|
766 | //******************************************************************************
|
---|
767 | int WIN32API LCMapStringA(
|
---|
768 | DWORD /*LCID*/ Locale,
|
---|
769 | DWORD dwMapFlags,
|
---|
770 | LPCSTR lpSrcStr,
|
---|
771 | int cchSrc,
|
---|
772 | LPSTR lpDestStr,
|
---|
773 | int cchDest)
|
---|
774 | {
|
---|
775 | dprintf(("KERNEL32: LCMapStringA not implemented\n"));
|
---|
776 | if(cchSrc == -1)
|
---|
777 | cchSrc = strlen((const char *)lpSrcStr);
|
---|
778 | if(!cchDest)
|
---|
779 | return cchSrc;
|
---|
780 | strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest));
|
---|
781 | return max(cchSrc, cchDest);
|
---|
782 | }
|
---|
783 | //******************************************************************************
|
---|
784 | //SvL: 24-6-'97 - Added
|
---|
785 | //******************************************************************************
|
---|
786 | VOID WIN32API DeleteCriticalSection( CRITICAL_SECTION * arg1)
|
---|
787 | {
|
---|
788 | dprintf(("KERNEL32: OS2DeleteCriticalSection\n"));
|
---|
789 | O32_DeleteCriticalSection(arg1);
|
---|
790 | }
|
---|
791 | //******************************************************************************
|
---|
792 | //SvL: 24-6-'97 - Added
|
---|
793 | //SvL: 28-6-'97: Fix for timeSetEvent in Red Alert Map Editor
|
---|
794 | //******************************************************************************
|
---|
795 | BOOL WIN32API DuplicateHandle(HANDLE srcprocess, HANDLE srchandle, HANDLE destprocess,
|
---|
796 | PHANDLE desthandle, DWORD arg5, BOOL arg6, DWORD arg7)
|
---|
797 | {
|
---|
798 | BOOL rc;
|
---|
799 |
|
---|
800 | #if 0
|
---|
801 | //SvL:
|
---|
802 | //If source & destination process are identical, just copy handle
|
---|
803 | //(if target pointer != NULL)
|
---|
804 | //timeSetEvent's timer handler expects to be called from another process,
|
---|
805 | //but we just create a separate timer thread inside the client process
|
---|
806 | if(srcprocess == destprocess) {
|
---|
807 | if(desthandle != NULL)
|
---|
808 | *desthandle = srchandle;
|
---|
809 | return(TRUE);
|
---|
810 | }
|
---|
811 | #endif
|
---|
812 | rc = O32_DuplicateHandle(srcprocess, srchandle, destprocess, desthandle, arg5, arg6, arg7);
|
---|
813 | //// dprintf(("KERNEL32: OS2DuplicateHandle returned %d\n", rc));
|
---|
814 | return(rc);
|
---|
815 | }
|
---|
816 | //******************************************************************************
|
---|
817 | //******************************************************************************
|
---|
818 | BOOL WIN32API Beep( DWORD arg1, DWORD arg2)
|
---|
819 | {
|
---|
820 | dprintf(("KERNEL32: OS2Beep\n"));
|
---|
821 | return O32_Beep(arg1, arg2);
|
---|
822 | }
|
---|
823 | //******************************************************************************
|
---|
824 | //******************************************************************************
|
---|
825 | HANDLE WIN32API CreateSemaphoreA(PSECURITY_ATTRIBUTES arg1, LONG arg2, LONG arg3, LPCSTR arg4)
|
---|
826 | {
|
---|
827 | dprintf(("KERNEL32: OS2CreateSemaphoreA\n"));
|
---|
828 | return O32_CreateSemaphore(arg1, arg2, arg3, (LPSTR)arg4);
|
---|
829 | }
|
---|
830 | //******************************************************************************
|
---|
831 | //******************************************************************************
|
---|
832 | HANDLE WIN32API CreateSemaphoreW(PSECURITY_ATTRIBUTES arg1,
|
---|
833 | LONG arg2, LONG arg3,
|
---|
834 | LPCWSTR arg4)
|
---|
835 | {
|
---|
836 | HANDLE rc;
|
---|
837 | char *astring;
|
---|
838 |
|
---|
839 | dprintf(("KERNEL32: OS2CreateSemaphoreW"));
|
---|
840 | astring = UnicodeToAsciiString((LPWSTR)arg4);
|
---|
841 | rc = O32_CreateSemaphore(arg1, arg2, arg3, astring);
|
---|
842 | FreeAsciiString(astring);
|
---|
843 | return(rc);
|
---|
844 | }
|
---|
845 | //******************************************************************************
|
---|
846 | //******************************************************************************
|
---|
847 | VOID WIN32API FatalAppExitA( UINT arg1, LPCSTR arg2)
|
---|
848 | {
|
---|
849 | dprintf(("KERNEL32: OS2FatalAppExitA\n"));
|
---|
850 | O32_FatalAppExit(arg1, arg2);
|
---|
851 | }
|
---|
852 | //******************************************************************************
|
---|
853 | //******************************************************************************
|
---|
854 | VOID WIN32API FatalAppExitW(UINT arg1, LPCWSTR arg2)
|
---|
855 | {
|
---|
856 | char *astring;
|
---|
857 |
|
---|
858 | dprintf(("KERNEL32: OS2FatalAppExitW\n"));
|
---|
859 | astring = UnicodeToAsciiString((LPWSTR)arg2);
|
---|
860 | O32_FatalAppExit(arg1, astring);
|
---|
861 | //probably won't return, but who cares..
|
---|
862 | FreeAsciiString(astring);
|
---|
863 | }
|
---|
864 | //******************************************************************************
|
---|
865 | //******************************************************************************
|
---|
866 | VOID WIN32API FatalExit( UINT arg1)
|
---|
867 | {
|
---|
868 | dprintf(("KERNEL32: OS2FatalExit\n"));
|
---|
869 | O32_FatalExit(arg1);
|
---|
870 | }
|
---|
871 | //******************************************************************************
|
---|
872 | //******************************************************************************
|
---|
873 | int WIN32API lstrlenA(LPCSTR arg1)
|
---|
874 | {
|
---|
875 | dprintf(("KERNEL32: OS2lstrlen %X\n", arg1));
|
---|
876 | return O32_lstrlen(arg1);
|
---|
877 | }
|
---|
878 | //******************************************************************************
|
---|
879 | //******************************************************************************
|
---|
880 | int WIN32API lstrlenW(LPCWSTR arg1)
|
---|
881 | {
|
---|
882 | int rc;
|
---|
883 |
|
---|
884 | rc = UniStrlen( (UniChar*)arg1);
|
---|
885 | dprintf(("KERNEL32: OS2lstrlenW returns %d\n", rc));
|
---|
886 | return rc;
|
---|
887 | }
|
---|
888 | //******************************************************************************
|
---|
889 | //******************************************************************************
|
---|
890 | LPSTR WIN32API GetEnvironmentStringsA(void)
|
---|
891 | {
|
---|
892 | dprintf(("KERNEL32: OS2GetEnvironmentStringsA\n"));
|
---|
893 | return (LPSTR) O32_GetEnvironmentStrings();
|
---|
894 | }
|
---|
895 | //******************************************************************************
|
---|
896 | //******************************************************************************
|
---|
897 | BOOL WIN32API GetOverlappedResult(HANDLE arg1, LPOVERLAPPED arg2, LPDWORD arg3, BOOL arg4)
|
---|
898 | {
|
---|
899 | dprintf(("KERNEL32: OS2GetOverlappedResult\n"));
|
---|
900 | return O32_GetOverlappedResult(arg1, arg2, arg3, arg4);
|
---|
901 | }
|
---|
902 | //******************************************************************************
|
---|
903 | //******************************************************************************
|
---|
904 | BOOL WIN32API IsBadHugeReadPtr( const void * arg1, UINT arg2)
|
---|
905 | {
|
---|
906 | dprintf(("KERNEL32: OS2IsBadHugeReadPtr\n"));
|
---|
907 | return O32_IsBadHugeReadPtr(arg1, arg2);
|
---|
908 | }
|
---|
909 | //******************************************************************************
|
---|
910 | //******************************************************************************
|
---|
911 | BOOL WIN32API IsBadHugeWritePtr( PVOID arg1, UINT arg2)
|
---|
912 | {
|
---|
913 | dprintf(("KERNEL32: OS2IsBadHugeWritePtr\n"));
|
---|
914 | return O32_IsBadHugeWritePtr(arg1, arg2);
|
---|
915 | }
|
---|
916 | //******************************************************************************
|
---|
917 | //******************************************************************************
|
---|
918 | BOOL WIN32API IsDBCSLeadByte(BYTE arg1)
|
---|
919 | {
|
---|
920 | dprintf(("KERNEL32: OS2IsDBCSLeadByte\n"));
|
---|
921 | return O32_IsDBCSLeadByte(arg1);
|
---|
922 | }
|
---|
923 | //******************************************************************************
|
---|
924 | //******************************************************************************
|
---|
925 | DWORD WIN32API LoadModule( LPCSTR arg1, PVOID arg2)
|
---|
926 | {
|
---|
927 | dprintf(("KERNEL32: OS2LoadModule\n"));
|
---|
928 | return O32_LoadModule(arg1, arg2);
|
---|
929 | }
|
---|
930 | //******************************************************************************
|
---|
931 | //******************************************************************************
|
---|
932 | int WIN32API MulDiv(int arg1, int arg2, int arg3)
|
---|
933 | {
|
---|
934 | dprintf(("KERNEL32: OS2MulDiv %d*%d/%d\n", arg1, arg2, arg3));
|
---|
935 | return O32_MulDiv(arg1, arg2, arg3);
|
---|
936 | }
|
---|
937 | //******************************************************************************
|
---|
938 | //******************************************************************************
|
---|
939 | HANDLE WIN32API OpenEventA( DWORD arg1, BOOL arg2, LPCSTR arg3)
|
---|
940 | {
|
---|
941 | dprintf(("KERNEL32: OS2OpenEventA\n"));
|
---|
942 | return O32_OpenEvent(arg1, arg2, arg3);
|
---|
943 | }
|
---|
944 | //******************************************************************************
|
---|
945 | //******************************************************************************
|
---|
946 | HANDLE WIN32API OpenEventW(DWORD dwDesiredAccess, BOOL bInheritHandle,
|
---|
947 | LPCWSTR lpName)
|
---|
948 | {
|
---|
949 | char *asciiname;
|
---|
950 | HANDLE rc;
|
---|
951 |
|
---|
952 | dprintf(("KERNEL32: OS2OpenEventW\n"));
|
---|
953 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
954 | rc = O32_OpenEvent(dwDesiredAccess, bInheritHandle, asciiname);
|
---|
955 | FreeAsciiString(asciiname);
|
---|
956 | return(rc);
|
---|
957 | }
|
---|
958 | //******************************************************************************
|
---|
959 | //******************************************************************************
|
---|
960 | HANDLE WIN32API OpenMutexA( DWORD arg1, BOOL arg2, LPCSTR arg3)
|
---|
961 | {
|
---|
962 | dprintf(("KERNEL32: OS2OpenMutexA\n"));
|
---|
963 | return O32_OpenMutex(arg1, arg2, arg3);
|
---|
964 | }
|
---|
965 | //******************************************************************************
|
---|
966 | //******************************************************************************
|
---|
967 | HANDLE WIN32API OpenMutexW(DWORD dwDesiredAccess, BOOL bInheritHandle,
|
---|
968 | LPCWSTR lpName)
|
---|
969 | {
|
---|
970 | char *asciiname;
|
---|
971 | HANDLE rc;
|
---|
972 |
|
---|
973 | dprintf(("KERNEL32: OS2OpenMutexW\n"));
|
---|
974 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
975 | rc = O32_OpenMutex(dwDesiredAccess, bInheritHandle, asciiname);
|
---|
976 | FreeAsciiString(asciiname);
|
---|
977 | return(rc);
|
---|
978 | }
|
---|
979 | //******************************************************************************
|
---|
980 | //******************************************************************************
|
---|
981 | HANDLE WIN32API OpenProcess(DWORD arg1, BOOL arg2, DWORD arg3)
|
---|
982 | {
|
---|
983 | dprintf(("KERNEL32: OS2OpenProcess\n"));
|
---|
984 | return O32_OpenProcess(arg1, arg2, arg3);
|
---|
985 | }
|
---|
986 | //******************************************************************************
|
---|
987 | //******************************************************************************
|
---|
988 | HANDLE WIN32API OpenSemaphoreA( DWORD arg1, BOOL arg2, LPCSTR arg3)
|
---|
989 | {
|
---|
990 | dprintf(("KERNEL32: OS2OpenSemaphoreA"));
|
---|
991 | return O32_OpenSemaphore(arg1, arg2, arg3);
|
---|
992 | }
|
---|
993 | //******************************************************************************
|
---|
994 | //******************************************************************************
|
---|
995 | HANDLE WIN32API OpenSemaphoreW(DWORD dwDesiredAccess, BOOL bInheritHandle,
|
---|
996 | LPCWSTR lpName)
|
---|
997 | {
|
---|
998 | char *asciiname;
|
---|
999 | HANDLE rc;
|
---|
1000 |
|
---|
1001 | dprintf(("KERNEL32: OS2OpenSemaphoreW"));
|
---|
1002 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
1003 | rc = O32_OpenSemaphore(dwDesiredAccess, bInheritHandle, asciiname);
|
---|
1004 | FreeAsciiString(asciiname);
|
---|
1005 | return(rc);
|
---|
1006 | }
|
---|
1007 | //******************************************************************************
|
---|
1008 | //******************************************************************************
|
---|
1009 | BOOL WIN32API PulseEvent( HANDLE arg1)
|
---|
1010 | {
|
---|
1011 | dprintf(("KERNEL32: OS2PulseEvent\n"));
|
---|
1012 | return O32_PulseEvent(arg1);
|
---|
1013 | }
|
---|
1014 | //******************************************************************************
|
---|
1015 | //******************************************************************************
|
---|
1016 | BOOL WIN32API ReleaseSemaphore( HANDLE arg1, LONG arg2, PLONG arg3)
|
---|
1017 | {
|
---|
1018 | dprintf(("KERNEL32: OS2ReleaseSemaphore"));
|
---|
1019 | return O32_ReleaseSemaphore(arg1, arg2, arg3);
|
---|
1020 | }
|
---|
1021 | //******************************************************************************
|
---|
1022 | //******************************************************************************
|
---|
1023 | BOOL WIN32API ResetEvent(HANDLE arg1)
|
---|
1024 | {
|
---|
1025 | dprintf(("KERNEL32: ResetEvent(%08xh)\n",
|
---|
1026 | arg1));
|
---|
1027 |
|
---|
1028 | return O32_ResetEvent(arg1);
|
---|
1029 | }
|
---|
1030 | //******************************************************************************
|
---|
1031 | //******************************************************************************
|
---|
1032 | DWORD WIN32API WaitForMultipleObjects( DWORD arg1, const HANDLE * arg2, BOOL arg3, DWORD arg4)
|
---|
1033 | {
|
---|
1034 | dprintf(("KERNEL32: OS2WaitForMultipleObjects"));
|
---|
1035 | return O32_WaitForMultipleObjects(arg1, arg2, arg3, arg4);
|
---|
1036 | }
|
---|
1037 |
|
---|
1038 |
|
---|
1039 | /*****************************************************************************
|
---|
1040 | * Name : DWORD OS2WaitForMultipleObjectsEx
|
---|
1041 | * Purpose : The WaitForMultipleObjectsEx function is an extended wait
|
---|
1042 | * function that can be used to perform an alertable wait. This
|
---|
1043 | * enables the function to return when the system queues an I/O
|
---|
1044 | * completion routine to be executed by the calling thread. The
|
---|
1045 | * function also returns either when any one or when all of the
|
---|
1046 | * specified objects are in the signaled state, or when the
|
---|
1047 | * time-out interval elapses.
|
---|
1048 | * Parameters: DWORD cObjects number of handles in handle array
|
---|
1049 | * HANDLE *lphObjects address of object-handle array
|
---|
1050 | * BOOL fWaitAll wait flag
|
---|
1051 | * DWORD dwTimeout time-out interval in milliseconds
|
---|
1052 | * BOOL fAlertable alertable wait flag
|
---|
1053 | * Variables :
|
---|
1054 | * Result : 0xFFFFFFFF in case of error
|
---|
1055 | * Remark : only really required for async I/O
|
---|
1056 | * Status : UNTESTED STUB
|
---|
1057 | *
|
---|
1058 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
1059 | *****************************************************************************/
|
---|
1060 |
|
---|
1061 | DWORD WIN32API WaitForMultipleObjectsEx(DWORD cObjects,
|
---|
1062 | CONST HANDLE *lphObjects,
|
---|
1063 | BOOL fWaitAll,
|
---|
1064 | DWORD dwTimeout,
|
---|
1065 | BOOL fAlertable)
|
---|
1066 | {
|
---|
1067 | dprintf(("Kernel32: WaitForMultipleObjectsEx(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented correctly.\n",
|
---|
1068 | cObjects,
|
---|
1069 | lphObjects,
|
---|
1070 | fWaitAll,
|
---|
1071 | dwTimeout,
|
---|
1072 | fAlertable));
|
---|
1073 |
|
---|
1074 | return(O32_WaitForMultipleObjects(cObjects,
|
---|
1075 | lphObjects,
|
---|
1076 | fWaitAll,
|
---|
1077 | dwTimeout));
|
---|
1078 | }
|
---|
1079 | //******************************************************************************
|
---|
1080 | //******************************************************************************
|
---|
1081 | LPSTR WIN32API lstrcatA(LPSTR arg1, LPCSTR arg2)
|
---|
1082 | {
|
---|
1083 | dprintf(("KERNEL32: OS2lstrcat\n"));
|
---|
1084 | return O32_lstrcat(arg1, arg2);
|
---|
1085 | }
|
---|
1086 | //******************************************************************************
|
---|
1087 | //******************************************************************************
|
---|
1088 | LPWSTR WIN32API lstrcatW(LPWSTR arg1, LPCWSTR arg2)
|
---|
1089 | {
|
---|
1090 | dprintf(("KERNEL32: OS2lstrcatW\n"));
|
---|
1091 | UniStrcat( (UniChar*) arg1, (UniChar*) arg2 );
|
---|
1092 | return arg1;
|
---|
1093 | }
|
---|
1094 | //******************************************************************************
|
---|
1095 | //******************************************************************************
|
---|
1096 | int WIN32API lstrcmpA(LPCSTR arg1, LPCSTR arg2)
|
---|
1097 | {
|
---|
1098 | dprintf(("KERNEL32: OS2lstrcmpA %s %x\n", arg1, arg1));
|
---|
1099 | dprintf(("KERNEL32: OS2lstrcmpA %s\n", arg2));
|
---|
1100 | return O32_lstrcmp(arg1, arg2);
|
---|
1101 | }
|
---|
1102 | //******************************************************************************
|
---|
1103 | //******************************************************************************
|
---|
1104 | int WIN32API lstrcmpW(LPCWSTR arg1, LPCWSTR arg2)
|
---|
1105 | {
|
---|
1106 | dprintf(("KERNEL32: OS2lstrcmpW\n"));
|
---|
1107 | return UniStrcmp( (UniChar*)arg1, (UniChar*)arg2 );
|
---|
1108 | }
|
---|
1109 | //******************************************************************************
|
---|
1110 | //******************************************************************************
|
---|
1111 | LPSTR WIN32API lstrcpyA(LPSTR arg1, LPCSTR arg2)
|
---|
1112 | {
|
---|
1113 | dprintf(("KERNEL32: OS2lstrcpy %s\n", arg2));
|
---|
1114 | return O32_lstrcpy(arg1, arg2);
|
---|
1115 | }
|
---|
1116 | //******************************************************************************
|
---|
1117 | //******************************************************************************
|
---|
1118 | LPWSTR WIN32API lstrcpyW(LPWSTR dest, LPCWSTR src)
|
---|
1119 | {
|
---|
1120 | dprintf(("KERNEL32: OS2lstrcpyW"));
|
---|
1121 | UniStrcpy( (UniChar*)dest, (UniChar*)src );
|
---|
1122 | return dest;
|
---|
1123 | }
|
---|
1124 | //******************************************************************************
|
---|
1125 | //******************************************************************************
|
---|
1126 | LPSTR WIN32API lstrcpynA(LPSTR arg1, LPCSTR arg2, int arg3)
|
---|
1127 | {
|
---|
1128 | dprintf(("KERNEL32: OS2lstrcpy\n"));
|
---|
1129 | return strncpy(arg1, arg2, arg3);
|
---|
1130 | }
|
---|
1131 | //******************************************************************************
|
---|
1132 | //******************************************************************************
|
---|
1133 | LPWSTR WIN32API lstrcpynW(LPWSTR dest, LPCWSTR src, int arg3)
|
---|
1134 | {
|
---|
1135 | dprintf(("KERNEL32: OS2lstrcpynW"));
|
---|
1136 | UniStrncpy( (UniChar*)dest, (UniChar*)src, arg3 );
|
---|
1137 | return dest;
|
---|
1138 | }
|
---|
1139 | //******************************************************************************
|
---|
1140 | //******************************************************************************
|
---|
1141 | int WIN32API lstrcmpiA(LPCSTR arg1, LPCSTR arg2)
|
---|
1142 | {
|
---|
1143 | dprintf(("KERNEL32: OS2lstrcmpi\n"));
|
---|
1144 | return O32_lstrcmpi(arg1, arg2);
|
---|
1145 | }
|
---|
1146 | //******************************************************************************
|
---|
1147 | //******************************************************************************
|
---|
1148 | int WIN32API lstrcmpiW(LPCWSTR arg1, LPCWSTR arg2)
|
---|
1149 | {
|
---|
1150 | char *astr1, *astr2;
|
---|
1151 | int rc;
|
---|
1152 |
|
---|
1153 | dprintf(("KERNEL32: OS2lstrcmpiW\n"));
|
---|
1154 | // NOTE: This function has not equivalent in uunidef.h
|
---|
1155 | astr1 = UnicodeToAsciiString((LPWSTR)arg1);
|
---|
1156 | astr2 = UnicodeToAsciiString((LPWSTR)arg2);
|
---|
1157 | rc = O32_lstrcmpi(astr1, astr2);
|
---|
1158 | FreeAsciiString(astr2);
|
---|
1159 | FreeAsciiString(astr1);
|
---|
1160 | return(rc);
|
---|
1161 | }
|
---|
1162 | //******************************************************************************
|
---|
1163 | //SvL: BUGFIX: C calling convention!
|
---|
1164 | //******************************************************************************
|
---|
1165 | VOID __cdecl OS2memmove(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, DWORD Length)
|
---|
1166 | {
|
---|
1167 | memmove(Destination, Source, Length);
|
---|
1168 | }
|
---|
1169 | //******************************************************************************
|
---|
1170 |
|
---|
1171 | //******************************************************************************
|
---|
1172 | UINT WIN32API CompareStringA(LCID lcid, DWORD fdwStyle, LPCSTR lpString1,
|
---|
1173 | DWORD cch1, LPCSTR lpString2, DWORD cch2)
|
---|
1174 | {
|
---|
1175 | int i;
|
---|
1176 | int fEqual = TRUE;
|
---|
1177 | char *string1 = (char *)lpString1, *string2 = (char *)lpString2;
|
---|
1178 |
|
---|
1179 | #ifdef DEBUG
|
---|
1180 | if(fdwStyle & SORT_STRINGSORT)
|
---|
1181 | dprintf(("KERNEL32: SORT_STRINGSORT not supported!\n"));
|
---|
1182 | if(fdwStyle & NORM_IGNORENONSPACE)
|
---|
1183 | dprintf(("KERNEL32: NORM_IGNORENONSPACE not supported!\n"));
|
---|
1184 | if(fdwStyle & NORM_IGNORESYMBOLS)
|
---|
1185 | dprintf(("KERNEL32: NORM_IGNORESYMBOLS not supported!\n"));
|
---|
1186 | #endif
|
---|
1187 |
|
---|
1188 | if(cch1 == -1) cch1 = strlen(string1);
|
---|
1189 | if(cch2 == -1) cch2 = strlen(string2);
|
---|
1190 |
|
---|
1191 | if(fdwStyle) {
|
---|
1192 | //TODO!
|
---|
1193 | if(fdwStyle != 0 && fdwStyle != NORM_IGNORECASE)
|
---|
1194 | return(0); /*PLF Fri 98-03-13 04:09:32 was return 1 */
|
---|
1195 | }
|
---|
1196 | if(fdwStyle & NORM_IGNORECASE)
|
---|
1197 | fEqual = strnicmp(string1, string2, min(cch1, cch2));
|
---|
1198 | else
|
---|
1199 | fEqual = strncmp(string1, string2, min(cch1, cch2));
|
---|
1200 |
|
---|
1201 | if (fEqual < 0 ) fEqual = 1;
|
---|
1202 | else if(fEqual == 0) fEqual = 2;
|
---|
1203 | else if(fEqual > 0) fEqual = 3;
|
---|
1204 |
|
---|
1205 | //If equal, but different length, largest one is the greatest in lexical value
|
---|
1206 | if(fEqual == 2 && cch1 != cch2){
|
---|
1207 | if(cch1 < cch2)
|
---|
1208 | fEqual = 1;
|
---|
1209 | else
|
---|
1210 | fEqual = 3;
|
---|
1211 | }
|
---|
1212 | // dprintf(("KERNEL32: OS2CompareStringA '%s' - '%s' returned %d\n", lpString1, lpString2, fEqual));
|
---|
1213 | return(fEqual);
|
---|
1214 | }
|
---|
1215 |
|
---|
1216 | //******************************************************************************
|
---|
1217 | //TODO: Not complete (fdwStyle flags specify compare method)
|
---|
1218 | //******************************************************************************
|
---|
1219 | UINT WIN32API CompareStringW(LCID lcid, DWORD fdwStyle, LPCWSTR lpString1,
|
---|
1220 | DWORD cch1, LPCWSTR lpString2, DWORD cch2)
|
---|
1221 | {
|
---|
1222 | int i;
|
---|
1223 | int fEqual = TRUE;
|
---|
1224 | char *string1 = UnicodeToAsciiString((LPWSTR)lpString1);
|
---|
1225 | char *string2 = UnicodeToAsciiString((LPWSTR)lpString2);
|
---|
1226 |
|
---|
1227 | // dprintf(("KERNEL32: OS2CompareStringW '%s' - '%s'\n", string1, string2));
|
---|
1228 |
|
---|
1229 | fEqual = CompareStringA(lcid, fdwStyle, string1, cch1, string2, cch2);
|
---|
1230 | FreeAsciiString(string1);
|
---|
1231 | FreeAsciiString(string2);
|
---|
1232 |
|
---|
1233 | return(fEqual);
|
---|
1234 | }
|
---|
1235 | //******************************************************************************
|
---|
1236 | //TODO:What does this do exactly??
|
---|
1237 | // @@@OPH -> see WINE
|
---|
1238 | //******************************************************************************
|
---|
1239 | BOOL WIN32API DisableThreadLibraryCalls(HMODULE hLibModule)
|
---|
1240 | {
|
---|
1241 | dprintf(("KERNEL32: (NI!)OS2DisableThreadLibraryCalls of %X\n", hLibModule));
|
---|
1242 | return(TRUE);
|
---|
1243 | }
|
---|
1244 | //******************************************************************************
|
---|
1245 | //******************************************************************************
|
---|
1246 | //TODO: Query processor info to complete this api
|
---|
1247 | //******************************************************************************
|
---|
1248 | VOID WIN32API GetSystemInfo(LPSYSTEM_INFO lpSystemInfo)
|
---|
1249 | {
|
---|
1250 | dprintf(("KERNEL32: GetSystemInfo, not completely accurate\n"));
|
---|
1251 | lpSystemInfo->u.x.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
|
---|
1252 | lpSystemInfo->u.x.wReserved = 0;
|
---|
1253 | lpSystemInfo->dwPageSize = 4096;
|
---|
1254 | lpSystemInfo->lpMinimumApplicationAddress = (LPVOID)0;
|
---|
1255 | lpSystemInfo->lpMaximumApplicationAddress = (LPVOID)(512*1024*1024);
|
---|
1256 | lpSystemInfo->dwActiveProcessorMask = 1;
|
---|
1257 | lpSystemInfo->dwNumberOfProcessors = 1; //assuming non-SMP OS/2
|
---|
1258 | lpSystemInfo->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
|
---|
1259 | lpSystemInfo->dwAllocationGranularity = 64*1024;
|
---|
1260 | lpSystemInfo->wProcessorLevel = 5; //Pentium
|
---|
1261 | lpSystemInfo->wProcessorRevision = 0x201; //Model 2 stepping 1 (obviously not correct)
|
---|
1262 | }
|
---|
1263 | //******************************************************************************
|
---|
1264 | //Borrowed from Wine
|
---|
1265 | //******************************************************************************
|
---|
1266 | VOID WIN32API GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
|
---|
1267 | {
|
---|
1268 | dprintf(("KERNEL32: GetStartupInfo\n"));
|
---|
1269 | lpStartupInfo->cb = sizeof(STARTUPINFOA);
|
---|
1270 | lpStartupInfo->lpReserved = "<Reserved>";
|
---|
1271 | lpStartupInfo->lpDesktop = "Desktop";
|
---|
1272 | lpStartupInfo->lpTitle = "Title";
|
---|
1273 |
|
---|
1274 | lpStartupInfo->cbReserved2 = 0;
|
---|
1275 | lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
|
---|
1276 |
|
---|
1277 | /* @@@PH 98/07/13 Handlemanager support */
|
---|
1278 | lpStartupInfo->hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
---|
1279 | lpStartupInfo->hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
---|
1280 | lpStartupInfo->hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
---|
1281 | return;
|
---|
1282 | }
|
---|
1283 | //******************************************************************************
|
---|
1284 | //Borrowed from Wine
|
---|
1285 | //******************************************************************************
|
---|
1286 | VOID WIN32API GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
|
---|
1287 | {
|
---|
1288 | static WCHAR lpReserved[] = {'<', 'R','e','s','e','r','v','e','d','>', 0};
|
---|
1289 | static WCHAR lpDesktop[] = {'D', 'e','s','k','t','o','p', 0};
|
---|
1290 | static WCHAR lpTitle[] = {'T', 'i','t','l','e', 0};
|
---|
1291 |
|
---|
1292 | dprintf(("KERNEL32: GetStartupInfoW\n"));
|
---|
1293 | lpStartupInfo->cb = sizeof(STARTUPINFOW);
|
---|
1294 | lpStartupInfo->lpReserved = lpReserved;
|
---|
1295 | lpStartupInfo->lpDesktop = lpDesktop;
|
---|
1296 | lpStartupInfo->lpTitle = lpTitle;
|
---|
1297 |
|
---|
1298 | lpStartupInfo->cbReserved2 = 0;
|
---|
1299 | lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
|
---|
1300 |
|
---|
1301 | /* @@@PH 98/07/13 Handlemanager support */
|
---|
1302 | lpStartupInfo->hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
---|
1303 | lpStartupInfo->hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
---|
1304 | lpStartupInfo->hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
---|
1305 | return;
|
---|
1306 | }
|
---|
1307 | //******************************************************************************
|
---|
1308 | //TODO: Not complete or correct, but sufficient for now
|
---|
1309 | //******************************************************************************
|
---|
1310 | BOOL WIN32API GetBinaryTypeA(LPCTSTR lpApplicationName, LPDWORD lpBinaryType)
|
---|
1311 | {
|
---|
1312 | dprintf(("KERNEL32: OS2GetBinaryTypeA %s\n", lpApplicationName));
|
---|
1313 | if(strstr(lpApplicationName, ".EXE") || strstr(lpApplicationName, ".exe"))
|
---|
1314 | *lpBinaryType = SCS_32BIT_BINARY;
|
---|
1315 | else
|
---|
1316 | if(strstr(lpApplicationName, ".COM") || strstr(lpApplicationName, ".com"))
|
---|
1317 | *lpBinaryType = SCS_DOS_BINARY;
|
---|
1318 | else
|
---|
1319 | if(strstr(lpApplicationName, ".PIF") || strstr(lpApplicationName, ".pif"))
|
---|
1320 | *lpBinaryType = SCS_PIF_BINARY;
|
---|
1321 | else return(FALSE);
|
---|
1322 | return(TRUE);
|
---|
1323 | }
|
---|
1324 | //******************************************************************************
|
---|
1325 | //******************************************************************************
|
---|
1326 | BOOL WIN32API GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
|
---|
1327 | {
|
---|
1328 | BOOL rc;
|
---|
1329 | char *astring;
|
---|
1330 |
|
---|
1331 | dprintf(("KERNEL32: OS2GetBinaryTypeW\n"));
|
---|
1332 | astring = UnicodeToAsciiString((LPWSTR)lpApplicationName);
|
---|
1333 | rc = GetBinaryTypeA(astring, lpBinaryType);
|
---|
1334 | FreeAsciiString(astring);
|
---|
1335 | return(rc);
|
---|
1336 | }
|
---|
1337 | //******************************************************************************
|
---|
1338 | //TODO: SetLastError
|
---|
1339 | //******************************************************************************
|
---|
1340 | BOOL WIN32API GetVersionExA(OSVERSIONINFOA *lpVersionInformation)
|
---|
1341 | {
|
---|
1342 | dprintf(("KERNEL32: OS2GetVersionExA\n"));
|
---|
1343 |
|
---|
1344 | if(lpVersionInformation == NULL || lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA))
|
---|
1345 | return(FALSE);
|
---|
1346 |
|
---|
1347 | lpVersionInformation->dwMajorVersion = 4; //pretend we're NT 4.0
|
---|
1348 | lpVersionInformation->dwMinorVersion = 0;
|
---|
1349 | lpVersionInformation->dwBuildNumber = 1564;
|
---|
1350 | lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
---|
1351 | lpVersionInformation->szCSDVersion[0]= 0;
|
---|
1352 | return(TRUE);
|
---|
1353 | }
|
---|
1354 | //******************************************************************************
|
---|
1355 | //******************************************************************************
|
---|
1356 | BOOL WIN32API GetVersionExW(OSVERSIONINFOW *lpVersionInformation)
|
---|
1357 | {
|
---|
1358 | dprintf(("KERNEL32: OS2GetVersionExW\n"));
|
---|
1359 |
|
---|
1360 | if(lpVersionInformation == NULL || lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW))
|
---|
1361 | return(FALSE);
|
---|
1362 |
|
---|
1363 | lpVersionInformation->dwMajorVersion = 4; //pretend we're NT 4.0
|
---|
1364 | lpVersionInformation->dwMinorVersion = 0;
|
---|
1365 | lpVersionInformation->dwBuildNumber = 1564;
|
---|
1366 | lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
---|
1367 | lpVersionInformation->szCSDVersion[0]= 0;
|
---|
1368 | return(TRUE);
|
---|
1369 | }
|
---|
1370 | //******************************************************************************
|
---|
1371 | //Should retrieve this from the exe...
|
---|
1372 | //******************************************************************************
|
---|
1373 | DWORD WIN32API GetProcessVersion(DWORD Processid)
|
---|
1374 | {
|
---|
1375 | dprintf(("KERNEL32: OS2GetProcessVersion not correctly implemented!!\n"));
|
---|
1376 | return(WIN32OS2_VERSION);
|
---|
1377 | }
|
---|
1378 | //******************************************************************************
|
---|
1379 | //******************************************************************************
|
---|
1380 | LONG WIN32API GetVersion()
|
---|
1381 | {
|
---|
1382 | dprintf(("KERNEL32: GetVersion\n"));
|
---|
1383 | // highword 0 = NT, lowword high byte major ver, low byte minor ver
|
---|
1384 | /* @@@PH 98/04/04 MFC30 makes assumptions about process control block */
|
---|
1385 | /* structures that lead to crashes if we don't identify as NT */
|
---|
1386 |
|
---|
1387 | // return(WIN32OS2_VERSION);
|
---|
1388 | return (0x0);
|
---|
1389 | }
|
---|
1390 | //******************************************************************************
|
---|
1391 | //SvL: 26-6-'97 - Added
|
---|
1392 | //******************************************************************************
|
---|
1393 | VOID WIN32API OutputDebugStringW(LPCWSTR arg1)
|
---|
1394 | {
|
---|
1395 | char *astring;
|
---|
1396 |
|
---|
1397 | astring = UnicodeToAsciiString((LPWSTR)arg1);
|
---|
1398 | dprintf(("KERNEL32: OS2OutputDebugStringW %s\n", astring));
|
---|
1399 | FreeAsciiString(astring);
|
---|
1400 | }
|
---|
1401 | //******************************************************************************
|
---|
1402 | //******************************************************************************
|
---|
1403 | VOID WIN32API OutputDebugStringA(LPCSTR lpszOutputString)
|
---|
1404 | {
|
---|
1405 | dprintf(("KERNEL32: OutputDebugStringA: %s\n", lpszOutputString));
|
---|
1406 | return;
|
---|
1407 | }
|
---|
1408 | //******************************************************************************
|
---|
1409 | //Obsolete
|
---|
1410 | //******************************************************************************
|
---|
1411 | DWORD WIN32API GetProcessHeaps(DWORD NumberOfHeaps, PHANDLE ProcessHeaps)
|
---|
1412 | {
|
---|
1413 | dprintf(("KERNEL32: GetProcessHeaps, Not implemented\n"));
|
---|
1414 | return(0);
|
---|
1415 | }
|
---|
1416 | //******************************************************************************
|
---|
1417 | //WINE
|
---|
1418 | //******************************************************************************
|
---|
1419 | BOOL WIN32API GetProcessAffinityMask(HANDLE hProcess,
|
---|
1420 | LPDWORD lpProcessAffinityMask,
|
---|
1421 | LPDWORD lpSystemAffinityMask)
|
---|
1422 | {
|
---|
1423 | /* It is definitely important for a process to know on what processor
|
---|
1424 | it is running :-) */
|
---|
1425 | if(lpProcessAffinityMask)
|
---|
1426 | *lpProcessAffinityMask=1;
|
---|
1427 | if(lpSystemAffinityMask)
|
---|
1428 | *lpSystemAffinityMask=1;
|
---|
1429 | return TRUE;
|
---|
1430 | }
|
---|
1431 | //******************************************************************************
|
---|
1432 | //******************************************************************************
|
---|
1433 |
|
---|
1434 |
|
---|
1435 | BOOL WIN32API FlushInstructionCache( /*PLF Mon 98-02-09 23:56:49 : STUB STUB STUB STUB STUB */
|
---|
1436 | HANDLE hProcess, /* process with cache to flush */
|
---|
1437 | LPCVOID lpvBase, /* address of region to flush */
|
---|
1438 | DWORD cbFlush) /* length of region to flush */
|
---|
1439 |
|
---|
1440 | {
|
---|
1441 | dprintf(("FlushInstructionCache() - NIY\n"));
|
---|
1442 | return TRUE;
|
---|
1443 | }
|
---|
1444 |
|
---|
1445 |
|
---|
1446 | //******************************************************************************
|
---|
1447 | VOID WIN32API UninitializeCriticalSection(CRITICAL_SECTION * lpcsCriticalSection)
|
---|
1448 | {
|
---|
1449 | dprintf(("KERNEL32: UninitializeCriticalSection\n"));
|
---|
1450 | }
|
---|
1451 |
|
---|
1452 | int WIN32API GetNumberFormatA(LCID Locale,
|
---|
1453 | DWORD dwFlags,
|
---|
1454 | LPCSTR lpValue,
|
---|
1455 | CONST NUMBERFMTA *lpFormat,
|
---|
1456 | LPSTR lpNumberStr,
|
---|
1457 | int cchNumber)
|
---|
1458 | {
|
---|
1459 | dprintf(("KERNEL32::OS2GetNumberFormatA(%08x,%08x,%s,%08x,%s,%08x) not implemented.\n",
|
---|
1460 | Locale,
|
---|
1461 | dwFlags,
|
---|
1462 | lpValue,
|
---|
1463 | lpFormat,
|
---|
1464 | lpNumberStr,
|
---|
1465 | cchNumber));
|
---|
1466 |
|
---|
1467 | return 0;
|
---|
1468 | }
|
---|
1469 |
|
---|
1470 | int WIN32API GetNumberFormatW(LCID Locale,
|
---|
1471 | DWORD dwFlags,
|
---|
1472 | LPCWSTR lpValue,
|
---|
1473 | CONST NUMBERFMTW *lpFormat,
|
---|
1474 | LPWSTR lpNumberStr,
|
---|
1475 | int cchNumber)
|
---|
1476 | {
|
---|
1477 | dprintf(("KERNEL32::OS2GetNumberFormatW(%08x,%08x,%s,%08x,%s,%08x) not implemented.\n",
|
---|
1478 | Locale,
|
---|
1479 | dwFlags,
|
---|
1480 | lpValue,
|
---|
1481 | lpFormat,
|
---|
1482 | lpNumberStr,
|
---|
1483 | cchNumber));
|
---|
1484 |
|
---|
1485 | return 0;
|
---|
1486 | }
|
---|
1487 |
|
---|
1488 | HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle)
|
---|
1489 | //HANDLE WIN32API ConvertToGlobalHandle(HANDLE hHandle,
|
---|
1490 | // BOOL fInherit)
|
---|
1491 | {
|
---|
1492 | return (hHandle);
|
---|
1493 | }
|
---|
1494 |
|
---|
1495 | BOOL WIN32API FindCloseChangeNotification(HANDLE hChange)
|
---|
1496 | {
|
---|
1497 | dprintf(("KERNEL32: OS2FindNextChangeNotification, Not implemented\n"));
|
---|
1498 |
|
---|
1499 | return(TRUE);
|
---|
1500 | }
|
---|
1501 |
|
---|
1502 | //******************************************************************************
|
---|
1503 | //******************************************************************************
|
---|
1504 | void WIN32API WrongComctl32()
|
---|
1505 | {
|
---|
1506 | O32_MessageBox(NULL,
|
---|
1507 | "KERNEL32.36 not implemented",
|
---|
1508 | "Win32 for OS/2 Error",
|
---|
1509 | MB_OK);
|
---|
1510 | ExitProcess(987);
|
---|
1511 | }
|
---|
1512 | //******************************************************************************
|
---|
1513 |
|
---|
1514 |
|
---|
1515 |
|
---|
1516 | /***********************************************************************
|
---|
1517 | * RtlFillMemory (KERNEL32.441)
|
---|
1518 | */
|
---|
1519 | VOID WIN32API RtlFillMemory(LPVOID ptr,
|
---|
1520 | UINT len,
|
---|
1521 | UINT fill )
|
---|
1522 | {
|
---|
1523 | #ifdef DEBUG_LOCAL
|
---|
1524 | dprintf(("KERNEL32: RtlFillMemory(%08x,%08x,%08x)\n",
|
---|
1525 | ptr,
|
---|
1526 | len,
|
---|
1527 | fill));
|
---|
1528 | #endif
|
---|
1529 |
|
---|
1530 | memset(ptr,
|
---|
1531 | fill,
|
---|
1532 | len );
|
---|
1533 | }
|
---|
1534 |
|
---|
1535 |
|
---|
1536 | /***********************************************************************
|
---|
1537 | * RtlMoveMemory (KERNEL32.442)
|
---|
1538 | */
|
---|
1539 | VOID WIN32API RtlMoveMemory(LPVOID dst,
|
---|
1540 | LPCVOID src,
|
---|
1541 | UINT len )
|
---|
1542 | {
|
---|
1543 | #ifdef DEBUG_LOCAL
|
---|
1544 | dprintf(("KERNEL32: RtlMoveMemory(%08x,%08x,%08x)\n",
|
---|
1545 | dst,
|
---|
1546 | src,
|
---|
1547 | len));
|
---|
1548 | #endif
|
---|
1549 |
|
---|
1550 | memmove(dst,
|
---|
1551 | src,
|
---|
1552 | len );
|
---|
1553 | }
|
---|
1554 |
|
---|
1555 |
|
---|
1556 | /***********************************************************************
|
---|
1557 | * RtlZeroMemory (KERNEL32.444)
|
---|
1558 | */
|
---|
1559 | VOID WIN32API RtlZeroMemory(LPVOID ptr,
|
---|
1560 | UINT len)
|
---|
1561 | {
|
---|
1562 | #ifdef DEBUG_LOCAL
|
---|
1563 | dprintf(("KERNEL32: RtlZeroMemory(%08x,%08x)\n",
|
---|
1564 | ptr,
|
---|
1565 | len));
|
---|
1566 | #endif
|
---|
1567 |
|
---|
1568 | memset(ptr,
|
---|
1569 | 0,
|
---|
1570 | len);
|
---|
1571 | }
|
---|
1572 |
|
---|
1573 |
|
---|
1574 | //******************************************************************************
|
---|
1575 | /*KSO Thu 21.05.1998*/
|
---|
1576 | BOOL WIN32API IsDBCSLeadByteEx(UINT CodePage, BYTE TestChar)
|
---|
1577 | {
|
---|
1578 | dprintf(("KERNEL32: OS2IsDBCSLeadByteEx - not correctly implemented\n"));
|
---|
1579 | return O32_IsDBCSLeadByte(TestChar);
|
---|
1580 | }
|
---|
1581 | //******************************************************************************
|
---|
1582 |
|
---|
1583 |
|
---|
1584 |
|
---|
1585 |
|
---|
1586 |
|
---|
1587 |
|
---|
1588 |
|
---|