ReactOS 0.4.15-dev-5666-gc548b97
wmip.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _WMIP_IRP_CONTEXT
 
struct  _WMIP_GUID_OBJECT
 

Macros

#define GUID_STRING_LENGTH   36
 

Typedefs

typedef struct _WMIP_IRP_CONTEXT WMIP_IRP_CONTEXT
 
typedef struct _WMIP_IRP_CONTEXTPWMIP_IRP_CONTEXT
 
typedef struct _WMIP_GUID_OBJECT WMIP_GUID_OBJECT
 
typedef struct _WMIP_GUID_OBJECTPWMIP_GUID_OBJECT
 

Functions

 _Function_class_ (DRIVER_INITIALIZE) _IRQL_requires_same_ NTSTATUS NTAPI WmipDriverEntry(_In_ PDRIVER_OBJECT DriverObject
 
NTSTATUS NTAPI WmipInitializeGuidObjectType (VOID)
 
NTSTATUS NTAPI WmipOpenGuidObject (_In_ LPCGUID Guid, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE AccessMode, _Out_ PHANDLE OutGuidObjectHandle, _Outptr_ PVOID *OutGuidObject)
 
NTSTATUS NTAPI WmipOpenGuidObjectByName (_In_ POBJECT_ATTRIBUTES ObjectAttributes, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE AccessMode, _Out_ PHANDLE OutGuidObjectHandle, _Outptr_ PVOID *OutGuidObject)
 
NTSTATUS NTAPI WmipQueryRawSMBiosTables (_Inout_ ULONG *InOutBufferSize, _Out_opt_ PVOID OutBuffer)
 

Variables

POBJECT_TYPE WmipGuidObjectType
 
_In_ PUNICODE_STRING RegistryPath
 

Macro Definition Documentation

◆ GUID_STRING_LENGTH

#define GUID_STRING_LENGTH   36

Definition at line 6 of file wmip.h.

Typedef Documentation

◆ PWMIP_GUID_OBJECT

◆ PWMIP_IRP_CONTEXT

◆ WMIP_GUID_OBJECT

◆ WMIP_IRP_CONTEXT

Function Documentation

◆ _Function_class_()

_Function_class_ ( DRIVER_INITIALIZE  )

◆ WmipInitializeGuidObjectType()

NTSTATUS NTAPI WmipInitializeGuidObjectType ( VOID  )

Definition at line 113 of file guidobj.c.

115{
116 static UNICODE_STRING GuidObjectName = RTL_CONSTANT_STRING(L"WmiGuid");
117 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
119
120 /* Setup the object type initializer */
121 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
122 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
123 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
124 ObjectTypeInitializer.GenericMapping = WmipGenericMapping;
125 ObjectTypeInitializer.PoolType = NonPagedPool;
126 ObjectTypeInitializer.MaintainHandleCount = FALSE;
127 ObjectTypeInitializer.ValidAccessMask = STANDARD_RIGHTS_ALL | 0xFFF;
128 ObjectTypeInitializer.SecurityRequired = TRUE;
129 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(WMIP_GUID_OBJECT);
130 ObjectTypeInitializer.SecurityProcedure = WmipSecurityMethod;
131 ObjectTypeInitializer.DeleteProcedure = WmipDeleteMethod;
132 ObjectTypeInitializer.CloseProcedure = WmipCloseMethod;
133
134 /* Create the object type */
135 Status = ObCreateObjectType(&GuidObjectName,
136 &ObjectTypeInitializer,
137 0,
139 if (!NT_SUCCESS(Status))
140 {
141 DPRINT1("ObCreateObjectType failed: 0x%lx\n", Status);
142 }
143
144 return Status;
145}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
VOID NTAPI WmipDeleteMethod(_In_ PVOID Object)
Definition: guidobj.c:86
VOID NTAPI WmipCloseMethod(_In_opt_ PEPROCESS Process, _In_ PVOID Object, _In_ ACCESS_MASK GrantedAccess, _In_ ULONG ProcessHandleCount, _In_ ULONG SystemHandleCount)
Definition: guidobj.c:101
POBJECT_TYPE WmipGuidObjectType
Definition: guidobj.c:21
GENERIC_MAPPING WmipGenericMapping
Definition: guidobj.c:22
NTSTATUS NTAPI WmipSecurityMethod(_In_ PVOID Object, _In_ SECURITY_OPERATION_CODE OperationType, _In_ PSECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PULONG CapturedLength, _Inout_ PSECURITY_DESCRIPTOR *ObjectSecurityDescriptor, _In_ POOL_TYPE PoolType, _In_ PGENERIC_MAPPING GenericMapping)
Definition: guidobj.c:35
#define OBJ_OPENLINK
Definition: winternl.h:230
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1048
OB_CLOSE_METHOD CloseProcedure
Definition: obtypes.h:368
OB_SECURITY_METHOD SecurityProcedure
Definition: obtypes.h:371
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
BOOLEAN MaintainHandleCount
Definition: obtypes.h:361
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
struct _WMIP_GUID_OBJECT WMIP_GUID_OBJECT

Referenced by WmiInitialize().

◆ WmipOpenGuidObject()

NTSTATUS NTAPI WmipOpenGuidObject ( _In_ LPCGUID  Guid,
_In_ ACCESS_MASK  DesiredAccess,
_In_ KPROCESSOR_MODE  AccessMode,
_Out_ PHANDLE  OutGuidObjectHandle,
_Outptr_ PVOID OutGuidObject 
)

Definition at line 217 of file guidobj.c.

223{
224 PWMIP_GUID_OBJECT GuidObject;
227
228 /* Create the GUID object */
229 Status = WmipCreateGuidObject(Guid, &GuidObject);
230 if (!NT_SUCCESS(Status))
231 {
232 DPRINT1("Failed to create GUID object: 0x%lx\n", Status);
233 *OutGuidObject = NULL;
234 return Status;
235 }
236
237 /* Set handle attributes */
239
240 /* Get a handle for the object */
241 Status = ObOpenObjectByPointer(GuidObject,
243 0,
247 OutGuidObjectHandle);
248 if (!NT_SUCCESS(Status))
249 {
250 DPRINT1("ObOpenObjectByPointer failed: 0x%lx\n", Status);
251 ObDereferenceObject(GuidObject);
252 GuidObject = NULL;
253 }
254
255 *OutGuidObject = GuidObject;
256
257 return Status;
258}
#define NULL
Definition: types.h:112
static NTSTATUS WmipCreateGuidObject(_In_ const GUID *Guid, _Out_ PWMIP_GUID_OBJECT *OutGuidObject)
Definition: guidobj.c:175
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
unsigned int ULONG
Definition: retypes.h:1
#define KernelMode
Definition: asm.h:34
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE _In_ ACCESS_MASK _In_ ULONG HandleAttributes
Definition: obfuncs.h:433
NTSTATUS NTAPI ObOpenObjectByPointer(IN PVOID Object, IN ULONG HandleAttributes, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PHANDLE Handle)
Definition: obhandle.c:2742
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by IoWMIOpenBlock(), and WmipOpenGuidObjectByName().

◆ WmipOpenGuidObjectByName()

NTSTATUS NTAPI WmipOpenGuidObjectByName ( _In_ POBJECT_ATTRIBUTES  ObjectAttributes,
_In_ ACCESS_MASK  DesiredAccess,
_In_ KPROCESSOR_MODE  AccessMode,
_Out_ PHANDLE  OutGuidObjectHandle,
_Outptr_ PVOID OutGuidObject 
)

Definition at line 262 of file guidobj.c.

268{
269 static UNICODE_STRING Prefix = RTL_CONSTANT_STRING(L"\\WmiGuid\\");
272 GUID Guid;
273 PAGED_CODE();
274
275 /* Check if we have the expected prefix */
277 {
278 DPRINT1("WMI: Invalid prefix for guid object '%wZ'\n",
279 ObjectAttributes->ObjectName);
281 }
282
283 /* Extract the GUID string */
284 GuidString = *ObjectAttributes->ObjectName;
285 GuidString.Buffer += Prefix.Length / sizeof(WCHAR);
286 GuidString.Length -= Prefix.Length;
287
288 /* Convert the string into a GUID structure */
290 if (!NT_SUCCESS(Status))
291 {
292 DPRINT1("WMI: Invalid uuid format for guid '%wZ'\n", &GuidString);
293 return Status;
294 }
295
296 return WmipOpenGuidObject(&Guid,
299 OutGuidObjectHandle,
300 OutGuidObject);
301}
#define PAGED_CODE()
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
NTSTATUS NTAPI WmipOpenGuidObject(_In_ LPCGUID Guid, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE AccessMode, _Out_ PHANDLE OutGuidObjectHandle, _Outptr_ PVOID *OutGuidObject)
Definition: guidobj.c:217
static NTSTATUS WmipGUIDFromString(_In_ PUNICODE_STRING GuidString, _Out_ PGUID Guid)
Definition: guidobj.c:149
static PWSTR GuidString
Definition: apphelp.c:93
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
unsigned short Length
Definition: sprintf.c:451
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1630
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by WmipOpenGuidForEvents(), and WmipRegisterGuids().

◆ WmipQueryRawSMBiosTables()

NTSTATUS NTAPI WmipQueryRawSMBiosTables ( _Inout_ ULONG InOutBufferSize,
_Out_opt_ PVOID  OutBuffer 
)

FIXME: most of this is fubar

Definition at line 220 of file smbios.c.

223{
225 PVOID TableData = NULL;
226 ULONG TableSize, ResultSize;
227 PWNODE_ALL_DATA AllData;
228
229 /* Get the table data */
230 Status = WmipGetRawSMBiosTableData(OutBuffer ? &TableData : NULL, &TableSize);
231 if (!NT_SUCCESS(Status))
232 {
233 DPRINT1("WmipGetRawSMBiosTableData failed: 0x%08lx\n", Status);
234 return Status;
235 }
236
237 ResultSize = sizeof(WNODE_ALL_DATA) + TableSize;
238
239 /* Check if the caller provided a buffer */
240 if ((OutBuffer != NULL) && (*InOutBufferSize != 0))
241 {
242 /* Check if the buffer is large enough */
243 if (*InOutBufferSize < ResultSize)
244 {
245 DPRINT1("Buffer too small. Got %lu, need %lu\n",
246 *InOutBufferSize, ResultSize);
248 }
249
251 AllData = OutBuffer;
252 AllData->WnodeHeader.BufferSize = ResultSize;
253 AllData->WnodeHeader.ProviderId = 0;
254 AllData->WnodeHeader.Version = 0;
255 AllData->WnodeHeader.Linkage = 0; // last entry
256 //AllData->WnodeHeader.CountLost;
257 AllData->WnodeHeader.KernelHandle = NULL;
258 //AllData->WnodeHeader.TimeStamp;
260 //AllData->WnodeHeader.ClientContext;
262 AllData->DataBlockOffset = sizeof(WNODE_ALL_DATA);
263 AllData->InstanceCount = 1;
264 //AllData->OffsetInstanceNameOffsets;
265 AllData->FixedInstanceSize = TableSize;
266
267 RtlCopyMemory(AllData + 1, TableData, TableSize);
268 }
269
270 /* Set the size */
271 *InOutBufferSize = ResultSize;
272
273 /* Free the table buffer */
274 if (TableData != NULL)
275 {
276 ExFreePoolWithTag(TableData, 'BTMS');
277 }
278
279 return STATUS_SUCCESS;
280}
const GUID MSSmBios_RawSMBiosTables_GUID
Definition: hwhacks.c:20
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
ULONG InstanceCount
Definition: wmistr.h:114
struct _WNODE_HEADER WnodeHeader
Definition: wmistr.h:112
ULONG DataBlockOffset
Definition: wmistr.h:113
ULONG FixedInstanceSize
Definition: wmistr.h:118
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define WNODE_FLAG_FIXED_INSTANCE_SIZE
Definition: wmistr.h:32
struct tagWNODE_ALL_DATA WNODE_ALL_DATA
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4327

Referenced by IoWMIQueryAllData().

Variable Documentation

◆ RegistryPath

Definition at line 28 of file wmip.h.

◆ WmipGuidObjectType

POBJECT_TYPE WmipGuidObjectType
extern