Review Request 117131: Implement KUser::faceIconPath on Windows.

Alexander Richardson arichardson.kde at googlemail.com
Fri Mar 28 13:49:25 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/117131/#review54437
-----------------------------------------------------------


I would personally keep the fallback code in case we couldn't load SHGetUserPicturePath (it is undocumented after all and could be removed in a future windows version), but if you want to remove it I'm also fine with that.


src/lib/util/kuser_win.cpp
<https://git.reviewboard.kde.org/r/117131/#comment38091>

    Don't think we need the RAII object here, AFAIK we link to shell32.dll anyway, so it will only be deleted on process exit anyway.



src/lib/util/kuser_win.cpp
<https://git.reviewboard.kde.org/r/117131/#comment38092>

    maybe make this static so it only gets resolved once:
    
    
    static SGUPP_ptr SHGetUserPicturePath = reinterpret_cast<SGUPP_ptr>(GetProcAddress(LoadLibraryW(L"shell32.dll"), MAKEINTRESOURCEA(261)));



src/lib/util/kuser_win.cpp
<https://git.reviewboard.kde.org/r/117131/#comment38094>

    WCHAR pathBuf[MAX_PATH];
    
    then you don't need the reinterpret_cast and can use QString::fromWCharArray()


- Alexander Richardson


On March 28, 2014, 2:07 a.m., Nicolás Alvarez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/117131/
> -----------------------------------------------------------
> 
> (Updated March 28, 2014, 2:07 a.m.)
> 
> 
> Review request for KDE Frameworks and kdewin.
> 
> 
> Repository: kcoreaddons
> 
> 
> Description
> -------
> 
> Implement KUser::faceIconPath on Windows.
> 
> I use an undocumented Windows API (http://undoc.airesoft.co.uk/shell32.dll/SHGetUserPicturePath.php) that stores the profile image in a temporary file and returns the path to it. The previous code was just trying to load that temporary file, and would only work if another app had created the file recently (such as the control panel section where the image is changed).
> 
> This only works on Windows Vista and later; on Windows XP the undocumented API is different, and faceIconPath will just return an empty string.
> 
> 
> Diffs
> -----
> 
>   src/lib/util/kuser_win.cpp 96cf2f0b89ac18a68783793d3a8b2827b72dd968 
> 
> Diff: https://git.reviewboard.kde.org/r/117131/diff/
> 
> 
> Testing
> -------
> 
> Compiled with MSVC2010, tested via the new faceicontest on Windows 7.
> 
> 
> Thanks,
> 
> Nicolás Alvarez
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140328/8be105d4/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list