Guest User

Untitled

a guest
Sep 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <wmiguid.h>
  2.  
  3. NTSTATUS status;
  4. GUID smbiosGUID = SMBIOS_DATA_GUID; // defined in wmiguid.h
  5. PVOID wmiObject = NULL;
  6. PWNODE_ALL_DATA dataBuffer;
  7.  
  8. //
  9. // Get a WMI block handle to the SMBIOS_DATA_GUID
  10. //
  11. status = IoWMIOpenBlock( (GUID *) &smbiosGUID, WMIGUID_QUERY,
  12. &wmiObject );
  13.  
  14. if (!NT_SUCCESS(status)) {
  15. return status;
  16. }
  17.  
  18. //
  19. // Determine how much space is required for the data
  20. //
  21. status = IoWMIQueryAllData( wmiObject, &bufferSize, NULL );
  22. if (status != STATUS_BUFFER_TOO_SMALL) {
  23. ObDereferenceObject( wmiObject );
  24. return status;
  25. }
  26.  
  27. //
  28. // Allocate the necessary storage. This space must come out of NP-pool
  29. //
  30. dataBuffer = ExAllocatePoolWithTag(NonPagedPool, bufferSize, TAG_SMBIOS);
  31. if (dataBuffer == NULL) {
  32. ObDereferenceObject( wmiObject );
  33. return STATUS_INSUFFICIENT_RESOURCES;
  34. }
Add Comment
Please, Sign In to add comment