[PATCH] Added 2 functions to shell32

Joris Huizer jorishuizer at planet.nl
Tue Mar 1 15:40:41 CST 2005


Gianluigi Tiesi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Changelog:
> ~  Fixed c:\test vs c:\test123
> 
> I really can implement it as m$ does but I think is very crazy to go around
> some dll, just to make a subpath match.
> Original m$ code calls: SHGetFolderPath, PathRemoveBackslash, 
> PathCommonPrefix
> :)
> 
> 
> - --
> Gianluigi Tiesi <sherpya at netfarm.it>
> EDP Project Leader
> Netfarm S.r.l. - http://www.netfarm.it/
> Free Software: http://oss.netfarm.it/
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (MingW32)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iD8DBQFCJADk3UE5cRfnO04RApbDAKCwswQyVtxe+xCGaDFrEISQK/3UyACfXWtC
> sFS2cEizLygq+D5F++L9duA=
> =5K/d
> -----END PGP SIGNATURE-----
> 
> 
> ------------------------------------------------------------------------
> 
> Index: shell32.spec
> ===================================================================
> RCS file: /home/wine/wine/dlls/shell32/shell32.spec,v
> retrieving revision 1.96
> diff -u -r1.96 shell32.spec
> --- shell32.spec	23 Feb 2005 15:41:14 -0000	1.96
> +++ shell32.spec	1 Mar 2005 05:35:01 -0000
> @@ -250,6 +250,7 @@
>  # >= NT5
>   714 stdcall @(ptr) SHELL32_714 # PathIsTemporaryW
>   730 stdcall -noname RestartDialogEx(long wstr long long)
> + 755 stdcall -noname PathIsEqualOrSubFolder(wstr wstr)
>  
>  1217 stub FOOBAR1217   # no joke! This is the real name!!
>  
> @@ -456,3 +457,4 @@
>  # _WIN32_IE >= 0x600
>  @ stdcall SHDefExtractIconA(str long long ptr ptr long)
>  @ stdcall SHDefExtractIconW(wstr long long ptr ptr long)
> +@ stub SHCreateShellItem
> Index: shellpath.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/shell32/shellpath.c,v
> retrieving revision 1.98
> diff -u -r1.98 shellpath.c
> --- shellpath.c	14 Feb 2005 11:07:55 -0000	1.98
> +++ shellpath.c	1 Mar 2005 05:35:01 -0000
> @@ -411,6 +411,28 @@
>  }
>  
>  /*************************************************************************
> + * PathIsEqualOrSubFolder     [SHELL32.755]
> + */
> +BOOL WINAPI PathIsEqualOrSubFolder(LPCWSTR path1, LPCWSTR path2)
> +{
> +	int i;
> +	int len;
> +	if (!path1 || !path2) return FALSE;
> +
> +	len = strlenW(path1);
> +	if (len > strlenW(path2)) return FALSE;
> +
> +	for (i=0; i < len; i++)
> +		if (tolowerW(path1[i]) != tolowerW(path2[i])) return FALSE;
> +
> +	/* a trailing backslash in path1,
> +	 * makes path2 reach char just after the backslash */
> +	if (path2[i-1] == '\\') return TRUE;
> +
> +	return (!path2[i] || (path2[i] == '\\'));
> +}
> +
> +/*************************************************************************

If path1 is path2 with an ending slash (like path1="C:\windows\" and 
path2="C:\windows", the test:
	if (len > strlenW(path2)) return FALSE;
will be true and the function will (incorrectly?) return FALSE; This line:
	if (path2[i-1] == '\\') return TRUE;
will never be executed ?

Sorry if I'm misreading...

HTH,

Joris



More information about the wine-devel mailing list