Page 2 of 2

Re: How do I get #WM_QUIT on reboot?

Posted: Wed Oct 06, 2021 2:37 am
by AZJIO
link1
link2 shortened
The program creates shortcuts when inserting a flash drive and deletes them when removing the flash drive.

Re: How do I get #WM_QUIT on reboot?

Posted: Thu Oct 07, 2021 4:35 pm
by HeX0R
Shortcuts, which are doing what exactly?

Re: How do I get #WM_QUIT on reboot?

Posted: Fri Aug 29, 2025 9:35 pm
by Randy Walker
Axolotl wrote: Tue Oct 05, 2021 3:50 pm Example : delete file at next Windows startup

Code: Select all

MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)  
MSDN: If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileEx registers the lpExistingFileName file to be deleted when the system restarts. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.
This is some primo information. THANKS Aristotle!!!! :D

Re: How do I get #WM_QUIT on reboot?

Posted: Fri Aug 29, 2025 10:09 pm
by Randy Walker
Randy Walker wrote: Fri Aug 29, 2025 9:35 pm
Axolotl wrote: Tue Oct 05, 2021 3:50 pm Example : delete file at next Windows startup

Code: Select all

MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)  
MSDN: If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileEx registers the lpExistingFileName file to be deleted when the system restarts. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.
This is some primo information. THANKS Aristotle!!!! :D
Well. I thought it was a really great tip but cannot get it to work for me. I tried two ways:

Code: Select all

MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)
AND:

Code: Select all

D$ = "Some_file_i_dont_need_anymore"
MoveFileEx_(@D$, 0, #MOVEFILE_DELAY_UNTIL_REBOOT)
Guess I'm missing something. I don't know.

Re: How do I get #WM_QUIT on reboot?

Posted: Sat Aug 30, 2025 3:19 am
by Randy Walker
Axolotl wrote: Tue Oct 05, 2021 3:50 pm Example : delete file at next Windows startup

Code: Select all

MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)  
I had no luck getting this trick to work but I did a lot of research and hacking to find a way for an EXE to delete itself. The answer is here:
viewtopic.php?p=644643#p644643

Re: How do I get #WM_QUIT on reboot?

Posted: Sat Aug 30, 2025 10:50 am
by Axolotl
@Randy Waler:
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory.
More on this functions: MoveFileExW function (winbase.h)

The function stores the locations of the files to be renamed at restart in the following registry value:

Code: Select all

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations
BTW: The batch solution is a quite good one.

Re: How do I get #WM_QUIT on reboot?

Posted: Sat Aug 30, 2025 5:56 pm
by Randy Walker
Axolotl wrote: Sat Aug 30, 2025 10:50 am @Randy Waler:
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory.

BTW: The batch solution is a quite good one.
I figured it was a permissions issue preventing your solution from working for me and decided best not to pursue it further since I would have no control over that on the end users machine. The bat solution fit the bill perfectly for me and has the added benefit of immediate cleanup, as opposed to waiting for next reboot, or forcing an unexpected reboot. In my case the Uninstall is not for user discretion. It is for banishment, removing all traces of the app and associated data on employees that have left the company. They can't restore and run from backup because the same cleanup will occur. This bat thing is the last part of cleanup that was missing from my banish procedure.