kernel32: Implement and test GetVolumePathNamesForVolumeName.

Alexandre Julliard julliard at winehq.org
Mon Feb 14 05:40:14 CST 2011


Hans Leidekker <hans at codeweavers.com> writes:

>  BOOL WINAPI GetVolumePathNamesForVolumeNameW(LPCWSTR volumename, LPWSTR volumepathname, DWORD buflen, PDWORD returnlen)
>  {
> -    FIXME("(%s, %p, %d, %p), stub!\n", debugstr_w(volumename), volumepathname, buflen, returnlen);
> -    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
> -    return FALSE;
> +    static const WCHAR prefixW[] =
> +        {'\\','\\','?','\\','V','o','l','u','m','e','{','0','0','0','0','0','0','0','0','-','0','0','0','0','-', 
> +         '0','0','0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0'};
> +    static const WCHAR fmtW[] = {'%','c',':','\\',0};
> +
> +    TRACE("%s, %p, %u, %p\n", debugstr_w(volumename), volumepathname, buflen, returnlen);
> +
> +    if (!volumename || strlenW( volumename ) != 49 ||
> +        volumename[47] != '}' || memcmp( volumename, prefixW, sizeof(prefixW) ))
> +    {
> +        SetLastError( ERROR_INVALID_NAME );
> +        return FALSE;
> +    }
> +    if (returnlen)
> +    {
> +        *returnlen = 5;
> +    }
> +    if (buflen < 5 || !volumepathname)
> +    {
> +        SetLastError( ERROR_MORE_DATA );
> +        return FALSE;
> +    }
> +    sprintfW( volumepathname, fmtW, strtolW( volumename + 45, NULL, 16 ) );
> +    volumepathname[4] = 0;
> +    return TRUE;

Please don't make assumption about volume guids. This should be
implemented by retrieving the correct data from mountmgr.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list