Fix for MoveFileExA
aric at codeweavers.com
Thu Jan 31 07:52:55 CST 2002
My turn to chime in, I have done a fair bit of reboot processing stuff..
first here is what msdn says
If the dwFlags parameter specifies MOVEFILE_DELAY_UNTIL_REBOOT, MoveFileEx stores
the locations of the files to be renamed at reboot in the following registry
The function fails if it cannot access the registry.
The PendingFileRenameOperations value is of type REG_MULTI_SZ. Each rename
operation stores a pair of NULL-terminated strings. The system uses these registry
entries to complete the operations at reboot in the same order that they were
issued. For example, the following code fragment creates registry entries that
delete szDstFile and rename szSrcFile to be szDstFile at reboot:
MoveFileEx(szDstFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
MoveFileEx(szSrcFile, szDstFile, MOVEFILE_DELAY_UNTIL_REBOOT);
The system stores the following entries in PendingFileRenameOperations:
Because the actual move and deletion operations specified with the
MOVEFILE_DELAY_UNTIL_REBOOT flag take place after the calling application has
ceased running, the return value cannot reflect success or failure in moving or
deleting the file. Rather, it reflects success or failure in placing the
appropriate entries into the registry.
The system deletes a directory tagged for deletion with the
MOVEFILE_DELAY_UNTIL_REBOOT flag only if it is empty. To ensure deletion of
directories, move or delete all files from the directory before attempting to
delete it. Files may be in the directory at boot time, but they must be deleted or
moved before the system can delete the directory.
Windows 95 and Windows 98: The MoveFileEx function is not supported. To rename or
delete a file at reboot, use the following procedure.
To rename or delete a file on Windows 95 and Windows 98
Check for the existence of the WININIT.INI file in the Windows directory.
If WININIT.INI exists, open it and add new entries to the existing [rename]
section. If the file does not exist, create the file and create a [rename]
Add lines of the following format to the [rename] section:
Both DestinationFileName and SourceFileName must be short filenames. To delete a
file, use NUL as the value for DestinationFileName.
The system processes WININIT.INI during system boot. After WININIT.INI has been
processed, the system names it WININIT.BAK.
So we have exactly what we should do.
This i have seen alot, andreas (and others) are working on a utility that will
process this wininit file. I have talked to alexandre and we both agree that it is
something that probably should not be in wine itself.
Malte Starostik wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Am Wednesday 30 January 2002 21:41 schrieb Uwe Bonnes:
> > >>>>> "Francois" == Francois Gouget <fgouget at free.fr> writes:
> > Francois> On Wed, 30 Jan 2002, Gerhard W. Gruber wrote:
> > ...
> > Francois> I believe that Windows stores the list of files to
> > Francois> move/delete somewhere in the registry. We should probably do
> > Francois> the same... It seems that adding keys in the registry would
> > be Francois> better than creating new files in any case.
> > At least Win95 and decendants store the file in <windows>/wininit.ini.
> Yes, because registry access isn't available yet when wininit.ini is
> handled during booting. That's what happens during the
> "Configuration files are being updated"
> (roughly translated from German, guess you know what I mean) while the
> boot logo is displayed. BTW, no idea why they call it "configuration files" :)
> Imagine kernel32, advapi or something else is being replaced...can't use the
> registry for it. The format of wininit.ini is pretty simple: ever line is like
> and causes the file named oldname to be renamed to newname. If newname
> is nul, the file is deleted.
> - --
> Malte Starostik
> PGP: 1024D/D2F3C787 [C138 2121 FAF3 410A 1C2A 27CD 5431 7745 D2F3 C787]
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
> -----END PGP SIGNATURE-----
More information about the wine-devel