From 513a12418df9103a2f0cc6d409101379a2b487b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Mon, 27 Aug 2007 09:32:52 +0000 Subject: [PATCH] Rely only on host headers (+ target ntstatus.h) to build mkhive svn path=/trunk/; revision=28596 --- reactos/include/reactos/typedefs_host.h | 105 ++++++++++++++++++++++++ reactos/lib/cmlib/cmlib.h | 13 ++- reactos/tools/mkhive/mkhive.h | 33 +++++--- reactos/tools/mkhive/mkhive.mak | 3 +- reactos/tools/mkhive/rtl.c | 6 +- 5 files changed, 138 insertions(+), 22 deletions(-) create mode 100644 reactos/include/reactos/typedefs_host.h diff --git a/reactos/include/reactos/typedefs_host.h b/reactos/include/reactos/typedefs_host.h new file mode 100644 index 00000000000..9342439e79c --- /dev/null +++ b/reactos/include/reactos/typedefs_host.h @@ -0,0 +1,105 @@ +/* + PROJECT: ReactOS + LICENSE: GPL v2 or any later version + FILE: include/reactos/typedefs_host.h + PURPOSE: Type definitions and useful macros for host tools + COPYRIGHT: Copyright 2007 Hervé Poussineau +*/ + +#ifndef _TYPEDEFS_HOST_H +#define _TYPEDEFS_HOST_H + +#include + +#define UNIMPLEMENTED { printf("%s unimplemented\n", __FUNCTION__); exit(1); } +#define ASSERT(x) { if (!(x)) { printf("ASSERT at %s:%d failed\n", __FILE__, __LINE__); exit(1); } } + +#define NTAPI __stdcall +#define WINAPI __stdcall + +#define IN +#define OUT +#define OPTIONAL + +#define FALSE 0 +#define TRUE (!(FALSE)) + +typedef void VOID, *PVOID, *HANDLE; +typedef HANDLE HKEY, *PHKEY; +typedef size_t SIZE_T, *PSIZE_T; +typedef unsigned char UCHAR, *PUCHAR, BYTE, *LPBYTE; +typedef char CHAR, *PCHAR, *PSTR; +typedef const char CCHAR; +typedef const char *PCSTR, *LPCSTR; +typedef short SHORT; +typedef unsigned short USHORT; +typedef unsigned int LONG, *PLONG; +typedef unsigned int ULONG, *PULONG, DWORD; +typedef long long LONGLONG; +typedef unsigned long long ULONGLONG; +typedef UCHAR BOOLEAN, *PBOOLEAN; +typedef int BOOL; +typedef int LONG_PTR, *PLONG_PTR; +typedef unsigned int ULONG_PTR, *PULONG_PTR; +typedef wchar_t WCHAR, *PWCHAR, *PWSTR, *LPWSTR; +typedef const wchar_t *PCWSTR, *LPCWSTR; +typedef int NTSTATUS; +typedef int POOL_TYPE; + +#define MAXUSHORT USHRT_MAX + +typedef struct _RTL_BITMAP +{ + ULONG SizeOfBitMap; + PULONG Buffer; +} RTL_BITMAP, *PRTL_BITMAP; + +typedef struct _RTL_BITMAP_RUN +{ + ULONG StartingIndex; + ULONG NumberOfBits; +} RTL_BITMAP_RUN, *PRTL_BITMAP_RUN; + +typedef union _LARGE_INTEGER +{ + struct + { + DWORD LowPart; + LONG HighPart; + } u; + LONGLONG QuadPart; +} LARGE_INTEGER, *PLARGE_INTEGER; + +typedef struct _LIST_ENTRY +{ + struct _LIST_ENTRY *Flink; + struct _LIST_ENTRY *Blink; +} LIST_ENTRY,*PLIST_ENTRY; + +typedef struct _ANSI_STRING +{ + USHORT Length; + USHORT MaximumLength; + PSTR Buffer; +} ANSI_STRING, *PANSI_STRING; + +typedef struct _UNICODE_STRING +{ + USHORT Length; + USHORT MaximumLength; + PWSTR Buffer; +} UNICODE_STRING, *PUNICODE_STRING; +typedef const UNICODE_STRING *PCUNICODE_STRING; + +#define NT_SUCCESS(x) ((x)>=0) +#define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s } +#define RtlZeroMemory(Destination, Length) memset(Destination, 0, Length) +#define RtlCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length) +#define RtlMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length) + +/* Prevent inclusion of some other headers */ +#define __INTERNAL_DEBUG +#define RTL_H +#define _TYPEDEFS64_H + +#endif diff --git a/reactos/lib/cmlib/cmlib.h b/reactos/lib/cmlib/cmlib.h index baeca03186b..5730ca3a21f 100644 --- a/reactos/lib/cmlib/cmlib.h +++ b/reactos/lib/cmlib/cmlib.h @@ -8,12 +8,17 @@ #ifndef CMLIB_H #define CMLIB_H -//#define WIN32_NO_STATUS -#ifdef CMLIB_HOST -#include +#ifdef _TYPEDEFS_HOST_H +#define REG_OPTION_VOLATILE 1 +#define OBJ_CASE_INSENSITIVE 0x00000040L +#define USHORT_MAX USHRT_MAX +#else + #ifdef CMLIB_HOST + #include + #endif + #include #endif -#include #include #include "hivedata.h" #include "cmdata.h" diff --git a/reactos/tools/mkhive/mkhive.h b/reactos/tools/mkhive/mkhive.h index 3887c340d27..5078fd1ef18 100644 --- a/reactos/tools/mkhive/mkhive.h +++ b/reactos/tools/mkhive/mkhive.h @@ -30,19 +30,30 @@ #include #include -/* We have to do this because psdk/windef.h will _always_ define _WIN32... */ -#if defined(_WIN32) || defined(_WIN64) -#define WINDOWS_HOST -#endif +#include +#include -#define NTOS_MODE_USER -#define WIN32_NO_STATUS +VOID NTAPI +KeQuerySystemTime( + OUT PLARGE_INTEGER CurrentTime); +NTSTATUS NTAPI +RtlAnsiStringToUnicodeString( + IN OUT PUNICODE_STRING UniDest, + IN PANSI_STRING AnsiSource, + IN BOOLEAN AllocateDestinationString); +VOID NTAPI +RtlInitAnsiString( + IN OUT PANSI_STRING DestinationString, + IN PCSTR SourceString); +VOID NTAPI +RtlInitUnicodeString( + IN OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString); +WCHAR NTAPI +RtlUpcaseUnicodeChar( + IN WCHAR Source); -#ifdef MKHIVE_HOST -#include -#endif - -#include +#define CMLIB_HOST #include #include #include "reginf.h" diff --git a/reactos/tools/mkhive/mkhive.mak b/reactos/tools/mkhive/mkhive.mak index 0c66e977758..d8909545270 100644 --- a/reactos/tools/mkhive/mkhive.mak +++ b/reactos/tools/mkhive/mkhive.mak @@ -31,8 +31,7 @@ MKHIVE_OBJECTS = \ $(addprefix $(INTERMEDIATE_), $(MKHIVE_SOURCES:.c=.o)) MKHIVE_HOST_CFLAGS = -fshort-wchar $(xTOOLS_CFLAGS) -I$(INFLIB_BASE) -I$(CMLIB_BASE) \ - -D_NTOSKRNL_ -D_NTSYSTEM_ -DMKHIVE_HOST \ - -Iinclude/reactos -Iinclude/ddk -Iinclude/psdk -g3 + -DMKHIVE_HOST -Iinclude/reactos -Iinclude/psdk -g3 MKHIVE_HOST_LFLAGS = $(xTOOLS_LFLAGS) -g3 diff --git a/reactos/tools/mkhive/rtl.c b/reactos/tools/mkhive/rtl.c index 7f4db5f5546..8c9b4a74ccd 100644 --- a/reactos/tools/mkhive/rtl.c +++ b/reactos/tools/mkhive/rtl.c @@ -6,11 +6,7 @@ #include -#define RTL_H - -#define NTOS_MODE_USER -#define WIN32_NO_STATUS -#include +#include "mkhive.h" #include SIZE_T xwcslen( PCWSTR String ) {