tamlin's work on compiling the kernel with another compiler than GCC. Patch by Mike Nordell.

svn path=/trunk/; revision=7460
This commit is contained in:
Thomas Bluemel 2004-01-05 14:28:21 +00:00
parent 16da2140a1
commit 583de66b3e
47 changed files with 517 additions and 462 deletions

View File

@ -7,6 +7,9 @@
#ifndef __AFD_SHARED_H #ifndef __AFD_SHARED_H
#define __AFD_SHARED_H #define __AFD_SHARED_H
#include <pshpack1.h>
#define AfdSocket "AfdSocket" #define AfdSocket "AfdSocket"
#define AFD_SOCKET_LENGTH (sizeof(AfdSocket) - 1) #define AFD_SOCKET_LENGTH (sizeof(AfdSocket) - 1)
@ -19,7 +22,7 @@ typedef struct _AFD_SOCKET_INFORMATION {
DWORD NotificationEvents; DWORD NotificationEvents;
UNICODE_STRING TdiDeviceName; UNICODE_STRING TdiDeviceName;
SOCKADDR Name; SOCKADDR Name;
} __attribute__((packed)) AFD_SOCKET_INFORMATION, *PAFD_SOCKET_INFORMATION; } AFD_SOCKET_INFORMATION, *PAFD_SOCKET_INFORMATION;
/* AFD IOCTL code definitions */ /* AFD IOCTL code definitions */
@ -65,21 +68,21 @@ typedef struct _AFD_SOCKET_INFORMATION {
typedef struct _FILE_REQUEST_BIND { typedef struct _FILE_REQUEST_BIND {
SOCKADDR Name; SOCKADDR Name;
} __attribute__((packed)) FILE_REQUEST_BIND, *PFILE_REQUEST_BIND; } FILE_REQUEST_BIND, *PFILE_REQUEST_BIND;
typedef struct _FILE_REPLY_BIND { typedef struct _FILE_REPLY_BIND {
INT Status; INT Status;
HANDLE TdiAddressObjectHandle; HANDLE TdiAddressObjectHandle;
HANDLE TdiConnectionObjectHandle; HANDLE TdiConnectionObjectHandle;
} __attribute__((packed)) FILE_REPLY_BIND, *PFILE_REPLY_BIND; } FILE_REPLY_BIND, *PFILE_REPLY_BIND;
typedef struct _FILE_REQUEST_LISTEN { typedef struct _FILE_REQUEST_LISTEN {
INT Backlog; INT Backlog;
} __attribute__((packed)) FILE_REQUEST_LISTEN, *PFILE_REQUEST_LISTEN; } FILE_REQUEST_LISTEN, *PFILE_REQUEST_LISTEN;
typedef struct _FILE_REPLY_LISTEN { typedef struct _FILE_REPLY_LISTEN {
INT Status; INT Status;
} __attribute__((packed)) FILE_REPLY_LISTEN, *PFILE_REPLY_LISTEN; } FILE_REPLY_LISTEN, *PFILE_REPLY_LISTEN;
typedef struct _FILE_REQUEST_SENDTO { typedef struct _FILE_REQUEST_SENDTO {
@ -88,12 +91,12 @@ typedef struct _FILE_REQUEST_SENDTO {
DWORD Flags; DWORD Flags;
SOCKADDR To; SOCKADDR To;
INT ToLen; INT ToLen;
} __attribute__((packed)) FILE_REQUEST_SENDTO, *PFILE_REQUEST_SENDTO; } FILE_REQUEST_SENDTO, *PFILE_REQUEST_SENDTO;
typedef struct _FILE_REPLY_SENDTO { typedef struct _FILE_REPLY_SENDTO {
INT Status; INT Status;
DWORD NumberOfBytesSent; DWORD NumberOfBytesSent;
} __attribute__((packed)) FILE_REPLY_SENDTO, *PFILE_REPLY_SENDTO; } FILE_REPLY_SENDTO, *PFILE_REPLY_SENDTO;
typedef struct _FILE_REQUEST_RECVFROM { typedef struct _FILE_REQUEST_RECVFROM {
@ -102,12 +105,12 @@ typedef struct _FILE_REQUEST_RECVFROM {
LPDWORD Flags; LPDWORD Flags;
LPSOCKADDR From; LPSOCKADDR From;
LPINT FromLen; LPINT FromLen;
} __attribute__((packed)) FILE_REQUEST_RECVFROM, *PFILE_REQUEST_RECVFROM; } FILE_REQUEST_RECVFROM, *PFILE_REQUEST_RECVFROM;
typedef struct _FILE_REPLY_RECVFROM { typedef struct _FILE_REPLY_RECVFROM {
INT Status; INT Status;
DWORD NumberOfBytesRecvd; DWORD NumberOfBytesRecvd;
} __attribute__((packed)) FILE_REPLY_RECVFROM, *PFILE_REPLY_RECVFROM; } FILE_REPLY_RECVFROM, *PFILE_REPLY_RECVFROM;
typedef struct _FILE_REQUEST_SELECT { typedef struct _FILE_REQUEST_SELECT {
@ -115,56 +118,56 @@ typedef struct _FILE_REQUEST_SELECT {
LPFD_SET WriteFDSet; LPFD_SET WriteFDSet;
LPFD_SET ExceptFDSet; LPFD_SET ExceptFDSet;
TIMEVAL Timeout; TIMEVAL Timeout;
} __attribute__((packed)) FILE_REQUEST_SELECT, *PFILE_REQUEST_SELECT; } FILE_REQUEST_SELECT, *PFILE_REQUEST_SELECT;
typedef struct _FILE_REPLY_SELECT { typedef struct _FILE_REPLY_SELECT {
INT Status; INT Status;
DWORD SocketCount; DWORD SocketCount;
} __attribute__((packed)) FILE_REPLY_SELECT, *PFILE_REPLY_SELECT; } FILE_REPLY_SELECT, *PFILE_REPLY_SELECT;
typedef struct _FILE_REQUEST_EVENTSELECT { typedef struct _FILE_REQUEST_EVENTSELECT {
WSAEVENT hEventObject; WSAEVENT hEventObject;
LONG lNetworkEvents; LONG lNetworkEvents;
} __attribute__((packed)) FILE_REQUEST_EVENTSELECT, *PFILE_REQUEST_EVENTSELECT; } FILE_REQUEST_EVENTSELECT, *PFILE_REQUEST_EVENTSELECT;
typedef struct _FILE_REPLY_EVENTSELECT { typedef struct _FILE_REPLY_EVENTSELECT {
INT Status; INT Status;
} __attribute__((packed)) FILE_REPLY_EVENTSELECT, *PFILE_REPLY_EVENTSELECT; } FILE_REPLY_EVENTSELECT, *PFILE_REPLY_EVENTSELECT;
typedef struct _FILE_REQUEST_ENUMNETWORKEVENTS { typedef struct _FILE_REQUEST_ENUMNETWORKEVENTS {
WSAEVENT hEventObject; WSAEVENT hEventObject;
} __attribute__((packed)) FILE_REQUEST_ENUMNETWORKEVENTS, *PFILE_REQUEST_ENUMNETWORKEVENTS; } FILE_REQUEST_ENUMNETWORKEVENTS, *PFILE_REQUEST_ENUMNETWORKEVENTS;
typedef struct _FILE_REPLY_ENUMNETWORKEVENTS { typedef struct _FILE_REPLY_ENUMNETWORKEVENTS {
INT Status; INT Status;
WSANETWORKEVENTS NetworkEvents; WSANETWORKEVENTS NetworkEvents;
} __attribute__((packed)) FILE_REPLY_ENUMNETWORKEVENTS, *PFILE_REPLY_ENUMNETWORKEVENTS; } FILE_REPLY_ENUMNETWORKEVENTS, *PFILE_REPLY_ENUMNETWORKEVENTS;
typedef struct _FILE_REQUEST_RECV { typedef struct _FILE_REQUEST_RECV {
LPWSABUF Buffers; LPWSABUF Buffers;
DWORD BufferCount; DWORD BufferCount;
LPDWORD Flags; LPDWORD Flags;
} __attribute__((packed)) FILE_REQUEST_RECV, *PFILE_REQUEST_RECV; } FILE_REQUEST_RECV, *PFILE_REQUEST_RECV;
typedef struct _FILE_REPLY_RECV { typedef struct _FILE_REPLY_RECV {
INT Status; INT Status;
DWORD NumberOfBytesRecvd; DWORD NumberOfBytesRecvd;
} __attribute__((packed)) FILE_REPLY_RECV, *PFILE_REPLY_RECV; } FILE_REPLY_RECV, *PFILE_REPLY_RECV;
typedef struct _FILE_REQUEST_SEND { typedef struct _FILE_REQUEST_SEND {
LPWSABUF Buffers; LPWSABUF Buffers;
DWORD BufferCount; DWORD BufferCount;
DWORD Flags; DWORD Flags;
} __attribute__((packed)) FILE_REQUEST_SEND, *PFILE_REQUEST_SEND; } FILE_REQUEST_SEND, *PFILE_REQUEST_SEND;
typedef struct _FILE_REPLY_SEND { typedef struct _FILE_REPLY_SEND {
INT Status; INT Status;
DWORD NumberOfBytesSent; DWORD NumberOfBytesSent;
} __attribute__((packed)) FILE_REPLY_SEND, *PFILE_REPLY_SEND; } FILE_REPLY_SEND, *PFILE_REPLY_SEND;
typedef struct _FILE_REQUEST_ACCEPT { typedef struct _FILE_REQUEST_ACCEPT {
@ -172,13 +175,13 @@ typedef struct _FILE_REQUEST_ACCEPT {
INT addrlen; INT addrlen;
LPCONDITIONPROC lpfnCondition; LPCONDITIONPROC lpfnCondition;
DWORD dwCallbackData; DWORD dwCallbackData;
} __attribute__((packed)) FILE_REQUEST_ACCEPT, *PFILE_REQUEST_ACCEPT; } FILE_REQUEST_ACCEPT, *PFILE_REQUEST_ACCEPT;
typedef struct _FILE_REPLY_ACCEPT { typedef struct _FILE_REPLY_ACCEPT {
INT Status; INT Status;
INT addrlen; INT addrlen;
SOCKET Socket; SOCKET Socket;
} __attribute__((packed)) FILE_REPLY_ACCEPT, *PFILE_REPLY_ACCEPT; } FILE_REPLY_ACCEPT, *PFILE_REPLY_ACCEPT;
typedef struct _FILE_REQUEST_CONNECT { typedef struct _FILE_REQUEST_CONNECT {
@ -188,11 +191,13 @@ typedef struct _FILE_REQUEST_CONNECT {
LPWSABUF lpCalleeData; LPWSABUF lpCalleeData;
LPQOS lpSQOS; LPQOS lpSQOS;
LPQOS lpGQOS; LPQOS lpGQOS;
} __attribute__((packed)) FILE_REQUEST_CONNECT, *PFILE_REQUEST_CONNECT; } FILE_REQUEST_CONNECT, *PFILE_REQUEST_CONNECT;
typedef struct _FILE_REPLY_CONNECT { typedef struct _FILE_REPLY_CONNECT {
INT Status; INT Status;
} __attribute__((packed)) FILE_REPLY_CONNECT, *PFILE_REPLY_CONNECT; } FILE_REPLY_CONNECT, *PFILE_REPLY_CONNECT;
#include <poppack.h>
#endif /*__AFD_SHARED_H */ #endif /*__AFD_SHARED_H */

View File

@ -122,6 +122,8 @@ struct external_scnhdr {
#define STYP_DATA (0x0040) /* section contains data only */ #define STYP_DATA (0x0040) /* section contains data only */
#define STYP_BSS (0x0080) /* section contains bss only */ #define STYP_BSS (0x0080) /* section contains bss only */
#include <pshpack1.h>
/********************** LINE NUMBERS **********************/ /********************** LINE NUMBERS **********************/
/* 1 line number entry for every "breakpointable" source line in a section. /* 1 line number entry for every "breakpointable" source line in a section.
@ -131,8 +133,8 @@ struct external_scnhdr {
*/ */
struct external_lineno { struct external_lineno {
union { union {
unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */ unsigned long l_symndx; /* function name symbol index, iff l_lnno == 0 */
unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */ unsigned long l_paddr; /* (physical) address of line number */
} l_addr; } l_addr;
unsigned short l_lnno; /* line number */ unsigned short l_lnno; /* line number */
}; };
@ -153,11 +155,11 @@ struct external_syment
union { union {
char e_name[E_SYMNMLEN]; char e_name[E_SYMNMLEN];
struct { struct {
unsigned long e_zeroes __attribute__((packed)); unsigned long e_zeroes;
unsigned long e_offset __attribute__((packed)); unsigned long e_offset;
} e; } e;
} e; } e;
unsigned long e_value __attribute__((packed)); unsigned long e_value;
short e_scnum; short e_scnum;
unsigned short e_type; unsigned short e_type;
unsigned char e_sclass; unsigned char e_sclass;
@ -171,18 +173,18 @@ struct external_syment
union external_auxent { union external_auxent {
struct { struct {
unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */ unsigned long x_tagndx; /* str, un, or enum tag indx */
union { union {
struct { struct {
unsigned short x_lnno; /* declaration line number */ unsigned short x_lnno; /* declaration line number */
unsigned short x_size; /* str/union/array size */ unsigned short x_size; /* str/union/array size */
} x_lnsz; } x_lnsz;
unsigned long x_fsize __attribute__((packed)); /* size of function */ unsigned long x_fsize; /* size of function */
} x_misc; } x_misc;
union { union {
struct { /* if ISFCN, tag, or .bb */ struct { /* if ISFCN, tag, or .bb */
unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */ unsigned long x_lnnoptr; /* ptr to fcn line # */
unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */ unsigned long x_endndx; /* entry ndx past block end */
} x_fcn; } x_fcn;
struct { /* if ISARY, up to 4 dimen. */ struct { /* if ISARY, up to 4 dimen. */
unsigned short x_dimen[E_DIMNUM]; unsigned short x_dimen[E_DIMNUM];
@ -194,19 +196,19 @@ union external_auxent {
union { union {
char x_fname[E_FILNMLEN]; char x_fname[E_FILNMLEN];
struct { struct {
unsigned long x_zeroes __attribute__((packed)); unsigned long x_zeroes;
unsigned long x_offset __attribute__((packed)); unsigned long x_offset;
} x_n; } x_n;
} x_file; } x_file;
struct { struct {
unsigned long x_scnlen __attribute__((packed)); /* section length */ unsigned long x_scnlen; /* section length */
unsigned short x_nreloc; /* # relocation entries */ unsigned short x_nreloc; /* # relocation entries */
unsigned short x_nlinno; /* # line numbers */ unsigned short x_nlinno; /* # line numbers */
} x_scn; } x_scn;
struct { struct {
unsigned long x_tvfill __attribute__((packed)); /* tv fill value */ unsigned long x_tvfill; /* tv fill value */
unsigned short x_tvlen; /* length of .tv */ unsigned short x_tvlen; /* length of .tv */
unsigned short x_tvran[2]; /* tv range */ unsigned short x_tvran[2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */ } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
@ -307,11 +309,13 @@ union external_auxent {
struct external_reloc { struct external_reloc {
unsigned long r_vaddr __attribute__((packed)); unsigned long r_vaddr;
unsigned long r_symndx __attribute__((packed)); unsigned long r_symndx;
unsigned short r_type; unsigned short r_type;
}; };
#include <poppack.h>
#define RELOC struct external_reloc #define RELOC struct external_reloc
#define RELSZ sizeof(RELOC) #define RELSZ sizeof(RELOC)

View File

@ -1,4 +1,4 @@
/* $Id: iotypes.h,v 1.61 2003/12/30 18:34:58 fireball Exp $ /* $Id: iotypes.h,v 1.62 2004/01/05 14:28:19 weiden Exp $
* *
*/ */
@ -9,7 +9,7 @@
#include <ntos/disk.h> #include <ntos/disk.h>
#include <ntos/file.h> #include <ntos/file.h>
#pragma pack(push,4) #include <pshpack4.h>
/* from winddk.h */ /* from winddk.h */
#define POINTER_ALIGNMENT #define POINTER_ALIGNMENT
@ -215,6 +215,8 @@ typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
} CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA; } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
#include <pshpack1.h>
typedef struct typedef struct
{ {
UCHAR Type; UCHAR Type;
@ -226,32 +228,32 @@ typedef struct
{ {
PHYSICAL_ADDRESS Start; PHYSICAL_ADDRESS Start;
ULONG Length; ULONG Length;
} __attribute__((packed)) Port; } Port;
struct struct
{ {
ULONG Level; ULONG Level;
ULONG Vector; ULONG Vector;
ULONG Affinity; ULONG Affinity;
} __attribute__((packed))Interrupt; } Interrupt;
struct struct
{ {
PHYSICAL_ADDRESS Start; PHYSICAL_ADDRESS Start;
ULONG Length; ULONG Length;
} __attribute__((packed))Memory; } Memory;
struct struct
{ {
ULONG Channel; ULONG Channel;
ULONG Port; ULONG Port;
ULONG Reserved1; ULONG Reserved1;
} __attribute__((packed))Dma; } Dma;
struct struct
{ {
ULONG DataSize; ULONG DataSize;
ULONG Reserved1; ULONG Reserved1;
ULONG Reserved2; ULONG Reserved2;
} __attribute__((packed))DeviceSpecificData; } DeviceSpecificData;
} __attribute__((packed)) u; } u;
} __attribute__((packed)) CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR; } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
typedef struct typedef struct
{ {
@ -259,14 +261,14 @@ typedef struct
USHORT Revision; USHORT Revision;
ULONG Count; ULONG Count;
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]; CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
} __attribute__((packed))CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST; } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
typedef struct typedef struct
{ {
INTERFACE_TYPE InterfaceType; INTERFACE_TYPE InterfaceType;
ULONG BusNumber; ULONG BusNumber;
CM_PARTIAL_RESOURCE_LIST PartialResourceList; CM_PARTIAL_RESOURCE_LIST PartialResourceList;
} __attribute__((packed)) CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR; } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
typedef struct typedef struct
{ {
@ -274,13 +276,15 @@ typedef struct
CM_FULL_RESOURCE_DESCRIPTOR List[1]; CM_FULL_RESOURCE_DESCRIPTOR List[1];
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST; } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
#include <poppack.h>
/* /*
* PURPOSE: IRP stack location * PURPOSE: IRP stack location
*/ */
/* /*
typedef struct __attribute__((packed)) _IO_STACK_LOCATION typedef struct _IO_STACK_LOCATION
{ {
UCHAR MajorFunction; UCHAR MajorFunction;
UCHAR MinorFunction; UCHAR MinorFunction;
@ -479,7 +483,7 @@ typedef struct __attribute__((packed)) _IO_STACK_LOCATION
PIO_COMPLETION_ROUTINE CompletionRoutine; PIO_COMPLETION_ROUTINE CompletionRoutine;
PVOID CompletionContext; PVOID CompletionContext;
} __attribute__((packed)) IO_STACK_LOCATION, *PIO_STACK_LOCATION;*/ } IO_STACK_LOCATION, *PIO_STACK_LOCATION;*/
typedef struct _IO_STACK_LOCATION { typedef struct _IO_STACK_LOCATION {
UCHAR MajorFunction; UCHAR MajorFunction;
@ -1316,6 +1320,6 @@ typedef struct _BUS_INTERFACE_STANDARD {
PGET_SET_DEVICE_DATA GetBusData; PGET_SET_DEVICE_DATA GetBusData;
} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD; } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
#pragma pack(pop) #include <poppack.h>
#endif /* __INCLUDE_DDK_IOTYPES_H */ #endif /* __INCLUDE_DDK_IOTYPES_H */

View File

@ -49,6 +49,8 @@ typedef struct _KWAIT_BLOCK
USHORT WaitType; USHORT WaitType;
} KWAIT_BLOCK, *PKWAIT_BLOCK; } KWAIT_BLOCK, *PKWAIT_BLOCK;
#include <pshpack1.h>
typedef struct _DISPATCHER_HEADER typedef struct _DISPATCHER_HEADER
{ {
UCHAR Type; UCHAR Type;
@ -57,8 +59,9 @@ typedef struct _DISPATCHER_HEADER
UCHAR Inserted; UCHAR Inserted;
LONG SignalState; LONG SignalState;
LIST_ENTRY WaitListHead; LIST_ENTRY WaitListHead;
} __attribute__((packed)) DISPATCHER_HEADER, *PDISPATCHER_HEADER; } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
#include <poppack.h>
typedef struct _KQUEUE typedef struct _KQUEUE
{ {
@ -92,6 +95,8 @@ typedef struct _KDEVICE_QUEUE
} KDEVICE_QUEUE, *PKDEVICE_QUEUE; } KDEVICE_QUEUE, *PKDEVICE_QUEUE;
#include <pshpack1.h>
typedef struct _KAPC typedef struct _KAPC
{ {
CSHORT Type; CSHORT Type;
@ -108,7 +113,9 @@ typedef struct _KAPC
CCHAR ApcStateIndex; CCHAR ApcStateIndex;
KPROCESSOR_MODE ApcMode; KPROCESSOR_MODE ApcMode;
USHORT Inserted; USHORT Inserted;
} __attribute__((packed)) KAPC, *PKAPC; } KAPC, *PKAPC;
#include <poppack.h>
typedef struct _KBUGCHECK_CALLBACK_RECORD typedef struct _KBUGCHECK_CALLBACK_RECORD
{ {
@ -130,11 +137,15 @@ typedef struct _KMUTEX
UCHAR ApcDisable; UCHAR ApcDisable;
} KMUTEX, *PKMUTEX, KMUTANT, *PKMUTANT; } KMUTEX, *PKMUTEX, KMUTANT, *PKMUTANT;
#include <pshpack1.h>
typedef struct _KSEMAPHORE typedef struct _KSEMAPHORE
{ {
DISPATCHER_HEADER Header; DISPATCHER_HEADER Header;
LONG Limit; LONG Limit;
} __attribute__((packed)) KSEMAPHORE, *PKSEMAPHORE; } KSEMAPHORE, *PKSEMAPHORE;
#include <poppack.h>
typedef struct _KEVENT typedef struct _KEVENT
{ {
@ -169,6 +180,8 @@ typedef VOID STDCALL_FUNC
/* /*
* PURPOSE: Defines a delayed procedure call object * PURPOSE: Defines a delayed procedure call object
*/ */
#include <pshpack1.h>
typedef struct _KDPC typedef struct _KDPC
{ {
SHORT Type; SHORT Type;
@ -180,8 +193,9 @@ typedef struct _KDPC
PVOID SystemArgument1; PVOID SystemArgument1;
PVOID SystemArgument2; PVOID SystemArgument2;
PULONG Lock; PULONG Lock;
} __attribute__((packed)) KDPC, *PKDPC; } KDPC, *PKDPC;
#include <poppack.h>
typedef struct _KDEVICE_QUEUE_ENTRY typedef struct _KDEVICE_QUEUE_ENTRY

View File

@ -38,7 +38,7 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
typedef typedef
DWORD CALLBACK (*PPROGRESS_ROUTINE)( DWORD (CALLBACK *PPROGRESS_ROUTINE)(
LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalFileSize,
LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER TotalBytesTransferred,
LARGE_INTEGER StreamSize, LARGE_INTEGER StreamSize,
@ -1710,7 +1710,7 @@ RtlSetCriticalSectionSpinCount(
typedef typedef
VOID VOID
CALLBACK (*POVERLAPPED_COMPLETION_ROUTINE)( (CALLBACK *POVERLAPPED_COMPLETION_ROUTINE)(
DWORD dwErrorCode, DWORD dwErrorCode,
DWORD dwNumberOfBytesTransfered, DWORD dwNumberOfBytesTransfered,
LPOVERLAPPED lpOverlapped LPOVERLAPPED lpOverlapped

View File

@ -1,6 +1,8 @@
#ifndef __INCLUDE_NAPI_WIN32_H #ifndef __INCLUDE_NAPI_WIN32_H
#define __INCLUDE_NAPI_WIN32_H #define __INCLUDE_NAPI_WIN32_H
#include <pshpack1.h>
typedef struct _W32THREAD typedef struct _W32THREAD
{ {
PVOID MessageQueue; PVOID MessageQueue;
@ -9,7 +11,10 @@ typedef struct _W32THREAD
struct _KBDTABLES* KeyboardLayout; struct _KBDTABLES* KeyboardLayout;
struct _DESKTOP_OBJECT* Desktop; struct _DESKTOP_OBJECT* Desktop;
DWORD MessagePumpHookValue; DWORD MessagePumpHookValue;
} __attribute__((packed)) W32THREAD, *PW32THREAD; } W32THREAD, *PW32THREAD;
#include <poppack.h>
typedef struct _W32PROCESS typedef struct _W32PROCESS
{ {

View File

@ -965,21 +965,21 @@ typedef enum _NET_DEVICE_POWER_STATE {
/* Call Manager */ /* Call Manager */
typedef NDIS_STATUS STDCALL (*CO_CREATE_VC_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*CO_CREATE_VC_HANDLER)(
IN NDIS_HANDLE ProtocolAfContext, IN NDIS_HANDLE ProtocolAfContext,
IN NDIS_HANDLE NdisVcHandle, IN NDIS_HANDLE NdisVcHandle,
OUT PNDIS_HANDLE ProtocolVcContext); OUT PNDIS_HANDLE ProtocolVcContext);
typedef NDIS_STATUS STDCALL (*CO_DELETE_VC_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*CO_DELETE_VC_HANDLER)(
IN NDIS_HANDLE ProtocolVcContext); IN NDIS_HANDLE ProtocolVcContext);
typedef NDIS_STATUS STDCALL (*CO_REQUEST_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*CO_REQUEST_HANDLER)(
IN NDIS_HANDLE ProtocolAfContext, IN NDIS_HANDLE ProtocolAfContext,
IN NDIS_HANDLE ProtocolVcContext OPTIONAL, IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
IN NDIS_HANDLE ProtocolPartyContext OPTIONAL, IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
IN OUT PNDIS_REQUEST NdisRequest); IN OUT PNDIS_REQUEST NdisRequest);
typedef VOID STDCALL (*CO_REQUEST_COMPLETE_HANDLER)( typedef VOID STDCALL_FUNC (*CO_REQUEST_COMPLETE_HANDLER)(
IN NDIS_STATUS Status, IN NDIS_STATUS Status,
IN NDIS_HANDLE ProtocolAfContext OPTIONAL, IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
IN NDIS_HANDLE ProtocolVcContext OPTIONAL, IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
@ -987,7 +987,7 @@ typedef VOID STDCALL (*CO_REQUEST_COMPLETE_HANDLER)(
IN PNDIS_REQUEST NdisRequest); IN PNDIS_REQUEST NdisRequest);
typedef NDIS_STATUS STDCALL (*CM_OPEN_AF_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*CM_OPEN_AF_HANDLER)(
IN NDIS_HANDLE CallMgrBindingContext, IN NDIS_HANDLE CallMgrBindingContext,
IN PCO_ADDRESS_FAMILY AddressFamily, IN PCO_ADDRESS_FAMILY AddressFamily,
IN NDIS_HANDLE NdisAfHandle, IN NDIS_HANDLE NdisAfHandle,
@ -1043,7 +1043,7 @@ STDCALL
typedef typedef
NDIS_STATUS NDIS_STATUS
STDCALL (*CM_ADD_PARTY_HANDLER)( STDCALL_FUNC (*CM_ADD_PARTY_HANDLER)(
IN NDIS_HANDLE CallMgrVcContext, IN NDIS_HANDLE CallMgrVcContext,
IN OUT PCO_CALL_PARAMETERS CallParameters, IN OUT PCO_CALL_PARAMETERS CallParameters,
IN NDIS_HANDLE NdisPartyHandle, IN NDIS_HANDLE NdisPartyHandle,
@ -1052,7 +1052,7 @@ STDCALL (*CM_ADD_PARTY_HANDLER)(
typedef typedef
NDIS_STATUS NDIS_STATUS
STDCALL (*CM_DROP_PARTY_HANDLER)( STDCALL_FUNC (*CM_DROP_PARTY_HANDLER)(
IN NDIS_HANDLE CallMgrPartyContext, IN NDIS_HANDLE CallMgrPartyContext,
IN PVOID CloseData OPTIONAL, IN PVOID CloseData OPTIONAL,
IN UINT Size OPTIONAL IN UINT Size OPTIONAL
@ -1060,7 +1060,7 @@ STDCALL (*CM_DROP_PARTY_HANDLER)(
typedef typedef
VOID VOID
STDCALL (*CM_ACTIVATE_VC_COMPLETE_HANDLER)( STDCALL_FUNC (*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
IN NDIS_STATUS Status, IN NDIS_STATUS Status,
IN NDIS_HANDLE CallMgrVcContext, IN NDIS_HANDLE CallMgrVcContext,
IN PCO_CALL_PARAMETERS CallParameters IN PCO_CALL_PARAMETERS CallParameters
@ -1068,7 +1068,7 @@ STDCALL (*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
typedef typedef
VOID VOID
STDCALL (*CM_DEACTIVATE_VC_COMPLETE_HANDLER)( STDCALL_FUNC (*CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
IN NDIS_STATUS Status, IN NDIS_STATUS Status,
IN NDIS_HANDLE CallMgrVcContext IN NDIS_HANDLE CallMgrVcContext
); );
@ -1107,7 +1107,7 @@ typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
/* Call Manager clients */ /* Call Manager clients */
typedef VOID STDCALL (*CL_OPEN_AF_COMPLETE_HANDLER)( typedef VOID STDCALL_FUNC (*CL_OPEN_AF_COMPLETE_HANDLER)(
IN NDIS_STATUS Status, IN NDIS_STATUS Status,
IN NDIS_HANDLE ProtocolAfContext, IN NDIS_HANDLE ProtocolAfContext,
IN NDIS_HANDLE NdisAfHandle); IN NDIS_HANDLE NdisAfHandle);
@ -4211,7 +4211,7 @@ typedef struct _NDIS_ADAPTER_INFORMATION
/* Prototypes for NDIS_MAC_CHARACTERISTICS */ /* Prototypes for NDIS_MAC_CHARACTERISTICS */
typedef NDIS_STATUS STDCALL (*OPEN_ADAPTER_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*OPEN_ADAPTER_HANDLER)(
OUT PNDIS_STATUS OpenErrorStatus, OUT PNDIS_STATUS OpenErrorStatus,
OUT NDIS_HANDLE * MacBindingHandle, OUT NDIS_HANDLE * MacBindingHandle,
OUT PUINT SelectedMediumIndex, OUT PUINT SelectedMediumIndex,
@ -4222,25 +4222,25 @@ typedef NDIS_STATUS STDCALL (*OPEN_ADAPTER_HANDLER)(
IN UINT OpenOptions, IN UINT OpenOptions,
IN PSTRING AddressingInformation OPTIONAL); IN PSTRING AddressingInformation OPTIONAL);
typedef NDIS_STATUS STDCALL (*CLOSE_ADAPTER_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*CLOSE_ADAPTER_HANDLER)(
IN NDIS_HANDLE MacBindingHandle); IN NDIS_HANDLE MacBindingHandle);
typedef NDIS_STATUS STDCALL (*WAN_TRANSFER_DATA_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*WAN_TRANSFER_DATA_HANDLER)(
VOID); VOID);
typedef NDIS_STATUS STDCALL (*QUERY_GLOBAL_STATISTICS_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*QUERY_GLOBAL_STATISTICS_HANDLER)(
IN NDIS_HANDLE MacAdapterContext, IN NDIS_HANDLE MacAdapterContext,
IN PNDIS_REQUEST NdisRequest); IN PNDIS_REQUEST NdisRequest);
typedef VOID STDCALL (*UNLOAD_MAC_HANDLER)( typedef VOID STDCALL_FUNC (*UNLOAD_MAC_HANDLER)(
IN NDIS_HANDLE MacMacContext); IN NDIS_HANDLE MacMacContext);
typedef NDIS_STATUS STDCALL (*ADD_ADAPTER_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*ADD_ADAPTER_HANDLER)(
IN NDIS_HANDLE MacMacContext, IN NDIS_HANDLE MacMacContext,
IN NDIS_HANDLE WrapperConfigurationContext, IN NDIS_HANDLE WrapperConfigurationContext,
IN PNDIS_STRING AdapterName); IN PNDIS_STRING AdapterName);
typedef VOID STDCALL (*REMOVE_ADAPTER_HANDLER)( typedef VOID STDCALL_FUNC (*REMOVE_ADAPTER_HANDLER)(
IN NDIS_HANDLE MacAdapterContext); IN NDIS_HANDLE MacAdapterContext);
typedef struct _NDIS_MAC_CHARACTERISTICS typedef struct _NDIS_MAC_CHARACTERISTICS
@ -4538,21 +4538,21 @@ typedef NDIS_STATUS (FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
IN NDIS_WORK_ITEM_TYPE WorkItemType, IN NDIS_WORK_ITEM_TYPE WorkItemType,
IN PVOID WorkItemContext); IN PVOID WorkItemContext);
typedef VOID STDCALL (*NDIS_M_REQ_COMPLETE_HANDLER)( typedef VOID STDCALL_FUNC (*NDIS_M_REQ_COMPLETE_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_STATUS Status); IN NDIS_STATUS Status);
typedef VOID STDCALL (*NDIS_M_RESET_COMPLETE_HANDLER)( typedef VOID STDCALL_FUNC (*NDIS_M_RESET_COMPLETE_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE MiniportAdapterHandle,
IN NDIS_STATUS Status, IN NDIS_STATUS Status,
IN BOOLEAN AddressingReset); IN BOOLEAN AddressingReset);
typedef VOID STDCALL (*NDIS_M_SEND_COMPLETE_HANDLER)( typedef VOID STDCALL_FUNC (*NDIS_M_SEND_COMPLETE_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE MiniportAdapterHandle,
IN PNDIS_PACKET Packet, IN PNDIS_PACKET Packet,
IN NDIS_STATUS Status); IN NDIS_STATUS Status);
typedef VOID STDCALL (*NDIS_M_SEND_RESOURCES_HANDLER)( typedef VOID STDCALL_FUNC (*NDIS_M_SEND_RESOURCES_HANDLER)(
IN NDIS_HANDLE MiniportAdapterHandle); IN NDIS_HANDLE MiniportAdapterHandle);
typedef BOOLEAN (FASTCALL *NDIS_M_START_SENDS)( typedef BOOLEAN (FASTCALL *NDIS_M_START_SENDS)(
@ -4820,14 +4820,14 @@ struct _NDIS_MINIPORT_BLOCK {
/* Handler prototypes for NDIS_OPEN_BLOCK */ /* Handler prototypes for NDIS_OPEN_BLOCK */
typedef NDIS_STATUS STDCALL (*WAN_SEND_HANDLER)( typedef NDIS_STATUS STDCALL_FUNC (*WAN_SEND_HANDLER)(
IN NDIS_HANDLE MacBindingHandle, IN NDIS_HANDLE MacBindingHandle,
IN NDIS_HANDLE LinkHandle, IN NDIS_HANDLE LinkHandle,
IN PVOID Packet); IN PVOID Packet);
/* NDIS 4.0 extension */ /* NDIS 4.0 extension */
typedef VOID STDCALL (*SEND_PACKETS_HANDLER)( typedef VOID STDCALL_FUNC (*SEND_PACKETS_HANDLER)(
IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_HANDLE MiniportAdapterContext,
IN PPNDIS_PACKET PacketArray, IN PPNDIS_PACKET PacketArray,
IN UINT NumberOfPackets); IN UINT NumberOfPackets);

View File

@ -83,6 +83,8 @@
#define FOCUS_EVENT (16) #define FOCUS_EVENT (16)
#include <pshpack1.h>
typedef struct _KEY_EVENT_RECORD typedef struct _KEY_EVENT_RECORD
{ {
BOOL bKeyDown; BOOL bKeyDown;
@ -95,7 +97,10 @@ typedef struct _KEY_EVENT_RECORD
CHAR AsciiChar; CHAR AsciiChar;
} uChar; } uChar;
DWORD dwControlKeyState; DWORD dwControlKeyState;
} PACKED KEY_EVENT_RECORD; } KEY_EVENT_RECORD;
#include <poppack.h>
typedef struct _MOUSE_EVENT_RECORD typedef struct _MOUSE_EVENT_RECORD
{ {

View File

@ -15,8 +15,6 @@
#ifndef __USE_W32API #ifndef __USE_W32API
#define PACKED __attribute__((packed))
#define ANYSIZE_ARRAY (1) #define ANYSIZE_ARRAY (1)
#define DELETE (0x00010000L) #define DELETE (0x00010000L)

View File

@ -1,4 +1,4 @@
/* $Id: rtltypes.h,v 1.10 2003/08/25 01:37:47 sedwards Exp $ /* $Id: rtltypes.h,v 1.11 2004/01/05 14:28:19 weiden Exp $
* *
*/ */
@ -180,6 +180,9 @@ typedef struct _NLSTABLEINFO
PUSHORT LowerCaseTable; PUSHORT LowerCaseTable;
} NLSTABLEINFO, *PNLSTABLEINFO; } NLSTABLEINFO, *PNLSTABLEINFO;
#include <pshpack1.h>
typedef struct _NLS_FILE_HEADER typedef struct _NLS_FILE_HEADER
{ {
USHORT HeaderSize; USHORT HeaderSize;
@ -191,7 +194,9 @@ typedef struct _NLS_FILE_HEADER
USHORT TransUniDefaultChar; USHORT TransUniDefaultChar;
USHORT DBCSCodePage; USHORT DBCSCodePage;
UCHAR LeadByte[MAXIMUM_LEADBYTES]; UCHAR LeadByte[MAXIMUM_LEADBYTES];
} PACKED NLS_FILE_HEADER, *PNLS_FILE_HEADER; } NLS_FILE_HEADER, *PNLS_FILE_HEADER;
#include <poppack.h>
typedef struct _RTL_GENERIC_TABLE typedef struct _RTL_GENERIC_TABLE

View File

@ -10,6 +10,8 @@
#ifndef __ASM__ #ifndef __ASM__
#include <pshpack1.h>
typedef struct _KTSSNOIOPM typedef struct _KTSSNOIOPM
{ {
USHORT PreviousTask; USHORT PreviousTask;
@ -52,7 +54,8 @@ typedef struct _KTSSNOIOPM
USHORT IoMapBase; USHORT IoMapBase;
/* no interrupt redirection map */ /* no interrupt redirection map */
UCHAR IoBitmap[1]; UCHAR IoBitmap[1];
} PACKED KTSSNOIOPM; } KTSSNOIOPM;
typedef struct _KTSS typedef struct _KTSS
{ {
@ -96,7 +99,9 @@ typedef struct _KTSS
USHORT IoMapBase; USHORT IoMapBase;
/* no interrupt redirection map */ /* no interrupt redirection map */
UCHAR IoBitmap[8193]; UCHAR IoBitmap[8193];
} PACKED KTSS; } KTSS;
#include <poppack.h>
#endif /* not __ASM__ */ #endif /* not __ASM__ */

View File

@ -220,13 +220,17 @@ typedef struct _BITMAPCOREINFO {
RGBTRIPLE bmciColors[1]; RGBTRIPLE bmciColors[1];
} BITMAPCOREINFO, *PBITMAPCOREINFO, *LPBITMAPCOREINFO; } BITMAPCOREINFO, *PBITMAPCOREINFO, *LPBITMAPCOREINFO;
#include <pshpack1.h>
typedef struct tagBITMAPFILEHEADER { typedef struct tagBITMAPFILEHEADER {
WORD bfType; WORD bfType;
DWORD bfSize; DWORD bfSize;
WORD bfReserved1; WORD bfReserved1;
WORD bfReserved2; WORD bfReserved2;
DWORD bfOffBits; DWORD bfOffBits;
} PACKED BITMAPFILEHEADER; } BITMAPFILEHEADER;
#include <poppack.h>
typedef struct tagBITMAPINFOHEADER { typedef struct tagBITMAPINFOHEADER {
DWORD biSize; DWORD biSize;
@ -510,7 +514,7 @@ typedef struct _RTL_RANGE {
typedef typedef
BOOLEAN BOOLEAN
CALLBACK (*PRTL_CONFLICT_RANGE_CALLBACK) ( (CALLBACK *PRTL_CONFLICT_RANGE_CALLBACK) (
PVOID Context, PVOID Context,
PRTL_RANGE Range PRTL_RANGE Range
); );
@ -1406,6 +1410,9 @@ typedef struct _DISK_PERFORMANCE {
DWORD QueueDepth; DWORD QueueDepth;
} DISK_PERFORMANCE ; } DISK_PERFORMANCE ;
#include <pshpack1.h>
typedef struct { typedef struct {
DWORD style; DWORD style;
DWORD dwExtendedStyle; DWORD dwExtendedStyle;
@ -1414,7 +1421,7 @@ typedef struct {
short cx; short cx;
short cy; short cy;
WORD id; WORD id;
} PACKED DLGITEMTEMPLATE; } DLGITEMTEMPLATE;
typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATE; typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATE;
typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATE; typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATE;
@ -1427,7 +1434,10 @@ typedef struct {
short y; short y;
short cx; short cx;
short cy; short cy;
} PACKED DLGTEMPLATE; } DLGTEMPLATE;
#include <poppack.h>
typedef DLGTEMPLATE *LPDLGTEMPLATE; typedef DLGTEMPLATE *LPDLGTEMPLATE;
typedef const DLGTEMPLATE *LPCDLGTEMPLATE; typedef const DLGTEMPLATE *LPCDLGTEMPLATE;
@ -3254,6 +3264,9 @@ typedef struct tagMETAFILEPICT {
HMETAFILE hMF; HMETAFILE hMF;
} METAFILEPICT, *PMETAFILEPICT, *LPMETAFILEPICT; } METAFILEPICT, *PMETAFILEPICT, *LPMETAFILEPICT;
#include <pshpack1.h>
typedef struct tagMETAHEADER { typedef struct tagMETAHEADER {
WORD mtType; WORD mtType;
WORD mtHeaderSize; WORD mtHeaderSize;
@ -3262,7 +3275,10 @@ typedef struct tagMETAHEADER {
WORD mtNoObjects; WORD mtNoObjects;
DWORD mtMaxRecord; DWORD mtMaxRecord;
WORD mtNoParameters; WORD mtNoParameters;
} PACKED METAHEADER; } METAHEADER;
#include <poppack.h>
typedef struct tagMETARECORD { typedef struct tagMETARECORD {
DWORD rdSize; DWORD rdSize;
@ -4299,6 +4315,9 @@ typedef struct _PREVENT_MEDIA_REMOVAL {
BOOLEAN PreventMediaRemoval; BOOLEAN PreventMediaRemoval;
} PREVENT_MEDIA_REMOVAL ; } PREVENT_MEDIA_REMOVAL ;
#include <pshpack1.h>
typedef struct tagPDA { typedef struct tagPDA {
DWORD lStructSize; DWORD lStructSize;
HWND hwndOwner; HWND hwndOwner;
@ -4319,7 +4338,7 @@ typedef struct tagPDA {
LPCSTR lpSetupTemplateName; LPCSTR lpSetupTemplateName;
HANDLE hPrintTemplate; HANDLE hPrintTemplate;
HANDLE hSetupTemplate; HANDLE hSetupTemplate;
} PACKED PRINTDLGA, *LPPRINTDLGA; } PRINTDLGA, *LPPRINTDLGA;
typedef struct tagPDW { typedef struct tagPDW {
DWORD lStructSize; DWORD lStructSize;
@ -4341,7 +4360,10 @@ typedef struct tagPDW {
LPCWSTR lpSetupTemplateName; LPCWSTR lpSetupTemplateName;
HANDLE hPrintTemplate; HANDLE hPrintTemplate;
HANDLE hSetupTemplate; HANDLE hSetupTemplate;
} PACKED PRINTDLGW, *LPPRINTDLGW; } PRINTDLGW, *LPPRINTDLGW;
#include <poppack.h>
typedef_tident(PRINTDLG) typedef_tident(PRINTDLG)
typedef_tident(LPPRINTDLG) typedef_tident(LPPRINTDLG)

View File

@ -5,6 +5,8 @@
#include <win32k/dc.h> #include <win32k/dc.h>
#include <win32k/gdiobj.h> #include <win32k/gdiobj.h>
#include <pshpack1.h>
/* Structures for reading icon/cursor files and resources */ /* Structures for reading icon/cursor files and resources */
// Structures for reading icon files and resources // Structures for reading icon files and resources
typedef struct _ICONIMAGE typedef struct _ICONIMAGE
@ -13,7 +15,7 @@ typedef struct _ICONIMAGE
RGBQUAD icColors[1]; // Color table RGBQUAD icColors[1]; // Color table
BYTE icXOR[1]; // DIB bits for XOR mask BYTE icXOR[1]; // DIB bits for XOR mask
BYTE icAND[1]; // DIB bits for AND mask BYTE icAND[1]; // DIB bits for AND mask
} PACKED ICONIMAGE, *LPICONIMAGE; } ICONIMAGE, *LPICONIMAGE;
typedef struct _CURSORIMAGE typedef struct _CURSORIMAGE
{ {
@ -21,7 +23,7 @@ typedef struct _CURSORIMAGE
RGBQUAD icColors[1]; // Color table RGBQUAD icColors[1]; // Color table
BYTE icXOR[1]; // DIB bits for XOR mask BYTE icXOR[1]; // DIB bits for XOR mask
BYTE icAND[1]; // DIB bits for AND mask BYTE icAND[1]; // DIB bits for AND mask
} PACKED CURSORIMAGE, *LPCURSORIMAGE; } CURSORIMAGE, *LPCURSORIMAGE;
typedef struct typedef struct
{ {
@ -29,25 +31,25 @@ typedef struct
BYTE bHeight; BYTE bHeight;
BYTE bColorCount; BYTE bColorCount;
BYTE bReserved; BYTE bReserved;
} PACKED ICONRESDIR; } ICONRESDIR;
typedef struct typedef struct
{ {
WORD wWidth; WORD wWidth;
WORD wHeight; WORD wHeight;
} PACKED CURSORRESDIR; } CURSORRESDIR;
typedef struct typedef struct
{ {
WORD wPlanes; // Number of Color Planes in the XOR image WORD wPlanes; // Number of Color Planes in the XOR image
WORD wBitCount; // Bits per pixel in the XOR image WORD wBitCount; // Bits per pixel in the XOR image
} PACKED ICONDIR; } ICONDIR;
typedef struct typedef struct
{ {
WORD wXHotspot; // Number of Color Planes in the XOR image WORD wXHotspot; // Number of Color Planes in the XOR image
WORD wYHotspot; // Bits per pixel in the XOR image WORD wYHotspot; // Bits per pixel in the XOR image
} PACKED CURSORDIR; } CURSORDIR;
typedef struct typedef struct
{ {
@ -61,15 +63,15 @@ typedef struct
} Info; } Info;
DWORD dwBytesInRes; // How many bytes in this resource? DWORD dwBytesInRes; // How many bytes in this resource?
DWORD dwImageOffset; // Where in the file is this image? DWORD dwImageOffset; // Where in the file is this image?
} PACKED CURSORICONDIRENTRY; } CURSORICONDIRENTRY;
typedef struct typedef struct
{ {
WORD idReserved; // Reserved (must be 0) WORD idReserved; // Reserved (must be 0)
WORD idType; // Resource Type (1 for icons, 0 for cursors) WORD idType; // Resource Type (1 for icons, 0 for cursors)
WORD idCount; // How many images? WORD idCount; // How many images?
CURSORICONDIRENTRY idEntries[1] __attribute__((packed)); // An entry for idCount number of images CURSORICONDIRENTRY idEntries[1]; // An entry for idCount number of images
} PACKED CURSORICONDIR; } CURSORICONDIR;
typedef struct typedef struct
{ {
@ -81,14 +83,16 @@ typedef struct
WORD wBitCount; // Bits per pixel WORD wBitCount; // Bits per pixel
DWORD dwBytesInRes; // how many bytes in this resource? DWORD dwBytesInRes; // how many bytes in this resource?
WORD nID; // the ID WORD nID; // the ID
} PACKED GRPCURSORICONDIRENTRY; } GRPCURSORICONDIRENTRY;
typedef struct typedef struct
{ {
WORD idReserved; // Reserved (must be 0) WORD idReserved; // Reserved (must be 0)
WORD idType; // Resource type (1 for icons) WORD idType; // Resource type (1 for icons)
WORD idCount; // How many images? WORD idCount; // How many images?
GRPCURSORICONDIRENTRY idEntries[1] PACKED; // The entries for each image GRPCURSORICONDIRENTRY idEntries[1]; // The entries for each image
} PACKED GRPCURSORICONDIR; } GRPCURSORICONDIR;
#include <poppack.h>
#endif #endif

View File

@ -4,8 +4,8 @@
#include <ddk/winddi.h> #include <ddk/winddi.h>
typedef BOOL STDCALL (*PGD_ENABLEDRIVER)(ULONG, ULONG, PDRVENABLEDATA); typedef BOOL STDCALL_FUNC (*PGD_ENABLEDRIVER)(ULONG, ULONG, PDRVENABLEDATA);
typedef DHPDEV STDCALL (*PGD_ENABLEPDEV)(DEVMODEW *, typedef DHPDEV STDCALL_FUNC (*PGD_ENABLEPDEV)(DEVMODEW *,
LPWSTR, LPWSTR,
ULONG, ULONG,
HSURF *, HSURF *,
@ -16,84 +16,84 @@ typedef DHPDEV STDCALL (*PGD_ENABLEPDEV)(DEVMODEW *,
LPWSTR, LPWSTR,
LPWSTR, LPWSTR,
HANDLE); HANDLE);
typedef VOID STDCALL (*PGD_COMPLETEPDEV)(DHPDEV, HDEV); typedef VOID STDCALL_FUNC (*PGD_COMPLETEPDEV)(DHPDEV, HDEV);
typedef VOID STDCALL (*PGD_DISABLEPDEV)(DHPDEV); typedef VOID STDCALL_FUNC (*PGD_DISABLEPDEV)(DHPDEV);
typedef HSURF STDCALL (*PGD_ENABLESURFACE)(DHPDEV); typedef HSURF STDCALL_FUNC (*PGD_ENABLESURFACE)(DHPDEV);
typedef VOID STDCALL (*PGD_DISABLESURFACE)(DHPDEV); typedef VOID STDCALL_FUNC (*PGD_DISABLESURFACE)(DHPDEV);
typedef BOOL STDCALL (*PGD_ASSERTMODE)(DHPDEV, BOOL); typedef BOOL STDCALL_FUNC (*PGD_ASSERTMODE)(DHPDEV, BOOL);
typedef BOOL STDCALL (*PGD_RESETPDEV)(DHPDEV, DHPDEV); typedef BOOL STDCALL_FUNC (*PGD_RESETPDEV)(DHPDEV, DHPDEV);
typedef HBITMAP STDCALL (*PGD_CREATEDEVICEBITMAP)(DHPDEV, SIZEL, ULONG); typedef HBITMAP STDCALL_FUNC (*PGD_CREATEDEVICEBITMAP)(DHPDEV, SIZEL, ULONG);
typedef VOID STDCALL (*PGD_DELETEDEVICEBITMAP)(DHSURF); typedef VOID STDCALL_FUNC (*PGD_DELETEDEVICEBITMAP)(DHSURF);
typedef BOOL STDCALL (*PGD_REALIZEBRUSH)(BRUSHOBJ*, SURFOBJ*, SURFOBJ*, SURFOBJ*, typedef BOOL STDCALL_FUNC (*PGD_REALIZEBRUSH)(BRUSHOBJ*, SURFOBJ*, SURFOBJ*, SURFOBJ*,
XLATEOBJ*, ULONG); XLATEOBJ*, ULONG);
typedef ULONG STDCALL (*PGD_DITHERCOLOR)(DHPDEV, ULONG, ULONG, PULONG); typedef ULONG STDCALL_FUNC (*PGD_DITHERCOLOR)(DHPDEV, ULONG, ULONG, PULONG);
typedef BOOL STDCALL (*PGD_STROKEPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, XFORMOBJ*, typedef BOOL STDCALL_FUNC (*PGD_STROKEPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, XFORMOBJ*,
BRUSHOBJ*, POINTL*, PLINEATTRS, MIX); BRUSHOBJ*, POINTL*, PLINEATTRS, MIX);
typedef BOOL STDCALL (*PGD_FILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, BRUSHOBJ*, typedef BOOL STDCALL_FUNC (*PGD_FILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, BRUSHOBJ*,
POINTL*, MIX, ULONG); POINTL*, MIX, ULONG);
typedef BOOL STDCALL (*PGD_STROKEANDFILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*, typedef BOOL STDCALL_FUNC (*PGD_STROKEANDFILLPATH)(SURFOBJ*, PATHOBJ*, CLIPOBJ*,
XFORMOBJ*, BRUSHOBJ*, PLINEATTRS, XFORMOBJ*, BRUSHOBJ*, PLINEATTRS,
BRUSHOBJ*, POINTL*, MIX, ULONG); BRUSHOBJ*, POINTL*, MIX, ULONG);
typedef BOOL STDCALL (*PGD_PAINT)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, POINTL*, MIX); typedef BOOL STDCALL_FUNC (*PGD_PAINT)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, POINTL*, MIX);
typedef BOOL STDCALL (*PGD_BITBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, typedef BOOL STDCALL_FUNC (*PGD_BITBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*,
XLATEOBJ*, RECTL*, POINTL*, POINTL*, BRUSHOBJ*, XLATEOBJ*, RECTL*, POINTL*, POINTL*, BRUSHOBJ*,
POINTL*, ROP4); POINTL*, ROP4);
typedef BOOL STDCALL (*PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, ULONG, ULONG); typedef BOOL STDCALL_FUNC (*PGD_TRANSPARENTBLT)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, RECTL*, ULONG, ULONG);
typedef BOOL STDCALL (*PGD_COPYBITS)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, typedef BOOL STDCALL_FUNC (*PGD_COPYBITS)(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*,
RECTL*, POINTL*); RECTL*, POINTL*);
typedef BOOL STDCALL (*PGD_STRETCHBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, typedef BOOL STDCALL_FUNC (*PGD_STRETCHBLT)(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*,
XLATEOBJ*, COLORADJUSTMENT*, POINTL*, XLATEOBJ*, COLORADJUSTMENT*, POINTL*,
RECTL*, RECTL*, POINTL*, ULONG); RECTL*, RECTL*, POINTL*, ULONG);
typedef BOOL STDCALL (*PGD_SETPALETTE)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG); typedef BOOL STDCALL_FUNC (*PGD_SETPALETTE)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG);
typedef BOOL STDCALL (*PGD_TEXTOUT)(SURFOBJ*, STROBJ*, FONTOBJ*, CLIPOBJ*, RECTL*, typedef BOOL STDCALL_FUNC (*PGD_TEXTOUT)(SURFOBJ*, STROBJ*, FONTOBJ*, CLIPOBJ*, RECTL*,
RECTL*, BRUSHOBJ*, BRUSHOBJ*, POINTL*, MIX); RECTL*, BRUSHOBJ*, BRUSHOBJ*, POINTL*, MIX);
typedef ULONG STDCALL (*PGD_ESCAPE)(SURFOBJ*, ULONG, ULONG, PVOID *, ULONG, PVOID *); typedef ULONG STDCALL_FUNC (*PGD_ESCAPE)(SURFOBJ*, ULONG, ULONG, PVOID *, ULONG, PVOID *);
typedef ULONG STDCALL (*PGD_DRAWESCAPE)(SURFOBJ*, ULONG, CLIPOBJ*, RECTL*, ULONG, typedef ULONG STDCALL_FUNC (*PGD_DRAWESCAPE)(SURFOBJ*, ULONG, CLIPOBJ*, RECTL*, ULONG,
PVOID *); PVOID *);
typedef PIFIMETRICS STDCALL (*PGD_QUERYFONT)(DHPDEV, ULONG, ULONG, PULONG); typedef PIFIMETRICS STDCALL_FUNC (*PGD_QUERYFONT)(DHPDEV, ULONG, ULONG, PULONG);
typedef PVOID STDCALL (*PGD_QUERYFONTTREE)(DHPDEV, ULONG, ULONG, ULONG, PULONG); typedef PVOID STDCALL_FUNC (*PGD_QUERYFONTTREE)(DHPDEV, ULONG, ULONG, ULONG, PULONG);
typedef LONG STDCALL (*PGD_QUERYFONTDATA)(DHPDEV, FONTOBJ*, ULONG, HGLYPH, GLYPHDATA*, typedef LONG STDCALL_FUNC (*PGD_QUERYFONTDATA)(DHPDEV, FONTOBJ*, ULONG, HGLYPH, GLYPHDATA*,
PVOID, ULONG); PVOID, ULONG);
typedef ULONG STDCALL (*PGD_SETPOINTERSHAPE)(SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*, typedef ULONG STDCALL_FUNC (*PGD_SETPOINTERSHAPE)(SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*,
LONG, LONG, LONG, LONG, RECTL*, ULONG); LONG, LONG, LONG, LONG, RECTL*, ULONG);
typedef VOID STDCALL (*PGD_MOVEPOINTER)(SURFOBJ*, LONG, LONG, RECTL*); typedef VOID STDCALL_FUNC (*PGD_MOVEPOINTER)(SURFOBJ*, LONG, LONG, RECTL*);
typedef BOOL STDCALL (*PGD_LINETO)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, LONG, LONG, LONG, typedef BOOL STDCALL_FUNC (*PGD_LINETO)(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, LONG, LONG, LONG,
LONG, RECTL*, MIX); LONG, RECTL*, MIX);
typedef BOOL STDCALL (*PGD_SENDPAGE)(SURFOBJ*); typedef BOOL STDCALL_FUNC (*PGD_SENDPAGE)(SURFOBJ*);
typedef BOOL STDCALL (*PGD_STARTPAGE)(SURFOBJ*); typedef BOOL STDCALL_FUNC (*PGD_STARTPAGE)(SURFOBJ*);
typedef BOOL STDCALL (*PGD_ENDDOC)(SURFOBJ*, ULONG); typedef BOOL STDCALL_FUNC (*PGD_ENDDOC)(SURFOBJ*, ULONG);
typedef BOOL STDCALL (*PGD_STARTDOC)(SURFOBJ*, PWSTR, DWORD); typedef BOOL STDCALL_FUNC (*PGD_STARTDOC)(SURFOBJ*, PWSTR, DWORD);
typedef ULONG STDCALL (*PGD_GETGLYPHMODE)(DHPDEV, FONTOBJ*); typedef ULONG STDCALL_FUNC (*PGD_GETGLYPHMODE)(DHPDEV, FONTOBJ*);
typedef VOID STDCALL (*PGD_SYNCHRONIZE)(DHPDEV, RECTL*); typedef VOID STDCALL_FUNC (*PGD_SYNCHRONIZE)(DHPDEV, RECTL*);
typedef ULONG STDCALL (*PGD_SAVESCREENBITS)(SURFOBJ*, ULONG, ULONG, RECTL*); typedef ULONG STDCALL_FUNC (*PGD_SAVESCREENBITS)(SURFOBJ*, ULONG, ULONG, RECTL*);
typedef ULONG STDCALL (*PGD_GETMODES)(HANDLE, ULONG, PDEVMODEW); typedef ULONG STDCALL_FUNC (*PGD_GETMODES)(HANDLE, ULONG, PDEVMODEW);
typedef VOID STDCALL (*PGD_FREE)(PVOID, ULONG); typedef VOID STDCALL_FUNC (*PGD_FREE)(PVOID, ULONG);
typedef VOID STDCALL (*PGD_DESTROYFONT)(FONTOBJ*); typedef VOID STDCALL_FUNC (*PGD_DESTROYFONT)(FONTOBJ*);
typedef LONG STDCALL (*PGD_QUERYFONTCAPS)(ULONG, PULONG); typedef LONG STDCALL_FUNC (*PGD_QUERYFONTCAPS)(ULONG, PULONG);
typedef ULONG STDCALL (*PGD_LOADFONTFILE)(ULONG, PVOID, ULONG, ULONG); typedef ULONG STDCALL_FUNC (*PGD_LOADFONTFILE)(ULONG, PVOID, ULONG, ULONG);
typedef BOOL STDCALL (*PGD_UNLOADFONTFILE)(ULONG); typedef BOOL STDCALL_FUNC (*PGD_UNLOADFONTFILE)(ULONG);
typedef ULONG STDCALL (*PGD_FONTMANAGEMENT)(SURFOBJ*, FONTOBJ*, ULONG, ULONG, PVOID, typedef ULONG STDCALL_FUNC (*PGD_FONTMANAGEMENT)(SURFOBJ*, FONTOBJ*, ULONG, ULONG, PVOID,
ULONG, PVOID); ULONG, PVOID);
typedef LONG STDCALL (*PGD_QUERYTRUETYPETABLE)(ULONG, ULONG, ULONG, PTRDIFF, ULONG, typedef LONG STDCALL_FUNC (*PGD_QUERYTRUETYPETABLE)(ULONG, ULONG, ULONG, PTRDIFF, ULONG,
PBYTE); PBYTE);
typedef LONG STDCALL (*PGD_QUERYTRUETYPEOUTLINE)(DHPDEV, FONTOBJ*, HGLYPH, BOOL, typedef LONG STDCALL_FUNC (*PGD_QUERYTRUETYPEOUTLINE)(DHPDEV, FONTOBJ*, HGLYPH, BOOL,
GLYPHDATA*, ULONG, TTPOLYGONHEADER*); GLYPHDATA*, ULONG, TTPOLYGONHEADER*);
typedef PVOID STDCALL (*PGD_GETTRUETYPEFILE)(ULONG, PULONG); typedef PVOID STDCALL_FUNC (*PGD_GETTRUETYPEFILE)(ULONG, PULONG);
typedef LONG STDCALL (*PGD_QUERYFONTFILE)(ULONG, ULONG, ULONG, PULONG); typedef LONG STDCALL_FUNC (*PGD_QUERYFONTFILE)(ULONG, ULONG, ULONG, PULONG);
typedef BOOL STDCALL (*PGD_QUERYADVANCEWIDTHS)(DHPDEV, FONTOBJ*, ULONG, HGLYPH *, typedef BOOL STDCALL_FUNC (*PGD_QUERYADVANCEWIDTHS)(DHPDEV, FONTOBJ*, ULONG, HGLYPH *,
PVOID *, ULONG); PVOID *, ULONG);
typedef BOOL STDCALL (*PGD_SETPIXELFORMAT)(SURFOBJ*, LONG, ULONG); typedef BOOL STDCALL_FUNC (*PGD_SETPIXELFORMAT)(SURFOBJ*, LONG, ULONG);
typedef LONG STDCALL (*PGD_DESCRIBEPIXELFORMAT)(DHPDEV, LONG, ULONG, typedef LONG STDCALL_FUNC (*PGD_DESCRIBEPIXELFORMAT)(DHPDEV, LONG, ULONG,
PPIXELFORMATDESCRIPTOR); PPIXELFORMATDESCRIPTOR);
typedef BOOL STDCALL (*PGD_SWAPBUFFERS)(SURFOBJ*, PWNDOBJ); typedef BOOL STDCALL_FUNC (*PGD_SWAPBUFFERS)(SURFOBJ*, PWNDOBJ);
typedef BOOL STDCALL (*PGD_STARTBANDING)(SURFOBJ*, POINTL*); typedef BOOL STDCALL_FUNC (*PGD_STARTBANDING)(SURFOBJ*, POINTL*);
typedef BOOL STDCALL (*PGD_NEXTBAND)(SURFOBJ*, POINTL*); typedef BOOL STDCALL_FUNC (*PGD_NEXTBAND)(SURFOBJ*, POINTL*);
typedef BOOL STDCALL (*PGD_GETDIRECTDRAWINFO)(DHPDEV, PDD_HALINFO, PDWORD, VIDEOMEMORY*, PDWORD, PDWORD); typedef BOOL STDCALL_FUNC (*PGD_GETDIRECTDRAWINFO)(DHPDEV, PDD_HALINFO, PDWORD, VIDEOMEMORY*, PDWORD, PDWORD);
typedef BOOL STDCALL (*PGD_ENABLEDIRECTDRAW)(DHPDEV, PDD_CALLBACKS, PDD_SURFACECALLBACKS, PDD_PALETTECALLBACKS); typedef BOOL STDCALL_FUNC (*PGD_ENABLEDIRECTDRAW)(DHPDEV, PDD_CALLBACKS, PDD_SURFACECALLBACKS, PDD_PALETTECALLBACKS);
typedef VOID STDCALL (*PGD_DISABLEDIRECTDRAW)(DHPDEV); typedef VOID STDCALL_FUNC (*PGD_DISABLEDIRECTDRAW)(DHPDEV);
typedef LONG STDCALL (*PGD_QUERYSPOOLTYPE)(DHPDEV, LPWSTR); typedef LONG STDCALL_FUNC (*PGD_QUERYSPOOLTYPE)(DHPDEV, LPWSTR);
typedef struct _DRIVER_FUNCTIONS typedef struct _DRIVER_FUNCTIONS

View File

@ -39,6 +39,7 @@ static inline struct _TEB * NtCurrentTeb(void)
{ {
struct _TEB * pTeb; struct _TEB * pTeb;
#if defined(__GNUC__)
/* FIXME: instead of hardcoded offsets, use offsetof() - if possible */ /* FIXME: instead of hardcoded offsets, use offsetof() - if possible */
__asm__ __volatile__ __asm__ __volatile__
( (
@ -46,6 +47,12 @@ static inline struct _TEB * NtCurrentTeb(void)
: "=r" (pTeb) /* can't have two memory operands */ : "=r" (pTeb) /* can't have two memory operands */
: /* no inputs */ : /* no inputs */
); );
#elif defined(_MSC_VER)
__asm mov eax, fs:0x18
__asm mov pTeb, eax
#else
#error Unknown compiler for inline assembler
#endif
return pTeb; return pTeb;
} }

View File

@ -52,7 +52,11 @@
// BLOCK_OFFSET = offset in file after header block // BLOCK_OFFSET = offset in file after header block
typedef ULONG BLOCK_OFFSET, *PBLOCK_OFFSET; typedef ULONG BLOCK_OFFSET, *PBLOCK_OFFSET;
#include <pshpack1.h>
/* header for registry hive file : */ /* header for registry hive file : */
typedef struct _HIVE_HEADER typedef struct _HIVE_HEADER
{ {
/* Hive identifier "regf" (0x66676572) */ /* Hive identifier "regf" (0x66676572) */
@ -97,7 +101,8 @@ typedef struct _HIVE_HEADER
/* Checksum of first 0x200 bytes */ /* Checksum of first 0x200 bytes */
ULONG Checksum; ULONG Checksum;
} __attribute__((packed)) HIVE_HEADER, *PHIVE_HEADER; } HIVE_HEADER, *PHIVE_HEADER;
typedef struct _HBIN typedef struct _HBIN
{ {
@ -118,13 +123,15 @@ typedef struct _HBIN
/* ? */ /* ? */
ULONG Unused2; ULONG Unused2;
} __attribute__((packed)) HBIN, *PHBIN; } HBIN, *PHBIN;
typedef struct _CELL_HEADER typedef struct _CELL_HEADER
{ {
/* <0 if used, >0 if free */ /* <0 if used, >0 if free */
LONG CellSize; LONG CellSize;
} __attribute__((packed)) CELL_HEADER, *PCELL_HEADER; } CELL_HEADER, *PCELL_HEADER;
typedef struct _KEY_CELL typedef struct _KEY_CELL
{ {
@ -180,8 +187,9 @@ typedef struct _KEY_CELL
USHORT ClassSize; USHORT ClassSize;
/* Name of key (not zero terminated) */ /* Name of key (not zero terminated) */
UCHAR Name[0]; UCHAR Name[1];
} __attribute__((packed)) KEY_CELL, *PKEY_CELL; } KEY_CELL, *PKEY_CELL;
/* KEY_CELL.Flags constants */ /* KEY_CELL.Flags constants */
#define REG_KEY_ROOT_CELL 0x0C #define REG_KEY_ROOT_CELL 0x0C
@ -199,7 +207,7 @@ typedef struct _HASH_RECORD
{ {
BLOCK_OFFSET KeyOffset; BLOCK_OFFSET KeyOffset;
ULONG HashValue; ULONG HashValue;
} __attribute__((packed)) HASH_RECORD, *PHASH_RECORD; } HASH_RECORD, *PHASH_RECORD;
typedef struct _HASH_TABLE_CELL typedef struct _HASH_TABLE_CELL
{ {
@ -207,14 +215,14 @@ typedef struct _HASH_TABLE_CELL
USHORT Id; USHORT Id;
USHORT HashTableSize; USHORT HashTableSize;
HASH_RECORD Table[0]; HASH_RECORD Table[0];
} __attribute__((packed)) HASH_TABLE_CELL, *PHASH_TABLE_CELL; } HASH_TABLE_CELL, *PHASH_TABLE_CELL;
typedef struct _VALUE_LIST_CELL typedef struct _VALUE_LIST_CELL
{ {
LONG CellSize; LONG CellSize;
BLOCK_OFFSET ValueOffset[0]; BLOCK_OFFSET ValueOffset[0];
} __attribute__((packed)) VALUE_LIST_CELL, *PVALUE_LIST_CELL; } VALUE_LIST_CELL, *PVALUE_LIST_CELL;
typedef struct _VALUE_CELL typedef struct _VALUE_CELL
{ {
@ -227,7 +235,7 @@ typedef struct _VALUE_CELL
USHORT Flags; USHORT Flags;
USHORT Unused1; USHORT Unused1;
UCHAR Name[0]; /* warning : not zero terminated */ UCHAR Name[0]; /* warning : not zero terminated */
} __attribute__((packed)) VALUE_CELL, *PVALUE_CELL; } VALUE_CELL, *PVALUE_CELL;
/* VALUE_CELL.Flags constants */ /* VALUE_CELL.Flags constants */
#define REG_VALUE_NAME_PACKED 0x0001 #define REG_VALUE_NAME_PACKED 0x0001
@ -241,7 +249,10 @@ typedef struct _DATA_CELL
{ {
LONG CellSize; LONG CellSize;
UCHAR Data[0]; UCHAR Data[0];
} __attribute__((packed)) DATA_CELL, *PDATA_CELL; } DATA_CELL, *PDATA_CELL;
#include <poppack.h>
typedef struct _REGISTRY_HIVE typedef struct _REGISTRY_HIVE
{ {

View File

@ -1,4 +1,4 @@
/* $Id: import.c,v 1.26 2003/12/14 17:58:00 hbirr Exp $ /* $Id: import.c,v 1.27 2004/01/05 14:28:19 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -105,7 +105,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
ExFreePool (Hive->BlockList); ExFreePool (Hive->BlockList);
ExFreePool (Hive->HiveHeader); ExFreePool (Hive->HiveHeader);
ExFreePool (Hive); ExFreePool (Hive);
return Status; return (BOOLEAN)Status;
} }
/* Initialize the free cell list */ /* Initialize the free cell list */
@ -118,7 +118,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
ExFreePool (Hive->HiveHeader); ExFreePool (Hive->HiveHeader);
ExFreePool (Hive); ExFreePool (Hive);
return Status; return (BOOLEAN)Status;
} }
if (!(Hive->Flags & HIVE_NO_FILE)) if (!(Hive->Flags & HIVE_NO_FILE))
@ -134,7 +134,7 @@ CmImportBinaryHive (PCHAR ChunkBase,
ExFreePool (Hive->HiveHeader); ExFreePool (Hive->HiveHeader);
ExFreePool (Hive); ExFreePool (Hive);
return Status; return (BOOLEAN)Status;
} }
} }

View File

@ -2251,7 +2251,7 @@ CmiGetMaxValueDataLength(PREGISTRY_HIVE RegistryHive,
CurValueCell = CmiGetCell (RegistryHive, CurValueCell = CmiGetCell (RegistryHive,
ValueListCell->ValueOffset[i],NULL); ValueListCell->ValueOffset[i],NULL);
if ((CurValueCell != NULL) && if ((CurValueCell != NULL) &&
(MaxValueData < (CurValueCell->DataSize & REG_DATA_SIZE_MASK))) (MaxValueData < (LONG)(CurValueCell->DataSize & REG_DATA_SIZE_MASK)))
{ {
MaxValueData = CurValueCell->DataSize & REG_DATA_SIZE_MASK; MaxValueData = CurValueCell->DataSize & REG_DATA_SIZE_MASK;
} }
@ -2752,7 +2752,7 @@ CmiScanKeyForValue(IN PREGISTRY_HIVE RegistryHive,
CmiComparePackedNames(ValueName, CmiComparePackedNames(ValueName,
CurValueCell->Name, CurValueCell->Name,
CurValueCell->NameSize, CurValueCell->NameSize,
CurValueCell->Flags & REG_VALUE_NAME_PACKED)) (BOOLEAN)((CurValueCell->Flags & REG_VALUE_NAME_PACKED) ? TRUE : FALSE)))
{ {
*ValueCell = CurValueCell; *ValueCell = CurValueCell;
if (VBOffset) if (VBOffset)
@ -2929,7 +2929,7 @@ CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
CmiComparePackedNames(ValueName, CmiComparePackedNames(ValueName,
CurValueCell->Name, CurValueCell->Name,
CurValueCell->NameSize, CurValueCell->NameSize,
CurValueCell->Flags & REG_VALUE_NAME_PACKED)) (BOOLEAN)((CurValueCell->Flags & REG_VALUE_NAME_PACKED) ? TRUE : FALSE)))
{ {
CmiDestroyValueCell(RegistryHive, CurValueCell, ValueListCell->ValueOffset[i]); CmiDestroyValueCell(RegistryHive, CurValueCell, ValueListCell->ValueOffset[i]);
@ -2993,8 +2993,9 @@ CmiAllocateHashTableCell (IN PREGISTRY_HIVE RegistryHive,
} }
else else
{ {
assert(SubKeyCount <= 0xffff); /* should really be USHORT_MAX or similar */
NewHashBlock->Id = REG_HASH_TABLE_CELL_ID; NewHashBlock->Id = REG_HASH_TABLE_CELL_ID;
NewHashBlock->HashTableSize = SubKeyCount; NewHashBlock->HashTableSize = (USHORT)SubKeyCount;
*HashBlock = NewHashBlock; *HashBlock = NewHashBlock;
} }
@ -3107,8 +3108,9 @@ CmiAllocateValueCell(PREGISTRY_HIVE RegistryHive,
} }
else else
{ {
assert(NameSize <= 0xffff); /* should really be USHORT_MAX or similar */
NewValueCell->Id = REG_VALUE_CELL_ID; NewValueCell->Id = REG_VALUE_CELL_ID;
NewValueCell->NameSize = NameSize; NewValueCell->NameSize = (USHORT)NameSize;
if (Packable) if (Packable)
{ {
/* Pack the value name */ /* Pack the value name */

View File

@ -53,13 +53,14 @@ NtShutdownSystem(IN SHUTDOWN_ACTION Action)
#else #else
PopSetSystemPowerState(PowerSystemShutdown); PopSetSystemPowerState(PowerSystemShutdown);
#ifdef __GNUC__ #if defined(__GNUC__)
__asm__("cli\n"); __asm__("cli\n");
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm cli __asm cli
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif
while (TRUE) while (TRUE)
{ {
; ;

View File

@ -68,8 +68,8 @@ extern inline PULONG get_page_directory(void)
*/ */
#define PAGE_TABLE_SIZE (4*1024*1024) #define PAGE_TABLE_SIZE (4*1024*1024)
#define PAGE_MASK(x) (x&(~0xfff)) #define PAGE_MASK(x) ((x)&(~0xfff))
#define VADDR_TO_PT_OFFSET(x) (((x/1024)%4096)) #define VADDR_TO_PT_OFFSET(x) ((((x)/1024)%4096))
#define VADDR_TO_PD_OFFSET(x) ((x)/(4*1024*1024)) #define VADDR_TO_PD_OFFSET(x) ((x)/(4*1024*1024))
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H */ #endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H */

View File

@ -21,6 +21,7 @@
#define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk") #define PAGE_LOCKED_FUNCTION PLACE_IN_SECTION("pagelk")
#define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo")
#include <pshpack1.h>
/* /*
* Defines a descriptor as it appears in the processor tables * Defines a descriptor as it appears in the processor tables
*/ */
@ -28,7 +29,9 @@ typedef struct _DESCRIPTOR
{ {
ULONG a; ULONG a;
ULONG b; ULONG b;
} __attribute__ ((packed)) IDT_DESCRIPTOR, GDT_DESCRIPTOR; } IDT_DESCRIPTOR, GDT_DESCRIPTOR;
#include <poppack.h>
extern IDT_DESCRIPTOR KiIdt[256]; extern IDT_DESCRIPTOR KiIdt[256];
//extern GDT_DESCRIPTOR KiGdt[256]; //extern GDT_DESCRIPTOR KiGdt[256];

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: ps.h,v 1.56 2003/12/30 00:12:47 hyperion Exp $ /* $Id: ps.h,v 1.57 2004/01/05 14:28:20 weiden Exp $
* *
* FILE: ntoskrnl/ke/kthread.c * FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Process manager definitions * PURPOSE: Process manager definitions
@ -54,6 +54,8 @@ extern LCID PsDefaultSystemLocaleId;
#ifndef __USE_W32API #ifndef __USE_W32API
#include <pshpack1.h>
typedef struct _KAPC_STATE typedef struct _KAPC_STATE
{ {
LIST_ENTRY ApcListHead[2]; LIST_ENTRY ApcListHead[2];
@ -61,10 +63,14 @@ typedef struct _KAPC_STATE
UCHAR KernelApcInProgress; UCHAR KernelApcInProgress;
UCHAR KernelApcPending; UCHAR KernelApcPending;
USHORT UserApcPending; USHORT UserApcPending;
} __attribute__((packed)) KAPC_STATE, *PKAPC_STATE; } KAPC_STATE, *PKAPC_STATE;
#include <poppack.h>
#endif /* __USE_W32API */ #endif /* __USE_W32API */
#include <pshpack1.h>
typedef struct _KTHREAD typedef struct _KTHREAD
{ {
/* For waiting on thread exit */ /* For waiting on thread exit */
@ -152,7 +158,9 @@ typedef struct _KTHREAD
/* Added by Phillip Susi for list of threads in a process */ /* Added by Phillip Susi for list of threads in a process */
LIST_ENTRY ProcessThreadListEntry; /* 1B0 */ LIST_ENTRY ProcessThreadListEntry; /* 1B0 */
} __attribute__((packed)) KTHREAD; } KTHREAD;
#include <poppack.h>
/* Top level irp definitions. */ /* Top level irp definitions. */
#define FSRTL_FSP_TOP_LEVEL_IRP (0x01) #define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
@ -176,6 +184,8 @@ typedef struct
SECURITY_IMPERSONATION_LEVEL Level; // 0x8 SECURITY_IMPERSONATION_LEVEL Level; // 0x8
} PS_IMPERSONATION_INFO, *PPS_IMPERSONATION_INFO; } PS_IMPERSONATION_INFO, *PPS_IMPERSONATION_INFO;
#include <pshpack1.h>
typedef struct _ETHREAD typedef struct _ETHREAD
{ {
KTHREAD Tcb; /* 000 */ KTHREAD Tcb; /* 000 */
@ -226,7 +236,10 @@ typedef struct _ETHREAD
struct _W32THREAD* Win32Thread; struct _W32THREAD* Win32Thread;
} __attribute__((packed)) ETHREAD; } ETHREAD;
#include <poppack.h>
#ifndef __USE_W32API #ifndef __USE_W32API

View File

@ -1,4 +1,4 @@
/* $Id: pnproot.c,v 1.19 2003/12/30 18:52:04 fireball Exp $ /* $Id: pnproot.c,v 1.20 2004/01/05 14:28:20 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -49,23 +49,8 @@ typedef enum {
} PNPROOT_DEVICE_STATE; } PNPROOT_DEVICE_STATE;
#if defined(__GNUC__)
typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
{
// Pointer to device object, this device extension is associated with
PDEVICE_OBJECT DeviceObject;
// Wether this device extension is for an FDO or PDO
BOOLEAN IsFDO;
// Wether the device is removed
BOOLEAN Removed;
// Current device power state for the device
DEVICE_POWER_STATE DevicePowerState;
} __attribute((packed)) PNPROOT_COMMON_DEVICE_EXTENSION, *PPNPROOT_COMMON_DEVICE_EXTENSION;
#elif defined(_MSC_VER)
#include <pshpack1.h> #include <pshpack1.h>
typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
{ {
// Pointer to device object, this device extension is associated with // Pointer to device object, this device extension is associated with
@ -77,30 +62,10 @@ typedef struct _PNPROOT_COMMON_DEVICE_EXTENSION
// Current device power state for the device // Current device power state for the device
DEVICE_POWER_STATE DevicePowerState; DEVICE_POWER_STATE DevicePowerState;
} PNPROOT_COMMON_DEVICE_EXTENSION, *PPNPROOT_COMMON_DEVICE_EXTENSION; } PNPROOT_COMMON_DEVICE_EXTENSION, *PPNPROOT_COMMON_DEVICE_EXTENSION;
#include <poppack.h>
#else
#error Unknown compiler for structure packing
#endif
#if defined(__GNUC__)
/* Physical Device Object device extension for a child device */ /* Physical Device Object device extension for a child device */
typedef struct _PNPROOT_PDO_DEVICE_EXTENSION typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
{
// Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common;
// Device ID
UNICODE_STRING DeviceID;
// Instance ID
UNICODE_STRING InstanceID;
} __attribute((packed)) PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION;
#elif defined(_MSC_VER)
#include <pshpack1.h>
typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
{ {
// Common device data // Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common; PNPROOT_COMMON_DEVICE_EXTENSION Common;
@ -109,39 +74,10 @@ typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
// Instance ID // Instance ID
UNICODE_STRING InstanceID; UNICODE_STRING InstanceID;
} PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION; } PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION;
#include <poppack.h>
#else
#error Unknown compiler for structure packing
#endif
#if defined(__GNUC__)
/* Functional Device Object device extension for the PCI driver device object */ /* Functional Device Object device extension for the PCI driver device object */
typedef struct _PNPROOT_FDO_DEVICE_EXTENSION typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
{
// Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common;
// Physical Device Object
PDEVICE_OBJECT Pdo;
// Lower device object
PDEVICE_OBJECT Ldo;
// Current state of the driver
PNPROOT_DEVICE_STATE State;
// Namespace device list
LIST_ENTRY DeviceListHead;
// Number of (not removed) devices in device list
ULONG DeviceListCount;
// Lock for namespace device list
// FIXME: Use fast mutex instead?
KSPIN_LOCK DeviceListLock;
} __attribute((packed)) PNPROOT_FDO_DEVICE_EXTENSION, *PPNPROOT_FDO_DEVICE_EXTENSION;
#elif defined(_MSC_VER)
#include <pshpack1.h>
typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
{ {
// Common device data // Common device data
PNPROOT_COMMON_DEVICE_EXTENSION Common; PNPROOT_COMMON_DEVICE_EXTENSION Common;
@ -159,11 +95,8 @@ typedef struct _PNPROOT_FDO_DEVICE_EXTENSION
// FIXME: Use fast mutex instead? // FIXME: Use fast mutex instead?
KSPIN_LOCK DeviceListLock; KSPIN_LOCK DeviceListLock;
} PNPROOT_FDO_DEVICE_EXTENSION, *PPNPROOT_FDO_DEVICE_EXTENSION; } PNPROOT_FDO_DEVICE_EXTENSION, *PPNPROOT_FDO_DEVICE_EXTENSION;
#include <poppack.h>
#else #include <poppack.h>
#error Unknown compiler for structure packing
#endif

View File

@ -1,4 +1,4 @@
/* $Id: xhaldrv.c,v 1.42 2003/12/30 18:52:04 fireball Exp $ /* $Id: xhaldrv.c,v 1.43 2004/01/05 14:28:20 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -26,6 +26,7 @@
#define PARTITION_TBL_SIZE 4 #define PARTITION_TBL_SIZE 4
#include <pshpack1.h>
typedef struct _PARTITION typedef struct _PARTITION
{ {
@ -39,7 +40,7 @@ typedef struct _PARTITION
unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */ unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
unsigned int StartingBlock; /* first sector relative to start of disk */ unsigned int StartingBlock; /* first sector relative to start of disk */
unsigned int SectorCount; /* number of sectors in partition */ unsigned int SectorCount; /* number of sectors in partition */
} PACKED PARTITION, *PPARTITION; } PARTITION, *PPARTITION;
typedef struct _PARTITION_SECTOR typedef struct _PARTITION_SECTOR
@ -49,7 +50,9 @@ typedef struct _PARTITION_SECTOR
UCHAR Reserved[2]; /* 0x1BC */ UCHAR Reserved[2]; /* 0x1BC */
PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */ PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
USHORT Magic; /* 0x1FE */ USHORT Magic; /* 0x1FE */
} PACKED PARTITION_SECTOR, *PPARTITION_SECTOR; } PARTITION_SECTOR, *PPARTITION_SECTOR;
#include <poppack.h>
typedef enum _DISK_MANAGER typedef enum _DISK_MANAGER

View File

@ -1,4 +1,4 @@
/* $Id: dlog.c,v 1.10 2004/01/02 17:43:50 sedwards Exp $ /* $Id: dlog.c,v 1.11 2004/01/05 14:28:20 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -46,7 +46,7 @@ DebugLogInit(VOID)
KeInitializeSemaphore(&DebugLogSem, 0, 255); KeInitializeSemaphore(&DebugLogSem, 0, 255);
} }
VOID STDCALL_FUNC VOID STDCALL
DebugLogThreadMain(PVOID Context) DebugLogThreadMain(PVOID Context)
{ {
KIRQL oldIrql; KIRQL oldIrql;

View File

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.49 2003/12/30 22:06:39 fireball Exp $ /* $Id: kdebug.c,v 1.50 2004/01/05 14:28:20 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -386,13 +386,15 @@ KeEnterKernelDebugger(VOID)
HalDisplayString("\n\n *** Entered kernel debugger ***\n"); HalDisplayString("\n\n *** Entered kernel debugger ***\n");
for (;;) for (;;)
#ifdef __GNUC__ {
#if defined(__GNUC__)
__asm__("hlt\n\t"); __asm__("hlt\n\t");
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm hlt __asm hlt
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif
}
} }
VOID STDCALL VOID STDCALL

View File

@ -1,4 +1,4 @@
/* $Id: service.c,v 1.6 2003/12/30 18:52:04 fireball Exp $ /* $Id: service.c,v 1.7 2004/01/05 14:28:20 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -138,12 +138,12 @@ void interrupt_handler2d()
sub esp, 112 /* FloatSave */ sub esp, 112 /* FloatSave */
mov eax, dr7; push eax; mov eax, dr7 __asm push eax
mov eax, dr6; push eax; mov eax, dr6 __asm push eax
mov eax, dr3; push eax; mov eax, dr3 __asm push eax
mov eax, dr2; push eax; mov eax, dr2 __asm push eax
mov eax, dr1; push eax; mov eax, dr1 __asm push eax
mov eax, dr0; push eax; mov eax, dr0 __asm push eax
push 0 /* ContextFlags */ push 0 /* ContextFlags */
@ -164,12 +164,12 @@ void interrupt_handler2d()
/* Restore the user context */ /* Restore the user context */
add esp, 4 /* UserContext */ add esp, 4 /* UserContext */
pop eax; mov dr0, eax; pop eax __asm mov dr0, eax
pop eax; mov dr1, eax; pop eax __asm mov dr1, eax
pop eax; mov dr2, eax; pop eax __asm mov dr2, eax
pop eax; mov dr3, eax; pop eax __asm mov dr3, eax
pop eax; mov dr6, eax; pop eax __asm mov dr6, eax
pop eax; mov dr7, eax; pop eax __asm mov dr7, eax
add esp, 112 /* FloatingSave */ add esp, 112 /* FloatingSave */
pop gs pop gs
pop fs pop fs
@ -185,7 +185,7 @@ void interrupt_handler2d()
pop ebp pop ebp
iret iretd
} }
} }

View File

@ -554,10 +554,10 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
{ {
if (Tf->Eflags & FLAG_IF) if (Tf->Eflags & FLAG_IF)
{ {
#ifdef __GNUC__ #if defined(__GNUC__)
__asm__("sti\n\t"); __asm__("sti\n\t");
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm sti __asm sti
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif

View File

@ -54,11 +54,17 @@ USHORT KiBootGdt[11 * 4] =
0x0, 0x0, 0x0, 0x0 /* Trap TSS */ 0x0, 0x0, 0x0, 0x0 /* Trap TSS */
}; };
struct
#include <pshpack1.h>
struct LocalGdtDescriptor_t
{ {
USHORT Length; USHORT Length;
ULONG Base; ULONG Base;
} __attribute__((packed)) KiGdtDescriptor = { 11 * 8, (ULONG)KiBootGdt }; } KiGdtDescriptor = { 11 * 8, (ULONG)KiBootGdt };
#include <poppack.h>
static KSPIN_LOCK GdtLock; static KSPIN_LOCK GdtLock;
@ -74,11 +80,7 @@ VOID
KiInitializeGdt(PKPCR Pcr) KiInitializeGdt(PKPCR Pcr)
{ {
PUSHORT Gdt; PUSHORT Gdt;
struct struct LocalGdtDescriptor_t Descriptor;
{
USHORT Length;
ULONG Base;
} __attribute__((packed)) Descriptor;
ULONG Entry; ULONG Entry;
ULONG Base; ULONG Base;
@ -146,18 +148,18 @@ KiInitializeGdt(PKPCR Pcr)
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm __asm
{ {
lgdt Descriptor; lgdt Descriptor;
mov ax, KERNEL_DS; mov ax, KERNEL_DS;
mov bx, PCR_SELECTOR; mov bx, PCR_SELECTOR;
mov ds, ax; mov ds, ax;
mov es, ax; mov es, ax;
mov fs, bx; mov fs, bx;
mov gs, ax; mov gs, ax;
push KERNEL_CS; push KERNEL_CS;
push offset l4 ; // what the heck... push offset l4 ;
ret retf
l4: l4:
} }
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif

View File

@ -19,23 +19,15 @@
IDT_DESCRIPTOR KiIdt[256]; IDT_DESCRIPTOR KiIdt[256];
#if defined(__GNUC__) #include <pshpack1.h>
struct struct
{ {
USHORT Length; USHORT Length;
ULONG Base; ULONG Base;
} __attribute__((packed)) KiIdtDescriptor = {256 * 8, (ULONG)KiIdt}; } KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
#else
#include <pshpack1.h>
struct dummyname_for_this_one
{
USHORT Length;
ULONG Base;
};
#include <poppack.h>
struct dummyname_for_this_one KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
#endif
#include <poppack.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: irq.c,v 1.38 2003/12/30 22:10:45 fireball Exp $ /* $Id: irq.c,v 1.39 2004/01/05 14:28:21 weiden Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/i386/irq.c * FILE: ntoskrnl/ke/i386/irq.c
@ -491,10 +491,10 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
* Enable interrupts * Enable interrupts
* NOTE: Only higher priority interrupts will get through * NOTE: Only higher priority interrupts will get through
*/ */
#ifdef __GNUC__ #if defined(__GNUC__)
__asm__("sti\n\t"); __asm__("sti\n\t");
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm sti __asm sti
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif
@ -523,10 +523,10 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
/* /*
* End the system interrupt. * End the system interrupt.
*/ */
#ifdef __GNUC__ #if defined(__GNUC__)
__asm__("cli\n\t"); __asm__("cli\n\t");
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm cli __asm cli
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif

View File

@ -93,10 +93,10 @@ KeApplicationProcessorInit(VOID)
*/ */
Ki386InitializeLdt(); Ki386InitializeLdt();
#ifdef __GNUC__ #if defined(__GNUC__)
__asm__ __volatile__ ("sti\n\t"); __asm__ __volatile__ ("sti\n\t");
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm sti __asm sti
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif

View File

@ -113,7 +113,7 @@ Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context)
KernelStack[1] = 0; /* ESI */ KernelStack[1] = 0; /* ESI */
KernelStack[2] = 0; /* EBX */ KernelStack[2] = 0; /* EBX */
KernelStack[3] = 0; /* EBP */ KernelStack[3] = 0; /* EBP */
KernelStack[4] = (ULONG)PsBeginThreadWithContextInternal; /* EIP */ KernelStack[4] = (ULONG)&PsBeginThreadWithContextInternal; /* EIP */
/* Save the context flags. */ /* Save the context flags. */
KernelStack[5] = Context->ContextFlags; KernelStack[5] = Context->ContextFlags;
@ -180,13 +180,13 @@ Ke386InitThread(PKTHREAD Thread,
/* /*
* Setup a stack frame for exit from the task switching routine * Setup a stack frame for exit from the task switching routine
*/ */
KernelStack = (PULONG)((char*)Thread->KernelStack - (8*4)); KernelStack = (PULONG)((char*)Thread->KernelStack - (8*4));
KernelStack[0] = 0; /* EDI */ KernelStack[0] = 0; /* EDI */
KernelStack[1] = 0; /* ESI */ KernelStack[1] = 0; /* ESI */
KernelStack[2] = 0; /* EBX */ KernelStack[2] = 0; /* EBX */
KernelStack[3] = 0; /* EBP */ KernelStack[3] = 0; /* EBP */
KernelStack[4] = (ULONG)PsBeginThread; /* EIP */ KernelStack[4] = (ULONG)&PsBeginThread; /* EIP */
KernelStack[5] = 0; /* Return EIP */ KernelStack[5] = 0; /* Return EIP */
KernelStack[6] = (ULONG)StartRoutine; /* First argument to PsBeginThread */ KernelStack[6] = (ULONG)StartRoutine; /* First argument to PsBeginThread */
KernelStack[7] = (ULONG)StartContext; /* Second argument to PsBeginThread */ KernelStack[7] = (ULONG)StartContext; /* Second argument to PsBeginThread */

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: main.c,v 1.181 2004/01/02 17:43:51 sedwards Exp $ /* $Id: main.c,v 1.182 2004/01/05 14:28:21 weiden Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c * FILE: ntoskrnl/ke/main.c
@ -915,8 +915,18 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe"); strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe");
KeLoaderModules[0].String = (ULONG)KeLoaderModuleStrings[0]; KeLoaderModules[0].String = (ULONG)KeLoaderModuleStrings[0];
KeLoaderModules[0].ModStart = 0xC0000000; KeLoaderModules[0].ModStart = KERNEL_BASE;
#ifdef __GNUC__
KeLoaderModules[0].ModEnd = PAGE_ROUND_UP((ULONG)&_bss_end__); KeLoaderModules[0].ModEnd = PAGE_ROUND_UP((ULONG)&_bss_end__);
#else
/* Take this value from the PE... */
{
PIMAGE_NT_HEADERS NtHeader = RtlImageNtHeader((PVOID)KeLoaderModules[0].ModStart);
PIMAGE_OPTIONAL_HEADER OptHead = &NtHeader->OptionalHeader;
KeLoaderModules[0].ModEnd =
KeLoaderModules[0].ModStart + PAGE_ROUND_UP((ULONG)OptHead->SizeOfImage);
}
#endif
for (i = 1; i < KeLoaderBlock.ModsCount; i++) for (i = 1; i < KeLoaderBlock.ModsCount; i++)
{ {
CHAR* s; CHAR* s;
@ -928,10 +938,11 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
{ {
strcpy(KeLoaderModuleStrings[i], (PUCHAR)KeLoaderModules[i].String); strcpy(KeLoaderModuleStrings[i], (PUCHAR)KeLoaderModules[i].String);
} }
/* TODO: Fix this hardcoded load address stuff... */
KeLoaderModules[i].ModStart -= 0x200000; KeLoaderModules[i].ModStart -= 0x200000;
KeLoaderModules[i].ModStart += 0xc0000000; KeLoaderModules[i].ModStart += KERNEL_BASE;
KeLoaderModules[i].ModEnd -= 0x200000; KeLoaderModules[i].ModEnd -= 0x200000;
KeLoaderModules[i].ModEnd += 0xc0000000; KeLoaderModules[i].ModEnd += KERNEL_BASE;
KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i]; KeLoaderModules[i].String = (ULONG)KeLoaderModuleStrings[i];
} }
@ -946,7 +957,7 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
/* /*
* Process hal.dll * Process hal.dll
*/ */
LdrSafePEProcessModule((PVOID)HalBase, (PVOID)DriverBase, (PVOID)0xC0000000, &DriverSize); LdrSafePEProcessModule((PVOID)HalBase, (PVOID)DriverBase, (PVOID)KERNEL_BASE, &DriverSize);
LdrHalBase = (ULONG_PTR)DriverBase; LdrHalBase = (ULONG_PTR)DriverBase;
last_kernel_address = DriverBase + DriverSize; last_kernel_address = DriverBase + DriverSize;
@ -954,10 +965,13 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
/* /*
* Process ntoskrnl.exe * Process ntoskrnl.exe
*/ */
LdrSafePEProcessModule((PVOID)0xC0000000, (PVOID)0xC0000000, (PVOID)DriverBase, &DriverSize); LdrSafePEProcessModule((PVOID)KERNEL_BASE, (PVOID)KERNEL_BASE, (PVOID)DriverBase, &DriverSize);
FirstKrnlPhysAddr = KeLoaderModules[0].ModStart - 0xc0000000 + 0x200000; /* Now our imports from HAL is fixed. This is the first */
LastKrnlPhysAddr = last_kernel_address - 0xc0000000 + 0x200000; /* time in the boot process that we can use HAL */
FirstKrnlPhysAddr = KeLoaderModules[0].ModStart - KERNEL_BASE + 0x200000;
LastKrnlPhysAddr = last_kernel_address - KERNEL_BASE + 0x200000;
LastKernelAddress = last_kernel_address; LastKernelAddress = last_kernel_address;
#ifndef ACPI #ifndef ACPI

View File

@ -1,4 +1,4 @@
/* $Id: timer.c,v 1.65 2003/12/31 14:37:34 hbirr Exp $ /* $Id: timer.c,v 1.66 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -32,7 +32,11 @@
/* /*
* Current time * Current time
*/ */
#if defined(__GNUC__)
static LARGE_INTEGER SystemBootTime = (LARGE_INTEGER)0LL; static LARGE_INTEGER SystemBootTime = (LARGE_INTEGER)0LL;
#else
static LARGE_INTEGER SystemBootTime = { 0 };
#endif
/* /*
* Number of timer interrupts since initialisation * Number of timer interrupts since initialisation
@ -223,6 +227,7 @@ KeQueryInterruptTime(PLARGE_INTEGER CurrentTime)
while (CurrentTime->u.HighPart != SharedUserData->InterruptTime.High2Part); while (CurrentTime->u.HighPart != SharedUserData->InterruptTime.High2Part);
} }
NTSTATUS STDCALL NTSTATUS STDCALL
NtGetTickCount (PULONG UpTime) NtGetTickCount (PULONG UpTime)
{ {
@ -332,7 +337,7 @@ KeSetTimerEx (PKTIMER Timer,
} }
KeReleaseSpinLock(&TimerListLock, oldlvl); KeReleaseSpinLock(&TimerListLock, oldlvl);
return AlreadyInList; return AlreadyInList;
} }
@ -607,7 +612,7 @@ KiUpdateSystemTime(KIRQL oldIrql,
SharedUserData->SystemTime.High1Part = Time.u.HighPart; SharedUserData->SystemTime.High1Part = Time.u.HighPart;
KeReleaseSpinLockFromDpcLevel(&TimerValueLock); KeReleaseSpinLockFromDpcLevel(&TimerValueLock);
/* /*
* Queue a DPC that will expire timers * Queue a DPC that will expire timers
*/ */

View File

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.138 2003/12/30 18:52:05 fireball Exp $ /* $Id: loader.c,v 1.139 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -131,43 +131,37 @@ LdrInitDebug(PLOADER_MODULE Module, PWCH Name)
VOID INIT_FUNCTION VOID INIT_FUNCTION
LdrInit1(VOID) LdrInit1(VOID)
{ {
PIMAGE_DOS_HEADER DosHeader; PIMAGE_NT_HEADERS NtHeader;
PIMAGE_FILE_HEADER FileHeader; PIMAGE_SECTION_HEADER SectionList;
PIMAGE_OPTIONAL_HEADER OptionalHeader;
PIMAGE_SECTION_HEADER SectionList;
InitializeListHead(&ModuleTextListHead); InitializeListHead(&ModuleTextListHead);
/* Setup ntoskrnl.exe text section */ /* Setup ntoskrnl.exe text section */
DosHeader = (PIMAGE_DOS_HEADER) KERNEL_BASE; /*
FileHeader = * This isn't the base of the text segment, but the start of the
(PIMAGE_FILE_HEADER) ((DWORD)KERNEL_BASE + * full image (in memory)
DosHeader->e_lfanew + sizeof(ULONG)); * Also, the Length field isn't set to the length of the segment,
OptionalHeader = (PIMAGE_OPTIONAL_HEADER) * but is more like the offset, from the image base, to the end
((DWORD)FileHeader + sizeof(IMAGE_FILE_HEADER)); * of the segment.
SectionList = (PIMAGE_SECTION_HEADER) */
((DWORD)OptionalHeader + sizeof(IMAGE_OPTIONAL_HEADER)); NtHeader = RtlImageNtHeader((PVOID)KERNEL_BASE);
NtoskrnlTextSection.Base = KERNEL_BASE; SectionList = IMAGE_FIRST_SECTION(NtHeader);
NtoskrnlTextSection.Base = KERNEL_BASE;
NtoskrnlTextSection.Length = SectionList[0].Misc.VirtualSize + NtoskrnlTextSection.Length = SectionList[0].Misc.VirtualSize +
SectionList[0].VirtualAddress; SectionList[0].VirtualAddress;
NtoskrnlTextSection.Name = KERNEL_MODULE_NAME; NtoskrnlTextSection.Name = KERNEL_MODULE_NAME;
NtoskrnlTextSection.OptionalHeader = OptionalHeader; NtoskrnlTextSection.OptionalHeader = OPTHDROFFSET(KERNEL_BASE);
InsertTailList(&ModuleTextListHead, &NtoskrnlTextSection.ListEntry); InsertTailList(&ModuleTextListHead, &NtoskrnlTextSection.ListEntry);
/* Setup hal.dll text section */ /* Setup hal.dll text section */
DosHeader = (PIMAGE_DOS_HEADER)LdrHalBase; /* Same comment as above applies */
FileHeader = NtHeader = RtlImageNtHeader((PVOID)LdrHalBase);
(PIMAGE_FILE_HEADER) ((DWORD)LdrHalBase + SectionList = IMAGE_FIRST_SECTION(NtHeader);
DosHeader->e_lfanew + sizeof(ULONG)); LdrHalTextSection.Base = LdrHalBase;
OptionalHeader = (PIMAGE_OPTIONAL_HEADER)
((DWORD)FileHeader + sizeof(IMAGE_FILE_HEADER));
SectionList = (PIMAGE_SECTION_HEADER)
((DWORD)OptionalHeader + sizeof(IMAGE_OPTIONAL_HEADER));
LdrHalTextSection.Base = LdrHalBase;
LdrHalTextSection.Length = SectionList[0].Misc.VirtualSize + LdrHalTextSection.Length = SectionList[0].Misc.VirtualSize +
SectionList[0].VirtualAddress; SectionList[0].VirtualAddress;
LdrHalTextSection.Name = HAL_MODULE_NAME; LdrHalTextSection.Name = HAL_MODULE_NAME;
LdrHalTextSection.OptionalHeader = OptionalHeader; LdrHalTextSection.OptionalHeader = OPTHDROFFSET(LdrHalBase);
InsertTailList(&ModuleTextListHead, &LdrHalTextSection.ListEntry); InsertTailList(&ModuleTextListHead, &LdrHalTextSection.ListEntry);
/* Hook for KDB on initialization of the loader. */ /* Hook for KDB on initialization of the loader. */
@ -1347,26 +1341,25 @@ LdrSafePEProcessModule(PVOID ModuleLoadBase,
/* Copy image sections into virtual section */ /* Copy image sections into virtual section */
for (Idx = 0; Idx < PEFileHeader->NumberOfSections; Idx++) for (Idx = 0; Idx < PEFileHeader->NumberOfSections; Idx++)
{ {
PIMAGE_SECTION_HEADER Section = &PESectionHeaders[Idx];
// Copy current section into current offset of virtual section // Copy current section into current offset of virtual section
if (PESectionHeaders[Idx].Characteristics & // if (PESectionHeaders[Idx].Characteristics &
(IMAGE_SECTION_CHAR_CODE | IMAGE_SECTION_CHAR_DATA)) // (IMAGE_SECTION_CHAR_CODE | IMAGE_SECTION_CHAR_DATA))
{ if (Section->SizeOfRawData)
//ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n", {
//PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + DriverBase); //ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n",
memcpy(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase, //PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + DriverBase);
(PVOID)((char*)ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData), memcpy(Section->VirtualAddress + (char*)DriverBase,
PESectionHeaders[Idx].Misc.VirtualSize > PESectionHeaders[Idx].SizeOfRawData ? Section->PointerToRawData + (char*)ModuleLoadBase,
PESectionHeaders[Idx].SizeOfRawData : PESectionHeaders[Idx].Misc.VirtualSize ); Section->SizeOfRawData);
} }
else if (Section->SizeOfRawData < Section->Misc.VirtualSize)
{ {
ps("PESectionHeaders[Idx].VirtualAddress (%X) + DriverBase %x\n", memset(Section->VirtualAddress + Section->SizeOfRawData + (char*)DriverBase,
PESectionHeaders[Idx].VirtualAddress, PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase); 0,
memset(PESectionHeaders[Idx].VirtualAddress + (char*)DriverBase, Section->Misc.VirtualSize - Section->SizeOfRawData);
'\0', }
PESectionHeaders[Idx].Misc.VirtualSize); CurrentSize += ROUND_UP(Section->Misc.VirtualSize,
}
CurrentSize += ROUND_UP(PESectionHeaders[Idx].Misc.VirtualSize,
PEOptionalHeader->SectionAlignment); PEOptionalHeader->SectionAlignment);
} }
@ -1515,9 +1508,10 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
PVOID ExportAddress; PVOID ExportAddress;
PWORD OrdinalList; PWORD OrdinalList;
PDWORD FunctionList, NameList; PDWORD FunctionList, NameList;
PCHAR ModuleBase = (PCHAR)ModuleObject->Base;
ExportDir = (PIMAGE_EXPORT_DIRECTORY) ExportDir = (PIMAGE_EXPORT_DIRECTORY)
RtlImageDirectoryEntryToData(ModuleObject->Base, RtlImageDirectoryEntryToData(ModuleBase,
TRUE, TRUE,
IMAGE_DIRECTORY_ENTRY_EXPORT, IMAGE_DIRECTORY_ENTRY_EXPORT,
&ExportDirSize); &ExportDirSize);
@ -1527,9 +1521,9 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
return NULL; return NULL;
} }
FunctionList = (PDWORD)((DWORD)ExportDir->AddressOfFunctions + (char*)ModuleObject->Base); FunctionList = (PDWORD)((char*)ModuleBase + (DWORD)ExportDir->AddressOfFunctions);
NameList = (PDWORD)((DWORD)ExportDir->AddressOfNames + (char*)ModuleObject->Base); NameList = (PDWORD)((char*)ModuleBase + (DWORD)ExportDir->AddressOfNames);
OrdinalList = (PWORD)((DWORD)ExportDir->AddressOfNameOrdinals + (char*)ModuleObject->Base); OrdinalList = (PWORD) ((char*)ModuleBase + (DWORD)ExportDir->AddressOfNameOrdinals);
ExportAddress = 0; ExportAddress = 0;
@ -1541,12 +1535,12 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
DPRINT(" Name:%s NameList[%d]:%s\n", DPRINT(" Name:%s NameList[%d]:%s\n",
Name, Name,
Idx, Idx,
(DWORD) ModuleObject->Base + NameList[Idx]); (DWORD) ModuleBase + NameList[Idx]);
#endif #endif
if (!strcmp(Name, (PCHAR) ((DWORD)ModuleObject->Base + NameList[Idx])))
if (!strcmp(Name, ModuleBase + NameList[Idx]))
{ {
ExportAddress = (PVOID) ((DWORD)ModuleObject->Base + ExportAddress = (PVOID) ((DWORD)ModuleBase +
FunctionList[OrdinalList[Idx]]); FunctionList[OrdinalList[Idx]]);
if (((ULONG)ExportAddress >= (ULONG)ExportDir) && if (((ULONG)ExportAddress >= (ULONG)ExportDir) &&
((ULONG)ExportAddress < (ULONG)ExportDir + ExportDirSize)) ((ULONG)ExportAddress < (ULONG)ExportDir + ExportDirSize))
@ -1562,7 +1556,7 @@ LdrPEGetExportAddress(PMODULE_OBJECT ModuleObject,
} }
else /* use hint */ else /* use hint */
{ {
ExportAddress = (PVOID) ((DWORD)ModuleObject->Base + ExportAddress = (PVOID) ((DWORD)ModuleBase +
FunctionList[Hint - ExportDir->Base]); FunctionList[Hint - ExportDir->Base]);
} }

View File

@ -44,6 +44,7 @@ typedef struct _PHYSICAL_PAGE
struct _MM_RMAP_ENTRY* RmapListHead; struct _MM_RMAP_ENTRY* RmapListHead;
} PHYSICAL_PAGE, *PPHYSICAL_PAGE; } PHYSICAL_PAGE, *PPHYSICAL_PAGE;
/* GLOBALS ****************************************************************/ /* GLOBALS ****************************************************************/
static PPHYSICAL_PAGE MmPageArray; static PPHYSICAL_PAGE MmPageArray;
@ -68,7 +69,7 @@ MmTransferOwnershipPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG NewConsumer)
{ {
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql; KIRQL oldIrql;
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].MapCount != 0) if (MmPageArray[Start].MapCount != 0)
{ {
@ -178,11 +179,11 @@ MmGetContinuousPages(ULONG NumberOfBytes,
LONG start; LONG start;
ULONG length; ULONG length;
KIRQL oldIrql; KIRQL oldIrql;
NrPages = PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE; NrPages = PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE;
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
start = -1; start = -1;
length = 0; length = 0;
for (i = (LowestAcceptableAddress.QuadPart / PAGE_SIZE); i < (HighestAcceptableAddress.QuadPart / PAGE_SIZE); ) for (i = (LowestAcceptableAddress.QuadPart / PAGE_SIZE); i < (HighestAcceptableAddress.QuadPart / PAGE_SIZE); )
@ -254,7 +255,7 @@ MiParseRangeToFreeList(PADDRESS_RANGE Range)
ULONG i, first, last; ULONG i, first, last;
/* FIXME: Not 64-bit ready */ /* FIXME: Not 64-bit ready */
DPRINT("Range going to free list (Base 0x%X, Length 0x%X, Type 0x%X)\n", DPRINT("Range going to free list (Base 0x%X, Length 0x%X, Type 0x%X)\n",
Range->BaseAddrLow, Range->BaseAddrLow,
Range->LengthLow, Range->LengthLow,
@ -281,7 +282,7 @@ MiParseRangeToBiosList(PADDRESS_RANGE Range)
ULONG i, first, last; ULONG i, first, last;
/* FIXME: Not 64-bit ready */ /* FIXME: Not 64-bit ready */
DPRINT("Range going to bios list (Base 0x%X, Length 0x%X, Type 0x%X)\n", DPRINT("Range going to bios list (Base 0x%X, Length 0x%X, Type 0x%X)\n",
Range->BaseAddrLow, Range->BaseAddrLow,
Range->LengthLow, Range->LengthLow,
@ -314,7 +315,7 @@ MiParseBIOSMemoryMap(PADDRESS_RANGE BIOSMemoryMap,
{ {
PADDRESS_RANGE p; PADDRESS_RANGE p;
ULONG i; ULONG i;
p = BIOSMemoryMap; p = BIOSMemoryMap;
for (i = 0; i < AddressRangeCount; i++, p++) for (i = 0; i < AddressRangeCount; i++, p++)
{ {
@ -348,7 +349,7 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
ULONG i; ULONG i;
ULONG Reserved; ULONG Reserved;
NTSTATUS Status; NTSTATUS Status;
DPRINT("MmInitializePageList(FirstPhysKernelAddress %x, " DPRINT("MmInitializePageList(FirstPhysKernelAddress %x, "
"LastPhysKernelAddress %x, " "LastPhysKernelAddress %x, "
"MemorySizeInPages %x, LastKernelAddress %x)\n", "MemorySizeInPages %x, LastKernelAddress %x)\n",
@ -367,19 +368,19 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
InitializeListHead(&BiosPageListHead); InitializeListHead(&BiosPageListHead);
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress); LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
MmPageArraySize = MemorySizeInPages; MmPageArraySize = MemorySizeInPages;
Reserved = Reserved =
PAGE_ROUND_UP((MmPageArraySize * sizeof(PHYSICAL_PAGE))) / PAGE_SIZE; PAGE_ROUND_UP((MmPageArraySize * sizeof(PHYSICAL_PAGE))) / PAGE_SIZE;
MmPageArray = (PHYSICAL_PAGE *)LastKernelAddress; MmPageArray = (PHYSICAL_PAGE *)LastKernelAddress;
DPRINT("Reserved %d\n", Reserved); DPRINT("Reserved %d\n", Reserved);
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress); LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
LastKernelAddress = ((ULONG)LastKernelAddress + (Reserved * PAGE_SIZE)); LastKernelAddress = ((ULONG)LastKernelAddress + (Reserved * PAGE_SIZE));
LastPhysKernelAddress = (PVOID)PAGE_ROUND_UP(LastPhysKernelAddress); LastPhysKernelAddress = (PVOID)PAGE_ROUND_UP(LastPhysKernelAddress);
LastPhysKernelAddress = (char*)LastPhysKernelAddress + (Reserved * PAGE_SIZE); LastPhysKernelAddress = (char*)LastPhysKernelAddress + (Reserved * PAGE_SIZE);
MmStats.NrTotalPages = 0; MmStats.NrTotalPages = 0;
MmStats.NrSystemPages = 0; MmStats.NrSystemPages = 0;
MmStats.NrUserPages = 0; MmStats.NrUserPages = 0;
@ -541,7 +542,6 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
KeInitializeEvent(&ZeroPageThreadEvent, NotificationEvent, TRUE); KeInitializeEvent(&ZeroPageThreadEvent, NotificationEvent, TRUE);
MmStats.NrTotalPages = MmStats.NrFreePages + MmStats.NrSystemPages + MmStats.NrTotalPages = MmStats.NrFreePages + MmStats.NrSystemPages +
MmStats.NrReservedPages + MmStats.NrUserPages; MmStats.NrReservedPages + MmStats.NrUserPages;
MmInitializeBalancer(MmStats.NrFreePages, MmStats.NrSystemPages + MmStats.NrReservedPages); MmInitializeBalancer(MmStats.NrFreePages, MmStats.NrSystemPages + MmStats.NrReservedPages);
@ -553,7 +553,7 @@ MmSetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress, ULONG Flags)
{ {
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql; KIRQL oldIrql;
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
MmPageArray[Start].AllFlags = Flags; MmPageArray[Start].AllFlags = Flags;
KeReleaseSpinLock(&PageListLock, oldIrql); KeReleaseSpinLock(&PageListLock, oldIrql);
@ -625,7 +625,7 @@ MmGetFlagsPage(PHYSICAL_ADDRESS PhysicalAddress)
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql; KIRQL oldIrql;
ULONG Flags; ULONG Flags;
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
Flags = MmPageArray[Start].AllFlags; Flags = MmPageArray[Start].AllFlags;
KeReleaseSpinLock(&PageListLock, oldIrql); KeReleaseSpinLock(&PageListLock, oldIrql);
@ -652,7 +652,7 @@ MmGetSavedSwapEntryPage(PHYSICAL_ADDRESS PhysicalAddress)
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
SWAPENTRY SavedSwapEntry; SWAPENTRY SavedSwapEntry;
KIRQL oldIrql; KIRQL oldIrql;
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
SavedSwapEntry = MmPageArray[Start].SavedSwapEntry; SavedSwapEntry = MmPageArray[Start].SavedSwapEntry;
KeReleaseSpinLock(&PageListLock, oldIrql); KeReleaseSpinLock(&PageListLock, oldIrql);
@ -665,14 +665,14 @@ MmReferencePage(PHYSICAL_ADDRESS PhysicalAddress)
{ {
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql; KIRQL oldIrql;
DPRINT("MmReferencePage(PhysicalAddress %x)\n", PhysicalAddress); DPRINT("MmReferencePage(PhysicalAddress %x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0) if (PhysicalAddress.u.LowPart == 0)
{ {
KEBUGCHECK(0); KEBUGCHECK(0);
} }
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED) if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
@ -680,7 +680,7 @@ MmReferencePage(PHYSICAL_ADDRESS PhysicalAddress)
DbgPrint("Referencing non-used page\n"); DbgPrint("Referencing non-used page\n");
KEBUGCHECK(0); KEBUGCHECK(0);
} }
MmPageArray[Start].ReferenceCount++; MmPageArray[Start].ReferenceCount++;
KeReleaseSpinLock(&PageListLock, oldIrql); KeReleaseSpinLock(&PageListLock, oldIrql);
} }
@ -698,7 +698,7 @@ MmGetReferenceCountPage(PHYSICAL_ADDRESS PhysicalAddress)
{ {
KEBUGCHECK(0); KEBUGCHECK(0);
} }
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED) if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
@ -706,7 +706,7 @@ MmGetReferenceCountPage(PHYSICAL_ADDRESS PhysicalAddress)
DbgPrint("Getting reference count for free page\n"); DbgPrint("Getting reference count for free page\n");
KEBUGCHECK(0); KEBUGCHECK(0);
} }
RCount = MmPageArray[Start].ReferenceCount; RCount = MmPageArray[Start].ReferenceCount;
KeReleaseSpinLock(&PageListLock, oldIrql); KeReleaseSpinLock(&PageListLock, oldIrql);
@ -730,7 +730,7 @@ MmIsUsablePage(PHYSICAL_ADDRESS PhysicalAddress)
{ {
return(FALSE); return(FALSE);
} }
return(TRUE); return(TRUE);
} }
@ -755,7 +755,7 @@ MmDereferencePage(PHYSICAL_ADDRESS PhysicalAddress)
DbgPrint("Dereferencing free page\n"); DbgPrint("Dereferencing free page\n");
KEBUGCHECK(0); KEBUGCHECK(0);
} }
MmPageArray[Start].ReferenceCount--; MmPageArray[Start].ReferenceCount--;
if (MmPageArray[Start].ReferenceCount == 0) if (MmPageArray[Start].ReferenceCount == 0)
{ {
@ -807,22 +807,22 @@ MmGetLockCountPage(PHYSICAL_ADDRESS PhysicalAddress)
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql; KIRQL oldIrql;
ULONG LockCount; ULONG LockCount;
DPRINT("MmGetLockCountPage(PhysicalAddress %x)\n", PhysicalAddress); DPRINT("MmGetLockCountPage(PhysicalAddress %x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0) if (PhysicalAddress.u.LowPart == 0)
{ {
KEBUGCHECK(0); KEBUGCHECK(0);
} }
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED) if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
{ {
DbgPrint("Getting lock count for free page\n"); DbgPrint("Getting lock count for free page\n");
KEBUGCHECK(0); KEBUGCHECK(0);
} }
LockCount = MmPageArray[Start].LockCount; LockCount = MmPageArray[Start].LockCount;
KeReleaseSpinLock(&PageListLock, oldIrql); KeReleaseSpinLock(&PageListLock, oldIrql);
@ -834,22 +834,22 @@ MmLockPage(PHYSICAL_ADDRESS PhysicalAddress)
{ {
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql; KIRQL oldIrql;
DPRINT("MmLockPage(PhysicalAddress %x)\n", PhysicalAddress); DPRINT("MmLockPage(PhysicalAddress %x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0) if (PhysicalAddress.u.LowPart == 0)
{ {
KEBUGCHECK(0); KEBUGCHECK(0);
} }
KeAcquireSpinLock(&PageListLock, &oldIrql); KeAcquireSpinLock(&PageListLock, &oldIrql);
if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED) if (MmPageArray[Start].Flags.Type != MM_PHYSICAL_PAGE_USED)
{ {
DbgPrint("Locking free page\n"); DbgPrint("Locking free page\n");
KEBUGCHECK(0); KEBUGCHECK(0);
} }
MmPageArray[Start].LockCount++; MmPageArray[Start].LockCount++;
KeReleaseSpinLock(&PageListLock, oldIrql); KeReleaseSpinLock(&PageListLock, oldIrql);
} }
@ -859,9 +859,9 @@ MmUnlockPage(PHYSICAL_ADDRESS PhysicalAddress)
{ {
ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE; ULONG Start = PhysicalAddress.u.LowPart / PAGE_SIZE;
KIRQL oldIrql; KIRQL oldIrql;
DPRINT("MmUnlockPage(PhysicalAddress %I64x)\n", PhysicalAddress); DPRINT("MmUnlockPage(PhysicalAddress %I64x)\n", PhysicalAddress);
if (PhysicalAddress.u.LowPart == 0) if (PhysicalAddress.u.LowPart == 0)
{ {
KEBUGCHECK(0); KEBUGCHECK(0);

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: page.c,v 1.61 2003/12/30 18:52:05 fireball Exp $ /* $Id: page.c,v 1.62 2004/01/05 14:28:21 weiden Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/i386/page.c * FILE: ntoskrnl/mm/i386/page.c
@ -132,7 +132,7 @@ ProtectToPTE(ULONG flProtect)
#define ADDR_TO_PDE(v) (PULONG)(PAGEDIRECTORY_MAP + \ #define ADDR_TO_PDE(v) (PULONG)(PAGEDIRECTORY_MAP + \
((((ULONG)(v)) / (1024 * 1024))&(~0x3))) ((((ULONG)(v)) / (1024 * 1024))&(~0x3)))
#define ADDR_TO_PTE(v) (PULONG)(PAGETABLE_MAP + ((((ULONG)v / 1024))&(~0x3))) #define ADDR_TO_PTE(v) (PULONG)(PAGETABLE_MAP + ((((ULONG)(v) / 1024))&(~0x3)))
#define ADDR_TO_PDE_OFFSET(v) ((((ULONG)(v)) / (4 * 1024 * 1024))) #define ADDR_TO_PDE_OFFSET(v) ((((ULONG)(v)) / (4 * 1024 * 1024)))
@ -271,7 +271,7 @@ NTSTATUS MmGetPageEntry2(PVOID PAddress, PULONG* Pte, BOOLEAN MayWait)
KIRQL oldIrql; KIRQL oldIrql;
DPRINT("MmGetPageEntry(Address %x)\n", PAddress); DPRINT("MmGetPageEntry(Address %x)\n", PAddress);
Pde = ADDR_TO_PDE(PAddress); Pde = ADDR_TO_PDE(PAddress);
if (*Pde == 0) if (*Pde == 0)
{ {

View File

@ -1,4 +1,4 @@
/* $Id: kmap.c,v 1.30 2003/12/30 18:52:05 fireball Exp $ /* $Id: kmap.c,v 1.31 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -131,7 +131,7 @@ VOID INIT_FUNCTION
MiInitKernelMap(VOID) MiInitKernelMap(VOID)
{ {
KeInitializeSpinLock(&AllocMapLock); KeInitializeSpinLock(&AllocMapLock);
RtlInitializeBitMap(&AllocMap, (PVOID)&AllocMapBuffer, ALLOC_MAP_SIZE); RtlInitializeBitMap(&AllocMap, (PULONG)AllocMapBuffer, ALLOC_MAP_SIZE);
RtlClearAllBits(&AllocMap); RtlClearAllBits(&AllocMap);
} }

View File

@ -548,7 +548,7 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
if (BoundaryAddressMultiple.QuadPart != 0) if (BoundaryAddressMultiple.QuadPart != 0)
{ {
EndAddress = *BaseAddress + tmpLength-1; EndAddress = ((char*)(*BaseAddress)) + tmpLength-1;
assert(((DWORD_PTR)*BaseAddress/BoundaryAddressMultiple.QuadPart) == ((DWORD_PTR)EndAddress/BoundaryAddressMultiple.QuadPart)); assert(((DWORD_PTR)*BaseAddress/BoundaryAddressMultiple.QuadPart) == ((DWORD_PTR)EndAddress/BoundaryAddressMultiple.QuadPart));
} }

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: section.c,v 1.140 2003/12/31 14:52:06 hbirr Exp $ /* $Id: section.c,v 1.141 2004/01/05 14:28:21 weiden Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c * FILE: ntoskrnl/mm/section.c
@ -510,7 +510,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
/* /*
* Retrieve the page from the cache segment that we actually want. * Retrieve the page from the cache segment that we actually want.
*/ */
(*Page) = MmGetPhysicalAddress(BaseAddress + (*Page) = MmGetPhysicalAddress((char*)BaseAddress +
FileOffset - BaseOffset); FileOffset - BaseOffset);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, TRUE); CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, TRUE);
@ -734,7 +734,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
} }
Page.QuadPart = (LONGLONG)(PAGE_FROM_SSE(Entry)); Page.QuadPart = (LONGLONG)(PAGE_FROM_SSE(Entry));
MmReferencePage(Page);
MmSharePageEntrySectionSegment(Segment, Offset); MmSharePageEntrySectionSegment(Segment, Offset);
Status = MmCreateVirtualMapping(MemoryArea->Process, Status = MmCreateVirtualMapping(MemoryArea->Process,
@ -1594,7 +1594,6 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
!(SwapEntry == 0 && !(SwapEntry == 0 &&
(Context.Segment->Flags & MM_PAGEFILE_SEGMENT || (Context.Segment->Flags & MM_PAGEFILE_SEGMENT ||
Context.Segment->Characteristics & IMAGE_SECTION_CHAR_SHARED))) Context.Segment->Characteristics & IMAGE_SECTION_CHAR_SHARED)))
{ {
if (Context.Private) if (Context.Private)
{ {
@ -3739,6 +3738,7 @@ MmAllocateSection (IN ULONG Length)
DPRINT("MmAllocateSection(Length %x)\n",Length); DPRINT("MmAllocateSection(Length %x)\n",Length);
BoundaryAddressMultiple.QuadPart = 0; BoundaryAddressMultiple.QuadPart = 0;
AddressSpace = MmGetKernelAddressSpace(); AddressSpace = MmGetKernelAddressSpace();
Result = NULL; Result = NULL;
MmLockAddressSpace(AddressSpace); MmLockAddressSpace(AddressSpace);
@ -3753,6 +3753,7 @@ MmAllocateSection (IN ULONG Length)
FALSE, FALSE,
BoundaryAddressMultiple); BoundaryAddressMultiple);
MmUnlockAddressSpace(AddressSpace); MmUnlockAddressSpace(AddressSpace);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return (NULL); return (NULL);

View File

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.69 2003/12/30 22:13:45 fireball Exp $ /* $Id: create.c,v 1.70 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -401,7 +401,7 @@ PsInitializeThread(HANDLE ProcessHandle,
InsertTailList(&PiThreadListHead, &Thread->Tcb.ThreadListEntry); InsertTailList(&PiThreadListHead, &Thread->Tcb.ThreadListEntry);
KeReleaseSpinLock(&PiThreadListLock, oldIrql); KeReleaseSpinLock(&PiThreadListLock, oldIrql);
Thread->Tcb.BasePriority = Thread->ThreadsProcess->Pcb.BasePriority; Thread->Tcb.BasePriority = (CHAR)Thread->ThreadsProcess->Pcb.BasePriority;
Thread->Tcb.Priority = Thread->Tcb.BasePriority; Thread->Tcb.Priority = Thread->Tcb.BasePriority;
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
@ -455,7 +455,7 @@ PsCreateTeb(HANDLE ProcessHandle,
} }
} }
TebBase = (char *)TebBase - TebSize; TebBase = (char*)TebBase - TebSize;
} }
DPRINT ("TebBase %p TebSize %lu\n", TebBase, TebSize); DPRINT ("TebBase %p TebSize %lu\n", TebBase, TebSize);

View File

@ -39,10 +39,11 @@ PsIdleThreadMain(PVOID Context)
KeLowerIrql(oldlvl); KeLowerIrql(oldlvl);
} }
NtYieldExecution(); NtYieldExecution();
#ifdef __GNUC__
__asm__("hlt\n\t"); #if defined(__GNUC__)
__asm__( "hlt" );
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
__asm hlt __asm hlt
#else #else
#error Unknown compiler for inline assembler #error Unknown compiler for inline assembler
#endif #endif

View File

@ -1,4 +1,4 @@
/* $Id: kill.c,v 1.69 2003/12/30 03:27:52 hyperion Exp $ /* $Id: kill.c,v 1.70 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -97,7 +97,7 @@ PsReapThreads(VOID)
{ {
PiNrThreadsAwaitingReaping--; PiNrThreadsAwaitingReaping--;
current->Tcb.State = THREAD_STATE_TERMINATED_2; current->Tcb.State = THREAD_STATE_TERMINATED_2;
/* /*
An unbelievably complex chain of events would cause a system crash An unbelievably complex chain of events would cause a system crash
if PiThreadListLock was still held when the thread object is about if PiThreadListLock was still held when the thread object is about

View File

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.123 2003/12/31 05:33:04 jfilby Exp $ /* $Id: process.c,v 1.124 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -464,9 +464,9 @@ PsCreatePeb(HANDLE ProcessHandle,
Peb->OSBuildNumber = 0; Peb->OSBuildNumber = 0;
Peb->OSPlatformId = 2; //VER_PLATFORM_WIN32_NT; Peb->OSPlatformId = 2; //VER_PLATFORM_WIN32_NT;
Peb->AnsiCodePageData = (char *)TableBase + NlsAnsiTableOffset; Peb->AnsiCodePageData = (char*)TableBase + NlsAnsiTableOffset;
Peb->OemCodePageData = (char *)TableBase + NlsOemTableOffset; Peb->OemCodePageData = (char*)TableBase + NlsOemTableOffset;
Peb->UnicodeCaseTableData = (char *)TableBase + NlsUnicodeTableOffset; Peb->UnicodeCaseTableData = (char*)TableBase + NlsUnicodeTableOffset;
Process->Peb = Peb; Process->Peb = Peb;
KeDetachProcess(); KeDetachProcess();
@ -785,7 +785,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
#endif #endif
/* Protect the 60KB above the shared user page */ /* Protect the 60KB above the shared user page */
BaseAddress = (char *)USER_SHARED_DATA + PAGE_SIZE; BaseAddress = (char*)USER_SHARED_DATA + PAGE_SIZE;
Status = MmCreateMemoryArea(Process, Status = MmCreateMemoryArea(Process,
&Process->AddressSpace, &Process->AddressSpace,
MEMORY_AREA_NO_ACCESS, MEMORY_AREA_NO_ACCESS,

View File

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.123 2003/12/14 18:02:33 hbirr Exp $ /* $Id: thread.c,v 1.124 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -228,7 +228,7 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
DPRINT("PsDispatchThread() %d/%d/%d/%d\n", KeGetCurrentProcessorNumber(), DPRINT("PsDispatchThread() %d/%d/%d/%d\n", KeGetCurrentProcessorNumber(),
CurrentThread->Cid.UniqueThread, NewThreadStatus, CurrentThread->Tcb.State); CurrentThread->Cid.UniqueThread, NewThreadStatus, CurrentThread->Tcb.State);
CurrentThread->Tcb.State = NewThreadStatus; CurrentThread->Tcb.State = (UCHAR)NewThreadStatus;
if (CurrentThread->Tcb.State == THREAD_STATE_READY) if (CurrentThread->Tcb.State == THREAD_STATE_READY)
{ {
PsInsertIntoThreadList(CurrentThread->Tcb.Priority, PsInsertIntoThreadList(CurrentThread->Tcb.Priority,
@ -369,7 +369,7 @@ PsBlockThread(PNTSTATUS Status, UCHAR Alertable, ULONG WaitMode,
KeReleaseDispatcherDatabaseLockFromDpcLevel(); KeReleaseDispatcherDatabaseLockFromDpcLevel();
} }
Thread->Tcb.Alertable = Alertable; Thread->Tcb.Alertable = Alertable;
Thread->Tcb.WaitMode = WaitMode; Thread->Tcb.WaitMode = (UCHAR)WaitMode;
Thread->Tcb.WaitIrql = WaitIrql; Thread->Tcb.WaitIrql = WaitIrql;
Thread->Tcb.WaitReason = WaitReason; Thread->Tcb.WaitReason = WaitReason;
PsDispatchThreadNoLock(THREAD_STATE_BLOCKED); PsDispatchThreadNoLock(THREAD_STATE_BLOCKED);

View File

@ -1,4 +1,4 @@
/* $Id: acl.c,v 1.14 2003/12/30 18:52:06 fireball Exp $ /* $Id: acl.c,v 1.15 2004/01/05 14:28:21 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -263,7 +263,7 @@ RtlAddAce(PACL Acl,
{ {
AclRevision = Acl->AclRevision; AclRevision = Acl->AclRevision;
} }
if ((PVOID)((char*)AceList + AceListLength) <= (PVOID)AceList) if (((char*)AceList + AceListLength) <= (char*)AceList)
{ {
return(STATUS_UNSUCCESSFUL); return(STATUS_UNSUCCESSFUL);
} }