-
Notifications
You must be signed in to change notification settings - Fork 113
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
Why is VALENT(A/W)::ve_valuename non-const #1778
Comments
Interestingly, Windows NT 3.5 (when typedef struct value_ent { /* val */
LPCTSTR ve_valuename;
DWORD ve_valuelen;
DWORD ve_valueptr;
DWORD ve_type;
} RECT; (The RECT typedef is a typo in the original docs.) Now to find when that changed... |
The NT 3.5 docs don't appear to have ever been truly in sync with the original header definition from NT 3.5: // winreg.h
// ...
typedef struct value_entA {
LPSTR ve_valuename;
DWORD ve_valuelen;
DWORD ve_valueptr;
DWORD ve_type;
}VALENTA, FAR *PVALENTA;
typedef struct value_entW {
LPWSTR ve_valuename;
DWORD ve_valuelen;
DWORD ve_valueptr;
DWORD ve_type;
}VALENTW, FAR *PVALENTW;
#ifdef UNICODE
typedef VALENTW VALENT;
typedef PVALENTW PVALENT;
#else
typedef VALENTA VALENT;
typedef PVALENTA PVALENT;
#endif // UNICODE NT 4.0 docs correct this mishap though: typedef struct value_ent {
LPTSTR ve_valuename;
DWORD ve_valuelen;
DWORD ve_valueptr;
DWORD ve_type;
}VALENT; |
Tried variations incl. remote registry servers, ANSI/UTF-16, etc. and could not see any issues. Looks to simply be an oversight, but I'm not sure it's appropriate for metadata to assert const here as it could change at any time. |
This only implies that it is used as an in-parameter. You could maybe analyse the Windows codebase to ensure that it is always used only like that. Also, I speculate that lots of code simply const_cast's string literals to fill the structure and call RegQueryMultipleValues. Changing the behaviour will cause a lot of crashes. |
I know that VALENT(A/W)::ve_valuename is non-const in the SDK headers, but it should really not be that way.
The text was updated successfully, but these errors were encountered: