Skip to content

Feat: Rewritten Windows Bindings - #5

Open
Mahasvan wants to merge 67 commits into
mainfrom
feat/win-bindings-new
Open

Feat: Rewritten Windows Bindings#5
Mahasvan wants to merge 67 commits into
mainfrom
feat/win-bindings-new

Conversation

@Mahasvan

@Mahasvan Mahasvan commented Aug 1, 2026

Copy link
Copy Markdown
Owner

No description provided.

Comment on lines +21 to +23
typedef struct {
char values[WMI_MAX_FIELDS][WMI_FIELD_LEN];
} WmiRow;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be turned into a typedef without being encapsulated in a struct. Is there a specific reason for it to stay inside of a struct?

Also, I think you meant to do char values[WMI_FIELD_LEN][WMI_MAX_FIELDS]

@kernel-dev kernel-dev Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mahasvan please fix this as well: you meant to do values[WMI_FIELD_LEN][WMI_MAX_FIELDS]

Comment thread src/hwprobe/interops/win/src/wmi.cpp
Comment thread src/hwprobe/interops/win/src/wmi.cpp Outdated
Comment thread src/hwprobe/interops/win/include/wmi.h
Comment thread src/hwprobe/interops/win/src/wmi.cpp Outdated
Comment thread src/hwprobe/interops/win/src/wmi.cpp Outdated
Comment on lines +79 to +88
// VT_BSTR fast path.
if (bstr) {
int len = WideCharToMultiByte(CP_UTF8, 0, bstr, -1, nullptr, 0, nullptr, nullptr);
if (len > 0) {
if (len > dst_size) len = dst_size;
WideCharToMultiByte(CP_UTF8, 0, bstr, -1, dst, len, nullptr, nullptr);
dst[dst_size - 1] = '\0';
}
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it just be easier to move this into the initial if condition block?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently not, according to claude

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? It seems to be doing the exact same thing when analyzing control flow?

Comment thread src/hwprobe/interops/win/src/wmi.cpp
Comment thread src/hwprobe/interops/win/src/wmi.cpp Outdated
Comment thread src/hwprobe/interops/win/bindings/wmi.py
Comment thread src/hwprobe/interops/win/src/gpu_info.cpp Outdated
Comment thread src/hwprobe/interops/win/src/gpu_info.cpp Outdated
Comment thread src/hwprobe/interops/win/src/gpu_info.cpp Outdated
@Mahasvan
Mahasvan requested a review from kernel-dev August 9, 2026 18:58
Comment thread src/hwprobe/core/linux/graphics.py

@kernel-dev kernel-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to check this before, my bad on the oversight

Comment on lines +21 to +23
typedef struct {
char values[WMI_MAX_FIELDS][WMI_FIELD_LEN];
} WmiRow;

@kernel-dev kernel-dev Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mahasvan please fix this as well: you meant to do values[WMI_FIELD_LEN][WMI_MAX_FIELDS]

@Mahasvan
Mahasvan requested a balanced review from Copilot August 10, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mahasvan
Mahasvan dismissed kernel-dev’s stale review August 10, 2026 16:28

It's not nested in the way you think, this is the correct code 😅

Mahasvan and others added 18 commits August 10, 2026 22:05
Bug description: `display.py:68-73` + `README.md:122-129` +
`main.cpp:199`: 🔴 bug: EDID lookup key contradiction. The README states
`get_edid` matches on `pnp_device_id` (`MONITOR\SAMxxxx\{...}`) and
explicitly warns that passing the CCD `display_path` will return "not
found". But `display.py` passes `connector.display_path` first (the
`\\?\DISPLAY#...` path). The C++ `get_edid` (`display_info.cpp:229-230`)
does bidirectional substring matching against the SetupAPI `DevicePath`,
which is also `\\?\DISPLAY#...` format — so `display_path` is what
actually works, and the full `pnp_device_id` (`MONITOR\...`) does NOT
match (`MONITOR\` ≠ `DISPLAY#`). The C++ self-test at `main.cpp:199`
calls `fnEdid(m.pnp_device_id, ...)` which would return 0 (not found).
Fix the README to match the code, and fix `main.cpp` to call `get_edid`
with the display_path or the split segment (`SAMxxxx`) so the self-test
actually exercises EDID retrieval.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants