It is currently March 28th, 2024, 7:11 pm

Documentation error for Registry measure?

Discussions about the documentation, main Rainmeter site and forums.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Documentation error for Registry measure?

Post by SilverAzide »

Hello,

The documentation for the Registry measure states that RegValue supports key value types of REG_SZ and REG_DWORD, DWORD being a 32-bit unsigned integer. However, I've successfully been pulling REG_QWORD values (64-bit unsigned long) from the registry using this measure.

Is the documentation correct? It seems like REG_QWORD values are supported...
Gadgets Wiki GitHub More Gadgets...
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Documentation error for Registry measure?

Post by Brian »

Technically speaking, the Registry measure can get the following 'types': REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_DWORD, and REG_QWORD.
Code: https://github.com/rainmeter/rainmeter/blob/master/Library/MeasureRegistry.cpp#L44-L61

However, there are some issues that can arise when using types other than REG_DWORD and REG_SZ.
REG_EXPAND_SZ is generally acceptable to use but will contain non-expanded environmental variables (in most cases).
REG_MULTI_SZ usually contains a list of multiple null terminated strings. The measure is not set up to handle strings like this and will truncate the rest of the string after the first null.
REG_QWORD will work fine until the value returned is too large to convert properly. A measures "number value" is a floating-point number (called a double) that can lose precision when approaching really large numbers. Since the point of a QWORD is to represent large numbers, this conversion issue will likely raise its ugly head from time to time - so that is why we don't recommend using it. See this post for more information on this: https://forum.rainmeter.net/viewtopic.php?p=79969#p79969

Example:
qword.png
So while the registry measure can get different types, it is generally not recommended since the data returned may not be accurate. Having said that, we probably could clarify the docs some.

-Brian
You do not have the required permissions to view the files attached to this post.