Index: dll/cpl/appwiz/appwiz.h =================================================================== --- dll/cpl/appwiz/appwiz.h (revision 71477) +++ dll/cpl/appwiz/appwiz.h (working copy) @@ -4,6 +4,7 @@ #include #include +#include #include #define WIN32_NO_STATUS @@ -17,6 +18,7 @@ #include #include #include +#include #include WINE_DEFAULT_DEBUG_CHANNEL(appwiz); Index: dll/cpl/appwiz/CMakeLists.txt =================================================================== --- dll/cpl/appwiz/CMakeLists.txt (revision 71477) +++ dll/cpl/appwiz/CMakeLists.txt (working copy) @@ -24,6 +24,6 @@ set_module_type(appwiz cpl UNICODE) target_link_libraries(appwiz uuid wine) add_delay_importlibs(appwiz msi) -add_importlibs(appwiz urlmon ole32 comctl32 advapi32 shell32 user32 msvcrt kernel32 ntdll) +add_importlibs(appwiz urlmon ole32 comctl32 advapi32 shlwapi shell32 user32 msvcrt kernel32 ntdll) add_pch(appwiz appwiz.h SOURCE) add_cd_file(TARGET appwiz DESTINATION reactos/system32 FOR all) Index: dll/cpl/appwiz/createlink.c =================================================================== --- dll/cpl/appwiz/createlink.c (revision 71477) +++ dll/cpl/appwiz/createlink.c (working copy) @@ -70,7 +70,7 @@ } BOOL -CreateShortcut(PCREATE_LINK_CONTEXT pContext) +CreateShortcut(PCREATE_LINK_CONTEXT pContext, BOOL isUrl) { IShellLinkW *pShellLink, *pSourceShellLink; IPersistFile *pPersistFile; @@ -78,6 +78,29 @@ WCHAR Path[MAX_PATH]; LPWSTR lpExtension; + /* Determine if the target is a URL */ + if (isUrl) + { + FILE *hUrl; + WCHAR TargetPath[MAX_PATH]; + + /* Create the URL File */ + hUrl = _wfopen(pContext->szLinkName, L"a+,ccs=UTF-8"); + if (hUrl == NULL) + return FALSE; + + wcscpy(TargetPath, L"URL="); + wcscat(TargetPath, pContext->szTarget); + + /* Writes the content to the URL file */ + fputws(L"[InternetShortcut]\n", hUrl); + fputws(TargetPath, hUrl); + + fclose(hUrl); + + return TRUE; + } + /* get the extension */ lpExtension = wcsrchr(pContext->szTarget, '.'); @@ -218,7 +241,7 @@ /// FIXME /// it should also be possible to create a link to folders, shellobjects etc.... /// - if (GetFileAttributesW(pContext->szTarget) == INVALID_FILE_ATTRIBUTES) + if ((GetFileAttributesW(pContext->szTarget) == INVALID_FILE_ATTRIBUTES) && (!PathIsURLW(pContext->szTarget))) { szDesc[0] = L'\0'; szPath[0] = L'\0'; @@ -299,13 +322,61 @@ pContext = (PCREATE_LINK_CONTEXT) GetWindowLongPtr(hwndDlg, DWLP_USER); if (lppsn->hdr.code == PSN_WIZFINISH) { + BOOL isURL = FALSE; + SendDlgItemMessageW(hwndDlg, IDC_SHORTCUT_NAME, WM_GETTEXT, MAX_PATH, (LPARAM)pContext->szDescription); wcscat(pContext->szLinkName, pContext->szDescription); - wcscat(pContext->szLinkName, L".lnk"); - if (!CreateShortcut(pContext)) + + /* Find out if the target location is a URL or not */ + isURL = PathIsURLW(pContext->szTarget); + + /* If the path isn't seen as a URL, then see if it has a proper URL prefix or not */ + if (!isURL) { - MessageBox(hwndDlg, _T("Failed to create shortcut"), _T("Error"), MB_ICONERROR); + WCHAR lpTmpPath[MAX_PATH]; + + if (UrlApplySchemeW(pContext->szTarget, lpTmpPath, (LPDWORD)MAX_PATH, URL_APPLY_GUESSSCHEME) == S_OK) + { + wcscpy(lpTmpPath, pContext->szTarget); + isURL = TRUE; + } } + + /* Determine the file extension based on if the target location is a URL or not */ + wcscat(pContext->szLinkName, (isURL ? L".url" : L".lnk")); + + /* Find out if the shortcut already exists before continuing. + If so, then ask the user if they want to overwrite it. */ + if (GetFileAttributesW(pContext->szLinkName) != INVALID_FILE_ATTRIBUTES) + { + WCHAR szShortcutMsg[MAX_PATH], szCaption[MAX_PATH], szError[MAX_PATH + 100]; + + LoadStringW(hApplet, IDS_ERROR_SHORTCUT_EXISTS, szShortcutMsg, MAX_PATH); + LoadStringW(hApplet, IDS_SHORTCUT_FINISH, szCaption, MAX_PATH); + + swprintf(szError, szShortcutMsg, pContext->szLinkName); + + /* If the user does not want to overwrite the existing shortcut then just refocus + onto the shortcut name edit text box */ + if (MessageBoxW(hwndDlg, szError, szCaption, MB_YESNO | MB_ICONERROR) == IDNO) + { + SendDlgItemMessage(hwndDlg, IDC_SHORTCUT_NAME, EM_SETSEL, 0, -1); + SetFocus(GetDlgItem(hwndDlg, IDC_SHORTCUT_NAME)); + SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE); + return -1; + } + } + + /* Try to create the shortcut */ + if (!CreateShortcut(pContext, isURL)) + { + WCHAR szMessage[MAX_PATH], szCaption[MAX_PATH], szError[MAX_PATH]; + LoadStringW(hApplet, IDS_CREATE_SHORTCUT_FAILED, szMessage, MAX_PATH); + LoadStringW(hApplet, IDS_CREATE_SHORTCUT, szCaption, MAX_PATH); + swprintf(szError, szMessage, pContext->szTarget); + + MessageBoxW(hwndDlg, szError, szCaption, MB_OK | MB_ICONERROR); + } } Index: dll/cpl/appwiz/lang/bg-BG.rc =================================================================== --- dll/cpl/appwiz/lang/bg-BG.rc (revision 71477) +++ dll/cpl/appwiz/lang/bg-BG.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Добавяне/премахване на приложения" IDS_CPLSYSTEMDESCRIPTION "Слага приложения и създава препратки." IDS_CREATE_SHORTCUT "Създаване на препратка" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Не бе открит файл %s." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/cs-CZ.rc =================================================================== --- dll/cpl/appwiz/lang/cs-CZ.rc (revision 71477) +++ dll/cpl/appwiz/lang/cs-CZ.rc (working copy) @@ -75,7 +75,10 @@ IDS_CPLSYSTEMNAME "Přidat a odebrat programy" IDS_CPLSYSTEMDESCRIPTION "Nastavuje programy a vytváří zástupce." IDS_CREATE_SHORTCUT "Vytvořit zástupce" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Soubor %s nebyl nalezen." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/de-DE.rc =================================================================== --- dll/cpl/appwiz/lang/de-DE.rc (revision 71477) +++ dll/cpl/appwiz/lang/de-DE.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Programme hinzufügen/entfernen" IDS_CPLSYSTEMDESCRIPTION "Installiert Programme und erstellt Verknüpfungen." IDS_CREATE_SHORTCUT "Verknüpfung erstellen" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Die Datei %s konnte nicht gefunden werden." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/el-GR.rc =================================================================== --- dll/cpl/appwiz/lang/el-GR.rc (revision 71477) +++ dll/cpl/appwiz/lang/el-GR.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Προσθαφαίρεση προγραμμάτων" IDS_CPLSYSTEMDESCRIPTION "Ρυθμίζει τα προγράμματα και δημιουργεί συντομεύσεις." IDS_CREATE_SHORTCUT "Δημιουργία συντόμευσης" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Το αρχείο %s δε βρέθηκε." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/en-US.rc =================================================================== --- dll/cpl/appwiz/lang/en-US.rc (revision 71477) +++ dll/cpl/appwiz/lang/en-US.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Add/Remove Programs" IDS_CPLSYSTEMDESCRIPTION "Sets up programs and creates shortcuts." IDS_CREATE_SHORTCUT "Create Shortcut" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "The file %s was not found." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/es-ES.rc =================================================================== --- dll/cpl/appwiz/lang/es-ES.rc (revision 71477) +++ dll/cpl/appwiz/lang/es-ES.rc (working copy) @@ -76,7 +76,10 @@ IDS_CPLSYSTEMNAME "Añadir y quitar programas" IDS_CPLSYSTEMDESCRIPTION "Añade programas y crea accesos directos." IDS_CREATE_SHORTCUT "Crear acceso directo" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "No se ha encontrado archivo %s." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/fr-FR.rc =================================================================== --- dll/cpl/appwiz/lang/fr-FR.rc (revision 71477) +++ dll/cpl/appwiz/lang/fr-FR.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Ajouter/Supprimer des Programmes" IDS_CPLSYSTEMDESCRIPTION "Installe des programmes et crée des raccourcis." IDS_CREATE_SHORTCUT "Créer un raccourci" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Le fichier %s n'a pas été trouvé." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/he-IL.rc =================================================================== --- dll/cpl/appwiz/lang/he-IL.rc (revision 71477) +++ dll/cpl/appwiz/lang/he-IL.rc (working copy) @@ -71,7 +71,10 @@ IDS_CPLSYSTEMNAME "הוספת/הסרת תכניות" IDS_CPLSYSTEMDESCRIPTION "מגדיר תכניות ויוצר קישורי דרך." IDS_CREATE_SHORTCUT "צור קיצור דרך" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "הקובץ %s לא נמצא." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/it-IT.rc =================================================================== --- dll/cpl/appwiz/lang/it-IT.rc (revision 71477) +++ dll/cpl/appwiz/lang/it-IT.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Aggiunge/Rimuove programmi" IDS_CPLSYSTEMDESCRIPTION "Predispone i programmi e crea collegamenti." IDS_CREATE_SHORTCUT "Crea collegamento" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Il file %s non è stato trovato." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/no-NO.rc =================================================================== --- dll/cpl/appwiz/lang/no-NO.rc (revision 71477) +++ dll/cpl/appwiz/lang/no-NO.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Legg til/Fjern Programmer" IDS_CPLSYSTEMDESCRIPTION "Sett opp programmer og opprett snarveier." IDS_CREATE_SHORTCUT "Opprett snarveier" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Filen %s ble ikke funnet." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/pl-PL.rc =================================================================== --- dll/cpl/appwiz/lang/pl-PL.rc (revision 71477) +++ dll/cpl/appwiz/lang/pl-PL.rc (working copy) @@ -79,7 +79,10 @@ IDS_CPLSYSTEMNAME "Dodaj lub usuń programy" IDS_CPLSYSTEMDESCRIPTION "Instaluje bądź usuwa programy oraz tworzy skróty." IDS_CREATE_SHORTCUT "Utwórz skrót" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Plik %s nie został znaleziony." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/pt-BR.rc =================================================================== --- dll/cpl/appwiz/lang/pt-BR.rc (revision 71477) +++ dll/cpl/appwiz/lang/pt-BR.rc (working copy) @@ -72,7 +72,10 @@ IDS_CPLSYSTEMNAME "Adicionar/Remover Programas" IDS_CPLSYSTEMDESCRIPTION "Configura programas e cria atalhos." IDS_CREATE_SHORTCUT "Criar Atalho" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "O arquivo %s não foi encontrado." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/ro-RO.rc =================================================================== --- dll/cpl/appwiz/lang/ro-RO.rc (revision 71477) +++ dll/cpl/appwiz/lang/ro-RO.rc (working copy) @@ -76,7 +76,10 @@ IDS_CPLSYSTEMNAME "Gestionar de programe" IDS_CPLSYSTEMDESCRIPTION "Instalează programe și crează scurtături." IDS_CREATE_SHORTCUT "Asistent pentru creare de scurtătură" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Elementul „%s” nu poate fi localizat." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/ru-RU.rc =================================================================== --- dll/cpl/appwiz/lang/ru-RU.rc (revision 71477) +++ dll/cpl/appwiz/lang/ru-RU.rc (working copy) @@ -70,7 +70,10 @@ IDS_CPLSYSTEMNAME "Установка и удаление программ" IDS_CPLSYSTEMDESCRIPTION "Работа с программами, обновлениями и ярлыками." IDS_CREATE_SHORTCUT "Создать ярлык" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Файл %s не найден." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/sk-SK.rc =================================================================== --- dll/cpl/appwiz/lang/sk-SK.rc (revision 71477) +++ dll/cpl/appwiz/lang/sk-SK.rc (working copy) @@ -74,7 +74,10 @@ IDS_CPLSYSTEMNAME "Pridať alebo odstrániť programy" IDS_CPLSYSTEMDESCRIPTION "Nastaví programy a vytvorí odkazy." IDS_CREATE_SHORTCUT "Vytvoriť odkaz" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Súbor %s nebol nájdený." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/sq-AL.rc =================================================================== --- dll/cpl/appwiz/lang/sq-AL.rc (revision 71477) +++ dll/cpl/appwiz/lang/sq-AL.rc (working copy) @@ -74,7 +74,10 @@ IDS_CPLSYSTEMNAME "Shto/Hiq Programe" IDS_CPLSYSTEMDESCRIPTION "Ndërton programe dhe krijon shortcute." IDS_CREATE_SHORTCUT "Krijo Shortcut" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Dokumenti %s nuk u gjend." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/tr-TR.rc =================================================================== --- dll/cpl/appwiz/lang/tr-TR.rc (revision 71477) +++ dll/cpl/appwiz/lang/tr-TR.rc (working copy) @@ -72,7 +72,10 @@ IDS_CPLSYSTEMNAME "İzlence Ekle ve Kaldır" IDS_CPLSYSTEMDESCRIPTION "İzlenceler kurar ve kısayollar oluşturur." IDS_CREATE_SHORTCUT "Kısayol Oluştur" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "%s kütüğü bulunamadı." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/uk-UA.rc =================================================================== --- dll/cpl/appwiz/lang/uk-UA.rc (revision 71477) +++ dll/cpl/appwiz/lang/uk-UA.rc (working copy) @@ -78,7 +78,10 @@ IDS_CPLSYSTEMNAME "Установка й видалення програм" IDS_CPLSYSTEMDESCRIPTION "Встановлення програм і створення ярликів." IDS_CREATE_SHORTCUT "Створити ярлик" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "Файл %s не знайдений." + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/lang/zh-CN.rc =================================================================== --- dll/cpl/appwiz/lang/zh-CN.rc (revision 71477) +++ dll/cpl/appwiz/lang/zh-CN.rc (working copy) @@ -77,7 +77,10 @@ IDS_CPLSYSTEMNAME "添加/删除程序" IDS_CPLSYSTEMDESCRIPTION "设置程序和快捷方式" IDS_CREATE_SHORTCUT "建立快捷方式" + IDS_CREATE_SHORTCUT_FAILED "Failed to create shortcut." IDS_ERROR_NOT_FOUND "找不到文件 %s" + IDS_ERROR_SHORTCUT_EXISTS "A shorcut named %s\nalready exists in this folder. Do you want to replace it?" + IDS_SHORTCUT_FINISH "Select a Title for the Program" END STRINGTABLE Index: dll/cpl/appwiz/resource.h =================================================================== --- dll/cpl/appwiz/resource.h (revision 71477) +++ dll/cpl/appwiz/resource.h (working copy) @@ -26,7 +26,10 @@ #define IDS_CPLSYSTEMNAME 1001 #define IDS_CPLSYSTEMDESCRIPTION 2001 #define IDS_CREATE_SHORTCUT 2021 -#define IDS_ERROR_NOT_FOUND 2022 +#define IDS_CREATE_SHORTCUT_FAILED 2022 +#define IDS_ERROR_NOT_FOUND 2023 +#define IDS_ERROR_SHORTCUT_EXISTS 2024 +#define IDS_SHORTCUT_FINISH 2025 #define IDS_DOWNLOADING 14 #define IDS_INSTALLING 15