From: KJK::Hyperion Date: Tue, 4 Nov 2008 18:16:58 +0000 (+0000) Subject: KJK::Hyperion is proud to present "dllimport purity", another landmark commit that... X-Git-Tag: backups/the-real-msvc@60644~2^2~8 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=00ed4c13948d9174a77537fdebd8259674e9ec96 KJK::Hyperion is proud to present "dllimport purity", another landmark commit that you should really build only after a "clean" 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 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 if it's going to be linked implicitely as the CRT libcntpr -> crt="libcntpr" Remove miscellaneous unused 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 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 --- diff --git a/reactos/base/applications/network/net/help.c b/reactos/base/applications/network/net/help.c index 2ff632971c2..ae32525213b 100644 --- a/reactos/base/applications/network/net/help.c +++ b/reactos/base/applications/network/net/help.c @@ -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"); } diff --git a/reactos/base/applications/network/net/main.c b/reactos/base/applications/network/net/main.c index 51c2db647f7..425b0db393d 100644 --- a/reactos/base/applications/network/net/main.c +++ b/reactos/base/applications/network/net/main.c @@ -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; } diff --git a/reactos/base/applications/network/ping/ping.c b/reactos/base/applications/network/ping/ping.c index 94cd421d460..44ca3e8e8f5 100644 --- a/reactos/base/applications/network/ping/ping.c +++ b/reactos/base/applications/network/ping/ping.c @@ -14,19 +14,6 @@ #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 */ diff --git a/reactos/base/applications/taskmgr/taskmgr.rbuild b/reactos/base/applications/taskmgr/taskmgr.rbuild index 50518990a8e..a3bb904ea15 100644 --- a/reactos/base/applications/taskmgr/taskmgr.rbuild +++ b/reactos/base/applications/taskmgr/taskmgr.rbuild @@ -2,8 +2,7 @@ . - msvcrt - ntdll + ntsys kernel32 advapi32 user32 diff --git a/reactos/base/applications/wordpad/wordpad.rbuild b/reactos/base/applications/wordpad/wordpad.rbuild index c158254bca5..120f2355878 100644 --- a/reactos/base/applications/wordpad/wordpad.rbuild +++ b/reactos/base/applications/wordpad/wordpad.rbuild @@ -6,7 +6,6 @@ shell32 user32 gdi32 - msvcrt advapi32 kernel32 comctl32 diff --git a/reactos/base/setup/usetup/usetup.rbuild b/reactos/base/setup/usetup/usetup.rbuild index 59fc77d9efe..de6806153e1 100644 --- a/reactos/base/setup/usetup/usetup.rbuild +++ b/reactos/base/setup/usetup/usetup.rbuild @@ -1,6 +1,6 @@ - + . . diff --git a/reactos/base/shell/cmd/cmd.rbuild b/reactos/base/shell/cmd/cmd.rbuild index c0e301b1564..7ae5ff6b01b 100644 --- a/reactos/base/shell/cmd/cmd.rbuild +++ b/reactos/base/shell/cmd/cmd.rbuild @@ -1,11 +1,18 @@ - + include/reactos/wine - . + . + wine + kernel32 + advapi32 + shell32 + user32 + cmd.rc + main.c precomp.h alias.c @@ -67,17 +74,4 @@ window.c - - include/reactos/wine - . - - cmd_base - wine - kernel32 - advapi32 - shell32 - user32 - cmd.rc - main.c - diff --git a/reactos/dll/3rdparty/dxtn/dxtn.rbuild b/reactos/dll/3rdparty/dxtn/dxtn.rbuild index 0a30d6919a5..d16c584e9e5 100644 --- a/reactos/dll/3rdparty/dxtn/dxtn.rbuild +++ b/reactos/dll/3rdparty/dxtn/dxtn.rbuild @@ -2,11 +2,8 @@ . - - msvcrt - fxt1.c dxtn.c wrapper.c texstore.c - \ No newline at end of file + diff --git a/reactos/dll/3rdparty/freetype/freetype.rbuild b/reactos/dll/3rdparty/freetype/freetype.rbuild index 5d6c44b4294..c091ce05467 100644 --- a/reactos/dll/3rdparty/freetype/freetype.rbuild +++ b/reactos/dll/3rdparty/freetype/freetype.rbuild @@ -1,6 +1,6 @@ - + include @@ -14,7 +14,6 @@ ntoskrnl - libcntpr setjmplongjmp.s diff --git a/reactos/dll/3rdparty/mesa32/mesa32.rbuild b/reactos/dll/3rdparty/mesa32/mesa32.rbuild index 7e0b945d342..bef9794acd9 100644 --- a/reactos/dll/3rdparty/mesa32/mesa32.rbuild +++ b/reactos/dll/3rdparty/mesa32/mesa32.rbuild @@ -5,7 +5,6 @@ -enable-stdcall-fixup ntdll kernel32 - msvcrt user32 diff --git a/reactos/dll/cpl/desk/desk.rbuild b/reactos/dll/cpl/desk/desk.rbuild index 8e7aaec98d8..d62a85f576c 100644 --- a/reactos/dll/cpl/desk/desk.rbuild +++ b/reactos/dll/cpl/desk/desk.rbuild @@ -15,7 +15,6 @@ shell32 ntdll msimg32 - msvcrt uuid advmon.c appearance.c diff --git a/reactos/dll/cpl/input/input.rbuild b/reactos/dll/cpl/input/input.rbuild index 13eb96ac6d6..f72d00157b4 100644 --- a/reactos/dll/cpl/input/input.rbuild +++ b/reactos/dll/cpl/input/input.rbuild @@ -7,7 +7,6 @@ advapi32 user32 comctl32 - msvcrt gdi32 input.c settings.c diff --git a/reactos/dll/cpl/intl/intl.rbuild b/reactos/dll/cpl/intl/intl.rbuild index 9115eab2f50..be1749a01b6 100644 --- a/reactos/dll/cpl/intl/intl.rbuild +++ b/reactos/dll/cpl/intl/intl.rbuild @@ -8,7 +8,6 @@ comctl32 advapi32 setupapi - msvcrt shell32 currency.c date.c diff --git a/reactos/dll/cpl/joy/joy.rbuild b/reactos/dll/cpl/joy/joy.rbuild index 40bb06f8c48..862e4671871 100644 --- a/reactos/dll/cpl/joy/joy.rbuild +++ b/reactos/dll/cpl/joy/joy.rbuild @@ -7,7 +7,6 @@ advapi32 user32 comctl32 - msvcrt ole32 uuid shell32 diff --git a/reactos/dll/cpl/main/main.rbuild b/reactos/dll/cpl/main/main.rbuild index 4224665a06c..3353e28eeca 100644 --- a/reactos/dll/cpl/main/main.rbuild +++ b/reactos/dll/cpl/main/main.rbuild @@ -11,7 +11,6 @@ comdlg32 shell32 gdi32 - msvcrt keyboard.c main.c mouse.c diff --git a/reactos/dll/cpl/mmsys/mmsys.rbuild b/reactos/dll/cpl/mmsys/mmsys.rbuild index 2dcffdc0b35..304feb81085 100644 --- a/reactos/dll/cpl/mmsys/mmsys.rbuild +++ b/reactos/dll/cpl/mmsys/mmsys.rbuild @@ -6,7 +6,6 @@ kernel32 user32 comctl32 - msvcrt devmgr gdi32 winmm diff --git a/reactos/dll/cpl/odbccp32/odbccp32.rbuild b/reactos/dll/cpl/odbccp32/odbccp32.rbuild index 936757b69a1..dd83b376c35 100644 --- a/reactos/dll/cpl/odbccp32/odbccp32.rbuild +++ b/reactos/dll/cpl/odbccp32/odbccp32.rbuild @@ -6,7 +6,6 @@ kernel32 user32 comctl32 - msvcrt odbccp32.c odbccp32.rc diff --git a/reactos/dll/cpl/powercfg/powercfg.rbuild b/reactos/dll/cpl/powercfg/powercfg.rbuild index 7e8308ef119..0a9509b7a1b 100644 --- a/reactos/dll/cpl/powercfg/powercfg.rbuild +++ b/reactos/dll/cpl/powercfg/powercfg.rbuild @@ -9,7 +9,6 @@ powrprof comctl32 shell32 - msvcrt advapi32 powercfg.c powershemes.c diff --git a/reactos/dll/cpl/sysdm/sysdm.rbuild b/reactos/dll/cpl/sysdm/sysdm.rbuild index 9b7583ae4b2..58f0f5c2b5a 100644 --- a/reactos/dll/cpl/sysdm/sysdm.rbuild +++ b/reactos/dll/cpl/sysdm/sysdm.rbuild @@ -6,11 +6,9 @@ kernel32 advapi32 setupapi - msvcrt user32 gdi32 comctl32 - ntdll msimg32 shell32 shlwapi diff --git a/reactos/dll/cpl/telephon/telephon.rbuild b/reactos/dll/cpl/telephon/telephon.rbuild index 35746b11ae4..788c7f5f8a5 100644 --- a/reactos/dll/cpl/telephon/telephon.rbuild +++ b/reactos/dll/cpl/telephon/telephon.rbuild @@ -7,7 +7,6 @@ advapi32 user32 comctl32 - msvcrt ole32 uuid shell32 diff --git a/reactos/dll/cpl/timedate/timedate.rbuild b/reactos/dll/cpl/timedate/timedate.rbuild index fdb6a4f917a..90dfca7b9f6 100644 --- a/reactos/dll/cpl/timedate/timedate.rbuild +++ b/reactos/dll/cpl/timedate/timedate.rbuild @@ -10,7 +10,6 @@ comctl32 ws2_32 iphlpapi - msvcrt clock.c dateandtime.c internettime.c diff --git a/reactos/dll/cpl/usrmgr/usrmgr.rbuild b/reactos/dll/cpl/usrmgr/usrmgr.rbuild index f7850c26b8c..8026fd993a2 100644 --- a/reactos/dll/cpl/usrmgr/usrmgr.rbuild +++ b/reactos/dll/cpl/usrmgr/usrmgr.rbuild @@ -10,7 +10,6 @@ comctl32 ntdll netapi32 - msvcrt extra.c groupprops.c groups.c diff --git a/reactos/dll/directx/ddraw/ddraw.rbuild b/reactos/dll/directx/ddraw/ddraw.rbuild index 267522c91e2..19b965b4ee3 100644 --- a/reactos/dll/directx/ddraw/ddraw.rbuild +++ b/reactos/dll/directx/ddraw/ddraw.rbuild @@ -11,7 +11,6 @@ ole32 user32 advapi32 - msvcrt pseh ddraw.rc diff --git a/reactos/dll/directx/dsound/dsound.rbuild b/reactos/dll/directx/dsound/dsound.rbuild index fc12b199477..6370a01090d 100644 --- a/reactos/dll/directx/dsound/dsound.rbuild +++ b/reactos/dll/directx/dsound/dsound.rbuild @@ -14,7 +14,6 @@ ole32 winmm dxguid - msvcrt version.rc buffer.c capture.c diff --git a/reactos/dll/directx/wine/wined3d/wined3d.rbuild b/reactos/dll/directx/wine/wined3d/wined3d.rbuild index 67e7e44b481..ac972254a58 100644 --- a/reactos/dll/directx/wine/wined3d/wined3d.rbuild +++ b/reactos/dll/directx/wine/wined3d/wined3d.rbuild @@ -14,7 +14,6 @@ advapi32 kernel32 uuid - msvcrt ati_fragment_shader.c arb_program_shader.c diff --git a/reactos/dll/nls/idndl_redist/idndl_redist.rbuild b/reactos/dll/nls/idndl_redist/idndl_redist.rbuild index 2f4fc4b6f7f..b5826dcf817 100644 --- a/reactos/dll/nls/idndl_redist/idndl_redist.rbuild +++ b/reactos/dll/nls/idndl_redist/idndl_redist.rbuild @@ -1,9 +1,8 @@ - + kernel32 scripts - libcntpr -fno-exceptions -fno-rtti --entry=0 diff --git a/reactos/dll/nls/normaliz_redist/normaliz_redist.rbuild b/reactos/dll/nls/normaliz_redist/normaliz_redist.rbuild index f25c82280f2..2876cc0602a 100644 --- a/reactos/dll/nls/normaliz_redist/normaliz_redist.rbuild +++ b/reactos/dll/nls/normaliz_redist/normaliz_redist.rbuild @@ -4,11 +4,10 @@ icu/source/common icudt38.c - + normalize idna normaliz_redist_data - libcntpr kernel32 -fno-exceptions -fno-rtti diff --git a/reactos/dll/ntdll/ntdll.rbuild b/reactos/dll/ntdll/ntdll.rbuild index 4ad11dfb570..124e2e4c84b 100644 --- a/reactos/dll/ntdll/ntdll.rbuild +++ b/reactos/dll/ntdll/ntdll.rbuild @@ -1,7 +1,10 @@ - + + + + include @@ -54,4 +57,4 @@ ntdll.rc - \ No newline at end of file + diff --git a/reactos/dll/shellext/deskadp/deskadp.rbuild b/reactos/dll/shellext/deskadp/deskadp.rbuild index edb177e2ea8..bb4d4265836 100644 --- a/reactos/dll/shellext/deskadp/deskadp.rbuild +++ b/reactos/dll/shellext/deskadp/deskadp.rbuild @@ -8,7 +8,6 @@ comctl32 ole32 uuid - msvcrt deskadp.c shxiface.c deskadp.rc diff --git a/reactos/dll/shellext/deskmon/deskmon.rbuild b/reactos/dll/shellext/deskmon/deskmon.rbuild index d453121a2ec..36252dc14ab 100644 --- a/reactos/dll/shellext/deskmon/deskmon.rbuild +++ b/reactos/dll/shellext/deskmon/deskmon.rbuild @@ -8,7 +8,6 @@ comctl32 ole32 uuid - msvcrt deskmon.c shxiface.c deskmon.rc diff --git a/reactos/dll/shellext/fontext/fontext.rbuild b/reactos/dll/shellext/fontext/fontext.rbuild index 715fc3080ad..5418840f553 100644 --- a/reactos/dll/shellext/fontext/fontext.rbuild +++ b/reactos/dll/shellext/fontext/fontext.rbuild @@ -7,7 +7,6 @@ gdi32 ole32 uuid - msvcrt shlwapi lz32 advapi32 diff --git a/reactos/dll/win32/crtdll/crtdll.rbuild b/reactos/dll/win32/crtdll/crtdll.rbuild index 54baeeb3569..435f2dd820e 100644 --- a/reactos/dll/win32/crtdll/crtdll.rbuild +++ b/reactos/dll/win32/crtdll/crtdll.rbuild @@ -1,4 +1,4 @@ - + . include diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild index 7ad4a4d46b2..716259251f6 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild @@ -4,7 +4,6 @@ ntdll kernel32 - msvcrt ws2_32 iphlpapi dhcpcsvc.c diff --git a/reactos/dll/win32/dnsapi/dnsapi.rbuild b/reactos/dll/win32/dnsapi/dnsapi.rbuild index a1fbb53ffdf..ad4b273d6d7 100644 --- a/reactos/dll/win32/dnsapi/dnsapi.rbuild +++ b/reactos/dll/win32/dnsapi/dnsapi.rbuild @@ -9,7 +9,6 @@ ntdll kernel32 user32 - msvcrt ws2_32 iphlpapi diff --git a/reactos/dll/win32/glu32/glu32.rbuild b/reactos/dll/win32/glu32/glu32.rbuild index 3ce372d13ba..4668301fc52 100644 --- a/reactos/dll/win32/glu32/glu32.rbuild +++ b/reactos/dll/win32/glu32/glu32.rbuild @@ -14,7 +14,6 @@ opengl32 kernel32 gdi32 - msvcrt bezierEval.cc diff --git a/reactos/dll/win32/icmp/icmp.rbuild b/reactos/dll/win32/icmp/icmp.rbuild index a7ee1600414..8da93de7a01 100644 --- a/reactos/dll/win32/icmp/icmp.rbuild +++ b/reactos/dll/win32/icmp/icmp.rbuild @@ -6,7 +6,6 @@ kernel32 ws2_32 wine - msvcrt icmp_main.c icmp.rc icmp.spec diff --git a/reactos/dll/win32/msvcrt/msvcrt.rbuild b/reactos/dll/win32/msvcrt/msvcrt.rbuild index f97ffc876ed..d77c9685dd5 100644 --- a/reactos/dll/win32/msvcrt/msvcrt.rbuild +++ b/reactos/dll/win32/msvcrt/msvcrt.rbuild @@ -1,4 +1,4 @@ - + . include diff --git a/reactos/dll/win32/msvcrt20/msvcrt20.rbuild b/reactos/dll/win32/msvcrt20/msvcrt20.rbuild index f33a67a1ecd..c6e51ab78fa 100644 --- a/reactos/dll/win32/msvcrt20/msvcrt20.rbuild +++ b/reactos/dll/win32/msvcrt20/msvcrt20.rbuild @@ -1,7 +1,7 @@ - + . include/reactos/wine diff --git a/reactos/dll/win32/msvcrt40/msvcrt40.rbuild b/reactos/dll/win32/msvcrt40/msvcrt40.rbuild index 200942afad0..c8432e06523 100644 --- a/reactos/dll/win32/msvcrt40/msvcrt40.rbuild +++ b/reactos/dll/win32/msvcrt40/msvcrt40.rbuild @@ -1,7 +1,7 @@ - + . include/reactos/wine diff --git a/reactos/dll/win32/user32/windows/font.c b/reactos/dll/win32/user32/windows/font.c index 941fdfba9d9..906325c15e1 100644 --- a/reactos/dll/win32/user32/windows/font.c +++ b/reactos/dll/win32/user32/windows/font.c @@ -34,7 +34,17 @@ /* 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: xadvapi32 user32 winmm - msvcrt midimap.c midimap.rc diff --git a/reactos/dll/win32/ws2_32/include/ws2_32.h b/reactos/dll/win32/ws2_32/include/ws2_32.h index f495fa1ef07..169fcc0deb2 100644 --- a/reactos/dll/win32/ws2_32/include/ws2_32.h +++ b/reactos/dll/win32/ws2_32/include/ws2_32.h @@ -7,6 +7,8 @@ #ifndef __WS2_32_H #define __WS2_32_H +#include + #define WIN32_NO_STATUS #include #include @@ -21,10 +23,6 @@ #include #include // 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; diff --git a/reactos/drivers/video/displays/framebuf/framebuf.rbuild b/reactos/drivers/video/displays/framebuf/framebuf.rbuild index e3733500153..5dcb2f06832 100644 --- a/reactos/drivers/video/displays/framebuf/framebuf.rbuild +++ b/reactos/drivers/video/displays/framebuf/framebuf.rbuild @@ -1,10 +1,9 @@ - + . win32k - libcntpr enable.c palette.c pointer.c diff --git a/reactos/drivers/video/displays/framebufacc/framebufacc.rbuild b/reactos/drivers/video/displays/framebufacc/framebufacc.rbuild index bfc08f00751..5db42b294fc 100644 --- a/reactos/drivers/video/displays/framebufacc/framebufacc.rbuild +++ b/reactos/drivers/video/displays/framebufacc/framebufacc.rbuild @@ -1,10 +1,9 @@ - + . win32k - libcntpr enable.c palette.c pointer.c diff --git a/reactos/drivers/video/displays/vga/vgaddi.rbuild b/reactos/drivers/video/displays/vga/vgaddi.rbuild index 9b2b2ee0f6e..35479f8657e 100644 --- a/reactos/drivers/video/displays/vga/vgaddi.rbuild +++ b/reactos/drivers/video/displays/vga/vgaddi.rbuild @@ -1,9 +1,8 @@ - + . - libcntpr win32k enable.c diff --git a/reactos/include/crt/_mingw.h b/reactos/include/crt/_mingw.h index dd0e13d5c46..ec8b672b07d 100644 --- a/reactos/include/crt/_mingw.h +++ b/reactos/include/crt/_mingw.h @@ -51,25 +51,43 @@ /* 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 @@ -82,8 +100,14 @@ # 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__)) @@ -106,6 +130,15 @@ # 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__) @@ -116,10 +149,20 @@ #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__ @@ -139,14 +182,32 @@ #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 @@ -163,35 +224,28 @@ #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 diff --git a/reactos/include/crt/ctype.h b/reactos/include/crt/ctype.h index 44a932bcb3f..c5e587025a1 100644 --- a/reactos/include/crt/ctype.h +++ b/reactos/include/crt/ctype.h @@ -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); diff --git a/reactos/include/crt/stdio.h b/reactos/include/crt/stdio.h index b32edaf8da3..375fbc5af06 100644 --- a/reactos/include/crt/stdio.h +++ b/reactos/include/crt/stdio.h @@ -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 /* diff --git a/reactos/include/crt/wctype.h b/reactos/include/crt/wctype.h index 57f61f71d43..731967df79a 100644 --- a/reactos/include/crt/wctype.h +++ b/reactos/include/crt/wctype.h @@ -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 diff --git a/reactos/include/psdk/winternl.h b/reactos/include/psdk/winternl.h index f58fc899dc0..7868b035251 100644 --- a/reactos/include/psdk/winternl.h +++ b/reactos/include/psdk/winternl.h @@ -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"); } diff --git a/reactos/include/reactos/wine/config.h b/reactos/include/reactos/wine/config.h index cc9c0777c3b..e4f02e7c2dd 100644 --- a/reactos/include/reactos/wine/config.h +++ b/reactos/include/reactos/wine/config.h @@ -797,7 +797,7 @@ #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 */ diff --git a/reactos/include/reactos/wine/unicode.h b/reactos/include/reactos/wine/unicode.h index dea64cd477a..44f09885305 100644 --- a/reactos/include/reactos/wine/unicode.h +++ b/reactos/include/reactos/wine/unicode.h @@ -2,6 +2,8 @@ #define _WINE_UNICODE_H #include +#include +#include #include #include @@ -53,12 +55,6 @@ #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; diff --git a/reactos/lib/3rdparty/adns/adns.rbuild b/reactos/lib/3rdparty/adns/adns.rbuild index 7a0ce2d4c14..700cf8ae1e1 100644 --- a/reactos/lib/3rdparty/adns/adns.rbuild +++ b/reactos/lib/3rdparty/adns/adns.rbuild @@ -1,6 +1,6 @@ - + src adns_win32 diff --git a/reactos/lib/3rdparty/libxml2/libxml2.rbuild b/reactos/lib/3rdparty/libxml2/libxml2.rbuild index 60ba9d42d09..822f8b59729 100644 --- a/reactos/lib/3rdparty/libxml2/libxml2.rbuild +++ b/reactos/lib/3rdparty/libxml2/libxml2.rbuild @@ -1,6 +1,6 @@ - + diff --git a/reactos/lib/3rdparty/mingw/mingw.rbuild b/reactos/lib/3rdparty/mingw/mingw.rbuild index c901f39f1aa..dab45dc1792 100644 --- a/reactos/lib/3rdparty/mingw/mingw.rbuild +++ b/reactos/lib/3rdparty/mingw/mingw.rbuild @@ -1,7 +1,7 @@ - + include cpu_features.c @@ -19,19 +19,19 @@ pseudo-reloc.c - + include binmode.c crt1.c main.c - + include wbinmode.c wcrt1.c wmain.c - + include dllcrt1.c diff --git a/reactos/subsystems/win32/csrss/csrss.rbuild b/reactos/subsystems/win32/csrss/csrss.rbuild index c7fd856ee48..56a6724646d 100644 --- a/reactos/subsystems/win32/csrss/csrss.rbuild +++ b/reactos/subsystems/win32/csrss/csrss.rbuild @@ -9,7 +9,6 @@ nt ntdll smdll - msvcrt handle.c process.c diff --git a/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild b/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild index e0033909c66..ba304e447d4 100644 --- a/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild +++ b/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild @@ -15,8 +15,6 @@ advapi32 win32ksys psapi - msvcrt - psapi shell32 w32csr.h alias.c diff --git a/reactos/subsystems/win32/win32k/win32k.rbuild b/reactos/subsystems/win32/win32k/win32k.rbuild index 5dd14c6504e..0173e4701fa 100644 --- a/reactos/subsystems/win32/win32k/win32k.rbuild +++ b/reactos/subsystems/win32/win32k/win32k.rbuild @@ -184,12 +184,11 @@ stubs.c - + win32k_base pseh ntoskrnl - libcntpr hal freetype dxguid diff --git a/reactos/tools/nci/nci.mak b/reactos/tools/nci/nci.mak index fb08ebe79d4..d2480c0409f 100644 --- a/reactos/tools/nci/nci.mak +++ b/reactos/tools/nci/nci.mak @@ -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: diff --git a/reactos/tools/nci/ncitool.c b/reactos/tools/nci/ncitool.c index bed88496c08..6a50fdf829b 100644 --- a/reactos/tools/nci/ncitool.c +++ b/reactos/tools/nci/ncitool.c @@ -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. * */ @@ -21,32 +21,35 @@ /* 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" \ @@ -119,24 +122,24 @@ /***** 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 ] 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 \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); diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 2d57389d04e..10afa360bb8 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -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 diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 3b73cdb8e76..fb26f719200 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -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 diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index d84ecc9059f..bdf2b52b429 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -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 { diff --git a/reactos/tools/rbuild/project.dtd b/reactos/tools/rbuild/project.dtd index 5411ce18646..a84dc9f357b 100644 --- a/reactos/tools/rbuild/project.dtd +++ b/reactos/tools/rbuild/project.dtd @@ -127,6 +127,8 @@ 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" > diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 3d87200ed4f..2629153d9af 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -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 ); };