KJK::Hyperion is proud to present "dllimport purity", another landmark commit that...
authorKJK::Hyperion <hackbunny@reactos.org>
Tue, 4 Nov 2008 18:16:58 +0000 (18:16 +0000)
committerKJK::Hyperion <hackbunny@reactos.org>
Tue, 4 Nov 2008 18:16:58 +0000 (18:16 +0000)
Disclaimer: in an uncharacteristic and daring move, I actually built, installed and booted this revision

modified   tools/rbuild/backend/mingw/mingw.cpp
modified   tools/rbuild/backend/mingw/modulehandler.cpp
modified   tools/rbuild/module.cpp
modified   tools/rbuild/project.dtd
modified   tools/rbuild/rbuild.h
modified   include/crt/_mingw.h
   New module attribute iscrt for marking modules that implement a C runtime library
   New module attribute crt for compiling and linking modules to a specific C runtime library. Can be "ntdll" (for ntdll.dll) "msvcrt" (msvcrt.dll), "crt" (statically-linked runtime), "libcntpr" (libcntpr.lib), "dll" (one of the <library> entries specifies a CRT DLL) or "static". Defaults to "msvcrt" for Win32 modules, to "static" for CRT modules themselves, and to "dll" for drivers
   Define _DLL for code that compiles against a dynamically-linked CRT
   Define __MINGW_IMPORT and _CRTIMP according to whether _DLL is defined. We finally use __declspec(dllimport) somewhere, anywhere (SDK headers still don't use it)
   Bonus fix: actually use compiler-specific command line flags when compiling files

modified   lib/3rdparty/adns/adns.rbuild
modified   lib/3rdparty/libxml2/libxml2.rbuild
modified   lib/3rdparty/mingw/mingw.rbuild
   And for the downside: static libraries that will be linked to a module that links to the CRT dynamically have to be compiled for a dynamically-linked CRT, as well. Say it out aloud.

modified   base/applications/wordpad/wordpad.rbuild
modified   base/setup/usetup/usetup.rbuild
modified   dll/3rdparty/dxtn/dxtn.rbuild
modified   dll/3rdparty/freetype/freetype.rbuild
modified   dll/3rdparty/mesa32/mesa32.rbuild
modified   dll/cpl/desk/desk.rbuild
modified   dll/cpl/input/input.rbuild
modified   dll/cpl/intl/intl.rbuild
modified   dll/cpl/joy/joy.rbuild
modified   dll/cpl/main/main.rbuild
modified   dll/cpl/mmsys/mmsys.rbuild
modified   dll/cpl/odbccp32/odbccp32.rbuild
modified   dll/cpl/powercfg/powercfg.rbuild
modified   dll/cpl/sysdm/sysdm.rbuild
modified   dll/cpl/telephon/telephon.rbuild
modified   dll/cpl/timedate/timedate.rbuild
modified   dll/cpl/usrmgr/usrmgr.rbuild
modified   dll/directx/ddraw/ddraw.rbuild
modified   dll/directx/dsound/dsound.rbuild
modified   dll/directx/wine/wined3d/wined3d.rbuild
modified   dll/nls/idndl_redist/idndl_redist.rbuild
modified   dll/nls/normaliz_redist/normaliz_redist.rbuild
modified   dll/shellext/deskadp/deskadp.rbuild
modified   dll/shellext/deskmon/deskmon.rbuild
modified   dll/shellext/fontext/fontext.rbuild
modified   dll/win32/dhcpcsvc/dhcpcsvc.rbuild
modified   dll/win32/dnsapi/dnsapi.rbuild
modified   dll/win32/glu32/glu32.rbuild
modified   dll/win32/icmp/icmp.rbuild
modified   dll/win32/winmm/midimap/midimap.rbuild
modified   drivers/video/displays/framebuf/framebuf.rbuild
modified   drivers/video/displays/framebufacc/framebufacc.rbuild
modified   drivers/video/displays/vga/vgaddi.rbuild
modified   subsystems/win32/csrss/csrss.rbuild
modified   subsystems/win32/csrss/win32csr/win32csr.rbuild
modified   subsystems/win32/win32k/win32k.rbuild
   Don't specify msvcrt explicitely as a <library> if it's going to be linked implicitely as the CRT
   <library>libcntpr</library> -> crt="libcntpr"
   Remove miscellaneous unused <library> entries

modified   dll/win32/crtdll/crtdll.rbuild
modified   dll/win32/msvcrt20/msvcrt20.rbuild
modified   dll/win32/msvcrt40/msvcrt40.rbuild
modified   dll/win32/msvcrt/msvcrt.rbuild
   Mark CRT DLLs as CRT modules

modified   dll/win32/user32/windows/font.c
modified   include/reactos/wine/unicode.h
   Don't redefine or redeclare CRT functions

modified   dll/win32/ws2_32/include/ws2_32.h
   Arch, you idiot, it's defined in <stdlib.h>

modified   include/crt/ctype.h
modified   include/crt/wctype.h
   Don't import ctype routines that were already defined as inlines

modified   include/crt/stdio.h
modified   include/reactos/wine/config.h
   Avoid linking to libmingwex.a if possible

modified   base/applications/taskmgr/taskmgr.rbuild
modified   tools/nci/nci.mak
modified   tools/nci/ncitool.c
modified   dll/ntdll/ntdll.rbuild
   Mark ntdll module as a CRT
   New "ntsys" module to import just Nt/Zw from ntdll.dll. Avoids accidentally linking to ntdll.dll's CRT when importing system calls

modified   include/psdk/winternl.h
   Nope, it doesn't.

modified   base/applications/network/net/help.c
modified   base/applications/network/net/main.c
   Replace printf with puts, or GCC will do it on its own and link to the dllimport thunk for puts

modified   base/applications/network/ping/ping.c
   Removed broken, unnecessary workaround

modified   base/shell/cmd/cmd.rbuild
   Simplify cmd module

This commit dediHAPPY BIRTHDAY STEFAN GINSBERG <3 <3 <3

svn path=/trunk/; revision=37187

65 files changed:
reactos/base/applications/network/net/help.c
reactos/base/applications/network/net/main.c
reactos/base/applications/network/ping/ping.c
reactos/base/applications/taskmgr/taskmgr.rbuild
reactos/base/applications/wordpad/wordpad.rbuild
reactos/base/setup/usetup/usetup.rbuild
reactos/base/shell/cmd/cmd.rbuild
reactos/dll/3rdparty/dxtn/dxtn.rbuild
reactos/dll/3rdparty/freetype/freetype.rbuild
reactos/dll/3rdparty/mesa32/mesa32.rbuild
reactos/dll/cpl/desk/desk.rbuild
reactos/dll/cpl/input/input.rbuild
reactos/dll/cpl/intl/intl.rbuild
reactos/dll/cpl/joy/joy.rbuild
reactos/dll/cpl/main/main.rbuild
reactos/dll/cpl/mmsys/mmsys.rbuild
reactos/dll/cpl/odbccp32/odbccp32.rbuild
reactos/dll/cpl/powercfg/powercfg.rbuild
reactos/dll/cpl/sysdm/sysdm.rbuild
reactos/dll/cpl/telephon/telephon.rbuild
reactos/dll/cpl/timedate/timedate.rbuild
reactos/dll/cpl/usrmgr/usrmgr.rbuild
reactos/dll/directx/ddraw/ddraw.rbuild
reactos/dll/directx/dsound/dsound.rbuild
reactos/dll/directx/wine/wined3d/wined3d.rbuild
reactos/dll/nls/idndl_redist/idndl_redist.rbuild
reactos/dll/nls/normaliz_redist/normaliz_redist.rbuild
reactos/dll/ntdll/ntdll.rbuild
reactos/dll/shellext/deskadp/deskadp.rbuild
reactos/dll/shellext/deskmon/deskmon.rbuild
reactos/dll/shellext/fontext/fontext.rbuild
reactos/dll/win32/crtdll/crtdll.rbuild
reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild
reactos/dll/win32/dnsapi/dnsapi.rbuild
reactos/dll/win32/glu32/glu32.rbuild
reactos/dll/win32/icmp/icmp.rbuild
reactos/dll/win32/msvcrt/msvcrt.rbuild
reactos/dll/win32/msvcrt20/msvcrt20.rbuild
reactos/dll/win32/msvcrt40/msvcrt40.rbuild
reactos/dll/win32/user32/windows/font.c
reactos/dll/win32/winmm/midimap/midimap.rbuild
reactos/dll/win32/ws2_32/include/ws2_32.h
reactos/drivers/video/displays/framebuf/framebuf.rbuild
reactos/drivers/video/displays/framebufacc/framebufacc.rbuild
reactos/drivers/video/displays/vga/vgaddi.rbuild
reactos/include/crt/_mingw.h
reactos/include/crt/ctype.h
reactos/include/crt/stdio.h
reactos/include/crt/wctype.h
reactos/include/psdk/winternl.h
reactos/include/reactos/wine/config.h
reactos/include/reactos/wine/unicode.h
reactos/lib/3rdparty/adns/adns.rbuild
reactos/lib/3rdparty/libxml2/libxml2.rbuild
reactos/lib/3rdparty/mingw/mingw.rbuild
reactos/subsystems/win32/csrss/csrss.rbuild
reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild
reactos/subsystems/win32/win32k/win32k.rbuild
reactos/tools/nci/nci.mak
reactos/tools/nci/ncitool.c
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/module.cpp
reactos/tools/rbuild/project.dtd
reactos/tools/rbuild/rbuild.h

index 2ff6329..ae32525 100644 (file)
@@ -19,148 +19,148 @@ INT cmdHelp(INT argc, CHAR **argv)
 
     if (strcmp(argv[0],"ACCOUNTS")==0)
     {
-        printf("ACCOUNTS\n");
-        printf("help text\n");
+        puts("ACCOUNTS");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"COMPUTER")==0)
     {
-        printf("COMPUTER\n");
-        printf("help text\n");
+        puts("COMPUTER");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"CONFIG")==0)
     {
-        printf("CONFIG\n");
-        printf("help text\n");
+        puts("CONFIG");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"CONTINUE")==0)
     {
-        printf("CONTINUE\n");
-        printf("help text\n");
+        puts("CONTINUE");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"FILE")==0)
     {
-        printf("FILE\n");
-        printf("help text\n");
+        puts("FILE");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"GROUP")==0)
     {
-        printf("GROUP\n");
-        printf("help text\n");
+        puts("GROUP");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"HELP")==0)
     {
-        printf("HELP\n");
-        printf("help text\n");
+        puts("HELP");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"HELPMSG")==0)
     {
-        printf("HELPMSG\n");
-        printf("help text\n");
+        puts("HELPMSG");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"LOCALGROUP")==0)
     {
-        printf("LOCALGROUP\n");
-        printf("help text\n");
+        puts("LOCALGROUP");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"NAME")==0)
     {
-        printf("NAME\n");
-        printf("help text\n");
+        puts("NAME");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"PRINT")==0)
     {
-        printf("PRINT\n");
-        printf("help text\n");
+        puts("PRINT");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"SEND")==0)
     {
-        printf("SEND\n");
-        printf("help text\n");
+        puts("SEND");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"SESSION")==0)
     {
-        printf("SESSION\n");
-        printf("help text\n");
+        puts("SESSION");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"SHARE")==0)
     {
-        printf("SHARE\n");
-        printf("help text\n");
+        puts("SHARE");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"START")==0)
     {
-        printf("START\n");
-        printf("help text\n");
+        puts("START");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"STATISTICS")==0)
     {
-        printf("STATISTICS\n");
-        printf("help text\n");
+        puts("STATISTICS");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"STOP")==0)
     {
-        printf("STOP\n");
-        printf("help text\n");
+        puts("STOP");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"TIME")==0)
     {
-        printf("TIME\n");
-        printf("help text\n");
+        puts("TIME");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"USE")==0)
     {
-        printf("USE\n");
-        printf("help text\n");
+        puts("USE");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"USER")==0)
     {
-        printf("USER\n");
-        printf("help text\n");
+        puts("USER");
+        puts("help text");
         return 0;
     }
 
     if (strcmp(argv[0],"VIEW")==0)
     {
-        printf("VIEW\n");
-        printf("help text\n");
+        puts("VIEW");
+        puts("help text");
         return 0;
     }
 
