+[8.5] can't open incomplete multi-volume rars anymore

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
za222
Member
Member
Posts: 146
Joined: 2003-03-11, 17:19 UTC
Location: Germany

+[8.5] can't open incomplete multi-volume rars anymore

Post by *za222 »

On TC 8 it was possible to open partial archives

file.part01.rar
file.part02.rar
file.part03.rar MISSING

Files contained inside parts 01 and 02 could be extracted.

This is not possible anymore since TC 8.5. It now shows a dialog asking for part03 and when clicking cancel it just errors out.


Winrar itself handles this just fine. (Additionally, it shows an "-->" indicator on files that are incomplete).


Is it possible to get this behavior back in TC8.5?

For example in the dialog asking for the next part file, add a 3rd button labeled "open partial archive".
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think TC should simply open archive as incomplete when user cancels next volume prompt. And ask for next volume again on extracting file that requires it.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Currently TC aborts reading from RAR if unrar.dll returns an error. I will change that and show the file names retrieved until the error occurs (and show an error dialog).
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This has been changed, so TC should show the contents of all parts until the first missing one. Please try it!
Author of Total Commander
https://www.ghisler.com
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

ghisler(Author) wrote:This has been changed, so TC should show the contents of all parts until the first missing one. Please try it!
It seems to work, but the behavior / error dialogs are not descriptive/confusing.

Let me explain two cases.


First case

Only the first part of a multi-volume archive is present. It contains a file, whose compressed size is greater than the part, thus, it is incomplete and continued over the next archive part(s).

When opening this first part, and dismissing TC's question for the subsequent part, it shows an error dialog with only an "OK" button.
Pressing "OK", the dialog closes without anything happening.

Which is fine, since the first part only contains an incomplete file.


Second case

Again, only the first part of a multi-volume archive is present. But this, times, it contains multiple compressed files, which are completely contained within this part (with the exception of the last file, of course).

After dismissing TC's question for the subsequent part, it shows the seemingly same error dialog as in the 1st case, but this time with "OK" and "Cancel" button. Huh...? :shock:
Now, pressing "OK" shows me the content of that part, and "Cancel" closes the dialog without anything happening.



I would suggest to rename those buttons, because as of now the behavior is not consistent nor self-explaining.

Just from the back of my head, i would have a common "Close" button in the error dialog in both cases which just closes the error dialog without anything further happening.

In the second case (that is, where complete files are contained within the archive part), the error dialog should have a second button labelled with something like "Show content of part". (Or alternatively, gray out this button for the first case, with an appropriate button tooltip explaining the situation briefly.)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The problem is that unrar.dll just reports the archive as defective. TC shows this error when no files were returned. When at least one file is found, TC allows the user to see them with OK, or ignore them with Cancel. Since nothing can be unpacked if the first file is partial, there is no need to see archive contents either.
Author of Total Commander
https://www.ghisler.com
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

ghisler(Author) wrote:The problem is that unrar.dll just reports the archive as defective. TC shows this error when no files were returned. When at least one file is found, TC allows the user to see them with OK, or ignore them with Cancel. Since nothing can be unpacked if the first file is partial, there is no need to see archive contents either.
You misunderstood me there. I was not questioning the function or algorithm, I fully understand and agree with you on what you do on the functional level.
But how the UI is communicating with the user is confusing.

Because what you actually do from the users perspective is that you silently change the meaning of the "OK" button, while at the same time adding a "Cancel" button which now receives the same meaning as the "OK" button before, all in a dialog that has the ever same purpose (error indicating incomplete archive).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately there is no MessageBox with just a Cancel button. There is just:
OK
OK,Cancel
Yes
Yes,No
Yes,No,Cancel
Retry,Cancel
Abort, Retry, Ignore
Cancel,Try Again,Continue

I want to use MessageBox to be consistent with other errors, and because it formats long texts very well.

Any suggestions?
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Probably the only way is to change text of the message box button by:
- creating a message hook by calling SetWindowsHookEx, for the current thread only and with WH_CALLWNDPROCRET parameter,
- handling WM_INITDIALOG message in the hook function,
- destroying the message hook after closing the message box.

For local hooks (for the current thread only) antivirus software shouldn't complain.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

@ghisler
If those are the templates that you have available for message boxes, then stick with it as it is now, i would say.

While it might be nicer to have more meaningful button labels, i doubt that the required efforts to implement another MsgBox with configurable button labels would be justified for just this occurence i noticed here.
I mean, there should be other things on your agenda that are more important ;)

However, if one day you decide to implement an Uber-MessageBox, feel free to reconsider my suggestion. :)


@MarcinW:
SetWindowsHookEx unfortunately does not work on Win9x/WinNT, i guess (which are still platforms supported by TC :( )
While it would be nicer to have nice button labels, i think a consistent behavior across all platforms is preferable.
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

SetWindowsHookEx unfortunately does not work on Win9x/WinNT
I can't agree - these systems are abandoned by Microsoft and not mentioned in MSDN, but SetWindowsHookEx works properly.


Below is a piece of code (tested as 32-bit with Windows 95, Windows NT4 without SP and Windows 8.1 Preview):

Code: Select all

uses
  Windows, Messages;

var
  PrevHookHandle : HHOOK;

function MessageBoxHook(Code : Integer; wParam : WPARAM; lParam : PCWPRetStruct) : LRESULT; stdcall;
begin
  if Code = HC_ACTION then
  with lParam^ do
  case message of
    WM_INITDIALOG :
        SetWindowText(GetDlgItem(hwnd,IDCANCEL),'abc');
  end;
  Result:=CallNextHookEx(PrevHookHandle,Code,wParam,Windows.LPARAM(lParam));
end;

begin
  PrevHookHandle:=SetWindowsHookEx(WH_CALLWNDPROCRET,@MessageBoxHook,0,GetCurrentThreadId);
  try
    MessageBox(0,'Test','Test',MB_OK);
  finally
    UnhookWindowsHookEx(PrevHookHandle);
  end;
end.
There is also a question:
how the proper "Cancel" string (in place of 'abc' in this example) can be obtained instead of hardcoding it? I've got some tricky idea, but maybe there is a straightforward method?
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

MarcinW wrote:I can't agree - these systems are abandoned by Microsoft and not mentioned in MSDN
Argh... those suckers... :o
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I prefer not to use such hacks. :)
Author of Total Commander
https://www.ghisler.com
Post Reply