The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: RuiLoureiro on April 11, 2008, 04:05:30 PM

Title: Renaming a file
Post by: RuiLoureiro on April 11, 2008, 04:05:30 PM
Hi all,
          I want to rename a file but i dont know how. I tried to use ReplaceFile but i have not the constant REPLACEFILE_WRITE_THROUGH in the windows.inc. How to do this ? Any help ?

New:

          I found MoveFileEx but i have the same problem with MOVEFILE_WRITE_THROUGH.
          It is not defined in windows.inc. Anyone knows the value ?

Thank you
Rui
Title: Re: Renaming a file
Post by: hutch-- on April 11, 2008, 04:28:03 PM
Rui,

Try this API.


BOOL MoveFile(
    LPCTSTR lpExistingFileName, // address of name of the existing file 
    LPCTSTR lpNewFileName // address of new name for the file
   );


This is the equate value from winbase.h.


#define MOVEFILE_WRITE_THROUGH          0x00000008


In MASM it should be,


MOVEFILE_WRITE_THROUGH equ 00000008h


LATER:

You must be using a very old windows.inc, the current two file version contains the equate. Download the latest release version from the masm32 subforum.
Title: Re: Renaming a file
Post by: RuiLoureiro on April 11, 2008, 08:25:08 PM
Hello Hutch,
                   Thank you.

                   Yes i think it is a very old windows.inc, but i am going to download the latest release version from the masm32 subforum.

Thanks
Rui