1 | /* $Id: crtdll.cpp,v 1.1 1999-09-07 20:41:44 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * The C RunTime DLL
|
---|
5 | *
|
---|
6 | * Implements C run-time functionality as known from UNIX.
|
---|
7 | *
|
---|
8 | * Copyright 1996,1998 Marcus Meissner
|
---|
9 | * Copyright 1996 Jukka Iivonen
|
---|
10 | * Copyright 1997 Uwe Bonnes
|
---|
11 | * Copyright 1999 Jens Wiessner
|
---|
12 | */
|
---|
13 |
|
---|
14 |
|
---|
15 | #include <os2win.h>
|
---|
16 | #include <stdio.h>
|
---|
17 | #include <stdlib.h>
|
---|
18 | #include <string.h>
|
---|
19 | #include <odinwrap.h>
|
---|
20 | #include <misc.h>
|
---|
21 | #include <unicode.h>
|
---|
22 | #include <heapstring.h>
|
---|
23 | #include <ctype.h>
|
---|
24 | #include <setjmp.h>
|
---|
25 | #include <except.h>
|
---|
26 | #include <debugtools.h>
|
---|
27 |
|
---|
28 | #include <wchar.h>
|
---|
29 | #include <wctype.h>
|
---|
30 |
|
---|
31 | #include <crtdll.h>
|
---|
32 | #include "crtinc.h"
|
---|
33 |
|
---|
34 |
|
---|
35 | // DEFAULT_DEBUG_CHANNEL(crtdll)
|
---|
36 |
|
---|
37 | INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args );
|
---|
38 |
|
---|
39 |
|
---|
40 | /*********************************************************************
|
---|
41 | * CRTDLL_MainInit (CRTDLL.init)
|
---|
42 | */
|
---|
43 | BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
---|
44 | {
|
---|
45 | if (fdwReason == DLL_PROCESS_ATTACH) {
|
---|
46 | CRTDLL__fdopen(0,"r");
|
---|
47 | CRTDLL__fdopen(1,"w");
|
---|
48 | CRTDLL__fdopen(2,"w");
|
---|
49 | }
|
---|
50 | return TRUE;
|
---|
51 | }
|
---|
52 |
|
---|
53 | /*********************************************************************
|
---|
54 | * _XcptFilter (CRTDLL.21)
|
---|
55 | * FIXME - Could not find anything about it
|
---|
56 | */
|
---|
57 | INT CDECL CRTDLL__XcptFilter(DWORD ret)
|
---|
58 | {
|
---|
59 | dprintf(("CRTDLL: XcptFilter\n"));
|
---|
60 |
|
---|
61 | return 0;
|
---|
62 | }
|
---|
63 |
|
---|
64 | /*********************************************************************
|
---|
65 | * _GetMainArgs (CRTDLL.22)
|
---|
66 | */
|
---|
67 | DWORD CDECL CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,
|
---|
68 | LPSTR *environ,DWORD flag)
|
---|
69 | {
|
---|
70 | char *cmdline;
|
---|
71 | char **xargv;
|
---|
72 | int xargc,i,afterlastspace;
|
---|
73 | DWORD version;
|
---|
74 |
|
---|
75 | dprintf(("CRTDLL: GetMainArgs\n"));
|
---|
76 |
|
---|
77 | CRTDLL_acmdln_dll = cmdline = HEAP_strdupA( GetProcessHeap(), 0,
|
---|
78 | GetCommandLineA() );
|
---|
79 |
|
---|
80 | version = GetVersion();
|
---|
81 | CRTDLL_osver_dll = version >> 16;
|
---|
82 | CRTDLL_winminor_dll = version & 0xFF;
|
---|
83 | CRTDLL_winmajor_dll = (version>>8) & 0xFF;
|
---|
84 | CRTDLL_baseversion_dll = version >> 16;
|
---|
85 | CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
|
---|
86 | CRTDLL_baseminor_dll = (version >> 16) & 0xFF;
|
---|
87 | CRTDLL_basemajor_dll = (version >> 24) & 0xFF;
|
---|
88 | CRTDLL_osversion_dll = version & 0xFFFF;
|
---|
89 | CRTDLL_osminor_dll = version & 0xFF;
|
---|
90 | CRTDLL_osmajor_dll = (version>>8) & 0xFF;
|
---|
91 |
|
---|
92 | /* missing threading init */
|
---|
93 | /*
|
---|
94 | i=0;xargv=NULL;xargc=0;afterlastspace=0;
|
---|
95 | dprintf(("CRTDLL: GetMainArgs i loop\n"));
|
---|
96 | while (cmdline[i]) {
|
---|
97 | if (cmdline[i]==' ') {
|
---|
98 | dprintf(("CRTDLL: GetMainArgs *1\n"));
|
---|
99 | xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
|
---|
100 | sizeof(char*)*(++xargc));
|
---|
101 | cmdline[i]='\0';
|
---|
102 | xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
|
---|
103 | cmdline+afterlastspace);
|
---|
104 | i++;
|
---|
105 | dprintf(("CRTDLL: GetMainArgs *2\n"));
|
---|
106 | while (cmdline[i]==' ')
|
---|
107 | i++;
|
---|
108 | if (cmdline[i])
|
---|
109 | afterlastspace=i;
|
---|
110 | dprintf(("CRTDLL: GetMainArgs *3\n"));
|
---|
111 | } else
|
---|
112 | i++;
|
---|
113 |
|
---|
114 | }
|
---|
115 | xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
|
---|
116 | sizeof(char*)*(++xargc));
|
---|
117 | dprintf(("CRTDLL: GetMainArgs *4\n"));
|
---|
118 | cmdline[i]='\0';
|
---|
119 | dprintf(("CRTDLL: GetMainArgs *5\n"));
|
---|
120 | xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
|
---|
121 | cmdline+afterlastspace);
|
---|
122 | dprintf(("CRTDLL: GetMainArgs *6\n"));
|
---|
123 | dprintf(("CRTDLL: GetMainArgs *7\n"));
|
---|
124 | CRTDLL_argc_dll = xargc;
|
---|
125 | dprintf(("CRTDLL: GetMainArgs *8\n"));
|
---|
126 | *argc = xargc;
|
---|
127 | dprintf(("CRTDLL: GetMainArgs *9\n"));
|
---|
128 | CRTDLL_argv_dll = xargv;
|
---|
129 | dprintf(("CRTDLL: GetMainArgs *11\n"));
|
---|
130 | *argv = xargv;
|
---|
131 | */
|
---|
132 | dprintf(("CRTDLL: GetMainArgs end\n"));
|
---|
133 | CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
|
---|
134 | return 0;
|
---|
135 | }
|
---|
136 |
|
---|
137 | /*********************************************************************
|
---|
138 | * __mb_cur_max_dll (CRTDLL.31)
|
---|
139 | * FIXME - Could not find anything about it
|
---|
140 | */
|
---|
141 | INT CDECL CRTDLL___mb_cur_max_dll(DWORD ret)
|
---|
142 | {
|
---|
143 | dprintf(("CRTDLL: __mb_cur_max_dll\n"));
|
---|
144 |
|
---|
145 | return 0;
|
---|
146 | }
|
---|
147 |
|
---|
148 | /*********************************************************************
|
---|
149 | * _chdir (CRTDLL.51)
|
---|
150 | */
|
---|
151 | INT CDECL CRTDLL__chdir(LPCSTR newdir)
|
---|
152 | {
|
---|
153 | dprintf(("CRTDLL: chdir\n"));
|
---|
154 | if (!SetCurrentDirectoryA(newdir))
|
---|
155 | return 1;
|
---|
156 | return 0;
|
---|
157 | }
|
---|
158 |
|
---|
159 | /*********************************************************************
|
---|
160 | * _exit (CRTDLL.87)
|
---|
161 | */
|
---|
162 | VOID CDECL CRTDLL__exit(DWORD ret)
|
---|
163 | {
|
---|
164 | dprintf(("CRTDLL: exit\n"));
|
---|
165 | ExitProcess(ret);
|
---|
166 | }
|
---|
167 |
|
---|
168 | /*********************************************************************
|
---|
169 | * _fdopen (CRTDLL.91)
|
---|
170 | */
|
---|
171 | CRTDLL_FILE * CDECL CRTDLL__fdopen(INT handle, LPCSTR mode)
|
---|
172 | {
|
---|
173 | dprintf(("CRTDLL: fdopen\n"));
|
---|
174 | CRTDLL_FILE *file;
|
---|
175 |
|
---|
176 | switch (handle)
|
---|
177 | {
|
---|
178 | case 0:
|
---|
179 | file = CRTDLL_stdin;
|
---|
180 | if (!file->handle) file->handle = GetStdHandle( STD_INPUT_HANDLE );
|
---|
181 | break;
|
---|
182 | case 1:
|
---|
183 | file = CRTDLL_stdout;
|
---|
184 | if (!file->handle) file->handle = GetStdHandle( STD_OUTPUT_HANDLE );
|
---|
185 | break;
|
---|
186 | case 2:
|
---|
187 | file=CRTDLL_stderr;
|
---|
188 | if (!file->handle) file->handle = GetStdHandle( STD_ERROR_HANDLE );
|
---|
189 | break;
|
---|
190 | default:
|
---|
191 | file = (PCRTDLL_FILE)HeapAlloc( GetProcessHeap(), 0, sizeof(*file) );
|
---|
192 | file->handle = handle;
|
---|
193 | break;
|
---|
194 | }
|
---|
195 | return file;
|
---|
196 | }
|
---|
197 |
|
---|
198 | /*********************************************************************
|
---|
199 | * _findfirst (CRTDLL.099)
|
---|
200 | *
|
---|
201 | * BUGS
|
---|
202 | * Unimplemented
|
---|
203 | */
|
---|
204 | DWORD CDECL CRTDLL__findfirst(LPCSTR fname, struct find_t * x2)
|
---|
205 | {
|
---|
206 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
207 | return FALSE;
|
---|
208 | }
|
---|
209 |
|
---|
210 | /*********************************************************************
|
---|
211 | * _findnext (CRTDLL.100)
|
---|
212 | *
|
---|
213 | * BUGS
|
---|
214 | * Unimplemented
|
---|
215 | */
|
---|
216 | INT CDECL CRTDLL__findnext(DWORD hand, struct find_t * x2)
|
---|
217 | {
|
---|
218 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
219 | return FALSE;
|
---|
220 | }
|
---|
221 |
|
---|
222 | /*********************************************************************
|
---|
223 | * _fstat (CRTDLL.111)
|
---|
224 | *
|
---|
225 | * BUGS
|
---|
226 | * Unimplemented
|
---|
227 | */
|
---|
228 | int CDECL CRTDLL__fstat(int file, struct stat* buf)
|
---|
229 | {
|
---|
230 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
231 | return FALSE;
|
---|
232 | }
|
---|
233 |
|
---|
234 | /*******************************************************************
|
---|
235 | * _global_unwind2 (CRTDLL.129)
|
---|
236 | */
|
---|
237 | void CDECL CRTDLL__global_unwind2( PEXCEPTION_FRAME frame )
|
---|
238 | {
|
---|
239 | dprintf(("CRTDLL: global_undwind2\n"));
|
---|
240 | RtlUnwind( frame, 0, NULL, 0 );
|
---|
241 | }
|
---|
242 |
|
---|
243 | /*********************************************************************
|
---|
244 | * _initterm (CRTDLL.135)
|
---|
245 | */
|
---|
246 | DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
|
---|
247 | {
|
---|
248 | dprintf(("CRTDLL: initterm\n"));
|
---|
249 | _INITTERMFUN *current;
|
---|
250 |
|
---|
251 | current=start;
|
---|
252 | while (current<end) {
|
---|
253 | if (*current) (*current)();
|
---|
254 | current++;
|
---|
255 | }
|
---|
256 | return 0;
|
---|
257 | }
|
---|
258 |
|
---|
259 | /*********************************************************************
|
---|
260 | * _isctype (CRTDLL.138)
|
---|
261 | */
|
---|
262 | BOOL CDECL CRTDLL__isctype(CHAR x,CHAR type)
|
---|
263 | {
|
---|
264 | dprintf(("CRTDLL: isctype\n"));
|
---|
265 | if ((type & CRTDLL_SPACE) && isspace(x))
|
---|
266 | return TRUE;
|
---|
267 | if ((type & CRTDLL_PUNCT) && ispunct(x))
|
---|
268 | return TRUE;
|
---|
269 | if ((type & CRTDLL_LOWER) && islower(x))
|
---|
270 | return TRUE;
|
---|
271 | if ((type & CRTDLL_UPPER) && isupper(x))
|
---|
272 | return TRUE;
|
---|
273 | if ((type & CRTDLL_ALPHA) && isalpha(x))
|
---|
274 | return TRUE;
|
---|
275 | if ((type & CRTDLL_DIGIT) && isdigit(x))
|
---|
276 | return TRUE;
|
---|
277 | if ((type & CRTDLL_CONTROL) && iscntrl(x))
|
---|
278 | return TRUE;
|
---|
279 | /* check CRTDLL_LEADBYTE */
|
---|
280 | return FALSE;
|
---|
281 | }
|
---|
282 |
|
---|
283 | /*******************************************************************
|
---|
284 | * _local_unwind2 (CRTDLL.172)
|
---|
285 | */
|
---|
286 | void CDECL CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr )
|
---|
287 | {
|
---|
288 | dprintf(("CRTDLL: local_undwind2\n"));
|
---|
289 | }
|
---|
290 |
|
---|
291 | /*********************************************************************
|
---|
292 | * CRTDLL__mbsinc (CRTDLL.203)
|
---|
293 | */
|
---|
294 | LPSTR CDECL CRTDLL__mbsinc( LPCSTR str )
|
---|
295 | {
|
---|
296 | int len = mblen( str, MB_LEN_MAX );
|
---|
297 | if (len < 1) len = 1;
|
---|
298 | return (LPSTR)(str + len);
|
---|
299 | }
|
---|
300 |
|
---|
301 |
|
---|
302 | /*********************************************************************
|
---|
303 | * CRTDLL__mbslen (CRTDLL.204)
|
---|
304 | */
|
---|
305 | INT CDECL CRTDLL__mbslen( LPCSTR str )
|
---|
306 | {
|
---|
307 | INT len, total = 0;
|
---|
308 | while ((len = mblen( str, MB_LEN_MAX )) > 0)
|
---|
309 | {
|
---|
310 | str += len;
|
---|
311 | total++;
|
---|
312 | }
|
---|
313 | return total;
|
---|
314 | }
|
---|
315 |
|
---|
316 | /*********************************************************************
|
---|
317 | * _mkdir (CRTDLL.232)
|
---|
318 | */
|
---|
319 | INT CDECL CRTDLL__mkdir(LPCSTR newdir)
|
---|
320 | {
|
---|
321 | dprintf(("CRTDLL: mkdir\n"));
|
---|
322 | if (!CreateDirectoryA(newdir,NULL))
|
---|
323 | return -1;
|
---|
324 | return 0;
|
---|
325 | }
|
---|
326 |
|
---|
327 | /*********************************************************************
|
---|
328 | * _memicmp (CRTDLL.233)
|
---|
329 | * A stringcompare, without \0 check
|
---|
330 | * RETURNS
|
---|
331 | * -1:if first string is alphabetically before second string
|
---|
332 | * 1:if second '' '' '' '' first ''
|
---|
333 | * 0:if both are equal.
|
---|
334 | */
|
---|
335 | INT CDECL CRTDLL__memicmp(
|
---|
336 | LPCSTR s1, /* [in] first string */
|
---|
337 | LPCSTR s2, /* [in] second string */
|
---|
338 | DWORD len /* [in] length to compare */
|
---|
339 | ) {
|
---|
340 | dprintf(("CRTDLL: memicmp\n"));
|
---|
341 | int i;
|
---|
342 |
|
---|
343 | for (i=0;i<len;i++) {
|
---|
344 | if (tolower(s1[i])<tolower(s2[i]))
|
---|
345 | return -1;
|
---|
346 | if (tolower(s1[i])>tolower(s2[i]))
|
---|
347 | return 1;
|
---|
348 | }
|
---|
349 | return 0;
|
---|
350 | }
|
---|
351 |
|
---|
352 | /*********************************************************************
|
---|
353 | * _pctype_dll (CRTDLL.245)
|
---|
354 | * FIXME - Could not find anything about it
|
---|
355 | */
|
---|
356 | INT CDECL CRTDLL__pctype_dll(DWORD ret)
|
---|
357 | {
|
---|
358 | dprintf(("CRTDLL: _pctype_dll\n"));
|
---|
359 |
|
---|
360 | return 0;
|
---|
361 | }
|
---|
362 |
|
---|
363 | /*********************************************************************
|
---|
364 | * _read (CRTDLL.254)
|
---|
365 | *
|
---|
366 | * BUGS
|
---|
367 | * Unimplemented
|
---|
368 | */
|
---|
369 | INT CDECL CRTDLL__read(INT fd, LPVOID buf, UINT count)
|
---|
370 | {
|
---|
371 | dprintf(("CRTDLL: _read\n"));
|
---|
372 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
373 | return FALSE;
|
---|
374 | }
|
---|
375 |
|
---|
376 | /*********************************************************************
|
---|
377 | * _strnicmp (CRTDLL.291)
|
---|
378 | */
|
---|
379 | INT CDECL CRTDLL__strnicmp( LPCSTR s1, LPCSTR s2, INT n )
|
---|
380 | {
|
---|
381 | dprintf(("CRTDLL: strnicmp\n"));
|
---|
382 | return lstrncmpiA( s1, s2, n );
|
---|
383 | }
|
---|
384 |
|
---|
385 | /*********************************************************************
|
---|
386 | * CRTDLL__wcsnset (CRTDLL.322)
|
---|
387 | */
|
---|
388 | LPWSTR CDECL CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
|
---|
389 | {
|
---|
390 | LPWSTR ret = str;
|
---|
391 | while ((n-- > 0) && *str) *str++ = c;
|
---|
392 | return ret;
|
---|
393 | }
|
---|
394 |
|
---|
395 | /*********************************************************************
|
---|
396 | * CRTDLL__wcsset (CRTDLL.324)
|
---|
397 | */
|
---|
398 | LPWSTR CDECL CRTDLL__wcsset( LPWSTR str, WCHAR c )
|
---|
399 | {
|
---|
400 | LPWSTR ret = str;
|
---|
401 | while (*str) *str++ = c;
|
---|
402 | return ret;
|
---|
403 | }
|
---|
404 |
|
---|
405 | /*********************************************************************
|
---|
406 | * exit (CRTDLL.356)
|
---|
407 | */
|
---|
408 | void CDECL CRTDLL_exit(DWORD ret)
|
---|
409 | {
|
---|
410 | dprintf(("CRTDLL: exit\n"));
|
---|
411 | ExitProcess(ret);
|
---|
412 | }
|
---|
413 |
|
---|
414 | /*********************************************************************
|
---|
415 | * fprintf (CRTDLL.370)
|
---|
416 | */
|
---|
417 | INT CDECL CRTDLL_fprintf( CRTDLL_FILE *file, LPSTR format, ... )
|
---|
418 | {
|
---|
419 | dprintf(("CRTDLL: fprintf\n"));
|
---|
420 | va_list valist;
|
---|
421 | INT res;
|
---|
422 |
|
---|
423 | va_start( valist, format );
|
---|
424 | res = CRTDLL_vfprintf( file, format, valist );
|
---|
425 | va_end( valist );
|
---|
426 | return res;
|
---|
427 | }
|
---|
428 |
|
---|
429 | /*********************************************************************
|
---|
430 | * free (CRTDLL.375)
|
---|
431 | */
|
---|
432 | VOID CDECL CRTDLL_free(LPVOID ptr)
|
---|
433 | {
|
---|
434 | dprintf(("CRTDLL: free\n"));
|
---|
435 | HeapFree(GetProcessHeap(),0,ptr);
|
---|
436 | }
|
---|
437 |
|
---|
438 | /*********************************************************************
|
---|
439 | * fwrite (CRTDLL.383)
|
---|
440 | */
|
---|
441 | DWORD CDECL CRTDLL_fwrite( LPVOID ptr, INT size, INT nmemb, CRTDLL_FILE *file )
|
---|
442 | {
|
---|
443 | DWORD ret;
|
---|
444 |
|
---|
445 | dprintf(("CRTDLL: fwrite\n"));
|
---|
446 | WriteFile( file->handle, ptr, size * nmemb, &ret, NULL );
|
---|
447 | return ret / size;
|
---|
448 | }
|
---|
449 |
|
---|
450 | /*********************************************************************
|
---|
451 | * isalnum (CRTDLL.391)
|
---|
452 | */
|
---|
453 | int CDECL CRTDLL_isalnum(int i)
|
---|
454 | {
|
---|
455 | dprintf(("CRTDLL: isalnum(%08xh)\n", i));
|
---|
456 |
|
---|
457 | return (isalnum(i));
|
---|
458 | }
|
---|
459 |
|
---|
460 | /*********************************************************************
|
---|
461 | * iscntrl (CRTDLL.393)
|
---|
462 | */
|
---|
463 | int CDECL CRTDLL_iscntrl(int i)
|
---|
464 | {
|
---|
465 | dprintf(("CRTDLL: iscntrl(%08xh)\n", i));
|
---|
466 |
|
---|
467 | return (iscntrl(i));
|
---|
468 | }
|
---|
469 |
|
---|
470 | /*********************************************************************
|
---|
471 | * isgraph (CRTDLL.395)
|
---|
472 | */
|
---|
473 | int CDECL CRTDLL_isgraph(int i)
|
---|
474 | {
|
---|
475 | dprintf(("CRTDLL: isgraph(%08xh)\n", i));
|
---|
476 |
|
---|
477 | return (isgraph(i));
|
---|
478 | }
|
---|
479 |
|
---|
480 | /*********************************************************************
|
---|
481 | * isleadbyte (CRTDLL.396)
|
---|
482 | */
|
---|
483 | int CDECL CRTDLL_isleadbyte(int i)
|
---|
484 | {
|
---|
485 | dprintf(("CRTDLL: isleadbyte(%08xh)\n", i));
|
---|
486 |
|
---|
487 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
488 | return FALSE;
|
---|
489 | }
|
---|
490 |
|
---|
491 | /*********************************************************************
|
---|
492 | * ispunct (CRTDLL.399)
|
---|
493 | */
|
---|
494 | int CDECL CRTDLL_ispunct(int i)
|
---|
495 | {
|
---|
496 | dprintf(("CRTDLL: ispunct(%08xh)\n", i));
|
---|
497 |
|
---|
498 | return (ispunct(i));
|
---|
499 | }
|
---|
500 |
|
---|
501 | /*********************************************************************
|
---|
502 | * iswalnum (CRTDLL.402)
|
---|
503 | */
|
---|
504 | int CDECL CRTDLL_iswalnum(wint_t i)
|
---|
505 | {
|
---|
506 | dprintf(("CRTDLL: iswalnum(%08xh)\n", i));
|
---|
507 |
|
---|
508 | return (iswalnum(i));
|
---|
509 | }
|
---|
510 |
|
---|
511 | /*********************************************************************
|
---|
512 | * iswalpha (CRTDLL.403)
|
---|
513 | */
|
---|
514 | int CDECL CRTDLL_iswalpha(wint_t i)
|
---|
515 | {
|
---|
516 | dprintf(("CRTDLL: iswalpha(%08xh)\n", i));
|
---|
517 |
|
---|
518 | return (iswalpha(i));
|
---|
519 | }
|
---|
520 |
|
---|
521 | /*********************************************************************
|
---|
522 | * iswascii (CRTDLL.404)
|
---|
523 | */
|
---|
524 | int CDECL CRTDLL_iswascii(wint_t i)
|
---|
525 | {
|
---|
526 | dprintf(("CRTDLL: iswascii(%08xh)\n", i));
|
---|
527 |
|
---|
528 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
529 | return FALSE;
|
---|
530 | }
|
---|
531 |
|
---|
532 | /*********************************************************************
|
---|
533 | * iswcntrl (CRTDLL.405)
|
---|
534 | */
|
---|
535 | int CDECL CRTDLL_iswcntrl(wint_t i)
|
---|
536 | {
|
---|
537 | dprintf(("CRTDLL: iswcntrl(%08xh)\n", i));
|
---|
538 |
|
---|
539 | return (iswcntrl(i));
|
---|
540 | }
|
---|
541 |
|
---|
542 | /*********************************************************************
|
---|
543 | * iswctype (CRTDLL.406)
|
---|
544 | */
|
---|
545 | int CDECL CRTDLL_iswctype(wint_t i, wctype_t wct)
|
---|
546 | {
|
---|
547 | dprintf(("CRTDLL: iswctype\n"));
|
---|
548 |
|
---|
549 | return (iswctype(i, wct));
|
---|
550 | }
|
---|
551 |
|
---|
552 | /*********************************************************************
|
---|
553 | * iswdigit (CRTDLL.407)
|
---|
554 | */
|
---|
555 | int CDECL CRTDLL_iswdigit(wint_t i)
|
---|
556 | {
|
---|
557 | dprintf(("CRTDLL: iswdigit(%08xh)\n", i));
|
---|
558 |
|
---|
559 | return (iswdigit(i));
|
---|
560 | }
|
---|
561 |
|
---|
562 | /*********************************************************************
|
---|
563 | * iswgraph (CRTDLL.408)
|
---|
564 | */
|
---|
565 | int CDECL CRTDLL_iswgraph(wint_t i)
|
---|
566 | {
|
---|
567 | dprintf(("CRTDLL: iswgraph(%08xh)\n", i));
|
---|
568 |
|
---|
569 | return (iswgraph(i));
|
---|
570 | }
|
---|
571 |
|
---|
572 | /*********************************************************************
|
---|
573 | * iswlower (CRTDLL.409)
|
---|
574 | */
|
---|
575 | int CDECL CRTDLL_iswlower(wint_t i)
|
---|
576 | {
|
---|
577 | dprintf(("CRTDLL: iswlower(%08xh)\n", i));
|
---|
578 |
|
---|
579 | return (iswlower(i));
|
---|
580 | }
|
---|
581 |
|
---|
582 | /*********************************************************************
|
---|
583 | * iswprint (CRTDLL.410)
|
---|
584 | */
|
---|
585 | int CDECL CRTDLL_iswprint(wint_t i)
|
---|
586 | {
|
---|
587 | dprintf(("CRTDLL: iswprint(%08xh)\n", i));
|
---|
588 |
|
---|
589 | return (iswprint(i));
|
---|
590 | }
|
---|
591 |
|
---|
592 | /*********************************************************************
|
---|
593 | * iswpunct (CRTDLL.411)
|
---|
594 | */
|
---|
595 | int CDECL CRTDLL_iswpunct(wint_t i)
|
---|
596 | {
|
---|
597 | dprintf(("CRTDLL: iswpunct(%08xh)\n", i));
|
---|
598 |
|
---|
599 | return (iswpunct(i));
|
---|
600 | }
|
---|
601 |
|
---|
602 | /*********************************************************************
|
---|
603 | * iswspace (CRTDLL.412)
|
---|
604 | */
|
---|
605 | int CDECL CRTDLL_iswspace(wint_t i)
|
---|
606 | {
|
---|
607 | dprintf(("CRTDLL: iswspace(%08xh)\n", i));
|
---|
608 |
|
---|
609 | return (iswspace(i));
|
---|
610 | }
|
---|
611 |
|
---|
612 | /*********************************************************************
|
---|
613 | * iswupper (CRTDLL.413)
|
---|
614 | */
|
---|
615 | int CDECL CRTDLL_iswupper(wint_t i)
|
---|
616 | {
|
---|
617 | dprintf(("CRTDLL: iswupper(%08xh)\n", i));
|
---|
618 |
|
---|
619 | return (iswupper(i));
|
---|
620 | }
|
---|
621 |
|
---|
622 | /*********************************************************************
|
---|
623 | * iswxdigit (CRTDLL.414)
|
---|
624 | */
|
---|
625 | int CDECL CRTDLL_iswxdigit(wint_t i)
|
---|
626 | {
|
---|
627 | dprintf(("CRTDLL: iswxdigit(%08xh)\n", i));
|
---|
628 |
|
---|
629 | return (iswxdigit(i));
|
---|
630 | }
|
---|
631 |
|
---|
632 | /*********************************************************************
|
---|
633 | * isxdigit (CRTDLL.415)
|
---|
634 | */
|
---|
635 | int CDECL CRTDLL_isxdigit(int i)
|
---|
636 | {
|
---|
637 | dprintf(("CRTDLL: isxdigit(%08xh)\n", i));
|
---|
638 |
|
---|
639 | return (isxdigit(i));
|
---|
640 | }
|
---|
641 |
|
---|
642 | /*********************************************************************
|
---|
643 | * longjmp (CRTDLL.423)
|
---|
644 | */
|
---|
645 | VOID CDECL CRTDLL_longjmp(jmp_buf env, int val)
|
---|
646 | {
|
---|
647 | dprintf(("CRTDLL: longjmp\n"));
|
---|
648 | longjmp(env, val);
|
---|
649 | }
|
---|
650 |
|
---|
651 | /*********************************************************************
|
---|
652 | * malloc (CRTDLL.424)
|
---|
653 | */
|
---|
654 | VOID* CDECL CRTDLL_malloc(DWORD size)
|
---|
655 | {
|
---|
656 | dprintf(("CRTDLL: malloc\n"));
|
---|
657 | return HeapAlloc(GetProcessHeap(),0,size);
|
---|
658 | }
|
---|
659 |
|
---|
660 | /*********************************************************************
|
---|
661 | * CRTDLL_mbtowc (CRTDLL.427)
|
---|
662 | */
|
---|
663 | INT CDECL CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
|
---|
664 | {
|
---|
665 | wchar_t res;
|
---|
666 | int ret = mbtowc( &res, str, n );
|
---|
667 | if (dst) *dst = (WCHAR)res;
|
---|
668 | return ret;
|
---|
669 | }
|
---|
670 |
|
---|
671 | /*********************************************************************
|
---|
672 | * memcmp (CRTDLL.429)
|
---|
673 | */
|
---|
674 | int CDECL CRTDLL_memcmp( const void * c1, const void * c2, size_t n )
|
---|
675 | {
|
---|
676 | dprintf(("CRTDLL: memcmp\n"));
|
---|
677 | return memcmp( c1, c2, n );
|
---|
678 | }
|
---|
679 |
|
---|
680 | /*********************************************************************
|
---|
681 | * memcpy (CRTDLL.430)
|
---|
682 | */
|
---|
683 | void * CDECL CRTDLL_memcpy( void *s1, const void *s2, size_t n )
|
---|
684 | {
|
---|
685 | dprintf(("CRTDLL: memcpy\n"));
|
---|
686 | return memcpy( s1, s2, n );
|
---|
687 | }
|
---|
688 |
|
---|
689 | /*********************************************************************
|
---|
690 | * memset (CRTDLL.432)
|
---|
691 | */
|
---|
692 | void * CDECL CRTDLL_memset( void *s, int i, size_t n )
|
---|
693 | {
|
---|
694 | dprintf(("CRTDLL: memset\n"));
|
---|
695 | return memset( s, i, n );
|
---|
696 | }
|
---|
697 |
|
---|
698 | /*********************************************************************
|
---|
699 | * remove (CRTDLL.445)
|
---|
700 | */
|
---|
701 | INT CDECL CRTDLL_remove(LPCSTR file)
|
---|
702 | {
|
---|
703 | dprintf(("CRTDLL: remove\n"));
|
---|
704 | if (!DeleteFileA(file))
|
---|
705 | return -1;
|
---|
706 | return 0;
|
---|
707 | }
|
---|
708 |
|
---|
709 | /*********************************************************************
|
---|
710 | * vfprintf (CRTDLL.494)
|
---|
711 | */
|
---|
712 | INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args )
|
---|
713 | {
|
---|
714 | dprintf(("CRTDLL: vprintf\n"));
|
---|
715 | char buffer[2048]; /* FIXME... */
|
---|
716 |
|
---|
717 | vsprintf( buffer, format, args );
|
---|
718 | return CRTDLL_fwrite( buffer, 1, strlen(buffer), file );
|
---|
719 | }
|
---|
720 |
|
---|
721 | /*********************************************************************
|
---|
722 | * vfwprintf (CRTDLL.495)
|
---|
723 | */
|
---|
724 | int CDECL CRTDLL_vfwprintf( FILE *F, const wchar_t *s, va_list arg )
|
---|
725 | {
|
---|
726 | dprintf(("CRTDLL: vfwprintf\n"));
|
---|
727 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
728 | return FALSE;
|
---|
729 | }
|
---|
730 |
|
---|
731 | /*********************************************************************
|
---|
732 | * vprintf (CRTDLL.496)
|
---|
733 | */
|
---|
734 | int CDECL CRTDLL_vprintf( const char *format, __va_list arg )
|
---|
735 | {
|
---|
736 | dprintf(("CRTDLL: vprintf\n"));
|
---|
737 |
|
---|
738 | return (vprintf(format, arg));
|
---|
739 | }
|
---|
740 |
|
---|
741 | /*********************************************************************
|
---|
742 | * vsprintf (CRTDLL.497)
|
---|
743 | */
|
---|
744 | int CDECL CRTDLL_vsprintf( char *s, const char *format, va_list arg )
|
---|
745 | {
|
---|
746 | dprintf(("CRTDLL: vsprintf\n"));
|
---|
747 |
|
---|
748 | return (vsprintf(s, format, arg));
|
---|
749 | }
|
---|
750 |
|
---|
751 | /*********************************************************************
|
---|
752 | * vswprintf (CRTDLL.498)
|
---|
753 | */
|
---|
754 | int CDECL CRTDLL_vswprintf( wchar_t *s , size_t t, const wchar_t *format, va_list arg )
|
---|
755 | {
|
---|
756 | dprintf(("CRTDLL: vswprintf\n"));
|
---|
757 |
|
---|
758 | return (vswprintf(s, t, format, arg));
|
---|
759 | }
|
---|
760 |
|
---|
761 | /*********************************************************************
|
---|
762 | * vwprintf (CRTDLL.499)
|
---|
763 | */
|
---|
764 | int CDECL CRTDLL_vwprintf( const wchar_t *s, va_list arg)
|
---|
765 | {
|
---|
766 | dprintf(("CRTDLL: vwprintf\n"));
|
---|
767 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
768 | return FALSE;
|
---|
769 | }
|
---|
770 |
|
---|
771 |
|
---|
772 | /*********************************************************************
|
---|
773 | * wcscoll (CRTDLL.503)
|
---|
774 | */
|
---|
775 | int CDECL CRTDLL_wcscoll(const wchar_t *s1, const wchar_t *s2)
|
---|
776 | {
|
---|
777 | dprintf(("CRTDLL: wcscoll\n"));
|
---|
778 |
|
---|
779 | return (wcscoll(s1, s2));
|
---|
780 | }
|
---|
781 |
|
---|
782 | /*********************************************************************
|
---|
783 | * wcsftime (CRTDLL.506)
|
---|
784 | */
|
---|
785 | size_t CDECL CRTDLL_wcsftime( wchar_t *s, size_t maxsize,
|
---|
786 | const wchar_t *format, const struct tm *timeptr )
|
---|
787 | {
|
---|
788 | dprintf(("CRTDLL: wcsftime\n"));
|
---|
789 |
|
---|
790 | return (wcsftime(s, maxsize, format, timeptr));
|
---|
791 | }
|
---|
792 |
|
---|
793 | /*********************************************************************
|
---|
794 | * wcstod (CRTDLL.515)
|
---|
795 | */
|
---|
796 | double CDECL CRTDLL_wcstod( const wchar_t *nptr, wchar_t **endptr )
|
---|
797 | {
|
---|
798 | dprintf(("CRTDLL: wcstod\n"));
|
---|
799 | return (wcstod(nptr, endptr));
|
---|
800 | }
|
---|
801 |
|
---|
802 | /*********************************************************************
|
---|
803 | * wcstok (CRTDLL.516)
|
---|
804 | */
|
---|
805 | wchar_t *CRTDLL_wcstok( wchar_t *s1, const wchar_t *s2, wchar_t **ptr )
|
---|
806 | {
|
---|
807 | dprintf(("CRTDLL: wcstod\n"));
|
---|
808 | return (wcstok(s1, s2, ptr));
|
---|
809 | }
|
---|
810 | /*********************************************************************
|
---|
811 | * wcstol (CRTDLL.517)
|
---|
812 | */
|
---|
813 | long int CDECL CRTDLL_wcstol( const wchar_t *s1, wchar_t **s2, int i )
|
---|
814 | {
|
---|
815 | dprintf(("CRTDLL: wcstol\n"));
|
---|
816 |
|
---|
817 | return (wcstol(s1, s2, i));
|
---|
818 | }
|
---|
819 |
|
---|
820 | /*********************************************************************
|
---|
821 | * wcstombs (CRTDLL.518)
|
---|
822 | */
|
---|
823 | size_t CDECL CRTDLL_wcstombs( char *s, const wchar_t *pwcs, size_t n )
|
---|
824 | {
|
---|
825 | dprintf(("CRTDLL: wcstombs\n"));
|
---|
826 |
|
---|
827 | return (wcstombs(s, pwcs, n));
|
---|
828 | }
|
---|
829 |
|
---|
830 | /*********************************************************************
|
---|
831 | * wcstoul (CRTDLL.519)
|
---|
832 | */
|
---|
833 | unsigned long int CDECL CRTDLL_wcstoul( const wchar_t *s1, wchar_t **s2, int i )
|
---|
834 | {
|
---|
835 | dprintf(("CRTDLL: wcstoul\n"));
|
---|
836 |
|
---|
837 | return (wcstoul(s1, s2, i));
|
---|
838 | }
|
---|
839 |
|
---|
840 | /*********************************************************************
|
---|
841 | * wcsxfrm (CRTDLL.520)
|
---|
842 | */
|
---|
843 | size_t CDECL CRTDLL_wcsxfrm( wchar_t *s1, const wchar_t *s2, size_t n )
|
---|
844 | {
|
---|
845 | dprintf(("CRTDLL: wcsxfrm\n"));
|
---|
846 |
|
---|
847 | return (wcsxfrm(s1, s2, n));
|
---|
848 | }
|
---|
849 |
|
---|
850 | /*********************************************************************
|
---|
851 | * wcstomb (CRTDLL.521)
|
---|
852 | */
|
---|
853 | int CDECL CRTDLL_wctomb( char *s, wchar_t wchar )
|
---|
854 | {
|
---|
855 | dprintf(("CRTDLL: wctomb\n"));
|
---|
856 |
|
---|
857 | return (wctomb(s,wchar));
|
---|
858 | }
|
---|
859 |
|
---|
860 | /*********************************************************************
|
---|
861 | * fwprintf (CRTDLL.522)
|
---|
862 | */
|
---|
863 | int CDECL CRTDLL_fwprintf( const wchar_t *s, ... )
|
---|
864 | {
|
---|
865 | dprintf(("CRTDLL: fwprintf\n"));
|
---|
866 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
867 | return FALSE;
|
---|
868 | }
|
---|
869 |
|
---|
870 | /*********************************************************************
|
---|
871 | * wscanf (CRTDLL.523)
|
---|
872 | */
|
---|
873 | int CDECL CRTDLL_wscanf( const wchar_t *s, ... )
|
---|
874 | {
|
---|
875 | dprintf(("CRTDLL: wscanf\n"));
|
---|
876 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
---|
877 | return FALSE;
|
---|
878 | }
|
---|
879 |
|
---|
880 |
|
---|
881 | INT WINAPI lstrncmpiA( LPCSTR str1, LPCSTR str2, INT n )
|
---|
882 | {
|
---|
883 | dprintf(("CRTDLL: lstrncmpiA\n"));
|
---|
884 | //CB: implement!
|
---|
885 | return 0;
|
---|
886 | }
|
---|