0

I want to decompress data that is compressed by using LZMA SDK in MASM32 program.
I found some assembly files such as LzmaDecOpt.asm in the LZMA SDK.

https://github.com/kornelski/7z/blob/main/Asm/x86/LzmaDecOpt.asm

I think this is the decompressor of LZMA for Assembly program.
But I can't understand how to use this to decompress data.
Please explain how to use this to decompress in MASM32 program.

  • 1
    That directory of asm functions might just be internal helpers with hand-written asm instead of compiler-generated code from pure C. The comments at the top say "*That code is tightly coupled with LzmaDec_TryDummy() and with another functions in LzmaDec.c file.*". You should just link the library and call the normal API functions, same way you'd call any C function according to the standard calling convention. – Peter Cordes Apr 27 '23 at 03:47
  • I tried to call the SDK api, but I failed to include C header files. I have got syntax errors in *.h files. Someone said that I should convert C header files to Assembly file to include. Is it right? – HappyLuck99 Apr 27 '23 at 03:49
  • 3
    `.h` files use C syntax, so of course you can't `include` them in an assembly source file. MASM syntax uses `extern` to declare functions from other files / libraries, as in [Calling a standard-library-function in MASM](https://stackoverflow.com/q/57377397) like `EXTERN printf :PROC`. I think MASM even allows you to declare prototypes, at least in 32-bit code where it has an `invoke` directive, otherwise you're setting up the args yourself so MASM doesn't need to know about args or return values. – Peter Cordes Apr 27 '23 at 03:55

0 Answers0