@@ -170,30 +170,30 @@ INT cmdHelp(INT argc, CHAR **argv)
 
 void help()
 {
-    printf("NET ACCOUNTS\n");
-    printf("NET COMPUTER\n");
-    printf("NET CONFIG\n");
-    printf("NET CONFIG SERVER\n");
-    printf("NET CONFIG WORKSTATION\n");
-    printf("NET CONTINUE\n");
-    printf("NET FILE\n");
-    printf("NET GROUP\n");
-
-    printf("NET HELP\n");
-    printf("NET HELPMSG\n");
-    printf("NET LOCALGROUP\n");
-    printf("NET NAME\n");
-    printf("NET PAUSE\n");
-    printf("NET PRINT\n");
-    printf("NET SEND\n");
-    printf("NET SESSION\n");
-
-    printf("NET SHARE\n");
-    printf("NET START\n");
-    printf("NET STATISTICS\n");
-    printf("NET STOP\n");
-    printf("NET TIME\n");
-    printf("NET USE\n");
-    printf("NET USER\n");
-    printf("NET VIEW\n");
+    puts("NET ACCOUNTS");
+    puts("NET COMPUTER");
+    puts("NET CONFIG");
+    puts("NET CONFIG SERVER");
+    puts("NET CONFIG WORKSTATION");
+    puts("NET CONTINUE");
+    puts("NET FILE");
+    puts("NET GROUP");
+
+    puts("NET HELP");
+    puts("NET HELPMSG");
+    puts("NET LOCALGROUP");
+    puts("NET NAME");
+    puts("NET PAUSE");
+    puts("NET PRINT");
+    puts("NET SEND");
+    puts("NET SESSION");
+
+    puts("NET SHARE");
+    puts("NET START");
+    puts("NET STATISTICS");
+    puts("NET STOP");
+    puts("NET TIME");
+    puts("NET USE");
+    puts("NET USER");
+    puts("NET VIEW");
 }
index 51c2db6..425b0db 100644 (file)
@@ -114,7 +114,7 @@ int main(int argc, char **argv)
 
 int unimplement()
 {
-       printf("This command is not implement yet\n");
+       puts("This command is not implement yet");
        return 1;
 }
 
index 94cd421..44ca3e8 100644 (file)
 
 #define NDEBUG
 
-#ifndef _MSC_VER
-
-/* Should be in the header files somewhere (exported by ntdll.dll) */
-long atol(const char *str);
-
-#ifndef __int64
-typedef long long __int64;
-#endif
-
-char * _i64toa(__int64 value, char *string, int radix);
-
-#endif /* _MSC_VER */
-
 /* General ICMP constants */
 #define ICMP_MINSIZE        8     /* Minimum ICMP packet size */
 #define ICMP_MAXSIZE        65535 /* Maximum ICMP packet size */
index 5051899..a3bb904 100644 (file)
@@ -2,8 +2,7 @@
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
 <module name="taskmgr" type="win32gui" installbase="system32" installname="taskmgr.exe" unicode="yes">
        <include base="taskmgr">.</include>
-       <library>msvcrt</library>
-       <library>ntdll</library>
+       <library>ntsys</library>
        <library>kernel32</library>
        <library>advapi32</library>
        <library>user32</library>
index c158254..120f235 100644 (file)
@@ -6,7 +6,6 @@
        <library>shell32</library>
        <library>user32</library>
        <library>gdi32</library>
-       <library>msvcrt</library>
        <library>advapi32</library>
        <library>kernel32</library>
        <library>comctl32</library>
index 59fc77d..de68061 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="usetup" type="nativecui" installbase="system32" installname="usetup.exe" allowwarnings="false">
+<module name="usetup" type="nativecui" installbase="system32" installname="usetup.exe" allowwarnings="false" crt="static">
        <bootstrap installbase="$(CDOUTPUT)/system32" nameoncd="smss.exe" />
        <include base="usetup">.</include>
        <include base="zlib">.</include>
index c0e301b..7ae5ff6 100644 (file)
@@ -1,11 +1,18 @@
 <?xml version="1.0"?>
 <!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
 <group>
-       <module name="cmd_base" type="objectlibrary" unicode="yes">
+       <module name="cmd" type="win32cui" installbase="system32" installname="cmd.exe" unicode="yes">
                <include base="ReactOS">include/reactos/wine</include>
-               <include base="cmd_base">.</include>
+               <include base="cmd">.</include>
                <define name="ANONYMOUSUNIONS" />
                <define name="_DEBUG_MEM" />
+               <library>wine</library>
+               <library>kernel32</library>
+               <library>advapi32</library>
+               <library>shell32</library>
+               <library>user32</library>
+               <file>cmd.rc</file>
+               <file>main.c</file>
                <pch>precomp.h</pch>
                <compilationunit name="unit.c">
                        <file>alias.c</file>
                        <file>window.c</file>
                </compilationunit>
        </module>
-       <module name="cmd" type="win32cui" installbase="system32" installname="cmd.exe" unicode="yes">
-               <include base="ReactOS">include/reactos/wine</include>
-               <include base="cmd">.</include>
-               <define name="ANONYMOUSUNIONS" />
-               <library>cmd_base</library>
-               <library>wine</library>
-               <library>kernel32</library>
-               <library>advapi32</library>
-               <library>shell32</library>
-               <library>user32</library>
-               <file>cmd.rc</file>
-               <file>main.c</file>
-       </module>
 </group>
index 0a30d69..d16c584 100644 (file)
@@ -2,11 +2,8 @@
        <importlibrary definition="dxtn.def" />
        <include base="dxtn">.</include>
        <define name="__USE_W32API" />
-
-       <library>msvcrt</library>
-
        <file>fxt1.c</file>
        <file>dxtn.c</file>
        <file>wrapper.c</file>
        <file>texstore.c</file>
-</module>
\ No newline at end of file
+</module>
index 5d6c44b..c091ce0 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="freetype" type="kernelmodedll" entrypoint="0" baseaddress="${BASEADDRESS_FREETYPE}" installbase="system32" installname="freetype.dll" allowwarnings="true">
+<module name="freetype" type="kernelmodedll" entrypoint="0" baseaddress="${BASEADDRESS_FREETYPE}" installbase="system32" installname="freetype.dll" allowwarnings="true" crt="libcntpr">
        <importlibrary definition="freetype.def" />
        <include base="freetype">include</include>
        <define name="_DISABLE_TIDENTS" />
@@ -14,7 +14,6 @@
                <define name="TT_CONFIG_OPTION_BYTECODE_INTERPRETER" />
        </if>
        <library>ntoskrnl</library>
-       <library>libcntpr</library>
        <directory name="i386">
                <file>setjmplongjmp.s</file>
        </directory>
index 7e0b945..bef9794 100644 (file)
@@ -5,7 +5,6 @@
        <linkerflag>-enable-stdcall-fixup</linkerflag>
        <library>ntdll</library>
        <library>kernel32</library>
-       <library>msvcrt</library>
        <library>user32</library>
        <define name="USE_EXTERNAL_DXTN_LIB" />
        <!-- The following is autogenrated by Makefile.ReactOS -->
index 8e7aaec..d62a85f 100644 (file)
@@ -15,7 +15,6 @@
        <library>shell32</library>
        <library>ntdll</library>
        <library>msimg32</library>
-       <library>msvcrt</library>
        <library>uuid</library>
        <file>advmon.c</file>
        <file>appearance.c</file>
index 13eb96a..f72d001 100644 (file)
@@ -7,7 +7,6 @@
        <library>advapi32</library>
        <library>user32</library>
        <library>comctl32</library>
-       <library>msvcrt</library>
        <library>gdi32</library>
        <file>input.c</file>
        <file>settings.c</file>
index 9115eab..be1749a 100644 (file)
@@ -8,7 +8,6 @@
     <library>comctl32</library>
     <library>advapi32</library>
     <library>setupapi</library>
-    <library>msvcrt</library>
     <library>shell32</library>
     <file>currency.c</file>
     <file>date.c</file>
index 40bb06f..862e467 100644 (file)
@@ -7,7 +7,6 @@
        <library>advapi32</library>
        <library>user32</library>
        <library>comctl32</library>
-       <library>msvcrt</library>
        <library>ole32</library>
        <library>uuid</library>
        <library>shell32</library>
index 4224665..3353e28 100644 (file)
@@ -11,7 +11,6 @@
        <library>comdlg32</library>
        <library>shell32</library>
        <library>gdi32</library>
-       <library>msvcrt</library>
        <file>keyboard.c</file>
        <file>main.c</file>
        <file>mouse.c</file>
index 2dcffdc..304feb8 100644 (file)
@@ -6,7 +6,6 @@
        <library>kernel32</library>
        <library>user32</library>
        <library>comctl32</library>
-       <library>msvcrt</library>
        <library>devmgr</library>
        <library>gdi32</library>
        <library>winmm</library>
index 936757b..dd83b37 100644 (file)
@@ -6,7 +6,6 @@
        <library>kernel32</library>
        <library>user32</library>
        <library>comctl32</library>
-       <library>msvcrt</library>
        <file>odbccp32.c</file>
        <file>odbccp32.rc</file>
 </module>
index 7e8308e..0a9509b 100644 (file)
@@ -9,7 +9,6 @@
        <library>powrprof</library>
        <library>comctl32</library>
        <library>shell32</library>
-       <library>msvcrt</library>
        <library>advapi32</library>
        <file>powercfg.c</file>
        <file>powershemes.c</file>
index 9b7583a..58f0f5c 100644 (file)
@@ -6,11 +6,9 @@
        <library>kernel32</library>
        <library>advapi32</library>
        <library>setupapi</library>
-       <library>msvcrt</library>
        <library>user32</library>
        <library>gdi32</library>
        <library>comctl32</library>
-       <library>ntdll</library>
        <library>msimg32</library>
        <library>shell32</library>
        <library>shlwapi</library>
index 35746b1..788c7f5 100644 (file)
@@ -7,7 +7,6 @@
        <library>advapi32</library>
        <library>user32</library>
        <library>comctl32</library>
-       <library>msvcrt</library>
        <library>ole32</library>
        <library>uuid</library>
        <library>shell32</library>
index fdb6a4f..90dfca7 100644 (file)
@@ -10,7 +10,6 @@
        <library>comctl32</library>
        <library>ws2_32</library>
        <library>iphlpapi</library>
-       <library>msvcrt</library>
        <file>clock.c</file>
        <file>dateandtime.c</file>
        <file>internettime.c</file>
index f7850c2..8026fd9 100644 (file)
@@ -10,7 +10,6 @@
        <library>comctl32</library>
        <library>ntdll</library>
        <library>netapi32</library>
