From 558496bca6e2838fc5575cd4732764f17683498c Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Sat, 3 Nov 2001 16:48:07 +0000 Subject: [PATCH] New target 'implib' to avoid cicular references. Integrate WINE into the build system. svn path=/trunk/; revision=2349 --- reactos/.cvsignore | 1 + reactos/Makefile | 186 +++++++-- reactos/apps/tests/lpc/makefile | 4 +- reactos/apps/tests/mstest/Makefile | 4 +- reactos/apps/tests/nptest/Makefile | 4 +- reactos/apps/tests/shm/makefile | 4 +- reactos/apps/tests/test_old/makefile | 4 +- reactos/drivers/dd/vga/makefile | 6 +- reactos/include/napi/teb.h | 1 + reactos/include/wine/config.h | 547 +++++++++++++++++++++++++++ reactos/include/wine/debugtools.h | 115 ++++++ reactos/include/wine/wineros.h | 10 + reactos/lib/ntdll/dbg/winedbg.c | 247 ++++++++++++ reactos/lib/ntdll/def/ntdll.def | 8 +- reactos/lib/ntdll/def/ntdll.edf | 8 +- reactos/lib/ntdll/makefile | 4 +- reactos/lib/user32/misc/stubs.c | 11 +- reactos/lib/user32/user32.def | 1 + reactos/ntoskrnl/Makefile | 10 +- reactos/rules.mak | 5 + reactos/tools/helper.mk | 111 ++++-- 21 files changed, 1210 insertions(+), 81 deletions(-) create mode 100644 reactos/include/wine/config.h create mode 100644 reactos/include/wine/debugtools.h create mode 100644 reactos/include/wine/wineros.h create mode 100644 reactos/lib/ntdll/dbg/winedbg.c diff --git a/reactos/.cvsignore b/reactos/.cvsignore index 02d7947c953..acfbf22b067 100644 --- a/reactos/.cvsignore +++ b/reactos/.cvsignore @@ -5,4 +5,5 @@ reactos *.dll *.a *.o +*.d *.coff diff --git a/reactos/Makefile b/reactos/Makefile index ac3f3f03637..d0d18312971 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -4,6 +4,15 @@ PATH_TO_TOP = . +# +# Define to build WINE modules +# +ifeq ($(ROS_BUILD_WINE),) +ROS_BUILD_WINE = no +else +ROS_BUILD_WINE = yes +endif + include $(PATH_TO_TOP)/rules.mak # @@ -13,7 +22,7 @@ COMPONENTS = iface_native iface_additional hallib ntoskrnl HALS = halx86 BUS = acpi isapnp pci DLLS = ntdll kernel32 advapi32 crtdll msvcrt fmifs gdi32 msafd \ - user32 oleaut32 secur32 shell32 ws2_32 version + user32 secur32 ws2_32 version SUBSYS = smss win32k csrss # @@ -64,17 +73,41 @@ APPS = args hello test cat bench apc shm lpc thread event file gditest \ #NET_APPS = ping roshttpd telnet NET_APPS = ping roshttpd +#lzexpand mapi32 (missing imports) +#dsound (missing winmm.dll) +WINE_DLLS = rpcrt4 ole32 oleaut32 oledlg olepro32 olecli olesvr \ + shell32 shlwapi comctl32 shfolder shdocvw commdlg \ + ddraw dinput dplay dplayx \ + psapi richedit serialui winspool + +WINE_PROGS = clock cmdlgtst control notepad osversioncheck \ + progman uninstaller view wcmd winemine \ + winver + +ifeq ($(ROS_BUILD_WINE),yes) +WINE_MODULES = $(WINE_DLLS) $(WINE_PROGS) +else +WINE_MODULES = +endif KERNEL_SERVICES = $(DEVICE_DRIVERS) $(INPUT_DRIVERS) $(FS_DRIVERS) \ $(NET_DRIVERS) $(NET_DEVICE_DRIVERS) $(STORAGE_DRIVERS) -all: tools dk $(COMPONENTS) $(HALS) $(BUS) $(DLLS) $(SUBSYS) \ - $(LOADERS) $(KERNEL_SERVICES) $(SYS_APPS) $(APPS) $(NET_APPS) +all: tools dk implib $(COMPONENTS) $(HALS) $(BUS) $(DLLS) $(SUBSYS) \ + $(LOADERS) $(KERNEL_SERVICES) $(SYS_APPS) $(APPS) $(NET_APPS) \ + $(WINE_MODULES) + +implib: $(COMPONENTS:%=%_implib) $(HALS:%=%_implib) $(BUS:%=%_implib) \ + $(DLLS:%=%_implib) $(LOADERS:%=%_implib) \ + $(KERNEL_SERVICES:%=%_implib) $(SUBSYS:%=%_implib) \ + $(SYS_APPS:%=%_implib) $(APPS:%=%_implib) \ + $(WINE_MODULES:%=%_implib) clean: dk_clean $(HALS:%=%_clean) \ $(COMPONENTS:%=%_clean) $(BUS:%=%_clean) $(DLLS:%=%_clean) \ $(LOADERS:%=%_clean) $(KERNEL_SERVICES:%=%_clean) $(SUBSYS:%=%_clean) \ - $(SYS_APPS:%=%_clean) $(APPS:%=%_clean) $(NET_APPS:%=%_clean) clean_after tools_clean + $(SYS_APPS:%=%_clean) $(APPS:%=%_clean) $(NET_APPS:%=%_clean) \ + $(WINE_MODULES:%=%_clean) clean_after tools_clean clean_after: $(RM) $(PATH_TO_TOP)/include/roscfg.h @@ -83,14 +116,16 @@ install: tools install_dirs install_before \ $(COMPONENTS:%=%_install) $(HALS:%=%_install) $(BUS:%=%_install) \ $(DLLS:%=%_install) $(LOADERS:%=%_install) \ $(KERNEL_SERVICES:%=%_install) $(SUBSYS:%=%_install) \ - $(SYS_APPS:%=%_install) $(APPS:%=%_install) + $(SYS_APPS:%=%_install) $(APPS:%=%_install) \ + $(WINE_MODULES:%=%_install) dist: $(TOOLS_PATH)/rcopy$(EXE_POSTFIX) dist_clean dist_dirs \ $(HALS:%=%_dist) $(COMPONENTS:%=%_dist) $(BUS:%=%_dist) $(DLLS:%=%_dist) \ $(LOADERS:%=%_dist) $(KERNEL_SERVICES:%=%_dist) $(SUBSYS:%=%_dist) \ - $(SYS_APPS:%=%_dist) $(APPS:%=%_dist) $(NET_APPS:%=%_dist) + $(SYS_APPS:%=%_dist) $(APPS:%=%_dist) $(NET_APPS:%=%_dist) \ + $(WINE_MODULES:%=%_dist) -.PHONY: all clean clean_before install dist +.PHONY: all implib clean clean_before install dist # # System Applications @@ -98,6 +133,9 @@ dist: $(TOOLS_PATH)/rcopy$(EXE_POSTFIX) dist_clean dist_dirs \ $(SYS_APPS): %: make -C apps/system/$* +$(SYS_APPS:%=%_implib): %_implib: + make -C apps/system/$* implib + $(SYS_APPS:%=%_clean): %_clean: make -C apps/system/$* clean @@ -107,7 +145,7 @@ $(SYS_APPS:%=%_dist): %_dist: $(SYS_APPS:%=%_install): %_install: make -C apps/system/$* install -.PHONY: $(SYS_APPS) $(SYS_APPS:%=%_clean) $(SYS_APPS:%=%_install) $(SYS_APPS:%=%_dist) +.PHONY: $(SYS_APPS) $(SYS_APPS:%=%_implib) $(SYS_APPS:%=%_clean) $(SYS_APPS:%=%_install) $(SYS_APPS:%=%_dist) # # Applications @@ -115,6 +153,9 @@ $(SYS_APPS:%=%_install): %_install: $(APPS): %: make -C apps/$* +$(APPS:%=%_implib): %_implib: + make -C apps/$* implib + $(APPS:%=%_clean): %_clean: make -C apps/$* clean @@ -124,7 +165,7 @@ $(APPS:%=%_dist): %_dist: $(APPS:%=%_install): %_install: make -C apps/$* install -.PHONY: $(APPS) $(APPS:%=%_clean) $(APPS:%=%_install) $(APPS:%=%_dist) +.PHONY: $(APPS) $(APPS:%=%_implib) $(APPS:%=%_clean) $(APPS:%=%_install) $(APPS:%=%_dist) # # Network applications @@ -132,6 +173,9 @@ $(APPS:%=%_install): %_install: $(NET_APPS): %: make -C apps/net/$* +$(NET_APPS:%=%_implib): %_implib: + make -C apps/net/$* implib + $(NET_APPS:%=%_clean): %_clean: make -C apps/net/$* clean @@ -141,7 +185,49 @@ $(NET_APPS:%=%_dist): %_dist: $(NET_APPS:%=%_install): %_install: make -C apps/net/$* install -.PHONY: $(NET_APPS) $(NET_APPS:%=%_clean) $(NET_APPS:%=%_install) $(NET_APPS:%=%_dist) +.PHONY: $(NET_APPS) $(NET_APPS:%=%_implib) $(NET_APPS:%=%_clean) $(NET_APPS:%=%_install) $(NET_APPS:%=%_dist) + + +# +# Wine DLLs +# +$(WINE_DLLS): %: + make -f makefile.ros -C $(WINE_PATH)/dlls/$* + +$(WINE_DLLS:%=%_implib): %_implib: + make -f makefile.ros -C $(WINE_PATH)/dlls/$* implib + +$(WINE_DLLS:%=%_clean): %_clean: + make -f makefile.ros -C $(WINE_PATH)/dlls/$* clean + +$(WINE_DLLS:%=%_dist): %_dist: + make -f makefile.ros -C $(WINE_PATH)/dlls/$* dist + +$(WINE_DLLS:%=%_install): %_install: + make -f makefile.ros -C $(WINE_PATH)/dlls/$* install + +.PHONY: $(WINE_DLLS) $(WINE_DLLS:%=%_implib) $(WINE_DLLS:%=%_clean) $(WINE_DLLS:%=%_install) $(WINE_DLLS:%=%_dist) + + +# +# Wine programs +# +$(WINE_PROGS): %: + make -f makefile.ros -C $(WINE_PATH)/programs/$* + +$(WINE_PROGS:%=%_implib): %_implib: + make -f makefile.ros -C $(WINE_PATH)/programs/$* implib + +$(WINE_PROGS:%=%_clean): %_clean: + make -f makefile.ros -C $(WINE_PATH)/programs/$* clean + +$(WINE_PROGS:%=%_dist): %_dist: + make -f makefile.ros -C $(WINE_PATH)/programs/$* dist + +$(WINE_PROGS:%=%_install): %_install: + make -f makefile.ros -C $(WINE_PATH)/programs/$* install + +.PHONY: $(WINE_PROGS) $(WINE_PROGS:%=%_implib) $(WINE_PROGS:%=%_clean) $(WINE_PROGS:%=%_install) $(WINE_PROGS:%=%_dist) # @@ -150,6 +236,8 @@ $(NET_APPS:%=%_install): %_install: tools: make -C tools +tools_implib: + tools_clean: make -C tools clean @@ -157,7 +245,7 @@ tools_install: tools_dist: -.PHONY: tools tools_clean tools_install tools_dist +.PHONY: tools tools_implib tools_clean tools_install tools_dist # @@ -175,6 +263,8 @@ dk: $(RMKDIR) $(XDK_PATH_LIB) $(RMKDIR) $(XDK_PATH_INC) +dk_implib: + # WARNING! Be very sure that there are no important files # in these directories before cleaning them!!! dk_clean: @@ -195,7 +285,7 @@ dk_install: dk_dist: -.PHONY: dk dk_clean dk_install dk_dist +.PHONY: dk dk_implib dk_clean dk_install dk_dist # @@ -204,6 +294,8 @@ dk_dist: iface_native: make -C iface/native +iface_native_implib: + iface_native_clean: make -C iface/native clean @@ -214,6 +306,8 @@ iface_native_dist: iface_additional: make -C iface/addsys +iface_additional_implib: + iface_additional_clean: make -C iface/addsys clean @@ -221,10 +315,10 @@ iface_additional_install: iface_additional_dist: -.PHONY: iface_native iface_native_clean iface_native_install \ +.PHONY: iface_native iface_native_implib iface_native_clean iface_native_install \ iface_native_dist \ - iface_additional iface_additional_clean iface_additional_install \ - iface_additional_dist + iface_additional iface_additional_implib iface_additional_clean \ + iface_additional_install iface_additional_dist # # Bus driver rules @@ -232,6 +326,9 @@ iface_additional_dist: $(BUS): %: make -C services/bus/$* +$(BUS:%=%_implib): %_implib: + make -C services/bus/$* implib + $(BUS:%=%_clean): %_clean: make -C services/bus/$* clean @@ -241,7 +338,7 @@ $(BUS:%=%_install): %_install: $(BUS:%=%_dist): %_dist: make -C services/bus/$* dist -.PHONY: $(BUS) $(BUS:%=%_clean) \ +.PHONY: $(BUS) $(BUS:%=%_implib) $(BUS:%=%_clean) \ $(BUS:%=%_install) $(BUS:%=%_dist) # @@ -250,6 +347,9 @@ $(BUS:%=%_dist): %_dist: $(DEVICE_DRIVERS): %: make -C services/dd/$* +$(DEVICE_DRIVERS:%=%_implib): %_implib: + make -C services/dd/$* implib + $(DEVICE_DRIVERS:%=%_clean): %_clean: make -C services/dd/$* clean @@ -259,7 +359,7 @@ $(DEVICE_DRIVERS:%=%_install): %_install: $(DEVICE_DRIVERS:%=%_dist): %_dist: make -C services/dd/$* dist -.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_clean) \ +.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_implib) $(DEVICE_DRIVERS:%=%_clean) \ $(DEVICE_DRIVERS:%=%_install) $(DEVICE_DRIVERS:%=%_dist) # @@ -268,6 +368,9 @@ $(DEVICE_DRIVERS:%=%_dist): %_dist: $(INPUT_DRIVERS): %: make -C services/input/$* +$(INPUT_DRIVERS:%=%_implib): %_implib: + make -C services/input/$* implib + $(INPUT_DRIVERS:%=%_clean): %_clean: make -C services/input/$* clean @@ -277,12 +380,15 @@ $(INPUT_DRIVERS:%=%_install): %_install: $(INPUT_DRIVERS:%=%_dist): %_dist: make -C services/input/$* dist -.PHONY: $(INPUT_DRIVERS) $(INPUT_DRIVERS:%=%_clean) \ +.PHONY: $(INPUT_DRIVERS) $(INPUT_DRIVERS:%=%_implib) $(INPUT_DRIVERS:%=%_clean)\ $(INPUT_DRIVERS:%=%_install) $(INPUT_DRIVERS:%=%_dist) $(FS_DRIVERS): %: make -C services/fs/$* +$(FS_DRIVERS:%=%_implib): %_implib: + make -C services/fs/$* implib + $(FS_DRIVERS:%=%_clean): %_clean: make -C services/fs/$* clean @@ -292,7 +398,7 @@ $(FS_DRIVERS:%=%_install): %_install: $(FS_DRIVERS:%=%_dist): %_dist: make -C services/fs/$* dist -.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_clean) \ +.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_implib) $(FS_DRIVERS:%=%_clean) \ $(FS_DRIVERS:%=%_install) $(FS_DRIVERS:%=%_dist) # @@ -301,6 +407,9 @@ $(FS_DRIVERS:%=%_dist): %_dist: $(NET_DRIVERS): %: make -C services/net/$* +$(NET_DRIVERS:%=%_implib): %_implib: + make -C services/net/$* implib + $(NET_DRIVERS:%=%_clean): %_clean: make -C services/net/$* clean @@ -310,12 +419,15 @@ $(NET_DRIVERS:%=%_install): %_install: $(NET_DRIVERS:%=%_dist): %_dist: make -C services/net/$* dist -.PHONY: $(NET_DRIVERS) $(NET_DRIVERS:%=%_clean) \ +.PHONY: $(NET_DRIVERS) $(NET_DRIVERS:%=%_implib) $(NET_DRIVERS:%=%_clean) \ $(NET_DRIVERS:%=%_install) $(NET_DRIVERS:%=%_dist) $(NET_DEVICE_DRIVERS): %: make -C services/net/dd/$* +$(NET_DEVICE_DRIVERS:%=%_implib): %_implib: + make -C services/net/dd/$* implib + $(NET_DEVICE_DRIVERS:%=%_clean): %_clean: make -C services/net/dd/$* clean @@ -325,7 +437,7 @@ $(NET_DEVICE_DRIVERS:%=%_install): %_install: $(NET_DEVICE_DRIVERS:%=%_dist): %_dist: make -C services/net/dd/$* dist -.PHONY: $(NET_DEVICE_DRIVERS) $(NET_DEVICE_DRIVERS:%=%_clean) \ +.PHONY: $(NET_DEVICE_DRIVERS) $(NET_DEVICE_DRIVERS:%=%_clean) $(NET_DEVICE_DRIVERS:%=%_implib) \ $(NET_DEVICE_DRIVERS:%=%_install) $(NET_DEVICE_DRIVERS:%=%_dist) # @@ -334,6 +446,9 @@ $(NET_DEVICE_DRIVERS:%=%_dist): %_dist: $(STORAGE_DRIVERS): %: make -C services/storage/$* +$(STORAGE_DRIVERS:%=%_implib): %_implib: + make -C services/storage/$* implib + $(STORAGE_DRIVERS:%=%_clean): %_clean: make -C services/storage/$* clean @@ -353,6 +468,8 @@ $(STORAGE_DRIVERS:%=%_dist): %_dist: $(LOADERS): %: make -C loaders/$* +$(LOADERS:%=%_implib): %_implib: + $(LOADERS:%=%_clean): %_clean: make -C loaders/$* clean @@ -362,7 +479,7 @@ $(LOADERS:%=%_install): %_install: $(LOADERS:%=%_dist): %_dist: make -C loaders/$* dist -.PHONY: $(LOADERS) $(LOADERS:%=%_clean) $(LOADERS:%=%_install) \ +.PHONY: $(LOADERS) $(LOADERS:%=%_implib) $(LOADERS:%=%_clean) $(LOADERS:%=%_install) \ $(LOADERS:%=%_dist) # @@ -372,6 +489,9 @@ $(LOADERS:%=%_dist): %_dist: ntoskrnl: make -C ntoskrnl +ntoskrnl_implib: + make -C ntoskrnl implib + ntoskrnl_clean: make -C ntoskrnl clean @@ -381,7 +501,7 @@ ntoskrnl_install: ntoskrnl_dist: make -C ntoskrnl dist -.PHONY: ntoskrnl ntoskrnl_clean ntoskrnl_install ntoskrnl_dist +.PHONY: ntoskrnl ntoskrnl_implib ntoskrnl_clean ntoskrnl_install ntoskrnl_dist # # Hardware Abstraction Layer import library @@ -390,6 +510,9 @@ ntoskrnl_dist: hallib: make -C hal/hal +hallib_implib: + make -C hal/hal implib + hallib_clean: make -C hal/hal clean @@ -399,7 +522,7 @@ hallib_install: hallib_dist: make -C hal/hal dist -.PHONY: hallib hallib_clean hallib_install hallib_dist +.PHONY: hallib hallib_implib hallib_clean hallib_install hallib_dist # # Hardware Abstraction Layers @@ -408,6 +531,9 @@ hallib_dist: $(HALS): %: make -C hal/$* +$(HALS:%=%_implib): %_implib: + make -C hal/$* implib + $(HALS:%=%_clean): %_clean: make -C hal/$* clean @@ -417,7 +543,7 @@ $(HALS:%=%_install): %_install: $(HALS:%=%_dist): %_dist: make -C hal/$* dist -.PHONY: $(HALS) $(HALS:%=%_clean) $(HALS:%=%_install) $(HALS:%=%_dist) +.PHONY: $(HALS) $(HALS:%=%_implib) $(HALS:%=%_clean) $(HALS:%=%_install) $(HALS:%=%_dist) # # Required DLLs @@ -426,6 +552,9 @@ $(HALS:%=%_dist): %_dist: $(DLLS): %: make -C lib/$* +$(DLLS:%=%_implib): %_implib: + make -C lib/$* implib + $(DLLS:%=%_clean): %_clean: make -C lib/$* clean @@ -435,7 +564,7 @@ $(DLLS:%=%_install): %_install: $(DLLS:%=%_dist): %_dist: make -C lib/$* dist -.PHONY: $(DLLS) $(DLLS:%=%_clean) $(DLLS:%=%_install) $(DLLS:%=%_dist) +.PHONY: $(DLLS) $(DLLS:%=%_implib) $(DLLS:%=%_clean) $(DLLS:%=%_install) $(DLLS:%=%_dist) # # Kernel Subsystems @@ -444,6 +573,9 @@ $(DLLS:%=%_dist): %_dist: $(SUBSYS): %: make -C subsys/$* +$(SUBSYS:%=%_implib): %_implib: + make -C subsys/$* implib + $(SUBSYS:%=%_clean): %_clean: make -C subsys/$* clean @@ -453,7 +585,7 @@ $(SUBSYS:%=%_install): %_install: $(SUBSYS:%=%_dist): %_dist: make -C subsys/$* dist -.PHONY: $(SUBSYS) $(SUBSYS:%=%_clean) $(SUBSYS:%=%_install) \ +.PHONY: $(SUBSYS) $(SUBSYS:%=%_implib) $(SUBSYS:%=%_clean) $(SUBSYS:%=%_install) \ $(SUBSYS:%=%_dist) # diff --git a/reactos/apps/tests/lpc/makefile b/reactos/apps/tests/lpc/makefile index 4f1e38a2bec..b566d2f861a 100644 --- a/reactos/apps/tests/lpc/makefile +++ b/reactos/apps/tests/lpc/makefile @@ -19,10 +19,12 @@ all: $(PROGS) .phony: all +implib: + clean: - $(RM) lpcsrv.o lpcsrv.exe lpcsrv.sym lpcclt.o lpcclt.exe lpcsrv.sym -.phony: clean +.phony: implib clean install: $(PROGS:%=$(INSTALL_DIR)/bin/%) diff --git a/reactos/apps/tests/mstest/Makefile b/reactos/apps/tests/mstest/Makefile index 9b5e7a83b09..c1bd1a0dbe1 100644 --- a/reactos/apps/tests/mstest/Makefile +++ b/reactos/apps/tests/mstest/Makefile @@ -19,10 +19,12 @@ all: $(PROGS) .phony: all +implib: + clean: - $(RM) *.o *.exe *.sym -.phony: clean +.phony: implib clean install: $(PROGS:%=$(INSTALL_DIR)/bin/%) diff --git a/reactos/apps/tests/nptest/Makefile b/reactos/apps/tests/nptest/Makefile index b714382deea..ab1542f42f3 100644 --- a/reactos/apps/tests/nptest/Makefile +++ b/reactos/apps/tests/nptest/Makefile @@ -18,10 +18,12 @@ all: $(PROGS) .phony: all +implib: + clean: - $(RM) *.o *.exe *.sym -.phony: clean +.phony: implib clean install: $(PROGS:%=$(INSTALL_DIR)/bin/%) diff --git a/reactos/apps/tests/shm/makefile b/reactos/apps/tests/shm/makefile index 1bb45f77e1e..33b3c9f2eb0 100644 --- a/reactos/apps/tests/shm/makefile +++ b/reactos/apps/tests/shm/makefile @@ -19,10 +19,12 @@ all: $(PROGS) .phony: all +implib: + clean: - $(RM) *.o *.exe *.sym -.phony: clean +.phony: implib clean install: $(PROGS:%=$(INSTALL_DIR)/bin/%) diff --git a/reactos/apps/tests/test_old/makefile b/reactos/apps/tests/test_old/makefile index fbf0ac8ec1b..45a68adaba9 100644 --- a/reactos/apps/tests/test_old/makefile +++ b/reactos/apps/tests/test_old/makefile @@ -10,10 +10,12 @@ all: $(PROGS:%=%.exe) .phony: all +implib: + clean: - $(RM) *.o *.exe *.sym -.phony: clean +.phony: implib clean install: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe) diff --git a/reactos/drivers/dd/vga/makefile b/reactos/drivers/dd/vga/makefile index 62478c60d76..89190cea372 100644 --- a/reactos/drivers/dd/vga/makefile +++ b/reactos/drivers/dd/vga/makefile @@ -1,9 +1,13 @@ -# $Id: makefile,v 1.9 2000/08/11 12:43:33 ekohl Exp $ +# $Id: makefile,v 1.10 2001/11/03 16:48:07 chorns Exp $ # # all: make -C display make -C miniport + +implib: + make -C display implib + make -C miniport implib clean: make -C display clean diff --git a/reactos/include/napi/teb.h b/reactos/include/napi/teb.h index f328253f72d..f877aae006a 100644 --- a/reactos/include/napi/teb.h +++ b/reactos/include/napi/teb.h @@ -211,6 +211,7 @@ typedef struct _TEB ULONG Spare4; // F7Ch PVOID ReservedForOle; // F80h ULONG WaitingOnLoaderLock; // F84h + PVOID WineDebugInfo; // Needed for WINE DLL's } TEB, *PTEB; diff --git a/reactos/include/wine/config.h b/reactos/include/wine/config.h new file mode 100644 index 00000000000..60f72312d5f --- /dev/null +++ b/reactos/include/wine/config.h @@ -0,0 +1,547 @@ +/* Wine configuration file for ReactOS */ + +#ifndef __REACTOS_WINE_CONFIG_H +#define __REACTOS_WINE_CONFIG_H + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* The number of bytes in a long long. */ +#undef SIZEOF_LONG_LONG + +/* Define if you have the __libc_fork function. */ +#undef HAVE___LIBC_FORK + +/* Define if you have the _lwp_create function. */ +#undef HAVE__LWP_CREATE + +/* Define if you have the clone function. */ +#undef HAVE_CLONE + +/* Define if you have the connect function. */ +#undef HAVE_CONNECT + +/* Define if you have the dlopen function. */ +#undef HAVE_DLOPEN + +/* Define if you have the ecvt function. */ +#undef HAVE_ECVT + +/* Define if you have the finite function. */ +#undef HAVE_FINITE + +/* Define if you have the fpclass function. */ +#undef HAVE_FPCLASS + +/* Define if you have the ftruncate64 function. */ +#undef HAVE_FTRUNCATE64 + +/* Define if you have the getbkgd function. */ +#undef HAVE_GETBKGD + +/* Define if you have the gethostbyname function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define if you have the getnetbyaddr function. */ +#undef HAVE_GETNETBYADDR + +/* Define if you have the getnetbyname function. */ +#undef HAVE_GETNETBYNAME + +/* Define if you have the getpagesize function. */ +#undef HAVE_GETPAGESIZE + +/* Define if you have the getprotobyname function. */ +#undef HAVE_GETPROTOBYNAME + +/* Define if you have the getprotobynumber function. */ +#undef HAVE_GETPROTOBYNUMBER + +/* Define if you have the getrlimit function. */ +#undef HAVE_GETRLIMIT + +/* Define if you have the getservbyport function. */ +#undef HAVE_GETSERVBYPORT + +/* Define if you have the getsockopt function. */ +#undef HAVE_GETSOCKOPT + +/* Define if you have the inet_network function. */ +#undef HAVE_INET_NETWORK + +/* Define if you have the iswalnum function. */ +#undef HAVE_ISWALNUM + +/* Define if you have the lseek64 function. */ +#undef HAVE_LSEEK64 + +/* Define if you have the lstat function. */ +#undef HAVE_LSTAT + +/* Define if you have the memmove function. */ +#undef HAVE_MEMMOVE + +/* Define if you have the mmap function. */ +#undef HAVE_MMAP + +/* Define if you have the openpty function. */ +#undef HAVE_OPENPTY + +/* Define if you have the resizeterm function. */ +#undef HAVE_RESIZETERM + +/* Define if you have the rfork function. */ +#undef HAVE_RFORK + +/* Define if you have the select function. */ +#undef HAVE_SELECT + +/* Define if you have the sendmsg function. */ +#undef HAVE_SENDMSG + +/* Define if you have the settimeofday function. */ +#undef HAVE_SETTIMEOFDAY + +/* Define if you have the sigaltstack function. */ +#undef HAVE_SIGALTSTACK + +/* Define if you have the statfs function. */ +#undef HAVE_STATFS + +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR + +/* Define if you have the strncasecmp function. */ +#undef HAVE_STRNCASECMP + +/* Define if you have the tcgetattr function. */ +#undef HAVE_TCGETATTR + +/* Define if you have the timegm function. */ +#undef HAVE_TIMEGM + +/* Define if you have the usleep function. */ +#undef HAVE_USLEEP + +/* Define if you have the vfscanf function. */ +#undef HAVE_VFSCANF + +/* Define if you have the wait4 function. */ +#undef HAVE_WAIT4 + +/* Define if you have the waitpid function. */ +#undef HAVE_WAITPID + +/* Define if you have the header file. */ +#undef HAVE_GL_GL_H + +/* Define if you have the header file. */ +#undef HAVE_GL_GLEXT_H + +/* Define if you have the header file. */ +#undef HAVE_GL_GLX_H + +/* Define if you have the header file. */ +#undef HAVE_X11_XKBLIB_H + +/* Define if you have the header file. */ +#undef HAVE_X11_XLIB_H + +/* Define if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XSHM_H + +/* Define if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XRENDER_H + +/* Define if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XVLIB_H + +/* Define if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_SHAPE_H + +/* Define if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XF86DGA_H + +/* Define if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XF86VMODE_H + +/* Define if you have the header file. */ +#undef HAVE_X11_XPM_H + +/* Define if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define if you have the header file. */ +#undef HAVE_ARPA_NAMESER_H + +/* Define if you have the header file. */ +#undef HAVE_CURSES_H + +/* Define if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define if you have the header file. */ +#undef HAVE_ELF_H + +/* Define if you have the header file. */ +#define HAVE_FLOAT_H + +/* Define if you have the header file. */ +#undef HAVE_FREETYPE_FREETYPE_H + +/* Define if you have the header file. */ +#undef HAVE_FREETYPE_FTGLYPH_H + +/* Define if you have the header file. */ +#undef HAVE_FREETYPE_FTNAMES_H + +/* Define if you have the header file. */ +#undef HAVE_FREETYPE_FTOUTLN_H + +/* Define if you have the header file. */ +#undef HAVE_FREETYPE_FTSNAMES_H + +/* Define if you have the header file. */ +#undef HAVE_FREETYPE_TTNAMEID_H + +/* Define if you have the header file. */ +#undef HAVE_FREETYPE_TTTABLES_H + +/* Define if you have the header file. */ +#undef HAVE_IEEEFP_H + +/* Define if you have the header file. */ +#undef HAVE_JPEGLIB_H + +/* Define if you have the header file. */ +#undef HAVE_LIBIO_H + +/* Define if you have the header file. */ +#undef HAVE_LIBUTIL_H + +/* Define if you have the header file. */ +#undef HAVE_LINK_H + +/* Define if you have the header file. */ +#undef HAVE_LINUX_CDROM_H + +/* Define if you have the header file. */ +#undef HAVE_LINUX_INPUT_H + +/* Define if you have the header file. */ +#undef HAVE_LINUX_JOYSTICK_H + +/* Define if you have the header file. */ +#undef HAVE_LINUX_UCDROM_H + +/* Define if you have the header file. */ +#undef HAVE_MACHINE_SOUNDCARD_H + +/* Define if you have the header file. */ +#undef HAVE_NCURSES_H + +/* Define if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define if you have the header file. */ +#undef HAVE_PTY_H + +/* Define if you have the header file. */ +#undef HAVE_RESOLV_H + +/* Define if you have the header file. */ +#undef HAVE_SCHED_H + +/* Define if you have the header file. */ +#undef HAVE_SOCKET_H + +/* Define if you have the header file. */ +#undef HAVE_SOUNDCARD_H + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_CDIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_ERRNO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_FILIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_IPC_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_LINK_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_LWP_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_MODEM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_MSG_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PTRACE_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_REG_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SHM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SIGNAL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOUNDCARD_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STATFS_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STRTIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SYSCALL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_USER_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_V86_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_V86INTR_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_VFS_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_VM86_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define if you have the header file. */ +#undef HAVE_SYSCALL_H + +/* Define if you have the header file. */ +#undef HAVE_UCONTEXT_H + +/* Define if you have the curses library (-lcurses). */ +#undef HAVE_LIBCURSES + +/* Define if you have the i386 library (-li386). */ +#undef HAVE_LIBI386 + +/* Define if you have the m library (-lm). */ +#undef HAVE_LIBM + +/* Define if you have the mmap library (-lmmap). */ +#undef HAVE_LIBMMAP + +/* Define if you have the ncurses library (-lncurses). */ +#undef HAVE_LIBNCURSES + +/* Define if you have the ossaudio library (-lossaudio). */ +#undef HAVE_LIBOSSAUDIO + +/* Define if you have the xpg4 library (-lxpg4). */ +#undef HAVE_LIBXPG4 + +/* Define if all debug messages are to be compiled out */ +#undef NO_DEBUG_MSGS + +/* Define if TRACE messages are to be compiled out */ +#undef NO_TRACE_MSGS + +/* Define if you have libjpeg including devel headers */ +#undef HAVE_LIBJPEG + +/* Define if you have the Xpm library */ +#undef HAVE_LIBXXPM + +/* Define if you have the XKB extension */ +#undef HAVE_XKB + +/* Define if you have the X Shm extension */ +#undef HAVE_LIBXXSHM + +/* Define if you have the X Shape extension */ +#undef HAVE_LIBXSHAPE + +/* Define if you have the Xxf86dga library version 2 */ +#undef HAVE_LIBXXF86DGA2 + +/* Define if you have the Xxf86dga library version 1 */ +#undef HAVE_LIBXXF86DGA + +/* Define if you have the Xxf86vm library */ +#undef HAVE_LIBXXF86VM + +/* Define if the X libraries support XVideo */ +#undef HAVE_XVIDEO + +/* Define if you have the XRender extension library */ +#undef HAVE_LIBXRENDER + +/* Define if OpenGL is present on the system */ +#undef HAVE_OPENGL + +/* Define if the OpenGL library supports the glXGetProcAddressARB call */ +#undef HAVE_GLX_GETPROCADDRESS + +/* Define if the OpenGL headers define extension typedefs */ +#undef HAVE_GLEXT_PROTOTYPES + +/* Define if we have CUPS */ +#undef HAVE_CUPS + +/* Define if FreeType 2 is installed */ +#undef HAVE_FREETYPE + +/* Define if we can use ppdev.h for parallel port access */ +#undef HAVE_PPDEV + +/* Define if IPX should use netipx/ipx.h from libc */ +#undef HAVE_IPX_GNU + +/* Define if IPX includes are taken from Linux kernel */ +#undef HAVE_IPX_LINUX + +/* Define if you have the Open Sound system */ +#undef HAVE_OSS + +/* Define if you have the Open Sound system (MIDI interface) */ +#undef HAVE_OSS_MIDI + +/* Set this to 64 to enable 64-bit file support on Linux */ +#undef _FILE_OFFSET_BITS + +/* Define if .type asm directive must be inside a .def directive */ +#undef NEED_TYPE_IN_DEF + +/* Define if symbols declared in assembly code need an underscore prefix */ +#undef NEED_UNDERSCORE_PREFIX + +/* Define to use .string instead of .ascii */ +#undef HAVE_ASM_STRING + +/* Define to the name of the function returning errno for reentrant libc */ +#undef ERRNO_LOCATION + +/* Define if X libraries are not reentrant (compiled without -D_REENTRANT) */ +#undef NO_REENTRANT_X11 + +/* Define if we have linux/input.h AND it contains the INPUT event API */ +#undef HAVE_CORRECT_LINUXINPUT_H + +/* Define if Linux-style gethostbyname_r and gethostbyaddr_r are available */ +#undef HAVE_LINUX_GETHOSTBYNAME_R_6 + +/* Define if defines the Linux 2.2 joystick API */ +#undef HAVE_LINUX_22_JOYSTICK_API + +/* Define if the struct statfs is defined by */ +#undef STATFS_DEFINED_BY_SYS_VFS + +/* Define if the struct statfs is defined by */ +#undef STATFS_DEFINED_BY_SYS_STATFS + +/* Define if the struct statfs is defined by */ +#undef STATFS_DEFINED_BY_SYS_MOUNT + +/* Define if the struct statfs has the member bfree */ +#undef STATFS_HAS_BFREE + +/* Define if the struct statfs has the member bavail */ +#undef STATFS_HAS_BAVAIL + +/* Define if struct msghdr contains msg_accrights */ +#undef HAVE_MSGHDR_ACCRIGHTS + +/* Define if struct sockaddr contains sa_len */ +#undef HAVE_SOCKADDR_SA_LEN + +/* Define if struct sockaddr_un contains sun_len */ +#undef HAVE_SOCKADDR_SUN_LEN + +#endif /* __REACTOS_WINE_CONFIG_H */ diff --git a/reactos/include/wine/debugtools.h b/reactos/include/wine/debugtools.h new file mode 100644 index 00000000000..64fcf0416ea --- /dev/null +++ b/reactos/include/wine/debugtools.h @@ -0,0 +1,115 @@ + +#ifndef __WINE_DEBUGTOOLS_H +#define __WINE_DEBUGTOOLS_H + +#ifndef __NTDLL__ + +#include +#include "config.h" +#include "windef.h" + +#else + +#include + +#endif __NTDLL__ + +struct _GUID; + +/* Internal definitions (do not use these directly) */ + +enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT }; + +#ifndef NO_TRACE_MSGS +# define __GET_DEBUGGING_TRACE(dbch) ((dbch)[0] & (1 << __DBCL_TRACE)) +#else +# define __GET_DEBUGGING_TRACE(dbch) 0 +#endif + +#ifndef NO_DEBUG_MSGS +# define __GET_DEBUGGING_WARN(dbch) ((dbch)[0] & (1 << __DBCL_WARN)) +# define __GET_DEBUGGING_FIXME(dbch) ((dbch)[0] & (1 << __DBCL_FIXME)) +#else +# define __GET_DEBUGGING_WARN(dbch) 0 +# define __GET_DEBUGGING_FIXME(dbch) 0 +#endif + +/* define error macro regardless of what is configured */ +#define __GET_DEBUGGING_ERR(dbch) ((dbch)[0] & (1 << __DBCL_ERR)) + +#define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING##dbcl(dbch) +#define __SET_DEBUGGING(dbcl,dbch,on) \ + ((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl)))) + +#ifdef __GNUC__ + +#define __DPRINTF(dbcl,dbch) \ + do { if(__GET_DEBUGGING(dbcl,(dbch))) { \ + const char * const __dbch = (dbch); \ + const enum __DEBUG_CLASS __dbcl = __DBCL##dbcl; \ + __WINE_DBG_LOG + +#define __WINE_DBG_LOG(args...) \ + wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0) + +#define __PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args))) + +#else /* __GNUC__ */ + +#define __DPRINTF(dbcl,dbch) \ + (!__GET_DEBUGGING(dbcl,(dbch)) || \ + (wine_dbg_log(__DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__),0)) ? \ + (void)0 : (void)wine_dbg_printf + +#define __PRINTF_ATTR(fmt, args) + +#endif /* __GNUC__ */ + +/* Exported definitions and macros */ + +/* These function return a printable version of a string, including + quotes. The string will be valid for some time, but not indefinitely + as strings are re-used. */ +extern const char *wine_dbgstr_an( const char * s, int n ); +extern const char *wine_dbgstr_wn( const WCHAR *s, int n ); +extern const char *wine_dbgstr_guid( const struct _GUID *id ); + +extern int wine_dbg_vprintf( const char *format, va_list args ) __PRINTF_ATTR(1,0); +extern int wine_dbg_printf( const char *format, ... ) __PRINTF_ATTR(1,2); +extern int wine_dbg_log( enum __DEBUG_CLASS cls, const char *ch, + const char *func, const char *format, ... ) __PRINTF_ATTR(4,5); + +inline static const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); } +inline static const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); } +inline static const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); } +inline static const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); } +inline static const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); } +inline static const char *debugres_a( const char *s ) { return wine_dbgstr_an( s, 80 ); } +inline static const char *debugres_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); } + +#define TRACE __DPRINTF(_TRACE,__wine_dbch___default) +#define TRACE_(ch) __DPRINTF(_TRACE,__wine_dbch_##ch) +#define TRACE_ON(ch) __GET_DEBUGGING(_TRACE,__wine_dbch_##ch) + +#define WARN __DPRINTF(_WARN,__wine_dbch___default) +#define WARN_(ch) __DPRINTF(_WARN,__wine_dbch_##ch) +#define WARN_ON(ch) __GET_DEBUGGING(_WARN,__wine_dbch_##ch) + +#define FIXME __DPRINTF(_FIXME,__wine_dbch___default) +#define FIXME_(ch) __DPRINTF(_FIXME,__wine_dbch_##ch) +#define FIXME_ON(ch) __GET_DEBUGGING(_FIXME,__wine_dbch_##ch) + +#undef ERR /* Solaris got an 'ERR' define in */ +#define ERR __DPRINTF(_ERR,__wine_dbch___default) +#define ERR_(ch) __DPRINTF(_ERR,__wine_dbch_##ch) +#define ERR_ON(ch) __GET_DEBUGGING(_ERR,__wine_dbch_##ch) + +#define DECLARE_DEBUG_CHANNEL(ch) \ + char __wine_dbch_##ch[1]; +#define DEFAULT_DEBUG_CHANNEL(ch) \ + char __wine_dbch_##ch[1]; static char * const __wine_dbch___default = __wine_dbch_##ch + +#define DPRINTF wine_dbg_printf +#define MESSAGE wine_dbg_printf + +#endif /* __WINE_DEBUGTOOLS_H */ diff --git a/reactos/include/wine/wineros.h b/reactos/include/wine/wineros.h new file mode 100644 index 00000000000..a0867087b63 --- /dev/null +++ b/reactos/include/wine/wineros.h @@ -0,0 +1,10 @@ +/* Wine wrapper for ReactOS */ +#ifndef __REACTOS_WINE_WINEROS_H +#define __REACTOS_WINE_WINEROS_H + +typedef unsigned short u_short; +typedef unsigned long u_long; + +#define FD_SETSIZE 64 + +#endif /* __REACTOS_WINE_WINEROS_H */ diff --git a/reactos/lib/ntdll/dbg/winedbg.c b/reactos/lib/ntdll/dbg/winedbg.c new file mode 100644 index 00000000000..5e953708d22 --- /dev/null +++ b/reactos/lib/ntdll/dbg/winedbg.c @@ -0,0 +1,247 @@ +/* + * Debugging functions for WINE + */ +#include +#include + +DECLARE_DEBUG_CHANNEL(tid); + +/* ---------------------------------------------------------------------- */ + +struct debug_info +{ + char *str_pos; /* current position in strings buffer */ + char *out_pos; /* current position in output buffer */ + char strings[1024]; /* buffer for temporary strings */ + char output[1024]; /* current output line */ +}; + +static struct debug_info tmp; + +/* get the debug info pointer for the current thread */ +static inline struct debug_info *get_info(void) +{ + struct debug_info *info = NtCurrentTeb()->WineDebugInfo; + if (!info) + { + if (!tmp.str_pos) + { + tmp.str_pos = tmp.strings; + tmp.out_pos = tmp.output; + } + if (!GetProcessHeap()) return &tmp; + /* setup the temp structure in case HeapAlloc wants to print something */ + NtCurrentTeb()->WineDebugInfo = &tmp; + info = HeapAlloc( GetProcessHeap(), 0, sizeof(*info) ); + info->str_pos = info->strings; + info->out_pos = info->output; + NtCurrentTeb()->WineDebugInfo = info; + } + return info; +} + +/* allocate some tmp space for a string */ +static void *gimme1(int n) +{ + struct debug_info *info = get_info(); + char *res = info->str_pos; + + if (res + n >= &info->strings[sizeof(info->strings)]) res = info->strings; + info->str_pos = res + n; + return res; +} + +/* release extra space that we requested in gimme1() */ +static inline void release( void *ptr ) +{ + struct debug_info *info = NtCurrentTeb()->WineDebugInfo; + info->str_pos = ptr; +} + +/*********************************************************************** + * wine_dbgstr_an (NTDLL.@) + */ +const char *wine_dbgstr_an( const char *src, int n ) +{ + char *dst, *res; + + if (!((WORD)(DWORD)(src) >> 16)) + { + if (!src) return "(null)"; + res = gimme1(6); + sprintf(res, "#%04x", (WORD)(DWORD)(src) ); + return res; + } + if (n < 0) n = 0; + else if (n > 200) n = 200; + dst = res = gimme1 (n * 4 + 6); + *dst++ = '"'; + while (n-- > 0 && *src) + { + unsigned char c = *src++; + switch (c) + { + case '\n': *dst++ = '\\'; *dst++ = 'n'; break; + case '\r': *dst++ = '\\'; *dst++ = 'r'; break; + case '\t': *dst++ = '\\'; *dst++ = 't'; break; + case '"': *dst++ = '\\'; *dst++ = '"'; break; + case '\\': *dst++ = '\\'; *dst++ = '\\'; break; + default: + if (c >= ' ' && c <= 126) + *dst++ = c; + else + { + *dst++ = '\\'; + *dst++ = '0' + ((c >> 6) & 7); + *dst++ = '0' + ((c >> 3) & 7); + *dst++ = '0' + ((c >> 0) & 7); + } + } + } + *dst++ = '"'; + if (*src) + { + *dst++ = '.'; + *dst++ = '.'; + *dst++ = '.'; + } + *dst++ = '\0'; + release( dst ); + return res; +} + +/*********************************************************************** + * wine_dbgstr_wn (NTDLL.@) + */ +const char *wine_dbgstr_wn( const WCHAR *src, int n ) +{ + char *dst, *res; + + if (!((WORD)(DWORD)(src) >> 16)) + { + if (!src) return "(null)"; + res = gimme1(6); + sprintf(res, "#%04x", (WORD)(DWORD)(src) ); + return res; + } + if (n < 0) n = 0; + else if (n > 200) n = 200; + dst = res = gimme1 (n * 5 + 7); + *dst++ = 'L'; + *dst++ = '"'; + while (n-- > 0 && *src) + { + WCHAR c = *src++; + switch (c) + { + case '\n': *dst++ = '\\'; *dst++ = 'n'; break; + case '\r': *dst++ = '\\'; *dst++ = 'r'; break; + case '\t': *dst++ = '\\'; *dst++ = 't'; break; + case '"': *dst++ = '\\'; *dst++ = '"'; break; + case '\\': *dst++ = '\\'; *dst++ = '\\'; break; + default: + if (c >= ' ' && c <= 126) + *dst++ = c; + else + { + *dst++ = '\\'; + sprintf(dst,"%04x",c); + dst+=4; + } + } + } + *dst++ = '"'; + if (*src) + { + *dst++ = '.'; + *dst++ = '.'; + *dst++ = '.'; + } + *dst++ = '\0'; + release( dst ); + return res; +} + +/*********************************************************************** + * wine_dbgstr_guid (NTDLL.@) + */ +const char *wine_dbgstr_guid( const GUID *id ) +{ + char *str; + + if (!id) return "(null)"; + if (!((WORD)(DWORD)(id) >> 16)) + { + str = gimme1(12); + sprintf( str, "", (WORD)(DWORD)(id) ); + } + else + { + str = gimme1(40); + sprintf( str, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + id->Data1, id->Data2, id->Data3, + id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3], + id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] ); + } + return str; +} + +/*********************************************************************** + * wine_dbg_vprintf (NTDLL.@) + */ +int wine_dbg_vprintf( const char *format, va_list args ) +{ + struct debug_info *info = get_info(); + char *p; + + int ret = _vsnprintf( info->out_pos, sizeof(info->output) - (info->out_pos - info->output), + format, args ); + + p = strrchr( info->out_pos, '\n' ); + if (!p) info->out_pos += ret; + else + { + char *pos = info->output; + p++; + write( 2, pos, p - pos ); + /* move beginning of next line to start of buffer */ + while ((*pos = *p++)) pos++; + info->out_pos = pos; + } + return ret; +} + +/*********************************************************************** + * wine_dbg_printf (NTDLL.@) + */ +int wine_dbg_printf(const char *format, ...) +{ + int ret; + va_list valist; + + va_start(valist, format); + ret = wine_dbg_vprintf( format, valist ); + va_end(valist); + return ret; +} + +/*********************************************************************** + * wine_dbg_log (NTDLL.@) + */ +int wine_dbg_log(enum __DEBUG_CLASS cls, const char *channel, + const char *function, const char *format, ... ) +{ + static const char *classes[__DBCL_COUNT] = { "fixme", "err", "warn", "trace" }; + va_list valist; + int ret = 0; + + va_start(valist, format); + if (TRACE_ON(tid)) + ret = wine_dbg_printf( "%08lx:", NtCurrentTeb()->Cid.UniqueThread); + if (cls < __DBCL_COUNT) + ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function ); + if (format) + ret += wine_dbg_vprintf( format, valist ); + va_end(valist); + return ret; +} diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index 3cb35cf4cbe..71bdba050b6 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -1,4 +1,4 @@ -; $Id: ntdll.def,v 1.79 2001/09/08 12:05:30 ekohl Exp $ +; $Id: ntdll.def,v 1.80 2001/11/03 16:48:06 chorns Exp $ ; ; ReactOS Operating System ; @@ -934,6 +934,12 @@ wcsstr wcstol wcstombs wcstoul +wine_dbgstr_an +wine_dbgstr_wn +wine_dbgstr_guid +wine_dbg_vprintf +wine_dbg_printf +wine_dbg_log InterlockedIncrement@4 InterlockedDecrement@4 InterlockedExchange@8 diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index aa998a8e912..7fc9125b7ec 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -1,4 +1,4 @@ -; $Id: ntdll.edf,v 1.68 2001/09/08 12:05:30 ekohl Exp $ +; $Id: ntdll.edf,v 1.69 2001/11/03 16:48:06 chorns Exp $ ; ; ReactOS Operating System ; @@ -937,4 +937,10 @@ wcsstr wcstol wcstombs wcstoul +wine_dbgstr_an +wine_dbgstr_wn +wine_dbgstr_guid +wine_dbg_vprintf +wine_dbg_printf +wine_dbg_log ;EOF diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index cfdcfd77b33..48f93880732 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.66 2001/09/23 22:14:09 chorns Exp $ +# $Id: makefile,v 1.67 2001/11/03 16:48:05 chorns Exp $ PATH_TO_TOP = ../.. @@ -22,7 +22,7 @@ TARGET_ENTRY = _LdrInitializeThunk@16 CSR_OBJECTS = csr/lpc.o csr/capture.o csr/probe.o csr/thread.o -DBG_OBJECTS = dbg/brkpoint.o dbg/debug.o dbg/print.o +DBG_OBJECTS = dbg/brkpoint.o dbg/debug.o dbg/print.o dbg/winedbg.o RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \ rtl/math.o rtl/mem.o rtl/nls.o rtl/process.o rtl/sd.o \ diff --git a/reactos/lib/user32/misc/stubs.c b/reactos/lib/user32/misc/stubs.c index 436abc081df..932262f9a2e 100644 --- a/reactos/lib/user32/misc/stubs.c +++ b/reactos/lib/user32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.5 2001/06/29 19:31:59 ekohl Exp $ +/* $Id: stubs.c,v 1.6 2001/11/03 16:48:06 chorns Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -2368,6 +2368,15 @@ GetSysColorBrush( return (HBRUSH)0; } +/* ReactOS extension */ +HPEN +STDCALL +GetSysColorPen( + int nIndex) +{ + return (HPEN)0; +} + HMENU STDCALL GetSystemMenu( diff --git a/reactos/lib/user32/user32.def b/reactos/lib/user32/user32.def index 5fb4d21851a..79bb26e747e 100644 --- a/reactos/lib/user32/user32.def +++ b/reactos/lib/user32/user32.def @@ -329,6 +329,7 @@ GetScrollRange@16 GetSubMenu@8 GetSysColor@4 GetSysColorBrush@4 +GetSysColorPen@4 ; ReactOS extension GetSystemMenu@8 GetSystemMetrics@4 GetTabbedTextExtentA@20 diff --git a/reactos/ntoskrnl/Makefile b/reactos/ntoskrnl/Makefile index f60ecd0d8c5..9a8b31dbedd 100644 --- a/reactos/ntoskrnl/Makefile +++ b/reactos/ntoskrnl/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.56 2001/10/10 22:08:27 hbirr Exp $ +# $Id: Makefile,v 1.57 2001/11/03 16:48:07 chorns Exp $ # # ReactOS Operating System # @@ -488,7 +488,7 @@ CLEAN_FILES = $(OBJECTS_PATH)/*.o cc/*.o cm/*.o dbg/*.o dbg/i386/*.o ex/*.o \ $(TARGETNAME).exe $(TARGETNAME).nostrip.exe $(TARGETNAME).sym \ $(TARGETNAME).coff $(DEP_FILES) -$(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(DDK_PATH_LIB)/$(TARGETNAME).a $(IE_DATA) +$(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(IE_DATA) $(CC) \ -Wl,-T,ntoskrnl.lnk \ -nostartfiles \ @@ -525,7 +525,7 @@ $(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(DDK_PATH_LIB)/$(TARGETNAME).a $(IE_ $(DDK_PATH_LIB)/hal.a - $(RM) temp.exp -$(TARGETNAME).exe: $(TARGETNAME).o $(DDK_PATH_LIB)/$(TARGETNAME).a $(LINKER_SCRIPT) $(DDK_PATH_LIB)/hal.a +$(TARGETNAME).exe: $(TARGETNAME).o $(LINKER_SCRIPT) $(DDK_PATH_LIB)/hal.a - $(CC) \ -Wl,-T,$(LINKER_SCRIPT) \ -nostartfiles \ @@ -611,8 +611,8 @@ $(TARGETNAME).o: $(OBJECTS) -o $(TARGETNAME).o \ $(OBJECTS) -$(DDK_PATH_LIB)/$(TARGETNAME).a: $(TARGETNAME).def - $(DLLTOOL) \ +implib: + - $(DLLTOOL) \ --dllname $(TARGETNAME).exe \ --def $(TARGETNAME).def \ --output-lib $(DDK_PATH_LIB)/$(TARGETNAME).a \ diff --git a/reactos/rules.mak b/reactos/rules.mak index 5be1fc32616..69acc7cf9b7 100644 --- a/reactos/rules.mak +++ b/reactos/rules.mak @@ -96,3 +96,8 @@ SDK_PATH_INC=$(PATH_TO_TOP)/include XDK_PATH=$(DK_PATH)/psx XDK_PATH_LIB=$(XDK_PATH)/lib XDK_PATH_INC=$(XDK_PATH)/include + +# Wine Integration +WINE_PATH=$(PATH_TO_TOP)/../wine +WINE_PATH_LIB=$(WINE_PATH)/lib +WINE_PATH_INC=$(WINE_PATH)/include diff --git a/reactos/tools/helper.mk b/reactos/tools/helper.mk index ba6f7edab81..8606ab23eb4 100644 --- a/reactos/tools/helper.mk +++ b/reactos/tools/helper.mk @@ -1,4 +1,4 @@ -# $Id: helper.mk,v 1.7 2001/09/01 11:55:38 dwelch Exp $ +# $Id: helper.mk,v 1.8 2001/11/03 16:48:07 chorns Exp $ # # Helper makefile for ReactOS modules # Variables this makefile accepts: @@ -30,6 +30,7 @@ # $TARGET_CPPFLAGS = G++ flags (optional) # $TARGET_ASFLAGS = GCC assembler flags (optional) # $TARGET_NFLAGS = NASM flags (optional) +# $TARGET_RCFLAGS = Windres flags (optional) # $TARGET_CLEAN = Files that are part of the clean rule (optional) # $TARGET_PATH = Relative path for *.def, *.edf, and *.rc (optional) # $TARGET_BASE = Default base address (optional) @@ -38,13 +39,14 @@ # $TARGET_NORC = Do not include standard resource file (no,yes) (optional) # $TARGET_LIBPATH = Destination path for import libraries (optional) # $TARGET_INSTALLDIR = Destination path when installed (optional) +# $WINE_MODE = Compile using WINE headers (no,yes) (optional) +# $WINE_RC = Name of .rc file for WINE modules (optional) ifeq ($(TARGET_PATH),) TARGET_PATH := . endif -# FIXME: MK_DEFENTRY may not be correct ifeq ($(TARGET_TYPE),program) MK_MODE := user MK_EXETYPE := exe @@ -52,15 +54,26 @@ ifeq ($(TARGET_TYPE),program) MK_DEFENTRY := _DEFINE_TARGET_APPTYPE MK_DDKLIBS := MK_SDKLIBS := +ifneq ($(WINE_MODE),yes) MK_CFLAGS := -I./ -I$(SDK_PATH_INC) MK_CPPFLAGS := -I./ -I$(SDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) +else + MK_CFLAGS := -I$(PATH_TO_TOP)/include/wine -I./ -I$(WINE_INCLUDE) + MK_CPPFLAGS := -I$(PATH_TO_TOP)/include/wine -I./ -I$(WINE_INCLUDE) + MK_RCFLAGS := --include-dir $(PATH_TO_TOP)/include/wine --include-dir $(WINE_INCLUDE) +endif MK_IMPLIB := no MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := MK_IMPLIB_EXT := .a MK_INSTALLDIR := bin MK_DISTDIR := apps - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff +ifeq ($(WINE_RC),) + MK_RES_BASE := $(TARGET_NAME) +else + MK_RES_BASE := $(WINE_RC) +endif endif ifeq ($(TARGET_TYPE),proglib) @@ -72,13 +85,14 @@ ifeq ($(TARGET_TYPE),proglib) MK_SDKLIBS := MK_CFLAGS := -I./ -I$(SDK_PATH_INC) MK_CPPFLAGS := -I./ -I$(SDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := yes MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := $(SDK_PATH_LIB) MK_IMPLIB_EXT := .a MK_INSTALLDIR := bin MK_DISTDIR := apps - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff + MK_RES_BASE := $(TARGET_NAME) endif ifeq ($(TARGET_TYPE),dynlink) @@ -88,15 +102,26 @@ ifeq ($(TARGET_TYPE),dynlink) MK_DEFENTRY := _DllMain@12 MK_DDKLIBS := MK_SDKLIBS := +ifneq ($(WINE_MODE),yes) MK_CFLAGS := -I./ -I$(SDK_PATH_INC) MK_CPPFLAGS := -I./ -I$(SDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) +else + MK_CFLAGS := -I$(PATH_TO_TOP)/include/wine -I./ -I$(WINE_INCLUDE) + MK_CPPFLAGS := -I$(PATH_TO_TOP)/include/wine -I./ -I$(WINE_INCLUDE) + MK_RCFLAGS := --include-dir $(PATH_TO_TOP)/include/wine --include-dir $(WINE_INCLUDE) +endif MK_IMPLIB := yes MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := $(SDK_PATH_LIB) MK_IMPLIB_EXT := .a MK_INSTALLDIR := system32 MK_DISTDIR := dlls - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff +ifeq ($(WINE_RC),) + MK_RES_BASE := $(TARGET_NAME) +else + MK_RES_BASE := $(WINE_RC) +endif endif ifeq ($(TARGET_TYPE),library) @@ -108,13 +133,14 @@ ifeq ($(TARGET_TYPE),library) MK_SDKLIBS := MK_CFLAGS := -I./ -I$(SDK_PATH_INC) MK_CPPFLAGS := -I./ -I$(SDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := no MK_IMPLIBONLY := yes MK_IMPLIBDEFPATH := $(SDK_PATH_LIB) MK_IMPLIB_EXT := .a MK_INSTALLDIR := $(SDK_PATH_INC) MK_DISTDIR := # FIXME - MK_RESOURCE := + MK_RES_BASE := endif ifeq ($(TARGET_TYPE),driver_library) @@ -126,13 +152,14 @@ ifeq ($(TARGET_TYPE),driver_library) MK_SDKLIBS := MK_CFLAGS := -I./ -I$(DDK_PATH_INC) MK_CPPFLAGS := -I./ -I$(DDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := no MK_IMPLIBONLY := yes MK_IMPLIBDEFPATH := $(DDK_PATH_LIB) MK_IMPLIB_EXT := .a MK_INSTALLDIR := $(DDK_PATH_INC) MK_DISTDIR := # FIXME - MK_RESOURCE := + MK_RES_BASE := endif ifeq ($(TARGET_TYPE),driver) @@ -144,13 +171,14 @@ ifeq ($(TARGET_TYPE),driver) MK_SDKLIBS := MK_CFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) MK_CPPFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := no MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := MK_IMPLIB_EXT := .a MK_INSTALLDIR := system32/drivers MK_DISTDIR := drivers - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff + MK_RES_BASE := $(TARGET_NAME) endif ifeq ($(TARGET_TYPE),export_driver) @@ -162,13 +190,14 @@ ifeq ($(TARGET_TYPE),export_driver) MK_SDKLIBS := MK_CFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) MK_CPPFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := yes MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := $(DDK_PATH_LIB) MK_IMPLIB_EXT := .a MK_INSTALLDIR := system32/drivers MK_DISTDIR := drivers - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff + MK_RES_BASE := $(TARGET_NAME) endif ifeq ($(TARGET_TYPE),hal) @@ -180,13 +209,14 @@ ifeq ($(TARGET_TYPE),hal) MK_SDKLIBS := MK_CFLAGS := -D__NTHAL__ -I./ -I$(DDK_PATH_INC) MK_CPPFLAGS := -D__NTHAL__ -I./ -I$(DDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := yes MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := MK_IMPLIB_EXT := .a MK_INSTALLDIR := system32 MK_DISTDIR := dlls - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff + MK_RES_BASE := $(TARGET_NAME) endif ifeq ($(TARGET_TYPE),bootpgm) @@ -198,13 +228,14 @@ ifeq ($(TARGET_TYPE),bootpgm) MK_SDKLIBS := MK_CFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) MK_CPPFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := no MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := MK_IMPLIB_EXT := .a MK_INSTALLDIR := system32 MK_DISTDIR := # FIXME - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff + MK_RES_BASE := $(TARGET_NAME) endif ifeq ($(TARGET_TYPE),miniport) @@ -216,13 +247,14 @@ ifeq ($(TARGET_TYPE),miniport) MK_SDKLIBS := MK_CFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) MK_CPPFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := no MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := MK_IMPLIB_EXT := .a MK_INSTALLDIR := system32/drivers MK_DISTDIR := drivers - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff + MK_RES_BASE := $(TARGET_NAME) endif ifeq ($(TARGET_TYPE),gdi_driver) @@ -230,25 +262,25 @@ ifeq ($(TARGET_TYPE),gdi_driver) MK_EXETYPE := dll MK_DEFEXT := .dll MK_DEFENTRY := _DrvEnableDriver@12 -# MK_DEFENTRY := _DriverEntry@8 MK_DDKLIBS := ntoskrnl.a hal.a win32k.a MK_SDKLIBS := MK_CFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) MK_CPPFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC) + MK_RCFLAGS := --include-dir $(SDK_PATH_INC) MK_IMPLIB := yes MK_IMPLIBONLY := no MK_IMPLIBDEFPATH := $(DDK_PATH_LIB) MK_IMPLIB_EXT := .a MK_INSTALLDIR := system32/drivers MK_DISTDIR := drivers - MK_RESOURCE := $(TARGET_PATH)/$(TARGET_NAME).coff + MK_RES_BASE := $(TARGET_NAME) endif ifeq ($(TARGET_TYPE),program) ifeq ($(TARGET_APPTYPE),windows) MK_DEFENTRY := _WinMainCRTStartup - MK_SDKLIBS := + MK_SDKLIBS := ntdll.a kernel32.a gdi32.a user32.a TARGET_LFLAGS += -Wl,--subsystem,windows endif @@ -266,6 +298,9 @@ ifeq ($(TARGET_TYPE),program) endif +MK_RESOURCE := $(MK_RES_BASE).coff + + ifneq ($(TARGET_INSTALLDIR),) MK_INSTALLDIR := $(TARGET_INSTALLDIR) endif @@ -293,7 +328,9 @@ endif ifeq ($(TARGET_NORC),yes) - MK_RESOURCE := + MK_FULLRES := +else + MK_FULLRES := $(TARGET_PATH)/$(MK_RESOURCE) endif @@ -344,6 +381,8 @@ TARGET_CFLAGS += -pipe -march=$(ARCH) TARGET_CPPFLAGS += $(MK_CPPFLAGS) TARGET_CPPFLAGS += -pipe -march=$(ARCH) +TARGET_RCFLAGS += $(MK_RCFLAGS) + TARGET_ASFLAGS += $(MK_ASFLAGS) TARGET_ASFLAGS += -pipe -march=$(ARCH) @@ -395,19 +434,13 @@ else MK_EXTRACMD2 := endif -$(MK_NOSTRIPNAME): $(MK_RESOURCE) $(TARGET_OBJECTS) $(MK_LIBS) -ifeq ($(MK_IMPLIB),yes) - $(DLLTOOL) --dllname $(MK_FULLNAME) \ - --def $(MK_DEFNAME) \ - --output-lib $(MK_IMPLIBPATH)/$(MK_BASENAME).a \ - --kill-at -endif +$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) ifeq ($(MK_EXETYPE),dll) $(CC) -Wl,--base-file,base.tmp \ -Wl,--entry,$(TARGET_ENTRY) \ $(TARGET_LFLAGS) \ -o junk.tmp $(MK_GCCLIBS) \ - $(MK_RESOURCE) $(MK_OBJECTS) $(MK_LIBS) + $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) - $(RM) junk.tmp $(DLLTOOL) --dllname $(MK_FULLNAME) \ --base-file base.tmp \ @@ -417,7 +450,7 @@ endif $(CC) $(TARGET_LFLAGS) \ -Wl,--entry,$(TARGET_ENTRY) $(MK_EXTRACMD2) \ -o $(MK_NOSTRIPNAME) $(MK_GCCLIBS) \ - $(MK_RESOURCE) $(MK_OBJECTS) $(MK_LIBS) + $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) - $(RM) temp.exp - $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).sym endif # KM_MODE @@ -431,19 +464,13 @@ else MK_EXTRACMD := endif -$(MK_NOSTRIPNAME): $(MK_RESOURCE) $(TARGET_OBJECTS) $(MK_LIBS) -ifeq ($(MK_IMPLIB),yes) - $(DLLTOOL) --dllname $(MK_FULLNAME) \ - --def $(MK_DEFNAME) \ - --output-lib $(MK_IMPLIBPATH)/$(MK_BASENAME).a \ - --kill-at -endif +$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) $(CC) -Wl,--base-file,base.tmp \ -Wl,--entry,$(TARGET_ENTRY) \ $(TARGET_LFLAGS) \ -nostartfiles -nostdlib \ -o junk.tmp $(MK_GCCLIBS) \ - $(MK_RESOURCE) $(MK_OBJECTS) $(MK_LIBS) + $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) - $(RM) junk.tmp $(DLLTOOL) --dllname $(MK_FULLNAME) \ --base-file base.tmp \ @@ -458,7 +485,7 @@ endif -Wl,temp.exp \ -mdll -nostartfiles -nostdlib \ -o $(MK_NOSTRIPNAME) $(MK_GCCLIBS) \ - $(MK_RESOURCE) $(MK_OBJECTS) $(MK_LIBS) + $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) - $(RM) temp.exp - $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).sym @@ -471,13 +498,21 @@ $(MK_FULLNAME): $(MK_NOSTRIPNAME) endif # MK_IMPLIBONLY -$(MK_RESOURCE): $(PATH_TO_TOP)/include/reactos/buildno.h $(TARGET_PATH)/$(TARGET_NAME).rc +$(MK_FULLRES): $(PATH_TO_TOP)/include/reactos/buildno.h $(TARGET_PATH)/$(MK_RES_BASE).rc + +implib: +ifeq ($(MK_IMPLIB),yes) + $(DLLTOOL) --dllname $(MK_FULLNAME) \ + --def $(MK_DEFNAME) \ + --output-lib $(MK_IMPLIBPATH)/$(MK_BASENAME).a \ + --kill-at +endif # Be carefull not to clean non-object files MK_CLEANFILES := $(filter %.o,$(MK_OBJECTS)) clean: - - $(RM) *.o $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(TARGET_NAME).coff \ + - $(RM) *.o $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(MK_RES_BASE).coff \ $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(MK_CLEANFILES) \ junk.tmp base.tmp temp.exp \ $(TARGET_CLEAN) @@ -515,7 +550,7 @@ $(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME): $(MK_FULLNAME) endif # MK_IMPLIBONLY -.phony: all clean install dist +.phony: all implib clean install dist %.o: %.c @@ -531,7 +566,7 @@ endif # MK_IMPLIBONLY %.o: %.asm $(NASM_CMD) $(TARGET_NFLAGS) $< -o $@ %.coff: %.rc - $(RC) $(RCINC) $< -o $@ + $(RC) $(TARGET_RCFLAGS) $(RCINC) $< -o $@ # Compatibility