1 | /* $Id: KERNEL32.CPP,v 1.12 1999-08-09 22:38:01 phaller 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 <odincrt.h>
|
---|
29 |
|
---|
30 | #include "misc.h"
|
---|
31 | #include "devio.h"
|
---|
32 | #include "except.h"
|
---|
33 | #include <builtin.h>
|
---|
34 | #include "heap.h"
|
---|
35 | #include "handlemanager.h"
|
---|
36 | #include "os2util.h"
|
---|
37 | #include "wprocess.h"
|
---|
38 |
|
---|
39 |
|
---|
40 | /*****************************************************************************
|
---|
41 | * Defines *
|
---|
42 | *****************************************************************************/
|
---|
43 |
|
---|
44 | /* this define enables certain less important debug messages */
|
---|
45 | //#define DEBUG_LOCAL 1
|
---|
46 |
|
---|
47 |
|
---|
48 |
|
---|
49 | /*****************************************************************************
|
---|
50 | * Name : BOOL WIN32API CloseHandle
|
---|
51 | * Purpose : forward call to Open32
|
---|
52 | * Parameters:
|
---|
53 | * Variables :
|
---|
54 | * Result :
|
---|
55 | * Remark :
|
---|
56 | * Status :
|
---|
57 | *
|
---|
58 | * Author : Patrick Haller [Fri, 1998/06/12 03:44]
|
---|
59 | *****************************************************************************/
|
---|
60 | BOOL WIN32API CloseHandle(HANDLE hHandle)
|
---|
61 | {
|
---|
62 | dprintf(("KERNEL32: CloseHandle(%08xh)\n",
|
---|
63 | hHandle));
|
---|
64 |
|
---|
65 | return HMCloseHandle(hHandle);
|
---|
66 | }
|
---|
67 |
|
---|
68 |
|
---|
69 | //******************************************************************************
|
---|
70 | HANDLE WIN32API GetModuleHandleA(LPCTSTR lpszModule)
|
---|
71 | {
|
---|
72 | HANDLE hMod;
|
---|
73 |
|
---|
74 | hMod = OS2iGetModuleHandleA( (PSZ) lpszModule);
|
---|
75 | eprintf(("KERNEL32: GetModuleHandle %s returned %X\n", lpszModule, hMod));
|
---|
76 | return(hMod);
|
---|
77 | }
|
---|
78 | //******************************************************************************
|
---|
79 | //******************************************************************************
|
---|
80 | HMODULE WIN32API GetModuleHandleW(LPCWSTR arg1)
|
---|
81 | {
|
---|
82 | HMODULE rc;
|
---|
83 | char *astring;
|
---|
84 |
|
---|
85 | astring = UnicodeToAsciiString((LPWSTR)arg1);
|
---|
86 | rc = O32_GetModuleHandle(astring);
|
---|
87 | dprintf(("KERNEL32: OS2GetModuleHandleW %s returned %X\n", astring, rc));
|
---|
88 | FreeAsciiString(astring);
|
---|
89 | return(rc);
|
---|
90 | }
|
---|
91 | //******************************************************************************
|
---|
92 | //******************************************************************************
|
---|
93 | HANDLE WIN32API GetStdHandle(DWORD fdwDevice)
|
---|
94 | {
|
---|
95 | HANDLE handle;
|
---|
96 |
|
---|
97 | /* @@@PH 1998/02/12 Handle Manager Support */
|
---|
98 | handle = HMGetStdHandle(fdwDevice);
|
---|
99 |
|
---|
100 | //@@@PH translate handle
|
---|
101 |
|
---|
102 | /* handle = GetStdHandle(fdwDevice); */
|
---|
103 | dprintf(("KERNEL32: GetStdHandle for device %X returned %X\n", fdwDevice, handle));
|
---|
104 | return(handle);
|
---|
105 | }
|
---|
106 | //******************************************************************************
|
---|
107 | //******************************************************************************
|
---|
108 | BOOL WIN32API SetStdHandle(DWORD IDStdHandle,
|
---|
109 | HANDLE hHandle)
|
---|
110 | {
|
---|
111 | dprintf(("KERNEL32: SetStdHandle\n"));
|
---|
112 |
|
---|
113 | ///@@@PH translate handle
|
---|
114 |
|
---|
115 | return (HMSetStdHandle(IDStdHandle,
|
---|
116 | hHandle));
|
---|
117 | }
|
---|
118 | //******************************************************************************
|
---|
119 | //******************************************************************************
|
---|
120 | BOOL WIN32API IsBadWritePtr(LPVOID lpvPtr, UINT cbBytes)
|
---|
121 | {
|
---|
122 | #ifdef DEBUG
|
---|
123 | BOOL rc;
|
---|
124 |
|
---|
125 | rc = O32_IsBadWritePtr(lpvPtr, cbBytes);
|
---|
126 | dprintf(("KERNEL32: IsBadWritePtr: 0x%X size %d rc = %d\n", (int)lpvPtr, cbBytes, rc));
|
---|
127 | return(rc);
|
---|
128 | #else
|
---|
129 | return(O32_IsBadWritePtr(lpvPtr, cbBytes));
|
---|
130 | #endif
|
---|
131 | }
|
---|
132 | //******************************************************************************
|
---|
133 | //******************************************************************************
|
---|
134 | BOOL WIN32API IsBadReadPtr(CONST VOID *lpvPtr, UINT cbBytes)
|
---|
135 | {
|
---|
136 | #ifdef DEBUG
|
---|
137 | BOOL rc;
|
---|
138 |
|
---|
139 | rc = O32_IsBadReadPtr(lpvPtr, cbBytes);
|
---|
140 | dprintf(("KERNEL32: IsBadWritePtr: 0x%X size %d rc = %d\n", (int)lpvPtr, cbBytes, rc));
|
---|
141 | return(rc);
|
---|
142 | #else
|
---|
143 | return(O32_IsBadReadPtr(lpvPtr, cbBytes));
|
---|
144 | #endif
|
---|
145 | }
|
---|
146 | //******************************************************************************
|
---|
147 | //******************************************************************************
|
---|
148 | BOOL WIN32API IsBadCodePtr( FARPROC arg1)
|
---|
149 | {
|
---|
150 | dprintf(("KERNEL32: IsBadCodePtr\n"));
|
---|
151 | return O32_IsBadCodePtr(arg1);
|
---|
152 | }
|
---|
153 | //******************************************************************************
|
---|
154 | //******************************************************************************
|
---|
155 | BOOL WIN32API IsBadStringPtrA( LPCSTR arg1, UINT arg2)
|
---|
156 | {
|
---|
157 | dprintf(("KERNEL32: IsBadStringPtr"));
|
---|
158 | return O32_IsBadStringPtr(arg1, arg2);
|
---|
159 | }
|
---|
160 | //******************************************************************************
|
---|
161 | //******************************************************************************
|
---|
162 | BOOL WIN32API IsBadStringPtrW(LPCWSTR arg1, UINT arg2)
|
---|
163 | {
|
---|
164 | dprintf(("KERNEL32: OS2IsBadStringPtrW"));
|
---|
165 | return O32_IsBadReadPtr((CONST VOID *)arg1, arg2*2+2);
|
---|
166 | }
|
---|
167 | //******************************************************************************
|
---|
168 | //******************************************************************************
|
---|
169 | DWORD WIN32API GetLastError()
|
---|
170 | {
|
---|
171 | DWORD rc;
|
---|
172 |
|
---|
173 | rc = O32_GetLastError();
|
---|
174 | #ifdef DEBUG_LOCAL
|
---|
175 | dprintf(("KERNEL32: GetLastError returned %d\n", rc));
|
---|
176 | #endif
|
---|
177 | return(rc);
|
---|
178 | }
|
---|
179 | //******************************************************************************
|
---|
180 | //******************************************************************************
|
---|
181 | VOID WIN32API SetLastError( DWORD arg1)
|
---|
182 | {
|
---|
183 | // dprintf(("KERNEL32: SetLastError to %d\n", arg1));
|
---|
184 | O32_SetLastError(arg1);
|
---|
185 | }
|
---|
186 | //******************************************************************************
|
---|
187 | //******************************************************************************
|
---|
188 | UINT WIN32API GetOEMCP(VOID)
|
---|
189 | {
|
---|
190 | dprintf(("KERNEL32: GetOEMCP\n"));
|
---|
191 | return(O32_GetOEMCP());
|
---|
192 | }
|
---|
193 | //******************************************************************************
|
---|
194 | //******************************************************************************
|
---|
195 | UINT WIN32API GetACP(VOID)
|
---|
196 | {
|
---|
197 | dprintf(("KERNEL32: GetACP\n"));
|
---|
198 | return(O32_GetACP());
|
---|
199 | }
|
---|
200 | //******************************************************************************
|
---|
201 | //******************************************************************************
|
---|
202 | LONG WIN32API InterlockedDecrement(LPLONG lplVal)
|
---|
203 | {
|
---|
204 | dprintf(("KERNEL32: InterlockedDecrement\n"));
|
---|
205 | return(O32_InterlockedDecrement(lplVal));
|
---|
206 | }
|
---|
207 | //******************************************************************************
|
---|
208 | //******************************************************************************
|
---|
209 | LONG WIN32API InterlockedIncrement(LPLONG lplVal)
|
---|
210 | {
|
---|
211 | dprintf(("KERNEL32: InterlockedIncrement\n"));
|
---|
212 | return(O32_InterlockedIncrement(lplVal));
|
---|
213 | }
|
---|
214 | //******************************************************************************
|
---|
215 | //******************************************************************************
|
---|
216 | LONG WIN32API InterlockedExchange( PLONG arg1, LONG arg2)
|
---|
217 | {
|
---|
218 | dprintf(("KERNEL32: InterlockedExchange\n"));
|
---|
219 | return O32_InterlockedExchange(arg1, arg2);
|
---|
220 | }
|
---|
221 | //******************************************************************************
|
---|
222 | //******************************************************************************
|
---|
223 | LPWSTR WIN32API GetEnvironmentStringsW(VOID)
|
---|
224 | {
|
---|
225 | char *envstrings = (char *)O32_GetEnvironmentStrings();
|
---|
226 | char *tmp;
|
---|
227 | LPWSTR wenvstrings;
|
---|
228 | int len, i;
|
---|
229 |
|
---|
230 | dprintf(("KERNEL32: GetEnvironmentStringsW\n"));
|
---|
231 |
|
---|
232 | if(envstrings == NULL)
|
---|
233 | return(NULL);
|
---|
234 |
|
---|
235 | tmp = envstrings;
|
---|
236 | len = 0;
|
---|
237 | while(*tmp != 0)
|
---|
238 | {
|
---|
239 | len += strlen(tmp)+1;
|
---|
240 | tmp = envstrings + len;
|
---|
241 | }
|
---|
242 | len++; //terminating 0
|
---|
243 | wenvstrings = (LPWSTR)malloc(len*sizeof(WCHAR));
|
---|
244 | for(i=0;
|
---|
245 | i<len;
|
---|
246 | i++)
|
---|
247 | {
|
---|
248 | wenvstrings[i] = envstrings[i];
|
---|
249 | }
|
---|
250 | return(wenvstrings);
|
---|
251 | }
|
---|
252 | //******************************************************************************
|
---|
253 | //******************************************************************************
|
---|
254 | BOOL WIN32API FreeEnvironmentStringsA(LPSTR envstrings)
|
---|
255 | {
|
---|
256 | dprintf(("KERNEL32: FreeEnvironmentStringsA\n"));
|
---|
257 | return(TRUE);
|
---|
258 | }
|
---|
259 | //******************************************************************************
|
---|
260 | //******************************************************************************
|
---|
261 | BOOL WIN32API FreeEnvironmentStringsW(LPWSTR envstrings)
|
---|
262 | {
|
---|
263 | dprintf(("KERNEL32: FreeEnvironmentStringsW\n"));
|
---|
264 | free(envstrings);
|
---|
265 | return(TRUE);
|
---|
266 | }
|
---|
267 | //******************************************************************************
|
---|
268 | //******************************************************************************
|
---|
269 | BOOL WIN32API GetStringTypeW(DWORD fdwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
270 | {
|
---|
271 | int i;
|
---|
272 |
|
---|
273 | dprintf(("KERNEL32: GetStringTypeW, not properly implemented\n"));
|
---|
274 | if((DWORD)lpSrcStr == (DWORD)lpCharType || !lpSrcStr || !lpCharType) {
|
---|
275 | O32_SetLastError(ERROR_INVALID_PARAMETER);
|
---|
276 | return(FALSE);
|
---|
277 | }
|
---|
278 | if(cchSrc == -1)
|
---|
279 | cchSrc = UniStrlen((UniChar*)lpSrcStr);
|
---|
280 |
|
---|
281 | memset(lpCharType, 0, cchSrc*sizeof(WORD));
|
---|
282 | switch(fdwInfoType) {
|
---|
283 | case CT_CTYPE1:
|
---|
284 | for(i=0;i<cchSrc;i++) {
|
---|
285 | if(lpSrcStr[i] >= (WCHAR)'a' && lpSrcStr[i] <= (WCHAR)'z')
|
---|
286 | lpCharType[i] |= C1_LOWER | C1_ALPHA;
|
---|
287 | else
|
---|
288 | if(lpSrcStr[i] >= (WCHAR)'A' && lpSrcStr[i] <= (WCHAR)'A')
|
---|
289 | lpCharType[i] |= C1_UPPER | C1_ALPHA;
|
---|
290 | else
|
---|
291 | if(lpSrcStr[i] >= (WCHAR)'0' && lpSrcStr[i] <= (WCHAR)'9')
|
---|
292 | lpCharType[i] |= C1_DIGIT;
|
---|
293 | else
|
---|
294 | if(lpSrcStr[i] >= (WCHAR)' ')
|
---|
295 | lpCharType[i] |= C1_SPACE;
|
---|
296 | }
|
---|
297 | break;
|
---|
298 | case CT_CTYPE2:
|
---|
299 | case CT_CTYPE3: //not supported right now
|
---|
300 | break;
|
---|
301 | }
|
---|
302 | return(TRUE);
|
---|
303 | }
|
---|
304 | //******************************************************************************
|
---|
305 | //NOTE: This has one parameter more than the W version! (@#$@#$)
|
---|
306 | //******************************************************************************
|
---|
307 | BOOL WIN32API GetStringTypeA(LCID Locale, DWORD fdwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
308 | {
|
---|
309 | int i;
|
---|
310 |
|
---|
311 | dprintf(("KERNEL32: GetStringTypeA, not properly implemented\n"));
|
---|
312 | if(lpSrcStr == (LPCSTR)lpCharType || !lpSrcStr || !lpCharType) {
|
---|
313 | O32_SetLastError(ERROR_INVALID_PARAMETER);
|
---|
314 | return(FALSE);
|
---|
315 | }
|
---|
316 | if(cchSrc == -1)
|
---|
317 | cchSrc = strlen(lpSrcStr);
|
---|
318 |
|
---|
319 | memset(lpCharType, 0, cchSrc*sizeof(WORD));
|
---|
320 | switch(fdwInfoType) {
|
---|
321 | case CT_CTYPE1:
|
---|
322 | for(i=0;i<cchSrc;i++) {
|
---|
323 | if(lpSrcStr[i] >= 'a' && lpSrcStr[i] <= 'z')
|
---|
324 | lpCharType[i] |= C1_LOWER | C1_ALPHA;
|
---|
325 | else
|
---|
326 | if(lpSrcStr[i] >= 'A' && lpSrcStr[i] <= 'A')
|
---|
327 | lpCharType[i] |= C1_UPPER | C1_ALPHA;
|
---|
328 | else
|
---|
329 | if(lpSrcStr[i] >= '0' && lpSrcStr[i] <= '9')
|
---|
330 | lpCharType[i] |= C1_DIGIT;
|
---|
331 | else
|
---|
332 | if(lpSrcStr[i] >= ' ')
|
---|
333 | lpCharType[i] |= C1_SPACE;
|
---|
334 | }
|
---|
335 | break;
|
---|
336 | case CT_CTYPE2:
|
---|
337 | case CT_CTYPE3: //not supported right now
|
---|
338 | break;
|
---|
339 | }
|
---|
340 | return(TRUE);
|
---|
341 | }
|
---|
342 | //******************************************************************************
|
---|
343 | //******************************************************************************
|
---|
344 | BOOL WIN32API GetStringTypeExW(LCID Locale, DWORD fdwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
345 | {
|
---|
346 | dprintf(("KERNEL32: GetStringTypeExW, not properly implemented\n"));
|
---|
347 | return(GetStringTypeW(fdwInfoType, lpSrcStr, cchSrc, lpCharType));
|
---|
348 | }
|
---|
349 | //******************************************************************************
|
---|
350 | //******************************************************************************
|
---|
351 | BOOL WIN32API GetStringTypeExA(LCID Locale, DWORD fdwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType)
|
---|
352 | {
|
---|
353 | dprintf(("KERNEL32: GetStringTypeExA, not properly implemented\n"));
|
---|
354 | return(GetStringTypeA(Locale, fdwInfoType, lpSrcStr, cchSrc, lpCharType));
|
---|
355 | }
|
---|
356 | //******************************************************************************
|
---|
357 | //******************************************************************************
|
---|
358 | VOID WIN32API EnterCriticalSection(CRITICAL_SECTION * lpcsCriticalSection)
|
---|
359 | {
|
---|
360 | //// dprintf(("KERNEL32: EnterCriticalSection\n"));
|
---|
361 | O32_EnterCriticalSection(lpcsCriticalSection);
|
---|
362 | }
|
---|
363 | //******************************************************************************
|
---|
364 | //******************************************************************************
|
---|
365 | VOID WIN32API LeaveCriticalSection(CRITICAL_SECTION * arg1)
|
---|
366 | {
|
---|
367 | //// dprintf(("KERNEL32: LeaveCriticalSection\n"));
|
---|
368 | O32_LeaveCriticalSection(arg1);
|
---|
369 | }
|
---|
370 | //******************************************************************************
|
---|
371 | //******************************************************************************
|
---|
372 | VOID WIN32API InitializeCriticalSection(CRITICAL_SECTION * arg1)
|
---|
373 | {
|
---|
374 | dprintf(("KERNEL32: InitializeCriticalSection\n"));
|
---|
375 | O32_InitializeCriticalSection(arg1);
|
---|
376 | }
|
---|
377 | //******************************************************************************
|
---|
378 | //******************************************************************************
|
---|
379 | void WINAPI MakeCriticalSectionGlobal( CRITICAL_SECTION *arg1 )
|
---|
380 | {
|
---|
381 | dprintf(("KERNEL32: MakeCriticalSectionGlobal not implemented correctly\n"));
|
---|
382 | }
|
---|
383 | //******************************************************************************
|
---|
384 | //******************************************************************************
|
---|
385 | BOOL WIN32API SetEnvironmentVariableA(LPCSTR arg1, LPCSTR arg2)
|
---|
386 | {
|
---|
387 | dprintf(("KERNEL32: SetEnvironmentVariable %s to %s\n", arg1, arg2));
|
---|
388 | return O32_SetEnvironmentVariable(arg1, arg2);
|
---|
389 | }
|
---|
390 | //******************************************************************************
|
---|
391 | //******************************************************************************
|
---|
392 | BOOL WIN32API SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue)
|
---|
393 | {
|
---|
394 | char *asciiname, *asciivalue;
|
---|
395 | BOOL rc;
|
---|
396 |
|
---|
397 | dprintf(("KERNEL32: OS2SetEnvironmentVariableW\n"));
|
---|
398 | asciiname = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
399 | asciivalue = UnicodeToAsciiString((LPWSTR)lpValue);
|
---|
400 | rc = O32_SetEnvironmentVariable(asciiname, asciivalue);
|
---|
401 | FreeAsciiString(asciivalue);
|
---|
402 | FreeAsciiString(asciiname);
|
---|
403 | return(rc);
|
---|
404 | }
|
---|
405 | //******************************************************************************
|
---|
406 | VOID WIN32API GlobalMemoryStatus( MEMORYSTATUS *arg1)
|
---|
407 | {
|
---|
408 | dprintf(("KERNEL32: GlobalMemoryStatus\n"));
|
---|
409 | O32_GlobalMemoryStatus(arg1);
|
---|
410 | dprintf(("dwMemoryLoad %X\n", arg1->dwMemoryLoad));
|
---|
411 | dprintf(("dwTotalPhys %X\n", arg1->dwTotalPhys));
|
---|
412 | dprintf(("dwAvailPhys %X\n", arg1->dwAvailPhys));
|
---|
413 | dprintf(("dwTotalPageFile %X\n", arg1->dwTotalPageFile));
|
---|
414 | dprintf(("dwAvailPageFile %X\n", arg1->dwAvailPageFile));
|
---|
415 | dprintf(("dwTotalVirtual %X\n", arg1->dwTotalVirtual));
|
---|
416 | dprintf(("dwAvailVirtual %X\n", arg1->dwAvailVirtual));
|
---|
417 | }
|
---|
418 | //******************************************************************************
|
---|
419 | //******************************************************************************
|
---|
420 | DWORD WIN32API GetEnvironmentVariableA(LPCSTR arg1, LPSTR arg2, DWORD arg3)
|
---|
421 | {
|
---|
422 | dprintf(("KERNEL32: GetEnvironmentVariable %s\n", arg1));
|
---|
423 | return O32_GetEnvironmentVariable(arg1, arg2, arg3);
|
---|
424 | }
|
---|
425 | //******************************************************************************
|
---|
426 | //******************************************************************************
|
---|
427 | DWORD WIN32API GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer,
|
---|
428 | DWORD nSize)
|
---|
429 | {
|
---|
430 | char *astring, *asciibuffer;
|
---|
431 | DWORD rc;
|
---|
432 |
|
---|
433 | dprintf(("KERNEL32: OS2GetEnvironmentVariableW\n"));
|
---|
434 | asciibuffer = (char *)malloc(nSize+1);
|
---|
435 | astring = UnicodeToAsciiString((LPWSTR)lpName);
|
---|
436 |
|
---|
437 | rc = O32_GetEnvironmentVariable(astring, asciibuffer, nSize);
|
---|
438 | AsciiToUnicode(asciibuffer, lpBuffer);
|
---|
439 | FreeAsciiString(astring);
|
---|
440 | free(asciibuffer);
|
---|
441 | return(rc);
|
---|
442 | }
|
---|
443 | //******************************************************************************
|
---|
444 | //******************************************************************************
|
---|
445 | HINSTANCE WIN32API WinExec(LPCSTR arg1, UINT arg2)
|
---|
446 | {
|
---|
447 | dprintf(("KERNEL32: WinExec %s\n", arg1));
|
---|
448 | return (HINSTANCE)O32_WinExec(arg1, arg2);
|
---|
449 | }
|
---|
450 | //******************************************************************************
|
---|
451 | //******************************************************************************
|
---|
452 | BOOL WIN32API GetExitCodeProcess(HANDLE arg1, LPDWORD arg2)
|
---|
453 | {
|
---|
454 | dprintf(("KERNEL32: GetExitCodeProcess\n"));
|
---|
455 | return O32_GetExitCodeProcess(arg1, arg2);
|
---|
456 | }
|
---|
457 | //******************************************************************************
|
---|
458 | //******************************************************************************
|
---|
459 | HANDLE WIN32API GetCurrentProcess(void)
|
---|
460 | {
|
---|
461 | //// dprintf(("KERNEL32: GetCurrentProcess\n"));
|
---|
462 | return O32_GetCurrentProcess();
|
---|
463 | }
|
---|
464 | //******************************************************************************
|
---|
465 | //******************************************************************************
|
---|
466 | DWORD WIN32API GetCurrentProcessId(void)
|
---|
467 | {
|
---|
468 | dprintf(("KERNEL32: GetCurrentProcessId\n"));
|
---|
469 | return O32_GetCurrentProcessId();
|
---|
470 | }
|
---|
471 | //******************************************************************************
|
---|
472 | //******************************************************************************
|
---|
473 | BOOL WIN32API TerminateProcess( HANDLE arg1, DWORD arg2)
|
---|
474 | {
|
---|
475 | dprintf(("KERNEL32: TerminateProcess\n"));
|
---|
476 | return O32_TerminateProcess(arg1, arg2);
|
---|
477 | }
|
---|
478 | //******************************************************************************
|
---|
479 | //******************************************************************************
|
---|
480 | VOID WIN32API Sleep(DWORD arg1)
|
---|
481 | {
|
---|
482 | dprintf(("KERNEL32: Sleep %d\n", arg1));
|
---|
483 | O32_Sleep(arg1);
|
---|
484 | }
|
---|
485 | //******************************************************************************
|
---|
486 | //******************************************************************************
|
---|
487 | DWORD WIN32API GetPriorityClass(HANDLE arg1)
|
---|
488 | {
|
---|
489 | dprintf(("KERNEL32: GetPriorityClass\n"));
|
---|
490 | return O32_GetPriorityClass(arg1);
|
---|
491 | }
|
---|
492 | //******************************************************************************
|
---|
493 | //******************************************************************************
|
---|
494 | BOOL WIN32API SetPriorityClass(HANDLE arg1, DWORD arg2)
|
---|
495 | {
|
---|
496 | dprintf(("KERNEL32: SetPriorityClass\n"));
|
---|
497 | return O32_SetPriorityClass(arg1, arg2);
|
---|
498 | }
|
---|
499 | //******************************************************************************
|
---|
500 | //TODO!
|
---|
501 | //******************************************************************************
|
---|
502 | int WIN32API LCMapStringW(
|
---|
503 | DWORD /*LCID*/ Locale,
|
---|
504 | DWORD dwMapFlags,
|
---|
505 | LPCWSTR lpSrcStr,
|
---|
506 | int cchSrc,
|
---|
507 | LPWSTR lpDestStr,
|
---|
508 | int cchDest)
|
---|
509 | {
|
---|
510 | // quick hack! this code is not done!
|
---|
511 | if(cchSrc == -1)
|
---|
512 | cchSrc = strlen((const char *)lpSrcStr);
|
---|
513 | if(!cchDest)
|
---|
514 | return cchSrc;
|
---|
515 | strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest));
|
---|
516 | return max(cchSrc, cchDest);
|
---|
517 | }
|
---|
518 | //******************************************************************************
|
---|
519 | //TODO!
|
---|
520 | //******************************************************************************
|
---|
521 | int WIN32API LCMapStringA(
|
---|
522 | DWORD /*LCID*/ Locale,
|
---|
523 | DWORD dwMapFlags,
|
---|
524 | LPCSTR lpSrcStr,
|
---|
525 | int cchSrc,
|
---|
526 | LPSTR lpDestStr,
|
---|
527 | int cchDest)
|
---|
528 | {
|
---|
529 | dprintf(("KERNEL32: LCMapStringA not implemented\n"));
|
---|
530 | if(cchSrc == -1)
|
---|
531 | cchSrc = strlen((const char *)lpSrcStr);
|
---|
532 | if(!cchDest)
|
---|
533 | return cchSrc;
|
---|
534 | strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest));
|
---|
535 | return max(cchSrc, cchDest);
|
---|
536 | }
|
---|
537 | //******************************************************************************
|
---|
538 | //SvL: 24-6-'97 - Added
|
---|
539 | //******************************************************************************
|
---|
540 | VOID WIN32API DeleteCriticalSection( CRITICAL_SECTION * arg1)
|
---|
541 | {
|
---|
542 | dprintf(("KERNEL32: OS2DeleteCriticalSection\n"));
|
---|
543 | O32_DeleteCriticalSection(arg1);
|
---|
544 | }
|
---|
545 | //******************************************************************************
|
---|
546 | //******************************************************************************
|
---|
547 | BOOL WIN32API Beep( DWORD arg1, DWORD arg2)
|
---|
548 | {
|
---|
549 | dprintf(("KERNEL32: OS2Beep\n"));
|
---|
550 | return O32_Beep(arg1, arg2);
|
---|
551 | }
|
---|
552 | //******************************************************************************
|
---|
553 | //******************************************************************************
|
---|
554 | VOID WIN32API FatalAppExitA( UINT arg1, LPCSTR arg2)
|
---|
555 | {
|
---|
556 | dprintf(("KERNEL32: OS2FatalAppExitA\n"));
|
---|
557 | O32_FatalAppExit(arg1, arg2);
|
---|
558 | }
|
---|
559 | //******************************************************************************
|
---|
560 | //******************************************************************************
|
---|
561 | VOID WIN32API FatalAppExitW(UINT arg1, LPCWSTR arg2)
|
---|
562 | {
|
---|
563 | char *astring;
|
---|
564 |
|
---|
565 | dprintf(("KERNEL32: OS2FatalAppExitW\n"));
|
---|
566 | astring = UnicodeToAsciiString((LPWSTR)arg2);
|
---|
567 | O32_FatalAppExit(arg1, astring);
|
---|
568 | //probably won't return, but who cares..
|
---|
569 | FreeAsciiString(astring);
|
---|
570 | }
|
---|
571 | //******************************************************************************
|
---|
572 | //******************************************************************************
|
---|
573 | VOID WIN32API FatalExit( UINT arg1)
|
---|
574 | {
|
---|
575 | dprintf(("KERNEL32: OS2FatalExit\n"));
|
---|
576 | O32_FatalExit(arg1);
|
---|
577 | }
|
---|
578 | //******************************************************************************
|
---|
579 | //******************************************************************************
|
---|
580 | LPSTR WIN32API GetEnvironmentStringsA(void)
|
---|
581 | {
|
---|
582 | dprintf(("KERNEL32: OS2GetEnvironmentStringsA\n"));
|
---|
583 | return (LPSTR) O32_GetEnvironmentStrings();
|
---|
584 | }
|
---|
585 | //******************************************************************************
|
---|
586 | //******************************************************************************
|
---|
587 | BOOL WIN32API IsBadHugeReadPtr( const void * arg1, UINT arg2)
|
---|
588 | {
|
---|
589 | dprintf(("KERNEL32: OS2IsBadHugeReadPtr\n"));
|
---|
590 | return O32_IsBadHugeReadPtr(arg1, arg2);
|
---|
591 | }
|
---|
592 | //******************************************************************************
|
---|
593 | //******************************************************************************
|
---|
594 | BOOL WIN32API IsBadHugeWritePtr( PVOID arg1, UINT arg2)
|
---|
595 | {
|
---|
596 | dprintf(("KERNEL32: OS2IsBadHugeWritePtr\n"));
|
---|
597 | return O32_IsBadHugeWritePtr(arg1, arg2);
|
---|
598 | }
|
---|
599 | //******************************************************************************
|
---|
600 | //******************************************************************************
|
---|
601 | BOOL WIN32API IsDBCSLeadByte(BYTE arg1)
|
---|
602 | {
|
---|
603 | dprintf(("KERNEL32: OS2IsDBCSLeadByte\n"));
|
---|
604 | return O32_IsDBCSLeadByte(arg1);
|
---|
605 | }
|
---|
606 | //******************************************************************************
|
---|
607 | //******************************************************************************
|
---|
608 | DWORD WIN32API LoadModule( LPCSTR arg1, PVOID arg2)
|
---|
609 | {
|
---|
610 | dprintf(("KERNEL32: OS2LoadModule\n"));
|
---|
611 | return O32_LoadModule(arg1, arg2);
|
---|
612 | }
|
---|
613 | //******************************************************************************
|
---|
614 | //******************************************************************************
|
---|
615 | int WIN32API MulDiv(int arg1, int arg2, int arg3)
|
---|
616 | {
|
---|
617 | dprintf(("KERNEL32: OS2MulDiv %d*%d/%d\n", arg1, arg2, arg3));
|
---|
618 | return O32_MulDiv(arg1, arg2, arg3);
|
---|
619 | }
|
---|
620 | //******************************************************************************
|
---|
621 | //******************************************************************************
|
---|
622 | HANDLE WIN32API OpenProcess(DWORD arg1, BOOL arg2, DWORD arg3)
|
---|
623 | {
|
---|
624 | dprintf(("KERNEL32: OS2OpenProcess\n"));
|
---|
625 | return O32_OpenProcess(arg1, arg2, arg3);
|
---|
626 | }
|
---|
627 | //******************************************************************************
|
---|
628 | //******************************************************************************
|
---|
629 | //SvL: BUGFIX: C calling convention!
|
---|
630 | //******************************************************************************
|
---|
631 | VOID __cdecl OS2memmove(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, DWORD Length)
|
---|
632 | {
|
---|
633 | memmove(Destination, Source, Length);
|
---|
634 | }
|
---|
635 | //******************************************************************************
|
---|
636 |
|
---|
637 | //******************************************************************************
|
---|
638 | UINT WIN32API CompareStringA(LCID lcid, DWORD fdwStyle, LPCSTR lpString1,
|
---|
639 | DWORD cch1, LPCSTR lpString2, DWORD cch2)
|
---|
640 | {
|
---|
641 | int i;
|
---|
642 | int fEqual = TRUE;
|
---|
643 | char *string1 = (char *)lpString1, *string2 = (char *)lpString2;
|
---|
644 |
|
---|
645 | #ifdef DEBUG
|
---|
646 | if(fdwStyle & SORT_STRINGSORT)
|
---|
647 | dprintf(("KERNEL32: SORT_STRINGSORT not supported!\n"));
|
---|
648 | if(fdwStyle & NORM_IGNORENONSPACE)
|
---|
649 | dprintf(("KERNEL32: NORM_IGNORENONSPACE not supported!\n"));
|
---|
650 | if(fdwStyle & NORM_IGNORESYMBOLS)
|
---|
651 | dprintf(("KERNEL32: NORM_IGNORESYMBOLS not supported!\n"));
|
---|
652 | #endif
|
---|
653 |
|
---|
654 | if(cch1 == -1) cch1 = strlen(string1);
|
---|
655 | if(cch2 == -1) cch2 = strlen(string2);
|
---|
656 |
|
---|
657 | if(fdwStyle) {
|
---|
658 | //TODO!
|
---|
659 | if(fdwStyle != 0 && fdwStyle != NORM_IGNORECASE)
|
---|
660 | return(0); /*PLF Fri 98-03-13 04:09:32 was return 1 */
|
---|
661 | }
|
---|
662 | if(fdwStyle & NORM_IGNORECASE)
|
---|
663 | fEqual = strnicmp(string1, string2, min(cch1, cch2));
|
---|
664 | else
|
---|
665 | fEqual = strncmp(string1, string2, min(cch1, cch2));
|
---|
666 |
|
---|
667 | if (fEqual < 0 ) fEqual = 1;
|
---|
668 | else if(fEqual == 0) fEqual = 2;
|
---|
669 | else if(fEqual > 0) fEqual = 3;
|
---|
670 |
|
---|
671 | //If equal, but different length, largest one is the greatest in lexical value
|
---|
672 | if(fEqual == 2 && cch1 != cch2){
|
---|
673 | if(cch1 < cch2)
|
---|
674 | fEqual = 1;
|
---|
675 | else
|
---|
676 | fEqual = 3;
|
---|
677 | }
|
---|
678 | // dprintf(("KERNEL32: OS2CompareStringA '%s' - '%s' returned %d\n", lpString1, lpString2, fEqual));
|
---|
679 | return(fEqual);
|
---|
680 | }
|
---|
681 |
|
---|
682 | //******************************************************************************
|
---|
683 | //TODO: Not complete (fdwStyle flags specify compare method)
|
---|
684 | //******************************************************************************
|
---|
685 | UINT WIN32API CompareStringW(LCID lcid, DWORD fdwStyle, LPCWSTR lpString1,
|
---|
686 | DWORD cch1, LPCWSTR lpString2, DWORD cch2)
|
---|
687 | {
|
---|
688 | int i;
|
---|
689 | int fEqual = TRUE;
|
---|
690 | char *string1 = UnicodeToAsciiString((LPWSTR)lpString1);
|
---|
691 | char *string2 = UnicodeToAsciiString((LPWSTR)lpString2);
|
---|
692 |
|
---|
693 | // dprintf(("KERNEL32: OS2CompareStringW '%s' - '%s'\n", string1, string2));
|
---|
694 |
|
---|
695 | fEqual = CompareStringA(lcid, fdwStyle, string1, cch1, string2, cch2);
|
---|
696 | FreeAsciiString(string1);
|
---|
697 | FreeAsciiString(string2);
|
---|
698 |
|
---|
699 | return(fEqual);
|
---|
700 | }
|
---|
701 | //******************************************************************************
|
---|
702 | //TODO:What does this do exactly??
|
---|
703 | // @@@OPH -> see WINE
|
---|
704 | //******************************************************************************
|
---|
705 | BOOL WIN32API DisableThreadLibraryCalls(HMODULE hLibModule)
|
---|
706 | {
|
---|
707 | dprintf(("KERNEL32: (NI!)OS2DisableThreadLibraryCalls of %X\n", hLibModule));
|
---|
708 | return(TRUE);
|
---|
709 | }
|
---|
710 | //******************************************************************************
|
---|
711 | //******************************************************************************
|
---|
712 | //TODO: Query processor info to complete this api
|
---|
713 | //******************************************************************************
|
---|
714 | VOID WIN32API GetSystemInfo(LPSYSTEM_INFO lpSystemInfo)
|
---|
715 | {
|
---|
716 | dprintf(("KERNEL32: GetSystemInfo, not completely accurate\n"));
|
---|
717 | lpSystemInfo->u.x.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
|
---|
718 | lpSystemInfo->u.x.wReserved = 0;
|
---|
719 | lpSystemInfo->dwPageSize = 4096;
|
---|
720 | lpSystemInfo->lpMinimumApplicationAddress = (LPVOID)0;
|
---|
721 | lpSystemInfo->lpMaximumApplicationAddress = (LPVOID)(512*1024*1024);
|
---|
722 | lpSystemInfo->dwActiveProcessorMask = 1;
|
---|
723 | lpSystemInfo->dwNumberOfProcessors = 1; //assuming non-SMP OS/2
|
---|
724 | lpSystemInfo->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
|
---|
725 | lpSystemInfo->dwAllocationGranularity = 64*1024;
|
---|
726 | lpSystemInfo->wProcessorLevel = 5; //Pentium
|
---|
727 | lpSystemInfo->wProcessorRevision = 0x201; //Model 2 stepping 1 (obviously not correct)
|
---|
728 | }
|
---|
729 | //******************************************************************************
|
---|
730 | //Borrowed from Wine
|
---|
731 | //******************************************************************************
|
---|
732 | VOID WIN32API GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
|
---|
733 | {
|
---|
734 | dprintf(("KERNEL32: GetStartupInfo\n"));
|
---|
735 | lpStartupInfo->cb = sizeof(STARTUPINFOA);
|
---|
736 | lpStartupInfo->lpReserved = "<Reserved>";
|
---|
737 | lpStartupInfo->lpDesktop = "Desktop";
|
---|
738 | lpStartupInfo->lpTitle = "Title";
|
---|
739 |
|
---|
740 | lpStartupInfo->cbReserved2 = 0;
|
---|
741 | lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
|
---|
742 |
|
---|
743 | /* @@@PH 98/07/13 Handlemanager support */
|
---|
744 | lpStartupInfo->hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
---|
745 | lpStartupInfo->hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
---|
746 | lpStartupInfo->hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
---|
747 | return;
|
---|
748 | }
|
---|
749 | //******************************************************************************
|
---|
750 | //Borrowed from Wine
|
---|
751 | //******************************************************************************
|
---|
752 | VOID WIN32API GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
|
---|
753 | {
|
---|
754 | static WCHAR lpReserved[] = {'<', 'R','e','s','e','r','v','e','d','>', 0};
|
---|
755 | static WCHAR lpDesktop[] = {'D', 'e','s','k','t','o','p', 0};
|
---|
756 | static WCHAR lpTitle[] = {'T', 'i','t','l','e', 0};
|
---|
757 |
|
---|
758 | dprintf(("KERNEL32: GetStartupInfoW\n"));
|
---|
759 | lpStartupInfo->cb = sizeof(STARTUPINFOW);
|
---|
760 | lpStartupInfo->lpReserved = lpReserved;
|
---|
761 | lpStartupInfo->lpDesktop = lpDesktop;
|
---|
762 | lpStartupInfo->lpTitle = lpTitle;
|
---|
763 |
|
---|
764 | lpStartupInfo->cbReserved2 = 0;
|
---|
765 | lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
|
---|
766 |
|
---|
767 | /* @@@PH 98/07/13 Handlemanager support */
|
---|
768 | lpStartupInfo->hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
---|
769 | lpStartupInfo->hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
---|
770 | lpStartupInfo->hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
---|
771 | return;
|
---|
772 | }
|
---|
773 | //******************************************************************************
|
---|
774 | //TODO: Not complete or correct, but sufficient for now
|
---|
775 | //******************************************************************************
|
---|
776 | BOOL WIN32API GetBinaryTypeA(LPCTSTR lpApplicationName, LPDWORD lpBinaryType)
|
---|
777 | {
|
---|
778 | dprintf(("KERNEL32: OS2GetBinaryTypeA %s\n", lpApplicationName));
|
---|
779 | if(strstr(lpApplicationName, ".EXE") || strstr(lpApplicationName, ".exe"))
|
---|
780 | *lpBinaryType = SCS_32BIT_BINARY;
|
---|
781 | else
|
---|
782 | if(strstr(lpApplicationName, ".COM") || strstr(lpApplicationName, ".com"))
|
---|
783 | *lpBinaryType = SCS_DOS_BINARY;
|
---|
784 | else
|
---|
785 | if(strstr(lpApplicationName, ".PIF") || strstr(lpApplicationName, ".pif"))
|
---|
786 | *lpBinaryType = SCS_PIF_BINARY;
|
---|
787 | else return(FALSE);
|
---|
788 | return(TRUE);
|
---|
789 | }
|
---|
790 | //******************************************************************************
|
---|
791 | //******************************************************************************
|
---|
792 | BOOL WIN32API GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
|
---|
793 | {
|
---|
794 | BOOL rc;
|
---|
795 | char *astring;
|
---|
796 |
|
---|
797 | dprintf(("KERNEL32: OS2GetBinaryTypeW\n"));
|
---|
798 | astring = UnicodeToAsciiString((LPWSTR)lpApplicationName);
|
---|
799 | rc = GetBinaryTypeA(astring, lpBinaryType);
|
---|
800 | FreeAsciiString(astring);
|
---|
801 | return(rc);
|
---|
802 | }
|
---|
803 | //******************************************************************************
|
---|
804 | //TODO: SetLastError
|
---|
805 | //******************************************************************************
|
---|
806 | BOOL WIN32API GetVersionExA(OSVERSIONINFOA *lpVersionInformation)
|
---|
807 | {
|
---|
808 | dprintf(("KERNEL32: OS2GetVersionExA\n"));
|
---|
809 |
|
---|
810 | if(lpVersionInformation == NULL || lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA))
|
---|
811 | return(FALSE);
|
---|
812 |
|
---|
813 | lpVersionInformation->dwMajorVersion = 4; //pretend we're NT 4.0
|
---|
814 | lpVersionInformation->dwMinorVersion = 0;
|
---|
815 | lpVersionInformation->dwBuildNumber = 1564;
|
---|
816 | lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
---|
817 | lpVersionInformation->szCSDVersion[0]= 0;
|
---|
818 | return(TRUE);
|
---|
819 | }
|
---|
820 | //******************************************************************************
|
---|
821 | //******************************************************************************
|
---|
822 | BOOL WIN32API GetVersionExW(OSVERSIONINFOW *lpVersionInformation)
|
---|
823 | {
|
---|
824 | dprintf(("KERNEL32: OS2GetVersionExW\n"));
|
---|
825 |
|
---|
826 | if(lpVersionInformation == NULL || lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW))
|
---|
827 | return(FALSE);
|
---|
828 |
|
---|
829 | lpVersionInformation->dwMajorVersion = 4; //pretend we're NT 4.0
|
---|
830 | lpVersionInformation->dwMinorVersion = 0;
|
---|
831 | lpVersionInformation->dwBuildNumber = 1564;
|
---|
832 | lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
---|
833 | lpVersionInformation->szCSDVersion[0]= 0;
|
---|
834 | return(TRUE);
|
---|
835 | }
|
---|
836 | //******************************************************************************
|
---|
837 | //Should retrieve this from the exe...
|
---|
838 | //******************************************************************************
|
---|
839 | DWORD WIN32API GetProcessVersion(DWORD Processid)
|
---|
840 | {
|
---|
841 | dprintf(("KERNEL32: OS2GetProcessVersion not correctly implemented!!\n"));
|
---|
842 | return(WIN32OS2_VERSION);
|
---|
843 | }
|
---|
844 | //******************************************************************************
|
---|
845 | //******************************************************************************
|
---|
846 | LONG WIN32API GetVersion()
|
---|
847 | {
|
---|
848 | dprintf(("KERNEL32: GetVersion\n"));
|
---|
849 | // highword 0 = NT, lowword high byte major ver, low byte minor ver
|
---|
850 | /* @@@PH 98/04/04 MFC30 makes assumptions about process control block */
|
---|
851 | /* structures that lead to crashes if we don't identify as NT */
|
---|
852 |
|
---|
853 | // return(WIN32OS2_VERSION);
|
---|
854 | return (0x0);
|
---|
855 | }
|
---|
856 | //******************************************************************************
|
---|
857 | //SvL: 26-6-'97 - Added
|
---|
858 | //******************************************************************************
|
---|
859 | VOID WIN32API OutputDebugStringW(LPCWSTR arg1)
|
---|
860 | {
|
---|
861 | char *astring;
|
---|
862 |
|
---|
863 | astring = UnicodeToAsciiString((LPWSTR)arg1);
|
---|
864 | dprintf(("KERNEL32: OS2OutputDebugStringW %s\n", astring));
|
---|
865 | FreeAsciiString(astring);
|
---|
866 | }
|
---|
867 | //******************************************************************************
|
---|
868 | //******************************************************************************
|
---|
869 | VOID WIN32API OutputDebugStringA(LPCSTR lpszOutputString)
|
---|
870 | {
|
---|
871 | dprintf(("KERNEL32: OutputDebugStringA: %s\n", lpszOutputString));
|
---|
872 | return;
|
---|
873 | }
|
---|
874 | //******************************************************************************
|
---|
875 | //Obsolete
|
---|
876 | //******************************************************************************
|
---|
877 | DWORD WIN32API GetProcessHeaps(DWORD NumberOfHeaps, PHANDLE ProcessHeaps)
|
---|
878 | {
|
---|
879 | dprintf(("KERNEL32: GetProcessHeaps, Not implemented\n"));
|
---|
880 | return(0);
|
---|
881 | }
|
---|
882 | //******************************************************************************
|
---|
883 | //WINE
|
---|
884 | //******************************************************************************
|
---|
885 | BOOL WIN32API GetProcessAffinityMask(HANDLE hProcess,
|
---|
886 | LPDWORD lpProcessAffinityMask,
|
---|
887 | LPDWORD lpSystemAffinityMask)
|
---|
888 | {
|
---|
889 | /* It is definitely important for a process to know on what processor
|
---|
890 | it is running :-) */
|
---|
891 | if(lpProcessAffinityMask)
|
---|
892 | *lpProcessAffinityMask=1;
|
---|
893 | if(lpSystemAffinityMask)
|
---|
894 | *lpSystemAffinityMask=1;
|
---|
895 | return TRUE;
|
---|
896 | }
|
---|
897 | //******************************************************************************
|
---|
898 | //******************************************************************************
|
---|
899 |
|
---|
900 |
|
---|
901 | BOOL WIN32API FlushInstructionCache( /*PLF Mon 98-02-09 23:56:49 : STUB STUB STUB STUB STUB */
|
---|
902 | HANDLE hProcess, /* process with cache to flush */
|
---|
903 | LPCVOID lpvBase, /* address of region to flush */
|
---|
904 | DWORD cbFlush) /* length of region to flush */
|
---|
905 |
|
---|
906 | {
|
---|
907 | dprintf(("FlushInstructionCache() - NIY\n"));
|
---|
908 | return TRUE;
|
---|
909 | }
|
---|
910 |
|
---|
911 |
|
---|
912 | //******************************************************************************
|
---|
913 | VOID WIN32API UninitializeCriticalSection(CRITICAL_SECTION * lpcsCriticalSection)
|
---|
914 | {
|
---|
915 | dprintf(("KERNEL32: UninitializeCriticalSection\n"));
|
---|
916 | }
|
---|
917 |
|
---|
918 | int WIN32API GetNumberFormatA(LCID Locale,
|
---|
919 | DWORD dwFlags,
|
---|
920 | LPCSTR lpValue,
|
---|
921 | CONST NUMBERFMTA *lpFormat,
|
---|
922 | LPSTR lpNumberStr,
|
---|
923 | int cchNumber)
|
---|
924 | {
|
---|
925 | dprintf(("KERNEL32::OS2GetNumberFormatA(%08x,%08x,%s,%08x,%s,%08x) not implemented.\n",
|
---|
926 | Locale,
|
---|
927 | dwFlags,
|
---|
928 | lpValue,
|
---|
929 | lpFormat,
|
---|
930 | lpNumberStr,
|
---|
931 | cchNumber));
|
---|
932 |
|
---|
933 | return 0;
|
---|
934 | }
|
---|
935 |
|
---|
936 | int WIN32API GetNumberFormatW(LCID Locale,
|
---|
937 | DWORD dwFlags,
|
---|
938 | LPCWSTR lpValue,
|
---|
939 | CONST NUMBERFMTW *lpFormat,
|
---|
940 | LPWSTR lpNumberStr,
|
---|
941 | int cchNumber)
|
---|
942 | {
|
---|
943 | dprintf(("KERNEL32::OS2GetNumberFormatW(%08x,%08x,%s,%08x,%s,%08x) not implemented.\n",
|
---|
944 | Locale,
|
---|
945 | dwFlags,
|
---|
946 | lpValue,
|
---|
947 | lpFormat,
|
---|
948 | lpNumberStr,
|
---|
949 | cchNumber));
|
---|
950 |
|
---|
951 | return 0;
|
---|
952 | }
|
---|
953 |
|
---|
954 | BOOL WIN32API FindCloseChangeNotification(HANDLE hChange)
|
---|
955 | {
|
---|
956 | dprintf(("KERNEL32: OS2FindNextChangeNotification, Not implemented\n"));
|
---|
957 |
|
---|
958 | return(TRUE);
|
---|
959 | }
|
---|
960 |
|
---|
961 | //******************************************************************************
|
---|
962 | //******************************************************************************
|
---|
963 | void WIN32API WrongComctl32()
|
---|
964 | {
|
---|
965 | O32_MessageBox(NULL,
|
---|
966 | "KERNEL32.36 not implemented",
|
---|
967 | "Win32 for OS/2 Error",
|
---|
968 | MB_OK);
|
---|
969 | ExitProcess(987);
|
---|
970 | }
|
---|
971 | //******************************************************************************
|
---|
972 |
|
---|
973 |
|
---|
974 |
|
---|
975 | /***********************************************************************
|
---|
976 | * RtlFillMemory (KERNEL32.441)
|
---|
977 | */
|
---|
978 | VOID WIN32API RtlFillMemory(LPVOID ptr,
|
---|
979 | UINT len,
|
---|
980 | UINT fill )
|
---|
981 | {
|
---|
982 | #ifdef DEBUG_LOCAL
|
---|
983 | dprintf(("KERNEL32: RtlFillMemory(%08x,%08x,%08x)\n",
|
---|
984 | ptr,
|
---|
985 | len,
|
---|
986 | fill));
|
---|
987 | #endif
|
---|
988 |
|
---|
989 | memset(ptr,
|
---|
990 | fill,
|
---|
991 | len );
|
---|
992 | }
|
---|
993 |
|
---|
994 |
|
---|
995 | /***********************************************************************
|
---|
996 | * RtlMoveMemory (KERNEL32.442)
|
---|
997 | */
|
---|
998 | VOID WIN32API RtlMoveMemory(LPVOID dst,
|
---|
999 | LPCVOID src,
|
---|
1000 | UINT len )
|
---|
1001 | {
|
---|
1002 | #ifdef DEBUG_LOCAL
|
---|
1003 | dprintf(("KERNEL32: RtlMoveMemory(%08x,%08x,%08x)\n",
|
---|
1004 | dst,
|
---|
1005 | src,
|
---|
1006 | len));
|
---|
1007 | #endif
|
---|
1008 |
|
---|
1009 | memmove(dst,
|
---|
1010 | src,
|
---|
1011 | len );
|
---|
1012 | }
|
---|
1013 |
|
---|
1014 |
|
---|
1015 | /***********************************************************************
|
---|
1016 | * RtlZeroMemory (KERNEL32.444)
|
---|
1017 | */
|
---|
1018 | VOID WIN32API RtlZeroMemory(LPVOID ptr,
|
---|
1019 | UINT len)
|
---|
1020 | {
|
---|
1021 | #ifdef DEBUG_LOCAL
|
---|
1022 | dprintf(("KERNEL32: RtlZeroMemory(%08x,%08x)\n",
|
---|
1023 | ptr,
|
---|
1024 | len));
|
---|
1025 | #endif
|
---|
1026 |
|
---|
1027 | memset(ptr,
|
---|
1028 | 0,
|
---|
1029 | len);
|
---|
1030 | }
|
---|
1031 |
|
---|
1032 |
|
---|
1033 | //******************************************************************************
|
---|
1034 | /*KSO Thu 21.05.1998*/
|
---|
1035 | BOOL WIN32API IsDBCSLeadByteEx(UINT CodePage, BYTE TestChar)
|
---|
1036 | {
|
---|
1037 | dprintf(("KERNEL32: OS2IsDBCSLeadByteEx - not correctly implemented\n"));
|
---|
1038 | return O32_IsDBCSLeadByte(TestChar);
|
---|
1039 | }
|
---|
1040 | //******************************************************************************
|
---|
1041 |
|
---|
1042 |
|
---|
1043 |
|
---|
1044 |
|
---|
1045 |
|
---|
1046 |
|
---|
1047 |
|
---|
1048 |
|
---|