2015-06-06 12:52:13 +00:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
|
|
|
|
// All rights reserved
|
2015-06-08 14:24:47 +00:00
|
|
|
// This file was released under the GPLv2 on June 2015.
|
2015-06-06 12:52:13 +00:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __NTDDK_EX__H__
|
|
|
|
#define __NTDDK_EX__H__
|
|
|
|
|
|
|
|
typedef enum _SYSTEM_INFORMATION_CLASS {
|
|
|
|
SystemBasicInformation,
|
|
|
|
SystemProcessorInformation,
|
|
|
|
SystemPerformanceInformation,
|
|
|
|
SystemTimeOfDayInformation,
|
|
|
|
SystemPathInformation,
|
|
|
|
SystemProcessInformation,
|
|
|
|
SystemCallCountInformation,
|
|
|
|
SystemDeviceInformation,
|
|
|
|
SystemProcessorPerformanceInformation,
|
|
|
|
SystemFlagsInformation,
|
|
|
|
SystemCallTimeInformation,
|
|
|
|
SystemModuleInformation,
|
|
|
|
SystemLocksInformation,
|
|
|
|
SystemStackTraceInformation,
|
|
|
|
SystemPagedPoolInformation,
|
|
|
|
SystemNonPagedPoolInformation,
|
|
|
|
SystemHandleInformation,
|
|
|
|
SystemObjectInformation,
|
|
|
|
SystemPageFileInformation,
|
|
|
|
SystemVdmInstemulInformation,
|
|
|
|
SystemVdmBopInformation,
|
|
|
|
SystemFileCacheInformation,
|
|
|
|
SystemPoolTagInformation,
|
|
|
|
SystemInterruptInformation,
|
|
|
|
SystemDpcBehaviorInformation,
|
|
|
|
SystemFullMemoryInformation,
|
|
|
|
SystemLoadGdiDriverInformation,
|
|
|
|
SystemUnloadGdiDriverInformation,
|
|
|
|
SystemTimeAdjustmentInformation,
|
|
|
|
SystemSummaryMemoryInformation,
|
|
|
|
SystemNextEventIdInformation,
|
|
|
|
SystemEventIdsInformation,
|
|
|
|
SystemCrashDumpInformation,
|
|
|
|
SystemExceptionInformation,
|
|
|
|
SystemCrashDumpStateInformation,
|
|
|
|
SystemKernelDebuggerInformation,
|
|
|
|
SystemContextSwitchInformation,
|
|
|
|
SystemRegistryQuotaInformation,
|
|
|
|
SystemExtendServiceTableInformation,
|
|
|
|
SystemPrioritySeperation,
|
|
|
|
SystemPlugPlayBusInformation,
|
|
|
|
SystemDockInformation,
|
|
|
|
#if !defined PO_CB_SYSTEM_POWER_POLICY
|
|
|
|
SystemPowerInformation,
|
|
|
|
#else
|
|
|
|
_SystemPowerInformation,
|
|
|
|
#endif
|
|
|
|
SystemProcessorSpeedInformation,
|
|
|
|
SystemCurrentTimeZoneInformation,
|
|
|
|
SystemLookasideInformation
|
|
|
|
} SYSTEM_INFORMATION_CLASS;
|
|
|
|
|
|
|
|
|
|
|
|
NTSYSAPI
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ZwQuerySystemInformation(
|
|
|
|
IN SYSTEM_INFORMATION_CLASS SystemInfoClass,
|
|
|
|
OUT PVOID SystemInfoBuffer,
|
|
|
|
IN ULONG SystemInfoBufferSize,
|
|
|
|
OUT PULONG BytesReturned OPTIONAL
|
|
|
|
);
|
|
|
|
|
|
|
|
typedef struct _SYSTEM_MODULE_ENTRY
|
|
|
|
{
|
|
|
|
ULONG Unused;
|
|
|
|
ULONG Always0;
|
|
|
|
PVOID ModuleBaseAddress;
|
|
|
|
ULONG ModuleSize;
|
|
|
|
ULONG Unknown;
|
|
|
|
ULONG ModuleEntryIndex;
|
|
|
|
USHORT ModuleNameLength;
|
|
|
|
USHORT ModuleNameOffset;
|
|
|
|
CHAR ModuleName [256];
|
|
|
|
} SYSTEM_MODULE_ENTRY, * PSYSTEM_MODULE_ENTRY;
|
|
|
|
|
|
|
|
typedef struct _SYSTEM_MODULE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG Count;
|
|
|
|
SYSTEM_MODULE_ENTRY Module [1];
|
|
|
|
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
|
|
|
|
|
|
|
|
typedef unsigned short WORD;
|
|
|
|
typedef unsigned int BOOL;
|
|
|
|
typedef unsigned long DWORD;
|
|
|
|
typedef unsigned char BYTE;
|
|
|
|
|
2015-06-15 11:59:49 +00:00
|
|
|
#ifndef __REACTOS__
|
2015-06-06 12:52:13 +00:00
|
|
|
typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
|
|
|
|
WORD e_magic; // Magic number
|
|
|
|
WORD e_cblp; // Bytes on last page of file
|
|
|
|
WORD e_cp; // Pages in file
|
|
|
|
WORD e_crlc; // Relocations
|
|
|
|
WORD e_cparhdr; // Size of header in paragraphs
|
|
|
|
WORD e_minalloc; // Minimum extra paragraphs needed
|
|
|
|
WORD e_maxalloc; // Maximum extra paragraphs needed
|
|
|
|
WORD e_ss; // Initial (relative) SS value
|
|
|
|
WORD e_sp; // Initial SP value
|
|
|
|
WORD e_csum; // Checksum
|
|
|
|
WORD e_ip; // Initial IP value
|
|
|
|
WORD e_cs; // Initial (relative) CS value
|
|
|
|
WORD e_lfarlc; // File address of relocation table
|
|
|
|
WORD e_ovno; // Overlay number
|
|
|
|
WORD e_res[4]; // Reserved words
|
|
|
|
WORD e_oemid; // OEM identifier (for e_oeminfo)
|
|
|
|
WORD e_oeminfo; // OEM information; e_oemid specific
|
|
|
|
WORD e_res2[10]; // Reserved words
|
|
|
|
LONG e_lfanew; // File address of new exe header
|
|
|
|
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
|
|
|
|
|
|
|
|
typedef struct _IMAGE_FILE_HEADER {
|
|
|
|
WORD Machine;
|
|
|
|
WORD NumberOfSections;
|
|
|
|
DWORD TimeDateStamp;
|
|
|
|
DWORD PointerToSymbolTable;
|
|
|
|
DWORD NumberOfSymbols;
|
|
|
|
WORD SizeOfOptionalHeader;
|
|
|
|
WORD Characteristics;
|
|
|
|
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
|
|
|
|
|
|
|
|
typedef struct _IMAGE_DATA_DIRECTORY {
|
|
|
|
DWORD VirtualAddress;
|
|
|
|
DWORD Size;
|
|
|
|
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
|
|
|
|
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _IMAGE_OPTIONAL_HEADER {
|
|
|
|
//
|
|
|
|
// Standard fields.
|
|
|
|
//
|
|
|
|
|
|
|
|
WORD Magic;
|
|
|
|
BYTE MajorLinkerVersion;
|
|
|
|
BYTE MinorLinkerVersion;
|
|
|
|
DWORD SizeOfCode;
|
|
|
|
DWORD SizeOfInitializedData;
|
|
|
|
DWORD SizeOfUninitializedData;
|
|
|
|
DWORD AddressOfEntryPoint;
|
|
|
|
DWORD BaseOfCode;
|
|
|
|
DWORD BaseOfData;
|
|
|
|
|
|
|
|
//
|
|
|
|
// NT additional fields.
|
|
|
|
//
|
|
|
|
|
|
|
|
DWORD ImageBase;
|
|
|
|
DWORD SectionAlignment;
|
|
|
|
DWORD FileAlignment;
|
|
|
|
WORD MajorOperatingSystemVersion;
|
|
|
|
WORD MinorOperatingSystemVersion;
|
|
|
|
WORD MajorImageVersion;
|
|
|
|
WORD MinorImageVersion;
|
|
|
|
WORD MajorSubsystemVersion;
|
|
|
|
WORD MinorSubsystemVersion;
|
|
|
|
DWORD Win32VersionValue;
|
|
|
|
DWORD SizeOfImage;
|
|
|
|
DWORD SizeOfHeaders;
|
|
|
|
DWORD CheckSum;
|
|
|
|
WORD Subsystem;
|
|
|
|
WORD DllCharacteristics;
|
|
|
|
DWORD SizeOfStackReserve;
|
|
|
|
DWORD SizeOfStackCommit;
|
|
|
|
DWORD SizeOfHeapReserve;
|
|
|
|
DWORD SizeOfHeapCommit;
|
|
|
|
DWORD LoaderFlags;
|
|
|
|
DWORD NumberOfRvaAndSizes;
|
|
|
|
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
|
|
|
} IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
|
|
|
|
|
|
|
|
typedef struct _IMAGE_NT_HEADERS {
|
|
|
|
DWORD Signature;
|
|
|
|
IMAGE_FILE_HEADER FileHeader;
|
|
|
|
IMAGE_OPTIONAL_HEADER32 OptionalHeader;
|
|
|
|
} IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
|
|
|
|
typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
|
|
|
|
typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
|
|
|
|
|
|
|
|
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory
|
|
|
|
|
|
|
|
typedef struct _IMAGE_EXPORT_DIRECTORY {
|
|
|
|
DWORD Characteristics;
|
|
|
|
DWORD TimeDateStamp;
|
|
|
|
WORD MajorVersion;
|
|
|
|
WORD MinorVersion;
|
|
|
|
DWORD Name;
|
|
|
|
DWORD Base;
|
|
|
|
DWORD NumberOfFunctions;
|
|
|
|
DWORD NumberOfNames;
|
|
|
|
DWORD AddressOfFunctions; // RVA from base of image
|
|
|
|
DWORD AddressOfNames; // RVA from base of image
|
|
|
|
DWORD AddressOfNameOrdinals; // RVA from base of image
|
|
|
|
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
|
2015-06-15 11:59:49 +00:00
|
|
|
#endif
|
2015-06-06 12:52:13 +00:00
|
|
|
|
|
|
|
#define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE, 0x0012, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE, 0x0014, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_DISK_BASE, 0x0028, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
|
|
|
|
#define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
#define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
|
|
|
|
#endif //__NTDDK_EX__H__
|