Skip to content
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

Fix SysInfo Plugin GetBestInterfaceOrByName always return 0 #270

Closed
wants to merge 1 commit into from
Closed

Fix SysInfo Plugin GetBestInterfaceOrByName always return 0 #270

wants to merge 1 commit into from

Conversation

aetasoul
Copy link

Reference on the rainmeter forum

Any adapter name used in SysInfoData= always returns 0, except for SysInfoData=BEST that return the correct value.

@jsmorley
Copy link
Member

Thanks for reporting. Let us take a look at this.

Copy link
Member

@poiru poiru left a comment

Choose a reason for hiding this comment

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

I think it would be cleaner to do something like this:

		IP_ADAPTER_INFO dummyAdapterInfo;
		ULONG adapterInfoSize = 0;
		GetAdaptersInfo(&dummyAdapterInfo, &adapterInfoSize);
		if (adapterInfoSize > 0) {
			auto buffer = std::make_unique<BYTE[]>(adapterInfoSize);
			if (GetAdaptersInfo(*buffer, &adapterInfoSize) == ERROR_SUCCESS) {
				auto info = (IP_ADAPTER_INFO*)buffer.get();
				int i = 0;
				// existing while loop etc. here
			}
		}

@brianferguson
Copy link
Member

@aetasoul
I believe we have fixed this issue. Could you try out the following test build and report back if it works for you?
https://forum.rainmeter.net/viewtopic.php?f=143&t=38371#p197283

Thank you,
-Brian

@aetasoul
Copy link
Author

aetasoul commented Sep 9, 2021

Hi @brianferguson

I'll test tomorrow and let you know! Thank you for your work!

@aetasoul
Copy link
Author

Hi @brianferguson sorry for the dilay but I was out of office. All is working correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants