Total SQX 1.10 (packer plug-in)
Moderators: Hacker, petermad, Stefan2, white
- XPEHOPE3KA
- Power Member
- Posts: 854
- Joined: 2006-03-03, 18:23 UTC
- Location: Saint-Petersburg, Russia
- XPEHOPE3KA
- Power Member
- Posts: 854
- Joined: 2006-03-03, 18:23 UTC
- Location: Saint-Petersburg, Russia
- XPEHOPE3KA
- Power Member
- Posts: 854
- Joined: 2006-03-03, 18:23 UTC
- Location: Saint-Petersburg, Russia
- XPEHOPE3KA
- Power Member
- Posts: 854
- Joined: 2006-03-03, 18:23 UTC
- Location: Saint-Petersburg, Russia
I have investigated the problem and I don't really know what to do. The problem is that the plug-in tries to reset the encryption settings after each compression to avoid that an later created archive will be encrpyted. When using the cretate separate archive option this is just like creating one archive at the time. There is no way to find out that this is some kind of batch operation.
Any ideas how to solve this problems once for all?
I have prepared a special edition which is identical to 1.10 but doesn't delete the encryption settings after packing. It may have side effects and should only be used if the "create separate archives" option is used.
http://lefteous.totalcmd.net/tc/archives/totalsqx/wcx_totalsqx_1.10_se.zip
Any ideas how to solve this problems once for all?
I have prepared a special edition which is identical to 1.10 but doesn't delete the encryption settings after packing. It may have side effects and should only be used if the "create separate archives" option is used.
http://lefteous.totalcmd.net/tc/archives/totalsqx/wcx_totalsqx_1.10_se.zip
- XPEHOPE3KA
- Power Member
- Posts: 854
- Joined: 2006-03-03, 18:23 UTC
- Location: Saint-Petersburg, Russia
I tested such situation with 7z 0.5.5 plugin - same problem! Only first archive is encrypted. Seems to be a major defect of TC WCX interface. Maybe, you can attract Ghisler's attention to the problem?
SE version works properly, thank you. It actually deletes encryption settings only when the settings dialog is opened or the plugin is loaded, doesn't it? /* what you've said seems to mean that it never deletes those settings
*/
Because when I archive some files with "create separate archive" ticked and with some passwords, and when I after that pack some other files without opening the settings dialog, the second bunch of files are packed encrypted!
So, I guess, you should remember the state of "create separate archive" option, and you somehow count the number of selected files. Then you save in ini or somewhere a variable decreasing with each next packed item. If it becomes zero, delete the passwords. However, you should make it zero if the user aborts operation, or if TC crashes somehow you should make it zero on plugin load, so you should make several vars for each TC instance, so... so... so.. etc.
PainInTheAss I would say - it's easier to convince Ghisler to do something on the problem...

SE version works properly, thank you. It actually deletes encryption settings only when the settings dialog is opened or the plugin is loaded, doesn't it? /* what you've said seems to mean that it never deletes those settings

Because when I archive some files with "create separate archive" ticked and with some passwords, and when I after that pack some other files without opening the settings dialog, the second bunch of files are packed encrypted!
So, I guess, you should remember the state of "create separate archive" option, and you somehow count the number of selected files. Then you save in ini or somewhere a variable decreasing with each next packed item. If it becomes zero, delete the passwords. However, you should make it zero if the user aborts operation, or if TC crashes somehow you should make it zero on plugin load, so you should make several vars for each TC instance, so... so... so.. etc.
PainInTheAss I would say - it's easier to convince Ghisler to do something on the problem...

F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
2XPEHOPE3KA
All your observations are correct. You really need to be careful when using this special version. Password handling will be completely different in the next version of Total SQX but that doesn't mean this problem is solved. TC 7 allows to use the the user choice in the packer dialog in a plug-in.
It would be really great to see some improvements here but that's up to Ghisler.
All your observations are correct. You really need to be careful when using this special version. Password handling will be completely different in the next version of Total SQX but that doesn't mean this problem is solved. TC 7 allows to use the the user choice in the packer dialog in a plug-in.
It would be really great to see some improvements here but that's up to Ghisler.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Well, Total Commander 7 does support a new flag for this already, but your plugin doesn't seem to use it yet:
In GetPackerCaps, you need to add PK_CAPS_ENCRYPT=512 to tell TC that your plugin supports encryption.
When the user then checks the option "Encrypt" in Total Commander, TC will set the flag PK_PACK_ENCRYPT=4 in the function PackFiles. I checked this, it is set correctly also when packing multiple files. When you get PK_PACK_ENCRYPT, you should ask the user for a password if he hasn't set a standard password.
In GetPackerCaps, you need to add PK_CAPS_ENCRYPT=512 to tell TC that your plugin supports encryption.
When the user then checks the option "Encrypt" in Total Commander, TC will set the flag PK_PACK_ENCRYPT=4 in the function PackFiles. I checked this, it is set correctly also when packing multiple files. When you get PK_PACK_ENCRYPT, you should ask the user for a password if he hasn't set a standard password.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I'll try to explain the problem again.
1. user selects the files to pack.
2. Then he packs the files with "create separate archives"
3. TC sends PK_CAPS_ENCRYPT for every archive so the user has to enter a password again and again. The user intension is to encrypt each of the separate archives with the same password and without addtional interaction. Imaging the case where packing a file needs several minutes, then the next file is packed and the plug-in asks again. This would be quite annoying.
The plug-in somehow needs to know if an archive is the last to pack. If it's not the last the plug-in will not delete the password and reuse it until TC signals the last archive to pack.
BTW: It's a bit irritating to read that you explain to me how a new flag works that I suggested and confirmed to work fine
Creating a real world plug-in is something else though.
1. user selects the files to pack.
2. Then he packs the files with "create separate archives"
3. TC sends PK_CAPS_ENCRYPT for every archive so the user has to enter a password again and again. The user intension is to encrypt each of the separate archives with the same password and without addtional interaction. Imaging the case where packing a file needs several minutes, then the next file is packed and the plug-in asks again. This would be quite annoying.
The plug-in somehow needs to know if an archive is the last to pack. If it's not the last the plug-in will not delete the password and reuse it until TC signals the last archive to pack.
BTW: It's a bit irritating to read that you explain to me how a new flag works that I suggested and confirmed to work fine

Last edited by Lefteous on 2007-05-15, 16:13 UTC, edited 1 time in total.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Well, your plugin doesn't seem to use PK_CAPS_ENCRYPT right now, so that's why I suggested to use it.
About the multiple archives: It's quite easy to solve: PackFiles is called only once per instance (no concurrent or threaded packing). So you can simple call GetTickCount() at the end of PackFiles and set a variable LastPackTime. Then call GetTickCount() again at the start of the next PackFiles function, and if smaller than, say, 200 ms, re-use the password. TC calls PackFiles repeatedly for each archive, without doing anything in between.
About the multiple archives: It's quite easy to solve: PackFiles is called only once per instance (no concurrent or threaded packing). So you can simple call GetTickCount() at the end of PackFiles and set a variable LastPackTime. Then call GetTickCount() again at the start of the next PackFiles function, and if smaller than, say, 200 ms, re-use the password. TC calls PackFiles repeatedly for each archive, without doing anything in between.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com