move running files in windows

    技术2022-05-11  87

    first of all, you must remove the windows sfc mechanism if the files belong to system. #include <Windows.h> BOOL del_file_func(char *szFileToDel) { char cTempFileName[0x80]; char cTempPathName[0x100]; char cFileName[0x100]; if(szFileToDel[1] == ':') { sprintf(cTempPathName, "%c://", szFileToDel[0]); } else { GetModuleFileName(NULL, cFileName, 0x100); sprintf(cTempPathName, "%c://", cFileName[0]); } if(GetTempFileName(cTempPathName, "_x", 0, cTempFileName) == 0) { return FALSE; } if(MoveFileEx(szFileToDel, cTempFileName, 1) == 0) { return FALSE; } if(MoveFileEx(cTempFileName, NULL, 4) == 0) { return FALSE; } return TRUE; } void usage(char *str) { printf("usage:/n/t %s FileNeedToDel/n", str); return; } int main(int argc, char *argv[]) { printf("/ncodz by xHydra./nQQ:150892418/nemail:xhydra@126.com/n"); if (argc != 2) usage(argv[0]); if(del_file_func(argv[1]) == TRUE) { printf("/nfile deleted successfully."); } else { printf("/nerror %d", GetLastError()); return FALSE; } return TRUE; }

    最新回复(0)