ReactOS  0.4.14-dev-55-g2da92ac
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 }
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1048
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
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
BOOLEAN MaintainHandleCount
Definition: obtypes.h:361
struct _WMIP_GUID_OBJECT WMIP_GUID_OBJECT
OB_CLOSE_METHOD CloseProcedure
Definition: obtypes.h:368
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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
static const WCHAR L[]
Definition: oid.c:1250
GENERIC_MAPPING WmipGenericMapping
Definition: guidobj.c:22
Status
Definition: gdiplustypes.h:24
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
OB_SECURITY_METHOD SecurityProcedure
Definition: obtypes.h:371
#define DPRINT1
Definition: precomp.h:8
POBJECT_TYPE WmipGuidObjectType
Definition: guidobj.c:21
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

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 216 of file guidobj.c.

222 {
223  PWMIP_GUID_OBJECT GuidObject;
226 
227  /* Create the GUID object */
228  Status = WmipCreateGuidObject(Guid, &GuidObject);
229  if (!NT_SUCCESS(Status))
230  {
231  DPRINT1("Failed to create GUID object: 0x%lx\n", Status);
232  *OutGuidObject = NULL;
233  return Status;
234  }
235 
236  /* Set handle attributes */
238 
239  /* Get a handle for the object */
240  Status = ObOpenObjectByPointer(GuidObject,
242  0,
245  AccessMode,
246  OutGuidObjectHandle);
247  if (!NT_SUCCESS(Status))
248  {
249  DPRINT1("ObOpenObjectByPointer failed: 0x%lx\n", Status);
250  ObDereferenceObject(GuidObject);
251  GuidObject = NULL;
252  }
253 
254  *OutGuidObject = GuidObject;
255 
256  return Status;
257 }
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE _In_ ACCESS_MASK _In_ ULONG HandleAttributes
Definition: obfuncs.h:429
static NTSTATUS WmipCreateGuidObject(_In_ const GUID *Guid, _Out_ PWMIP_GUID_OBJECT *OutGuidObject)
Definition: guidobj.c:175
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
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:2739
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
static GUID * Guid
Definition: apphelp.c:93
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define DPRINT1
Definition: precomp.h:8
POBJECT_TYPE WmipGuidObjectType
Definition: guidobj.c:21
unsigned int ULONG
Definition: retypes.h:1
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231

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 261 of file guidobj.c.

