News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

an error in masm32

Started by debugee, February 10, 2012, 03:55:16 AM

Previous topic - Next topic

debugee

.386
.model flat,stdcall
option casemap:none


.code

shell_start      equ      this byte
      nop
      jmp   @f      ;; this instruct give rise to error !!
      nop
   @@:
      nop
shell_end      equ      this byte


TestFunc   proc   uses ebx esi edi _dwTest
   
   
      ret
TestFunc   endp   
start:
   ;;;;shell_end - shell_start = nop + jmp(short jmp) + nop + nop = 1 + 2 + 1 + 1 = 5
   invoke   TestFunc,shell_end - shell_start   ;;result shell_end - shell_start = 0DH !!
   
   ;;;you can see this error by Ollydbg.

   ret
end   start

dedndave

masm32 is a package of libraries, include files, examples, tutorials, and tools
masm is a program by microsoft   :P
this is a masm bug - not masm32
it is probably fixed on more recent versions of masm
there was a recent related thread, only the problem was with $ in the .DATA section

at any rate, for your case, try this for a work-around...
include \masm32\include\masm32rt.inc

.code

shell_start::
      nop
      jmp   @f      ;; this instruct give rise to error !!
      nop
   @@:
      nop
shell_end::


TestFunc   proc   uses ebx esi edi _dwTest
   
   
      ret
TestFunc   endp   
start:
   ;;;;shell_end - shell_start = nop + jmp(short jmp) + nop + nop = 1 + 2 + 1 + 1 = 5
   invoke   TestFunc,shell_end - shell_start   ;;result shell_end - shell_start = 0DH !!
   
   ;;;you can see this error by Ollydbg.

   ret
end   start

debugee

thanks for you reply !
but you code still error .

shell_start::
shell_end::

that syntax i don't see before ,  :lol\
i had learn it at  here .  :lol :lol


dedndave

Quotebut you code still error

interesting   :P

Quoteshell_start::
shell_end::

that syntax i don't see before

it is similar to ":", except "::" has global scope

debugee

 :lol

::

i have see that in nasm

dedndave

it seems to be a problem with INVOKE (a masm-internal macro)
try this....

        push    shell_end-shell_start
        CALL    TestFunc


debugee

hi dedndave .

yes, invoke instruct lead to the error .
yestorday, i had to modify it like you code
:U

dedndave

i happened to think - this will probably work...
TempParm = shell_end-shell_start
        INVOKE  TestFunc,TempParm

:8)

hutch--

 :bg

These bug reports always make me laugh, MASM has always been a buggy old pig that you had to be familiar with to get results from. Its an assembler, not a consumer multimedia app and there must be at least a million ways of writing code that does not work. The trick is to write code that does work.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

debugee


SteveAsm

Quote from: hutch-- on February 10, 2012, 07:56:05 AM
...there must be at least a million ways of writing code that does not work. The trick is to write code that does work.

That is worthy of being a "quote".

clive

Quote from: SteveAsmThat is worthy of being a "quote".

Made me chuckle too, perhaps the million monkeys working on Shakespeare could knock out a couple of bad MASM examples in the process. Or perhaps Edison's quip about discovering a thousand ways not to make a light bulb.
It could be a random act of randomness. Those happen a lot as well.