-       <library>msvcrt</library>
        <file>extra.c</file>
        <file>groupprops.c</file>
        <file>groups.c</file>
index 267522c..19b965b 100644 (file)
@@ -11,7 +11,6 @@
        <library>ole32</library>
        <library>user32</library>
        <library>advapi32</library>
-       <library>msvcrt</library>
        <library>pseh</library>
 
        <file>ddraw.rc</file>
index fc12b19..6370a01 100644 (file)
@@ -14,7 +14,6 @@
        <library>ole32</library>
        <library>winmm</library>
        <library>dxguid</library>
-       <library>msvcrt</library>
        <file>version.rc</file>
        <file>buffer.c</file>
        <file>capture.c</file>
index 67e7e44..ac97225 100644 (file)
@@ -14,7 +14,6 @@
        <library>advapi32</library>
        <library>kernel32</library>
        <library>uuid</library>
-       <library>msvcrt</library>
 
        <file>ati_fragment_shader.c</file>
        <file>arb_program_shader.c</file>
index 2f4fc4b..b5826dc 100644 (file)
@@ -1,9 +1,8 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="idndl_redist" type="win32dll" installname="idndl_redist.dll">
+<module name="idndl_redist" type="win32dll" installname="idndl_redist.dll" crt="libcntpr">
        <library>kernel32</library>
        <library>scripts</library>
-       <library>libcntpr</library>
        <compilerflag compiler="cpp">-fno-exceptions</compilerflag>
        <compilerflag compiler="cpp">-fno-rtti</compilerflag>
        <linkerflag>--entry=0</linkerflag>
index f25c822..2876cc0 100644 (file)
@@ -4,11 +4,10 @@
        <include base="icu4ros">icu/source/common</include>
        <directory name="data"><file>icudt38.c</file></directory>
 </module>
-<module name="normaliz_redist" type="win32dll" installname="normaliz_redist.dll">
+<module name="normaliz_redist" type="win32dll" installname="normaliz_redist.dll" crt="libcntpr">
        <library>normalize</library>
        <library>idna</library>
        <library>normaliz_redist_data</library>
-       <library>libcntpr</library>
        <library>kernel32</library>
        <compilerflag compiler="cpp">-fno-exceptions</compilerflag>
        <compilerflag compiler="cpp">-fno-rtti</compilerflag>
index 4ad11df..124e2e4 100644 (file)
@@ -1,7 +1,10 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../tools/rbuild/project.dtd">
 <group>
-       <module name="ntdll" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_NTDLL}" installbase="system32" installname="ntdll.dll">
+       <module name="ntsys" type="staticlibrary">
+               <importlibrary definition="def/ntsys.pspec" dllname="ntdll.dll" root="intermediate" />
+       </module>
+       <module name="ntdll" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_NTDLL}" installbase="system32" installname="ntdll.dll" iscrt="yes">
                <bootstrap installbase="$(CDOUTPUT)/system32" />
                <importlibrary definition="def/ntdll_$(ARCH).def" />
                <include base="ntdll">include</include>
@@ -54,4 +57,4 @@
                        <file>ntdll.rc</file>
                </directory>
        </module>
-</group>
\ No newline at end of file
+</group>
index edb177e..bb4d426 100644 (file)
@@ -8,7 +8,6 @@
        <library>comctl32</library>
        <library>ole32</library>
        <library>uuid</library>
-       <library>msvcrt</library>
        <file>deskadp.c</file>
        <file>shxiface.c</file>
        <file>deskadp.rc</file>
index d453121..36252dc 100644 (file)
@@ -8,7 +8,6 @@
        <library>comctl32</library>
        <library>ole32</library>
        <library>uuid</library>
-       <library>msvcrt</library>
        <file>deskmon.c</file>
        <file>shxiface.c</file>
        <file>deskmon.rc</file>
index 715fc30..5418840 100644 (file)
@@ -7,7 +7,6 @@
        <library>gdi32</library>
        <library>ole32</library>
        <library>uuid</library>
-       <library>msvcrt</library>
        <library>shlwapi</library>
        <library>lz32</library>
        <library>advapi32</library>
index 54baeeb..435f2dd 100644 (file)
@@ -1,4 +1,4 @@
-<module name="crtdll" type="win32dll" baseaddress="${BASEADDRESS_CRTDLL}" mangledsymbols="true" installbase="system32" installname="crtdll.dll">
+<module name="crtdll" type="win32dll" baseaddress="${BASEADDRESS_CRTDLL}" mangledsymbols="true" installbase="system32" installname="crtdll.dll" iscrt="true">
        <importlibrary definition="crtdll.def" />
        <include base="crtdll">.</include>
        <include base="crt">include</include>
index 7ad4a4d..7162592 100644 (file)
@@ -4,7 +4,6 @@
        <define name="_DISABLE_TIDENTS" />
        <library>ntdll</library>
        <library>kernel32</library>
-       <library>msvcrt</library>
        <library>ws2_32</library>
        <library>iphlpapi</library>
        <file>dhcpcsvc.c</file>
index a1fbb53..ad4b273 100644 (file)
@@ -9,7 +9,6 @@
        <library>ntdll</library>
        <library>kernel32</library>
        <library>user32</library>
-       <library>msvcrt</library>
        <library>ws2_32</library>
        <library>iphlpapi</library>
        <directory name="dnsapi">
index 3ce372d..4668301 100644 (file)
@@ -14,7 +14,6 @@
        <library>opengl32</library>
        <library>kernel32</library>
        <library>gdi32</library>
-       <library>msvcrt</library>
        <directory name="libnurbs">
                <directory name="interface">
                        <file>bezierEval.cc</file>
index a7ee160..8da93de 100644 (file)
@@ -6,7 +6,6 @@
        <library>kernel32</library>
        <library>ws2_32</library>
        <library>wine</library>
-       <library>msvcrt</library>
        <file>icmp_main.c</file>
        <file>icmp.rc</file>
        <file>icmp.spec</file>
index f97ffc8..d77c968 100644 (file)
@@ -1,4 +1,4 @@
-<module name="msvcrt" type="win32dll" baseaddress="${BASEADDRESS_MSVCRT}" mangledsymbols="true" installbase="system32" installname="msvcrt.dll">
+<module name="msvcrt" type="win32dll" baseaddress="${BASEADDRESS_MSVCRT}" mangledsymbols="true" installbase="system32" installname="msvcrt.dll" iscrt="yes">
        <importlibrary definition="msvcrt.def" />
        <include base="msvcrt">.</include>
        <include base="crt">include</include>
index f33a67a..c6e51ab 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
 <group>
-<module name="msvcrt20" type="win32dll" baseaddress="${BASEADDRESS_MSVCRT20}" installbase="system32" installname="msvcrt20.dll" allowwarnings="true" entrypoint="0">
+<module name="msvcrt20" type="win32dll" baseaddress="${BASEADDRESS_MSVCRT20}" installbase="system32" installname="msvcrt20.dll" allowwarnings="true" entrypoint="0" iscrt="yes">
        <importlibrary definition="msvcrt20.spec" />
        <include base="msvcrt20">.</include>
        <include base="ReactOS">include/reactos/wine</include>
index 200942a..c8432e0 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
 <group>
-<module name="msvcrt40" type="win32dll" baseaddress="${BASEADDRESS_MSVCRT40}" installbase="system32" installname="msvcrt40.dll">
+<module name="msvcrt40" type="win32dll" baseaddress="${BASEADDRESS_MSVCRT40}" installbase="system32" installname="msvcrt40.dll" iscrt="yes">
        <importlibrary definition="msvcrt40.spec" />
        <include base="msvcrt40">.</include>
        <include base="ReactOS">include/reactos/wine</include>
index 941fdfb..906325c 100644 (file)
 
 /* FUNCTIONS *****************************************************************/
 
