Major cleanup of NDK. I've decided that it would be much cleaner to
accumulate all types, regardless of their um/km availabilty, into each
header. Thus, umtypes.h now only contains the equivalent of ntdef.h and
is automatically not-included if the DDK is. Similary, I've removed all
the NTIFS hacks and added a single ifssupp.h file, which is
automatically removed if the IFS is added. That file will be deleted
then the Longhorn WDK is made public (it contains the IFS/DDK). Nothing
has changed on the includer-side, the same rules still apply
Modified: trunk/reactos/drivers/storage/scsiport/scsiport_int.h
Modified: trunk/reactos/include/drivers/diskdump/diskdump.h
Modified: trunk/reactos/include/ndk/arch/ketypes.h
Added: trunk/reactos/include/ndk/cmtypes.h
Modified: trunk/reactos/include/ndk/extypes.h
Modified: trunk/reactos/include/ndk/fixmes.txt
Modified: trunk/reactos/include/ndk/i386/mmtypes.h
Added: trunk/reactos/include/ndk/ifssupp.h
Modified: trunk/reactos/include/ndk/iotypes.h
Modified: trunk/reactos/include/ndk/kdfuncs.h
Modified: trunk/reactos/include/ndk/kefuncs.h
Modified: trunk/reactos/include/ndk/ketypes.h
Modified: trunk/reactos/include/ndk/lpctypes.h
Modified: trunk/reactos/include/ndk/mmtypes.h
Modified: trunk/reactos/include/ndk/ntndk.h
Modified: trunk/reactos/include/ndk/obtypes.h
Modified: trunk/reactos/include/ndk/pstypes.h
Modified: trunk/reactos/include/ndk/rtlfuncs.h
Modified: trunk/reactos/include/ndk/rtltypes.h
Modified: trunk/reactos/include/ndk/umfuncs.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/w32api/include/basetsd.h
Modified: trunk/reactos/w32api/include/winnt.h
_____
Modified: trunk/reactos/drivers/storage/scsiport/scsiport_int.h
--- trunk/reactos/drivers/storage/scsiport/scsiport_int.h
2005-08-17 06:14:55 UTC (rev 17419)
+++ trunk/reactos/drivers/storage/scsiport/scsiport_int.h
2005-08-17 07:06:59 UTC (rev 17420)
@@ -7,8 +7,12 @@
#define VERSION "0.0.3"
+#ifndef PAGE_ROUND_UP
#define PAGE_ROUND_UP(x) ( (((ULONG_PTR)x)%PAGE_SIZE) ?
((((ULONG_PTR)x)&(~(PAGE_SIZE-1)))+PAGE_SIZE) : ((ULONG_PTR)x) )
+#endif
+#ifndef ROUND_UP
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
+#endif
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) +
((D)<<24))
_____
Modified: trunk/reactos/include/drivers/diskdump/diskdump.h
--- trunk/reactos/include/drivers/diskdump/diskdump.h 2005-08-17
06:14:55 UTC (rev 17419)
+++ trunk/reactos/include/drivers/diskdump/diskdump.h 2005-08-17
07:06:59 UTC (rev 17420)
@@ -2,7 +2,7 @@
#define __DISKDUMP_H
#include <ddk/ntddscsi.h>
-#include <ndk/ketypes.h>
+#include <ndk/ntndk.h>
#define MM_CORE_DUMP_HEADER_MAGIC (0xdeafbead)
#define MM_CORE_DUMP_HEADER_VERSION (0x1)
_____
Modified: trunk/reactos/include/ndk/arch/ketypes.h
--- trunk/reactos/include/ndk/arch/ketypes.h 2005-08-17 06:14:55 UTC
(rev 17419)
+++ trunk/reactos/include/ndk/arch/ketypes.h 2005-08-17 07:06:59 UTC
(rev 17420)
@@ -9,7 +9,7 @@
#ifndef _ARCH_KETYPES_H
#define _ARCH_KETYPES_H
-/* Shared structure needed by Arch-specific headers */
+/* Shared structures needed by Arch-specific headers */
typedef struct _KDPC_DATA
{
LIST_ENTRY DpcListHead;
@@ -18,6 +18,12 @@
ULONG DpcCount;
} KDPC_DATA, *PKDPC_DATA;
+typedef struct _PP_LOOKASIDE_LIST
+{
+ struct _GENERAL_LOOKASIDE *P;
+ struct _GENERAL_LOOKASIDE *L;
+} PP_LOOKASIDE_LIST, *PPP_LOOKASIDE_LIST;
+
#ifdef _M_IX86
#include <ndk/i386/ketypes.h>
#else
_____
Added: trunk/reactos/include/ndk/cmtypes.h
--- trunk/reactos/include/ndk/cmtypes.h 2005-08-17 06:14:55 UTC (rev
17419)
+++ trunk/reactos/include/ndk/cmtypes.h 2005-08-17 07:06:59 UTC (rev
17420)
@@ -0,0 +1,129 @@
+/*
+ * PROJECT: ReactOS Native Headers
+ * FILE: include/ndk/cmtypes.h
+ * PURPOSE: Definitions for Config Manager Types not defined in
DDK/IFS
+ * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
+ * UPDATE HISTORY:
+ * Created 06/10/04
+ */
+
+#ifndef _CMTYPES_H
+#define _CMTYPES_H
+
+/* DEPENDENCIES
**************************************************************/
+
+/* EXPORTED DATA
*************************************************************/
+
+/* CONSTANTS
*****************************************************************/
+
+/* ENUMERATIONS
**************************************************************/
+
+#ifdef NTOS_MODE_USER
+typedef enum _KEY_INFORMATION_CLASS
+{
+ KeyBasicInformation,
+ KeyNodeInformation,
+ KeyFullInformation,
+ KeyNameInformation,
+ KeyCachedInformation,
+ KeyFlagsInformation
+} KEY_INFORMATION_CLASS;
+
+typedef enum _KEY_VALUE_INFORMATION_CLASS
+{
+ KeyValueBasicInformation,
+ KeyValueFullInformation,
+ KeyValuePartialInformation,
+ KeyValueFullInformationAlign64,
+ KeyValuePartialInformationAlign64
+} KEY_VALUE_INFORMATION_CLASS;
+
+typedef enum _KEY_SET_INFORMATION_CLASS
+{
+ KeyWriteTimeInformation,
+ KeyUserFlagsInformation,
+ MaxKeySetInfoClass
+} KEY_SET_INFORMATION_CLASS;
+
+/* TYPES
*********************************************************************/
+
+typedef struct _KEY_WRITE_TIME_INFORMATION
+{
+ LARGE_INTEGER LastWriteTime;
+} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
+
+typedef struct _KEY_USER_FLAGS_INFORMATION
+{
+ ULONG UserFlags;
+} KEY_USER_FLAGS_INFORMATION, *PKEY_USER_FLAGS_INFORMATION;
+
+typedef struct _KEY_FULL_INFORMATION
+{
+ LARGE_INTEGER LastWriteTime;
+ ULONG TitleIndex;
+ ULONG ClassOffset;
+ ULONG ClassLength;
+ ULONG SubKeys;
+ ULONG MaxNameLen;
+ ULONG MaxClassLen;
+ ULONG Values;
+ ULONG MaxValueNameLen;
+ ULONG MaxValueDataLen;
+ WCHAR Class[1];
+} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
+
+typedef struct _KEY_NODE_INFORMATION
+{
+ LARGE_INTEGER LastWriteTime;
+ ULONG TitleIndex;
+ ULONG ClassOffset;
+ ULONG ClassLength;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
+
+typedef struct _KEY_VALUE_ENTRY
+{
+ PUNICODE_STRING ValueName;
+ ULONG DataLength;
+ ULONG DataOffset;
+ ULONG Type;
+} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
+
+typedef struct _KEY_VALUE_PARTIAL_INFORMATION
+{
+ ULONG TitleIndex;
+ ULONG Type;
+ ULONG DataLength;
+ UCHAR Data[1];
+} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
+
+typedef struct _KEY_VALUE_BASIC_INFORMATION
+{
+ ULONG TitleIndex;
+ ULONG Type;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
+
+typedef struct _KEY_VALUE_FULL_INFORMATION
+{
+ ULONG TitleIndex;
+ ULONG Type;
+ ULONG DataOffset;
+ ULONG DataLength;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
+
+typedef struct _KEY_BASIC_INFORMATION
+{
+ LARGE_INTEGER LastWriteTime;
+ ULONG TitleIndex;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
+
+#endif
+#endif
+
_____
Modified: trunk/reactos/include/ndk/extypes.h
--- trunk/reactos/include/ndk/extypes.h 2005-08-17 06:14:55 UTC (rev
17419)
+++ trunk/reactos/include/ndk/extypes.h 2005-08-17 07:06:59 UTC (rev
17420)
@@ -11,36 +11,37 @@
#define _EXTYPES_H
/* DEPENDENCIES
**************************************************************/
-#include "ketypes.h"
/* EXPORTED DATA
*************************************************************/
+#ifndef NTOS_MODE_USER
extern POBJECT_TYPE NTOSAPI ExIoCompletionType;
extern NTOSAPI POBJECT_TYPE ExMutantObjectType;
extern NTOSAPI POBJECT_TYPE ExTimerType;
+#endif
/* CONSTANTS
*****************************************************************/
-
+#ifndef NTOS_MODE_USER
#define INVALID_HANDLE_VALUE (HANDLE)-1
+#endif
/* Increments */
#define MUTANT_INCREMENT 1
-/* Callback Object Access Rights */
-#define CALLBACK_ALL_ACCESS
(STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x0001)
-#define CALLBACK_EXECUTE
(STANDARD_RIGHTS_EXECUTE|SYNCHRONIZE|0x0001)
-#define CALLBACK_WRITE (STANDARD_RIGHTS_WRITE|SYNCHRONIZE|0x0001)
-#define CALLBACK_READ (STANDARD_RIGHTS_READ|SYNCHRONIZE|0x0001)
+/* Executive Object Access Rights */
+#define CALLBACK_ALL_ACCESS
(STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x0001)
+#define CALLBACK_EXECUTE
(STANDARD_RIGHTS_EXECUTE|SYNCHRONIZE|0x0001)
+#define CALLBACK_WRITE
(STANDARD_RIGHTS_WRITE|SYNCHRONIZE|0x0001)
+#define CALLBACK_READ
(STANDARD_RIGHTS_READ|SYNCHRONIZE|0x0001)
+#ifdef NTOS_MODE_USER
+#define EVENT_QUERY_STATE 0x0001
+#define SEMAPHORE_QUERY_STATE 0x0001
+#endif
/* ENUMERATIONS
**************************************************************/
/* TYPES
*********************************************************************/
-/* You'll need the IFS for this, so use an equivalent version */
-#ifndef _NTIFS_
-typedef PVOID EX_RUNDOWN_REF;
-typedef PVOID EX_PUSH_LOCK;
-#endif
-
+#ifndef NTOS_MODE_USER
typedef struct _EX_QUEUE_WORKER_INFO
{
UCHAR QueueDisabled:1;
@@ -120,4 +121,5 @@
} HANDLE_TABLE, *PHANDLE_TABLE;
#endif
+#endif
_____
Modified: trunk/reactos/include/ndk/fixmes.txt
--- trunk/reactos/include/ndk/fixmes.txt 2005-08-17 06:14:55 UTC
(rev 17419)
+++ trunk/reactos/include/ndk/fixmes.txt 2005-08-17 07:06:59 UTC
(rev 17420)
@@ -33,45 +33,10 @@
Priority 4:
- FIXED: Kernel and Memory Types are not architecture-specific
(Eric) [ketypes.h, mmtypes.h]
- FIXED: Win32K Builds with windows.h (Filip) [extypes.h,
ketypes.h]
- - Move out stuff from umtypes.h into the actual header where
they should go. Use ifdeffing
- directly in that file to protect user-mode versus kernel-mode
types. umtypes.h will only
- end up containing the misc types that are needed for
compatibility. This would create a
- significant cleanup.
+ - FIXED: Modify design of NDK so that all the types are in their
respective files (Alex) [*.h]
Priority 5:
- FIXED: LPC Types are totally wrong. (Alex) [lpctypes.h]
- Missing System Info Classes [zwtypes.h]
- FIXED: Process Priority Classes are messed up (Alex)
[pstypes.h]
-Generic Note:
- One of the most difficult things is when certain structures
require the IFS for some of their
- members. Up until some time ago, the IFS was 1000$, so it was
senseless to require it in order
- to allow people to use the NDK. Recently, however, the IFS price
went down to 100$. This is
- still way too much. Even though the GNU NTIFS.H exists, I don't
want to fallback on it. The
- good news is that the WDK (Windows Driver Kit), which will
supplant the DDK in about a year,
- includes the IFS. At that point we can remove all the
#ifndef/ifdef NTIFS hacks, since it'll
- be OK to "force" IFS usage.
-
- UPDATE:
- However, I'm giving serious consideration of making the IFS a
requirement, and suggesting
- usage of the GNU IFS for anyone that needs it. The problem,
however, is that the official
- GNU IFS is outdated and quite invalid in many ways, compared to
the ReactOS IFS (which still
- isn't perfect yet). Also, this would include many more
definitions then needed. A third
- option that I'm considering is creating a new header, until the
WDK is out, which will be
- called ifstypes. It would be the brother of umtypes, but for
kernel mode. Only a small
- number of types will need to be included, and hence they will be
easy to locate in case
- the official ones change (by the time they do, the WDK will be
out however, so no worries).
- It would reduce all the ifdeffing to a single file.
-
- UPDATE2:
- No. This is a bad idea. I've just added a note to purge out
large parts of umtypes.h into the
- actual xxtypes.h files, and then use iffdefing. This is a direct
contradiction to my idea of
- generalizing all the IFS stuff together.
-
- UPDATE3:
- No. This is different...the user-mode types will always be
unavailable in kernel-mode, and
- dissipating them into the real files is a good thing, because
they will never move out and
- they are much easier to maintain. However, once the WDK comes
out, all #ifdef ntifs will
- become obsolete, and they will have to be hunted down and
removed. Having a single file that
- is automatically added if the IFS is not detected is much easier
to remove once the time
- comes.
_____
Modified: trunk/reactos/include/ndk/i386/mmtypes.h
--- trunk/reactos/include/ndk/i386/mmtypes.h 2005-08-17 06:14:55 UTC
(rev 17419)
+++ trunk/reactos/include/ndk/i386/mmtypes.h 2005-08-17 07:06:59 UTC
(rev 17420)
@@ -9,4 +9,17 @@
#ifndef _I386_MMTYPES_H
#define _I386_MMTYPES_H
+/* DEPENDENCIES
**************************************************************/
+
+/* EXPORTED DATA
*************************************************************/
+
+/* CONSTANTS
*****************************************************************/
+
+#define PAGE_SIZE 0x1000
+#define PAGE_SHIFT 12L
+
+/* ENUMERATIONS
**************************************************************/
+
+/* TYPES
*********************************************************************/
+
#endif
_____
Added: trunk/reactos/include/ndk/ifssupp.h
--- trunk/reactos/include/ndk/ifssupp.h 2005-08-17 06:14:55 UTC (rev
17419)
+++ trunk/reactos/include/ndk/ifssupp.h 2005-08-17 07:06:59 UTC (rev
17420)
@@ -0,0 +1,116 @@
+/*
+ * PROJECT: ReactOS Native Headers
+ * FILE: include/ndk/ifssupp.h
+ * PURPOSE: Defintions present in IFS, required for NDK usage.
+ * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
+ * UPDATE HISTORY:
+ * Created 08/16/05
+ */
+#ifndef _NTIFS_
+#define _NTIFS_
+
+/* DEPENDENCIES
**************************************************************/
+
+/* EXPORTED DATA
*************************************************************/
+
+/* CONSTANTS
*****************************************************************/
+
+/* TYPES
*********************************************************************/
+
+typedef PVOID PRTL_HEAP_PARAMETERS;
+
+#if defined(USE_LPC6432)
+#define LPC_CLIENT_ID CLIENT_ID64
+#define LPC_SIZE_T ULONGLONG
+#define LPC_PVOID ULONGLONG
+#define LPC_HANDLE ULONGLONG
+#else
+#define LPC_CLIENT_ID CLIENT_ID
+#define LPC_SIZE_T SIZE_T
+#define LPC_PVOID PVOID
+#define LPC_HANDLE HANDLE
+#endif
+
+typedef struct _PORT_MESSAGE
+{
+ union
+ {
+ struct
+ {
+ CSHORT DataLength;
+ CSHORT TotalLength;
+ } s1;
+ ULONG Length;
+ } u1;
+ union
+ {
+ struct
+ {
+ CSHORT Type;
+ CSHORT DataInfoOffset;
+ } s2;
+ ULONG ZeroInit;
+ } u2;
+ union
+ {
+ LPC_CLIENT_ID ClientId;
+ double DoNotUseThisField;
+ };
+ ULONG MessageId;
+ union
+ {
+ LPC_SIZE_T ClientViewSize;
+ ULONG CallbackId;
+ };
+} PORT_MESSAGE, *PPORT_MESSAGE;
+
+typedef struct _PORT_VIEW
+{
+ ULONG Length;
+ LPC_HANDLE SectionHandle;
+ ULONG SectionOffset;
+ LPC_SIZE_T ViewSize;
+ LPC_PVOID ViewBase;
+ LPC_PVOID ViewRemoteBase;
+} PORT_VIEW, *PPORT_VIEW;
+
+typedef struct _REMOTE_PORT_VIEW
+{
+ ULONG Length;
+ LPC_SIZE_T ViewSize;
+ LPC_PVOID ViewBase;
+} REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
+
+typedef struct _KAPC_STATE
+{
+ LIST_ENTRY ApcListHead[2];
+ PKPROCESS Process;
+ BOOLEAN KernelApcInProgress;
+ BOOLEAN KernelApcPending;
+ BOOLEAN UserApcPending;
+} KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE;
+
+typedef struct _KQUEUE
+{
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY EntryListHead;
+ ULONG CurrentCount;
+ ULONG MaximumCount;
+ LIST_ENTRY ThreadListHead;
+} KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;
+
+typedef PVOID EX_RUNDOWN_REF;
+typedef PVOID EX_PUSH_LOCK;
+
+typedef struct _SECURITY_CLIENT_CONTEXT
+{
+ SECURITY_QUALITY_OF_SERVICE SecurityQos;
+ PACCESS_TOKEN ClientToken;
+ BOOLEAN DirectlyAccessClientToken;
+ BOOLEAN DirectAccessEffectiveOnly;
+ BOOLEAN ServerIsRemote;
+ TOKEN_CONTROL ClientTokenControl;
+} SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT;
+
+#endif
+
_____
Modified: trunk/reactos/include/ndk/iotypes.h
--- trunk/reactos/include/ndk/iotypes.h 2005-08-17 06:14:55 UTC (rev
17419)
+++ trunk/reactos/include/ndk/iotypes.h 2005-08-17 07:06:59 UTC (rev
17420)
@@ -11,17 +11,82 @@
#define _IOTYPES_H
/* DEPENDENCIES
**************************************************************/
-#include "potypes.h"
/* EXPORTED DATA
*************************************************************/
+#ifndef NTOS_MODE_USER
extern POBJECT_TYPE NTOSAPI IoAdapterObjectType;
extern POBJECT_TYPE NTOSAPI IoDeviceHandlerObjectType;
extern POBJECT_TYPE NTOSAPI IoDeviceObjectType;
extern POBJECT_TYPE NTOSAPI IoDriverObjectType;
extern POBJECT_TYPE NTOSAPI IoFileObjectType;
+#endif
/* CONSTANTS
*****************************************************************/
+#ifdef NTOS_MODE_USER
+/* Object Access Rights */
+#define SYMBOLIC_LINK_QUERY 0x0001
+#define SYMBOLIC_LINK_ALL_ACCESS STANDARD_RIGHTS_REQUIRED |
0x0001
+#endif
+
+/* File Result Flags */
+#define FILE_SUPERSEDED 0x00000000
+#define FILE_OPENED 0x00000001
+#define FILE_CREATED 0x00000002
+#define FILE_OVERWRITTEN 0x00000003
+#define FILE_EXISTS 0x00000004
+#define FILE_DOES_NOT_EXIST 0x00000005
+
+/* Pipe Flags */
+#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
+#define FILE_PIPE_MESSAGE_MODE 0x00000001
+#define FILE_PIPE_QUEUE_OPERATION 0x00000000
+#define FILE_PIPE_COMPLETE_OPERATION 0x00000001
+#define FILE_PIPE_INBOUND 0x00000000
+#define FILE_PIPE_OUTBOUND 0x00000001
+#define FILE_PIPE_FULL_DUPLEX 0x00000002
+#define FILE_PIPE_CLIENT_END 0x00000000
+#define FILE_PIPE_SERVER_END 0x00000001
+
+/* File Attributes */
+#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
+#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
+
+/* File Flags */
+#define FILE_SUPERSEDE 0x00000000
+#define FILE_OPEN 0x00000001
+#define FILE_CREATE 0x00000002
+#define FILE_OPEN_IF 0x00000003
+#define FILE_OVERWRITE 0x00000004
+#define FILE_OVERWRITE_IF 0x00000005
+#define FILE_MAXIMUM_DISPOSITION 0x00000005
+
+/* File Types */
+#define FILE_DIRECTORY_FILE 0x00000001
+#define FILE_WRITE_THROUGH 0x00000002
+#define FILE_SEQUENTIAL_ONLY 0x00000004
+#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
+#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
+#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
+#define FILE_NON_DIRECTORY_FILE 0x00000040
+#define FILE_CREATE_TREE_CONNECTION 0x00000080
+#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
+#define FILE_NO_EA_KNOWLEDGE 0x00000200
+#define FILE_OPEN_FOR_RECOVERY 0x00000400
+#define FILE_RANDOM_ACCESS 0x00000800
+#define FILE_DELETE_ON_CLOSE 0x00001000
+#define FILE_OPEN_BY_FILE_ID 0x00002000
+#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
+#define FILE_NO_COMPRESSION 0x00008000
+#define FILE_RESERVE_OPFILTER 0x00100000
+#define FILE_OPEN_REPARSE_POINT 0x00200000
+#define FILE_OPEN_NO_RECALL 0x00400000
+#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
+
+/* Device Charactertics */
+#define FILE_REMOVABLE_MEDIA 0x00000001
+#define FILE_REMOTE_DEVICE 0x00000010
+
/* Device Object Extension Flags */
#define DOE_UNLOAD_PENDING 0x1
#define DOE_DELETE_PENDING 0x2
@@ -67,6 +132,90 @@
#define DNUF_NOT_DISABLEABLE 0x0008
/* ENUMERATIONS
**************************************************************/
+
+#ifdef NTOS_MODE_USER
+typedef enum _INTERFACE_TYPE
+{
+ InterfaceTypeUndefined = -1,
+ Internal,
+ Isa,
+ Eisa,
+ MicroChannel,
+ TurboChannel,
+ PCIBus,
+ VMEBus,
+ NuBus,
+ PCMCIABus,
+ CBus,
+ MPIBus,
+ MPSABus,
+ ProcessorInternal,
+ InternalPowerBus,
+ PNPISABus,
+ PNPBus,
+ MaximumInterfaceType
+}INTERFACE_TYPE, *PINTERFACE_TYPE;
+
+typedef enum _FILE_INFORMATION_CLASS
+{
+ FileDirectoryInformation = 1,
+ FileFullDirectoryInformation,
+ FileBothDirectoryInformation,
+ FileBasicInformation,
+ FileStandardInformation,
+ FileInternalInformation,
+ FileEaInformation,
+ FileAccessInformation,
+ FileNameInformation,
+ FileRenameInformation,
+ FileLinkInformation,
+ FileNamesInformation,
+ FileDispositionInformation,
+ FilePositionInformation,
+ FileFullEaInformation,
+ FileModeInformation,
+ FileAlignmentInformation,
+ FileAllInformation,
+ FileAllocationInformation,
+ FileEndOfFileInformation,
+ FileAlternateNameInformation,
+ FileStreamInformation,
+ FilePipeInformation,
+ FilePipeLocalInformation,
+ FilePipeRemoteInformation,
+ FileMailslotQueryInformation,
+ FileMailslotSetInformation,
+ FileCompressionInformation,
+ FileObjectIdInformation,
+ FileCompletionInformation,
+ FileMoveClusterInformation,
+ FileQuotaInformation,
+ FileReparsePointInformation,
+ FileNetworkOpenInformation,
+ FileAttributeTagInformation,
+ FileTrackingInformation,
+ FileIdBothDirectoryInformation,
+ FileIdFullDirectoryInformation,
+ FileValidDataLengthInformation,
+ FileShortNameInformation,
+ FileMaximumInformation
+} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
+
+typedef enum _FSINFOCLASS
+{
+ FileFsVolumeInformation = 1,
+ FileFsLabelInformation,
+ FileFsSizeInformation,
+ FileFsDeviceInformation,
+ FileFsAttributeInformation,
+ FileFsControlInformation,
+ FileFsFullSizeInformation,
+ FileFsObjectIdInformation,
+ FileFsDriverPathInformation,
+ FileFsMaximumInformation
+} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
+#endif
+
typedef enum _PNP_DEVNODE_STATE
{
DeviceNodeUnspecified = 0x300,
@@ -95,6 +244,279 @@
/* TYPES
*********************************************************************/
+#ifdef NTOS_MODE_USER
+typedef struct _FILE_BASIC_INFORMATION
+{
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ ULONG FileAttributes;
+} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
+
+typedef struct _FILE_STANDARD_INFORMATION
+{
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER EndOfFile;
+ ULONG NumberOfLinks;
+ BOOLEAN DeletePending;
+ BOOLEAN Directory;
+} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
+
+typedef struct _FILE_NETWORK_OPEN_INFORMATION
+{
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER EndOfFile;
+ ULONG FileAttributes;
+} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
+
+typedef struct _FILE_EA_INFORMATION
+{
+ ULONG EaSize;
+} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
+
+typedef struct _FILE_COMPRESSION_INFORMATION
+{
+ LARGE_INTEGER CompressedFileSize;
+ USHORT CompressionFormat;
+ UCHAR CompressionUnitShift;
+ UCHAR ChunkShift;
+ UCHAR ClusterShift;
+ UCHAR Reserved[3];
+} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
+
+typedef struct _FILE_POSITION_INFORMATION
+{
+ LARGE_INTEGER CurrentByteOffset;
+} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
+
+typedef struct _FILE_DISPOSITION_INFORMATION
+{
+ BOOLEAN DeleteFile;
+} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
+
+typedef struct _FILE_FULL_EA_INFORMATION
+{
+ ULONG NextEntryOffset;
+ UCHAR Flags;
+ UCHAR EaNameLength;
+ USHORT EaValueLength;
+ CHAR EaName[1];
+} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
+
+typedef struct _FILE_QUOTA_INFORMATION
+{
+ ULONG NextEntryOffset;
+ ULONG SidLength;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER QuotaUsed;
+ LARGE_INTEGER QuotaThreshold;
+ LARGE_INTEGER QuotaLimit;
+ SID Sid;
+} FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
+
+typedef struct _FILE_INTERNAL_INFORMATION
+{
+ LARGE_INTEGER IndexNumber;
+} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
+
+typedef struct _FILE_RENAME_INFORMATION
+{
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
+
+typedef struct _FILE_PIPE_INFORMATION
+{
+ ULONG ReadMode;
+ ULONG CompletionMode;
+} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
+
+typedef struct _FILE_PIPE_LOCAL_INFORMATION
+{
+ ULONG NamedPipeType;
+ ULONG NamedPipeConfiguration;
+ ULONG MaximumInstances;
+ ULONG CurrentInstances;
+ ULONG InboundQuota;
+ ULONG ReadDataAvailable;
+ ULONG OutboundQuota;
+ ULONG WriteQuotaAvailable;
+ ULONG NamedPipeState;
+ ULONG NamedPipeEnd;
+} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
+
+typedef struct _FILE_PIPE_REMOTE_INFORMATION
+{
+ LARGE_INTEGER CollectDataTime;
+ ULONG MaximumCollectionCount;
+} FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
+
+typedef struct _FILE_MAILSLOT_QUERY_INFORMATION
+{
+ ULONG MaximumMessageSize;
+ ULONG MailslotQuota;
+ ULONG NextMessageSize;
+ ULONG MessagesAvailable;
+ LARGE_INTEGER ReadTimeout;
+} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
+
+typedef struct _FILE_MAILSLOT_SET_INFORMATION
+{
+ LARGE_INTEGER ReadTimeout;
+} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
+
+typedef struct _FILE_BOTH_DIR_INFORMATION
+{
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ CCHAR ShortNameLength;
+ WCHAR ShortName[12];
+ WCHAR FileName[1];
+} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
+
+typedef struct _FILE_COMPLETION_INFORMATION
+{
+ HANDLE Port;
+ PVOID Key;
+} FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
+
+typedef struct _FILE_LINK_INFORMATION
+{
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
+
+typedef struct _FILE_NAME_INFORMATION
+{
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
+
+typedef struct _FILE_ALLOCATION_INFORMATION
+{
+ LARGE_INTEGER AllocationSize;
+} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
+
+typedef struct _FILE_END_OF_FILE_INFORMATION
+{
+ LARGE_INTEGER EndOfFile;
+} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
+
+typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION
+{
+ LARGE_INTEGER ValidDataLength;
+} FILE_VALID_DATA_LENGTH_INFORMATION,
*PFILE_VALID_DATA_LENGTH_INFORMATION;
+
+typedef struct _FILE_FS_DEVICE_INFORMATION
+{
+ DEVICE_TYPE DeviceType;
+ ULONG Characteristics;
+} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
+
+typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
+{
+ ULONG FileSystemAttributes;
+ ULONG MaximumComponentNameLength;
+ ULONG FileSystemNameLength;
+ WCHAR FileSystemName[1];
+} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
+
+typedef struct _FILE_FS_SIZE_INFORMATION
+{
+ LARGE_INTEGER TotalAllocationUnits;
+ LARGE_INTEGER AvailableAllocationUnits;
+ ULONG SectorsPerAllocationUnit;
+ ULONG BytesPerSector;
+} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
+
+typedef struct _FILE_FS_LABEL_INFORMATION
+{
+ ULONG VolumeLabelLength;
+ WCHAR VolumeLabel[1];
+} FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION;
+
+typedef struct _FILE_FS_VOLUME_INFORMATION
+{
+ LARGE_INTEGER VolumeCreationTime;
+ ULONG VolumeSerialNumber;
+ ULONG VolumeLabelLength;
+ BOOLEAN SupportsObjects;
+ WCHAR VolumeLabel[1];
+} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
+
+typedef struct _FILE_PIPE_WAIT_FOR_BUFFER
+{
+ LARGE_INTEGER Timeout;
+ ULONG NameLength;
+ BOOLEAN TimeoutSpecified;
+ WCHAR Name[1];
+} FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER;
+
+typedef struct _FILE_PIPE_PEEK_BUFFER
+{
+ ULONG NamedPipeState;
+ ULONG ReadDataAvailable;
+ ULONG NumberOfMessages;
+ ULONG MessageLength;
+ CHAR Data[1];
+} FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER;
+
+typedef struct _IO_STATUS_BLOCK
+{
+ union
+ {
+ NTSTATUS Status;
+ PVOID Pointer;
+ };
+ ULONG_PTR Information;
+} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
+
+typedef struct _IO_ERROR_LOG_PACKET
+{
+ UCHAR MajorFunctionCode;
+ UCHAR RetryCount;
+ USHORT DumpDataSize;
+ USHORT NumberOfStrings;
+ USHORT StringOffset;
+ USHORT EventCategory;
+ NTSTATUS ErrorCode;
+ ULONG UniqueErrorValue;
+ NTSTATUS FinalStatus;
+ ULONG SequenceNumber;
+ ULONG IoControlCode;
+ LARGE_INTEGER DeviceOffset;
+ ULONG DumpData[1];
+}IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
+
+typedef struct _IO_ERROR_LOG_MESSAGE
+{
+ USHORT Type;
+ USHORT Size;
+ USHORT DriverNameLength;
+ LARGE_INTEGER TimeStamp;
+ ULONG DriverNameOffset;
+ IO_ERROR_LOG_PACKET EntryData;
+} IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
+#endif
+
typedef struct _MAILSLOT_CREATE_PARAMETERS
{
ULONG MailslotQuota;
@@ -115,6 +537,7 @@
BOOLEAN TimeoutSpecified;
} NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS;
+#ifndef NTOS_MODE_USER
typedef struct _IO_TIMER
{
USHORT Type;
@@ -127,52 +550,33 @@
typedef struct _DEVICE_NODE
{
- /* A tree structure. */
struct _DEVICE_NODE *Parent;
struct _DEVICE_NODE *PrevSibling;
struct _DEVICE_NODE *NextSibling;
struct _DEVICE_NODE *Child;
- /* The level of deepness in the tree. */
UINT Level;
- PPO_DEVICE_NOTIFY Notify;
- /* State machine. */
+ struct _PO_DEVICE_NOTIFY *Notify;
PNP_DEVNODE_STATE State;
PNP_DEVNODE_STATE PreviousState;
PNP_DEVNODE_STATE StateHistory[20];
UINT StateHistoryEntry;
- /* ? */
INT CompletionStatus;
- /* ? */
PIRP PendingIrp;
- /* See DNF_* flags below (WinDBG documentation has WRONG values) */
ULONG Flags;
- /* See DNUF_* flags below (and IRP_MN_QUERY_PNP_DEVICE_STATE) */
ULONG UserFlags;
- /* See CM_PROB_* values are defined in cfg.h */
ULONG Problem;
- /* Pointer to the PDO corresponding to the device node. */
PDEVICE_OBJECT PhysicalDeviceObject;
- /* Resource list as assigned by the PnP arbiter. See
IRP_MN_START_DEVICE
- and ARBITER_INTERFACE (not documented in DDK, but present in
headers). */
PCM_RESOURCE_LIST ResourceList;
- /* Resource list as assigned by the PnP arbiter (translated
version). */
PCM_RESOURCE_LIST ResourceListTranslated;
- /* Instance path relative to the Enum key in registry. */
UNICODE_STRING InstancePath;
- /* Name of the driver service. */
UNICODE_STRING ServiceName;
- /* ? */
PDEVICE_OBJECT DuplicatePDO;
- /* See IRP_MN_QUERY_RESOURCE_REQUIREMENTS. */
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements;
- /* Information about bus for bus drivers. */
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
- /* Information about underlying bus for child devices. */
INTERFACE_TYPE ChildInterfaceType;
ULONG ChildBusNumber;
USHORT ChildBusTypeIndex;
- /* ? */
UCHAR RemovalPolicy;
UCHAR HardwareRemovalPolicy;
LIST_ENTRY TargetDeviceNotify;
@@ -191,9 +595,7 @@
{
struct _DEVICE_NODE *NextResourceDeviceNode;
} OverUsed2;
- /* See IRP_MN_QUERY_RESOURCES/IRP_MN_FILTER_RESOURCES. */
PCM_RESOURCE_LIST BootResources;
- /* See the bitfields in DEVICE_CAPABILITIES structure. */
ULONG CapabilityFlags;
struct
{
@@ -245,6 +647,77 @@
PVOID ClientIdentificationAddress;
CHAR Extension[1];
} PRIVATE_DRIVER_EXTENSIONS, *PPRIVATE_DRIVER_EXTENSIONS;
+#endif
+/* FUNCTION TYPES
************************************************************/
+
+typedef VOID
+(NTAPI *PIO_APC_ROUTINE)(
+ IN PVOID ApcContext,
+ IN PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG Reserved);
+
+/* I/O CONTROL CODES
*********************************************************/
+
+#ifdef NTOS_MODE_USER
+/* Mailslots */
+#define FSCTL_MAILSLOT_PEEK \
+ CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA)
+
+/* Pipes */
+#define FSCTL_PIPE_ASSIGN_EVENT \
+ CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED,
FILE_ANY_ACCESS)
[truncated at 1000 lines; 2891 more skipped]