shell32/tests: Add test for shell links to short path containing double backslashes.
Nicolas Le Cam
niko.lecam at gmail.com
Sun Jul 26 15:35:34 CDT 2009
---
dlls/shell32/tests/shelllink.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index 3ab3766..8707563 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -48,6 +48,7 @@ static fnSHILCreateFromPath pSHILCreateFromPath;
static fnSHDefExtractIconA pSHDefExtractIconA;
static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
+static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD);
static const GUID _IID_IShellLinkDataList = {
0x45e2b4ae, 0xb1c3, 0x11d0,
@@ -107,6 +108,8 @@ static void test_get_set(void)
HRESULT r;
IShellLinkA *sl;
char mypath[MAX_PATH];
+ char expected[MAX_PATH];
+ char tmpdir[MAX_PATH];
char buffer[INFOTIPSIZE];
LPITEMIDLIST pidl, tmp_pidl;
const char * str;
@@ -223,6 +226,7 @@ static void test_get_set(void)
r = IShellLinkA_SetPath(sl, "\"c:\\nonexistent\\file\"");
ok(r==S_FALSE || r == S_OK, "SetPath failed (0x%08x)\n", r);
+ strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
ok(r==S_OK, "GetPath failed (0x%08x)\n", r);
ok(!lstrcmp(buffer, "C:\\nonexistent\\file") ||
@@ -615,6 +619,25 @@ static void test_load_save(void)
create_lnk(lnkfile, &desc, 0);
check_lnk(lnkfile, &desc, 0x0);
+ r=pGetShortPathNameA(mydir, mypath, sizeof(mypath));
+ strcpy(realpath, mypath);
+ strcat(realpath, "\\test.txt");
+ strcat(mypath, "\\\\test.txt");
+
+ /* Overwrite the existing lnk file and test link to a short path with double backslashes */
+ desc.description="non-executable file";
+ desc.workdir=mydir;
+ desc.path=mypath;
+ desc.pidl=NULL;
+ desc.arguments="";
+ desc.showcmd=SW_SHOWNORMAL;
+ desc.icon=mypath;
+ desc.icon_id=0;
+ desc.hotkey=0x1234;
+ create_lnk(lnkfile, &desc, 0);
+ desc.path=realpath;
+ check_lnk(lnkfile, &desc, 0x0);
+
r = DeleteFileA(mypath);
ok(r, "failed to delete file %s (%d)\n", mypath, GetLastError());
@@ -750,6 +773,7 @@ START_TEST(shelllink)
pSHDefExtractIconA = (fnSHDefExtractIconA) GetProcAddress(hmod, "SHDefExtractIconA");
pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
+ pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");
r = CoInitialize(NULL);
ok(SUCCEEDED(r), "CoInitialize failed (0x%08x)\n", r);
--
1.6.0.4
--=-P9taUW7P2gioTNJayJqo--
More information about the wine-patches
mailing list