Fix some NDK things and missing w32api defines.
Modified: trunk/reactos/include/ndk/haltypes.h
Modified: trunk/reactos/include/ndk/iotypes.h
Modified: trunk/reactos/include/ndk/kefuncs.h
Modified: trunk/reactos/include/ndk/lpctypes.h
Modified: trunk/reactos/include/ndk/mmtypes.h
Modified: trunk/reactos/include/ndk/obtypes.h
Modified: trunk/reactos/include/ndk/rtltypes.h
Modified: trunk/reactos/include/ndk/umtypes.h
Modified: trunk/reactos/include/ndk/zwfuncs.h
Modified: trunk/reactos/include/ndk/zwtypes.h
Modified: trunk/reactos/include/ntos/ntpnp.h
Modified: trunk/reactos/include/reactos/helper.h
Modified: trunk/reactos/w32api/include/ddk/ntifs.h
Modified: trunk/reactos/w32api/include/ddk/winddk.h

Modified: trunk/reactos/include/ndk/haltypes.h
--- trunk/reactos/include/ndk/haltypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/haltypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -10,7 +10,6 @@
 #define _HALTYPES_H
 
 /* DEPENDENCIES **************************************************************/
-//#include <ddk/ntdddisk.h>
 
 /* EXPORTED DATA *************************************************************/
 extern ULONG NTOSAPI KdComPortInUse;
@@ -30,6 +29,7 @@
 #define MB_FLAGS_BOOT_LOADER_NAME (0x200)
 #define MB_FLAGS_APM_TABLE        (0x400)
 #define MB_FLAGS_GRAPHICS_TABLE   (0x800)
+#define MB_FLAGS_ACPI_TABLE       (0x1000)
 
 /* ENUMERATIONS **************************************************************/
 typedef enum _FIRMWARE_ENTRY
@@ -44,6 +44,19 @@
 
 /* TYPES *********************************************************************/
 
+typedef struct _HAL_PRIVATE_DISPATCH
+{
+    ULONG Version;
+} HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH;
+
+#ifdef __NTOSKRNL__
+extern NTOSAPI HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
+#else
+extern NTOSAPI PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
+#endif
+
+#define HAL_PRIVATE_DISPATCH_VERSION	1
+
 typedef struct _LOADER_MODULE 
 {
    ULONG ModStart;

Modified: trunk/reactos/include/ndk/iotypes.h
--- trunk/reactos/include/ndk/iotypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/iotypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -20,6 +20,11 @@
 extern POBJECT_TYPE NTOSAPI IoFileObjectType;
 
 /* CONSTANTS *****************************************************************/
+#define DOE_UNLOAD_PENDING    0x1
+#define DOE_DELETE_PENDING    0x2
+#define DOE_REMOVE_PENDING    0x4
+#define DOE_REMOVE_PROCESSED  0x8
+#define DOE_START_PENDING     0x10
 
 /* ENUMERATIONS **************************************************************/
 

Modified: trunk/reactos/include/ndk/kefuncs.h
--- trunk/reactos/include/ndk/kefuncs.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/kefuncs.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -277,5 +277,9 @@
 KeRaiseUserException(
     IN NTSTATUS ExceptionCode
     );
+
+VOID 
+STDCALL
+KeFlushWriteBuffer(VOID);
     
 #endif

Modified: trunk/reactos/include/ndk/lpctypes.h
--- trunk/reactos/include/ndk/lpctypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/lpctypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -16,6 +16,8 @@
 /* CONSTANTS *****************************************************************/
 #define LPC_MESSAGE_BASE_SIZE 24
 #define MAX_MESSAGE_DATA      (0x130)
+#define PORT_MAX_DATA_LENGTH 0x104
+#define PORT_MAX_MESSAGE_LENGTH 0x148
 
 /* ENUMERATIONS **************************************************************/
 

Modified: trunk/reactos/include/ndk/mmtypes.h
--- trunk/reactos/include/ndk/mmtypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/mmtypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -16,6 +16,17 @@
 /* CONSTANTS *****************************************************************/
 
 /* ENUMERATIONS **************************************************************/
+typedef enum _PP_NPAGED_LOOKASIDE_NUMBER
+{
+    LookasideSmallIrpList = 0,
+    LookasideLargeIrpList = 1,
+    LookasideMdlList = 2,
+    LookasideCreateInfoList = 3,
+    LookasideNameBufferList = 4,
+    LookasideTwilightList = 5,
+    LookasideCompletionList = 6,
+    LookasideMaximumList = 7
+} PP_NPAGED_LOOKASIDE_NUMBER;
 
 /* TYPES *********************************************************************/
 

Modified: trunk/reactos/include/ndk/obtypes.h
--- trunk/reactos/include/ndk/obtypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/obtypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -13,7 +13,7 @@
 
 /* EXPORTED DATA *************************************************************/
 extern NTOSAPI POBJECT_TYPE ObDirectoryType;
-extern NTOSAPI struct DEVICE_MAP* ObSystemDeviceMap;
+extern NTOSAPI PDEVICE_MAP ObSystemDeviceMap;
 
 /* CONSTANTS *****************************************************************/
 

Modified: trunk/reactos/include/ndk/rtltypes.h
--- trunk/reactos/include/ndk/rtltypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/rtltypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -387,6 +387,11 @@
         AclRevisionInformation = 1,
         AclSizeInformation
     } ACL_INFORMATION_CLASS;
+    
+    #define TIME_ZONE_ID_UNKNOWN 0
+    #define TIME_ZONE_ID_STANDARD 1
+    #define TIME_ZONE_ID_DAYLIGHT 2
+    #define TIME_ZONE_ID_INVALID 0xFFFFFFFF
 #endif
 
 #endif

Modified: trunk/reactos/include/ndk/umtypes.h
--- trunk/reactos/include/ndk/umtypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/umtypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -292,79 +292,7 @@
   
 #define IsLastEntry(ListHead, Entry) \
     ((ListHead)->Blink == Entry)
-    
-#define InsertAscendingListFIFO(ListHead, Type, ListEntryField, NewEntry, SortField)\
-{\
-  PLIST_ENTRY current;\
-\
-  current = (ListHead)->Flink;\
-  while (current != (ListHead))\
-  {\
-    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >\
-        (NewEntry)->SortField)\
-    {\
-      break;\
-    }\
-    current = current->Flink;\
-  }\
-\
-  InsertTailList(current, &((NewEntry)->ListEntryField));\
-}
 
-#define InsertDescendingListFIFO(ListHead, Type, ListEntryField, NewEntry, SortField)\
-{\
-  PLIST_ENTRY current;\
-\
-  current = (ListHead)->Flink;\
-  while (current != (ListHead))\
-  {\
-    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField <\
-        (NewEntry)->SortField)\
-    {\
-      break;\
-    }\
-    current = current->Flink;\
-  }\
-\
-  InsertTailList(current, &((NewEntry)->ListEntryField));\
-}
-
-#define InsertAscendingList(ListHead, Type, ListEntryField, NewEntry, SortField)\
-{\
-  PLIST_ENTRY current;\
-\
-  current = (ListHead)->Flink;\
-  while (current != (ListHead))\
-  {\
-    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >=\
-        (NewEntry)->SortField)\
-    {\
-      break;\
-    }\
-    current = current->Flink;\
-  }\
-\
-  InsertTailList(current, &((NewEntry)->ListEntryField));\
-}
-
-#define InsertDescendingList(ListHead, Type, ListEntryField, NewEntry, SortField)\
-{\
-  PLIST_ENTRY current;\
-\
-  current = (ListHead)->Flink;\
-  while (current != (ListHead))\
-  {\
-    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField <=\
-        (NewEntry)->SortField)\
-    {\
-      break;\
-    }\
-    current = current->Flink;\
-  }\
-\
-  InsertTailList(current, &((NewEntry)->ListEntryField));\
-}
-
 /*
  * Constant String Macro
  */

Modified: trunk/reactos/include/ndk/zwfuncs.h
--- trunk/reactos/include/ndk/zwfuncs.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/zwfuncs.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -954,6 +954,15 @@
 
 NTSTATUS 
 STDCALL
