Do not include <ntddk.h> when compiling cmlib_host. This file defines too much things.

svn path=/trunk/; revision=28599
This commit is contained in:
Hervé Poussineau 2007-08-27 12:47:56 +00:00
parent 62a91eb656
commit 7cd48df5b6
5 changed files with 57 additions and 42 deletions

View file

@ -9,10 +9,13 @@
#ifndef _TYPEDEFS_HOST_H #ifndef _TYPEDEFS_HOST_H
#define _TYPEDEFS_HOST_H #define _TYPEDEFS_HOST_H
#include <stdlib.h>
#include <limits.h> #include <limits.h>
#define UNIMPLEMENTED { printf("%s unimplemented\n", __FUNCTION__); exit(1); } #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 ASSERT(x) { if (!(x)) { printf("Assertion " #x " at %s:%d failed\n", __FILE__, __LINE__); exit(1); } }
#define DPRINT if (0) printf
#define DPRINT1 printf
#define NTAPI __stdcall #define NTAPI __stdcall
#define WINAPI __stdcall #define WINAPI __stdcall
@ -24,9 +27,13 @@
#define FALSE 0 #define FALSE 0
#define TRUE (!(FALSE)) #define TRUE (!(FALSE))
/* FIXME: this value is target specific, host tools MUST not use it
* and this line has to be removed */
#define PAGE_SIZE 4096
typedef void VOID, *PVOID, *HANDLE; typedef void VOID, *PVOID, *HANDLE;
typedef HANDLE HKEY, *PHKEY; typedef HANDLE HKEY, *PHKEY;
typedef size_t SIZE_T, *PSIZE_T; typedef long unsigned int SIZE_T, *PSIZE_T;
typedef unsigned char UCHAR, *PUCHAR, BYTE, *LPBYTE; typedef unsigned char UCHAR, *PUCHAR, BYTE, *LPBYTE;
typedef char CHAR, *PCHAR, *PSTR; typedef char CHAR, *PCHAR, *PSTR;
typedef const char CCHAR; typedef const char CCHAR;
@ -48,6 +55,7 @@ typedef int POOL_TYPE;
#define MAXUSHORT USHRT_MAX #define MAXUSHORT USHRT_MAX
#include <pshpack4.h>
typedef struct _RTL_BITMAP typedef struct _RTL_BITMAP
{ {
ULONG SizeOfBitMap; ULONG SizeOfBitMap;
@ -89,9 +97,12 @@ typedef struct _UNICODE_STRING
USHORT MaximumLength; USHORT MaximumLength;
PWSTR Buffer; PWSTR Buffer;
} UNICODE_STRING, *PUNICODE_STRING; } UNICODE_STRING, *PUNICODE_STRING;
#include <poppack.h>
typedef const UNICODE_STRING *PCUNICODE_STRING; typedef const UNICODE_STRING *PCUNICODE_STRING;
#define NT_SUCCESS(x) ((x)>=0) #define NT_SUCCESS(x) ((x)>=0)
#define FIELD_OFFSET(t,f) ((LONG_PTR)&(((t*)0)->f))
#define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s } #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
#define RtlZeroMemory(Destination, Length) memset(Destination, 0, Length) #define RtlZeroMemory(Destination, Length) memset(Destination, 0, Length)
#define RtlCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length) #define RtlCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length)

View file