-void _assert(const char *msg, const char *file, int line)
+#ifndef NDEBUG
+
+#ifdef assert
+#undef assert
+#endif
+
+#define assert(e) ((e) ? (void)0 : _font_assert(#e, __FILE__, __LINE__))
+
+#endif
+
+void _font_assert(const char *msg, const char *file, int line)
 {
   /* Assertion failed at foo.c line 45: x<y */
   DbgPrint("Assertion failed at %s line %d: %s\n", file, line, msg);
index 60d4fbf..5933999 100644 (file)
@@ -9,7 +9,6 @@
        <library>advapi32</library>
        <library>user32</library>
        <library>winmm</library>
-       <library>msvcrt</library>
        <file>midimap.c</file>
        <file>midimap.rc</file>
 </module>
index f495fa1..169fcc0 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef __WS2_32_H
 #define __WS2_32_H
 
+#include <stdlib.h>
+
 #define WIN32_NO_STATUS
 #include <winsock2.h>
 #include <ws2spi.h>
 #include <debug.h>
 #include <windns.h> // DNS_A_DATA
 
-/* Exported by ntdll.dll, but where is the prototype? */
-unsigned long strtoul(const char *nptr, char **endptr, int base);
-
-
 #define EXPORT STDCALL
 
 extern HINSTANCE g_hInstDll;
index e373350..5dcb2f0 100644 (file)
@@ -1,10 +1,9 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
-<module name="framebuf" type="kernelmodedll" entrypoint="DrvEnableDriver@12" installbase="system32" installname="framebuf.dll">
+<module name="framebuf" type="kernelmodedll" entrypoint="DrvEnableDriver@12" installbase="system32" installname="framebuf.dll" crt="libcntpr">
        <importlibrary definition="framebuf.spec" />
        <include base="framebuf">.</include>
        <library>win32k</library>
-       <library>libcntpr</library>
        <file>enable.c</file>
        <file>palette.c</file>
        <file>pointer.c</file>
index bfc08f0..5db42b2 100644 (file)
@@ -1,10 +1,9 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
-<module name="framebufacc" type="kernelmodedll" entrypoint="DrvEnableDriver@12" installbase="system32" installname="framebuf.dll">
+<module name="framebufacc" type="kernelmodedll" entrypoint="DrvEnableDriver@12" installbase="system32" installname="framebuf.dll" crt="libcntpr">
        <importlibrary definition="framebufacc.spec" />
        <include base="framebufacc">.</include>
        <library>win32k</library>
-       <library>libcntpr</library>
        <file>enable.c</file>
        <file>palette.c</file>
        <file>pointer.c</file>
index 9b2b2ee..35479f8 100644 (file)
@@ -1,9 +1,8 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
-<module name="vgaddi" type="kernelmodedll" entrypoint="DrvEnableDriver@12" installbase="system32" installname="vgaddi.dll">
+<module name="vgaddi" type="kernelmodedll" entrypoint="DrvEnableDriver@12" installbase="system32" installname="vgaddi.dll" crt="libcntpr">
        <importlibrary definition="vgaddi.spec" />
        <include base="vgaddi">.</include>
-       <library>libcntpr</library>
        <library>win32k</library>
        <directory name="main">
                <file>enable.c</file>
index dd0e13d..ec8b672 100644 (file)
 /* Try to avoid problems with outdated checks for GCC __attribute__ support.  */
 #undef __attribute__
 
-#ifndef __GNUC__
-# ifndef __MINGW_IMPORT
-#  define __MINGW_IMPORT  __declspec(dllimport)
-# endif
-# ifndef _CRTIMP
-#  define _CRTIMP  __declspec(dllimport)
+#if defined(_MSC_VER)
+# ifdef _DLL
+#  ifndef __MINGW_IMPORT
+#   define __MINGW_IMPORT  __declspec(dllimport)
+#  endif
+#  ifndef _CRTIMP
+#   define _CRTIMP  __declspec(dllimport)
+#  endif
+# else
+#  ifndef __MINGW_IMPORT
+#   define __MINGW_IMPORT
+#  endif
+#  ifndef _CRTIMP
+#   define _CRTIMP
+#  endif
 # endif
 # define __DECLSPEC_SUPPORTED
 # define __attribute__(x) /* nothing */
-#else /* __GNUC__ */
+# define __restrict__ /* nothing */
+#elif defined(__GNUC__)
 # ifdef __declspec
 #  ifndef __MINGW_IMPORT
-   /* Note the extern. This is needed to work around GCC's
-      limitations in handling dllimport attribute.  */
-#   define __MINGW_IMPORT  extern __attribute__ ((__dllimport__))
+#   ifdef _DLL
+    /* Note the extern. This is needed to work around GCC's
+       limitations in handling dllimport attribute.  */
+#    define __MINGW_IMPORT  extern __attribute__ ((__dllimport__))
+#   else
+#    define __MINGW_IMPORT  extern
+#   endif
 #  endif
 #  ifndef _CRTIMP
 #   ifdef __USE_CRTIMP
-#    define _CRTIMP  __attribute__ ((dllimport))
+#    ifdef _DLL
+#     define _CRTIMP  __attribute__ ((dllimport))
+#    else
+#     define _CRTIMP
+#    endif
 #   else
 #    define _CRTIMP
 #   endif
 #   define _CRTIMP
 #  endif
 # endif /* __declspec */
+
+/*
+   The next two defines can cause problems if user code adds the __cdecl attribute
+   like so:
+   void __attribute__ ((__cdecl)) foo(void);
+*/
 # ifndef __cdecl
-#  define __cdecl __attribute__ ((__cdecl__))
+#  define __cdecl  __attribute__ ((__cdecl__))
 # endif
 # ifndef __stdcall
 #  define __stdcall __attribute__ ((__stdcall__))
 # ifndef __hyper
 #  define __hyper long long
 # endif
+#else
+# ifndef __MINGW_IMPORT
+#  define __MINGW_IMPORT  __declspec(dllimport)
+# endif
+# ifndef _CRTIMP
+#  define _CRTIMP  __declspec(dllimport)
+# endif
+# define __DECLSPEC_SUPPORTED
+# define __attribute__(x) /* nothing */
 #endif /* __GNUC__ */
 
 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
 #define __MINGW_GNUC_PREREQ(major, minor)  0
 #endif
 
+#if defined (_MSC_VER)
+#define __MINGW_MSC_PREREQ(major, minor) \
+  ((_MSC_VER / 100) > (major) \
+   || ((_MSC_VER / 100) == (major) && (_MSC_VER % 100) >= (minor)))
+#else
+#define __MINGW_MSC_PREREQ(major, minor)  0
+#endif
+
 #ifdef __cplusplus
 # define __CRT_INLINE inline
 #else
-# if __GNUC_STDC_INLINE__
+# if defined(_MSC_VER)
+#  define __CRT_INLINE __inline
+# elif __GNUC_STDC_INLINE__
 #  define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
 # else
 #  define __CRT_INLINE extern __inline__
 #ifdef __GNUC__
 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
+#elif __MINGW_MSC_PREREQ(12, 0)
+#define __MINGW_ATTRIB_NORETURN __declspec(noreturn)
+#define __MINGW_ATTRIB_CONST
 #else
 #define __MINGW_ATTRIB_NORETURN
 #define __MINGW_ATTRIB_CONST
 #endif
 
+#if defined(__GNUC__)
+#define __mingw_va_start(v,l) __builtin_va_start(v,l)
+#define __mingw_va_end(v) __builtin_va_end(v)
+#define __mingw_va_arg(v,l)    __builtin_va_arg(v,l)
+#define __mingw_va_copy(d,s) __builtin_va_copy(d,s)
+#elif defined(_MSC_VER)
+#define __mingw_va_start(v,l) __msc_va_start(v,l)
+#define __mingw_va_end(v) __msc_va_end(v)
+#define __mingw_va_arg(v,l)    __msc_va_arg(v,l)
+#define __mingw_va_copy(d,s) __msc_va_copy(d,s)
+#endif
+
 #if __MINGW_GNUC_PREREQ (3, 0)
 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
+#elif __MINGW_MSC_PREREQ (14, 0)
+#define __MINGW_ATTRIB_MALLOC __declspec(noalias) __declspec(restrict)
+#define __MINGW_ATTRIB_PURE
 #else
 #define __MINGW_ATTRIB_MALLOC
 #define __MINGW_ATTRIB_PURE
 
 #if  __MINGW_GNUC_PREREQ (3, 1)
 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
+#elif __MINGW_MSC_PREREQ (12, 0)
+#define __MINGW_ATTRIB_DEPRECATED __declspec (deprecated)
 #else
 #define __MINGW_ATTRIB_DEPRECATED
-#endif /* GNUC >= 3.1 */
+#endif
+
 #if  __MINGW_GNUC_PREREQ (3, 3)
 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
+#elif __MINGW_MSC_PREREQ (12, 0) && defined (__cplusplus)
+#define __MINGW_NOTHROW __declspec (nothrow)
 #else
 #define __MINGW_NOTHROW
-#endif /* GNUC >= 3.3 */
+#endif
+
+/* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW.  This will
+allow GCC to optimize away some EH unwind code, at least in DW2 case.  */
 
 #ifndef __MSVCRT_VERSION__
 /*  High byte is the major version, low byte is the minor. */
 # define __MSVCRT_VERSION__ 0x0600
 #endif
 
-#ifndef _SIZE_T_DEFINED
-#define _SIZE_T_DEFINED
-#undef size_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
-  typedef unsigned int size_t __attribute__ ((mode (DI)));
-#else
-  typedef unsigned __int64 size_t;
-#endif
-#else
-  typedef unsigned int size_t;
-#endif
-#endif
-
 #define __MINGW32_VERSION 3.13
 #define __MINGW32_MAJOR_VERSION 3
 #define __MINGW32_MINOR_VERSION 13
index 44a932b..c5e5870 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ctype.h
  * This file has no copyright assigned and is placed in the Public Domain.
  * This file is a part of the mingw-runtime package.
@@ -33,7 +33,7 @@
 #define        _CONTROL        0x0020
 /* _BLANK is set for SP and non-ASCII horizontal space chars (eg,
    "no-break space", 0xA0, in CP1250) but not for HT.  */
-#define        _BLANK          0x0040 
+#define        _BLANK          0x0040
 #define        _HEX            0x0080
 #define        _LEADBYTE       0x8000
 
@@ -79,7 +79,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW toupper(int);
 /*
  *  These are the cheap non-std versions: The return values are undefined
  *  if the argument is not ASCII char or is not of appropriate case
- */ 
+ */
 _CRTIMP int __cdecl __MINGW_NOTHROW _tolower(int);
 _CRTIMP int __cdecl __MINGW_NOTHROW _toupper(int);
 #endif
@@ -116,7 +116,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _toupper(int);
 # else /* CRTDLL */
   __MINGW_IMPORT const unsigned short* _pctype_dll;
 # define  _pctype _pctype_dll
-# endif 
+# endif
 
 #else          /*  __DECLSPEC_SUPPORTED */
 # if __MSVCRT_VERSION__ <= 0x0700
@@ -134,7 +134,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _toupper(int);
 #endif
 
 /*
- * Use inlines here rather than macros, because macros will upset 
+ * Use inlines here rather than macros, because macros will upset
  * C++ usage (eg, ::isalnum), and so usually get undefined
  *
  * According to standard for SB chars, these function are defined only
@@ -144,7 +144,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _toupper(int);
  *
  * If no MB char support is needed, these can be simplified even
  * more by command line define -DMB_CUR_MAX=1.  The compiler will then
- * optimise away the constant condition.                       
+ * optimise away the constant condition.
  */
 
 #if !(defined (__NO_INLINE__)  || defined (__NO_CTYPE_INLINES) \
@@ -190,20 +190,8 @@ typedef wchar_t wctype_t;
 #define _WCTYPE_T_DEFINED
 #endif
 
-_CRTIMP int __cdecl __MINGW_NOTHROW iswalnum(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswalpha(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswascii(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswcntrl(wint_t);
 _CRTIMP int __cdecl __MINGW_NOTHROW iswctype(wint_t, wctype_t);
 _CRTIMP int __cdecl __MINGW_NOTHROW is_wctype(wint_t, wctype_t);       /* Obsolete! */
-_CRTIMP int __cdecl __MINGW_NOTHROW iswdigit(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswgraph(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswlower(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswprint(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswpunct(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswspace(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswupper(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW iswxdigit(wint_t);
 
 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
      || !defined __STRICT_ANSI__ || defined __cplusplus
@@ -243,6 +231,21 @@ __CRT_INLINE int __cdecl __MINGW_NOTHROW iswblank (wint_t wc)
 
 #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
 
+#ifndef __WCTYPE_INLINES_DEFINED
+_CRTIMP int __cdecl __MINGW_NOTHROW iswalnum(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswalpha(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswascii(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswcntrl(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswdigit(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswgraph(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswlower(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswprint(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswpunct(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswspace(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswupper(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswxdigit(wint_t);
+#endif
+
 #ifndef        __STRICT_ANSI__
 int __cdecl __MINGW_NOTHROW __isascii (int);
 int __cdecl __MINGW_NOTHROW __toascii (int);
@@ -250,14 +253,14 @@ int __cdecl __MINGW_NOTHROW __iscsymf (int);              /* Valid first character in C symb
 int __cdecl __MINGW_NOTHROW __iscsym (int);            /* Valid character in C symbol (after first) */
 
 #if !(defined (__NO_INLINE__) || defined (__NO_CTYPE_INLINES))
-__CRT_INLINE int __cdecl __MINGW_NOTHROW __isascii(int c) {return ((c & ~0x7F) == 0);} 
+__CRT_INLINE int __cdecl __MINGW_NOTHROW __isascii(int c) {return ((c & ~0x7F) == 0);}
 __CRT_INLINE int __cdecl __MINGW_NOTHROW __toascii(int c) {return (c & 0x7F);}
 __CRT_INLINE int __cdecl __MINGW_NOTHROW __iscsymf(int c) {return (isalpha(c) || (c == '_'));}
 __CRT_INLINE int __cdecl __MINGW_NOTHROW __iscsym(int c)  {return  (isalnum(c) || (c == '_'));}
 #endif /* __NO_CTYPE_INLINES */
 
 #ifndef        _NO_OLDNAMES
-/* Not _CRTIMP */ 
+/* Not _CRTIMP */
 int __cdecl __MINGW_NOTHROW isascii (int);
 int __cdecl __MINGW_NOTHROW toascii (int);
 int __cdecl __MINGW_NOTHROW iscsymf (int);
index b32edaf..375fbc5 100644 (file)
@@ -205,15 +205,27 @@ _CRTIMP int __cdecl __MINGW_NOTHROW       vprintf (const char*, __VALIST);
 _CRTIMP int __cdecl __MINGW_NOTHROW    vsprintf (char*, const char*, __VALIST);
 _CRTIMP int __cdecl __MINGW_NOTHROW    _vsnprintf (char*, size_t, const char*, __VALIST);
 
-#ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
-int __cdecl __MINGW_NOTHROW snprintf(char *, size_t, const char *, ...);
-int __cdecl __MINGW_NOTHROW vsnprintf (char *, size_t, const char *, __VALIST);
-
-int __cdecl __MINGW_NOTHROW vscanf (const char * __restrict__, __VALIST);
-int __cdecl __MINGW_NOTHROW vfscanf (FILE * __restrict__, const char * __restrict__,
-                    __VALIST);
-int __cdecl __MINGW_NOTHROW vsscanf (const char * __restrict__,
-                    const char * __restrict__, __VALIST);
+#ifndef __NO_ISOCEXT
+__CRT_INLINE int __cdecl __MINGW_NOTHROW snprintf(char * s, size_t n, const char * f, ...)
+{
+       int r;
+       __VALIST a;
+       __mingw_va_start(a, f);
+       r = _vsnprintf (s, n, f, a);
+       __mingw_va_end(a);
+       return r;
+}
+
+__CRT_INLINE int __cdecl __MINGW_NOTHROW vsnprintf (char * s, size_t n, const char * f, __VALIST a)
+{
+       return _vsnprintf (s, n, f, a);
+}
+
+int __cdecl __MINGW_NOTHROW vscanf (const char * __restrict__ f, __VALIST a);
+int __cdecl __MINGW_NOTHROW vfscanf (FILE * __restrict__ o, const char * __restrict__ f,
+                    __VALIST a);
+int __cdecl __MINGW_NOTHROW vsscanf (const char * __restrict__ s,
+                    const char * __restrict__ f, __VALIST a);
 #endif
 
 /*
index 57f61f7..731967d 100644 (file)
@@ -64,20 +64,8 @@ typedef wchar_t wctype_t;
 #endif
 
 /* Wide character equivalents - also in ctype.h */
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswalnum(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswalpha(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswascii(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswcntrl(wint_t);
 _CRTIMP int __cdecl __MINGW_NOTHROW    iswctype(wint_t, wctype_t);
 _CRTIMP int __cdecl __MINGW_NOTHROW    is_wctype(wint_t, wctype_t);    /* Obsolete! */
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswdigit(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswgraph(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswlower(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswprint(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswpunct(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswspace(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswupper(wint_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW    iswxdigit(wint_t);
 
 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
      || !defined __STRICT_ANSI__ || defined __cplusplus
@@ -98,7 +86,7 @@ _CRTIMP int __cdecl __MINGW_NOTHROW   isleadbyte (int);
 #ifdef __DECLSPEC_SUPPORTED
 # if __MSVCRT_VERSION__ <= 0x0700
   __MINGW_IMPORT unsigned short _ctype[];
-# endif 
+# endif
 # ifdef __MSVCRT__
   __MINGW_IMPORT const unsigned short* _pctype;
 # else /* CRTDLL */
@@ -146,6 +134,21 @@ __CRT_INLINE int __cdecl __MINGW_NOTHROW iswblank (wint_t wc)
 
 #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
 
+#ifndef __WCTYPE_INLINES_DEFINED
+_CRTIMP int __cdecl __MINGW_NOTHROW iswalnum(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswalpha(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswascii(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswcntrl(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswdigit(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswgraph(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswlower(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswprint(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswpunct(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswspace(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswupper(wint_t);
+_CRTIMP int __cdecl __MINGW_NOTHROW iswxdigit(wint_t);
+#endif
+
 typedef wchar_t wctrans_t;
 
 /* These are resolved by libmingwex.a.  Note, that they are also exported
index f58fc89..7868b03 100644 (file)
@@ -1662,9 +1662,6 @@ typedef enum _SYSDBG_COMMAND {
  * Function declarations
  */
 
-extern LPSTR _strlwr(LPSTR str); /* FIXME: Doesn't belong here */
-extern LPSTR _strupr(LPSTR str); /* FIXME: Doesn't belong here */
-
 #if defined(__i386__) && defined(__GNUC__)
 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
index cc9c077..e4f02e7 100644 (file)
 #define HAVE_VA_COPY 1
 
 /* Define to 1 if you have the `vsnprintf' function. */
-//#define HAVE_VSNPRINTF 1
+#define HAVE_VSNPRINTF 1
 
 /* Define to 1 if you have the `wait4' function. */
 /* #undef HAVE_WAIT4 */
index dea64cd..44f0988 100644 (file)
@@ -2,6 +2,8 @@
 #define _WINE_UNICODE_H
 
 #include <stdarg.h>
+#include <stdlib.h>
+#include <wchar.h>
 
 #include <windef.h>
 #include <winbase.h>
 #endif
 #endif /* defined __VALIST  */
 
-int __cdecl _wtoi (const wchar_t *);
-long __cdecl _wtol (const wchar_t *);
-int __cdecl swprintf (wchar_t*, const wchar_t*, ...);
-int __cdecl _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
-int __cdecl _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
-
 static __inline WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
 {
     for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)str;
index 7a0ce2d..700cf8a 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="adns" type="staticlibrary" allowwarnings="true">
+<module name="adns" type="staticlibrary" allowwarnings="true" crt="dll">
        <include base="adns">src</include>
        <include base="adns">adns_win32</include>
        <define name="ADNS_JGAA_WIN32" />
index 60ba9d4..822f8b5 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="libxml2" type="staticlibrary" allowwarnings="true">
+<module name="libxml2" type="staticlibrary" allowwarnings="true" crt="dll">
        <define name="HAVE_CONFIG_H" />
        <define name="WIN32" />
        <define name="_WINDOWS" />
index c901f39..dab45dc 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
 <group>
-<module name="mingw_common" type="staticlibrary" isstartuplib="true" underscoresymbols="true">
+<module name="mingw_common" type="staticlibrary" isstartuplib="true" underscoresymbols="true" crt="dll">
        <importlibrary definition="moldname-msvcrt.def" dllname="msvcrt.dll" />
        <include base="mingw_common">include</include>
        <file>cpu_features.c</file>
                <file>pseudo-reloc.c</file>
        </if>
 </module>
-<module name="mingw_main" type="staticlibrary" isstartuplib="true" allowwarnings="true">
+<module name="mingw_main" type="staticlibrary" isstartuplib="true" allowwarnings="true" crt="dll">
        <include base="mingw_common">include</include>
        <file>binmode.c</file>
        <file>crt1.c</file>
        <file>main.c</file>
 </module>
-<module name="mingw_wmain" type="staticlibrary" isstartuplib="true" allowwarnings="true">
+<module name="mingw_wmain" type="staticlibrary" isstartuplib="true" allowwarnings="true" crt="dll">
        <include base="mingw_common">include</include>
        <file>wbinmode.c</file>
        <file>wcrt1.c</file>
        <file>wmain.c</file>
 </module>
-<module name="mingw_dllmain" type="staticlibrary" isstartuplib="true">
+<module name="mingw_dllmain" type="staticlibrary" isstartuplib="true" crt="dll">
        <include base="mingw_common">include</include>
        <file>dllcrt1.c</file>
 </module>
index c7fd856..56a6724 100644 (file)
@@ -9,7 +9,6 @@
                <library>nt</library>
                <library>ntdll</library>
                <library>smdll</library>
-               <library>msvcrt</library>
                <directory name="api">
                        <file>handle.c</file>
                        <file>process.c</file>
index e003390..ba304e4 100644 (file)
@@ -15,8 +15,6 @@
        <library>advapi32</library>
         <library>win32ksys</library>
        <library>psapi</library>
-       <library>msvcrt</library>
-       <library>psapi</library>
        <library>shell32</library>
        <pch>w32csr.h</pch>
        <file>alias.c</file>
index 5dd14c6..0173e47 100644 (file)
                <file>stubs.c</file>
        </directory>
 </module>
-<module name="win32k" type="kernelmodedriver" installbase="system32" installname="win32k.sys" allowwarnings="true">
+<module name="win32k" type="kernelmodedriver" installbase="system32" installname="win32k.sys" allowwarnings="true" crt="libcntpr">
        <importlibrary definition="win32k.pspec" />
        <library>win32k_base</library>
        <library>pseh</library>
        <library>ntoskrnl</library>
-       <library>libcntpr</library>
        <library>hal</library>
        <library>freetype</library>
        <library>dxguid</library>
index fb08ebe..d2480c0 100644 (file)
@@ -56,13 +56,15 @@ KERNEL_SVC_DB = ntoskrnl$(SEP)sysfuncs.lst
 KERNEL_SERVICE_TABLE = $(INTERMEDIATE_)ntoskrnl$(SEP)include$(SEP)internal$(SEP)napi.h
 NTDLL_STUBS = $(INTERMEDIATE_)lib$(SEP)ntdllsys$(SEP)ntdll.S
 KERNEL_STUBS = $(INTERMEDIATE_)ntoskrnl$(SEP)ex$(SEP)zw.S
+NT_SPEC = $(INTERMEDIATE_)dll$(SEP)ntdll$(SEP)def$(SEP)ntsys.pspec
 
 NCI_SERVICE_FILES = \
        $(KERNEL_SERVICE_TABLE) \
        $(WIN32K_SERVICE_TABLE) \
        $(NTDLL_STUBS) \
        $(KERNEL_STUBS) \
-       $(WIN32K_STUBS)
+       $(WIN32K_STUBS) \
+       $(NT_SPEC)
 
 $(NCI_SERVICE_FILES): $(NCI_TARGET) $(KERNEL_SVC_DB) $(WIN32K_SVC_DB)
        $(ECHO_NCI)
@@ -71,6 +73,7 @@ $(NCI_SERVICE_FILES): $(NCI_TARGET) $(KERNEL_SVC_DB) $(WIN32K_SVC_DB)
        ${mkdir} $(INTERMEDIATE_)ntoskrnl$(SEP)ex$(SEP) 2>$(NUL)
        ${mkdir} $(INTERMEDIATE_)subsystems$(SEP)win32$(SEP)win32k$(SEP)include 2>$(NUL)
        ${mkdir} $(INTERMEDIATE_)lib$(SEP)win32ksys 2>$(NUL)
+       ${mkdir} $(INTERMEDIATE_)dll$(SEP)ntdll$(SEP)def 2>$(NUL)
 
        $(Q)$(NCI_TARGET) -arch $(ARCH) \
                $(KERNEL_SVC_DB) \
@@ -79,7 +82,8 @@ $(NCI_SERVICE_FILES): $(NCI_TARGET) $(KERNEL_SVC_DB) $(WIN32K_SVC_DB)
                $(WIN32K_SERVICE_TABLE) \
                $(NTDLL_STUBS) \
                $(KERNEL_STUBS) \
-               $(WIN32K_STUBS)
+               $(WIN32K_STUBS) \
+               $(NT_SPEC)
 
 .PHONY: nci_service_files_clean
 nci_service_files_clean:
index bed8849..6a50fdf 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:               Native Call Interface Support Tool
  * PURPOSE:               Generates NCI Tables and Stubs.
  * PROGRAMMER;            Alex Ionescu (alex@relsoft.net)
- * CHANGE HISTORY:        14/01/05 - Created. Based on original code by 
+ * CHANGE HISTORY:        14/01/05 - Created. Based on original code by
  *                                   KJK::Hyperion and Emanuelle Aliberti.
  *
  */
 /* DEFINES  ****************************************************************/
 
 #define INPUT_BUFFER_SIZE 255
-#define Arguments 7
+#define Arguments 8
 
 /******* Table Indexes ************/
 #define MAIN_INDEX 0x0
 #define WIN32K_INDEX 0x1000
 
 /******* Argument List ************/
-/* First, define the Databases */
+/* Databases */
 #define NativeSystemDb 0
 #define NativeGuiDb 1
 
-/* Now the Service Tables */
+/* Service Tables */
 #define NtosServiceTable 2
 #define Win32kServiceTable 3
 
-/* And finally, the stub files. */
+/* Stub Files */
 #define NtosUserStubs 4
 #define NtosKernelStubs 5
 #define Win32kStubs 6
 
+/* Spec Files */
+#define NtSpec 7
+
 /********** Stub Code ************/
 
 /*
- * This stubs calls into KUSER_SHARED_DATA where either a 
+ * This stubs calls into KUSER_SHARED_DATA where either a
  * sysenter or interrupt is performed, depending on CPU support.
- */    
+ */
 #if defined(__GNUC__)
 #define UserModeStub_x86    "    movl $0x%x, %%eax\n" \
                             "    movl $KUSER_SHARED_SYSCALL, %%ecx\n" \
@@ -84,7 +87,7 @@
 
 /*
  * This stub calls KiSystemService directly with a fake INT2E stack.
- * Because EIP is pushed during the call, the handler will return here. 
+ * Because EIP is pushed during the call, the handler will return here.
  */
 #if defined(__GNUC__)
 #define KernelModeStub_x86  "    movl $0x%x, %%eax\n" \
 
 /***** Arch Dependent Stuff ******/
 struct ncitool_data_t {
-       const char *arch;
-       int args_to_bytes;
-       const char *km_stub;
-       const char *um_stub;
-       const char *global_header;
-       const char *declaration;
+    const char *arch;
+    int args_to_bytes;
+    const char *km_stub;
+    const char *um_stub;
+    const char *global_header;
+    const char *declaration;
 };
 
 struct ncitool_data_t ncitool_data[] = {
-       { "i386", 4, KernelModeStub_x86, UserModeStub_x86,
-         ".global _%s@%d\n", "_%s@%d:\n" },
-       { "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc,
-         "\t.globl %s\n", "%s:\n" },
-       { "mips", 4, KernelModeStub_mips, UserModeStub_mips,
-         "\t.globl %s\n", "%s:\n" },
-       { "arm", 4, KernelModeStub_arm, UserModeStub_arm,
+    { "i386", 4, KernelModeStub_x86, UserModeStub_x86,
+      ".global _%s@%d\n", "_%s@%d:\n" },
+    { "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc,
+      "\t.globl %s\n", "%s:\n" },
+    { "mips", 4, KernelModeStub_mips, UserModeStub_mips,
+      "\t.globl %s\n", "%s:\n" },
+    { "arm", 4, KernelModeStub_arm, UserModeStub_arm,
     "\t.globl %s\n", "%s:\n" },
-       { 0, }
+    { 0, }
 };
 int arch_sel = 0;
 #define ARGS_TO_BYTES(x) (x)*(ncitool_data[arch_sel].args_to_bytes)
@@ -148,7 +151,7 @@ int arch_sel = 0;
 /* FUNCTIONS ****************************************************************/
 
 /*++
- * WriteFileHeader 
+ * WriteFileHeader
  *
  *     Prints out the File Header for a Stub File.
  *
@@ -166,7 +169,7 @@ int arch_sel = 0;
  *     FileLocation is only used for printing the header.
  *
  *--*/
-void 
+void
 WriteFileHeader(FILE * StubFile,
                 char* FileDescription,
                 char* FileLocation)
@@ -185,7 +188,7 @@ WriteFileHeader(FILE * StubFile,
 }
 
 /*++
- * WriteFileHeader 
+ * WriteFileHeader
  *
  *     Prints out the File Header for a Stub File.
  *
@@ -203,21 +206,21 @@ WriteFileHeader(FILE * StubFile,
  *     FileLocation is only used for printing the header.
  *
  *--*/
-void 
-WriteStubHeader(FILE* StubFile, 
-                char* SyscallName, 
+void
+WriteStubHeader(FILE* StubFile,
+                char* SyscallName,
                 unsigned StackBytes)
 {
     /* Export the function */
     fprintf(StubFile, GlobalHeader, SyscallName, StackBytes);
-    
+
     /* Define it */
     fprintf(StubFile, Declaration, SyscallName, StackBytes);
 }
 
-    
+
 /*++
- * WriteKernelModeStub 
+ * WriteKernelModeStub
  *
  *     Prints out the Kernel Mode Stub for a System Call.
  *
@@ -237,12 +240,12 @@ WriteStubHeader(FILE* StubFile,
  *     On i386, StackBytes is the number of arguments x 4.
  *
  *--*/
-void 
-WriteKernelModeStub(FILE* StubFile, 
-                    char* SyscallName, 
+void
+WriteKernelModeStub(FILE* StubFile,
+                    char* SyscallName,
                     unsigned StackBytes,
                     unsigned int SyscallId)
-{    
+{
     /* Write the Stub Header and export the Function */
     WriteStubHeader(StubFile, SyscallName, StackBytes);
 
@@ -251,7 +254,7 @@ WriteKernelModeStub(FILE* StubFile,
 }
 
 /*++
- * WriteUserModeStub 
+ * WriteUserModeStub
  *
  *     Prints out the User Mode Stub for a System Call.
  *
@@ -271,12 +274,12 @@ WriteKernelModeStub(FILE* StubFile,
  *     On i386, StackBytes is the number of arguments x 4.
  *
  *--*/
-void 
-WriteUserModeStub(FILE* StubFile, 
-                  char* SyscallName, 
+void
+WriteUserModeStub(FILE* StubFile,
+                  char* SyscallName,
                   unsigned StackBytes,
                   unsigned int SyscallId)
-{   
+{
     /* Write the Stub Header and export the Function */
     WriteStubHeader(StubFile, SyscallName, StackBytes);
 
@@ -285,7 +288,7 @@ WriteUserModeStub(FILE* StubFile,
 }
 
 /*++
- * GetNameAndArgumentsFromDb 
+ * GetNameAndArgumentsFromDb
  *
  *     Parses an entry from a System Call Database, extracting
  *     the function's name and arguments that it takes.
@@ -305,23 +308,23 @@ WriteUserModeStub(FILE* StubFile,
  *     On i386, StackBytes is the number of arguments x 4.
  *
  *--*/
-void 
+void
 GetNameAndArgumentsFromDb(char Line[],
                           char ** NtSyscallName,
                           char ** SyscallArguments)
 {
     char *s;
     char *stmp;
-    
+
     /* Remove new line */
     if ((s = (char *) strchr(Line,'\r')) != NULL) {
         *s = '\0';
     }
-        
+
     /* Skip comments (#) and empty lines */
     s = &Line[0];
     if ((*s) != '#' && (*s) != '\0') {
-            
+
         /* Extract the NtXXX name */
         *NtSyscallName = (char *)strtok(s," \t");
 
@@ -332,9 +335,9 @@ GetNameAndArgumentsFromDb(char Line[],
         if ((stmp = strchr(*SyscallArguments, '\n')) != NULL) {
             *stmp = '\0';
         }
-        
+
     } else {
-    
+
         /* Skip this entry */
         *NtSyscallName = NULL;
         *SyscallArguments = NULL;
@@ -342,7 +345,7 @@ GetNameAndArgumentsFromDb(char Line[],
 }
 
 /*++
- * CreateStubs 
+ * CreateStubs
  *
  *     Parses a System Call Database and creates stubs for all the entries.
  *
@@ -379,28 +382,28 @@ CreateStubs(FILE * SyscallDb,
     char *SyscallArguments;
     int SyscallId;
     unsigned StackBytes;
-    
+
     /* We loop, incrementing the System Call Index, until the end of the file  */
     for (SyscallId = 0; ((!feof(SyscallDb)) && (fgets(Line, sizeof(Line), SyscallDb) != NULL));) {
-             
+
         /* Extract the Name and Arguments */
-        GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments); 
+        GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments);
         if (SyscallArguments != NULL)
             StackBytes = ARGS_TO_BYTES(strtoul(SyscallArguments, NULL, 0));
         else
             StackBytes = 0;
+
         /* Make sure we really extracted something */
         if (NtSyscallName) {
-     
+
             /* Create Usermode Stubs for Nt/Zw syscalls in each Usermode file */
             int i;
             for (i= 0; i < UserFiles; i++) {
-    
+
                 /* Write the Nt Version */
-                WriteUserModeStub(UserModeFiles[i], 
-                                  NtSyscallName, 
-                                  StackBytes, 
+                WriteUserModeStub(UserModeFiles[i],
+                                  NtSyscallName,
+                                  StackBytes,
                                   SyscallId | Index);
 
                 /* If a Zw Version is needed (was specified), write it too */
@@ -426,7 +429,7 @@ CreateStubs(FILE * SyscallDb,
                                     StackBytes,
                                     SyscallId | Index);
             }
-        
+
             /* Only increase if we actually added something */
             SyscallId++;
         }
@@ -434,7 +437,7 @@ CreateStubs(FILE * SyscallDb,
 }
 
 /*++
- * CreateSystemServiceTable 
+ * CreateSystemServiceTable
  *
  *     Parses a System Call Database and creates a System Call Service Table for it.
  *
@@ -455,7 +458,7 @@ CreateStubs(FILE * SyscallDb,
  *
  *--*/
 void
-CreateSystemServiceTable(FILE *SyscallDb, 
+CreateSystemServiceTable(FILE *SyscallDb,
                          FILE *SyscallTable,
                          char * Name,
                          char * FileLocation)
@@ -477,21 +480,21 @@ CreateSystemServiceTable(FILE *SyscallDb,
 
         /* Extract the Name and Arguments */
         GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments);
-        
+
         /* Make sure we really extracted something */
         if (NtSyscallName) {
-            
+
             /* Add a new line */
             if (SyscallId > 0) fprintf(SyscallTable,",\n");
-        
+
             /* Write the syscall name in the service table. */
             fprintf(SyscallTable,"\t\t(ULONG_PTR)%s", NtSyscallName);
-            
+
             /* Only increase if we actually added something */
             SyscallId++;
         }
     }
-    
+
     /* Close the service table (C syntax) */
     fprintf(SyscallTable,"\n};\n");
 
@@ -504,24 +507,24 @@ CreateSystemServiceTable(FILE *SyscallDb,
 
         /* Extract the Name and Arguments */
         GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments);
-        
+
         /* Make sure we really extracted something */
         if (NtSyscallName) {
-            
+
             /* Add a new line */
             if (SyscallId > 0) fprintf(SyscallTable,",\n");
-            
+
             /* Write the syscall arguments in the argument table. */
             if (SyscallArguments != NULL)
                 fprintf(SyscallTable,"\t\t%lu * sizeof(void *)",strtoul(SyscallArguments, NULL, 0));
             else
                 fprintf(SyscallTable,"\t\t0");
-                    
+
             /* Only increase if we actually added something */
             SyscallId++;
         }
     }
-    
+
     /* Close the service table (C syntax) */
     fprintf(SyscallTable,"\n};\n");
 
@@ -534,6 +537,108 @@ CreateSystemServiceTable(FILE *SyscallDb,
     fprintf(SyscallTable, "ULONG %sNumberOfSysCalls = %d;\n", Name, SyscallId);
 }
 
+/*++
+ * WriteSpec
+ *
+ *     Prints out the Spec Entry for a System Call.
+ *
+ * Params:
+ *     SpecFile - Spec File to which to write the header.
+ *
+ *     SyscallName - Name of System Call for which to add the stub.
+ *
+ *     CountArguments - Number of arguments to the System Call.
+ *
+ * Returns:
+ *     None.
+ *
+ * Remarks:
+ *     None.
+ *
+ *--*/
+void
+WriteSpec(FILE* StubFile,
+          char* SyscallName,
+          unsigned CountArguments)
+{
+    unsigned i;
+
+    fprintf(StubFile, "@ stdcall %s", SyscallName);
+
+    fputc ('(', StubFile);
+
+    for (i = 0; i < CountArguments; ++ i)
+        fputs ("ptr ", StubFile);
+
+    fputc (')', StubFile);
+    fputc ('\n', StubFile);
+}
+
+/*++
+ * CreateSpec
+ *
+ *     Parses a System Call Database and creates a spec file for all the entries.
+ *
+ * Params:
+ *     SyscallDb - System Call Database to parse.
+ *
+ *     Files - Array of Spec Files to which to write.
+ *
+ *     CountFiles - Number of Spec Files to create
+ *
+ *     UseZw - Use Zw prefix?
+ *
+ * Returns:
+ *     None.
+ *
+ * Remarks:
+ *     None.
+ *
+ *--*/
+void
+CreateSpec(FILE * SyscallDb,
+           FILE * Files[],
+           unsigned CountFiles,
+           unsigned UseZw)
+{
+    char Line[INPUT_BUFFER_SIZE];
+    char *NtSyscallName;
+    char *SyscallArguments;
+    unsigned CountArguments;
+
+    /* We loop until the end of the file  */
+    while ((!feof(SyscallDb)) && (fgets(Line, sizeof(Line), SyscallDb) != NULL)) {
+
+        /* Extract the Name and Arguments */
+        GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments);
+        CountArguments = strtoul(SyscallArguments, NULL, 0);
+
+        /* Make sure we really extracted something */
+        if (NtSyscallName) {
+
+            int i;
+            for (i= 0; i < CountFiles; i++) {
+
+                if (!UseZw) {
+                    WriteSpec(Files[i],
+                              NtSyscallName,
+                              CountArguments);
+                }
+
+                if (UseZw && NtSyscallName[0] == 'N' && NtSyscallName[1] == 't') {
+
+                    NtSyscallName[0] = 'Z';
+                    NtSyscallName[1] = 'w';
+                    WriteSpec(Files[i],
+                              NtSyscallName,
+                              CountArguments);
+                }
+
+            }
+        }
+    }
+}
+
 void usage(char * argv0)
 {
     printf("Usage: %s [-arch <arch>] sysfuncs.lst w32ksvc.db napi.h ssdt.h napi.S zw.S win32k.S win32k.S\n"
@@ -545,6 +650,7 @@ void usage(char * argv0)
            "  zw.S          NTOSKRNL Zw stubs\n"
            "  win32k.S      GDI32 stubs\n"
            "  win32k.S      USER32 stubs\n"
+           "  nt.pspec      NTDLL exports\n"
            "  -arch is optional, default is %s\n",
            argv0,
            ncitool_data[0].arch
@@ -574,14 +680,14 @@ int main(int argc, char* argv[])
         usage(argv[0]);
         return(1);
     }
-  
+
     /* Open all Output and bail out if any fail */
     for (FileNumber = 0; FileNumber < Arguments; FileNumber++) {
-    
+
         /* Open the File */
         if (FileNumber == 2) OpenType = "wb";
         Files[FileNumber] = fopen(argv[FileNumber + ArgOffset], OpenType);
-        
+
         /* Check for failure and error out if so */
         if (!Files[FileNumber]) {
             perror(argv[FileNumber + ArgOffset]);
@@ -590,56 +696,67 @@ int main(int argc, char* argv[])
     }
 
     /* Write the File Headers */
-    WriteFileHeader(Files[NtosUserStubs], 
-                    "System Call Stubs for Native API", 
+    WriteFileHeader(Files[NtosUserStubs],
+                    "System Call Stubs for Native API",
                     argv[NtosUserStubs + ArgOffset]);
-    
-    WriteFileHeader(Files[NtosKernelStubs], 
-                    "System Call Stubs for Native API", 
+
+    WriteFileHeader(Files[NtosKernelStubs],
+                    "System Call Stubs for Native API",
                     argv[NtosKernelStubs + ArgOffset]);
     fputs("#include <ndk/asm.h>\n\n", Files[NtosKernelStubs]);
 
-    WriteFileHeader(Files[Win32kStubs], 
-                    "System Call Stubs for Native API", 
+    WriteFileHeader(Files[Win32kStubs],
+                    "System Call Stubs for Native API",
                     argv[Win32kStubs + ArgOffset]);
 
     /* Create the System Stubs */
     CreateStubs(Files[NativeSystemDb],
-                &Files[NtosUserStubs], 
-                Files[NtosKernelStubs], 
-                MAIN_INDEX, 
+                &Files[NtosUserStubs],
+                Files[NtosKernelStubs],
+                MAIN_INDEX,
                 1,
                 1);
 
     /* Create the Graphics Stubs */
-    CreateStubs(Files[NativeGuiDb], 
-                &Files[Win32kStubs], 
-                NULL, 
-                WIN32K_INDEX, 
+    CreateStubs(Files[NativeGuiDb],
+                &Files[Win32kStubs],
+                NULL,
+                WIN32K_INDEX,
                 1,
                 0);
 
-    /* Rewind the databases */
-    rewind(Files[NativeSystemDb]);
-    rewind(Files[NativeGuiDb]);
-
     /* Create the Service Tables */
-    CreateSystemServiceTable(Files[NativeSystemDb], 
+    rewind(Files[NativeSystemDb]);
+    CreateSystemServiceTable(Files[NativeSystemDb],
                             Files[NtosServiceTable],
                             "Main",
                             argv[NtosServiceTable + ArgOffset]);
-    
-    CreateSystemServiceTable(Files[NativeGuiDb], 
+
+    rewind(Files[NativeGuiDb]);
+    CreateSystemServiceTable(Files[NativeGuiDb],
                             Files[Win32kServiceTable],
                             "Win32k",
                             argv[Win32kServiceTable + ArgOffset]);
 
+    /* Create the Spec Files */
+    rewind(Files[NativeSystemDb]);
+    CreateSpec(Files[NativeSystemDb],
+               &Files[NtSpec],
+               1,
+               0);
+
+    rewind(Files[NativeSystemDb]);
+    CreateSpec(Files[NativeSystemDb],
+               &Files[NtSpec],
+               1,
+               1);
+
     /* Close all files */
     for (FileNumber = 0; FileNumber < Arguments-ArgOffset; FileNumber++) {
-    
+
         /* Close the File */
         fclose(Files[FileNumber]);
-        
+
     }
 
     return(0);
index 2d57389..10afa36 100644 (file)
@@ -450,7 +450,44 @@ MingwBackend::GenerateProjectGccOptionsMacro ( const char* assignmentOperation,
                }
        }
 
-       fprintf ( fMakefile, "\n" );
+       fputs ( "\n", fMakefile );
+
+       // TODO: reference these from somewhere
+       fprintf (
+               fMakefile,
+               "PROJECT_GCC_CFLAGS %s",
+               assignmentOperation );
+
+       for ( i = 0; i < data.compilerFlags.size(); i++ )
+       {
+               if ( data.compilerFlags[i]->compiler == CompilerTypeCC )
+               {
+                       fprintf (
+                               fMakefile,
+                               " %s",
+                               data.compilerFlags[i]->flag.c_str() );
+               }
+       }
+
+       fputs ( "\n", fMakefile );
+
+       fprintf (
+               fMakefile,
+               "PROJECT_GCC_CXXFLAGS %s",
+               assignmentOperation );
+
+       for ( i = 0; i < data.compilerFlags.size(); i++ )
+       {
+               if ( data.compilerFlags[i]->compiler == CompilerTypeCPP )
+               {
+                       fprintf (
+                               fMakefile,
+                               " %s",
+                               data.compilerFlags[i]->flag.c_str() );
+               }
+       }
+
+       fputs ( "\n", fMakefile );
 }
 
 void
index 3b73cdb..fb26f71 100644 (file)
@@ -1059,7 +1059,7 @@ Rule wmcRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc
 Rule winebuildPDefRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).auto.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                          "\t$(ECHO_WINEBLD)\n"
                          "\t${gcc} -xc -E ${$(module_name)_RCFLAGS} $(source) > $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).def.spec\n"
-                         "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext)_$(module_name).auto.def --def -E $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).def.spec\n\n",
+                         "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).auto.def --def -E $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).def.spec\n\n",
                          "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).def.spec",
                          "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).auto.def",
                          "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
@@ -1650,10 +1650,11 @@ MingwModuleHandler::GenerateObjectFileTargets ()
                          backend->GetFullPath ( *pchFilename ).c_str() );
                fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );
                fprintf ( fMakefile,
-                         "\t%s -o %s %s -g %s\n\n",
+                         "\t%s -o %s %s %s -g %s\n\n",
                          module.cplusplus ? cppc.c_str() : cc.c_str(),
                          backend->GetFullName ( *pchFilename ).c_str(),
                          cflagsMacro.c_str(),
+                                 GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags, module.cplusplus ? CompilerTypeCPP : CompilerTypeCC ).c_str(),
                          backend->GetFullName ( baseHeaderFile ).c_str() );
                delete pchFilename;
        }
@@ -1886,7 +1887,11 @@ MingwModuleHandler::GenerateOtherMacros ()
 
        string globalCflags = "";
        if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
+       {
                globalCflags += " $(PROJECT_CFLAGS)";
+               if ( module.dynamicCRT )
+                       globalCflags += " -D_DLL -D__USE_CRTIMP";
+       }
        else
                globalCflags += " -Wall -Wpointer-arith";
        globalCflags += " -g";
@@ -2378,6 +2383,38 @@ MingwAddDebugSupportLibraries ( Module& module, DebugSupportType type )
        module.non_if_data.libraries.push_back(pLibrary);
 }
 
+static void
+MingwAddCRTLibrary( Module &module )
+{
+       const char * crtAttr = module.CRT.c_str ();
+       const char * crtLib = NULL;
+
+       if ( stricmp ( crtAttr, "libc" ) == 0 )
+               crtLib = "crt";
+       else if ( stricmp ( crtAttr, "msvcrt" ) == 0 )
+               crtLib = "msvcrt";
+       else if ( stricmp ( crtAttr, "libcntpr" ) == 0 )
+               crtLib = "libcntpr";
+       else if ( stricmp ( crtAttr, "ntdll" ) == 0 )
+               crtLib = "ntdll";
+
+       if ( crtLib )
+       {
+               Library* pLibrary = new Library ( module, std::string ( crtLib ) );
+
+               if ( pLibrary->importedModule == NULL)
+               {
+                       throw XMLInvalidBuildFileException (
+                               module.node.location,
+                               "module '%s' trying to import non-existant C runtime module '%s'",
+                               module.name.c_str(),
+                               crtLib );
+               }
+
+               module.non_if_data.libraries.push_back ( pLibrary );
+       }
+}
+
 MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ )
        : MingwModuleHandler ( module_ )
 {
@@ -2479,6 +2516,7 @@ MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (
 void
 MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module )
 {
+       MingwAddCRTLibrary ( module );
        MingwAddDebugSupportLibraries ( module, DebugKernelMode );
 }
 
@@ -2527,6 +2565,7 @@ MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler (
 void
 MingwNativeDLLModuleHandler::AddImplicitLibraries ( Module& module )
 {
+       MingwAddCRTLibrary ( module );
        MingwAddDebugSupportLibraries ( module, DebugUserMode );
 }
 
@@ -2575,6 +2614,7 @@ MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler (
 void
 MingwNativeCUIModuleHandler::AddImplicitLibraries ( Module& module )
 {
+       MingwAddCRTLibrary ( module );
        MingwAddDebugSupportLibraries ( module, DebugUserMode );
 }
 
@@ -2627,23 +2667,10 @@ MingwWin32OCXModuleHandler::MingwWin32OCXModuleHandler (
 {
 }
 
-static bool
-LinksToCrt( Module &module )
-{
-       for ( size_t i = 0; i < module.non_if_data.libraries.size (); i++ )
-       {
-               Library& library = *module.non_if_data.libraries[i];
-               if ( library.name == "libcntpr" || library.name == "crt" )
-                       return true;
-       }
-       return false;
-}
-
 static void
 MingwAddImplicitLibraries( Module &module )
 {
        Library* pLibrary;
-       bool links_to_crt;
 
        if ( module.type != Win32DLL
          && module.type != Win32OCX
@@ -2651,54 +2678,28 @@ MingwAddImplicitLibraries( Module &module )
          && module.type != Win32GUI
          && module.type != Win32SCR)
        {
-               // no implicit libraries
                return;
        }
 
-       links_to_crt = LinksToCrt ( module );
-
-       if ( !module.isDefaultEntryPoint )
+       if ( module.isDefaultEntryPoint )
        {
-               if ( module.GetEntryPoint(false) == "0" )
+               if ( module.IsDLL () )
                {
-                       if ( !links_to_crt )
-                       {
-                               pLibrary = new Library ( module, "mingw_common" );
-                               module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin() , pLibrary );
-
-                               pLibrary = new Library ( module, "msvcrt" );
-                               module.non_if_data.libraries.push_back ( pLibrary );
-                               links_to_crt = true;
-                       }
+                       //pLibrary = new Library ( module, "__mingw_dllmain" );
+                       //module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
+               }
+               else
+               {
+                       pLibrary = new Library ( module, module.isUnicode ? "mingw_wmain" : "mingw_main" );
+                       module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
                }
-               pLibrary = new Library ( module, "debugsup_ntdll" );
-               module.non_if_data.libraries.push_back(pLibrary);
-               return;
-       }
-
-       if ( module.IsDLL () )
-       {
-               //pLibrary = new Library ( module, "__mingw_dllmain" );
-               //module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
-       }
-       else
-       {
-               pLibrary = new Library ( module, module.isUnicode ? "mingw_wmain" : "mingw_main" );
-               module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
        }
 
        pLibrary = new Library ( module, "mingw_common" );
-       module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin() + 1, pLibrary );
+       module.non_if_data.libraries.push_back ( pLibrary );
 
-       if ( !links_to_crt )
-       {
-               // always link in msvcrt to get the basic routines
-               pLibrary = new Library ( module, "msvcrt" );
-               module.non_if_data.libraries.push_back ( pLibrary );
-       }
-
-       pLibrary = new Library ( module, "debugsup_ntdll" );
-       module.non_if_data.libraries.push_back(pLibrary);
+       MingwAddCRTLibrary ( module );
+       MingwAddDebugSupportLibraries ( module, DebugUserMode );
 }
 
 void
index d84ecc9..bdf2b52 100644 (file)
@@ -232,6 +232,28 @@ void IfableData::ProcessXML ()
                compilationUnits[i]->ProcessXML ();
 }
 
+bool Module::GetBooleanAttribute ( const XMLElement& moduleNode, const char * name, bool default_value )
+{
+       const XMLAttribute* att = moduleNode.GetAttribute ( name, false );
+       if ( att != NULL )
+       {
+               const char* p = att->value.c_str();
+               if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )
+                       return true;
+               else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )
+                       return false;
+               else
+               {
+                       throw InvalidAttributeValueException (
+                               moduleNode.location,
+                               name,
+                               att->value );
+               }
+       }
+       else
+               return default_value;
+}
+
 Module::Module ( const Project& project,
                  const XMLElement& moduleNode,
                  const string& modulePath )
@@ -282,24 +304,7 @@ Module::Module ( const Project& project,
        else
                extension = GetDefaultModuleExtension ();
 
-       att = moduleNode.GetAttribute ( "unicode", false );
-       if ( att != NULL )
-       {
-               const char* p = att->value.c_str();
-               if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )
-                       isUnicode = true;
-               else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )
-                       isUnicode = false;
-               else
-               {
-                       throw InvalidAttributeValueException (
-                               moduleNode.location,
-                               "unicode",
-                               att->value );
-               }
-       }
-       else
-               isUnicode = false;
+       isUnicode = GetBooleanAttribute ( moduleNode, "unicode" );
 
        if (isUnicode)
        {
@@ -337,24 +342,7 @@ Module::Module ( const Project& project,
        else
                baseaddress = GetDefaultModuleBaseaddress ();
 
-       att = moduleNode.GetAttribute ( "mangledsymbols", false );
-       if ( att != NULL )
-       {
-               const char* p = att->value.c_str();
-               if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )
-                       mangledSymbols = true;
-               else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )
-                       mangledSymbols = false;
-               else
-               {
-                       throw InvalidAttributeValueException (
-                               moduleNode.location,
-                               "mangledsymbols",
-                               att->value );
-               }
-       }
-       else
-               mangledSymbols = false;
+       mangledSymbols = GetBooleanAttribute ( moduleNode, "mangledsymbols" );
 
        att = moduleNode.GetAttribute ( "underscoresymbols", false );
        if ( att != NULL )
@@ -362,24 +350,50 @@ Module::Module ( const Project& project,
        else
                underscoreSymbols = false;
 
-       att = moduleNode.GetAttribute ( "isstartuplib", false );
-       if ( att != NULL )
+       isStartupLib = GetBooleanAttribute ( moduleNode, "isstartuplib" );
+       isCRT = GetBooleanAttribute ( moduleNode, "iscrt", GetDefaultModuleIsCRT () );
+
+       att = moduleNode.GetAttribute ( "crt", false );
+       if ( att != NULL)
        {
-               const char* p = att->value.c_str();
-               if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )
-                       isStartupLib = true;
-               else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )
-                       isStartupLib = false;
-               else
-               {
-                       throw InvalidAttributeValueException (
-                               moduleNode.location,
-                               "isstartuplib",
-                               att->value );
-               }
+               CRT = att->value;
+
+               if ( stricmp ( CRT.c_str (), "auto" ) == 0 )
+                       CRT = GetDefaultModuleCRT ();
        }
        else
-               isStartupLib = false;
+               CRT = GetDefaultModuleCRT ();
+
+       const char * crtAttr = CRT.c_str ();
+       if ( crtAttr == NULL || stricmp ( crtAttr, "none" ) == 0 )
+               dynamicCRT = false;
+       else if ( stricmp ( crtAttr, "libc" ) == 0 )
+               dynamicCRT = false;
+       else if ( stricmp ( crtAttr, "msvcrt" ) == 0 )
+               dynamicCRT = true;
+       else if ( stricmp ( crtAttr, "libcntpr" ) == 0 )
+               dynamicCRT = false;
+       else if ( stricmp ( crtAttr, "ntdll" ) == 0 )
+               dynamicCRT = true;
+       else if ( stricmp ( crtAttr, "static" ) == 0 )
+               dynamicCRT = false;
+       else if ( stricmp ( crtAttr, "dll" ) == 0 )
+               dynamicCRT = true;
+       else
+       {
+               throw InvalidAttributeValueException (
+                       moduleNode.location,
+                       "crt",
+                       std::string ( crtAttr ) );
+       }
+
+       if ( isCRT && dynamicCRT )
+       {
+               throw XMLInvalidBuildFileException (
+                       moduleNode.location,
+                       "C runtime module '%s' cannot be compiled for a dynamically-linked C runtime",
+                       name.c_str() );
+       }
 
        att = moduleNode.GetAttribute ( "prefix", false );
        if ( att != NULL )
@@ -1155,6 +1169,67 @@ Module::GetDefaultModuleBaseaddress () const
                                          __LINE__ );
 }
 
+std::string
+Module::GetDefaultModuleCRT () const
+{
+       if ( isCRT )
+               return "static";
+
+       switch ( type )
+       {
+               case Kernel:
+                       return "static";
+               case Win32DLL:
+               case Win32OCX:
+                       return "msvcrt";
+               case NativeDLL:
+               case NativeCUI:
+                       return "ntdll";
+               case Win32CUI:
+               case Win32SCR:
+               case Win32GUI:
+                       return "msvcrt";
+               case Test:
+                       return "msvcrt"; // BUGBUG: not sure about this
+               case KeyboardLayout:
+                       return "none";
+               case KernelModeDLL:
+               case KernelModeDriver:
+                       return "dll";
+               case BootLoader:
+                       return "libcntpr";
+               case ElfExecutable:
+               case BuildTool:
+               case StaticLibrary:
+               case HostStaticLibrary:
+               case ObjectLibrary:
+               case BootSector:
+               case Iso:
+               case LiveIso:
+               case IsoRegTest:
+               case LiveIsoRegTest:
+               case RpcServer:
+               case RpcClient:
+               case RpcProxy:
+               case Alias:
+               case BootProgram:
+               case IdlHeader:
+               case MessageHeader:
+               case EmbeddedTypeLib:
+               case Cabinet:
+               case TypeDontCare:
+                       return "none";
+       }
+       throw InvalidOperationException ( __FILE__,
+                                         __LINE__ );
+}
+
+bool
+Module::GetDefaultModuleIsCRT () const
+{
+       return type == Kernel;
+}
+
 bool
 Module::HasImportLibrary () const
 {
index 5411ce1..a84dc9f 100644 (file)
        unicode (true|yes|false|no) "no"
        isstartuplib    (true)  #IMPLIED
        buildtype %Text; #FIXED "OFWLDR"
+       iscrt   (true|yes|false|no) "no"
+       crt     (libc|msvcrt|libcntpr|ntdll|static|dll|none|auto) "auto"
 >
 
 <!ELEMENT pch (#PCDATA)>
index 3d87200..2629153 100644 (file)
@@ -368,6 +368,9 @@ public:
        bool allowWarnings;
        bool enabled;
        bool isStartupLib;
+       bool isCRT;
+       std::string CRT;
+       bool dynamicCRT;
        FileLocation *output; // "path/foo.exe"
        FileLocation *dependency; // "path/foo.exe" or "path/libfoo.a"
        FileLocation *install;
@@ -398,11 +401,16 @@ private:
        std::string GetDefaultModuleExtension () const;
        std::string GetDefaultModuleEntrypoint () const;
        std::string GetDefaultModuleBaseaddress () const;
+       std::string GetDefaultModuleCRT () const;
+       bool GetDefaultModuleIsCRT () const;
        std::string entrypoint;
        void ProcessXMLSubElement ( const XMLElement& e,
                                    DirectoryLocation directory,
                                    const std::string& relative_path,
                                    ParseContext& parseContext );
+       bool GetBooleanAttribute ( const XMLElement& moduleNode,
+                                  const char * name,
+                                  bool default_value = false );
 };