Geoff Chappell - Software Analyst
This function queries a value in a subkey of a shell key.
HRESULT SKGetValueW ( SHELLKEY nShellKey, LPCWSTR pszSubKey, LPCWSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData);
The nShellKey argument specifies the shell key as a constant from the SHELLKEY enumeration.
The pszSubKey argument provides the address of a null-terminated string that names the subkey, or is NULL for the shell key itself.
The pszValue argument provides the address of a null-terminated string that names the value, or is NULL for the default value.
The pdwType argument provides the address of a variable that is to receive the data type, e.g., REG_SZ or REG_DWORD. This argument can be NULL to mean that the data type is not wanted.
The pvData argument provides the address of a buffer that is to receive the data. This argument can be NULL to mean that the data is not wanted.
The pcbData argument provides the address of a variable that plays two roles. On input, the variable provides the size of the buffer, in bytes, but is ignored if pvData is NULL. On output, the variable receives the size of the data, in bytes. This argument can be NULL if pvData is NULL or to mean that the buffer size is zero.
The function returns zero for success, else an error code.
Of particular interest are the cases when the value is accessible but has more data than can fit in the given buffer, including because there is no buffer:
The function opens the given subkey of the selected shell key (using SHGetShellKeyEx, asking for read access), queries the value for its data (using SHQueryValueExW), and closes the subkey.
In builds before Windows Vista, the subkey is opened by using SHGetShellKey.
The SKGetValueW function is exported from SHLWAPI as ordinal 516 in version 6.00 and higher.
Though this function dates from 2001, it was still not documented by Microsoft as late as the January 2007 edition of the Windows Vista Software Development Kit (SDK).