flat assembler
Message board for the users of flat assembler.
Index
> Windows > [SOLVED] It has to be somewhere above |
Author |
|
comrade 05 Mar 2009, 23:43
I can't compile this, its saying __GetMainArgs is an undefined symbol
|
|||
05 Mar 2009, 23:43 |
|
Picnic 05 Mar 2009, 23:55
Hi comrade,
That's because i'm including the CRTDLL.INC in win32ax.inc I found it somewhere inside forum, and using it for a long time with no problems so far.
Last edited by Picnic on 05 Mar 2009, 23:57; edited 1 time in total |
|||||||||||
05 Mar 2009, 23:55 |
|
revolution 05 Mar 2009, 23:57
Where is your 'printf' function? The code doesn't compile for me.
|
|||
05 Mar 2009, 23:57 |
|
Picnic 06 Mar 2009, 00:07
Also inside CRTDLL revolution.
|
|||
06 Mar 2009, 00:07 |
|
LocoDelAssembly 06 Mar 2009, 00:25
I'm always getting port number failed. How is it supposed to be used?
This is the code I'm using: Code: format pe console 4.0 entry main include 'win32ax.inc' NL equ 13,10 INADDR_ANY = 0 IPPROTO_TCP = 6 macro err n { mov [env], err#n } .data wsadata WSADATA saddr sockaddr_in argc dd 0 argv dd ? env dd ? port dd ? hsock dd ? sip rb 256 .code main: cinvoke __GetMainArgs, argc, argv, env, 0 cmp [argc], 2 err 10 jb DispErr mov esi, [argv] mov esi, dword [esi+4] xor eax,eax mov ecx, 4 err 20 @@: movzx ebx, byte [esi] test ebx, ebx je @F cmp ebx, '0' jc DispErr cmp ebx, ':' jnc DispErr lea eax, [eax*5] lea eax, [eax*2+ebx-'0'] inc esi loop @b @@: mov [port], eax err 30 invoke WSAStartup, 0202h, wsadata test eax, eax jne DispErr err 40 invoke socket, AF_INET, SOCK_STREAM, IPPROTO_TCP cmp eax, -1 je WSAErr mov [hsock], eax mov [saddr.sin_family], AF_INET invoke htons, [port] mov [saddr.sin_port], ax mov [saddr.sin_addr], INADDR_ANY err 50 invoke bind, [hsock], saddr, sizeof.sockaddr cmp eax, -1 je MainErr err 60 invoke gethostname, sip, 256 cmp eax, -1 je MainErr err 70 invoke gethostbyname, eax cmp eax, -1 je MainErr mov eax, [eax+12] mov eax, [eax] mov eax, [eax] invoke inet_ntoa, eax invoke lstrcpy, sip, eax cinvoke printf, <'IP: [%s]'>, sip ; <-- ; ; ; ; invoke closesocket, [hsock] invoke WSACleanup jmp Exit MainErr: invoke closesocket, [hsock] WSAErr: invoke WSACleanup DispErr: cinvoke printf, [env] Exit: invoke ExitProcess, 0 err10 db NL,' usage: SERVER [port]',NL,0 err20 db NL,'Port number failed.',NL,0 err30 db NL,'WSAStartup failed.',NL,0 err40 db NL,'Error at socket()',NL,0 err50 db NL,'Error at bind()',NL,0 err60 db NL,'Error at gethostname()',NL,0 err70 db NL,'Error at gethostbyname()',NL,0 section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ wsock32,'WSOCK32.DLL',\ crtdll,'CRTDLL.DLL' include 'api/kernel32.inc' include 'api/wsock32.inc' include 'crtdll.inc' |
|||
06 Mar 2009, 00:25 |
|
comrade 06 Mar 2009, 00:32
It works for me and I don't seem to be getting ACCESS DENIED anywhere. I can't even see how that can possibly be printed from anywhere.
|
|||
06 Mar 2009, 00:32 |
|
Picnic 06 Mar 2009, 08:54
comrade wrote: I can't even see how that can possibly be printed from anywhere. Same here comrade, i am getting a system error message and i can't figure out why. Maybe something bad is going on my desktop pc because i run the code on my laptop and works |
|||
06 Mar 2009, 08:54 |
|
comrade 06 Mar 2009, 09:12
Access denied when you run it or compile it? Does the problem reproduce itself consistently?
|
|||
06 Mar 2009, 09:12 |
|
Picnic 06 Mar 2009, 09:20
Compiles fine, when i run it from command line, it displays a message in Greek 'Δεν επιτρέπεται η πρόσβαση' translated simply means 'Access Denied'
|
|||
06 Mar 2009, 09:20 |
|
Picnic 06 Mar 2009, 21:31
I think i finally found the cause. It was AVG antivirus. I'm so f... pissed off
Thank you all. |
|||
06 Mar 2009, 21:31 |
|
rugxulo 09 Mar 2009, 00:40
Antiviruses are very dumb when it comes to heuristics, esp. assembly apps.
|
|||
09 Mar 2009, 00:40 |
|
revolution 09 Mar 2009, 00:52
The most frustrating of all was when I had one of my TEXT (asm source) files tagged by Norton as malware and it refused to let me open it for editing! I had to ask the PC owner to turn off Norton. The owner was quite amused by it when he saw the source file was harmless text. I hate AVs.
|
|||
09 Mar 2009, 00:52 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.