user32: Implement GetWindowModuleFileName with tests (try 2)

Alexandre Julliard julliard at winehq.org
Fri Feb 15 04:50:09 CST 2008


"Maarten Lankhorst" <m.b.lankhorst at gmail.com> writes:

> @@ -3121,9 +3133,21 @@ UINT WINAPI GetWindowModuleFileNameA( HWND hwnd, LPSTR lpszFileName, UINT cchFil
>   */
>  UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR lpszFileName, UINT cchFileNameMax)
>  {
> -    FIXME("GetWindowModuleFileNameW(hwnd %p, lpszFileName %p, cchFileNameMax %u) stub!\n",
> -          hwnd, lpszFileName, cchFileNameMax);
> -    return 0;
> +    HINSTANCE hInst;
> +    UINT ret;
> +    TRACE("hwnd %p, lpszFileName %p, cchFileNameMax %u\n", hwnd, lpszFileName, cchFileNameMax);
> +
> +    hInst = (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
> +    if (!hInst)
> +    {
> +        if (hwnd == GetDesktopWindow() || !IsWindow(hwnd))
> +            return 0;
> +        hInst = GetModuleHandleW(0);
> +    }
> +
> +    ret = GetModuleFileNameW(hInst, lpszFileName, cchFileNameMax);
> +    TRACE("--> %d %s\n", ret, debugstr_wn(lpszFileName, ret));
> +    return ret;

This won't work across processes.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list