| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Assembly Questions and Answers for Assembly here! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Invalid Number Help
Hello, I am trying to run a simple ASM sample that opens notepad.exe. When I try to load WinExec and ExitProcess addresses into bx the TASM assembler says:
Quote:
Code:
.model small
.stack
.data
.code
main proc ;start main procEDURE
start:
jmp short GetCommand
CommandReturn:
pop bx ;bx now holds the handle to the string
xor ax,ax
push ax
xor ax,ax
mov [bx + 22],al ;insert the NULL character
push bx
mov bx, 0x77e6fd35
call bx ;call WinExec(path,showcode)
xor ax,ax ;zero the register again, clears winexec retval
push ax
mov bx, 0x77e798fd
call bx ;call ExitProcess(0);
GetCommand:
call CommandReturn
db "cmd.exe /c notepad.exe$"
mov ax,4c00h ;end clean
int 21h ;intERRUPT - (DOS Service)
main endp ;end main procEDURE
end main ;exit application
Thanks in advance |
|
#2
|
|||
|
|||
|
Re: Invalid Number Help
the error comes from line
> mov bx, 0x77e6fd35 it is in C syntax, not ASM, and bx is a 16 bit register, it cannot hold 32bit values. Furthermore, you are trying to call 32bit protected mode code from 16 bit real-mode (or v86mode) code. That cannot work. |
|
#3
|
||||
|
||||
|
Re: Invalid Number Help
Quote:
Code:
mov ebx, 077e798fdh ./ 11 posts to go
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
|
#4
|
|||
|
|||
|
Re: Invalid Number Help
When I was using tasm while writing code I used a macro:
calle MACRO x extrn x:PROC call x ENDM calle then I just wrote: calle somefunction and that was enough. I also recommend to read some optimization trick, because they can be quite useful when writing in asm. I learned then by heart and now with c++ I'm still trying to use them, although the compiler's optimizer will "do that for me" it's just a habit :P |
|
#5
|
|||
|
|||
|
Re: Invalid Number Help
oh.. ok so use nasm or masm and try it that way.. I am learning ASM in reverse I first learnt VB then C++ and now ASM. I am so use to API to not use it makes me feel limited while coding, I am definently graduating early to 32bit as soon as possible.
thanks a lot for your help guys, much appreciated.
|
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|