Shell32.dll has an undocumented function. In Windows XP, its serial number is 233, in Windows Vista and 7 its serial number is 261.
Its function prototype ( from Airesoft ):
HRESULT WINAPI SHGetUserPicturePath ( LPCWSTR pwszPicOrUserName, DWORD sguppFlags, LPWSTR pwszPicPath, UINT picPathLen )
You can use this function to get the path where the user's image is stored. Just pass the username as pwszPicOrUserName, the buffer in which you want to save the image path as pwszPicPath and the size of the buffer in char as picPathLen. You can set sguppFlags to 0 or to any of the other flags .
There is also an undocumented feature that you can use to set up a custom user image. Its serial number is 234 on Windows XP, 262 on Windows Vista and Windows 7.
Its function prototype ( from Airesoft ):
HRESULT WINAPI SHSetUserPicturePath ( LPWSTR pwszAcctName, DWORD reserved, LPCWSTR pwszPictureFile )
Pass in the username whose image should be changed as pwszAcctName and the path to the image you want to set as pwszPictureFile. Set is reserved for 0. You must initialize COM before calling this function.
According to Microsoft, you should not rely on an undocumented feature because they can be removed or changed using any patch installed on Windows.
source share