Hi everyone

I have a program that will log the events and actions from end-user. For specific reason, the log file will be kept open at all time and should not be allowed to copy, delete or rename. Using CreateFile() with restriction on READ and WRITE, I was able to accomplish the prevention of delete and copy. However, while the file is in use, I still can use File Explorer or ActiveSync to rename the file

Any info on this issue is greatly aprreciated

TI

JS

RE: How to prevent in-use file from being renamed? by anonymous

anonymous
Thu May 06 15:36:05 CDT 2004

I tried that on PocketPC 2002 device and couldn't replicate your problem. opened the file in exclusive mode, then used the file exporer in Active Sync to rename the file and was unable to do so.

RE: How to prevent in-use file from being renamed? by anonymous

anonymous
Fri May 07 07:51:08 CDT 2004

What method do you use to open the file with? I am using the following

CreateFile(szFilename, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM
NULL)

Also make sure the file is not a ROM file...Of course, those file cannot be renamed

Thanks
JS