Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int SelfDelete()
- {
- TCHAR szFile[MAX_PATH];
- TCHAR szCmd[MAX_PATH];
- if (
- (GetModuleFileName(0, szFile, MAX_PATH) != 0)
- &&
- (GetShortPathName(szFile, szFile, MAX_PATH) != 0)
- )
- {
- lstrcpy(szCmd, _T("/c del "));
- lstrcat(szCmd, szFile);
- lstrcat(szCmd, _T(" >> NUL"));
- if (
- (GetEnvironmentVariable(_T("ComSpec"), szFile, MAX_PATH) != 0)
- &&
- ((INT)ShellExecute(0, 0, szFile, szCmd, 0, SW_HIDE) > 32)
- )
- return TRUE;
- }
- return FALSE;
- }
Add Comment
Please, Sign In to add comment