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