+NtGetPlugPlayEvent(
+    ULONG Reserved1,
+    ULONG Reserved2,
+    struct _PLUGPLAY_EVENT_BLOCK *Buffer,
+    ULONG BufferSize
+);
+
+NTSTATUS 
+STDCALL
 NtImpersonateClientOfPort(
     HANDLE PortHandle,
     PLPC_MESSAGE ClientMessage
@@ -1498,6 +1507,14 @@
 );
 
 NTSTATUS 
+STDCALL
+NtPlugPlayControl(
+    ULONG ControlCode,
+    PVOID Buffer,
+    ULONG BufferSize
+);
+   
+NTSTATUS 
 STDCALL 
 NtPowerInformation(
     POWER_INFORMATION_LEVEL PowerInformationLevel,
@@ -2049,7 +2066,7 @@
 STDCALL
 NtQuerySystemEnvironmentValue(
     IN PUNICODE_STRING Name,
-    OUT PVOID Value,
+    OUT PWSTR Value,
     ULONG Length,
     PULONG ReturnLength
 );
@@ -3307,23 +3324,6 @@
     VOID
 );
 
-NTSTATUS
-STDCALL
-NtPlugPlayControl(
-    DWORD Unknown1,
-    DWORD Unknown2,
-    DWORD Unknown3
-);
-
-NTSTATUS
-STDCALL
-NtGetPlugPlayEvent(
-    ULONG Reserved1,
-    ULONG Reserved2,
-    PVOID Buffer,
-    ULONG BufferLength
-);
-
 NTSTATUS 
 STDCALL 
 NtSetSystemPowerState(
@@ -3608,7 +3608,7 @@
 STDCALL
 NtQuerySection(
     IN HANDLE SectionHandle,
-    IN CINT SectionInformationClass,
+    IN SECTION_INFORMATION_CLASS SectionInformationClass,
     OUT PVOID SectionInformation,
     IN ULONG Length,
     OUT PULONG ResultLength

Modified: trunk/reactos/include/ndk/zwtypes.h
--- trunk/reactos/include/ndk/zwtypes.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ndk/zwtypes.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -25,6 +25,9 @@
 
 #define EVENT_PAIR_ALL_ACCESS    (0x1F0000L)
 
+#define OBJECT_TYPE_CREATE 0x0001
+#define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
+
 /* For ProcessDeviceMap */
 #define DOSDEVICE_DRIVE_UNKNOWN    0
 #define DOSDEVICE_DRIVE_CALCULATE  1
@@ -36,7 +39,6 @@
 
 /* ENUMERATIONS **************************************************************/
 
-
 typedef enum _HARDERROR_RESPONSE_OPTION 
 {
     OptionAbortRetryIgnore,
@@ -250,6 +252,7 @@
 
 typedef unsigned short LANGID;
 typedef LANGID *PLANGID;
+struct _PLUGPLAY_EVENT_BLOCK; /* FIXME: Ask Filip if it's OK to define it */
 
 /**** Information Structures ****/
 /*

Modified: trunk/reactos/include/ntos/ntpnp.h
--- trunk/reactos/include/ntos/ntpnp.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/ntos/ntpnp.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -71,24 +71,6 @@
    MaxPlugEventCategory
 } PLUGPLAY_EVENT_CATEGORY;
 
-#ifndef __USE_W32API
-typedef enum _PNP_VETO_TYPE {
-   PNP_VetoTypeUnknown,
-   PNP_VetoLegacyDevice,
-   PNP_VetoPendingClose,
-   PNP_VetoWindowsApp,
-   PNP_VetoWindowsService,
-   PNP_VetoOutstandingOpen,
-   PNP_VetoDevice,
-   PNP_VetoDriver,
-   PNP_VetoIllegalDeviceRequest,
-   PNP_VetoInsufficientPower,
-   PNP_VetoNonDisableable,
-   PNP_VetoLegacyDriver,
-   PNP_VetoInsufficientRights,
-} PNP_VETO_TYPE;
-#endif
-
 /*
  * Plug and Play event structure used by NtGetPlugPlayEvent.
  *
@@ -184,14 +166,13 @@
  *
  * Remarks
  *    This function isn't multi-thread safe!
- */
-
 NTSTATUS STDCALL
 NtGetPlugPlayEvent(
    ULONG Reserved1,
    ULONG Reserved2,
    PPLUGPLAY_EVENT_BLOCK Buffer,
    ULONG BufferSize);
+ */
 
 /*
  * NtPlugPlayControl
@@ -294,13 +275,6 @@
   ULONG Flags;    /* DN_       see cfg.h */
 } PLUGPLAY_DEVICE_STATUS_DATA, *PPLUGPLAY_DEVICE_STATUS_DATA;
 
-
-NTSTATUS STDCALL
-NtPlugPlayControl(
-   ULONG ControlCode,
-   PVOID Buffer,
-   ULONG BufferSize);
-
 #endif /* __GUIDS_ONLY__ */
 
 #endif /* __NTPNP_H */

Modified: trunk/reactos/include/reactos/helper.h
--- trunk/reactos/include/reactos/helper.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/include/reactos/helper.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -41,4 +41,77 @@
 #define SECONDS_TO_100NS(seconds) (((LONGLONG)(seconds)) * MILLIS_TO_100NS(1000))
 #define MINUTES_TO_100NS(minutes) (((LONGLONG)(minutes)) * SECONDS_TO_100NS(60))
 #define HOURS_TO_100NS(hours) (((LONGLONG)(hours)) * MINUTES_TO_100NS(60))
+#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
+#define InsertAscendingListFIFO(ListHead, Type, ListEntryField, NewEntry, SortField)\
+{\
+  PLIST_ENTRY current;\
+\
+  current = (ListHead)->Flink;\
+  while (current != (ListHead))\
+  {\
+    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >\
+        (NewEntry)->SortField)\
+    {\
+      break;\
+    }\
+    current = current->Flink;\
+  }\
+\
+  InsertTailList(current, &((NewEntry)->ListEntryField));\
+}
+
+#define InsertDescendingListFIFO(ListHead, Type, ListEntryField, NewEntry, SortField)\
+{\
+  PLIST_ENTRY current;\
+\
+  current = (ListHead)->Flink;\
+  while (current != (ListHead))\
+  {\
+    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField <\
+        (NewEntry)->SortField)\
+    {\
+      break;\
+    }\
+    current = current->Flink;\
+  }\
+\
+  InsertTailList(current, &((NewEntry)->ListEntryField));\
+}
+
+#define InsertAscendingList(ListHead, Type, ListEntryField, NewEntry, SortField)\
+{\
+  PLIST_ENTRY current;\
+\
+  current = (ListHead)->Flink;\
+  while (current != (ListHead))\
+  {\
+    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >=\
+        (NewEntry)->SortField)\
+    {\
+      break;\
+    }\
+    current = current->Flink;\
+  }\
+\
+  InsertTailList(current, &((NewEntry)->ListEntryField));\
+}
+
+#define InsertDescendingList(ListHead, Type, ListEntryField, NewEntry, SortField)\
+{\
+  PLIST_ENTRY current;\
+\
+  current = (ListHead)->Flink;\
+  while (current != (ListHead))\
+  {\
+    if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField <=\
+        (NewEntry)->SortField)\
+    {\
+      break;\
+    }\
+    current = current->Flink;\
+  }\
+\
+  InsertTailList(current, &((NewEntry)->ListEntryField));\
+}
+
 #endif

