setty7

Untitled

Jan 6th, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. int SelfDelete()
  2. {
  3.     TCHAR szFile[MAX_PATH];
  4.     TCHAR szCmd[MAX_PATH];
  5.  
  6.     if (
  7.         (GetModuleFileName(0, szFile, MAX_PATH) != 0)
  8.         &&
  9.         (GetShortPathName(szFile, szFile, MAX_PATH) != 0)
  10.         )
  11.     {
  12.         lstrcpy(szCmd, _T("/c del "));
  13.         lstrcat(szCmd, szFile);
  14.         lstrcat(szCmd, _T(" >> NUL"));
  15.  
  16.         if (
  17.             (GetEnvironmentVariable(_T("ComSpec"), szFile, MAX_PATH) != 0)
  18.             &&
  19.             ((INT)ShellExecute(0, 0, szFile, szCmd, 0, SW_HIDE) > 32)
  20.             )
  21.             return TRUE;
  22.     }
  23.     return FALSE;
  24. }
Add Comment
Please, Sign In to add comment