[Bug 15661] CardTricks141.exe can't format SD Memory Card (needs 'format.com' utility)

wine-bugs at winehq.org wine-bugs at winehq.org
Sun May 25 04:51:25 CDT 2014


https://bugs.winehq.org/show_bug.cgi?id=15661

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |focht at gmx.net
          Component|-unknown                    |programs
            Summary|cardtricks141.exe can't     |CardTricks141.exe can't
                   |format SD Memory Card       |format SD Memory Card
                   |                            |(needs 'format.com'
                   |                            |utility)

--- Comment #6 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming, still present.

First you need to make sure that the 'Allow Fixed Disks' option is selected in
lower right group box since Wine isn't reporting this as 'removable' (bug
16091).

The executable is an AutoIT/AutoHotKey script compiled to native code and
finally packed with UPX.

--- snip ---
Unpacking: z:\home\focht\Downloads\CardTricks141.exe
Script Type 3.2.5+ found.
AlternativeSigScan for 'FILE'-signature in au3-body...
Scanning for FILE-(old)signature: FF 6D B0 CE
...not found.
Scanning for FILE-(new)signature: 6B 43 CA 52
0007C256 -> SrcFile_FileInst: >>>AUTOIT SCRIPT<<<
Seeking back to script start position...
AU3_Signature: A3 48 4B BE 98 6C 4A A9 99 4C 53 0A 86 D6 48 7D
 ---> ScriptStartOffset: 0007C200
      EndOf_PE-ExeFile : 0007C200
Extracting ExeIcon/s to: "z:\home\focht\Downloads\CardTricks141.ico"
0007C214 -> SubType: 0x41  AU3!
~ Note:  The following offset values are were the data ends (and not were it
starts) ~
0007C218 -> New tokenised AutoIt script found.
Script is password protected!
...
--- snip ---

Unwrapping and decompiling gives some hints (besides looking at Wine trace
log):

--- snip ---
If $redraw < 2 Then 
  GUICtrlSetState($mbut_form_fat, $GUI_DISABLE)
  Do
    $card_drive = FileSelectFolder(    "Select your SD Card drive - Please note
that only 'Removable' or" & @CRLF & _ 
                    "'Unknown' (and 'Fixed' if selected) drive types will be" &
@CRLF & _ 
                    "accepted; select Cancel if no drive selectable.", _ 
                    "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 2, "",
$cardmenu )
    If $card_drive = "" Then ExitLoop
    $card_drive = StringLeft($card_drive, 3)    ; ignore selected subdir
    Switch DriveGetType($card_drive)
      Case "Removable", "Unknown"
        $acceptable = True
      Case "Fixed"
        If IsChecked($chk_fix_disk) Then
          $acceptable = True
        Else
          $acceptable = False
        EndIf
      Case Else
        $acceptable = False
    EndSwitch
  Until ( StringInStr($illegal, StringLeft($card_drive, 1)) = 0 ) And 
$acceptable
EndIf
--- snip ---

Nothing to see here, just plain 'DriveGetType' AutoIt script function call
which maps to 'GetDriveTypeW' API.

Anyway, media is properly recognized if pre-formatted as FAT and mapped to
driver letter within Wine.

The problem is this:

--- snip ---
0023:Call KERNEL32.CreateProcessW(00000000,0089cf10
L"C:\\windows\\system32\\cmd.exe /c echo | format F: /FS:FAT /V:CANON_DC
/X",00000000,00000000,00000000,00000000,00000000,0089af10
L"Z:\\home\\focht\\Downloads",0089aec8,0089ae8c) ret=00431f7b
...
002c:Call KERNEL32.__wine_kernel_init() ret=7bc5a4b2
0023:Ret  KERNEL32.CreateProcessW() retval=00000001 ret=00431f7b 
...
Can't recognize 'format F: /FS:FAT /V:CANON_DC /X' as an internal or external
command, or batch script.
--- snip ---

Format part of AutoIT script:

--- snip ---
; check for photo/video on card
If DosExec("dir " & $drive & "*.JPG /S") = 0 Then $warn &= " JPG"
If DosExec("dir " & $drive & "*.CRW /S") = 0 Then $warn &= " CRW"
If DosExec("dir " & $drive & "*.AVI /S") = 0 Then $warn &= " AVI"
If $warn <> "" Then $warn = "Attention! Card " & $drive & " contains:" & $warn
& @CRLF & @CRLF

If ( $warn <> "" ) Or ( Not IsChecked($chk_stop_info) ) Then
  $ret = MsgBox(1,"Warning", $warn & _ 
          "Formatting will DESTROY ALL DATA on card " & $drive & @CRLF & @CRLF
& _ 
          "Are you sure you want to continue ?" )
  If $ret = 2 Then Return 0    
EndIf
If DriveSpaceTotal($drive) > 4096 Then
  $type = " as FAT32"
  $cmd = " /FS:FAT32"
  $label = ""
  If Not IsChecked($chk_stop_info) Then
    MsgBox(0, "Warning", _ 
      "Your card needs to be formatted with the FAT32" & @CRLF & _ 
      "file system. CHDK can not start from this card," & @CRLF & _ 
      "and 'CHDK->Card' option has been disabled." )
  EndIf
Else
  If DriveSpaceTotal($drive) > 2048 Then 
    If Not IsChecked($chk_stop_info) Then
      MsgBox(0, "Warning", _ 
        "Your card needs to be FAT formatted with (non-standard)" & @CRLF & _ 
        "64 KB clusters, for maximum camera compatibility try" & @CRLF & _ 
        "using a smaller (max. 2 GB) card." )
    EndIf
  EndIf
  $type = " as FAT16"
  $cmd = " /FS:FAT"
EndIf
SplashTextOn("", "Formatting Card " & $drive & $type & " ...", 250, 40,
$wpos[0] + R(275) - 125, $wpos[1] + R(160) - 20, 33)
$ret = DosExec("echo | format " & StringLeft($drive, 2) & $cmd & " /V:" &
$label & " /X")                
SplashOff()
If $ret <> 0 Then 
  CardWriteError()
  Return 0
Else 
  If $label = "CANON_DC" Then FileWrite($drive & "ver.req", "")
  Return 2
EndIf
--- snip ---

All "CANON cam" preparation steps happening after formatting can be extracted
from the AutoIT decompiled script but that's more or less boring stuff.

There is also a hint at the website: http://chdk.wikia.com/wiki/CardTricks

--- quote ---
WARNING : The CardTricks utility is obsolete. It may not correctly install the
current version of CHDK. It is also not recommended use with cameras released
after 2010 or with SD cards bigger than 4Gb. The most recent documentation
about SD card preparation for use with CHDK can always be found at this link>
Prepare Your SD Card 
--- quote ---

This is already flagged as abandonware.

$ sha1sum CardTricks141.zip 
697863901fc571d90527eed8df4291f7507d20ef  CardTricks141.zip

$ du -sh CardTricks141.zip 
424K    CardTricks141.zip

$ wine --version
wine-1.7.19-56-gee13e10

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list