shell32: Test links to executable filenames lacking the extension.

oldstable
Vincent Povirk 2011-01-24 13:46:29 -06:00 committed by Alexandre Julliard
parent 365ae23e46
commit 05ff15a755
1 changed files with 63 additions and 0 deletions

View File

@ -681,6 +681,24 @@ static void test_load_save(void)
create_lnk(lnkfile, &desc, 0);
check_lnk(lnkfile, &desc, 0x0);
/* Test omitting .exe from an absolute path */
p=strrchr(mypath, '.');
if (p)
*p='\0';
desc.description="absolute path without .exe";
desc.workdir=mydir;
desc.path=mypath;
desc.pidl=NULL;
desc.arguments="/option1 /option2 \"Some string\"";
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, 0x4);
/* Overwrite the existing lnk file and test link to a command on the path */
desc.description="command on path";
desc.workdir=mypath;
@ -697,6 +715,22 @@ static void test_load_save(void)
desc.path=realpath;
check_lnk(lnkfile, &desc, 0x0);
/* Test omitting .exe from a command on the path */
desc.description="command on path without .exe";
desc.workdir=mypath;
desc.path="rundll32";
desc.pidl=NULL;
desc.arguments="/option1 /option2 \"Some string\"";
desc.showcmd=SW_SHOWNORMAL;
desc.icon=mypath;
desc.icon_id=0;
desc.hotkey=0x1234;
create_lnk(lnkfile, &desc, 0);
/* Check that link is created to proper location */
SearchPathA( NULL, "rundll32", NULL, MAX_PATH, realpath, NULL);
desc.path=realpath;
check_lnk(lnkfile, &desc, 0x4);
/* Create a temporary non-executable file */
r=GetTempPath(sizeof(mypath), mypath);
ok(r<sizeof(mypath), "GetTempPath failed (%d), err %d\n", r, GetLastError());
@ -747,6 +781,35 @@ static void test_load_save(void)
r = DeleteFileA(mypath);
ok(r, "failed to delete file %s (%d)\n", mypath, GetLastError());
/* Create a temporary .bat file */
strcpy(mypath, mydir);
strcat(mypath, "\\test.bat");
hf = CreateFile(mypath, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
CloseHandle(hf);
strcpy(realpath, mypath);
p=strrchr(mypath, '.');
if (p)
*p='\0';
/* Try linking to the .bat file without the extension */
desc.description="batch 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, 0x4);
r = DeleteFileA(realpath);
/* FIXME: Also test saving a .lnk pointing to a pidl that cannot be
* represented as a path.
*/