Skip to content

Windows support broken #19

@gvanem

Description

@gvanem

Hello. I just discovered this project.

But trying to build for _WIN32 is broken at the moment. Seems it has never worked.
Several issues:

  • Use of std::vector w/o an #include <vector>
  • Signature should be signature.
  • getDMI() should be called get_dmi_data()
  • etc.

So with this patch it works for MSVC and clang-cl:

--- a/smbios_decode.c 2024-12-13 01:43:15
+++ b/smbios_decode.c 2025-09-13 07:25:05
@@ -24,22 +24,24 @@

 #include <Windows.h>

-static bool getDMI( std::vector<uint8_t> &buffer )
+static bool get_dmi_data( uint8_t **buffer, size_t *size )
 {
     const BYTE byteSignature[] = { 'B', 'M', 'S', 'R' };
     const DWORD signature = *((DWORD*)byteSignature);

     // get the size of SMBIOS table
-    DWORD size = GetSystemFirmwareTable(signature, 0, NULL, 0);
-    if (size == 0) return false;
-    buffer.resize(size, 0);
+    *size = GetSystemFirmwareTable(signature, 0, NULL, 0);
+    if (*size == 0)
+       return false;
+
+    *buffer = (uint8_t*) malloc(*size);
+    if (*buffer == NULL)
+        return false;
+
     // retrieve the SMBIOS table

-    if (size != GetSystemFirmwareTable(Signature, 0, buffer.data(), size))
-    {
-        buffer.clear();
+    if (*size != GetSystemFirmwareTable(signature, 0, *buffer, *size))
         return false;
-    }

     return true;
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions