Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1568 lines
38 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. wmikmp.h
  5. Abstract:
  6. Private header for WMI kernel mode component
  7. Author:
  8. AlanWar
  9. Environment:
  10. Revision History:
  11. --*/
  12. #ifndef _WMIKMP_
  13. #define _WMIKMP_
  14. //
  15. // Define this to cause no security descriptor to be placed on the service
  16. // device. This should never be defined for released builds; it is only
  17. // needed when debugging the service startup code.
  18. //#define NO_SERVICE_DEVICE_SECURITY
  19. //
  20. // define this to get allocation debug info
  21. //#define DEBUG_ALLOCS
  22. #ifdef MEMPHIS
  23. //
  24. // In building for memphis we include WDM.h which defines the WMI apis as
  25. // DECLSPEC_IMPORT which we don't want. So we redefine the api names around
  26. // the inclusion of WDM.h.
  27. //
  28. #define IoWMIRegistrationControl IoWMIRegistrationControlImport
  29. #define IoWMIAllocateInstanceIds IoWMIAllocateInstanceIdsImport
  30. #define IoWMISuggestInstanceName IoWMISuggestInstanceNameImport
  31. #define IoWMIWriteEvent IoWMIWriteEventImport
  32. #endif
  33. #ifdef MEMPHIS
  34. #define UNICODE
  35. #define WANTVXDWRAPS
  36. #include <wdm.h>
  37. #include <poclass.h>
  38. #include <basedef.h>
  39. #include <regstr.h>
  40. #include <vmm.h>
  41. #include <vmmreg.h>
  42. #include <shell.h>
  43. #include <vpicd.h>
  44. #include <vxdldr.h>
  45. #include <ntkern.h>
  46. #include <vpowerd.h>
  47. #include <vxdwraps.h>
  48. #include <configmg.h>
  49. #include <devinfo.h>
  50. #include <stdarg.h>
  51. #else
  52. #include "ntos.h"
  53. #include "zwapi.h"
  54. #ifndef IsEqualGUID
  55. #define IsEqualGUID(guid1, guid2) \
  56. (!memcmp((guid1), (guid2), sizeof(GUID)))
  57. #endif
  58. #if DBG
  59. //
  60. // Debug levels are bit masks and are not cumulative. So if you want to see
  61. // All errors and warnings you need to have bits 0 and 1 set.
  62. //
  63. // Mask for WMICORE is in variable nt!Kd_WMICORE_Mask
  64. //
  65. // Registry can be setup with initial mask value for nt!Kd_WMICORE_Mask by
  66. // setting up a DWORD value named WMICORE under key
  67. // HKLM\System\CurrnetControlSet\Control\Session Manager\Debug Print Filter
  68. //
  69. // Standard levels are
  70. // DPFLTR_ERROR_LEVEL 0 0x00000001
  71. // DPFLTR_WARNING_LEVEL 1 0x00000002
  72. // DPFLTR_TRACE_LEVEL 2 0x00000004
  73. // DPFLTR_INFO_LEVEL 3 0x00000008
  74. //
  75. // Custom debug print levels are 4 through 31
  76. //
  77. #define DPFLTR_MCA_LEVEL 4 // 0x00000010
  78. #define DPFLTR_OBJECT_LEVEL 5 // 0x00000020
  79. #define DPFLTR_API_INFO_LEVEL 6 // 0x00000040
  80. #define DPFLTR_EVENT_INFO_LEVEL 7 // 0x00000080
  81. #define WMICORE_INFO DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL
  82. #define WmipDebugPrintEx(_x_) DbgPrintEx _x_
  83. #else
  84. #define WmipDebugPrintEx(_x_)
  85. #endif // if DBG
  86. #endif // ifdef MEMPHIS
  87. #include "wmiguid.h"
  88. #include "wmidata.h"
  89. #include <stdio.h>
  90. #ifndef MEMPHIS
  91. extern POBJECT_TYPE IoFileObjectType;
  92. #endif
  93. #ifdef MEMPHIS
  94. #undef IoWMIRegistrationControl
  95. #undef IoWMIAllocateInstanceIds
  96. #undef IoWMISuggestInstanceName
  97. #undef IoWMIWriteEvent
  98. #endif
  99. #include "wmistr.h"
  100. #include "wmiumkm.h"
  101. #include <wmi.h>
  102. NTSTATUS IoWMIAllocateInstanceIds(
  103. IN GUID *Guid,
  104. IN ULONG InstanceCount,
  105. OUT ULONG *FirstInstanceId
  106. );
  107. NTKERNELAPI
  108. NTSTATUS
  109. IoCreateDriver (
  110. IN PUNICODE_STRING DriverName, OPTIONAL
  111. IN PDRIVER_INITIALIZE InitializationFunction
  112. );
  113. #define WmipAssert ASSERT
  114. #define WMIPOOLTAG 'pimW'
  115. #define WMINCPOOLTAG 'nimW'
  116. #define WMINPPOOLTAG 'NimW'
  117. #define WMINWPOOLTAG 'wimW'
  118. #define WMIMSGPOOLTAG 'mimW'
  119. #define WMIIIPOOLTAG 'iimW'
  120. #define WMIREGPOOLTAG 'RimW'
  121. #define WMISYSIDPOOLTAG 'simW'
  122. #define WmipRegisterDSPoolTag 'DimW'
  123. #define WMIPSCHEDPOOLTAG 'gaiD'
  124. #define WmipMCAPoolTag 'acMW'
  125. #define WmipInstanceNameTag 'IimW'
  126. #define WMI_GM_POOLTAG 'jimW'
  127. #define WMIPCREATETHREADTAG 'CimW'
  128. #define OffsetToPtr(Base, Offset) ((PUCHAR)((PUCHAR)(Base) + (Offset)))
  129. //
  130. // Maximum size allowed for any WNODE_EVENT_ITEM
  131. #define DEFAULTMAXKMWNODEEVENTSIZE 0x80000
  132. #define LARGEKMWNODEEVENTSIZE 512
  133. typedef struct
  134. {
  135. ULONG BufferSize;
  136. PUCHAR Buffer;
  137. } REGQUERYBUFFERXFER, *PREGQUERYBUFFERXFER;
  138. //
  139. // We have got a single Mutex/Critical Section for the entire WMI KM code
  140. // It is used anytime that access needs to be serialized. Typically it is
  141. // used in the following cases:
  142. //
  143. // 1. Access to the internal data structures that contain the registration
  144. // list, guid entries, data sources, etc.
  145. //
  146. // 2. Synchronize collecting SMBIOS information
  147. //
  148. // 3. Tracelog purposes
  149. //
  150. // 4. Updating the device stack size
  151. //
  152. extern KMUTEX WmipSMMutex;
  153. _inline NTSTATUS WmipEnterCritSection(
  154. BOOLEAN AllowAPC
  155. )
  156. {
  157. NTSTATUS status;
  158. do
  159. {
  160. status = KeWaitForMutexObject(&WmipSMMutex,
  161. Executive,
  162. KernelMode,
  163. AllowAPC,
  164. NULL);
  165. } while((status == STATUS_ALERTED) ||
  166. (status == STATUS_USER_APC));
  167. return(status);
  168. }
  169. _inline void WmipLeaveCritSection(
  170. )
  171. {
  172. KeReleaseMutex(&WmipSMMutex,
  173. FALSE);
  174. }
  175. //
  176. // SMCritSection does not allows APCs to occur while the mutex is held.
  177. //
  178. #define WmipEnterSMCritSection() WmipEnterCritSection(FALSE)
  179. #define WmipLeaveSMCritSection() WmipLeaveCritSection()
  180. //
  181. // Tracelog Critical section is to serialize the Enabling and disabling
  182. // of trace control guids. Since we want to allow Updates (enable a
  183. // a Guid with a different set of flags and levels), we serialize this
  184. // operation to reduce complexity of code.
  185. //
  186. // NOTE: TraceCritSection must not be taken with SMCritSection held.
  187. // Bad Deadlocks will result if that happens.
  188. //
  189. extern KMUTEX WmipTLMutex;
  190. _inline NTSTATUS WmipEnterTraceCritSection(
  191. BOOLEAN AllowAPC
  192. )
  193. {
  194. NTSTATUS status;
  195. do
  196. {
  197. status = KeWaitForMutexObject(&WmipTLMutex,
  198. Executive,
  199. KernelMode,
  200. AllowAPC,
  201. NULL);
  202. } while((status == STATUS_ALERTED) ||
  203. (status == STATUS_USER_APC));
  204. return(status);
  205. }
  206. _inline void WmipLeaveTraceCritSection(
  207. )
  208. {
  209. KeReleaseMutex(&WmipTLMutex,
  210. FALSE);
  211. }
  212. //
  213. // TLCritSection does not allows APCs to occur while the mutex is held.
  214. //
  215. #define WmipEnterTLCritSection() WmipEnterTraceCritSection(FALSE);
  216. #define WmipLeaveTLCritSection() WmipLeaveTraceCritSection();
  217. //
  218. // This defines the stack size that the WMI device starts with. Since
  219. // WMI irps will be forwarded any WMI data provider the WMI device must have
  220. // more stack locations than the largest driver to which it forwards irps.
  221. #define WmiDeviceStackSize 2
  222. /////////////////////////////////////////////////////////////////////////////
  223. // Device Registration Data structures
  224. //
  225. // Each WMI providing device object and callback is maintained in a REGENTRY
  226. // structure which is allocated in chunks. Each entry is referenced by the
  227. // Device object or the callback address. The WMI user mode service is given
  228. // info from RegEntry structure, and is generally only interested in the
  229. // DeviceObject (or WmiEntry) and flags. The user mode side uses the device
  230. // object (or WmiEntry) as its "handle" to the data provider and is referred
  231. // to as ProviderId in the user mode code.
  232. //
  233. struct tagDATASOURCE;
  234. typedef struct _REGENTRY
  235. {
  236. LIST_ENTRY InUseEntryList; // Node in list of in use entries
  237. union
  238. {
  239. PDEVICE_OBJECT DeviceObject; // Device object of registered device
  240. #ifndef MEMPHIS
  241. WMIENTRY * WmiEntry; // Pointer to a pointer to Callback function
  242. #endif
  243. };
  244. ULONG RefCount; // Reference Count
  245. ULONG Flags; // Registration flags
  246. PDEVICE_OBJECT PDO; // PDO associated with device
  247. ULONG MaxInstanceNames; // # instance names for device
  248. ULONG IrpCount; // Count of IRPs currently active
  249. ULONG ProviderId; // Provider Id
  250. struct tagDATASOURCE *DataSource; // Datasource associated with regentry
  251. KEVENT Event; // Event used to synchronize unloading
  252. } REGENTRY, *PREGENTRY;
  253. #define REGENTRY_FLAG_INUSE 0x00000001 // Entry is in use (not free)
  254. #define REGENTRY_FLAG_CALLBACK 0x00000002 // Entry represents a callback
  255. #define REGENTRY_FLAG_NEWREGINFO 0x00000004 // Entry has new registration info
  256. #define REGENTRY_FLAG_UPDREGINFO 0x00000008 // Entry has updated registration info
  257. // When set do not forward irps to the device
  258. #define REGENTRY_FLAG_NOT_ACCEPTING_IRPS 0x00000010
  259. #define REGENTRY_FLAG_TOO_SMALL 0x00000020
  260. #define REGENTRY_FLAG_TRACED 0x00000040 // Entry represents traced device
  261. // When set device is being rundown.
  262. #define REGENTRY_FLAG_RUNDOWN 0x00000080
  263. // Entry is in process of registering
  264. #define REGENTRY_FLAG_REG_IN_PROGRESS 0x00000100
  265. // Entry is UM data provider
  266. #define REGENTRY_FLAG_UM_PROVIDER 0x00000200
  267. #define REGENTRY_FLAG_TRACE_NOTIFY_MASK 0x000F0000 // Reserved for callouts
  268. #define WmipSetKmRegInfo(KmRegInfoPtr, RegEntryPtr) \
  269. { \
  270. (KmRegInfoPtr)->ProviderId = (RegEntryPtr)->ProviderId; \
  271. (KmRegInfoPtr)->Flags = (RegEntryPtr)->Flags; \
  272. }
  273. typedef enum _REGOPERATION
  274. {
  275. RegisterAllDrivers,
  276. RegisterSingleDriver,
  277. RegisterUpdateSingleDriver,
  278. RegisterDeleteSingleDriver
  279. } REGOPERATION, *PREGOPERATION;
  280. typedef struct _REGISTRATIONWORKITEM
  281. {
  282. LIST_ENTRY ListEntry;
  283. REGOPERATION RegOperation;
  284. PREGENTRY RegEntry;
  285. } REGISTRATIONWORKITEM, *PREGISTRATIONWORKITEM;
  286. typedef struct
  287. {
  288. LIST_ENTRY ListEntry;
  289. PREGENTRY RegEntry;
  290. PWNODE_HEADER Wnode;
  291. } EVENTWORKCONTEXT, *PEVENTWORKCONTEXT;
  292. typedef struct
  293. {
  294. WORK_QUEUE_ITEM WorkItem;
  295. PVOID Object;
  296. } CREATETHREADWORKITEM, *PCREATETHREADWORKITEM;
  297. /////////////////////////////////////////////////////////////////////////////
  298. // InstanceId management data structures
  299. //
  300. // This defines the number of INSTID structures in a chunk
  301. #define INSTIDSPERCHUNK 8
  302. typedef struct
  303. {
  304. GUID Guid; // Guid
  305. ULONG BaseId; // Next instance id for guid
  306. } INSTID, *PINSTID;
  307. typedef struct tagINSTIDCHUNK
  308. {
  309. struct tagINSTIDCHUNK *Next; // Next chunk of INSTIDS
  310. INSTID InstId[INSTIDSPERCHUNK];
  311. } INSTIDCHUNK, *PINSTIDCHUNK;
  312. //
  313. // TODO: Move from separate header into here
  314. #include "wmiumds.h"
  315. #define WmipBuildWnodeTooSmall(Wnode, BufferSizeNeeded) \
  316. ((PWNODE_TOO_SMALL)Wnode)->WnodeHeader.BufferSize = sizeof(WNODE_TOO_SMALL);\
  317. ((PWNODE_TOO_SMALL)Wnode)->WnodeHeader.Flags = WNODE_FLAG_TOO_SMALL; \
  318. ((PWNODE_TOO_SMALL)Wnode)->SizeNeeded = BufferSizeNeeded;
  319. typedef struct
  320. {
  321. BOOLEAN Used20CallingMethod;
  322. UCHAR SMBiosMajorVersion;
  323. UCHAR SMBiosMinorVersion;
  324. UCHAR DMIBiosRevision;
  325. } SMBIOSVERSIONINFO, *PSMBIOSVERSIONINFO;
  326. //
  327. // See smbios spec for System Event Log (Type 15) for detailed information
  328. // on the contents of this structurre. The layout from element LogAreaLength
  329. // to VariableData must match the layout of the SMBIOS System Eventlog
  330. // structure as defined in the smbios spec and smbios.h.
  331. //
  332. typedef struct
  333. {
  334. USHORT LogTypeDescLength;
  335. UCHAR LogHeaderDescExists;
  336. UCHAR Reserved;
  337. USHORT LogAreaLength;
  338. USHORT LogHeaderStart;
  339. USHORT LogDataStart;
  340. UCHAR AccessMethod;
  341. UCHAR LogStatus;
  342. ULONG LogChangeToken;
  343. ULONG AccessMethodAddress;
  344. //
  345. // LogHeaderFormat, NumberLogTypeDesc, LengthEachLogTypeDesc and
  346. // ListLogTypeDesc are only valid if LogHeaderDescExists is TRUE.
  347. // This means that SMBIOS is revision 2.1
  348. //
  349. UCHAR LogHeaderFormat;
  350. UCHAR NumberLogTypeDesc;
  351. UCHAR LengthEachLogTypeDesc;
  352. //
  353. // Within the variable data is the Log Type descriptors immediately
  354. // followed by the Eventlog area. The size of the Log Type Descriptors
  355. // is LogTypeDescLength bytes and the size of the Eventlog area is
  356. // LogAreaLength
  357. //
  358. UCHAR VariableData[1];
  359. } SMBIOS_EVENTLOG_INFO, *PSMBIOS_EVENTLOG_INFO;
  360. //
  361. // WMI service device extension
  362. extern PDEVICE_OBJECT WmipServiceDeviceObject;
  363. #define WmipIsWmiNotSetupProperly() (WmipServiceDeviceObject == NULL)
  364. typedef struct
  365. {
  366. PREGENTRY RegEntry;
  367. KEVENT Event;
  368. } IRPCOMPCTX, *PIRPCOMPCTX;
  369. //
  370. // This defines the WMI Guid object. There are really 5 different type of
  371. // objects that are created from this data structure:
  372. //
  373. // QuerySet Object returned to the data consumer to allow them to
  374. // send queries and sets to a particular set of providers. It
  375. // does not use a flag.
  376. //
  377. // Notification Object is used by data consumers to receive events. It
  378. // is created when a data consumer wants to receive an event for a
  379. // particular guid and queues up the received events until they are
  380. // retrieved by the consumer. When the object is deleted it is
  381. // removed from the list of objects maintianed by a GuidEntry and
  382. // a event disable request is sent to the devices that expose
  383. // the events if this is the last object open to the event.
  384. // These have no flag set
  385. //
  386. // Request Object is created on behalf of a user mode data provider
  387. // when it registers its guids with WMI. It acts like a Notification
  388. // object in that requests (in the form of events) are received
  389. // by it and then can be picked up by the user mode creator. It uses
  390. // the WMIGUID_FLAG_REQUEST_OBJECT flag. When a Request Object is
  391. // being deleted it will clean up any guids registered for it and
  392. // send a reply message to any reply objects waiting to receive
  393. // a message from it.
  394. //
  395. // Reply Object is created as a product of Creating a user mode logger.
  396. // This object acts as a notification object to deliver replies
  397. // sent by request objects. When it is closed it will remove itself
  398. // from any request list that it may be part of and clear the
  399. // reference to it in any request objects and deref itself to account
  400. // for that. These use the WMIGUID_FLAG_REPLY_OBJECT flag
  401. //
  402. // Security Objects are created so that the security apis can have
  403. // a mechanism to change the security descriptors for the guids
  404. // These have the WMIGUID_FLAG_SECURITY_OBJECT
  405. // This defines the maximum number of outstanding requests that can
  406. // be sent to a request object
  407. #define MAXREQREPLYSLOTS 4
  408. typedef struct
  409. {
  410. struct _WMIGUIDOBJECT *ReplyObject;
  411. LIST_ENTRY RequestListEntry;
  412. } MBREQUESTS, *PMBREQUESTS;
  413. //
  414. // This data structure is used to maintain a fixed sized queue of events
  415. // waiting to be delivered to a user mdoe consumer.
  416. //
  417. typedef struct
  418. {
  419. PUCHAR Buffer; // Buffer that holds events waiting
  420. PWNODE_HEADER LastWnode; // Last event so we can link to next
  421. ULONG MaxBufferSize; // Max size of events that can be held
  422. ULONG NextOffset; // Offset in buffer to next place to store
  423. ULONG EventsLost; // # events lost
  424. } WMIEVENTQUEUE, *PWMIEVENTQUEUE;
  425. typedef struct _WMIGUIDOBJECT
  426. {
  427. KEVENT Event;
  428. union
  429. {
  430. GUID Guid;
  431. PREGENTRY RegEntry;
  432. };
  433. // Entry in linked list of objects for this guid
  434. LIST_ENTRY GEObjectList;
  435. PBGUIDENTRY GuidEntry;
  436. ULONG Type; // Type of object
  437. union
  438. {
  439. //
  440. // Kernel mode event receiver - all we need is a callback &
  441. // context
  442. //
  443. struct
  444. {
  445. WMI_NOTIFICATION_CALLBACK Callback;
  446. PVOID CallbackContext;
  447. };
  448. struct
  449. {
  450. //
  451. // User mode Queued up event management
  452. //
  453. //
  454. // Info on how to startup a new pump thread
  455. //
  456. LIST_ENTRY ThreadObjectList;
  457. HANDLE UserModeProcess;
  458. PUSER_THREAD_START_ROUTINE UserModeCallback;
  459. //
  460. // Info for request waiting to be completed
  461. //
  462. PIRP Irp; // Irp waiting for event from this object
  463. // Entry in list objects associated with an irp
  464. LIST_ENTRY IrpObjectList;
  465. // What to do when an event is queued
  466. ULONG EventQueueAction;
  467. WMIEVENTQUEUE HiPriority;// Hi priority event queue
  468. WMIEVENTQUEUE LoPriority;// Lo priority event queue
  469. };
  470. };
  471. BOOLEAN EnableRequestSent;
  472. //
  473. // MB management
  474. //
  475. union
  476. {
  477. LIST_ENTRY RequestListHead; // Head of request list (reply object)
  478. // (request object)
  479. MBREQUESTS MBRequests[MAXREQREPLYSLOTS];
  480. };
  481. ULONG Cookie;
  482. ULONG Flags;
  483. } WMIGUIDOBJECT, *PWMIGUIDOBJECT;
  484. // Set if the guid is a request object, that is receives requests
  485. #define WMIGUID_FLAG_REQUEST_OBJECT 0x00000001
  486. // Set if the guid is a reply object, that is receives replies
  487. #define WMIGUID_FLAG_REPLY_OBJECT 0x00000002
  488. // Set if the guid is a security object
  489. #define WMIGUID_FLAG_SECURITY_OBJECT 0x00000004
  490. // Set if the guid is a kernel mode notification object, that is there
  491. // is kernel mode code that wants a callback when an event is received
  492. #define WMIGUID_FLAG_KERNEL_NOTIFICATION 0x00000008
  493. // Set if the guid object is marked for pending closure, so no events
  494. // should be queued to it
  495. #define WMIGUID_FLAG_RECEIVE_NO_EVENTS 0x00000010
  496. typedef struct
  497. {
  498. PWMIGUIDOBJECT GuidObject;
  499. PWNODE_HEADER NextWnode;
  500. } OBJECT_EVENT_INFO, *POBJECT_EVENT_INFO;
  501. // NTSTATUS ValidateWnodeHeader(
  502. // PWNODE_HEADER Wnode,
  503. // ULONG BufSize,
  504. // ULONG BufferSizeMin,
  505. // ULONG RequiredFlags,
  506. // ULONG ProhibitedFlags
  507. // );
  508. #define WmipValidateWnodeHeader( \
  509. Wnode, \
  510. BufSize, \
  511. BufferSizeMin, \
  512. RequiredFlags, \
  513. ProhibitedFlags \
  514. ) \
  515. (( (BufSize < BufferSizeMin) || \
  516. ( (Wnode->Flags & RequiredFlags) != RequiredFlags) || \
  517. (BufSize != Wnode->BufferSize) || \
  518. ( (Wnode->Flags & ProhibitedFlags) != 0)) ? \
  519. STATUS_UNSUCCESSFUL : STATUS_SUCCESS)
  520. #define WmipIsAligned( Value, Alignment ) \
  521. ( ( ((Value)+(Alignment-1)) & ~(Alignment-1) ) == (Value) )
  522. typedef struct
  523. {
  524. GUID Guid; // Guid to registered
  525. ULONG InstanceCount; // Count of Instances of Datablock
  526. ULONG Flags; // Additional flags (see WMIREGINFO in wmistr.h)
  527. } GUIDREGINFO, *PGUIDREGINFO;
  528. typedef
  529. NTSTATUS
  530. (*PQUERY_WMI_REGINFO) (
  531. IN PDEVICE_OBJECT DeviceObject,
  532. OUT PULONG RegFlags,
  533. OUT PUNICODE_STRING Name,
  534. OUT PUNICODE_STRING *RegistryPath
  535. );
  536. /*++
  537. Routine Description:
  538. This routine is a callback into the driver to retrieve information about
  539. the guids being registered.
  540. Arguments:
  541. DeviceObject is the device whose registration information is needed
  542. *RegFlags returns with a set of flags that describe the guids being
  543. registered for this device. If the device wants enable and disable
  544. collection callbacks before receiving queries for the registered
  545. guids then it should return the WMIREG_FLAG_EXPENSIVE flag. Also the
  546. returned flags may specify WMIREG_FLAG_INSTANCE_PDO in which case
  547. the instance name is determined from the PDO associated with the
  548. device object. Note that the PDO must have an associated devnode. If
  549. WMIREG_FLAG_INSTANCE_PDO is not set then Name must return a unique
  550. name for the device.
  551. Name returns with the instance name for the guids if
  552. WMIREG_FLAG_INSTANCE_PDO is not set in the returned *RegFlags. The
  553. caller will call ExFreePool with the buffer returned.
  554. *RegistryPath returns with the registry path of the driver
  555. Return Value:
  556. status
  557. --*/
  558. typedef
  559. NTSTATUS
  560. (*PQUERY_WMI_DATABLOCK) (
  561. IN PDEVICE_OBJECT DeviceObject,
  562. IN PIRP Irp,
  563. IN ULONG GuidIndex,
  564. IN ULONG InstanceIndex,
  565. IN ULONG InstanceCount,
  566. IN OUT PULONG InstanceLengthArray,
  567. IN ULONG BufferAvail,
  568. OUT PUCHAR Buffer
  569. );
  570. /*++
  571. Routine Description:
  572. This routine is a callback into the driver to query for the contents of
  573. all instances of a data block. When the driver has finished filling the
  574. data block it must call IoWMICompleteRequest to complete the irp. The
  575. driver can return STATUS_PENDING if the irp cannot be completed
  576. immediately.
  577. Arguments:
  578. DeviceObject is the device whose data block is being queried
  579. Irp is the Irp that makes this request
  580. GuidIndex is the index into the list of guids provided when the
  581. device registered
  582. InstanceIndex is the index that denotes which instance of the data block
  583. is being queried.
  584. InstanceCount is the number of instnaces expected to be returned for
  585. the data block.
  586. InstanceLengthArray is a pointer to an array of ULONG that returns the
  587. lengths of each instance of the data block. If this is NULL then
  588. there was not enough space in the output buffer to fufill the request
  589. so the irp should be completed with the buffer needed.
  590. BufferAvail on entry has the maximum size available to write the data
  591. blocks.
  592. Buffer on return is filled with the returned data blocks. Note that each
  593. instance of the data block must be aligned on a 8 byte boundry. If
  594. this is NULL then there was not enough space in the output buffer
  595. to fufill the request so the irp should be completed with the buffer
  596. needed.
  597. Return Value:
  598. status
  599. --*/
  600. typedef
  601. NTSTATUS
  602. (*PSET_WMI_DATABLOCK) (
  603. IN PDEVICE_OBJECT DeviceObject,
  604. IN PIRP Irp,
  605. IN ULONG GuidIndex,
  606. IN ULONG InstanceIndex,
  607. IN ULONG BufferSize,
  608. IN PUCHAR Buffer
  609. );
  610. /*++
  611. Routine Description:
  612. This routine is a callback into the driver to query for the contents of
  613. a data block. When the driver has finished filling the data block it
  614. must call IoWMICompleteRequest to complete the irp. The driver can
  615. return STATUS_PENDING if the irp cannot be completed immediately.
  616. Arguments:
  617. DeviceObject is the device whose data block is being queried
  618. Irp is the Irp that makes this request
  619. GuidIndex is the index into the list of guids provided when the
  620. device registered
  621. InstanceIndex is the index that denotes which instance of the data block
  622. is being set.
  623. BufferSize has the size of the data block passed
  624. Buffer has the new values for the data block
  625. Return Value:
  626. status
  627. --*/
  628. typedef
  629. NTSTATUS
  630. (*PSET_WMI_DATAITEM) (
  631. IN PDEVICE_OBJECT DeviceObject,
  632. IN PIRP Irp,
  633. IN ULONG GuidIndex,
  634. IN ULONG InstanceIndex,
  635. IN ULONG DataItemId,
  636. IN ULONG BufferSize,
  637. IN PUCHAR Buffer
  638. );
  639. /*++
  640. Routine Description:
  641. This routine is a callback into the driver to query for the contents of
  642. a data block. When the driver has finished filling the data block it
  643. must call IoWMICompleteRequest to complete the irp. The driver can
  644. return STATUS_PENDING if the irp cannot be completed immediately.
  645. Arguments:
  646. DeviceObject is the device whose data block is being queried
  647. Irp is the Irp that makes this request
  648. GuidIndex is the index into the list of guids provided when the
  649. device registered
  650. InstanceIndex is the index that denotes which instance of the data block
  651. is being set.
  652. DataItemId has the id of the data item being set
  653. BufferSize has the size of the data item passed
  654. Buffer has the new values for the data item
  655. Return Value:
  656. status
  657. --*/
  658. typedef
  659. NTSTATUS
  660. (*PEXECUTE_WMI_METHOD) (
  661. IN PDEVICE_OBJECT DeviceObject,
  662. IN PIRP Irp,
  663. IN ULONG GuidIndex,
  664. IN ULONG InstanceIndex,
  665. IN ULONG MethodId,
  666. IN ULONG InBufferSize,
  667. IN ULONG OutBufferSize,
  668. IN OUT PUCHAR Buffer
  669. );
  670. /*++
  671. Routine Description:
  672. This routine is a callback into the driver to execute a method. When the
  673. driver has finished filling the data block it must call
  674. IoWMICompleteRequest to complete the irp. The driver can
  675. return STATUS_PENDING if the irp cannot be completed immediately.
  676. Arguments:
  677. DeviceObject is the device whose data block is being queried
  678. Irp is the Irp that makes this request
  679. GuidIndex is the index into the list of guids provided when the
  680. device registered
  681. InstanceIndex is the index that denotes which instance of the data block
  682. is being called.
  683. MethodId has the id of the method being called
  684. InBufferSize has the size of the data block passed in as the input to
  685. the method.
  686. OutBufferSize on entry has the maximum size available to write the
  687. returned data block.
  688. Buffer on entry has the input data block and on return has the output
  689. output data block.
  690. Return Value:
  691. status
  692. --*/
  693. typedef enum
  694. {
  695. WmiEventGeneration,
  696. WmiDataBlockCollection
  697. } WMIENABLEDISABLEFUNCTION;
  698. typedef
  699. NTSTATUS
  700. (*PWMI_FUNCTION_CONTROL) (
  701. IN PDEVICE_OBJECT DeviceObject,
  702. IN PIRP Irp,
  703. IN ULONG GuidIndex,
  704. IN WMIENABLEDISABLEFUNCTION Function,
  705. IN BOOLEAN Enable
  706. );
  707. /*++
  708. Routine Description:
  709. This routine is a callback into the driver to enabled or disable event
  710. generation or data block collection. A device should only expect a
  711. single enable when the first event or data consumer enables events or
  712. data collection and a single disable when the last event or data
  713. consumer disables events or data collection. Data blocks will only
  714. receive collection enable/disable if they were registered as requiring
  715. it.
  716. Arguments:
  717. DeviceObject is the device whose data block is being queried
  718. GuidIndex is the index into the list of guids provided when the
  719. device registered
  720. Function specifies which functionality is being enabled or disabled
  721. Enable is TRUE then the function is being enabled else disabled
  722. Return Value:
  723. status
  724. --*/
  725. typedef struct _WMILIB_INFO
  726. {
  727. //
  728. // Next device lower in the stack
  729. PDEVICE_OBJECT LowerDeviceObject;
  730. //
  731. // PDO associated with device
  732. PDEVICE_OBJECT LowerPDO;
  733. //
  734. // WMI data block guid registration info
  735. ULONG GuidCount;
  736. PGUIDREGINFO GuidList;
  737. //
  738. // WMI functionality callbacks
  739. PQUERY_WMI_REGINFO QueryWmiRegInfo;
  740. PQUERY_WMI_DATABLOCK QueryWmiDataBlock;
  741. PSET_WMI_DATABLOCK SetWmiDataBlock;
  742. PSET_WMI_DATAITEM SetWmiDataItem;
  743. PEXECUTE_WMI_METHOD ExecuteWmiMethod;
  744. PWMI_FUNCTION_CONTROL WmiFunctionControl;
  745. } WMILIB_INFO, *PWMILIB_INFO;
  746. NTSTATUS
  747. IoWMICompleteRequest(
  748. IN PWMILIB_INFO WmiLibInfo,
  749. IN PDEVICE_OBJECT DeviceObject,
  750. IN PIRP Irp,
  751. IN NTSTATUS Status,
  752. IN ULONG BufferUsed,
  753. IN CCHAR PriorityBoost
  754. );
  755. NTSTATUS
  756. IoWMISystemControl(
  757. IN PWMILIB_INFO WmiLibInfo,
  758. IN PDEVICE_OBJECT DeviceObject,
  759. IN PIRP Irp
  760. );
  761. NTSTATUS
  762. IoWMIFireEvent(
  763. IN PWMILIB_INFO WmiLibInfo,
  764. IN PDEVICE_OBJECT DeviceObject,
  765. IN ULONG GuidIndex,
  766. IN ULONG EventDataSize,
  767. IN PVOID EventData
  768. );
  769. NTSTATUS IoWMIRegistrationControl(
  770. IN PDEVICE_OBJECT DeviceObject,
  771. IN ULONG Action
  772. );
  773. NTSTATUS IoWMIWriteEvent(
  774. IN PVOID WnodeEventItem
  775. );
  776. // ds.c
  777. extern GUID GUID_REGISTRATION_CHANGE_NOTIFICATION;
  778. extern GUID GUID_MOF_RESOURCE_ADDED_NOTIFICATION;
  779. extern GUID GUID_MOF_RESOURCE_REMOVED_NOTIFICATION;
  780. NTSTATUS WmipEnumerateMofResources(
  781. PWMIMOFLIST MofList,
  782. ULONG BufferSize,
  783. ULONG *RetSize
  784. );
  785. NTSTATUS WmipInitializeDataStructs(
  786. void
  787. );
  788. NTSTATUS WmipRemoveDataSource(
  789. PREGENTRY RegEntry
  790. );
  791. NTSTATUS WmipUpdateDataSource(
  792. PREGENTRY RegEntry,
  793. PWMIREGINFOW RegistrationInfo,
  794. ULONG RetSize
  795. );
  796. NTSTATUS WmipAddDataSource(
  797. IN PREGENTRY RegEntry,
  798. IN PWMIREGINFOW WmiRegInfo,
  799. IN ULONG BufferSize,
  800. IN PWCHAR RegPath,
  801. IN PWCHAR ResourceName,
  802. IN PWMIGUIDOBJECT RequestObject,
  803. IN BOOLEAN IsUserMode
  804. );
  805. #define WmiInsertTimestamp(WnodeHeader) KeQuerySystemTime(&(WnodeHeader)->TimeStamp)
  806. // consumer.c
  807. NTSTATUS WmipMarkHandleAsClosed(
  808. HANDLE Handle
  809. );
  810. NTSTATUS WmipUMProviderCallback(
  811. IN WMIACTIONCODE ActionCode,
  812. IN PVOID DataPath,
  813. IN ULONG BufferSize,
  814. IN OUT PVOID Buffer
  815. );
  816. NTSTATUS WmipOpenBlock(
  817. IN ULONG Ioctl,
  818. IN KPROCESSOR_MODE AccessMode,
  819. IN POBJECT_ATTRIBUTES ObjectAttributes,
  820. IN ULONG DesiredAccess,
  821. OUT PHANDLE Handle
  822. );
  823. NTSTATUS WmipQueryAllData(
  824. IN PWMIGUIDOBJECT GuidObject,
  825. IN PIRP Irp,
  826. IN KPROCESSOR_MODE AccessMode,
  827. IN PWNODE_ALL_DATA Wnode,
  828. IN ULONG OutBufferLen,
  829. OUT PULONG RetSize
  830. );
  831. NTSTATUS WmipQueryAllDataMultiple(
  832. IN ULONG ObjectCount,
  833. IN PWMIGUIDOBJECT *ObjectList,
  834. IN PIRP Irp,
  835. IN KPROCESSOR_MODE AccessMode,
  836. IN OUT PUCHAR BufferPtr,
  837. IN ULONG BufferSize,
  838. IN PWMIQADMULTIPLE QadMultiple,
  839. OUT ULONG *ReturnSize
  840. );
  841. NTSTATUS WmipQuerySingleMultiple(
  842. IN PIRP Irp,
  843. IN KPROCESSOR_MODE AccessMode,
  844. IN OUT PUCHAR BufferPtr,
  845. IN ULONG BufferSize,
  846. IN PWMIQSIMULTIPLE QsiMultiple,
  847. IN ULONG QueryCount,
  848. IN PWMIGUIDOBJECT *ObjectList,
  849. IN PUNICODE_STRING InstanceNames,
  850. OUT ULONG *ReturnSize
  851. );
  852. NTSTATUS WmipQuerySetExecuteSI(
  853. IN PWMIGUIDOBJECT GuidObject,
  854. IN PIRP Irp,
  855. IN KPROCESSOR_MODE AccessMode,
  856. IN UCHAR MinorFunction,
  857. IN OUT PWNODE_HEADER Wnode,
  858. IN ULONG OutBufferSize,
  859. OUT PULONG RetSize
  860. );
  861. NTSTATUS WmipEnumerateGuids(
  862. ULONG Ioctl,
  863. PWMIGUIDLISTINFO GuidList,
  864. ULONG MaxBufferSize,
  865. ULONG *OutBufferSize
  866. );
  867. NTSTATUS WmipProcessEvent(
  868. PWNODE_HEADER Wnode,
  869. BOOLEAN IsHiPriority,
  870. BOOLEAN FreeBuffer
  871. );
  872. NTSTATUS WmipQueryGuidInfo(
  873. IN OUT PWMIQUERYGUIDINFO QueryGuidInfo
  874. );
  875. NTSTATUS WmipReceiveNotifications(
  876. PWMIRECEIVENOTIFICATION ReceiveNotification,
  877. PULONG OutBufferSize,
  878. PIRP Irp
  879. );
  880. void WmipClearIrpObjectList(
  881. PIRP Irp
  882. );
  883. NTSTATUS WmipWriteWnodeToObject(
  884. PWMIGUIDOBJECT Object,
  885. PWNODE_HEADER Wnode,
  886. BOOLEAN IsHighPriority
  887. );
  888. NTSTATUS WmipRegisterUMGuids(
  889. IN POBJECT_ATTRIBUTES ObjectAttributes,
  890. IN ULONG Cookie,
  891. IN PWMIREGINFO RegInfo,
  892. IN ULONG RegInfoSize,
  893. OUT PTRACEGUIDMAP TraceGuidMap,
  894. IN ULONG GuidCount,
  895. OUT HANDLE *RequestHandle,
  896. OUT ULONG64 *LoggerContext
  897. );
  898. NTSTATUS WmipUnregisterGuids(
  899. PWMIUNREGGUIDS UnregGuids
  900. );
  901. NTSTATUS WmipCreateUMLogger(
  902. IN OUT PWMICREATEUMLOGGER CreateInfo
  903. );
  904. NTSTATUS WmipMBReply(
  905. IN HANDLE RequestHandle,
  906. IN ULONG ReplyIndex,
  907. IN PUCHAR Message,
  908. IN ULONG MessageSize
  909. );
  910. void WmipClearObjectFromThreadList(
  911. PWMIGUIDOBJECT Object
  912. );
  913. // enabdisa.c
  914. #define WmipIsControlGuid(GuidEntry) WmipIsISFlagsSet(GuidEntry, (IS_TRACED | IS_CONTROL_GUID))
  915. #define WmipIsTraceGuid(GuidEntry) WmipIsISFlagsSet(GuidEntry, IS_TRACED)
  916. BOOLEAN
  917. WmipIsISFlagsSet(
  918. PBGUIDENTRY GuidEntry,
  919. ULONG Flags
  920. );
  921. NTSTATUS WmipDisableCollectOrEvent(
  922. PBGUIDENTRY GuidEntry,
  923. ULONG Ioctl,
  924. ULONG64 LoggerContext
  925. );
  926. NTSTATUS WmipEnableCollectOrEvent(
  927. PBGUIDENTRY GuidEntry,
  928. ULONG Ioctl,
  929. BOOLEAN *RequestSent,
  930. ULONG64 LoggerContext
  931. );
  932. NTSTATUS WmipEnableDisableTrace(
  933. ULONG Ioctl,
  934. PWMITRACEENABLEDISABLEINFO TraceEnableInfo
  935. );
  936. NTSTATUS WmipDeliverWnodeToDS(
  937. CHAR ActionCode,
  938. PBDATASOURCE DataSource,
  939. PWNODE_HEADER Wnode,
  940. ULONG BufferSize
  941. );
  942. ULONG WmipDoDisableRequest(
  943. PBGUIDENTRY GuidEntry,
  944. BOOLEAN IsEvent,
  945. BOOLEAN IsTraceLog,
  946. ULONG64 LoggerContext,
  947. ULONG InProgressFlag
  948. );
  949. void WmipReleaseCollectionEnabled(
  950. PBGUIDENTRY GuidEntry
  951. );
  952. NTSTATUS
  953. WmipDisableTraceProviders (
  954. ULONG StopLoggerId,
  955. PLIST_ENTRY GMHeadPtr
  956. );
  957. // register.c
  958. extern KSPIN_LOCK WmipRegistrationSpinLock;
  959. extern LIST_ENTRY WmipInUseRegEntryHead;
  960. extern ULONG WmipInUseRegEntryCount;
  961. extern KMUTEX WmipRegistrationMutex;
  962. extern const GUID WmipDataProviderPnpidGuid;
  963. extern const GUID WmipDataProviderPnPIdInstanceNamesGuid;
  964. #if DBG
  965. #define WmipReferenceRegEntry(RegEntry) { \
  966. InterlockedIncrement(&(RegEntry)->RefCount); \
  967. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, \
  968. "WMI: Ref RegEntry %p -> 0x%x in %s line %d\n", \
  969. (RegEntry), (RegEntry)->RefCount, __FILE__, __LINE__)); \
  970. }
  971. #else
  972. #define WmipReferenceRegEntry(RegEntry) InterlockedIncrement(&(RegEntry)->RefCount)
  973. #endif
  974. PREGENTRY WmipAllocRegEntry(
  975. PDEVICE_OBJECT DeviceObject,
  976. ULONG Flags
  977. );
  978. void WmipTranslatePDOInstanceNames(
  979. IN OUT PIRP Irp,
  980. IN UCHAR MinorFunction,
  981. IN ULONG BufferSize,
  982. IN OUT PREGENTRY RegEntry
  983. );
  984. void WmipInitializeRegistration(
  985. ULONG Phase
  986. );
  987. NTSTATUS WmipRegisterDevice(
  988. PDEVICE_OBJECT DeviceObject,
  989. ULONG RegistrationFlag
  990. );
  991. NTSTATUS WmipDeregisterDevice(
  992. PDEVICE_OBJECT DeviceObject
  993. );
  994. NTSTATUS WmipUpdateRegistration(
  995. PDEVICE_OBJECT DeviceObject
  996. );
  997. #if DBG
  998. #define WmipUnreferenceRegEntry(RegEntry) { \
  999. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, \
  1000. "WMI: UnRef RegEntry %p -> 0x%x in %s line %d\n", \
  1001. (RegEntry), (RegEntry)->RefCount, __FILE__, __LINE__)); \
  1002. WmipDoUnreferenceRegEntry(RegEntry); \
  1003. }
  1004. #else
  1005. #define WmipUnreferenceRegEntry WmipDoUnreferenceRegEntry
  1006. #endif
  1007. BOOLEAN WmipDoUnreferenceRegEntry(
  1008. PREGENTRY RegEntry
  1009. );
  1010. PREGENTRY WmipFindRegEntryByDevice(
  1011. PDEVICE_OBJECT DeviceObject,
  1012. BOOLEAN ReferenceIrp
  1013. );
  1014. PREGENTRY WmipDoFindRegEntryByDevice(
  1015. PDEVICE_OBJECT DeviceObject,
  1016. ULONG InvalidFlags
  1017. );
  1018. #if defined(_WIN64)
  1019. PREGENTRY WmipDoFindRegEntryByProviderId(
  1020. ULONG ProviderId,
  1021. ULONG InvalidFlags
  1022. );
  1023. PREGENTRY WmipFindRegEntryByProviderId(
  1024. ULONG ProviderId,
  1025. BOOLEAN ReferenceIrp
  1026. );
  1027. #else
  1028. #define WmipFindRegEntryByProviderId(ProviderId, ReferenceIrp) \
  1029. WmipFindRegEntryByDevice( (PDEVICE_OBJECT)(ProviderId) , (ReferenceIrp) )
  1030. #define WmipDeviceObjectToProviderId(DeviceObject) ((ULONG)(DeviceObject))
  1031. #define WmipDoFindRegEntryByProviderId(ProviderId, InvalidFlags) \
  1032. WmipDoFindRegEntryByDevice((PDEVICE_OBJECT)(ProviderId), InvalidFlags)
  1033. #endif
  1034. void WmipDecrementIrpCount(
  1035. IN PREGENTRY RegEntry
  1036. );
  1037. NTSTATUS WmipPDOToDeviceInstanceName(
  1038. IN PDEVICE_OBJECT PDO,
  1039. OUT PUNICODE_STRING DeviceInstanceName
  1040. );
  1041. NTSTATUS WmipValidateWmiRegInfoString(
  1042. PWMIREGINFO WmiRegInfo,
  1043. ULONG BufferSize,
  1044. ULONG Offset,
  1045. PWCHAR *String
  1046. );
  1047. NTSTATUS WmipProcessWmiRegInfo(
  1048. IN PREGENTRY RegEntry,
  1049. IN PWMIREGINFO WmiRegInfo,
  1050. IN ULONG BufferSize,
  1051. IN PWMIGUIDOBJECT RequestObject,
  1052. IN BOOLEAN Update,
  1053. IN BOOLEAN IsUserMode
  1054. );
  1055. //
  1056. // from notify.c
  1057. extern WORK_QUEUE_ITEM WmipEventWorkQueueItem;
  1058. extern LIST_ENTRY WmipNPEvent;
  1059. extern KSPIN_LOCK WmipNPNotificationSpinlock;
  1060. extern LONG WmipEventWorkItems;
  1061. extern ULONG WmipNSAllocCount, WmipNSAllocMax;
  1062. #if DBG
  1063. extern ULONG WmipNPAllocFail;
  1064. #endif
  1065. void WmipInitializeNotifications(
  1066. void
  1067. );
  1068. void WmipEventNotification(
  1069. PVOID Context
  1070. );
  1071. BOOLEAN WmipIsValidRegEntry(
  1072. PREGENTRY CheckRegEntry
  1073. );
  1074. //
  1075. // from wmi.c
  1076. extern ULONG WmipMaxKmWnodeEventSize;
  1077. extern UNICODE_STRING WmipRegistryPath;
  1078. NTSTATUS
  1079. WmipDriverEntry(
  1080. IN PDRIVER_OBJECT DriverObject,
  1081. IN PUNICODE_STRING RegistryPath
  1082. );
  1083. void WmipUpdateDeviceStackSize(
  1084. CCHAR NewStackSize
  1085. );
  1086. NTSTATUS WmipForwardWmiIrp(
  1087. PIRP Irp,
  1088. UCHAR MinorFunction,
  1089. ULONG ProviderId,
  1090. PVOID DataPath,
  1091. ULONG BufferLength,
  1092. PVOID Buffer
  1093. );
  1094. NTSTATUS WmipSendWmiIrp(
  1095. UCHAR MinorFunction,
  1096. ULONG ProviderId,
  1097. PVOID DataPath,
  1098. ULONG BufferLength,
  1099. PVOID Buffer,
  1100. PIO_STATUS_BLOCK Iosb
  1101. );
  1102. NTSTATUS WmipGetDevicePDO(
  1103. PDEVICE_OBJECT DeviceObject,
  1104. PDEVICE_OBJECT *PDO
  1105. );
  1106. NTSTATUS WmipProbeWmiOpenGuidBlock(
  1107. POBJECT_ATTRIBUTES CapturedObjectAttributes,
  1108. PUNICODE_STRING CapturedGuidString,
  1109. PWCHAR CapturedGuidBuffer,
  1110. PULONG DesiredAccess,
  1111. PWMIOPENGUIDBLOCK InBlock,
  1112. ULONG InBufferLen,
  1113. ULONG OutBufferLen
  1114. );
  1115. NTSTATUS WmipProbeAndCaptureGuidObjectAttributes(
  1116. POBJECT_ATTRIBUTES CapturedObjectAttributes,
  1117. PUNICODE_STRING CapturedGuidString,
  1118. PWCHAR CapturedGuidBuffer,
  1119. POBJECT_ATTRIBUTES ObjectAttributes
  1120. );
  1121. NTSTATUS WmipTranslateFileHandle(
  1122. IN OUT PWMIFHTOINSTANCENAME FhToInstanceName,
  1123. IN OUT PULONG OutBufferLen,
  1124. IN HANDLE FileHandle,
  1125. IN PDEVICE_OBJECT DeviceObject,
  1126. IN PWMIGUIDOBJECT GuidObject,
  1127. OUT PUNICODE_STRING InstanceNameString
  1128. );
  1129. //
  1130. // from smbios.c
  1131. BOOLEAN WmipFindSMBiosTable(
  1132. PPHYSICAL_ADDRESS SMBiosTablePhysicalAddress,
  1133. PUCHAR *SMBiosTableVirtualAddress,
  1134. PULONG SMBiosTableLength,
  1135. PSMBIOSVERSIONINFO SMBiosVersionInfo
  1136. );
  1137. NTSTATUS WmipGetSMBiosTableData(
  1138. PUCHAR Buffer,
  1139. PULONG BufferSize,
  1140. OUT PSMBIOSVERSIONINFO SMBiosVersionInfo
  1141. );
  1142. NTSTATUS
  1143. WmipDockUndockEventCallback(
  1144. IN PVOID NoificationStructure,
  1145. IN PVOID Context
  1146. );
  1147. NTSTATUS WmipGetSysIds(
  1148. PSYSID_UUID *SysIdUuid,
  1149. ULONG *SysIdUuidCount,
  1150. PSYSID_1394 *SysId1394,
  1151. ULONG *SysId1394Count
  1152. );
  1153. NTSTATUS WmipGetSMBiosEventlog(
  1154. PUCHAR Buffer,
  1155. PULONG BufferSize
  1156. );
  1157. void WmipGetSMBiosFromLoaderBlock(
  1158. PVOID LoaderBlockPtr
  1159. );
  1160. extern PHYSICAL_ADDRESS WmipSMBiosTablePhysicalAddress;
  1161. extern PUCHAR WmipSMBiosTableVirtualAddress;
  1162. extern ULONG WmipSMBiosTableLength;
  1163. //
  1164. // from dataprov.c
  1165. extern const WMILIB_INFO WmipWmiLibInfo;
  1166. // from secure.c
  1167. #ifndef MEMPHIS
  1168. extern POBJECT_TYPE WmipGuidObjectType;
  1169. NTSTATUS WmipInitializeSecurity(
  1170. void
  1171. );
  1172. NTSTATUS WmipOpenGuidObject(
  1173. IN POBJECT_ATTRIBUTES ObjectAttributes,
  1174. IN ACCESS_MASK DesiredAccess,
  1175. IN KPROCESSOR_MODE AccessMode,
  1176. OUT PHANDLE Handle,
  1177. OUT PWMIGUIDOBJECT *ObjectPtr
  1178. );
  1179. NTSTATUS
  1180. WmipCheckGuidAccess(
  1181. IN LPGUID Guid,
  1182. IN ACCESS_MASK DesiredAccess
  1183. );
  1184. // from mca.c
  1185. extern ULONG WmipRawMCASize;
  1186. extern PMCA_EXCEPTION WmipRawMCA;
  1187. extern ULONG WmipCpePollInterval;
  1188. NTSTATUS WmipRegisterMcaHandler(
  1189. ULONG Phase
  1190. );
  1191. NTSTATUS WmipGetRawMCAInfo(
  1192. OUT PUCHAR Buffer,
  1193. IN OUT PULONG BufferSize
  1194. );
  1195. #ifdef GENERATE_MCA
  1196. extern GUID WmipGenerateMCEGuid;
  1197. NTSTATUS WmipGenerateMCE(
  1198. IN ULONG Id
  1199. );
  1200. #endif
  1201. void WmipGenerateMCAEventlog(
  1202. PUCHAR ErrorLog,
  1203. ULONG ErrorLogSize,
  1204. BOOLEAN IsFatal
  1205. );
  1206. #ifdef CPE_CONTROL
  1207. NTSTATUS WmipSetCPEPolling(
  1208. IN BOOLEAN Enabled,
  1209. IN ULONG Interval
  1210. );
  1211. #endif
  1212. //
  1213. // From tracelog
  1214. //
  1215. typedef struct _tagWMI_Event {
  1216. WNODE_HEADER Wnode;
  1217. NTSTATUS Status;
  1218. ULONG TraceErrorFlag;
  1219. } WMI_TRACE_EVENT, *PWMI_TRACE_EVENT;
  1220. // From Traceapi.c, the Ioctl interface to TraceMessage
  1221. NTSTATUS
  1222. FASTCALL
  1223. WmiTraceUserMessage(
  1224. IN PMESSAGE_TRACE_USER pMessage,
  1225. IN ULONG MessageSize
  1226. );
  1227. #endif
  1228. #endif // _WMIKMP_