WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

IntControl 30 Allow Protected Renames


Question:

I try to change "in use" dll files under W2k using IntControl 30. Although the return code of the function - and the entry in the registry (PendingFileRenameOperations) looks good after a reboot the files are not changed. Hope it is just a little mistake of mine. Anyone out there who could give me the tip I need?

Script:

new_file_path="o:\rpc.w2k\"
new_file="ole32.dln"
Ziel="ole32.dll"
Gosub Tausch


new_file_path="o:\rpc.w2k\"
new_file="rpcrt4.dln"
Ziel="rpcrt4.dll"
Gosub Tausch

new_file_path="o:\rpc.w2k\"
new_file="rpcss.dln"
Ziel="rpcss.dll"
Gosub Tausch

exit

:Tausch

new_file_path=StrCat(new_file_path,new_file)
SystemDir=DirWindows (1)
old_file=StrCat(SystemDir,Ziel)
tmp_new_file=StrCat(SystemDir,new_file)

Newer=FileCompare(new_file_path,old_file)
if newer==2
FileCopy(new_file_path,tmp_new_file, @False)
FileAttrSet(old_file,"r")
ret=IntControl(30,tmp_new_file,old_file,0,0)
;Message ("Returncode für IntControl",ret) 
endif
return

Answer:

I'm guessing that the system auto-repair stuff is seeing that the fields were modified, and is restoring them from backup copies. It may not be quite that simple to update system files. See if there are any interesting notes in the event log?

User Reply:

No entry in the Event-Log. - But in the meantime I found the solution.

There has to exist a Registry entry:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager]
"AllowProtectedRenames"=dword:00000001
So adding the following code to my script solved the problem:
RegSetDword(@REGMACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager[AllowProtectedRenames]", 1)
Hope this also is helpfull for other users.

Article ID:   W15952
File Created: 2004:03:30:15:42:00
Last Updated: 2004:03:30:15:42:00