Leaked source code of windows server 2003
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.

686 lines
19 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 _WMIUMDS_
  13. #define _WMIUMDS_
  14. //
  15. // Define this to track reference counts
  16. //#define TRACK_REFERNECES
  17. #include <wchar.h>
  18. extern const GUID WmipBinaryMofGuid;
  19. extern const GUID RegChangeNotificationGuid;
  20. //
  21. // Chunk Management definitions
  22. // All structures that rely upon the chunk allocator must be defined so that
  23. // their members match that of ENTRYHEADER. These include DATASOURCE,
  24. // GUIDENTRY, INSTANCESET, DCENTRY, NOTIFICATIONENTRY, MOFCLASS, MOFRESOURCE
  25. // Also ENTRYHEADER reserves 0x80000000 for its own flag.
  26. struct _CHUNKINFO;
  27. struct _ENTRYHEADER;
  28. typedef void (*ENTRYCLEANUP)(
  29. struct _CHUNKINFO *,
  30. struct _ENTRYHEADER *
  31. );
  32. typedef struct _CHUNKINFO
  33. {
  34. LIST_ENTRY ChunkHead; // Head of list of chunks
  35. ULONG EntrySize; // Size of a single entry
  36. ULONG EntriesPerChunk; // Number of entries per chunk allocation
  37. ENTRYCLEANUP EntryCleanup; // Entry cleanup routine
  38. ULONG InitialFlags; // Initial flags for all entries
  39. ULONG Signature;
  40. #if DBG
  41. LONG AllocCount;
  42. LONG FreeCount;
  43. #endif
  44. } CHUNKINFO, *PCHUNKINFO;
  45. typedef struct
  46. {
  47. LIST_ENTRY ChunkList; // Node in list of chunks
  48. LIST_ENTRY FreeEntryHead; // Head of list of free entries in chunk
  49. ULONG EntriesInUse; // Count of entries being used
  50. } CHUNKHEADER, *PCHUNKHEADER;
  51. typedef struct _ENTRYHEADER
  52. {
  53. union
  54. {
  55. LIST_ENTRY FreeEntryList; // Node in list of free entries
  56. LIST_ENTRY InUseEntryList; // Node in list ofin use entries
  57. };
  58. PCHUNKHEADER Chunk; // Chunk in which entry is located
  59. ULONG Flags; // Flags
  60. LONG RefCount; // Reference Count
  61. ULONG Signature;
  62. } ENTRYHEADER, *PENTRYHEADER;
  63. // Set if the entry is free
  64. #define FLAG_ENTRY_ON_FREE_LIST 0x80000000
  65. #define FLAG_ENTRY_ON_INUSE_LIST 0x40000000
  66. #define FLAG_ENTRY_INVALID 0x20000000
  67. #define FLAG_ENTRY_REMOVE_LIST 0x10000000
  68. #define WmipReferenceEntry(Entry) \
  69. InterlockedIncrement(&((PENTRYHEADER)(Entry))->RefCount)
  70. // chunk.c
  71. ULONG WmipUnreferenceEntry(
  72. PCHUNKINFO ChunkInfo,
  73. PENTRYHEADER Entry);
  74. PENTRYHEADER WmipAllocEntry(
  75. PCHUNKINFO ChunkInfo
  76. );
  77. void WmipFreeEntry(
  78. PCHUNKINFO ChunkInfo,
  79. PENTRYHEADER Entry
  80. );
  81. PWCHAR WmipCountedToSz(
  82. PWCHAR Counted
  83. );
  84. struct tagGUIDENTRY;
  85. typedef struct tagGUIDENTRY GUIDENTRY, *PGUIDENTRY, *PBGUIDENTRY;
  86. //
  87. // An INSTANCESET contains the information a set of instances that is provided
  88. // by a single data source. An instance set is part of two lists. One list is
  89. // the set of instance sets for a particular guid. The other list is the list
  90. // of instance sets supported by a data source.
  91. //
  92. //
  93. // Instance names for an instance set registered with a base name and count
  94. // are stored in a ISBASENAME structure. This structure is tracked by
  95. // PDFISBASENAME in wmicore.idl.
  96. typedef struct
  97. {
  98. ULONG BaseIndex; // First index to append to base name
  99. WCHAR BaseName[1]; // Actual base name
  100. } ISBASENAME, *PISBASENAME, *PBISBASENAME;
  101. //
  102. // This defines the maximum number of characters that can be part of a suffix
  103. // to a basename. The current value of 6 will allow up to 999999 instances
  104. // of a guid with a static base name
  105. #define MAXBASENAMESUFFIXSIZE 6
  106. #define MAXBASENAMESUFFIXVALUE 999999
  107. #define BASENAMEFORMATSTRING L"%d"
  108. //
  109. // Instance names for an instance set registerd with a set of static names
  110. // are kept in a ISSTATICNAMES structure. This structure is tracked by
  111. // PDFISSTATICNAMES defined in wmicore.idl
  112. typedef struct
  113. {
  114. PWCHAR StaticNamePtr[1]; // pointers to static names
  115. // WCHAR StaticNames[1];
  116. } ISSTATICENAMES, *PISSTATICNAMES, *PBISSTATICNAMES;
  117. typedef struct tagInstanceSet
  118. {
  119. union
  120. {
  121. // Entry in list of instances within a guid
  122. LIST_ENTRY GuidISList;
  123. // Entry in main list of free instances
  124. LIST_ENTRY FreeISList;
  125. };
  126. PCHUNKHEADER Chunk; // Chunk in which entry is located
  127. ULONG Flags;
  128. // Reference count of number of guids using this instance set
  129. ULONG RefCount;
  130. // Signature to identify entry
  131. ULONG Signature;
  132. // Entry in list of instances within a data source
  133. LIST_ENTRY DSISList;
  134. // Back link to guid that this instance set is a member
  135. PBGUIDENTRY GuidEntry;
  136. // Back link to data source that this instance set is a member
  137. struct tagDATASOURCE *DataSource;
  138. // Count of instances in instance set
  139. ULONG Count;
  140. // Size needed to place all instance names in a WNODE_ALL_DATA
  141. ULONG WADInstanceNameSize;
  142. // ProviderId for the DS associated with this IS
  143. ULONG ProviderId;
  144. //
  145. // If IS_INSTANCE_BASENAME is set then IsBaseName pointe at instance base
  146. // name structure. Else if IS_INSTANCE_STATICNAME is set then
  147. // IsStaticNames points to static instance name list. If
  148. union
  149. {
  150. PBISBASENAME IsBaseName;
  151. PBISSTATICNAMES IsStaticNames;
  152. };
  153. } INSTANCESET, *PINSTANCESET, *PBINSTANCESET;
  154. #define IS_SIGNATURE 'SImW'
  155. //
  156. // Guid Map Entry List maintains the list of Guid and their maps.
  157. // Only those Guids that are Unregistered while a logger session is in
  158. // progress is kept in this list.
  159. // It is also used as a placeholder for InstanceIds. Trace Guid Registration
  160. // calls return a handle to a GUIDMAPENTRY which maintains the map and the
  161. // Instance Ids.
  162. //
  163. typedef struct tagTRACE_REG_INFO
  164. {
  165. ULONG RegistrationCookie;
  166. HANDLE InProgressEvent; // Registration is in Progress Event
  167. BOOLEAN EnabledState; // Indicates if this GUID is Enabled or not.
  168. PVOID NotifyRoutine;
  169. PVOID TraceCtxHandle;
  170. } TRACE_REG_INFO, *PTRACE_REG_INFO;
  171. typedef struct
  172. {
  173. LIST_ENTRY Entry;
  174. TRACEGUIDMAP GuidMap;
  175. ULONG InstanceId;
  176. ULONG64 LoggerContext;
  177. PTRACE_REG_INFO pControlGuidData;
  178. } GUIDMAPENTRY, *PGUIDMAPENTRY;
  179. //
  180. // These flags are also by the WMIINSTANCEINFO structure in wmicore.idl
  181. #define IS_INSTANCE_BASENAME 0x00000001
  182. #define IS_INSTANCE_STATICNAMES 0x00000002
  183. #define IS_EXPENSIVE 0x00000004 // set if collection must be enabled
  184. #define IS_COLLECTING 0x00000008 // set when collecting
  185. #define IS_KM_PROVIDER 0x00000080 // KM data provider
  186. #define IS_SM_PROVIDER 0x00000100 // Shared memory provider
  187. #define IS_UM_PROVIDER 0x00000200 // User mode provider
  188. #define IS_NEWLY_REGISTERED 0x00000800 // set if IS is registering
  189. //
  190. // Any traced guids are used for trace logging and not querying
  191. #define IS_TRACED 0x00001000
  192. // Set when events are enabled for instance set
  193. #define IS_ENABLE_EVENT 0x00002000
  194. // Set when events are enabled for instance set
  195. #define IS_ENABLE_COLLECTION 0x00004000
  196. // Set if guid is used only for firing events and not querying
  197. #define IS_EVENT_ONLY 0x00008000
  198. // Set if data provider for instance set is expecting ansi instsance names
  199. #define IS_ANSI_INSTANCENAMES 0x00010000
  200. // Set if instance names are originated from a PDO
  201. #define IS_PDO_INSTANCENAME 0x00020000
  202. // Set if a Traced Guid is also a Trace Control Guid
  203. #define IS_CONTROL_GUID 0x00080000
  204. #define IS_ON_FREE_LIST 0x80000000
  205. typedef struct tagGUIDENTRY
  206. {
  207. union
  208. {
  209. // Entry in list of all guids registered with WMI
  210. LIST_ENTRY MainGEList;
  211. // Entry in list of free guid entry blocks
  212. LIST_ENTRY FreeGEList;
  213. };
  214. PCHUNKHEADER Chunk; // Chunk in which entry is located
  215. ULONG Flags;
  216. // Count of number of data sources using this guid
  217. ULONG RefCount;
  218. // Signature to identify entry
  219. ULONG Signature;
  220. // Head of list of open objects to this guid
  221. LIST_ENTRY ObjectHead;
  222. // Count of InstanceSets headed by this guid
  223. ULONG ISCount;
  224. // Head of list of all instances for guid
  225. LIST_ENTRY ISHead;
  226. // Guid that represents data block
  227. GUID Guid;
  228. ULONG EventRefCount; // Global count of event enables
  229. ULONG CollectRefCount; // Global count of collection enables
  230. ULONG64 LoggerContext; // Logger context handle
  231. PWMI_LOGGER_INFORMATION LoggerInfo; // LoggerInfo. Used in case of Ntdll tracing
  232. PKEVENT CollectInProgress; // Event set when all collect complete
  233. } GUIDENTRY, *PGUIDENTRY, *PBGUIDENTRY;
  234. #define GE_SIGNATURE 'EGmW'
  235. #define GE_ON_FREE_LIST 0x80000000
  236. //
  237. // When set this guid is an internally defined guid that has no data source
  238. // attached to it.
  239. #define GE_FLAG_INTERNAL 0x00000001
  240. // Set when a notification request is being processed by the data providers
  241. #define GE_FLAG_NOTIFICATION_IN_PROGRESS 0x00000002
  242. // Set when a collection request is being processed by the data providers
  243. #define GE_FLAG_COLLECTION_IN_PROGRESS 0x00000004
  244. // Set when a trace disable is being processed by a worker thread
  245. #define GE_FLAG_TRACEDISABLE_IN_PROGRESS 0x00000008
  246. // Set when there is a wait in progress for collect/event enable/disable
  247. #define GE_FLAG_WAIT_ENABLED 0x00000010
  248. // Set when the guid has had an enable collection sent to it
  249. #define GE_FLAG_COLLECTION_ENABLED 0x00000020
  250. // Set when the guid has had an enable notifications sent to it
  251. #define GE_FLAG_NOTIFICATIONS_ENABLED 0x00000040
  252. #define GE_NOTIFICATION_TRACE_FLAG 0x00000080
  253. // Set when an enabled guid receives another enable notification
  254. #define GE_NOTIFICATION_TRACE_UPDATE 0x00000100
  255. typedef struct
  256. {
  257. union
  258. {
  259. // Entry in list of all DS
  260. LIST_ENTRY MainMRList;
  261. // Entry in list of free DS
  262. LIST_ENTRY FreeMRList;
  263. };
  264. PCHUNKHEADER Chunk; // Chunk in which entry is located
  265. ULONG Flags;
  266. ULONG RefCount;
  267. // Signature to identify entry
  268. ULONG Signature;
  269. PWCHAR RegistryPath; // Path to image file with resource
  270. PWCHAR MofResourceName; // Name of resource containing mof data
  271. } MOFRESOURCE, *PMOFRESOURCE;
  272. #define MR_SIGNATURE 'RMmW'
  273. //
  274. // This is a user mode resource so the RegistryPath is really an image path
  275. #define MR_FLAG_USER_MODE 0x00000001
  276. #if DBG
  277. #define AVGMOFRESOURCECOUNT 1
  278. #else
  279. #define AVGMOFRESOURCECOUNT 4
  280. #endif
  281. struct _WMIGUIDOBJECT;
  282. typedef struct tagDATASOURCE
  283. {
  284. union
  285. {
  286. // Entry in list of all DS
  287. LIST_ENTRY MainDSList;
  288. // Entry in list of free DS
  289. LIST_ENTRY FreeDSList;
  290. };
  291. PCHUNKHEADER Chunk; // Chunk in which entry is located
  292. ULONG Flags;
  293. ULONG RefCount;
  294. ULONG Signature;
  295. // Head of list of instances for this DS
  296. LIST_ENTRY ISHead;
  297. // Provider id of kernel mode driver
  298. ULONG ProviderId;
  299. // Path to registry holding ACLs
  300. PTCHAR RegistryPath;
  301. // Head of list of MofResources attached to data source
  302. ULONG MofResourceCount;
  303. PMOFRESOURCE *MofResources;
  304. PMOFRESOURCE StaticMofResources[AVGMOFRESOURCECOUNT];
  305. // Guid object if this is a UM provider
  306. struct _WMIGUIDOBJECT *RequestObject;
  307. };
  308. #define DS_SIGNATURE 'SDmW'
  309. #define VERIFY_DPCTXHANDLE(DsCtxHandle) \
  310. ( ((DsCtxHandle) == NULL) || \
  311. (((PBDATASOURCE)(DsCtxHandle))->Signature == DS_SIGNATURE) )
  312. typedef struct tagDATASOURCE DATASOURCE, *PDATASOURCE, *PBDATASOURCE;
  313. #define DS_ALLOW_ALL_ACCESS 0x00000001
  314. #define DS_KERNEL_MODE 0x00000002
  315. #define DS_USER_MODE 0x00000008
  316. #define DS_ON_FREE_LIST 0x80000000
  317. //
  318. // AVGGUIDSPERDS defines a guess as to the number of guids that get registered
  319. // by any data provider. It is used to allocate the buffer used to deliver
  320. // registration change notifications.
  321. #if DBG
  322. #define AVGGUIDSPERDS 2
  323. #else
  324. #define AVGGUIDSPERDS 256
  325. #endif
  326. //
  327. // Guid and InstanceSet cache
  328. #if DBG
  329. #define PTRCACHEGROWSIZE 2
  330. #else
  331. #define PTRCACHEGROWSIZE 64
  332. #endif
  333. typedef struct
  334. {
  335. LPGUID Guid;
  336. PBINSTANCESET InstanceSet;
  337. } PTRCACHE;
  338. typedef struct
  339. {
  340. ULONG ProviderId;
  341. ULONG Flags;
  342. ULONG InstanceCount;
  343. ULONG InstanceNameSize;
  344. PWCHAR **StaticNamePtr;
  345. ULONG BaseIndex;
  346. PWCHAR BaseName;
  347. } WMIINSTANCEINFO, *PWMIINSTANCEINFO;
  348. // TODO: Since these were copied from wmium.h, we actually need to mov
  349. // them someplace else so they aren't copied
  350. //extern GUID GUID_REGISTRATION_CHANGE_NOTIFICATION;
  351. //extern GUID_MOF_RESOURCE_ADDED_NOTIFICATION;
  352. //extern GUID_MOF_RESOURCE_REMOVED_NOTIFICATION;
  353. //
  354. // Location of built in MOF for the system
  355. //
  356. #define WMICOREIMAGEPATH L"advapi32.dll"
  357. #define WMICORERESOURCENAME L"MofResourceName"
  358. void WmipGenerateBinaryMofNotification(
  359. PBINSTANCESET BinaryMofInstanceSet,
  360. LPCGUID Guid
  361. );
  362. void WmipGenerateMofResourceNotification(
  363. LPWSTR ImagePath,
  364. LPWSTR ResourceName,
  365. LPCGUID Guid,
  366. ULONG ActionCode
  367. );
  368. //
  369. // alloc.c
  370. extern LIST_ENTRY WmipGEHead;
  371. extern PLIST_ENTRY WmipGEHeadPtr;
  372. extern CHUNKINFO WmipGEChunkInfo;
  373. extern LIST_ENTRY WmipDSHead;
  374. extern PLIST_ENTRY WmipDSHeadPtr;
  375. extern CHUNKINFO WmipDSChunkInfo;
  376. extern LIST_ENTRY WmipMRHead;
  377. extern PLIST_ENTRY WmipMRHeadPtr;
  378. extern CHUNKINFO WmipMRChunkInfo;
  379. extern CHUNKINFO WmipISChunkInfo;
  380. extern LIST_ENTRY WmipGMHead;
  381. extern PLIST_ENTRY WmipGMHeadPtr;
  382. #ifdef TRACK_REFERNECES
  383. #define WmipUnreferenceDS(DataSource) \
  384. { \
  385. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Unref DS %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), DataSource, DataSource->RefCount, __FILE__, __LINE__)); \
  386. WmipUnreferenceEntry(&WmipDSChunkInfo, (PENTRYHEADER)DataSource); \
  387. }
  388. #define WmipReferenceDS(DataSource) \
  389. { \
  390. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Ref DS %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), DataSource, DataSource->RefCount, __FILE__, __LINE__)); \
  391. WmipReferenceEntry((PENTRYHEADER)DataSource); \
  392. }
  393. #define WmipUnreferenceGE(GuidEntry) \
  394. { \
  395. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Unref GE %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), GuidEntry, GuidEntry->RefCount, __FILE__, __LINE__)); \
  396. WmipUnreferenceEntry(&WmipGEChunkInfo, (PENTRYHEADER)GuidEntry); \
  397. }
  398. #define WmipReferenceGE(GuidEntry) \
  399. { \
  400. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Ref GE %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), GuidEntry, GuidEntry->RefCount, __FILE__, __LINE__)); \
  401. WmipReferenceEntry((PENTRYHEADER)GuidEntry); \
  402. }
  403. #define WmipUnreferenceIS(InstanceSet) \
  404. { \
  405. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Unref IS %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), InstanceSet, InstanceSet->RefCount, __FILE__, __LINE__)); \
  406. WmipUnreferenceEntry(&WmipISChunkInfo, (PENTRYHEADER)InstanceSet); \
  407. }
  408. #define WmipReferenceIS(InstanceSet) \
  409. { \
  410. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Ref IS %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), InstanceSet, InstanceSet->RefCount, __FILE__, __LINE__)); \
  411. WmipReferenceEntry((PENTRYHEADER)InstanceSet); \
  412. }
  413. #define WmipUnreferenceMR(MofResource) \
  414. { \
  415. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Unref MR %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), MofResource, MofResource->RefCount, __FILE__, __LINE__)); \
  416. WmipUnreferenceEntry(&WmipMRChunkInfo, (PENTRYHEADER)MofResource); \
  417. }
  418. #define WmipReferenceMR(MofResource) \
  419. { \
  420. WmipDebugPrintEx((DPFLTR_WMICORE_ID, DPFLTR_INFO_LEVEL, "WMI: %p.%p Ref MR %p (%x) at %s %d\n", PsGetCurrentProcessId(), PsGetCurrentThreadId(), MofResource, MofResource->RefCount, __FILE__, __LINE__)); \
  421. WmipReferenceEntry((PENTRYHEADER)MofResource); \
  422. }
  423. #else
  424. #define WmipUnreferenceDS(DataSource) \
  425. WmipUnreferenceEntry(&WmipDSChunkInfo, (PENTRYHEADER)DataSource)
  426. #define WmipReferenceDS(DataSource) \
  427. WmipReferenceEntry((PENTRYHEADER)DataSource)
  428. #define WmipUnreferenceGE(GuidEntry) \
  429. WmipUnreferenceEntry(&WmipGEChunkInfo, (PENTRYHEADER)GuidEntry)
  430. #define WmipReferenceGE(GuidEntry) \
  431. WmipReferenceEntry((PENTRYHEADER)GuidEntry)
  432. #define WmipUnreferenceIS(InstanceSet) \
  433. WmipUnreferenceEntry(&WmipISChunkInfo, (PENTRYHEADER)InstanceSet)
  434. #define WmipReferenceIS(InstanceSet) \
  435. WmipReferenceEntry((PENTRYHEADER)InstanceSet)
  436. #define WmipUnreferenceDC(DataConsumer) \
  437. WmipUnreferenceEntry(&WmipDCChunkInfo, (PENTRYHEADER)DataConsumer)
  438. #define WmipReferenceDC(DataConsumer) \
  439. WmipReferenceEntry((PENTRYHEADER)DataConsumer)
  440. #define WmipUnreferenceMR(MofResource) \
  441. WmipUnreferenceEntry(&WmipMRChunkInfo, (PENTRYHEADER)MofResource)
  442. #define WmipReferenceMR(MofResource) \
  443. WmipReferenceEntry((PENTRYHEADER)MofResource)
  444. #endif
  445. PBDATASOURCE WmipAllocDataSource(
  446. void
  447. );
  448. PBGUIDENTRY WmipAllocGuidEntryX(
  449. ULONG Line,
  450. PCHAR File
  451. );
  452. #define WmipAllocGuidEntry() WmipAllocGuidEntryX(__LINE__, __FILE__)
  453. #define WmipAllocInstanceSet() ((PBINSTANCESET)WmipAllocEntry(&WmipISChunkInfo))
  454. #define WmipAllocMofResource() ((PMOFRESOURCE)WmipAllocEntry(&WmipMRChunkInfo))
  455. #define WmipAllocString(Size) \
  456. WmipAlloc((Size)*sizeof(WCHAR))
  457. #define WmipFreeString(Ptr) \
  458. WmipFree(Ptr)
  459. BOOLEAN WmipIsNumber(
  460. LPCWSTR String
  461. );
  462. #ifdef HEAPVALIDATION
  463. PVOID WmipAlloc(
  464. ULONG Size
  465. );
  466. PVOID WmipAllocWithTag(
  467. ULONG Size,
  468. ULONG Tag
  469. );
  470. void WmipFree(
  471. PVOID p
  472. );
  473. #else
  474. #define WmipAlloc(Size) \
  475. ExAllocatePoolWithTag(PagedPool, Size, 'pimW')
  476. #define WmipAllocWithTag(Size, Tag) \
  477. ExAllocatePoolWithTag(PagedPool, Size, Tag)
  478. #define WmipFree(Ptr) \
  479. ExFreePool(Ptr)
  480. #endif
  481. #define WmipAllocNP(Size) \
  482. ExAllocatePoolWithTag(NonPagedPool, Size, 'pimW')
  483. #define WmipAllocNPWithTag(Size, Tag) \
  484. ExAllocatePoolWithTag(NonPagedPool, Size, Tag)
  485. BOOLEAN WmipRealloc(
  486. PVOID *Buffer,
  487. ULONG CurrentSize,
  488. ULONG NewSize,
  489. BOOLEAN FreeOriginalBuffer
  490. );
  491. PBGUIDENTRY WmipFindGEByGuid(
  492. LPGUID Guid,
  493. BOOLEAN MakeTopOfList
  494. );
  495. PBDATASOURCE WmipFindDSByProviderId(
  496. ULONG_PTR ProviderId
  497. );
  498. PBINSTANCESET WmipFindISByGuid(
  499. PBDATASOURCE DataSource,
  500. GUID UNALIGNED *Guid
  501. );
  502. PMOFRESOURCE WmipFindMRByNames(
  503. LPCWSTR ImagePath,
  504. LPCWSTR MofResourceName
  505. );
  506. PBINSTANCESET WmipFindISinGEbyName(
  507. PBGUIDENTRY GuidEntry,
  508. PWCHAR InstanceName,
  509. PULONG InstanceIndex
  510. );
  511. // TODO: Implement this
  512. #define WmipReportEventLog(a,b,c,d,e,f,g)
  513. #endif