#include #include #include #include int WINAPI WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) { HRESULT hResult = CoInitialize(NULL); IShellLink* pShellLink = nullptr; hResult = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&pShellLink); if (SUCCEEDED(hResult)) { pShellLink->SetPath(L"%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"); pShellLink->SetArguments(L"-Command \"Add-Type -AssemblyName System.Windows.Forms; " L"[System.Windows.Forms.MessageBox]::Show('ethical.blue Magazine', " L"'ethical.blue', 'OK', 'Information');\""); IPersistFile* pPersistFile = nullptr; hResult = pShellLink->QueryInterface(IID_IPersistFile, (LPVOID*)&pPersistFile); if (SUCCEEDED(hResult)) { OPENFILENAME openFileName; WCHAR wszFilePath[MAX_PATH] = L""; ZeroMemory(&openFileName, sizeof(openFileName)); openFileName.lStructSize = sizeof(openFileName); openFileName.lpstrFilter = L"Pliki skrótu (*.lnk)\0*.lnk\0Wszystkie pliki\0*.*\0"; openFileName.nMaxFile = MAX_PATH; openFileName.lpstrFile = wszFilePath; openFileName.lpstrDefExt = L"lnk"; if (GetSaveFileName(&openFileName)) { hResult = pPersistFile->Save(wszFilePath, TRUE); } pPersistFile->Release(); } pShellLink->Release(); } return EXIT_SUCCESS; }