Replace any file with 'rename target' via TCMADMIN fails

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Replace any file with 'rename target' via TCMADMIN fails

Post by *MVV »

E.g. I want to replace plugin that is loaded in TC. Steps:
1. Open folders with new plugin DLL and plugin installation folder.
2. Drag updated plugin file or use F5 to open copy dialog, click OK.
3. In replace dialog choose 'auto-rename target' under 'More options'.
4. Choose 'As Administrator', confirm UAC request (or enter login/password if you're under Windows XP and your account doesn't have admin rights).

In result TC tells that it can't write to file, 'retry' button doesn't help. If you click 'abort', you will see that TC successfully renamed old plugin file but couldn't copy new file! Now you may repeat copy procedure (you meet steps 2, 4 because target file doesn't exist) and TC will successfully copy file. So it is a question why it couldn't copy it before. :)

I can reproduce this bug under Windows XP (user account) and Windows 7 (UAC). If I do the same via TC that is started with admin rights, operation succeeds w/o errors.


Added:
Same problem take place with any file, not only used by some process, e.g. even with text file. But we may replace text files w/o any renaming targets.
Last edited by MVV on 2011-06-16, 16:09 UTC, edited 1 time in total.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Strange, TC doesn't try to rename the plugin file. Have you tried cm_unloadplugins before copying?
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It doesn't matter what kind of DLL is this file - plugin or not, the main thing that it is loaded by some process. Windows NT allows to rename/move loaded DLLs within same volume so it is unnecessary to unload module to rename it.

Even more, we have convenient way to replace loaded plugin - I replace file using 'auto-rename target' and then execute cm_UnloadPlugins - and then I can use updated plugin w/o restarting TC. E.g. if this plugin is content plugin, I need only to hover any file by mouse and TC loads plugin because it needs to show its field in tooltip. :)

The only problem of this topic - why 'auto-rename target' via TCMADMIN renames old file but can't copy new one.

BTW just now I've tried it with text file - same problem exists. TC successfully renames old file but can't copy new one. So, TCMADMIN can auto-rename existing file, it can copy file, but can't do both. :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I don't see any reason for that behaviour - I will check it in the debugger.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Thanks:)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

OK, I found it! You may be getting two "as admin" requests now, but at least it will work.
Author of Total Commander
https://www.ghisler.com
Post Reply