The MASM Forum

General => The Campus => Topic started by: Magnum on December 28, 2012, 02:45:33 AM

Title: Lots of errors with window.inc
Post by: Magnum on December 28, 2012, 02:45:33 AM
This generates a lot of errors with windows.inc.
The code was written in 2005 if that helps.




; Code by Petroizki

.386
.model flat, stdcall

include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
include C:\masm32\include\ws2_32.inc
include C:\masm32\include\wsock32.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\ws2_32.lib
includelib \masm32\lib\wsock32.lib

.data

address db "192.168.0.1",0
icmp db "icmp.dll",0
icmpcreate db "IcmpCreateFile",0
icmpsend db "IcmpSendEcho",0
senddata db 32 dup (66h)

.data?

reply db (SIZEOF ICMP_ECHO_REPLY) + (SIZEOF senddata) dup (?)

.code

start:

invoke inet_addr, ADDR address
mov ebx, eax

invoke LoadLibrary, ADDR icmp

mov ebp, eax

invoke GetProcAddress, eax, ADDR icmpcreate

call eax ; IcmpCreateFile

mov edi, eax

invoke GetProcAddress, ebp, ADDR icmpsend

push 1000
push SIZEOF reply
push OFFSET reply
push NULL
push SIZEOF senddata
push OFFSET senddata
push ebx
push edi
call eax ; IcmpSendEcho

cmp eax, 0
je @error

; JIIHAAAAA! (ping was succesful)
int 3h

invoke FreeLibrary, ebp

invoke ExitProcess, 0

@error:
; ERROR..
int 3h

end start
Title: Re: Lots of errors with window.inc
Post by: qWord on December 28, 2012, 02:58:05 AM
Assembles without any error here (MASM32 v11)

You may change the include paths thus they are realtiv or point to your MASM32 installation.
Title: Re: Lots of errors with window.inc
Post by: dedndave on December 28, 2012, 03:23:53 AM
it assembles fine, here
i made one change....

Quote.386
        .MODEL  Flat, StdCall
        OPTION  CaseMap:None