blob: aa50c00439902a5298f67662e73bf615255855d5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#pragma once
#include <windef.h>
#include <wmistr.h>
#include <assert.h>
/**
* The WmiOpenBlock function opens the WMI data block object for the specified WMI class.
*
* \param Guid Specifies the GUID for WMI class.
* \param DesiredAccess Specifies the desired access rights to the data block object.
* \param DataBlockHandle Pointer to a memory location where the routine returns a handle to the data block object.
* \return ULONG Successful or errant status.
*/
NTSYSAPI ULONG NTAPI
WmiOpenBlock(
_In_ LPCGUID Guid,
_In_ ACCESS_MASK DesiredAccess,
_Out_ PHANDLE DataBlockHandle);
/**
* The WmiQueryAllDataW function returns all WMI data blocks that implement a given WMI class (Unicode).
*
* \param DataBlockHandle Handle to a WMI data block object.
* \param BufferLength Pointer to a memory location that specifies the size of the buffer.
* \param Buffer Pointer to the buffer where the routine returns the WMI data.
* \return ULONG Successful or errant status.
*/
NTSYSAPI ULONG NTAPI
WmiQueryAllDataW(
_In_ HANDLE DataBlockHandle,
_Inout_ PULONG BufferLength,
_Out_writes_bytes_opt_(*BufferLength) PVOID Buffer);
/**
* The WmiCloseBlock function closes a WMI data block object.
*
* \param DataBlockHandle Handle to the data block object to be closed.
* \return ULONG Successful or errant status.
*/
NTSYSAPI ULONG NTAPI
WmiCloseBlock(
_In_ HANDLE DataBlockHandle);
static inline void ffCloseWmiBlock(HANDLE* hBlock) {
assert(hBlock);
if (*hBlock) {
WmiCloseBlock(*hBlock);
}
}
#define FF_AUTO_CLOSE_WMI_BLOCK __attribute__((cleanup(ffCloseWmiBlock)))
// MOF: https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/km/wmicore.mof
|