Skip to content

Fix win32_SystemProcessorPerformanceInformation struct #1831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025

Conversation

niemp100
Copy link

@niemp100 niemp100 commented Apr 1, 2025

Fixes An issue on Windows 32Bit Systems where the CPU information is not available and throwing an windows error response code from the API discussed here: #1236

@niemp100
Copy link
Author

niemp100 commented Apr 9, 2025

In the struct that is passed to the windows API One of the variables has the wrong datatype (32 bit int instead of 64 bit) thus the size of the struct is 4 byte too small. Even though the buffer is big enough to hold all data, the API returns an error on 32bit windows systems ( tested on windows10 )

@shirou shirou requested a review from Copilot April 17, 2025 13:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue on Windows 32-bit systems where the CPU performance information was incorrectly represented.

  • Fixed the type of the InterruptCount field to match the Windows API's ULONG requirements.
Comments suppressed due to low confidence (1)

cpu/cpu_windows.go:42

  • Changing InterruptCount from uint32 to uint64 appears necessary to match the API's ULONG definition, but please double-check that this change does not inadvertently affect structure alignment or behavior on 32-bit systems.
InterruptCount uint64 // ULONG needs to be uint64

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

I haven't check on 32-bit Windows machine, but LGTM! Thank you for your contribution!

@shirou shirou merged commit 61f624b into shirou:master Apr 17, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants