When translating the Windows API (including data types) into P/Invoke, should I replace DWORD with int
or uint
?
It\'s normally unsigned, but I
Use int. Reason being, if I change "AutoRestartShell" with a uint variable:
regKey.SetValue("AutoRestartShell", uintVariable);
the data type in the Registry Editor changes to "REG_SZ". If I ask for that value to be returned with:
regKey.GetValue("AutoRestartShell");
a string gets returned.
If, however, I change "AutoRestartShell" with an int variable:
regKey.SetValue("AutoRestartShell", intVariable);
The data type stays as "REG_DWORD".
Why does this happen? No idea. All I know is that it does. Logic certainly would tell us that uint should be used but that changes the data type which we don't want.