Module: wine Branch: master Commit: 05ff15a75517a506ae5d35b7d9f8fd3fa3b5f22f URL: http://source.winehq.org/git/wine.git/?a=commit;h=05ff15a75517a506ae5d35b7d9...
Author: Vincent Povirk vincent@codeweavers.com Date: Mon Jan 24 13:46:29 2011 -0600
shell32: Test links to executable filenames lacking the extension.
---
dlls/shell32/tests/shelllink.c | 63 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c index f754efd..29b0dda 100644 --- a/dlls/shell32/tests/shelllink.c +++ b/dlls/shell32/tests/shelllink.c @@ -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. */