@ -8,15 +8,48 @@
#ifndef CMLIB_H #ifndef CMLIB_H
#define CMLIB_H #define CMLIB_H
#ifdef _TYPEDEFS_HOST_H #ifdef CMLIB_HOST
#define REG_OPTION_VOLATILE 1 #include <typedefs_host.h>
#define OBJ_CASE_INSENSITIVE 0x00000040L #include <stdio.h>
#define USHORT_MAX USHRT_MAX #include <string.h>
#else #include <ntstatus.h>
#ifdef CMLIB_HOST #endif
#include <typedefs64.h>
#endif #ifndef _TYPEDEFS_HOST_H
#include <ntddk.h> #include <ntddk.h>
#else
#define REG_OPTION_VOLATILE 1
#define OBJ_CASE_INSENSITIVE 0x00000040L
#define USHORT_MAX USHRT_MAX
VOID NTAPI
KeQuerySystemTime(
OUT PLARGE_INTEGER CurrentTime);
VOID NTAPI
RtlInitializeBitMap(
IN PRTL_BITMAP BitMapHeader,
IN PULONG BitMapBuffer,
IN ULONG SizeOfBitMap);
ULONG NTAPI
RtlFindSetBits(
IN PRTL_BITMAP BitMapHeader,
IN ULONG NumberToFind,
IN ULONG HintIndex);
VOID NTAPI
RtlSetBits(
IN PRTL_BITMAP BitMapHeader,
IN ULONG StartingIndex,
IN ULONG NumberToSet);
VOID NTAPI
RtlClearAllBits(
IN PRTL_BITMAP BitMapHeader);
#define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP) / 32]) >> ((BP) % 32)) & 0x1)
#endif #endif
#include <wchar.h> #include <wchar.h>

View file

@ -31,9 +31,8 @@ CMLIB_HOST_OBJECTS = \
$(subst $(CMLIB_BASE), $(CMLIB_INT), $(CMLIB_HOST_SOURCES:.c=.o)) $(subst $(CMLIB_BASE), $(CMLIB_INT), $(CMLIB_HOST_SOURCES:.c=.o))
CMLIB_HOST_CFLAGS = -O3 -Wall -Wwrite-strings -Wpointer-arith \ CMLIB_HOST_CFLAGS = -O3 -Wall -Wwrite-strings -Wpointer-arith \
-D_X86_ -D__i386__ -D_REACTOS_ -D_NTOSKRNL_ -D_NTSYSTEM_ \ -I$(CMLIB_BASE) -Iinclude/reactos -Iinclude/psdk \
-DCMLIB_HOST -D_M_IX86 -I$(CMLIB_BASE) -Iinclude/reactos -Iinclude/psdk -Iinclude/ddk -Iinclude/crt \ -DCMLIB_HOST
-D__NO_CTYPE_INLINES
$(CMLIB_HOST_TARGET): $(CMLIB_HOST_OBJECTS) | $(CMLIB_OUT) $(CMLIB_HOST_TARGET): $(CMLIB_HOST_OBJECTS) | $(CMLIB_OUT)
$(ECHO_AR) $(ECHO_AR)

View file

@ -33,9 +33,6 @@
#include <typedefs_host.h> #include <typedefs_host.h>
#include <ntstatus.h> #include <ntstatus.h>
VOID NTAPI
KeQuerySystemTime(
OUT PLARGE_INTEGER CurrentTime);
NTSTATUS NTAPI NTSTATUS NTAPI
RtlAnsiStringToUnicodeString( RtlAnsiStringToUnicodeString(
IN OUT PUNICODE_STRING UniDest, IN OUT PUNICODE_STRING UniDest,
@ -74,31 +71,7 @@ extern LIST_ENTRY CmiHiveListHead;
#define min(a, b) (((a) < (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b))
#endif #endif
#ifdef _WIN32
/* Debugging macros */
#ifdef _MSC_VER
#include <stdio.h>
#include <stdarg.h>
static void DPRINT1(const char* fmt, ... )
{
va_list args;
va_start ( args, fmt );
vprintf ( fmt, args );
va_end ( args );
}
static void DPRINT ( const char* fmt, ... )
{
}
#else
#define DPRINT1(args...) do { printf("(%s:%d) ",__FILE__,__LINE__); printf(args); } while(0);
#define DPRINT(args...)
#endif//_MSC_VER
#define CHECKPOINT1 do { printf("%s:%d\n",__FILE__,__LINE__); } while(0);
#define CHECKPOINT
#ifdef WINDOWS_HOST
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define strcasecmp _stricmp #define strcasecmp _stricmp
#else #else

View file

@ -139,7 +139,6 @@ VOID NTAPI
KeQuerySystemTime( KeQuerySystemTime(
OUT PLARGE_INTEGER CurrentTime) OUT PLARGE_INTEGER CurrentTime)
{ {
DPRINT1("KeQuerySystemTime() unimplemented\n");
CurrentTime->QuadPart = 0; CurrentTime->QuadPart = 0;
} }