Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

miniddk.h

Go to the documentation of this file.
00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
00002 /*
00003  * Copyright (C) 2005 Dell Inc.
00004  *  by Michael Brown <Michael_E_Brown@dell.com>
00005  * Licensed under the Open Software License version 2.1
00006  *
00007  * Alternatively, you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published
00009  * by the Free Software Foundation; either version 2 of the License,
00010  * or (at your option) any later version.
00011 
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00015  * See the GNU General Public License for more details.
00016  */
00017 
00018 
00019 #ifndef MINIDDK_H
00020 #define MINIDDK_H
00021 
00022 #include <windows.h>
00023 #include <stdio.h>
00024 
00025 
00026 //From #include "ntdef.h"
00027 typedef LONG NTSTATUS;
00028 
00029 //
00030 // Generic test for success on any status value (non-negative numbers
00031 // indicate success).
00032 //
00033 
00034 #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
00035 //
00036 // Unicode strings are counted 16-bit character strings. If they are
00037 // NULL terminated, Length does not include trailing NULL.
00038 //
00039 
00040 typedef struct _UNICODE_STRING
00041 {
00042     USHORT Length;
00043     USHORT MaximumLength;
00044 #ifdef MIDL_PASS
00045 
00046     [size_is(MaximumLength / 2), length_is((Length) / 2) ] USHORT * Buffer;
00047 #else // MIDL_PASS
00048 
00049     PWSTR  Buffer;
00050 #endif // MIDL_PASS
00051 }
00052 UNICODE_STRING;
00053 typedef UNICODE_STRING *PUNICODE_STRING;
00054 typedef const UNICODE_STRING *PCUNICODE_STRING;
00055 #define UNICODE_NULL ((WCHAR)0) // winnt
00056 
00057 //
00058 // Valid values for the Attributes field
00059 //
00060 
00061 #define OBJ_INHERIT             0x00000002L
00062 #define OBJ_PERMANENT           0x00000010L
00063 #define OBJ_EXCLUSIVE           0x00000020L
00064 #define OBJ_CASE_INSENSITIVE    0x00000040L
00065 #define OBJ_OPENIF              0x00000080L
00066 #define OBJ_OPENLINK            0x00000100L
00067 #define OBJ_KERNEL_HANDLE       0x00000200L
00068 #define OBJ_VALID_ATTRIBUTES    0x000003F2L
00069 
00070 //
00071 // Object Attributes structure
00072 //
00073 
00074 typedef struct _OBJECT_ATTRIBUTES
00075 {
00076     ULONG Length;
00077     HANDLE RootDirectory;
00078     PUNICODE_STRING ObjectName;
00079     ULONG Attributes;
00080     PVOID SecurityDescriptor;        // Points to type SECURITY_DESCRIPTOR
00081     PVOID SecurityQualityOfService;  // Points to type SECURITY_QUALITY_OF_SERVICE
00082 }
00083 OBJECT_ATTRIBUTES;
00084 typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
00085 
00086 //++
00087 //
00088 // VOID
00089 // InitializeObjectAttributes(
00090 //     OUT POBJECT_ATTRIBUTES p,
00091 //     IN PUNICODE_STRING n,
00092 //     IN ULONG a,
00093 //     IN HANDLE r,
00094 //     IN PSECURITY_DESCRIPTOR s
00095 //     )
00096 //
00097 //--
00098 
00099 #define InitializeObjectAttributes( p, n, a, r, s ) { \
00100     (p)->Length = sizeof( OBJECT_ATTRIBUTES );          \
00101     (p)->RootDirectory = r;                             \
00102     (p)->Attributes = a;                                \
00103     (p)->ObjectName = n;                                \
00104     (p)->SecurityDescriptor = s;                        \
00105     (p)->SecurityQualityOfService = NULL;               \
00106     }
00107 
00108 //
00109 // Physical address.
00110 //
00111 
00112 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
00113 
00114 //
00115 // From winnt.h
00116 //
00117 //
00118 // Section Information Structures.
00119 //
00120 
00121 typedef enum _SECTION_INHERIT {
00122     ViewShare = 1,
00123     ViewUnmap = 2
00124 } SECTION_INHERIT;
00125 
00126 //
00127 // Section Access Rights.
00128 //
00129 
00130 // begin_winnt
00131 #define SECTION_QUERY       0x0001
00132 #define SECTION_MAP_WRITE   0x0002
00133 #define SECTION_MAP_READ    0x0004
00134 #define SECTION_MAP_EXECUTE 0x0008
00135 #define SECTION_EXTEND_SIZE 0x0010
00136 
00137 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\
00138                             SECTION_MAP_WRITE |      \
00139                             SECTION_MAP_READ |       \
00140                             SECTION_MAP_EXECUTE |    \
00141                             SECTION_EXTEND_SIZE)
00142 
00143 // From ntddk.h
00144 #define NtCurrentProcess() ( (HANDLE) -1 )
00145 
00146 // NtDll Func decls same as ZwOpenSection
00147 typedef NTSTATUS (__stdcall *NtOpenSectionPtr) (
00148     OUT PHANDLE             SectionHandle,
00149     IN ACCESS_MASK          DesiredAccess,
00150     IN POBJECT_ATTRIBUTES   ObjectAttributes );
00151 
00152 // Same as ZwClose
00153 typedef NTSTATUS (__stdcall *NtClosePtr) (
00154     IN HANDLE  Handle );
00155 
00156 // Same as ZwMapViewOfSection
00157 typedef NTSTATUS (__stdcall *NtMapViewOfSectionPtr) (
00158     IN HANDLE               SectionHandle,
00159     IN HANDLE               ProcessHandle,
00160     IN OUT PVOID            *BaseAddress OPTIONAL,
00161     IN ULONG                ZeroBits OPTIONAL,
00162     IN ULONG                CommitSize,
00163     IN OUT PLARGE_INTEGER   SectionOffset OPTIONAL,
00164     IN OUT PULONG           ViewSize,
00165     IN SECTION_INHERIT      InheritDisposition,
00166     IN ULONG                AllocationType OPTIONAL,
00167     IN ULONG                Protect );
00168 
00169 // Same as ZwUnmapViewOfSection
00170 typedef NTSTATUS (__stdcall *NtUnmapViewOfSectionPtr) (
00171     IN HANDLE               ProcessHandle,
00172     IN PVOID                BaseAddress );
00173 
00174 typedef VOID (__stdcall *RtlInitUnicodeStringPtr) (
00175     IN OUT PUNICODE_STRING  DestinationString,
00176     IN PCWSTR  SourceString );
00177 
00178 
00179 // For Debug Control
00180 typedef enum _DEBUG_CONTROL_CODE {
00181     DebugGetTraceInformation = 1,
00182     DebugSetInternalBreakpoint,
00183     DebugSetSpecialCall,
00184     DebugClearSpecialCalls,
00185     DebugQuerySpecialCalls,
00186     DebugDbgBreakPoint,
00187     DebugMaximum,
00188     DebugSysReadPhysicalMemory = 10,
00189     DebugSysReadIoSpace = 14,
00190     DebugSysWriteIoSpace = 15
00191 } DEBUG_CONTROL_CODE;
00192 
00193 
00194 typedef NTSTATUS (__stdcall *ZwSystemDebugControlPtr) (
00195     IN DEBUG_CONTROL_CODE  ControlCode,
00196     IN PVOID  InputBuffer  OPTIONAL,
00197     IN ULONG  InputBufferLength,
00198     OUT PVOID  OutputBuffer  OPTIONAL,
00199     IN ULONG  OutputBufferLength,
00200     OUT PULONG  ReturnLength  OPTIONAL );
00201 
00202 typedef NTSTATUS (__stdcall *EnumSystemFirmwareTablesPtr) (
00203     IN DWORD iFirmwareTableProviderSignature,
00204     OUT PVOID  InputBuffer,
00205     IN DWORD  InputBufferLength );
00206 
00207 typedef NTSTATUS (__stdcall *GetSystemFirmwareTablePtr) (
00208     IN DWORD iFirmwareTableProviderSignature,
00209     IN DWORD  FirmwareTableID,
00210     OUT PVOID  InputBuffer,
00211     IN DWORD  InputBufferLength );
00212 
00213 // See
00214 typedef struct _IO_STRUCT
00215 {
00216     DWORD  Addr;
00217     DWORD  Reserved1;
00218     PVOID  pBuf;
00219     DWORD  NumBytes;
00220     DWORD  Reserved4;
00221     DWORD  Reserved5;
00222     DWORD  Reserved6;
00223     DWORD  Reserved7;
00224 }
00225 IO_STRUCT;
00226 
00227 #ifdef LIBSMBIOS_WIN_USE_WMI
00228 
00229 // Define the WMI SMBIOS Information Structure
00230 
00231 typedef struct _WMISMBIOSINFO {
00232     u8  majorVersion;
00233     u8  minorVersion;
00234     u32 bufferSize;
00235     u8  *buffer;
00236 } WMISMBIOSINFO;
00237 
00238 #endif
00239 
00240 #pragma pack(push,1)
00241 typedef struct MEM_STRUCT
00242 {
00243     DWORD Addr;
00244     DWORD Reserved1;
00245     void *pBuf;
00246     DWORD NumBytes;
00247 }
00248 MEM_STRUCT;
00249 #pragma pack(pop,1)
00250 
00251 #endif /* MINIDDK_H */

Generated on Wed Apr 11 16:25:10 2007 for SMBIOS Library by doxygen 1.3.5