lurner
January 28th, 2005, 04:04 AM
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:
Assembling file: test.ASM
**Error** test.ASM(29) Illegal number
**Error** test.ASM(34) Illegal number
Error messages: 2
Warning messages: None
Passes: 1
Remaining memory: 418k
Here is my code... btw: I am writing for 8086, Windows XP
.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
I must be trying to load the addresses wrong or I am not doing something with them in order to make them valid. I tried using quotes "" and square brackets [] and neither worked. Can someone please help me fix this code so it will work. This will be a great snippet to learn from if I can just get it to movE the kernel addresses into bx. Unless there is a better way, in which I would be interested in seeing.
Thanks in advance
Assembling file: test.ASM
**Error** test.ASM(29) Illegal number
**Error** test.ASM(34) Illegal number
Error messages: 2
Warning messages: None
Passes: 1
Remaining memory: 418k
Here is my code... btw: I am writing for 8086, Windows XP
.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
I must be trying to load the addresses wrong or I am not doing something with them in order to make them valid. I tried using quotes "" and square brackets [] and neither worked. Can someone please help me fix this code so it will work. This will be a great snippet to learn from if I can just get it to movE the kernel addresses into bx. Unless there is a better way, in which I would be interested in seeing.
Thanks in advance