News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

CD - Compress-Decompress Utility

Started by fearless, October 22, 2023, 02:13:10 AM

Previous topic - Next topic

Biterider

Hi
A small contribution. 
Attached is the translation of the compressapi.h file.

Biterider

Biterider

Hi fearless
I have a small suggestion: do not specify the segment in the generated asm file. 
Let the user specify the target segment before the assembler file is included. 
This way you have the choice between .data and .const.

Biterider

fearless

Something like adding a checkbox option to use .DATA or .CONST, like this?

You cannot view this attachment.

Biterider

Hi fearless
Yes, something like that or let the user write

.data
include .\Res\MyCompressedData.asm

That is only a small detail.
Of course, you can edit the file after it has been created, but if you want to automate the tool-chain, that could be a bit tedious.

Biterider

fearless

Updated first post with v1.0.0.2

  • Optimized assembler output to speed up process overall and to fix hangs (buffer overflows) for larger files (100K+)
  • Added checkbox option to specify .DATA segment or .CONST segment for masm output
  • Added Compress Text button and accelerators for it.
  • Increased the max text size in the input edit control in the compress text dialog to 256KB
  • Uploaded x64 version of CD

(Reached max attachments, so only uploading the two source zips in the first post and just the binary only zips here)

jj2007

Win7-64:
x86: Unable to find ordinal 43 in the dynamic link library Cabinet.dll
x64: Unable to find ordinal 40 in the dynamic link library Cabinet.dll

fearless

#21
Quote from: jj2007 on October 29, 2023, 05:27:07 AMWin7-64:
x86: Unable to find ordinal 43 in the dynamic link library Cabinet.dll
x64: Unable to find ordinal 40 in the dynamic link library Cabinet.dll
https://masm32.com/board/index.php?topic=11371.msg124773#msg124773

jj2007

I see - bad luck. I tried to assemble cd.asm but got some errors:
AboutDlg.asm(145) : Error A2275: Constant value too large: 54686973206973206D65616E7420746Fh
 AboutDlg.asm(145): Included by
  Tmp_File.asm(95): Main line code
AboutDlg.asm(145) : Error A2147: Too few arguments to INVOKE: SetWindowTextA
 AboutDlg.asm(145): Included by
  Tmp_File.asm(95): Main line code
CDText.asm(365) : Error A2275: Constant value too large: 546F6F6C746970735F636C6173733332h
 CDText.asm(365): Included by
  Tmp_File.asm(96): Main line code
CDText.asm(365) : Error A2147: Too few arguments to INVOKE: CreateWindowExA
 CDText.asm(365): Included by
  Tmp_File.asm(96): Main line code
CDText.asm(426) : Error A2275: Constant value too large: 436F7572696572204E6577h
 CDText.asm(426): Included by
  Tmp_File.asm(96): Main line code
CDText.asm(426) : Error A2147: Too few arguments to INVOKE: lstrcpyA
 CDText.asm(426): Included by
  Tmp_File.asm(96): Main line code
Tmp_File.asm(405) : Error A2275: Constant value too large: 546F6F6C746970735F636C6173733332h
Tmp_File.asm(405) : Error A2147: Too few arguments to INVOKE: CreateWindowExA
Tmp_File.asm(1097) : Error A2143: Symbol redefinition: CDCompressMem
Tmp_File.asm(1098) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1099) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1100) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1101) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1102) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1103) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1264) : Error A2142: Unmatched block nesting: CDCompressMem
Tmp_File.asm(1274) : Error A2143: Symbol redefinition: CDDecompressMem
Tmp_File.asm(1275) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1276) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1277) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1278) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1279) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1280) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1281) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1423) : Error A2142: Unmatched block nesting: CDDecompressMem
Tmp_File.asm(1957) : Error A2143: Symbol redefinition: CDBitmapCreateFromMem
Tmp_File.asm(1958) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1959) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1975) : Error A2142: Unmatched block nesting: CDBitmapCreateFromMem
Tmp_File.asm: 2075 lines, 1 passes, 93 ms, 0 warnings, 29 errors

fearless

Looks like an issue with the CTEXT macro in those places. For the x64 version I use Uasm64 and have a ctext macro in the windows.inc file (from the WinInc package).

At the end i have a ctext defined as:

