Author Topic: ml.exe 10 strange behaviour  (Read 7553 times)

HellRaider

  • Guest
ml.exe 10 strange behaviour
« on: March 16, 2013, 11:03:42 PM »
I was trying out ArTeam Win32 Assembler Coding -> "Customising Your Keygen" tutorial

Everything works fine for ml.exe provided in masm32v11r.zip. But when i upgraded ml to v10 (Visual Studio 2010) it started showing error in that particular example only. Also it did not produce any executable.

C:\WinAsm\f-CustomKeygen.asm(71) : error A2070:invalid instruction operands

Line 71 : invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

Any help other than suggesting to stick with old version will be appreciated...... Thanks

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ml.exe 10 strange behaviour
« Reply #1 on: March 16, 2013, 11:16:02 PM »

Vortex

  • Member
  • *****
  • Posts: 2326
Re: ml.exe 10 strange behaviour
« Reply #2 on: March 16, 2013, 11:32:19 PM »
Hi HellRaider,

Dave is right. You should read the forum rules before asking support to build a keygen.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7528
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: ml.exe 10 strange behaviour
« Reply #3 on: March 16, 2013, 11:46:10 PM »
Apart from removing any reference to keygens, what you need to do is compare the function prototype to the data sizes in your own calling of the function.

Also if you are not in a position to debug ML 10.00, use 9.00, seemed to do everything fine.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

HellRaider

  • Guest
Re: ml.exe 10 strange behaviour
« Reply #4 on: March 17, 2013, 04:38:55 AM »
With due respect :dazzled: @dedndave and @Vortex, I did not ask for coding a keygen......
Basically i was trying to play .xm file using ufmod library

Thanks @hutch--, any pointer how to debug ml 10.
I cant understand why when passing .xm as table the program doesn't work (works fine in default ml). But it works fine when passing .xm directly as resource.

Not working:
invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

Working Code:
invoke uFMOD_PlaySong,123,xmSize,XM_RESOURCE
.rc
123 RCDATA DISCARDABLE "C:\WinAsm\uFMOD\chiptune.xm"





@compare the function prototype to the data sizes in your own calling of the function.
how??

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ml.exe 10 strange behaviour
« Reply #5 on: March 17, 2013, 05:11:47 AM »
here is the thing...

if you can't get through the first post without mentioning keygen's,
then assembly language may not be your cup of tea

when you register for the forum, you confirm that you have read the rules
if you want to play with the big dogs, you have to be able to absorb a lot of documentation

you could have asked for help without mentioning keygen's, at all - DOH
that's your bad, not ours - don't try to turn it back on Vortex and me - lol


as for the difference between the working and non-working code...

with the incomplete code example, we cannot really say what the problem is
i.e., we do not know how "table" and "xmSize" are defined
we can assume that you have included ufmod.inc, so that XM_MEMORY and XM_RESOURCE are defined as equates


here is what i recommend...

create a small example program, using just uFMOD_PlaySong
try not to name it "keygen.asm"   :P
attach the entire project so that we don't each have to write a program to offer assistance
by doing that, we can see how you have defined the variables, prototypes, and so on

also - let us know which version of the library you are using

HellRaider

  • Guest
Re: ml.exe 10 strange behaviour
« Reply #6 on: March 18, 2013, 04:45:56 AM »
; ufmod-1.25.2a-win32

.386
.model flat, stdcall
option casemap:none

include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib
include C:\WinAsm\uFMOD\ufmod.inc
includelib C:\WinAsm\uFMOD\ufmod.lib
includelib winmm.lib

.data
include C:\WinAsm\uFMOD\chiptune.inc
xmSize equ $ - table

.data?
hInstance   dd ?

.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax

;error -> option 1
;invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

;works fine -> option 2
;invoke uFMOD_PlaySong,123,hInstance,XM_RESOURCE

invoke Sleep,10000
invoke ExitProcess,0
end start



.rc file for option2
123 RCDATA DISCARDABLE "C:\WinAsm\uFMOD\chiptune.xm"
« Last Edit: March 18, 2013, 06:15:42 AM by HellRaider »

Vortex

  • Member
  • *****
  • Posts: 2326
Re: ml.exe 10 strange behaviour
« Reply #7 on: March 18, 2013, 05:04:18 AM »
Code: [Select]
xmSize equ $ - table
I assume table is defined in chiptune.inc


HellRaider

  • Guest
Re: ml.exe 10 strange behaviour
« Reply #8 on: March 18, 2013, 05:20:36 AM »
yes.

include C:\WinAsm\uFMOD\chiptune.inc

works fine for default ml
but not working in ml 10

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ml.exe 10 strange behaviour
« Reply #9 on: March 18, 2013, 05:34:45 AM »
that means we cannot build the sample project without it   :P
i managed to find a file that is named chiptune.xm, at 16,417 bytes
but - that isn't an INC file - lol

i noticed that you have the line
Code: [Select]
includelib winmm.libbut, i don't see the INC file to go with it
probably not the problem, but i thought i'd mention it

you can attach zip files to your post - see the Attachments and other options link under the reply window

jj2007

  • Member
  • *****
  • Posts: 10537
  • Assembler is fun ;-)
    • MasmBasic
Re: ml.exe 10 strange behaviour
« Reply #10 on: March 18, 2013, 08:41:11 AM »
Not working:
invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

The problem is not addr table, but rather xmSize. You may use

mov eax, xmSize
invoke uFMOD_PlaySong,addr table, eax, XM_MEMORY

If you want to save the extra byte, here is a solution that works with ML 6.15 and ML 10.0:

include chiptune.inc
xmSize CATSTR %($ - table)

Looks kinda weird, of course. Don't call it a bug in ML 10.0, it's certainly a feature :greensml:

By the way, JWasm will assemble your proggie more than twice as fast as ML 10.0, and it accepts the old syntax.
« Last Edit: March 18, 2013, 10:37:54 AM by jj2007 »

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ml.exe 10 strange behaviour
« Reply #11 on: March 18, 2013, 09:55:46 AM »
that seems strange
i wonder if this would work
Code: [Select]
invoke uFMOD_PlaySong,addr table, dword ptr xmSize, XM_MEMORY
also - beware of possible problems using the $ operator
i seem to recall there was a masm bug with that one

one possible work-around for the bug might be
Code: [Select]
.data
include C:\WinAsm\uFMOD\chiptune.inc
xmEnd label byte
;
;
invoke uFMOD_PlaySong,addr table, dword ptr (xmEnd-table), XM_MEMORY
you may not even need the "dword ptr" or parens

HellRaider

  • Guest
Re: ml.exe 10 strange behaviour
« Reply #12 on: March 18, 2013, 04:24:38 PM »
include chiptune.inc
xmSize CATSTR %($ - table)


Worked like a charm... :eusa_clap:

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ml.exe 10 strange behaviour
« Reply #13 on: March 19, 2013, 12:00:42 AM »
 :t