Click here to Skip to main content
16,007,932 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Plugin development for Outlook express/ Windows Mail in win32 c Pin
Member 350795926-Oct-09 8:36
Member 350795926-Oct-09 8:36 
QuestionFile should delete itself Pin
VCProgrammer16-Jun-08 19:18
VCProgrammer16-Jun-08 19:18 
AnswerRe: File should delete itself Pin
Rajesh R Subramanian16-Jun-08 19:32
professionalRajesh R Subramanian16-Jun-08 19:32 
JokeRe: File should delete itself Pin
Hamid_RT16-Jun-08 20:59
Hamid_RT16-Jun-08 20:59 
GeneralRe: File should delete itself Pin
Rajesh R Subramanian16-Jun-08 21:16
professionalRajesh R Subramanian16-Jun-08 21:16 
GeneralRe: File should delete itself Pin
Hamid_RT16-Jun-08 21:22
Hamid_RT16-Jun-08 21:22 
GeneralRe: File should delete itself Pin
Rajesh R Subramanian16-Jun-08 23:13
professionalRajesh R Subramanian16-Jun-08 23:13 
AnswerRe: File should delete itself Pin
Jagdish V. Bhimbha16-Jun-08 19:38
Jagdish V. Bhimbha16-Jun-08 19:38 
Hi Friend,

You should try this trick :

There are several tricks for making programs that are in one way or another able to delete themselves, without leaving any traces in the system.

One of the most wide-spread techniques, and also the one which is supposed to be one of the most platform independent (between Windows versions) is the following:

1.
Start the program you want to delete (EXE1).

2.
From this program, drop a second exe file (EXE2).

3.
Open a file handle to EXE2 from EXE1, using CreateFile, with the flag "FILE_FLAG_DELETE_ON_CLOSE".

4.
Execute EXE2 from EXE1 (e.g. with CreateProcess), causing the operating system to open another file handle to EXE2.

5.
Let EXE1 exit and terminate (which will implicitly cause its filehandle to EXE2 to close, leaving only the operating system's filehandle to EXE2 left open).

6.
EXE2 waits for EXE1 to terminate, and as soon as it detects this, it deletes EXE1 from disk.

7.
After successfully deleting EXE1, the job of EXE2 is complete, and it exits and terminates, causing the operating system's filehandle to it to close.

8.
The general concept and idea is now that EXE2 should immediately be deleted upon this closing of the last open file handle to it. This is also a seemingly correct assumption, especially when you read the entry for the "FILE_FLAG_DELETE_ON_CLOSE" flag of the CreateFile API in the Win32API reference


Or you can visit the following link :
http://www.woodmann.com/forum/archive/index.php/t-4542.html

Have a Good Luck...Rose | [Rose]

Jagdish Bhimbha
S/W Developer

GeneralRe: File should delete itself Pin
David Crow17-Jun-08 4:21
David Crow17-Jun-08 4:21 
AnswerRe: File should delete itself Pin
santhoshv8416-Jun-08 19:44
santhoshv8416-Jun-08 19:44 
AnswerRe: File should delete itself Pin
Jijo.Raj16-Jun-08 19:48
Jijo.Raj16-Jun-08 19:48 
QuestionSomeone Please Help (WinPCap/TCP Capture) Pin
Joe_Scialabba16-Jun-08 18:45
Joe_Scialabba16-Jun-08 18:45 
AnswerRe: Someone Please Help (WinPCap/TCP Capture) Pin
malaugh17-Jun-08 11:52
malaugh17-Jun-08 11:52 
QuestionUsing structure in Timer Pin
Anu_Bala16-Jun-08 18:35
Anu_Bala16-Jun-08 18:35 
AnswerRe: Using structure in Timer [modified] Pin
Jijo.Raj16-Jun-08 18:56
Jijo.Raj16-Jun-08 18:56 
GeneralRe: Using structure in Timer Pin
Anu_Bala16-Jun-08 19:13
Anu_Bala16-Jun-08 19:13 
GeneralRe: Using structure in Timer Pin
Jijo.Raj16-Jun-08 19:55
Jijo.Raj16-Jun-08 19:55 
GeneralRe: Using structure in Timer Pin
Anu_Bala16-Jun-08 20:22
Anu_Bala16-Jun-08 20:22 
GeneralRe: Using structure in Timer Pin
Jijo.Raj16-Jun-08 20:37
Jijo.Raj16-Jun-08 20:37 
AnswerRe: Using structure in Timer Pin
Anu_Bala16-Jun-08 20:48
Anu_Bala16-Jun-08 20:48 
GeneralRe: Using structure in Timer Pin
Jijo.Raj16-Jun-08 21:30
Jijo.Raj16-Jun-08 21:30 
GeneralRe: Using structure in Timer Pin
Anu_Bala16-Jun-08 22:11
Anu_Bala16-Jun-08 22:11 
GeneralRe: Using structure in Timer Pin
Jijo.Raj16-Jun-08 23:15
Jijo.Raj16-Jun-08 23:15 
GeneralRe: Using structure in Timer Pin
Anu_Bala16-Jun-08 23:22
Anu_Bala16-Jun-08 23:22 
GeneralRe: Using structure in Timer Pin
Jijo.Raj16-Jun-08 23:31
Jijo.Raj16-Jun-08 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.