build msvcrt and crtdll from same source via lib\crt fix problem with scanf/printf reading/printing doubles Added: trunk/reactos/lib/crt/ Added: trunk/reactos/lib/crt/README.txt Added: trunk/reactos/lib/crt/conio/ Added: trunk/reactos/lib/crt/ctype/ Added: trunk/reactos/lib/crt/direct/ Added: trunk/reactos/lib/crt/except/ Added: trunk/reactos/lib/crt/float/ Added: trunk/reactos/lib/crt/io/ Modified: trunk/reactos/lib/crt/io/fmode.c Modified: trunk/reactos/lib/crt/io/open.c Modified: trunk/reactos/lib/crt/io/read.c Added: trunk/reactos/lib/crt/locale/ Modified: trunk/reactos/lib/crt/locale/locale.c Added: trunk/reactos/lib/crt/makefile Added: trunk/reactos/lib/crt/math/ Added: trunk/reactos/lib/crt/mbstring/ Added: trunk/reactos/lib/crt/misc/ Deleted: trunk/reactos/lib/crt/misc/dllmain.c Modified: trunk/reactos/lib/crt/misc/environ.c Modified: trunk/reactos/lib/crt/misc/getargs.c Added: trunk/reactos/lib/crt/precomp.h Added: trunk/reactos/lib/crt/process/ Modified: trunk/reactos/lib/crt/process/_system.c Added: trunk/reactos/lib/crt/search/ Added: trunk/reactos/lib/crt/setjmp/ Added: trunk/reactos/lib/crt/signal/ Added: trunk/reactos/lib/crt/signal/xcptinfo.c Added: trunk/reactos/lib/crt/stdio/ Modified: trunk/reactos/lib/crt/stdio/fopen.c Modified: trunk/reactos/lib/crt/stdio/freopen.c Modified: trunk/reactos/lib/crt/stdio/fsopen.c Modified: trunk/reactos/lib/crt/stdio/popen.c Modified: trunk/reactos/lib/crt/stdio/vfprintf.c Modified: trunk/reactos/lib/crt/stdio/vfscanf.c Modified: trunk/reactos/lib/crt/stdio/vfwprint.c Added: trunk/reactos/lib/crt/stdlib/ Modified: trunk/reactos/lib/crt/stdlib/getenv.c Added: trunk/reactos/lib/crt/string/ Added: trunk/reactos/lib/crt/sys_stat/ Added: trunk/reactos/lib/crt/sys_stat/systime.c Added: trunk/reactos/lib/crt/time/ Added: trunk/reactos/lib/crt/wine/ Modified: trunk/reactos/lib/crt/wine/cpp.c Modified: trunk/reactos/lib/crt/wine/cppexcept.c Deleted: trunk/reactos/lib/crt/wine/cppexcept.h Deleted: trunk/reactos/lib/crt/wine/eh.h Modified: trunk/reactos/lib/crt/wine/heap.c Deleted: trunk/reactos/lib/crt/wine/msvcrt.h Modified: trunk/reactos/lib/crt/wine/thread.c Added: trunk/reactos/lib/crt/wstring/ _____
Copied: trunk/reactos/lib/crt/README.txt (from rev 13314, trunk/reactos/lib/msvcrt/README.txt) _____
Copied: trunk/reactos/lib/crt/conio (from rev 13291, trunk/reactos/lib/msvcrt/conio) _____
Copied: trunk/reactos/lib/crt/ctype (from rev 13290, trunk/reactos/lib/msvcrt/ctype) _____
Copied: trunk/reactos/lib/crt/direct (from rev 13290, trunk/reactos/lib/msvcrt/direct) _____
Copied: trunk/reactos/lib/crt/except (from rev 13290, trunk/reactos/lib/msvcrt/except) _____
Copied: trunk/reactos/lib/crt/float (from rev 13290, trunk/reactos/lib/msvcrt/float) _____
Copied: trunk/reactos/lib/crt/io (from rev 13290, trunk/reactos/lib/msvcrt/io) _____
Modified: trunk/reactos/lib/crt/io/fmode.c --- trunk/reactos/lib/msvcrt/io/fmode.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/io/fmode.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -2,13 +2,13 @@
#include <msvcrt/fcntl.h> #include <msvcrt/io.h>
-#undef _fmode -unsigned int _fmode = O_TEXT;
+int __fmode = O_TEXT; + /* * @implemented */ -unsigned int *__p__fmode(void) +int *__p__fmode(void) { - return &_fmode; + return &__fmode; } _____
Modified: trunk/reactos/lib/crt/io/open.c --- trunk/reactos/lib/msvcrt/io/open.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/io/open.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -21,10 +21,10 @@
#include <msvcrt/fcntl.h> #include <msvcrt/sys/stat.h> #include <msvcrt/stdlib.h> -#include <msvcrt/internal/file.h> #include <msvcrt/string.h> #include <msvcrt/share.h> #include <msvcrt/errno.h> +#include <msvcrt/internal/file.h>
#define NDEBUG #include <msvcrt/msvcrtdbg.h> @@ -192,7 +192,7 @@ } DPRINT("OK\n"); if (!(_oflag & (_O_TEXT|_O_BINARY))) { - _oflag |= _fmode; + _oflag |= __fmode; } return __fileno_alloc(hFile,_oflag); } _____
Modified: trunk/reactos/lib/crt/io/read.c --- trunk/reactos/lib/msvcrt/io/read.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/io/read.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -12,7 +12,7 @@
* behavior for line-buffered streams (KJK::Hyperion) */
-#include "precomp.h" +#include <windows.h> #include <msvcrt/io.h> #include <msvcrt/internal/file.h>
_____
Copied: trunk/reactos/lib/crt/locale (from rev 13290, trunk/reactos/lib/msvcrt/locale) _____
Modified: trunk/reactos/lib/crt/locale/locale.c --- trunk/reactos/lib/msvcrt/locale/locale.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/locale/locale.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -1,3 +1,9 @@
+/* + * Some stuff takem from wine msvcrt\locale.c + * + * Copyright 2000 Jon Griffiths + */ + #include "precomp.h" #include <msvcrt/stdio.h> #include <msvcrt/locale.h> @@ -201,3 +207,74 @@ DPRINT1("__lc_codepage - stub\n"); return; } + + +/********************************************************************* + * _Gettnames (MSVCRT.@) + */ +void *_Gettnames(void) +{ + DPRINT1("(void), stub!\n"); + return NULL; +} + +/********************************************************************* + * __lconv_init (MSVCRT.@) + */ +void __lconv_init(void) +{ + DPRINT1(" stub\n"); +} + + +/********************************************************************* + * _Strftime (MSVCRT.@) + */ +const char* _Strftime(char *out, unsigned int len, const char *fmt, + const void *tm, void *foo) +{ + /* FIXME: */ + DPRINT1("(%p %d %s %p %p) stub\n", out, len, fmt, tm, foo); + return ""; +} + + +/********************************************************************* + * _Getdays (MSVCRT.@) + */ +const char* _Getdays(void) +{ + static const char *MSVCRT_days = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:" + "Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday"; + /* FIXME: Use locale */ + DPRINT1("(void) semi-stub\n"); + return MSVCRT_days; +} + +/********************************************************************* + * _Getmonths (MSVCRT.@) + */ +const char* _Getmonths(void) +{ + static const char *MSVCRT_months = ":Jan:January:Feb:February:Mar:March:Apr:" + "April:May:May:Jun:June:Jul:July:Aug:August:Sep:September:Oct:" + "October:Nov:November:Dec:December"; + /* FIXME: Use locale */ + DPRINT1("(void) semi-stub\n"); + return MSVCRT_months; +} + +/********************************************************************* + * __crtLCMapStringA (MSVCRT.@) + */ +int __crtLCMapStringA( + LCID lcid, DWORD mapflags, const char* src, int srclen, char* dst, + int dstlen, unsigned int codepage, int xflag +) { + DPRINT1("(lcid %lx, flags %lx, %s(%d), %p(%d), %x, %d), partial stub!\n", + lcid,mapflags,src,srclen,dst,dstlen,codepage,xflag); + /* FIXME: A bit incorrect. But msvcrt itself just converts its + * arguments to wide strings and then calls LCMapStringW + */ + return LCMapStringA(lcid,mapflags,src,srclen,dst,dstlen); +} _____
Added: trunk/reactos/lib/crt/makefile --- trunk/reactos/lib/crt/makefile 2005-01-27 21:17:28 UTC (rev 13341) +++ trunk/reactos/lib/crt/makefile 2005-01-27 21:18:04 UTC (rev 13342) @@ -0,0 +1,475 @@
+# $Id: Makefile 12852 2005-01-06 13:58:04Z mf $ + +PATH_TO_TOP = ../.. + +TARGET_DEFONLY = yes + +TARGET_TYPE = library + +TARGET_NAME = crt + +TARGET_PCH = precomp.h + +TARGET_CFLAGS = -D_MSVCRT_LIB_ -Wall -Werror + +# require os code to explicitly request A/W version of structs/functions +TARGET_CFLAGS += \ + -D_DISABLE_TIDENTS \ + -D__USE_W32API \ + -D__REACTOS__ \ + -D_WIN32_IE=0x600 \ + -D_WIN32_WINNT=0x501 \ + -DUSE_MSVCRT_PREFIX \ + -D_MT + +CONIO_OBJECTS = \ + conio/cgets.o \ + conio/cprintf.o \ + conio/cputs.o \ + conio/cscanf.o \ + conio/getch.o \ + conio/getche.o \ + conio/kbhit.o \ + conio/putch.o \ + conio/ungetch.o + +CTYPE_OBJECTS = \ + ctype/ctype.o \ + ctype/isalnum.o \ + ctype/isalpha.o \ + ctype/isascii.o \ + ctype/iscntrl.o \ + ctype/isdigit.o \ + ctype/isgraph.o \ + ctype/islower.o \ + ctype/isprint.o \ + ctype/ispunct.o \ + ctype/isspace.o \ + ctype/isupper.o \ + ctype/isxdigit.o \ + ctype/toascii.o \ + ctype/tolower.o \ + ctype/toupper.o \ + ctype/iscsym.o \ + ctype/isctype.o + +DIRECT_OBJECTS = \ + direct/chdir.o \ + direct/chdrive.o \ + direct/getcwd.o \ + direct/getdcwd.o \ + direct/getdfree.o \ + direct/getdrive.o \ + direct/mkdir.o \ + direct/rmdir.o \ + direct/wchdir.o \ + direct/wgetcwd.o \ + direct/wgetdcwd.o \ + direct/wmkdir.o \ + direct/wrmdir.o + +EXCEPT_OBJECTS = \ + except/seh.o \ + except/abnorter.o \ + except/exhand2.o \ + except/matherr.o \ + except/unwind.o \ + except/xcptfil.o + +FLOAT_OBJECTS = \ + float/chgsign.o \ + float/clearfp.o \ + float/cntrlfp.o \ + float/copysign.o \ + float/fpclass.o \ + float/fpecode.o \ + float/fpreset.o \ + float/isnan.o \ + float/logb.o \ + float/nafter.o \ + float/scalb.o \ + float/statfp.o + +IO_OBJECTS = \ + io/access.o \ + io/chmod.o \ + io/chsize.o \ + io/close.o \ + io/commit.o \ + io/create.o \ + io/dup.o \ + io/dup2.o \ + io/eof.o \ + io/filelen.o \ + io/fileleni.o \ + io/find.o \ + io/fmode.o \ + io/isatty.o \ + io/locking.o \ + io/lseek.o \ + io/lseeki64.o \ + io/mktemp.o \ + io/open.o \ + io/pipe.o \ + io/read.o \ + io/setmode.o \ + io/sopen.o \ + io/stubs.o \ + io/tell.o \ + io/telli64.o \ + io/umask.o \ + io/unlink.o \ + io/utime.o \ + io/waccess.o \ + io/wchmod.o \ + io/wcreate.o \ + io/wfind.o \ + io/wmktemp.o \ + io/wopen.o \ + io/write.o \ + io/wunlink.o \ + io/wutime.o + +LOCALE_OBJECTS = \ + locale/locale.o + +MATH_OBJECTS = \ + math/acos.o \ + math/adjust.o \ + math/asin.o \ + math/atan.o \ + math/atan2.o \ + math/cabs.o \ + math/ceil.o \ + math/cos.o \ + math/cosh.o \ + math/exp.o \ + math/fabs.o \ + math/floor.o \ + math/fmod.o \ + math/frexp.o \ + math/huge_val.o \ + math/hypot.o \ + math/j0_y0.o \ + math/j1_y1.o \ + math/jn_yn.o \ + math/ldexp.o \ + math/log.o \ + math/log10.o \ + math/modf.o \ + math/pow.o \ + math/sin.o \ + math/sinh.o \ + math/sqrt.o \ + math/stubs.o \ + math/tan.o \ + math/tanh.o + +MBSTRING_OBJECTS = \ + mbstring/hanzen.o \ + mbstring/ischira.o \ + mbstring/iskana.o \ + mbstring/iskpun.o \ + mbstring/islead.o \ + mbstring/islwr.o \ + mbstring/ismbal.o \ + mbstring/ismbaln.o \ + mbstring/ismbc.o \ + mbstring/ismbgra.o \ + mbstring/ismbkaln.o \ + mbstring/ismblead.o \ + mbstring/ismbpri.o \ + mbstring/ismbpun.o \ + mbstring/ismbtrl.o \ + mbstring/isuppr.o \ + mbstring/jistojms.o \ + mbstring/jmstojis.o \ + mbstring/mbbtype.o \ + mbstring/mbccpy.o \ + mbstring/mbclen.o \ + mbstring/mbscat.o \ + mbstring/mbschr.o \ + mbstring/mbscmp.o \ + mbstring/mbscoll.o \ + mbstring/mbscpy.o \ + mbstring/mbscspn.o \ + mbstring/mbsdec.o \ + mbstring/mbsdup.o \ + mbstring/mbsicmp.o \ + mbstring/mbsicoll.o \ + mbstring/mbsinc.o \ + mbstring/mbslen.o \ + mbstring/mbslwr.o \ + mbstring/mbsncat.o \ + mbstring/mbsnccnt.o \ + mbstring/mbsncmp.o \ + mbstring/mbsncoll.o \ + mbstring/mbsncpy.o \ + mbstring/mbsnextc.o \ + mbstring/mbsnicmp.o \ + mbstring/mbsnicoll.o \ + mbstring/mbsninc.o \ + mbstring/mbsnset.o \ + mbstring/mbspbrk.o \ + mbstring/mbsrchr.o \ + mbstring/mbsrev.o \ + mbstring/mbsset.o \ + mbstring/mbsspn.o \ + mbstring/mbsspnp.o \ + mbstring/mbsstr.o \ + mbstring/mbstok.o \ + mbstring/mbstrlen.o \ + mbstring/mbsupr.o + +MISC_OBJECTS = \ + misc/amsg.o \ + misc/assert.o \ + misc/crtmain.o \ + misc/environ.o \ + misc/getargs.o \ + misc/initterm.o \ + misc/lock.o \ + misc/purecall.o \ + misc/stubs.o \ + misc/tls.o + +PROCESS_OBJECTS = \ + process/_cwait.o \ + process/_system.o \ + process/dll.o \ + process/process.o \ + process/procid.o \ + process/thread.o \ + process/threadid.o \ + process/threadx.o + +SEARCH_OBJECTS = \ + search/lfind.o \ + search/lsearch.o + +SETJMP_OBJECTS = \ + setjmp/i386/setjmp.o + +SIGNAL_OBJECTS = \ + signal/signal.o \ + signal/xcptinfo.o + +STDIO_OBJECTS = \ + stdio/allocfil.o \ + stdio/clearerr.o \ + stdio/fclose.o \ + stdio/fdopen.o \ + stdio/feof.o \ + stdio/ferror.o \ + stdio/fflush.o \ + stdio/fgetc.o \ + stdio/fgetchar.o \ + stdio/fgetpos.o \ + stdio/fgets.o \ + stdio/fgetws.o \ + stdio/filbuf.o \ + stdio/fileno.o \ + stdio/flsbuf.o \ + stdio/fopen.o \ + stdio/fprintf.o \ + stdio/fputc.o \ + stdio/fputchar.o \ + stdio/fputs.o \ + stdio/fread.o \ + stdio/freopen.o \ + stdio/fscanf.o \ + stdio/fseek.o \ + stdio/fsetpos.o \ + stdio/fsopen.o \ + stdio/ftell.o \ + stdio/fwalk.o \ + stdio/fwrite.o \ + stdio/getc.o \ + stdio/getchar.o \ + stdio/gets.o \ + stdio/getw.o \ + stdio/perror.o \ + stdio/popen.o \ + stdio/printf.o \ + stdio/putc.o \ + stdio/putchar.o \ + stdio/puts.o \ + stdio/putw.o \ + stdio/remove.o \ + stdio/rename.o \ + stdio/rewind.o \ + stdio/rmtmp.o \ + stdio/scanf.o \ + stdio/setbuf.o \ + stdio/setvbuf.o \ + stdio/sprintf.o \ + stdio/sscanf.o \ + stdio/stdhnd.o \ + stdio/tempnam.o \ + stdio/tmpfile.o \ + stdio/tmpnam.o \ + stdio/ungetc.o \ + stdio/vfprintf.o \ + stdio/vfscanf.o \ + stdio/vfwprint.o \ + stdio/vprintf.o \ + stdio/vscanf.o \ + stdio/vsprintf.o \ + stdio/vsscanf.o \ + stdio/wfdopen.o \ + stdio/wrename.o \ + stdio/wtempnam.o \ + stdio/wtmpnam.o + +STDLIB_OBJECTS = \ + stdlib/_exit.o \ + stdlib/abort.o \ + stdlib/abs.o \ + stdlib/atexit.o \ + stdlib/atof.o \ + stdlib/atoi.o \ + stdlib/atoi64.o \ + stdlib/atol.o \ + stdlib/bsearch.o \ + stdlib/div.o \ + stdlib/ecvt.o \ + stdlib/ecvtbuf.o \ + stdlib/errno.o \ + stdlib/fcvt.o \ + stdlib/fcvtbuf.o \ + stdlib/fullpath.o \ + stdlib/gcvt.o \ + stdlib/getenv.o \ + stdlib/itoa.o \ + stdlib/itow.o \ + stdlib/labs.o \ + stdlib/ldiv.o \ + stdlib/makepath.o \ + stdlib/malloc.o \ + stdlib/mbstowcs.o \ + stdlib/mbtowc.o \ + stdlib/obsol.o \ + stdlib/putenv.o \ + stdlib/qsort.o \ + stdlib/rand.o \ + stdlib/rot.o \ + stdlib/senv.o \ + stdlib/splitp.o \ + stdlib/strtod.o \ + stdlib/strtol.o \ + stdlib/strtoul.o \ + stdlib/swab.o \ + stdlib/wcstod.o \ + stdlib/wcstol.o \ + stdlib/wcstombs.o \ + stdlib/wcstoul.o \ + stdlib/wctomb.o \ + stdlib/wfulpath.o \ + stdlib/witoa.o \ + stdlib/witow.o \ + stdlib/wputenv.o \ + stdlib/wsenv.o \ + stdlib/wsplitp.o \ + stdlib/wmakpath.o \ + stdlib/wtoi.o \ + stdlib/wtoi64.o + +STRING_OBJECTS = \ + string/lasttok.o \ + string/memicmp.o \ + string/strcoll.o \ + string/strdup.o \ + string/strerror.o \ + string/stricmp.o \ + string/strlwr.o \ + string/strncoll.o \ + string/strnicmp.o \ + string/strpbrk.o \ + string/strrev.o\ + string/strset.o \ + string/strstr.o \ + string/strtok.o \ + string/strupr.o \ + string/strxfrm.o + +SYS_STAT_OBJECTS = \ + sys_stat/fstat.o \ + sys_stat/fstati64.o \ + sys_stat/futime.o \ + sys_stat/stat.o \ + sys_stat/wstat.o \ + sys_stat/systime.o + +TIME_OBJECTS = \ + time/clock.o \ + time/ctime.o \ + time/difftime.o \ + time/ftime.o \ + time/strdate.o \ + time/strftime.o \ + time/strtime.o \ + time/time.o \ + time/tz_vars.o \ + time/wctime.o \ + time/wstrdate.o \ + time/wstrtime.o + + + +WSTRING_OBJECTS = \ + wstring/wcscoll.o \ + wstring/wcscspn.o \ + wstring/wcsdup.o \ + wstring/wcsicmp.o \ + wstring/wcslwr.o \ + wstring/wcsnicmp.o \ + wstring/wcspbrk.o \ + wstring/wcsrev.o \ + wstring/wcsset.o \ + wstring/wcsspn.o \ + wstring/wcsstr.o \ + wstring/wcstok.o \ + wstring/wcsupr.o \ + wstring/wcsxfrm.o \ + wstring/wlasttok.o + +WINE_OBJECTS = \ + wine/cpp.o \ + wine/cppexcept.o \ + wine/heap.o \ + wine/thread.o + +TARGET_OBJECTS = \ + $(CONIO_OBJECTS) \ + $(CTYPE_OBJECTS) \ + $(DIRECT_OBJECTS) \ + $(EXCEPT_OBJECTS) \ + $(FLOAT_OBJECTS) \ + $(IO_OBJECTS) \ + $(LOCALE_OBJECTS) \ + $(MATH_OBJECTS) \ + $(MBSTRING_OBJECTS) \ + $(MISC_OBJECTS) \ + $(PROCESS_OBJECTS) \ + $(SEARCH_OBJECTS) \ + $(SETJMP_OBJECTS) \ + $(SIGNAL_OBJECTS) \ + $(STDIO_OBJECTS) \ + $(STDLIB_OBJECTS) \ + $(STRING_OBJECTS) \ + $(SYS_STAT_OBJECTS) \ + $(TIME_OBJECTS) \ + $(WSTRING_OBJECTS) \ + $(WINE_OBJECTS) + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +DEP_OBJECTS := $(TARGET_OBJECTS) + +TARGET_CLEAN = $(DEP_FILES) + +include $(PATH_TO_TOP)/tools/depend.mk + +# EOF _____
Copied: trunk/reactos/lib/crt/math (from rev 13290, trunk/reactos/lib/msvcrt/math) _____
Copied: trunk/reactos/lib/crt/mbstring (from rev 13290, trunk/reactos/lib/msvcrt/mbstring) _____
Copied: trunk/reactos/lib/crt/misc (from rev 13290, trunk/reactos/lib/msvcrt/misc) _____
Deleted: trunk/reactos/lib/crt/misc/dllmain.c --- trunk/reactos/lib/msvcrt/misc/dllmain.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/misc/dllmain.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -1,140 +0,0 @@
-/* $Id$ - * - * dllmain.c - * - * ReactOS MSVCRT.DLL Compatibility Library - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warrenties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * $Revision: 1.24 $ - * $Author$ - * $Date$ - * - */ - -#include "precomp.h" -#include <msvcrt/internal/tls.h> -#include <msvcrt/stdlib.h> -#include "../wine/msvcrt.h" - -#define NDEBUG -#include <msvcrt/msvcrtdbg.h> - - -/* EXTERNAL PROTOTYPES ********************************************************/ - -//void __fileno_init(void); -extern BOOL __fileno_init(void); -extern int BlockEnvToEnvironA(void); -extern int BlockEnvToEnvironW(void); -extern void FreeEnvironment(char **environment); - -extern unsigned int _osver; -extern unsigned int _winminor; -extern unsigned int _winmajor; -extern unsigned int _winver; - -extern char* _acmdln; /* pointer to ascii command line */ -extern wchar_t* _wcmdln; /* pointer to wide character command line */ -#undef _environ -extern char** _environ; /* pointer to environment block */ -extern char** __initenv; /* pointer to initial environment block */ -extern wchar_t** _wenviron; /* pointer to environment block */ -extern wchar_t** __winitenv; /* pointer to initial environment block */ - - -/* LIBRARY GLOBAL VARIABLES ***************************************************/ - -HANDLE hHeap = NULL; /* handle for heap */ - - -/* LIBRARY ENTRY POINT ********************************************************/ - -BOOL -STDCALL -DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved) -{ - switch (dwReason) - { - case DLL_PROCESS_ATTACH://1 - /* initialize version info */ - DPRINT("Attach %d\n", nAttachCount); - _osver = GetVersion(); - _winmajor = (_osver >> 8) & 0xFF; - _winminor = _osver & 0xFF; - _winver = (_winmajor << 8) + _winminor; - _osver = (_osver >> 16) & 0xFFFF; - hHeap = HeapCreate(0, 100000, 0); - if (hHeap == NULL) - return FALSE; - if (!__fileno_init()) - return FALSE; - - /* create tls stuff */ - if (!CreateThreadData()) - return FALSE; - - if (BlockEnvToEnvironA() < 0) - return FALSE; - - if (BlockEnvToEnvironW() < 0) - { - FreeEnvironment((char**)_wenviron); - return FALSE; - } - - _acmdln = strdup(GetCommandLineA()); - _wcmdln = wcsdup(GetCommandLineW()); - - /* FIXME: more initializations... */ - - /* FIXME: Initialization of the WINE code */ - msvcrt_init_mt_locks(); - - DPRINT("Attach done\n"); - break; - - case DLL_THREAD_ATTACH://2 - break; - - case DLL_THREAD_DETACH://4 - FreeThreadData(NULL); - break; - - case DLL_PROCESS_DETACH://0 - DPRINT("Detach %d\n", nAttachCount); - /* FIXME: more cleanup... */ - _fcloseall(); - - /* destroy tls stuff */ - DestroyThreadData(); - - if (__winitenv && __winitenv != _wenviron) - FreeEnvironment((char**)__winitenv); - if (_wenviron) - FreeEnvironment((char**)_wenviron); - - if (__initenv && __initenv != _environ) - FreeEnvironment(__initenv); - if (_environ) - FreeEnvironment(_environ); - - /* destroy heap */ - HeapDestroy(hHeap); - - DPRINT("Detach done\n"); - break; - } - - return TRUE; -} - -/* EOF */ _____
Modified: trunk/reactos/lib/crt/misc/environ.c --- trunk/reactos/lib/msvcrt/misc/environ.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/misc/environ.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -9,7 +9,7 @@
#include <msvcrt/internal/tls.h> #include <msvcrt/stdlib.h> #include <msvcrt/string.h> - + #define NDEBUG #include <msvcrt/msvcrtdbg.h>
@@ -18,6 +18,7 @@ unsigned int _winminor = 0; unsigned int _winmajor = 0; unsigned int _winver = 0; +
char *_acmdln = NULL; /* pointer to ascii command line */ wchar_t *_wcmdln = NULL; /* pointer to wide character command line */ @@ -165,9 +166,9 @@ for (envptr = original_environment; count > 1; newenvptr++, count--) { if (wide) - *newenvptr = (char*)wcsdup((wchar_t*)*envptr++); + *newenvptr = (char*)_wcsdup((wchar_t*)*envptr++); else - *newenvptr = strdup(*envptr++); + *newenvptr = _strdup(*envptr++); if (*newenvptr == NULL) { for (newenvptr--; newenvptr >= newenv; newenvptr--); @@ -243,7 +244,7 @@ /* Find the option we're trying to modify. */ for (index = 0, wenvptr = _wenviron; *wenvptr != NULL; wenvptr++, index++) { - if (!wcsnicmp(*wenvptr, option, epos - option)) + if (!_wcsnicmp(*wenvptr, option, epos - option)) { found = 1; break; @@ -277,7 +278,7 @@ else { /* Make a copy of the option that we will store in the environment block. */ - woption = wcsdup((wchar_t*)option); + woption = _wcsdup((wchar_t*)option); if (woption == NULL) { free(name); _____
Modified: trunk/reactos/lib/crt/misc/getargs.c --- trunk/reactos/lib/msvcrt/misc/getargs.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/misc/getargs.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -68,7 +68,7 @@
do { if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { strcpy(&buffer[pos], fd.cFileName); - if (add(strdup(buffer)) < 0) { + if (add(_strdup(buffer)) < 0) { FindClose(hFile); return -1; } @@ -136,7 +136,7 @@ *argc = __argc; *argv = __argv; *env = _environ; - _pgmptr = strdup((char*)argv[0]); + _pgmptr = _strdup((char*)argv[0]); return 0; }
_____
Added: trunk/reactos/lib/crt/precomp.h --- trunk/reactos/lib/crt/precomp.h 2005-01-27 21:17:28 UTC (rev 13341) +++ trunk/reactos/lib/crt/precomp.h 2005-01-27 21:18:04 UTC (rev 13342) @@ -0,0 +1 @@
+#include <windows.h> _____
Copied: trunk/reactos/lib/crt/process (from rev 13290, trunk/reactos/lib/msvcrt/process) _____
Modified: trunk/reactos/lib/crt/process/_system.c --- trunk/reactos/lib/msvcrt/process/_system.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/process/_system.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -47,7 +47,7 @@
if (szComSpec == NULL) { - szComSpec = strdup("cmd.exe"); + szComSpec = _strdup("cmd.exe"); if (szComSpec == NULL) { __set_errno(ENOMEM); _____
Copied: trunk/reactos/lib/crt/search (from rev 13290, trunk/reactos/lib/msvcrt/search) _____
Copied: trunk/reactos/lib/crt/setjmp (from rev 13290, trunk/reactos/lib/msvcrt/setjmp) _____
Copied: trunk/reactos/lib/crt/signal (from rev 13290, trunk/reactos/lib/msvcrt/signal) _____
Added: trunk/reactos/lib/crt/signal/xcptinfo.c --- trunk/reactos/lib/msvcrt/signal/xcptinfo.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/signal/xcptinfo.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -0,0 +1,9 @@
+#include <msvcrt/stdlib.h> + +/* + * @unimplemented + */ +void **__pxcptinfoptrs (void) +{ + return NULL; +} _____
Copied: trunk/reactos/lib/crt/stdio (from rev 13290, trunk/reactos/lib/msvcrt/stdio) _____
Modified: trunk/reactos/lib/crt/stdio/fopen.c --- trunk/reactos/lib/msvcrt/stdio/fopen.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/stdio/fopen.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -30,18 +30,13 @@
#include <msvcrt/string.h> #include <msvcrt/io.h> #include <msvcrt/fcntl.h> -//#include <msvcrt/internal/file.h> +#include <msvcrt/internal/file.h>
//might change fopen(file,mode) -> fsopen(file,mode,_SH_DENYNO);
-#undef _fmode -extern unsigned int _fmode; - FILE* __alloc_file(void);
-//extern int _fmode;
- FILE* fopen(const char *file, const char *mode) { FILE *f; @@ -68,7 +63,7 @@ else if (strchr(mode, 'b')) oflags |= O_BINARY; else - oflags |= (_fmode & (O_TEXT|O_BINARY)); + oflags |= (__fmode & (O_TEXT|O_BINARY));
fd = _open(file, oflags, 0); if (fd < 0) @@ -94,7 +89,7 @@ f->_flag |= _IOTEXT; else if (strchr(mode, 'b')) f->_flag |= _IOBINARY; - else if (_fmode & O_BINARY) + else if (__fmode & O_BINARY) f->_flag |= _IOBINARY;
f->_base = f->_ptr = NULL; @@ -130,7 +125,7 @@ else if (wcschr(mode, L'b')) oflags |= O_BINARY; else - oflags |= (_fmode & (O_TEXT|O_BINARY)); + oflags |= (__fmode & (O_TEXT|O_BINARY));
fd = _wopen(file, oflags, 0); if (fd < 0) @@ -155,7 +150,7 @@ f->_flag |= _IOTEXT; else if (wcschr(mode, L'b')) f->_flag |= _IOBINARY; - else if (_fmode & O_BINARY) + else if (__fmode & O_BINARY) f->_flag |= _IOBINARY;
f->_base = f->_ptr = NULL; _____
Modified: trunk/reactos/lib/crt/stdio/freopen.c --- trunk/reactos/lib/msvcrt/stdio/freopen.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/stdio/freopen.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -44,7 +44,7 @@
else if (tbchar == 'b') oflags |= O_BINARY; else - oflags |= (_fmode & (O_TEXT|O_BINARY)); + oflags |= (__fmode & (O_TEXT|O_BINARY));
fd = _open(file, oflags, 0666); if (fd < 0) @@ -104,7 +104,7 @@ else if (tbchar == L'b') oflags |= O_BINARY; else - oflags |= (_fmode & (O_TEXT|O_BINARY)); + oflags |= (__fmode & (O_TEXT|O_BINARY));
fd = _wopen(file, oflags, 0666); if (fd < 0) _____
Modified: trunk/reactos/lib/crt/stdio/fsopen.c --- trunk/reactos/lib/msvcrt/stdio/fsopen.c 2005-01-25 22:58:47 UTC (rev 13290) +++ trunk/reactos/lib/crt/stdio/fsopen.c 2005-01-27 21:18:04 UTC (rev 13342) @@ -65,7 +65,7 @@
else if (tbchar == 'b') oflags |= O_BINARY; else - oflags |= (_fmode & (O_TEXT|O_BINARY)); + oflags |= (__fmode & (O_TEXT|O_BINARY));
if ( shflag == _SH_DENYNO ) shf = _S_IREAD | _S_IWRITE; @@ -146,7 +146,7 @@ else if (tbchar == L'b') oflags |= O_BINARY; else - oflags |= (_fmode & (O_TEXT|O_BINARY)); + oflags |= (__fmode & (O_TEXT|O_BINARY));
if ( shflag == _SH_DENYNO ) shf = _S_IREAD | _S_IWRITE; [truncated at 1000 lines; 3380 more skipped]