From 168997c0d184ba0b27df3dfe9b3a2407dde11faf Mon Sep 17 00:00:00 2001 From: "KJK::Hyperion" Date: Sat, 25 Oct 2008 17:32:54 +0000 Subject: [PATCH] modified base/applications/screensavers/3dtext/3dtext.rbuild modified lib/sdk/crt/crt.rbuild Split chkstk away from crt Link 3dtext to chkstk for Visual C++ builds (a gcc-built 3dtext would simply crash, I guess?) modified dll/cpl/access/display.c modified dll/cpl/access/general.c modified dll/cpl/access/keyboard.c modified dll/cpl/access/mouse.c Fixed signedness violations (thank you cl -Wall -W4) modified dll/win32/acledit/acledit.rbuild modified dll/win32/aclui/aclui.rbuild Removed empty stubs (thank you cl -Wall -W4) modified dll/win32/aclui/checklist.c Fixed signedness violations wcsnicmp is not a standard C routine BOOL is not a boolean Thank you cl -Wall -W4 modified dll/win32/aclui/sidcache.c Marked possible overflow (thank you cl -Wall -W4) modified dll/win32/msvcrt/msvcrt.def __iob_func and __p_iob are the same thing Export non-conforming swprintf as _swprintf, too (will fix for real later) Thank you cl -Wall -W4 modified include/ddk/winddk.h Zero-length array field in struct _SCATTER_GATHER_LIST Forward-declare structures out of argument lists Thank you cl -Wall -W4 modified include/reactos/msvctarget.h No need to emulate Visual C++ flags when compiling with Visual C++ modified lib/3rdparty/mingw/cpu_features.c modified lib/3rdparty/mingw/cpu_features.h Useless dependency from stdbool.h removed Now compiles with Visual C++ too modified lib/3rdparty/mingw/getopt.c Silence harmless warning modified lib/3rdparty/mingw/isascii.c modified lib/3rdparty/mingw/iscsym.c modified lib/3rdparty/mingw/iscsymf.c modified lib/3rdparty/mingw/toascii.c Undefine conflicting macro names before declaring the functions modified Makefile Visual C++ support is coming, did you bring your coat? svn path=/trunk/; revision=36954 --- reactos/Makefile | 4 + .../screensavers/3dtext/3dtext.rbuild | 1 + reactos/dll/cpl/access/display.c | 2 +- reactos/dll/cpl/access/general.c | 2 +- reactos/dll/cpl/access/keyboard.c | 8 +- reactos/dll/cpl/access/mouse.c | 2 +- reactos/dll/win32/acledit/acledit.rbuild | 1 - reactos/dll/win32/aclui/aclui.rbuild | 1 - reactos/dll/win32/aclui/checklist.c | 10 +-- reactos/dll/win32/msvcrt/msvcrt.def | 4 +- reactos/include/ddk/winddk.h | 17 +++-- reactos/include/reactos/msvctarget.h | 2 + reactos/lib/3rdparty/mingw/cpu_features.c | 73 ++++++++++++++++--- reactos/lib/3rdparty/mingw/cpu_features.h | 2 - reactos/lib/3rdparty/mingw/getopt.c | 2 +- reactos/lib/3rdparty/mingw/isascii.c | 4 + reactos/lib/3rdparty/mingw/iscsym.c | 4 + reactos/lib/3rdparty/mingw/iscsymf.c | 4 + reactos/lib/3rdparty/mingw/toascii.c | 3 + reactos/lib/sdk/crt/crt.rbuild | 18 ++++- 20 files changed, 127 insertions(+), 37 deletions(-) diff --git a/reactos/Makefile b/reactos/Makefile index be31071b129..84b25040413 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -215,6 +215,7 @@ ifeq ($(HALFVERBOSEECHO),yes) ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE) ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE) ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE) + ECHO_CL =@echo $(QUOTE)[CL] $<$(QUOTE) ECHO_GAS =@echo $(QUOTE)[GAS] $<$(QUOTE) ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE) ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE) @@ -224,6 +225,7 @@ ifeq ($(HALFVERBOSEECHO),yes) ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE) ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL] $@$(QUOTE) ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE) + ECHO_LINK =@echo $(QUOTE)[LINK] $@$(QUOTE) ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE) ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE) ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE) @@ -309,6 +311,8 @@ objcopy = $(Q)$(PREFIX_)objcopy dlltool = $(Q)$(PREFIX_)dlltool strip = $(Q)$(PREFIX_)strip windres = $(Q)$(PREFIX_)windres +cl = $(Q)cl -nologo +link = $(Q)link -nologo # Set utilities ifeq ($(OSTYPE),msys) diff --git a/reactos/base/applications/screensavers/3dtext/3dtext.rbuild b/reactos/base/applications/screensavers/3dtext/3dtext.rbuild index b228be584f9..8ecece679f9 100644 --- a/reactos/base/applications/screensavers/3dtext/3dtext.rbuild +++ b/reactos/base/applications/screensavers/3dtext/3dtext.rbuild @@ -2,6 +2,7 @@ scrnsave + chkstk kernel32 user32 gdi32 diff --git a/reactos/dll/cpl/access/display.c b/reactos/dll/cpl/access/display.c index e2ca3556473..d4b6279550f 100644 --- a/reactos/dll/cpl/access/display.c +++ b/reactos/dll/cpl/access/display.c @@ -87,7 +87,7 @@ HighContrastDlgProc(HWND hwndDlg, SendDlgItemMessage(hwndDlg, IDC_CONTRAST_COMBO, CB_SELECTSTRING, - -1, + (WPARAM)-1, (LPARAM)pGlobalData->highContrast.lpszDefaultScheme); break; diff --git a/reactos/dll/cpl/access/general.c b/reactos/dll/cpl/access/general.c index 6b7fdaaba39..b55cea6a0c8 100644 --- a/reactos/dll/cpl/access/general.c +++ b/reactos/dll/cpl/access/general.c @@ -19,7 +19,7 @@ #define BAUDTICKS 6 -static INT nBaudArray[BAUDTICKS] = {300, 1200, 2400, 4800, 9600, 19200}; +static UINT nBaudArray[BAUDTICKS] = {300, 1200, 2400, 4800, 9600, 19200}; INT_PTR CALLBACK diff --git a/reactos/dll/cpl/access/keyboard.c b/reactos/dll/cpl/access/keyboard.c index 29ba6e58cf3..90451eadb8f 100644 --- a/reactos/dll/cpl/access/keyboard.c +++ b/reactos/dll/cpl/access/keyboard.c @@ -19,16 +19,16 @@ #define BOUNCETICKS 5 -static INT nBounceArray[BOUNCETICKS] = {500, 700, 1000, 1500, 2000}; +static UINT nBounceArray[BOUNCETICKS] = {500, 700, 1000, 1500, 2000}; #define DELAYTICKS 5 -static INT nDelayArray[DELAYTICKS] = {300, 700, 1000, 1500, 2000}; +static UINT nDelayArray[DELAYTICKS] = {300, 700, 1000, 1500, 2000}; #define REPEATTICKS 6 -static INT nRepeatArray[REPEATTICKS] = {300, 500, 700, 1000, 1500, 2000}; +static UINT nRepeatArray[REPEATTICKS] = {300, 500, 700, 1000, 1500, 2000}; #define WAITTICKS 10 -static INT nWaitArray[WAITTICKS] = {0, 300, 500, 700, 1000, 1500, 2000, 5000, 10000, 20000}; +static UINT nWaitArray[WAITTICKS] = {0, 300, 500, 700, 1000, 1500, 2000, 5000, 10000, 20000}; static VOID diff --git a/reactos/dll/cpl/access/mouse.c b/reactos/dll/cpl/access/mouse.c index 56e21694627..fb4e20938eb 100644 --- a/reactos/dll/cpl/access/mouse.c +++ b/reactos/dll/cpl/access/mouse.c @@ -20,7 +20,7 @@ #define SPEEDTICKS 9 #define ACCELTICKS 9 -static INT nSpeedArray[SPEEDTICKS] = {10, 20, 30, 40, 60, 80, 120, 180, 360}; +static UINT nSpeedArray[SPEEDTICKS] = {10, 20, 30, 40, 60, 80, 120, 180, 360}; INT_PTR CALLBACK diff --git a/reactos/dll/win32/acledit/acledit.rbuild b/reactos/dll/win32/acledit/acledit.rbuild index 047b0aceea9..b82383a76d5 100644 --- a/reactos/dll/win32/acledit/acledit.rbuild +++ b/reactos/dll/win32/acledit/acledit.rbuild @@ -11,5 +11,4 @@ acledit.c stubs.c acledit.rc - acledit.spec diff --git a/reactos/dll/win32/aclui/aclui.rbuild b/reactos/dll/win32/aclui/aclui.rbuild index d15b3817a31..6da5cc1080c 100644 --- a/reactos/dll/win32/aclui/aclui.rbuild +++ b/reactos/dll/win32/aclui/aclui.rbuild @@ -17,6 +17,5 @@ misc.c sidcache.c aclui.rc - aclui.spec precomp.h diff --git a/reactos/dll/win32/aclui/checklist.c b/reactos/dll/win32/aclui/checklist.c index b4a1274b9fb..e4aea80db95 100644 --- a/reactos/dll/win32/aclui/checklist.c +++ b/reactos/dll/win32/aclui/checklist.c @@ -153,12 +153,12 @@ FindCheckItemByIndex(IN PCHECKLISTWND infoPtr, return Found; } -static UINT +static INT FindCheckItemIndexByAccessMask(IN PCHECKLISTWND infoPtr, IN ACCESS_MASK AccessMask) { PCHECKITEM Item; - UINT Index = 0, Found = -1; + INT Index = 0, Found = -1; for (Item = infoPtr->CheckItemListHead; Item != NULL; @@ -208,7 +208,7 @@ FindCheckItem(IN PCHECKLISTWND infoPtr, CurItem = CurItem->Next) { if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED && - !wcsnicmp(CurItem->Name, + !_wcsnicmp(CurItem->Name, SearchText, Count)) { break; @@ -1569,7 +1569,7 @@ CheckListWndProc(IN HWND hwnd, { PCHECKITEM PtItem; UINT PtItemBox; - BOOL OldPushed; + UINT OldPushed; PtItem = PtToCheckItemBox(infoPtr, &pt, @@ -2137,7 +2137,7 @@ CheckListWndProc(IN HWND hwnd, (infoPtr->QuickSearchHitItem == NULL || infoPtr->QuickSearchHitItem == infoPtr->FocusedCheckItem)) { - BOOL OldPushed = infoPtr->FocusedPushed; + UINT OldPushed = infoPtr->FocusedPushed; infoPtr->FocusedPushed = TRUE; if (infoPtr->FocusedPushed != OldPushed) diff --git a/reactos/dll/win32/msvcrt/msvcrt.def b/reactos/dll/win32/msvcrt/msvcrt.def index 977477266da..95b1a925ffd 100644 --- a/reactos/dll/win32/msvcrt/msvcrt.def +++ b/reactos/dll/win32/msvcrt/msvcrt.def @@ -120,7 +120,7 @@ EXPORTS __fpecode @115 __getmainargs @116 __initenv @117 -; __iob_func @118 + __iob_func=__p__iob @118 __isascii @119 __iscsym @120 __iscsymf @121 @@ -846,3 +846,5 @@ EXPORTS wctomb @840 wprintf @841 wscanf @842 + + _swprintf=swprintf diff --git a/reactos/include/ddk/winddk.h b/reactos/include/ddk/winddk.h index 5ec2b440c9d..4ca8657f051 100644 --- a/reactos/include/ddk/winddk.h +++ b/reactos/include/ddk/winddk.h @@ -749,11 +749,11 @@ typedef struct _KUSER_SHARED_DATA typedef enum _IO_PAGING_PRIORITY { - IoPagingPriorityInvalid, - IoPagingPriorityNormal, - IoPagingPriorityHigh, - IoPagingPriorityReserved1, - IoPagingPriorityReserved2 + IoPagingPriorityInvalid, + IoPagingPriorityNormal, + IoPagingPriorityHigh, + IoPagingPriorityReserved1, + IoPagingPriorityReserved2 } IO_PAGING_PRIORITY; typedef enum _IO_ALLOCATION_ACTION { @@ -2362,7 +2362,7 @@ typedef struct _SCATTER_GATHER_ELEMENT { typedef struct _SCATTER_GATHER_LIST { ULONG NumberOfElements; ULONG_PTR Reserved; - SCATTER_GATHER_ELEMENT Elements[0]; + SCATTER_GATHER_ELEMENT Elements[1]; } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST; typedef struct _MDL { @@ -2763,6 +2763,7 @@ typedef enum _KD_OPTION { } KD_OPTION; /* Function Type Defintions for Dispatch Functions */ +struct _DEVICE_CONTROL_CONTEXT; typedef VOID (DDKAPI *PDEVICE_CONTROL_COMPLETION)( @@ -4441,6 +4442,8 @@ typedef struct _RTL_BITMAP_RUN { ULONG NumberOfBits; } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN; +struct _RTL_RANGE; + typedef BOOLEAN (NTAPI *PRTL_CONFLICT_RANGE_CALLBACK) ( PVOID Context, @@ -4806,6 +4809,8 @@ typedef enum _KBUGCHECK_CALLBACK_REASON { KbCallbackDumpIo, } KBUGCHECK_CALLBACK_REASON; +struct _KBUGCHECK_REASON_CALLBACK_RECORD; + typedef VOID (DDKAPI *PKBUGCHECK_REASON_CALLBACK_ROUTINE)( IN KBUGCHECK_CALLBACK_REASON Reason, diff --git a/reactos/include/reactos/msvctarget.h b/reactos/include/reactos/msvctarget.h index 2366279f9db..9514d907455 100644 --- a/reactos/include/reactos/msvctarget.h +++ b/reactos/include/reactos/msvctarget.h @@ -1,3 +1,4 @@ +#ifndef _MSC_VER #ifndef __GNUC__ #error Unsupported compiler #endif @@ -15,3 +16,4 @@ #elif defined(__i386__) && !defined(_M_IX86) #define _M_IX86 300 #endif +#endif diff --git a/reactos/lib/3rdparty/mingw/cpu_features.c b/reactos/lib/3rdparty/mingw/cpu_features.c index cc901d77f50..32983e11f24 100644 --- a/reactos/lib/3rdparty/mingw/cpu_features.c +++ b/reactos/lib/3rdparty/mingw/cpu_features.c @@ -1,6 +1,9 @@ -#include #include "cpu_features.h" +#if defined(_MSC_VER) +#include +#endif + /* level 1 edx bits */ #define EDX_CX8 (1 << 8) /* CMPXCHG8B */ #define EDX_CMOV (1 << 15) @@ -18,28 +21,76 @@ #define EDX_3DNOWP (1 << 30) #define EDX_LM (1 << 29) /*LONG MODE */ -#define __cpuid(level,a,b,c,d) \ - __asm__ __volatile__ ("cpuid;" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d)\ - : "0" (level)) - /* Combine the different cpuid flags into a single bitmap. */ unsigned int __cpu_features = 0; -void __cpu_features_init (void) -{ #ifdef __i386__ - unsigned int eax, ebx, ecx, edx; - /* Try to change the value of CPUID bit (bit 21) in EFLAGS. +#if defined(__GNUC__) +#define __cpuid(level,a,b,c,d) \ + __asm__ __volatile__ ("cpuid;" \ + : "=a" (a), "=b" (b), "=c" (c), "=d" (d)\ + : "0" (level)) +#elif defined(_MSC_VER) +void ___cpuid (int level, unsigned int * a, unsigned int * b, unsigned int * c, unsigned int * d) +{ + int info[4]; + + __cpuid (info, level); + + *a = info[0]; + *b = info[1]; + *c = info[2]; + *d = info[3]; +} +#define __cpuid(level,a,b,c,d) \ + ___cpuid(level, &(a), &(b), &(c), &(d)) +#endif + +static +unsigned int __detect_cpuid (void) +{ + /* Try to change the value of CPUID bit (bit 21) in EFLAGS. If the bit can be toggled, CPUID is supported. */ +#if defined(__GNUC__) + unsigned int eax, ebx; asm volatile ("pushfl; pushfl; popl %0;" "movl %0,%1; xorl %2,%0;" "pushl %0; popfl; pushfl; popl %0; popfl" : "=&r" (eax), "=&r" (ebx) : "i" (0x00200000)); - if (((eax ^ ebx) & 0x00200000) == 0) + return ((eax ^ ebx) & 0x00200000; +#elif defined(_MSC_VER) + unsigned int retval; + + __asm + { + pushf + pushf + pop eax + mov ebx, eax + xor eax, 00200000h + push eax + popf + pushf + pop eax + popf + xor eax, ebx + mov [retval], eax + } + + return retval & 0x00200000; +#endif +} +#endif + +void __cpu_features_init (void) +{ +#ifdef __i386__ + unsigned int eax, ebx, ecx, edx; + + if (!__detect_cpuid ()) return; __cpuid (0, eax, ebx, ecx, edx); diff --git a/reactos/lib/3rdparty/mingw/cpu_features.h b/reactos/lib/3rdparty/mingw/cpu_features.h index 64318574776..594a1fe76c8 100644 --- a/reactos/lib/3rdparty/mingw/cpu_features.h +++ b/reactos/lib/3rdparty/mingw/cpu_features.h @@ -1,8 +1,6 @@ #ifndef _CPU_FEATURES_H #define _CPU_FEATURES_H -#include - #define _CRT_CMPXCHG8B 0x0001 #define _CRT_CMOV 0x0002 #define _CRT_MMX 0x0004 diff --git a/reactos/lib/3rdparty/mingw/getopt.c b/reactos/lib/3rdparty/mingw/getopt.c index 1b520d90801..82ef52e9673 100644 --- a/reactos/lib/3rdparty/mingw/getopt.c +++ b/reactos/lib/3rdparty/mingw/getopt.c @@ -82,7 +82,7 @@ int _tgetopt(int argc, _TCHAR * const argv[], const _TCHAR * optstring) ++ s_nArgChar; /* unrecognized option */ - if((_toptopt == _T(':')) || ((pcOptChar = _tcschr(optstring, _toptopt)) == NULL)) + if((_toptopt == _T(':')) || ((pcOptChar = _tcschr(optstring, (_TCHAR)_toptopt)) == NULL)) { /* print an error message */ if(_topterr && optstring[0] != _T(':')) diff --git a/reactos/lib/3rdparty/mingw/isascii.c b/reactos/lib/3rdparty/mingw/isascii.c index 9d3385c3f01..8a0db89ac62 100644 --- a/reactos/lib/3rdparty/mingw/isascii.c +++ b/reactos/lib/3rdparty/mingw/isascii.c @@ -13,6 +13,10 @@ #include +#ifdef isascii +#undef isascii +#endif + int isascii (int c) { diff --git a/reactos/lib/3rdparty/mingw/iscsym.c b/reactos/lib/3rdparty/mingw/iscsym.c index ea9a571ac18..7f3fd80eaaa 100644 --- a/reactos/lib/3rdparty/mingw/iscsym.c +++ b/reactos/lib/3rdparty/mingw/iscsym.c @@ -13,6 +13,10 @@ #include +#ifdef iscsym +#undef iscsym +#endif + int iscsym (int c) { diff --git a/reactos/lib/3rdparty/mingw/iscsymf.c b/reactos/lib/3rdparty/mingw/iscsymf.c index 6afde993e6a..96a3310e5ca 100644 --- a/reactos/lib/3rdparty/mingw/iscsymf.c +++ b/reactos/lib/3rdparty/mingw/iscsymf.c @@ -13,6 +13,10 @@ #include +#ifdef iscsymf +#undef iscsymf +#endif + int iscsymf (int c) { diff --git a/reactos/lib/3rdparty/mingw/toascii.c b/reactos/lib/3rdparty/mingw/toascii.c index be9f2f50bd5..2253f0072ee 100644 --- a/reactos/lib/3rdparty/mingw/toascii.c +++ b/reactos/lib/3rdparty/mingw/toascii.c @@ -13,6 +13,9 @@ #include +#ifdef toascii +#undef toascii +#endif int toascii (int c) diff --git a/reactos/lib/sdk/crt/crt.rbuild b/reactos/lib/sdk/crt/crt.rbuild index a0350674978..c6734d71b88 100644 --- a/reactos/lib/sdk/crt/crt.rbuild +++ b/reactos/lib/sdk/crt/crt.rbuild @@ -1,6 +1,22 @@ + + + + + chkstk_asm.s + + + + + chkstk_asm.s + + + + + + chkstk . include @@ -43,7 +59,6 @@ matherr.c - chkstk_asm.s prolog.s seh.s unwind.c @@ -52,7 +67,6 @@ seh.s - chkstk_asm.s xcptfil.c