Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <wmiguid.h>
- NTSTATUS status;
- GUID smbiosGUID = SMBIOS_DATA_GUID; // defined in wmiguid.h
- PVOID wmiObject = NULL;
- PWNODE_ALL_DATA dataBuffer;
- //
- // Get a WMI block handle to the SMBIOS_DATA_GUID
- //
- status = IoWMIOpenBlock( (GUID *) &smbiosGUID, WMIGUID_QUERY,
- &wmiObject );
- if (!NT_SUCCESS(status)) {
- return status;
- }
- //
- // Determine how much space is required for the data
- //
- status = IoWMIQueryAllData( wmiObject, &bufferSize, NULL );
- if (status != STATUS_BUFFER_TOO_SMALL) {
- ObDereferenceObject( wmiObject );
- return status;
- }
- //
- // Allocate the necessary storage. This space must come out of NP-pool
- //
- dataBuffer = ExAllocatePoolWithTag(NonPagedPool, bufferSize, TAG_SMBIOS);
- if (dataBuffer == NULL) {
- ObDereferenceObject( wmiObject );
- return STATUS_INSUFFICIENT_RESOURCES;
- }
Add Comment
Please, Sign In to add comment