CTEXT MACRO quoted_text:VARARG
    LOCAL local_text
    .data
    align 8
    local_text db quoted_text,0
    .code
    align 8
    EXITM <offset local_text>
ENDM


jj2007

If I insert your CTEXT macro behind the include macros.asm line as follows...
include \masm32\macros\macros.asm
CTEXT MACRO quoted_text:VARARG
    LOCAL local_text
    .data
    align 8
    local_text db quoted_text,0
    .code
    align 8
    EXITM <offset local_text>
ENDM

... I get these errors:
*** Assemble using UAsm64  ***

***********
ASCII build
***********

Tmp_File.asm(1106) : Error A2143: Symbol redefinition: CDCompressMem
Tmp_File.asm(1107) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1108) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1109) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1110) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1111) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1112) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1273) : Error A2142: Unmatched block nesting: CDCompressMem
Tmp_File.asm(1283) : Error A2143: Symbol redefinition: CDDecompressMem
Tmp_File.asm(1284) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1285) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1286) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1287) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1288) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1289) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1290) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1432) : Error A2142: Unmatched block nesting: CDDecompressMem
Tmp_File.asm(1966) : Error A2143: Symbol redefinition: CDBitmapCreateFromMem
Tmp_File.asm(1967) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1968) : Error A2092: PROC, MACRO or macro loop directive must precede LOCAL
Tmp_File.asm(1984) : Error A2142: Unmatched block nesting: CDBitmapCreateFromMem
Tmp_File.asm: 2084 lines, 1 passes, 87 ms, 0 warnings, 21 errors

jj2007

Quote from: fearless on October 29, 2023, 07:27:37 AMI use Uasm64 and have a ctext macro in the windows.inc file (from the WinInc package)

Does that mean you use the UAsm version of Windows.inc? I see include windows.inc in CD.inc - no path supplied, so it relies on the user's PATH variable. OTOH, there is include \masm32\macros\macros.asm in CD.asm, so you are clearly also using (parts of) Masm32 SDK.

fearless

Sorry, I probably mixing up the x86 and x64 versions

Yes i use masm32 sdk with the x86 version: ml, linker etc. For the x64 version i use uasm64, wininc.

ML.EXE /c /coff /Cp /nologo /I"M:\masm32\include" cd.asm
And i use the macros.asm in the x86 one including the CTEXT one:

        CTEXT macro Text
            local szText
            .data
            szText byte Text, 0
            .code
            exitm <offset szText> 
        endm

For the x64 this seems to work from the command line:

UASM64.exe /c -win64 -Zp8 /win64 /D_WIN64 /Cp /nologo /W2 /I" M:\UASM\include" cd.asm
And the CTEXT macro is defined in my WinInc windows.inc as:

CTEXT MACRO quoted_text:VARARG
    LOCAL local_text
    .data
    align 8
    local_text db quoted_text,0
    .code
    align 8
    EXITM <offset local_text>
ENDM

Im not sure why the CTEXT macro is not working. Only place close to having a conflicting definition is the following structs, which have szText1 - cant remember if its like that by default or if i modified it perhaps?

NMTTDISPINFOA STRUCT
  hdr              NMHDR  <>
  lpszText          DWORD  ?
  szText1          BYTE 80 DUP (?)
  union
    hInst          DWORD  ?
    hinst          DWORD  ?
  ends
  uFlags            DWORD  ?
  lParam            DWORD  ?
NMTTDISPINFOA ENDS

NMTTDISPINFOW STRUCT
  hdr              NMHDR  <>
  lpszText          DWORD  ?
  szText1          BYTE 80 DUP (?)
  union
    hInst          DWORD  ?
    hinst          DWORD  ?
  ends
  uFlags            DWORD  ?
  lParam            DWORD  ?
NMTTDISPINFOW ENDS

fearless

Interestingly when compiling the x64 version with Uasm64 i did get conflicting definition errors, so in that version i took out the EXTERN lines, which seemed to solve it. I imagine it would be the same if using Uasm to compile the x86 version.

jj2007

I could build the x86 version with the attached batch file, plus this modification of line 78:

option casemap:none
include \masm32\macros\macros.asm
include \Masm32\include\debug.inc

Biterider

Hi fearless
I tested both binaries successfully on Win10.  :thumbsup:

Biterider