Renaming A Running Process' File Image On Windows

后端 未结 6 699
北荒
北荒 2020-12-21 15:15

I have a Windows service application on Vista SP1 and I\'ve found that users are renaming its executable file (while it\'s running) and then rebooting, thus causing it to fa

6条回答
  •  余生分开走
    2020-12-21 15:56

    your concept is wrong ... the filename is not the center of the file-io universe ... the handle to the open file is. the file is not moved to a different section of disk when you rename it, it's still in the same place and the part of the disk the internal data structure for the open file is still pointing to the same place. bottom line is that your observations are correct. you can rename a running program without causing problems. you can create a new file with the same name as the running program once you've renamed it. this is actually useful behavior if you want to update software while the software is running.

提交回复
热议问题