Rely only on host headers (+ target ntstatus.h) to build mkhive

svn path=/trunk/; revision=28596
This commit is contained in:
Hervé Poussineau
2007-08-27 09:32:52 +00:00
parent 36235f6d7f
commit 513a12418d
5 changed files with 138 additions and 22 deletions
+105
View File
@@ -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 <limits.h>
#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
+9 -4
View File
@@ -8,12 +8,17 @@
#ifndef CMLIB_H
#define CMLIB_H
//#define WIN32_NO_STATUS
#ifdef CMLIB_HOST
#include <typedefs64.h>
#ifdef _TYPEDEFS_HOST_H
#define REG_OPTION_VOLATILE 1
#define OBJ_CASE_INSENSITIVE 0x00000040L
#define USHORT_MAX USHRT_MAX
#else
#ifdef CMLIB_HOST
#include <typedefs64.h>
#endif
#include <ntddk.h>
#endif
#include <ntddk.h>
#include <wchar.h>
#include "hivedata.h"
#include "cmdata.h"
+22 -11
View File
@@ -30,19 +30,30 @@
#include <stdio.h>
#include <stdlib.h>
/* We have to do this because psdk/windef.h will _always_ define _WIN32... */
#if defined(_WIN32) || defined(_WIN64)
#define WINDOWS_HOST
#endif
#include <typedefs_host.h>
#include <ntstatus.h>
#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 <typedefs64.h>
#endif
#include <ntddk.h>
#define CMLIB_HOST
#include <cmlib.h>
#include <infhost.h>
#include "reginf.h"
+1 -2
View File
@@ -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
+1 -5
View File
@@ -6,11 +6,7 @@
#include <stdlib.h>
#define RTL_H
#define NTOS_MODE_USER
#define WIN32_NO_STATUS
#include <ntddk.h>
#include "mkhive.h"
#include <bitmap.c>
SIZE_T xwcslen( PCWSTR String ) {