Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help file to delete itself?

2 views
Skip to first unread message

Craig Pomeroy

unread,
May 2, 2002, 2:51:11 PM5/2/02
to
I am currently writing an uninstaller for an application my
company distributes. To allow the uninstaller to delete itself in 9x,
I just use wininit.ini. In NT-based operating systems, that's not
doable. Since I'm writing this in an install scripting language (Wise
InstallBuilder 8.14) rather than a full programming language, I cannot
use the API call to delete the file with a delay.

I can, however, make any registry changes I like. Can anyone
give me pointers on the actual registry entries I need to edit to
queue a file for deletion at reboot in NT/2K/XP? I would like info on
the keys themselves and format/syntax for any values therein. Any help
greatly appreciated!

... Oh, and for those familiar with Wise who might suggest
using unWise, that is not an option -- removing this program is more
complicated than simply reversing the steps of the install.

--
Craig

Ralf Buschmann

unread,
May 2, 2002, 5:18:22 PM5/2/02
to
On Thu, 02 May 2002 13:51:11 -0500, Craig Pomeroy <cra...@cpsinet.com>
wrote:

> I am currently writing an uninstaller for an application my
>company distributes. To allow the uninstaller to delete itself in 9x,
>I just use wininit.ini. In NT-based operating systems, that's not
>doable. Since I'm writing this in an install scripting language (Wise
>InstallBuilder 8.14) rather than a full programming language, I cannot
>use the API call to delete the file with a delay.

Sure you can. Here is the corresponding snippet of Wise code, copy and
paste into your script:


item: Get System Information
Variable=THISEXE
Flags=00001101
end
item: Call DLL Function
Pathname=%SYS32%\KERNEL32.DLL
Function Name=MoveFileExA
Argument List=40THISEXE
Argument List=42
Argument List=314
Return Variable=3RETURN
Flags=00100000
end
item: If/While Statement
Variable=RETURN
Value=0
end
item: Display Message
Title=Uninstall
Text=Failed to schedule file for deletion!
Flags=00101000
end
item: End Block
end


Note that this requires administrator privileges.

Ralf.

harris

unread,
May 2, 2002, 11:35:13 PM5/2/02
to
Please check out this link to delete exe itself-

http://freespace.virgin.net/james.brown7/tuts/selfdel.htm

Harris M.

Craig Pomeroy <cra...@cpsinet.com> wrote in message news:<m213dug97k32dt3f9...@4ax.com>...

Serve Laurijssen

unread,
May 3, 2002, 3:32:53 PM5/3/02
to
"harris" <harr...@yahoo.com> wrote in message
news:af968c64.02050...@posting.google.com...

> Please check out this link to delete exe itself-
>
> http://freespace.virgin.net/james.brown7/tuts/selfdel.htm
>
> Harris M.

I assume you meant the following code from the website. Can somebody explain
how it works?

#include <windows.h>

int main(int argc, char *argv[])
{
char buf[MAX_PATH];
HMODULE module;

module = GetModuleHandle(0);
GetModuleFileName(module, buf, MAX_PATH);
CloseHandle((HANDLE)4);

__asm
{
lea eax, buf
push 0
push 0
push eax
push ExitProcess
push module
push DeleteFile
push UnmapViewOfFile
ret
}

return 0;
}

r...@pen_fact.com

unread,
May 4, 2002, 9:35:13 AM5/4/02
to
I'm using a variation of one of the other choices at that site.
Specifically, I have an executable that makes a temporary copy of
itself, which then deletes the origiinal. The site does a better job
explaining than I can. The technique works well under NT and 2K, but
not under 95 or 98. Under 95 and 98, it seems to be a no-op (safe, but
useless). I also believe it misbehaves badly when run undr a debugger,
So, getting all the details right was a pain.

My code is not easily shared, because it uses several functions from
my own library. Also, the actual method really is the same as the
sample, so I don't think it would add much info

On Fri, 3 May 2002 21:32:53 +0200, "Serve Laurijssen" <b...@content.nl>
wrote:

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret
PenFact, Inc.
46 Beach Street
Boston, MA 02111
www.penfact.com

0 new messages