267 {
268  static UNICODE_STRING Prefix = RTL_CONSTANT_STRING(L"\\WmiGuid\\");
271  GUID Guid;
272  PAGED_CODE();
273 
274  /* Check if we have the expected prefix */
276  {
277  DPRINT1("WMI: Invalid prefix for guid object '%wZ'\n",
278  ObjectAttributes->ObjectName);
280  }
281 
282  /* Extract the GUID string */
283  GuidString = *ObjectAttributes->ObjectName;
284  GuidString.Buffer += Prefix.Length / sizeof(WCHAR);
285  GuidString.Length -= Prefix.Length;
286 
287  /* Convert the string into a GUID structure */
289  if (!NT_SUCCESS(Status))
290  {
291  DPRINT1("WMI: Invalid uuid format for guid '%wZ'\n", &GuidString);
292  return Status;
293  }
294 
295  return WmipOpenGuidObject(&Guid,
297  AccessMode,
298  OutGuidObjectHandle,
299  OutGuidObject);
300 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
static PWSTR GuidString
Definition: apphelp.c:91
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
unsigned short Length
Definition: sprintf.c:451
#define PAGED_CODE()
Definition: video.h:57
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
static GUID * Guid
Definition: apphelp.c:93
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static NTSTATUS WmipGUIDFromString(_In_ PUNICODE_STRING GuidString, _Out_ PGUID Guid)
Definition: guidobj.c:149
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI WmipOpenGuidObject(_In_ LPCGUID Guid, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE AccessMode, _Out_ PHANDLE OutGuidObjectHandle, _Outptr_ PVOID *OutGuidObject)
Definition: guidobj.c:216
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

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 219 of file smbios.c.

222 {
224  PVOID TableData = NULL;
225  ULONG TableSize, ResultSize;
226  PWNODE_ALL_DATA AllData;
227 
228  /* Get the table data */
229  Status = WmipGetRawSMBiosTableData(OutBuffer ? &TableData : NULL, &TableSize);
230  if (!NT_SUCCESS(Status))
231  {
232  DPRINT1("WmipGetRawSMBiosTableData failed: 0x%08lx\n", Status);
233  return Status;
234  }
235 
236  ResultSize = sizeof(WNODE_ALL_DATA) + TableSize;
237 
238  /* Check if the caller provided a buffer */
239  if ((OutBuffer != NULL) && (*InOutBufferSize != 0))
240  {
241  /* Check if the buffer is large enough */
242  if (*InOutBufferSize < ResultSize)
243  {
244  DPRINT1("Buffer too small. Got %lu, need %lu\n",
245  *InOutBufferSize, ResultSize);
247  }
248 
250  AllData = OutBuffer;
251  AllData->WnodeHeader.BufferSize = ResultSize;
252  AllData->WnodeHeader.ProviderId = 0;
253  AllData->WnodeHeader.Version = 0;
254  AllData->WnodeHeader.Linkage = 0; // last entry
255  //AllData->WnodeHeader.CountLost;
256  AllData->WnodeHeader.KernelHandle = NULL;
257  //AllData->WnodeHeader.TimeStamp;
259  //AllData->WnodeHeader.ClientContext;
261  AllData->DataBlockOffset = sizeof(WNODE_ALL_DATA);
262  AllData->InstanceCount = 1;
263  //AllData->OffsetInstanceNameOffsets;
264  AllData->FixedInstanceSize = TableSize;
265 
266  RtlCopyMemory(AllData + 1, TableData, TableSize);
267  }
268 
269  /* Set the size */
270  *InOutBufferSize = ResultSize;
271 
272  /* Free the table buffer */
273  if (TableData != NULL)
274  {
275  ExFreePoolWithTag(TableData, 'BTMS');
276  }
277 
278  return STATUS_SUCCESS;
279 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
struct tagWNODE_ALL_DATA WNODE_ALL_DATA
smooth NULL
Definition: ftsmooth.c:416
ULONG DataBlockOffset
Definition: wmistr.h:113
const GUID MSSmBios_RawSMBiosTables_GUID
Definition: hwhacks.c:20
#define WNODE_FLAG_FIXED_INSTANCE_SIZE
Definition: wmistr.h:32
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
ULONG FixedInstanceSize
Definition: wmistr.h:118
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:3971
unsigned int ULONG
Definition: retypes.h:1
struct _WNODE_HEADER WnodeHeader
Definition: wmistr.h:112
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2966
ULONG InstanceCount
Definition: wmistr.h:114

Referenced by IoWMIQueryAllData().

Variable Documentation

◆ RegistryPath

_In_ PUNICODE_STRING RegistryPath

Definition at line 27 of file wmip.h.

Referenced by _Function_class_(), _tmain(), AtapiRegCheckParameterValue(), AtapiRegGetStringParameterValue(), BindAdapter(), CdRomCheckRegistryForMediaChangeValue(), ClassInitialize(), ClasspIsMediaChangeDisabledDueToHardwareLimitation(), ClasspIsMediaChangeDisabledForClass(), CmpAddDriverToList(), CreateCdRomDeviceObject(), CreateDiskDeviceObject(), CreatePartitionDeviceObjects(), CreateRegistryKeyHandle(), DriverEntry(), EnumDeviceKeys(), EnumerateSoundDevices(), EnumerateSubkey(), Ext2QueryGlobalParameters(), Ext2QueryRegistrySettings(), FFSQueryParameters(), FindScsiDisks(), FreeBT_QueryWmiRegInfo(), HalAssignSlotResources(), HalpAssignSlotResources(), InitDevice(), InitializeFmIfsOnce(), InitializeSoundBlaster(), IopCreateDeviceKeyPath(), IopCreateDriver(), IopLoadUnloadDriver(), LANRegisterAdapter(), LoadBootDeviceDriver(), MountmgrReadNoAutoMount(), ndisBindMiniportsToProtocol(), NdisInitializeWrapper(), OpenRegistryKey(), OpenRegistryKeyHandle(), OpenSubkey(), PciAssignSlotResources(), PciIdeXInitialize(), PnpRootDriverEntry(), QueryParameters(), ReadRegistryEntries(), RegOpenKey(), RegTGetDwordValue(), RegTGetStringValue(), RfsdQueryParameters(), RxDriverEntry(), RxGetRegistryParameters(), ScsiCdRomFindDevices(), ScsiClassInitialize(), ScsiClassQueryTimeOutRegistryValue(), ScsiPortInitialize(), SpiBuildDeviceMap(), SpiGetPciConfigData(), SpiInitOpenKeys(), StorPortInitialize(), TestDriverObject(), TestEntry(), UDFRegCheckParameterValue(), VfdLoadLink(), VideoPortInitialize(), ViLoadImagesFromRegistry(), and WinLdrAddDriverToList().

◆ WmipGuidObjectType

POBJECT_TYPE WmipGuidObjectType