Modified: trunk/reactos/w32api/include/ddk/ntifs.h
--- trunk/reactos/w32api/include/ddk/ntifs.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/w32api/include/ddk/ntifs.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -29,7 +29,7 @@
 #endif
 
 #include "ntddk.h"
-#include "ntapi.h"
+//#include "ntapi.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -329,9 +329,6 @@
 #define PIN_NO_READ                     (4)
 #define PIN_IF_BCB                      (8)
 
-#define PORT_CONNECT                    0x0001
-#define PORT_ALL_ACCESS                 (STANDARD_RIGHTS_ALL |\
-                                         PORT_CONNECT)
 /* also in winnt.h */
 #define SEC_BASED	0x00200000
 #define SEC_NO_CHANGE	0x00400000
@@ -539,6 +536,12 @@
 typedef struct _VACB                            *PVACB;
 typedef struct _VAD_HEADER                      *PVAD_HEADER;
 
+typedef ULONG LBN;
+typedef LBN *PLBN;
+
+typedef ULONG VBN;
+typedef VBN *PVBN;
+
 typedef struct _NOTIFY_SYNC
 {
     ULONG Unknown0;
@@ -1239,6 +1242,28 @@
 
 #endif /* (VER_PRODUCTBUILD >= 2600) */
 
+typedef struct _BASE_MCB
+{
+    ULONG MaximumPairCount;
+    ULONG PairCount;
+    POOL_TYPE PoolType;
+    PVOID Mapping;
+} BASE_MCB;
+typedef BASE_MCB *PBASE_MCB;
+
+typedef struct _LARGE_MCB
+{
+    PFAST_MUTEX FastMutex;
+    BASE_MCB BaseMcb;
+} LARGE_MCB;
+typedef LARGE_MCB *PLARGE_MCB;
+
+typedef struct _MCB 
+{
+    LARGE_MCB DummyFieldThatSizesThisStructureCorrectly;
+} MCB;
+typedef MCB *PMCB;
+
 typedef struct _GENERATE_NAME_CONTEXT {
     USHORT  Checksum;
     BOOLEAN CheckSumInserted;
@@ -2556,6 +2581,15 @@
     IN NTSTATUS Ntstatus
 );
 
+#define NLS_MB_CODE_PAGE_TAG NlsMbCodePageTag
+#define NLS_MB_OEM_CODE_PAGE_TAG NlsMbOemCodePageTag
+#define NLS_MB_CODE_PAGE_TAG NlsMbOemCodePageTag
+#define NLS_OEM_LEAD_BYTE_INFO NlsOemLeadByteInfo
+
+extern BOOLEAN NlsMbCodePageTag;
+extern BOOLEAN NlsMbOemCodePageTag;
+extern PUSHORT NlsOemLeadByteInfo;
+
 #define FsRtlIsLeadDbcsCharacter(DBCS_CHAR) (                               \
     (BOOLEAN)((UCHAR)(DBCS_CHAR) < 0x80 ? FALSE :                           \
               (NLS_MB_CODE_PAGE_TAG &&                                      \

Modified: trunk/reactos/w32api/include/ddk/winddk.h
--- trunk/reactos/w32api/include/ddk/winddk.h	2005-06-23 01:36:58 UTC (rev 16233)
+++ trunk/reactos/w32api/include/ddk/winddk.h	2005-06-23 03:18:20 UTC (rev 16234)
@@ -5368,13 +5368,30 @@
   IN PVOID  Context,
   IN PVOID  Environment  OPTIONAL);
 
-NTOSAPI
-VOID
-DDKAPI
-RtlRetrieveUlong(
-  IN OUT PULONG  DestinationAddress,
-  IN PULONG  SourceAddress);
+  
+#define LONG_SIZE (sizeof(LONG))
+#define LONG_MASK (LONG_SIZE - 1)
 
+/*
+ * VOID
+ * RtlRetrieveUlong (
+ *	PULONG	DestinationAddress,
+ *	PULONG	SourceAddress
+ *	);
+ */
+#define RtlRetrieveUlong(DestAddress,SrcAddress) \
+    if ((ULONG_PTR)(SrcAddress) & LONG_MASK) \
+    { \
+        ((PUCHAR)(DestAddress))[0]=((PUCHAR)(SrcAddress))[0]; \
+        ((PUCHAR)(DestAddress))[1]=((PUCHAR)(SrcAddress))[1]; \
+        ((PUCHAR)(DestAddress))[2]=((PUCHAR)(SrcAddress))[2]; \
+        ((PUCHAR)(DestAddress))[3]=((PUCHAR)(SrcAddress))[3]; \
+    } \
+    else \
+    { \
+        *((PULONG)(DestAddress))=*((PULONG)(SrcAddress)); \
+    }
+
 NTOSAPI
 VOID
 DDKAPI