Sysinternals Homepage
Forum Home Forum Home > Windows Discussions > Development
  New Posts New Posts RSS Feed - How to prevent file copying of mapped file
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to prevent file copying of mapped file

 Post Reply Post Reply
Author
Message
hugo View Drop Down
Groupie
Groupie
Avatar

Joined: 20 July 2005
Location: United States
Status: Offline
Points: 83
Post Options Post Options   Thanks (0) Thanks(0)   Quote hugo Quote  Post ReplyReply Direct Link To This Post Topic: How to prevent file copying of mapped file
    Posted: 12 October 2012 at 11:37pm
Is there any way to prevent copying of a file that is opened and mapped by several processes?
 
The issue I have is that customers often copy an in-use mapped file - very complex structure with tons of rapdily changing data in.
 
The copy they end up with is useless and internally inconsistent because it was copied whilst the data was being modified in memory, they then try to use the file by mapping it with other apps/tools and this fails - all because the file is useless - it should never have been copied BUT people forget this.
 
Ideally I'd like to limit the acces to be ONLY mappings, but I cannot - some operating systems have a file open mode of VM_ACCESS and once a process has created/opened a file with this access mode - then that process and any others can ONLY access the file by mapping it - they cannot read/write using IO - this - if it were supported on Windows - would prevent manual copying attempts while the file was mapped by one or more processes.
 
Is there any way at all in Win32?
 
Thx
 
Hugh
 


Edited by hugo - 12 October 2012 at 11:38pm
Back to Top
WindowsStar View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 June 2010
Status: Offline
Points: 576
Post Options Post Options   Thanks (0) Thanks(0)   Quote WindowsStar Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2012 at 1:29am
Back to Top
aaronmar View Drop Down
Moderator Group
Moderator Group


Joined: 13 July 2010
Status: Offline
Points: 66
Post Options Post Options   Thanks (0) Thanks(0)   Quote aaronmar Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2012 at 2:56pm
Hugo, I've never heard of such an access mechanism in Windows.  If you allow the file to be read, the reader can write the content to another location.  Perhaps instead of allowing customers direct access to a file while it is being changed an internally inconsistent, have that data be someplace less available and have the "copyable" file be updated when data is in a consistent state.
-- Aaron Margosis (Microsoft)
co-author of The Windows Sysinternals Administrator's Reference.
http://www.amazon.com/Windows-Sysinternals-Administrators-Reference-Russinovich/dp/073565672X
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down