Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   How to?-How to mark a file at the OS level (https://forum.exetools.com/showthread.php?t=7631)

SOLAR 05-30-2005 02:28

How to?-How to mark a file at the OS level
 
Here's the scenario I want to be able to programmatically mark a file in a way with a flag or something that will tell the OS to do something with the file.

For example...I know uninstallers when uninstalling an app deletes some of the files related to an application but sometimes to compleletly remove the software the computer needs to be rebooted as some file are being used by the system. However, once the reboot occurs the un-installer has marked the file to be deleted at reboot i.e. before the operating system loads it again.

I know the un-installer marks the file because a few days ago i un-installed an application and without rebooting i tried to reinstall it and the OS (Win XP) gave me an alert that said something like "Cannot install because [some_filename_here] is marked for deletion"

How does the un-installer do this? And how can i accomplish this using some programming language preferable VB/C#.Net or VB?

Thank you in advance for any help

Sarre 05-30-2005 02:34

I don't know, but have you checked if the file in use can be renamed? If it's renamed such that it's not loaded on reboot, an application can then remove it when the OS is loaded.

aldente 05-30-2005 03:02

The installer just has a specific file/reg location, where it stores files to delete at the next reboot. Then, the uninstaller deletes the files, or, if started before reboot complains about the fact, that there are files in the setup, which will be affected by the next startup-delete-process.

there is no real "mark" (on a filesystem-level, or whatever you thought about), its just an information the installer itself uses and stores somewhere.

Opc0de 05-30-2005 04:49

Hi,

Take a look:
http://www.diamondcs.com.au/index.php?page=dellater

Probably, this is rellated with your question.

Regards,
Opc0de

nikola 05-30-2005 05:24

SOLAR, i think this file is marked in installer/uninstaller rather than OS. There wouldnt be any point preventing access to file if its going to be deleted anyway, so i think thats just something author of installer made up to fix some issue he had. You can simply write a program to delete files you want, add it to autorun in registry, so when computer restarts it deletes the file and removes itself from registry. Or maybe even adding it to services if file you want to delete is loaded as service, and therefor cant be deleted becouse its already started...

SOLAR 05-30-2005 10:05

Thanks for all responses u guys are right i just realize a few hours after posting that it isnt os level and in fact very simple to do.

JuneMouse 05-30-2005 18:45

well hklm\ and or hkcu
\softawre\microsoft\windows\
has runonce and runonce ex keys
they are accessed on boot and run

so you have set a key like cmd \c del blah.exe
it wil run cmd and delte the file during boot


also in this key there is a value PendingFileRenameoperation it takes HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager

this key takes multiple file names as arguments and deletes them all during next reboot

Cobi 05-30-2005 21:28

Look at this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/movefileex.asp

Quote:

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.


All times are GMT +8. The time now is 14:39.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX