From d84ac5044bd22608199a0492dd906be050b1a930 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Fri, 7 Jun 2013 17:26:03 +0000 Subject: [PATCH] moved include files for network programs to /programs folder, fixed synergyc. git-svn-id: svn://kolibrios.org@3618 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/{network => }/debug-fdo.inc | 0 programs/{network => }/libio.inc | 0 programs/macros.inc | 89 +++- programs/{network => }/network.inc | 0 programs/network/config.inc | 1 - programs/network/dll.inc | 160 ------ programs/network/downloader/downloader.asm | 16 +- programs/network/ftpd/commands.inc | 8 +- programs/network/ftpd/ftpd.asm | 14 +- programs/network/icmp/ping.asm | 14 +- programs/network/ircc/ircc.asm | 17 +- programs/network/macros.inc | 588 --------------------- programs/network/netcfg/netcfg.asm | 43 +- programs/network/netstat/netstat.asm | 10 +- programs/network/nslookup/nslookup.asm | 22 +- programs/network/pppoe/pppoe.asm | 14 +- programs/network/proc32.inc | 270 ---------- programs/network/socketdbg/socketdbg.asm | 23 +- programs/network/struct.inc | 240 --------- programs/network/synergyc/synergyc.asm | 74 +-- programs/network/tcpserv/tcpserv.asm | 26 +- programs/network/telnet/telnet.asm | 18 +- programs/network/tftpc/tftpc.asm | 61 ++- programs/network/vncc/vncc.asm | 62 ++- programs/network/zeroconf/zeroconf.asm | 34 +- 25 files changed, 345 insertions(+), 1459 deletions(-) rename programs/{network => }/debug-fdo.inc (100%) rename programs/{network => }/libio.inc (100%) rename programs/{network => }/network.inc (100%) delete mode 100644 programs/network/config.inc delete mode 100644 programs/network/dll.inc delete mode 100644 programs/network/macros.inc delete mode 100644 programs/network/proc32.inc delete mode 100644 programs/network/struct.inc diff --git a/programs/network/debug-fdo.inc b/programs/debug-fdo.inc similarity index 100% rename from programs/network/debug-fdo.inc rename to programs/debug-fdo.inc diff --git a/programs/network/libio.inc b/programs/libio.inc similarity index 100% rename from programs/network/libio.inc rename to programs/libio.inc diff --git a/programs/macros.inc b/programs/macros.inc index 1d9ccbe22f..1a396a9de2 100644 --- a/programs/macros.inc +++ b/programs/macros.inc @@ -292,7 +292,8 @@ include 'config.inc' ;__CPU_type equ p5 SYSENTER_VAR equ 0 -macro mcall a,b,c,d,e,f { ; mike.dld +macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls + local ..ret_point __mov eax,a __mov ebx,b __mov ecx,c @@ -300,7 +301,30 @@ macro mcall a,b,c,d,e,f { ; mike.dld __mov esi,e __mov edi,f - int 0x40 + if __CPU_type eq p5 + int 0x40 + else + if __CPU_type eq p6 + push ebp + mov ebp, esp + push ..ret_point ; it may be 2 or 5 byte + sysenter + ..ret_point: + pop edx + pop ecx + + else + if __CPU_type eq k6 + push ecx + syscall + pop ecx + else + display 'ERROR : unknown CPU type (set to p5)', 10, 13 + __CPU_type equ p5 + int 0x40 + end if + end if + end if } @@ -503,6 +527,49 @@ struct FILEINFO Size dq ? ends + +if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 + +cmove fix cmovz +macro cmovz reg1, reg2 { + +local .jumpaddr + + jnz .jumpaddr + mov reg1, reg2 + .jumpaddr: +} + +cmovne fix cmovnz +macro cmovnz reg1, reg2 { + +local .jumpaddr + + jz .jumpaddr + mov reg1, reg2 + .jumpaddr: +} + +macro cmovg reg1, reg2 { + +local .jumpaddr + + jle .jumpaddr + mov reg1, reg2 + .jumpaddr: +} + +macro cmovl reg1, reg2 { + +local .jumpaddr + + jge .jumpaddr + mov reg1, reg2 + .jumpaddr: +} + +end if + ; constants ; events @@ -518,11 +585,13 @@ EV_IPC = 7 EV_STACK = 8 ; event mask bits for function 40 -EVM_REDRAW = 1b -EVM_KEY = 10b -EVM_BUTTON = 100b -EVM_EXIT = 1000b -EVM_BACKGROUND = 10000b -EVM_MOUSE = 100000b -EVM_IPC = 1000000b -EVM_STACK = 10000000b +EVM_REDRAW = 1b +EVM_KEY = 10b +EVM_BUTTON = 100b +EVM_EXIT = 1000b +EVM_BACKGROUND = 10000b +EVM_MOUSE = 100000b +EVM_IPC = 1000000b +EVM_STACK = 10000000b +EVM_DEBUG = 100000000b +EVM_STACK2 = 1000000000b diff --git a/programs/network/network.inc b/programs/network.inc similarity index 100% rename from programs/network/network.inc rename to programs/network.inc diff --git a/programs/network/config.inc b/programs/network/config.inc deleted file mode 100644 index dc70bf9760..0000000000 --- a/programs/network/config.inc +++ /dev/null @@ -1 +0,0 @@ -__CPU_type fix p5 diff --git a/programs/network/dll.inc b/programs/network/dll.inc deleted file mode 100644 index a213dd21be..0000000000 --- a/programs/network/dll.inc +++ /dev/null @@ -1,160 +0,0 @@ -;----------------------------------------------------------------------------- -proc mem.Alloc size ;///////////////////////////////////////////////////////// -;----------------------------------------------------------------------------- - push ebx ecx - mov eax,[size] - lea ecx,[eax+4+4095] - and ecx, not 4095 - mcall 68,12 - test eax, eax - jz @f - add ecx,-4 - mov [eax],ecx - add eax,4 - @@: - pop ecx ebx - ret -endp - -;----------------------------------------------------------------------------- -proc mem.ReAlloc mptr,size;/////////////////////////////////////////////////// -;----------------------------------------------------------------------------- - push ebx ecx esi edi eax - mov eax,[mptr] - mov ebx,[size] - or eax,eax - jz @f - lea ecx,[ebx+4+4095] - and ecx,not 4095 - add ecx,-4 - cmp ecx,[eax-4] - je .exit - @@: mov eax,ebx - call mem.Alloc - xchg eax,[esp] - or eax,eax - jz .exit - mov esi,eax - xchg eax,[esp] - mov edi,eax - mov ecx,[esi-4] - cmp ecx,[edi-4] - jbe @f - mov ecx,[edi-4] - @@: add ecx,3 - shr ecx,2 - cld - rep movsd - xchg eax,[esp] - call mem.Free - .exit: - pop eax edi esi ecx ebx - ret -endp - -;----------------------------------------------------------------------------- -proc mem.Free mptr ;////////////////////////////////////////////////////////// -;----------------------------------------------------------------------------- - mov eax,[mptr] - or eax,eax - jz @f - push ebx ecx - lea ecx,[eax-4] - mcall 68,13 - pop ecx ebx - @@: ret -endp - - -proc dll.Load, import_table:dword - mov esi,[import_table] - .next_lib: mov edx,[esi] - or edx,edx - jz .exit - push esi - mov esi,[esi+4] - mov edi,s_libdir.fname - @@: lodsb - stosb - or al,al - jnz @b - mcall 68,19,s_libdir - or eax,eax - jz .fail - stdcall dll.Link,eax,edx - stdcall dll.Init,[eax+4] - pop esi - add esi,8 - jmp .next_lib - .exit: xor eax,eax - ret - .fail: add esp,4 - xor eax,eax - inc eax - ret -endp - -proc dll.Link, exp:dword,imp:dword - push eax - mov esi,[imp] - test esi,esi - jz .done - .next: lodsd - test eax,eax - jz .done - stdcall dll.GetProcAddress,[exp],eax - or eax,eax - jz @f - mov [esi-4],eax - jmp .next - @@: mov dword[esp],0 - .done: pop eax - ret -endp - -proc dll.Init, dllentry:dword - pushad - mov eax,mem.Alloc - mov ebx,mem.Free - mov ecx,mem.ReAlloc - mov edx,dll.Load - stdcall [dllentry] - popad - ret -endp - -proc dll.GetProcAddress, exp:dword,sz_name:dword - mov edx,[exp] - xor eax,eax - .next: or edx,edx - jz .end - cmp dword[edx],0 - jz .end - stdcall strcmp,[edx],[sz_name] - test eax,eax - jz .ok - add edx,8 - jmp .next - .ok: mov eax,[edx+4] - .end: ret -endp - -proc strcmp, str1:dword,str2:dword - push esi edi - mov esi,[str1] - mov edi,[str2] - xor eax,eax - @@: lodsb - scasb - jne .fail - or al,al - jnz @b - jmp .ok - .fail: or eax,-1 - .ok: pop edi esi - ret -endp - -s_libdir: - db '/sys/lib/' - .fname rb 32 diff --git a/programs/network/downloader/downloader.asm b/programs/network/downloader/downloader.asm index da2909d855..8395d9c67f 100644 --- a/programs/network/downloader/downloader.asm +++ b/programs/network/downloader/downloader.asm @@ -15,11 +15,11 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -URLMAXLEN = 1024 -BUFFERSIZE = 4096 +URLMAXLEN = 1024 +BUFFERSIZE = 4096 __DEBUG__ = 1 -__DEBUG_LEVEL__ = 2 +__DEBUG_LEVEL__ = 1 format binary as "" @@ -35,12 +35,12 @@ use32 dd params ; I_PARAM dd 0x0 ; I_Path -include '../macros.inc' -include '../proc32.inc' -include '../network.inc' +include '../../macros.inc' +include '../../proc32.inc' +include '../../network.inc' include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../dll.inc' -include '../debug-fdo.inc' +include '../../dll.inc' +include '../../debug-fdo.inc' START: diff --git a/programs/network/ftpd/commands.inc b/programs/network/ftpd/commands.inc index f5bc9bb2d2..bac5d34935 100644 --- a/programs/network/ftpd/commands.inc +++ b/programs/network/ftpd/commands.inc @@ -531,25 +531,25 @@ cmdLIST: stosd ; now the filesize in ascii - mov eax, [ebx + FileInfoA.FileSizeLow] + mov eax, dword[ebx + FileInfoA.FileSize] call dword_to_ascii mov al, ' ' stosb ; then date (month/day/year) - movzx eax, [ebx + FileInfoA.DateModify + FileDateTime.month] + movzx eax, [ebx + FileInfoA.DateModify.month] cmp eax, 12 ja @f mov eax, [months - 4 + 4*eax] stosd @@: - movzx eax, [ebx + FileInfoA.DateModify + FileDateTime.day] + movzx eax, [ebx + FileInfoA.DateModify.day] call dword_to_ascii mov al, ' ' stosb - movzx eax, [ebx + FileInfoA.DateModify + FileDateTime.year] + movzx eax, [ebx + FileInfoA.DateModify.year] call dword_to_ascii mov al, ' ' stosb diff --git a/programs/network/ftpd/ftpd.asm b/programs/network/ftpd/ftpd.asm index e3c7a6b469..a02e4db5f1 100644 --- a/programs/network/ftpd/ftpd.asm +++ b/programs/network/ftpd/ftpd.asm @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; ftpd.asm - FTP Daemon for KolibriOS ;; @@ -63,14 +63,14 @@ use32 dd params ; parameters dd path ; path -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' -include '../struct.inc' -include '../libio.inc' +include '../../proc32.inc' +include '../../dll.inc' +include '../../struct.inc' +include '../../libio.inc' -include '../network.inc' +include '../../network.inc' macro sendFTP str { local string, length diff --git a/programs/network/icmp/ping.asm b/programs/network/icmp/ping.asm index e5e26e5f16..4fa94a14ad 100644 --- a/programs/network/icmp/ping.asm +++ b/programs/network/icmp/ping.asm @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; ping.asm - ICMP echo client for KolibriOS ;; @@ -12,9 +12,10 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - format binary as "" +BUFFERSIZE = 1500 + use32 org 0x0 @@ -28,13 +29,12 @@ use32 dd 0 ; path -BUFFERSIZE equ 1500 ; useful includes -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' -include '../network.inc' +include '../../proc32.inc' +include '../../dll.inc' +include '../../network.inc' include 'icmp.inc' diff --git a/programs/network/ircc/ircc.asm b/programs/network/ircc/ircc.asm index 6f6904fc67..d1d56bb553 100644 --- a/programs/network/ircc/ircc.asm +++ b/programs/network/ircc/ircc.asm @@ -87,11 +87,11 @@ use32 dd param dd path -include "../macros.inc" -include "../proc32.inc" -include "../dll.inc" -include "../network.inc" -include "../struct.inc" +include "../../macros.inc" +include "../../proc32.inc" +include "../../dll.inc" +include "../../network.inc" +include "../../struct.inc" include '../../develop/libraries/box_lib/trunk/box_lib.mac' struct window @@ -426,10 +426,6 @@ import boxlib,\ scrollbar_v_draw ,'scrollbar_v_draw' ,\ scrollbar_v_mouse,'scrollbar_v_mouse' - -usercommand db '/server chat.freenode.net', 0 - rb MAX_COMMAND_LEN - I_END: ; width, left, top @@ -438,6 +434,9 @@ edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, userco scroll1 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 scroll2 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 +usercommand db '/server chat.freenode.net', 0 + rb MAX_COMMAND_LEN + main_PID dd ? ; identifier of main thread utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence utf8_char dd ? ; first bits of current UTF8 character diff --git a/programs/network/macros.inc b/programs/network/macros.inc deleted file mode 100644 index d6568ca0eb..0000000000 --- a/programs/network/macros.inc +++ /dev/null @@ -1,588 +0,0 @@ -@^ fix macro comment { -^@ fix } - -; ------------------------- -macro library [lname,fname] -{ - forward - dd __#lname#_library_table__,__#lname#_library_name__ - common - dd 0 - forward - align 4 - __#lname#_library_name__ db fname,0 -} - -macro import lname,[name,sname] -{ - common - align 4 - __#lname#_library_table__: - forward - if used name - name dd __#name#_import_name__ - end if - common - dd 0 - forward - if used name - align 4 - __#name#_import_name__ db sname,0 - end if -} - -macro export [name,sname] -{ - forward - dd __#name#_export_name__,name - common - dd 0 - forward - align 4 - __#name#_export_name__ db sname,0 -} -; ------------------------- - -macro m2m dest,src { - push src - pop dest -} - - -macro iglobal { - IGlobals equ IGlobals, - macro __IGlobalBlock { } - -macro uglobal { - UGlobals equ UGlobals, - macro __UGlobalBlock { } - -endg fix } ; Use endg for ending iglobal and uglobal blocks. - - -macro IncludeIGlobals{ - macro IGlobals dummy,[n] \{ __IGlobalBlock - purge __IGlobalBlock \} - match I, IGlobals \{ I \} } - -macro IncludeUGlobals{ - macro UGlobals dummy,[n] \{ - \common - \local begin, size - begin = $ - virtual at $ - \forward - __UGlobalBlock - purge __UGlobalBlock - \common - size = $ - begin - end virtual - rb size - \} - match U, UGlobals \{ U \} } - -uglobal -endg - -iglobal -endg - - -; new application structure -macro meos_app_start - { - use32 - org 0x0 - - db 'MENUET01' - dd 0x01 - dd __start - dd __end - dd __memory - dd __stack - - if used __params & ~defined __params - dd __params - else - dd 0x0 - end if - - dd 0x0 - } -MEOS_APP_START fix meos_app_start - -macro code - { - __start: - } -CODE fix code - -macro data - { - __data: - IncludeIGlobals - } -DATA fix data - -macro udata - { - if used __params & ~defined __params - __params: - db 0 - __end: - rb 255 - else - __end: - end if - __udata: - IncludeUGlobals - } -UDATA fix udata - -macro meos_app_end - { - align 32 - rb 2048 - __stack: - __memory: - } -MEOS_APP_END fix meos_app_end - - -; macro for defining multiline text data -struc mstr [sstring] - { - forward - local ssize - virtual at 0 - db sstring - ssize = $ - end virtual - dd ssize - db sstring - common - dd -1 - } - -; macro for defining multiline text data -struc mls [sstring] - { - forward - local ssize - virtual at 0 - db sstring ; mod - ssize = $ - end virtual - db ssize - db sstring - common - db -1 ; mod - } - - - -; strings -macro sz name,[data] { ; from MFAR [mike.dld] - common - if used name - name db data - .size = $-name - end if -} - -macro lsz name,[lng,data] { ; from MFAR [mike.dld] - common - if used name - label name - forward - if lang eq lng - db data - end if - common - .size = $-name - end if -} - -macro szc name,elsz,[data] { ; from MFAR [mike.dld] - common - local s,m - m = 0 - if used name - label name - forward - virtual at 0 - db data - s = $ - end virtual - d#elsz s - if m < s - m = s - end if - db data - common - .size = $-name - .maxl = m - end if -} - -macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] - common - local s,m,c - m = 0 - c = 0 - if used name - label name - forward - if lang eq lng - virtual at 0 - db data - s = $ - end virtual - d#elsz s - if m < s - m = s - end if - db data - c = c+1 - end if - common - .size = $-name - .maxl = m - .count = c - end if -} - - -; easy system call macro -macro mpack dest, hsrc, lsrc -{ - if (hsrc eqtype 0) & (lsrc eqtype 0) - mov dest, (hsrc) shl 16 + lsrc - else - if (hsrc eqtype 0) & (~lsrc eqtype 0) - mov dest, (hsrc) shl 16 - add dest, lsrc - else - mov dest, hsrc - shl dest, 16 - add dest, lsrc - end if - end if -} - -macro __mov reg,a,b { ; mike.dld - if (~a eq)&(~b eq) - mpack reg,a,b - else if (~a eq)&(b eq) - mov reg,a - end if -} - - -include 'config.inc' -;__CPU_type equ p5 -SYSENTER_VAR equ 0 - -macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls - local ..ret_point - __mov eax,a - __mov ebx,b - __mov ecx,c - __mov edx,d - __mov esi,e - __mov edi,f - - if __CPU_type eq p5 - int 0x40 - else - if __CPU_type eq p6 - push ebp - mov ebp, esp - push ..ret_point ; it may be 2 or 5 byte - sysenter - ..ret_point: - pop edx - pop ecx - - else - if __CPU_type eq k6 - push ecx - syscall - pop ecx - else - display 'ERROR : unknown CPU type (set to p5)', 10, 13 - __CPU_type equ p5 - int 0x40 - end if - end if - end if -} - - -; ------------------------- -macro header a,[b] { - common - use32 - org 0 - db 'MENUET',a - forward - if b eq - dd 0 - else - dd b - end if } -macro section name { align 16 - label name } -macro func name { - if ~used name - display 'FUNC NOT USED: ',`name,13,10 - else - align 4 - name: - ;diff16 `name,0,name -;pushad -;pushfd -;dps `name -;newline -;mcall 5,1 -;popfd -;popad -} -macro endf { end if } - -macro diff16 title,l1,l2 - { - local s,d - s = l2-l1 - display title,': 0x' - repeat 8 - d = '0' + s shr ((8-%) shl 2) and $0F - if d > '9' - d = d + 'A'-'9'-1 - end if - display d - end repeat - display 13,10 - } - -macro diff10 title,l1,l2 - { - local s,d,z,m - s = l2-l1 - z = 0 - m = 1000000000 - display title,': ' - repeat 10 - d = '0' + s / m - s = s - (s/m)*m - m = m / 10 - if d <> '0' - z = 1 - end if - if z <> 0 - display d - end if - end repeat - display 13,10 - } - -; optimize the code for size -__regs fix - -macro add arg1,arg2 - { - if (arg2 eqtype 0) - if (arg2) = 1 - inc arg1 - else - add arg1,arg2 - end if - else - add arg1,arg2 - end if - } - -macro sub arg1,arg2 - { - if (arg2 eqtype 0) - if (arg2) = 1 - dec arg1 - else - sub arg1,arg2 - end if - else - sub arg1,arg2 - end if - } - -macro mov arg1,arg2 - { - if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) - if (arg2) = 0 - xor arg1,arg1 - else if (arg2) = 1 - xor arg1,arg1 - inc arg1 - else if (arg2) = -1 - or arg1,-1 - else if (arg2) > -128 & (arg2) < 128 - push arg2 - pop arg1 - else - mov arg1,arg2 - end if - else - mov arg1,arg2 - end if - } - - -macro RGB [a] { - common - match (r=,g=,b),a \{ - \dd ((r) shl 16) or ((g) shl 8) or (b) - \} -} - - -struc POINT _t,_dx,_dy { - .x _t _dx - .y _t _dy -} - -; structure definition helper -include 'struct.inc' - -struct RECT - left dd ? - top dd ? - right dd ? - bottom dd ? -ends - -struct BOX - left dd ? - top dd ? - width dd ? - height dd ? -ends - -; structures used in MeOS -struct process_information - cpu_usage dd ? ; +0 - window_stack_position dw ? ; +4 - window_stack_value dw ? ; +6 - dw ? ; +8 - process_name rb 12 ; +10 - memory_start dd ? ; +22 - used_memory dd ? ; +26 - PID dd ? ; +30 - box BOX ; +34 - slot_state dw ? ; +50 - dw ? ; +52 - client_box BOX ; +54 - wnd_state db ? ; +70 - rb (1024-71) -ends - -struct system_colors - frame dd ? - grab dd ? - grab_button dd ? - grab_button_text dd ? - grab_text dd ? - work dd ? - work_button dd ? - work_button_text dd ? - work_text dd ? - work_graph dd ? -ends - -struct FILEDATE - Second db ? - Minute db ? - Hour db ? - db ? - Day db ? - Month db ? - Year dw ? -ends - -struct FILEINFO - Attributes dd ? - IsUnicode db ? - db 3 dup(?) - DateCreate FILEDATE - DateAccess FILEDATE - DateModify FILEDATE - Size dq ? -ends - - -if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 - -cmove fix cmovz -macro cmovz reg1, reg2 { - -local .jumpaddr - - jnz .jumpaddr - mov reg1, reg2 - .jumpaddr: -} - -cmovne fix cmovnz -macro cmovnz reg1, reg2 { - -local .jumpaddr - - jz .jumpaddr - mov reg1, reg2 - .jumpaddr: -} - -macro cmovg reg1, reg2 { - -local .jumpaddr - - jle .jumpaddr - mov reg1, reg2 - .jumpaddr: -} - -macro cmovl reg1, reg2 { - -local .jumpaddr - - jge .jumpaddr - mov reg1, reg2 - .jumpaddr: -} - -end if - -; constants - -; events -EV_IDLE = 0 -EV_TIMER = 0 -EV_REDRAW = 1 -EV_KEY = 2 -EV_BUTTON = 3 -EV_EXIT = 4 -EV_BACKGROUND = 5 -EV_MOUSE = 6 -EV_IPC = 7 -EV_STACK = 8 - -; event mask bits for function 40 -EVM_REDRAW = 1b -EVM_KEY = 10b -EVM_BUTTON = 100b -EVM_EXIT = 1000b -EVM_BACKGROUND = 10000b -EVM_MOUSE = 100000b -EVM_IPC = 1000000b -EVM_STACK = 10000000b -EVM_DEBUG = 100000000b -EVM_STACK2 = 1000000000b diff --git a/programs/network/netcfg/netcfg.asm b/programs/network/netcfg/netcfg.asm index 6ae678e6e9..f12f17f9c9 100644 --- a/programs/network/netcfg/netcfg.asm +++ b/programs/network/netcfg/netcfg.asm @@ -1,10 +1,16 @@ -; -; Netcfg v1.02 -; -; Application to load network drivers in KolibriOS -; -; By hidnplayr -; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; netcfg.asm - Network driver control center for KolibriOS ;; +;; ;; +;; Written by hidnplayr@kolibrios.org ;; +;; ;; +;; GNU GENERAL PUBLIC LICENSE ;; +;; Version 2, June 1991 ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; format binary as "" @@ -21,7 +27,7 @@ use32 type_ethernet equ 1 -include '../macros.inc' +include '../../macros.inc' START: ; first, check boot parameters @@ -243,12 +249,25 @@ Start_Enum: @@: mcall 62 ; Read it mov [PCI_IRQ], al ; Save it -; cmp byte [PCI_Class], 0 ; device from before class codes -; je @f - cmp byte [PCI_Class], 2 ; network controller + je @f + + cmp byte [PCI_Class], 6 ; bridge type device jne nextDev -; @@: + + cmp byte [PCI_SubClass], 7 ; Cardbus bridge + jne nextDev + + mov bl, 6 ; get a dword + mov bh, byte [V_Bus] ; bus of pci device + mov ch, byte [V_Dev] ; device number/function + mov cl, 0x40 ; offset to subsystem device/vendor id + mcall 62 ; get ID's + + mov word [PCI_Device], ax ; There is a device here, save the ID's + shr eax, 16 ; + mov word [PCI_Vendor], ax ; + @@: cmp byte[param], 0 jne load_and_start diff --git a/programs/network/netstat/netstat.asm b/programs/network/netstat/netstat.asm index 0d4da37a41..64f343f1fe 100644 --- a/programs/network/netstat/netstat.asm +++ b/programs/network/netstat/netstat.asm @@ -26,8 +26,8 @@ use32 dd (I_END+0x1000) ; esp dd 0, 0 ; I_Param , I_Path -include '..\macros.inc' -include '..\network.inc' +include '../../macros.inc' +include '../../network.inc' START: mcall 40, EVM_REDRAW + EVM_BUTTON + EVM_STACK2 @@ -324,15 +324,13 @@ not_102: pop ecx mcall - - - mov edx, 50 shl 16 + 150 +; mov edx, 50 shl 16 + 150 mov [last], 0 .arp_loop: mov ebx, API_ARP + 3 mov bh, [device] - mcall 76, , [last],,, arp_buf + mcall 76, , [last], , , arp_buf cmp eax, -1 je mainloop diff --git a/programs/network/nslookup/nslookup.asm b/programs/network/nslookup/nslookup.asm index 94704101d0..995e37ec73 100644 --- a/programs/network/nslookup/nslookup.asm +++ b/programs/network/nslookup/nslookup.asm @@ -1,3 +1,17 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; nslookup.asm - name service lookup (DNS)) program for KolibriOS ;; +;; ;; +;; Written by hidnplayr@kolibrios.org ;; +;; ;; +;; GNU GENERAL PUBLIC LICENSE ;; +;; Version 2, June 1991 ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + format binary as "" use32 @@ -12,12 +26,12 @@ use32 dd 0 ; path ; useful includes -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' +include '../../proc32.inc' +include '../../dll.inc' -include '../network.inc' +include '../../network.inc' ; entry point start: diff --git a/programs/network/pppoe/pppoe.asm b/programs/network/pppoe/pppoe.asm index 9805d659df..3eadf700a4 100644 --- a/programs/network/pppoe/pppoe.asm +++ b/programs/network/pppoe/pppoe.asm @@ -1,9 +1,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; -;; pppoe.asm - PPPoE dialer for KolibriOS ;; +;; pppoe.asm - PPPoe dialer for KolibriOS ;; ;; ;; ;; Written by hidnplayr@kolibrios.org ;; ;; ;; @@ -25,12 +25,12 @@ use32 dd 0 ; parameters dd 0 ; path -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' -include '../network.inc' -include '../struct.inc' +include '../../proc32.inc' +include '../../dll.inc' +include '../../network.inc' +include '../../struct.inc' ; Ethernet protocol numbers ETHER_PPP_DISCOVERY = 0x6388 diff --git a/programs/network/proc32.inc b/programs/network/proc32.inc deleted file mode 100644 index aa3ffc9702..0000000000 --- a/programs/network/proc32.inc +++ /dev/null @@ -1,270 +0,0 @@ - -; Macroinstructions for defining and calling procedures - -macro stdcall proc,[arg] ; directly call STDCALL procedure - { common - if ~ arg eq - reverse - pushd arg - common - end if - call proc } - -macro invoke proc,[arg] ; indirectly call STDCALL procedure - { common - if ~ arg eq - reverse - pushd arg - common - end if - call [proc] } - -macro ccall proc,[arg] ; directly call CDECL procedure - { common - size@ccall = 0 - if ~ arg eq - reverse - pushd arg - size@ccall = size@ccall+4 - common - end if - call proc - if size@ccall - add esp,size@ccall - end if } - -macro cinvoke proc,[arg] ; indirectly call CDECL procedure - { common - size@ccall = 0 - if ~ arg eq - reverse - pushd arg - size@ccall = size@ccall+4 - common - end if - call [proc] - if size@ccall - add esp,size@ccall - end if } - -macro proc [args] ; define procedure - { common - match name params, args> - \{ define@proc name, \{ prologue name,flag,parmbytes,localbytes,reglist \} - macro locals - \{ virtual at ebp-localbytes+current - macro label def \\{ match . type,def> \\\{ deflocal@proc .,label, - \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} - macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2 - end if \} } - -macro defargs@proc [arg] - { common - if ~ arg eq - forward - local ..arg,current@arg - match argname:type, arg - \{ current@arg equ argname - label ..arg type - argname equ ..arg - if dqword eq type - dd ?,?,?,? - else if tbyte eq type - dd ?,?,? - else if qword eq type | pword eq type - dd ?,? - else - dd ? - end if \} - match =current@arg,current@arg - \{ current@arg equ arg - arg equ ..arg - ..arg dd ? \} - common - args@proc equ current@arg - forward - restore current@arg - common - end if } - -macro deflocal@proc name,def,[val] - { common - match vars, all@vars \{ all@vars equ all@vars, \} - all@vars equ all@vars name - forward - local ..var,..tmp - match =label,def \{ ..tmp equ \} - match tmp,..tmp \{ ..var def val \} - match ,..tmp \{ label ..var val \} - match =?, val \{ ..tmp equ \} - match any =dup (=?), val \{ ..tmp equ \} - match tmp : value, ..tmp : val - \{ tmp: end virtual - initlocal@proc ..var,def value - virtual at tmp\} - common - match first rest, ..var, \{ name equ first \} } - -macro initlocal@proc name,def - { virtual at name - def - size@initlocal = $ - name - end virtual - position@initlocal = 0 - while size@initlocal > position@initlocal - virtual at name - def - if size@initlocal - position@initlocal < 2 - current@initlocal = 1 - load byte@initlocal byte from name+position@initlocal - else if size@initlocal - position@initlocal < 4 - current@initlocal = 2 - load word@initlocal word from name+position@initlocal - else - current@initlocal = 4 - load dword@initlocal dword from name+position@initlocal - end if - end virtual - if current@initlocal = 1 - mov byte [name+position@initlocal],byte@initlocal - else if current@initlocal = 2 - mov word [name+position@initlocal],word@initlocal - else - mov dword [name+position@initlocal],dword@initlocal - end if - position@initlocal = position@initlocal + current@initlocal - end while } - -macro endp - { purge ret,locals,endl - finish@proc - purge finish@proc - restore regs@proc - match all,args@proc \{ restore all \} - restore args@proc - match all,all@vars \{ restore all \} } - -macro local [var] - { common - locals - forward done@local equ - match varname[count]:vartype, var - \{ match =BYTE, vartype \\{ varname rb count - restore done@local \\} - match =WORD, vartype \\{ varname rw count - restore done@local \\} - match =DWORD, vartype \\{ varname rd count - restore done@local \\} - match =PWORD, vartype \\{ varname rp count - restore done@local \\} - match =QWORD, vartype \\{ varname rq count - restore done@local \\} - match =TBYTE, vartype \\{ varname rt count - restore done@local \\} - match =DQWORD, vartype \\{ label varname dqword - rq count+count - restore done@local \\} - match , done@local \\{ virtual - varname vartype - end virtual - rb count*sizeof.\#vartype - restore done@local \\} \} - match :varname:vartype, done@local:var - \{ match =BYTE, vartype \\{ varname db ? - restore done@local \\} - match =WORD, vartype \\{ varname dw ? - restore done@local \\} - match =DWORD, vartype \\{ varname dd ? - restore done@local \\} - match =PWORD, vartype \\{ varname dp ? - restore done@local \\} - match =QWORD, vartype \\{ varname dq ? - restore done@local \\} - match =TBYTE, vartype \\{ varname dt ? - restore done@local \\} - match =DQWORD, vartype \\{ label varname dqword - dq ?,? - restore done@local \\} - match , done@local \\{ varname vartype - restore done@local \\} \} - match ,done@local - \{ var - restore done@local \} - common - endl } diff --git a/programs/network/socketdbg/socketdbg.asm b/programs/network/socketdbg/socketdbg.asm index 7723d23787..e235639cd7 100644 --- a/programs/network/socketdbg/socketdbg.asm +++ b/programs/network/socketdbg/socketdbg.asm @@ -1,3 +1,17 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; socketdbg.asm - socket debug utility for KolibriOS ;; +;; ;; +;; Written by hidnplayr@kolibrios.org ;; +;; ;; +;; GNU GENERAL PUBLIC LICENSE ;; +;; Version 2, June 1991 ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + format binary as "" use32 @@ -12,12 +26,11 @@ use32 dd 0 ; path ; useful includes -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' - -include '../struct.inc' +include '../../proc32.inc' +include '../../dll.inc' +include '../../struct.inc' include 'socket.inc' diff --git a/programs/network/struct.inc b/programs/network/struct.inc deleted file mode 100644 index 37f0b65b72..0000000000 --- a/programs/network/struct.inc +++ /dev/null @@ -1,240 +0,0 @@ - -; Macroinstructions for defining data structures - -macro struct name - { virtual at 0 - fields@struct equ name - match child parent, name \{ fields@struct equ child,fields@\#parent \} - sub@struct equ - struc db [val] \{ \common define field@struct .,db, - fields@struct equ fields@struct,field@struct \} - struc dw [val] \{ \common define field@struct .,dw, - fields@struct equ fields@struct,field@struct \} - struc du [val] \{ \common define field@struct .,du, - fields@struct equ fields@struct,field@struct \} - struc dd [val] \{ \common define field@struct .,dd, - fields@struct equ fields@struct,field@struct \} - struc dp [val] \{ \common define field@struct .,dp, - fields@struct equ fields@struct,field@struct \} - struc dq [val] \{ \common define field@struct .,dq, - fields@struct equ fields@struct,field@struct \} - struc dt [val] \{ \common define field@struct .,dt, - fields@struct equ fields@struct,field@struct \} - struc rb count \{ define field@struct .,db,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rw count \{ define field@struct .,dw,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rd count \{ define field@struct .,dd,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rp count \{ define field@struct .,dp,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rq count \{ define field@struct .,dq,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rt count \{ define field@struct .,dt,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro db [val] \{ \common \local anonymous - define field@struct anonymous,db, - fields@struct equ fields@struct,field@struct \} - macro dw [val] \{ \common \local anonymous - define field@struct anonymous,dw, - fields@struct equ fields@struct,field@struct \} - macro du [val] \{ \common \local anonymous - define field@struct anonymous,du, - fields@struct equ fields@struct,field@struct \} - macro dd [val] \{ \common \local anonymous - define field@struct anonymous,dd, - fields@struct equ fields@struct,field@struct \} - macro dp [val] \{ \common \local anonymous - define field@struct anonymous,dp, - fields@struct equ fields@struct,field@struct \} - macro dq [val] \{ \common \local anonymous - define field@struct anonymous,dq, - fields@struct equ fields@struct,field@struct \} - macro dt [val] \{ \common \local anonymous - define field@struct anonymous,dt, - fields@struct equ fields@struct,field@struct \} - macro rb count \{ \local anonymous - define field@struct anonymous,db,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rw count \{ \local anonymous - define field@struct anonymous,dw,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rd count \{ \local anonymous - define field@struct anonymous,dd,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rp count \{ \local anonymous - define field@struct anonymous,dp,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rq count \{ \local anonymous - define field@struct anonymous,dq,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rt count \{ \local anonymous - define field@struct anonymous,dt,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro union \{ fields@struct equ fields@struct,,union,< - sub@struct equ union \} - macro struct \{ fields@struct equ fields@struct,,substruct,< - sub@struct equ substruct \} } - -macro ends - { match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt - restruc rb,rw,rd,rp,rq,rt - purge db,dw,du,dd,dp,dq,dt - purge rb,rw,rd,rp,rq,rt - purge union,struct - match name tail,fields@struct, \\{ if $ - display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah - err - end if \\} - match name=,fields,fields@struct \\{ fields@struct equ - make@struct name,fields - define fields@\\#name fields \\} - end virtual \} - match any, sub@struct \{ fields@struct equ fields@struct> \} - restore sub@struct } - -macro make@struct name,[field,type,def] - { common - local define - define equ name - forward - local sub - match , field \{ make@substruct type,name,sub def - define equ define,.,sub, \} - match any, field \{ define equ define,.#field,type, \} - common - match fields, define \{ define@struct fields \} } - -macro define@struct name,[field,type,def] - { common - virtual - db `name - load initial@struct byte from 0 - if initial@struct = '.' - display 'Error: name of structure should not begin with a dot.',0Dh,0Ah - err - end if - end virtual - local list - list equ - forward - if ~ field eq . - name#field type def - sizeof.#name#field = $ - name#field - else - label name#.#type - rb sizeof.#type - end if - local value - match any, list \{ list equ list, \} - list equ list - common - sizeof.#name = $ - restruc name - match values, list \{ - struc name value \\{ \\local \\..base - match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, \\\} - match , fields@struct \\\{ label \\..base - forward - match , value \\\\{ field type def \\\\} - match any, value \\\\{ field type value - if ~ field eq . - rb sizeof.#name#field - ($-field) - end if \\\\} - common label . at \\..base \\\} - \\} - macro name value \\{ - match any, fields@struct \\\{ \\\local anonymous - fields@struct equ fields@struct,anonymous,name, \\\} - match , fields@struct \\\{ - forward - match , value \\\\{ type def \\\\} - match any, value \\\\{ \\\\local ..field - ..field = $ - type value - if ~ field eq . - rb sizeof.#name#field - ($-..field) - end if \\\\} - common \\\} \\} \} } - -macro enable@substruct - { macro make@substruct substruct,parent,name,[field,type,def] - \{ \common - \local define - define equ parent,name - \forward - \local sub - match , field \\{ match any, type \\\{ enable@substruct - make@substruct type,parent,sub def - purge make@substruct - define equ define,.,sub, \\\} \\} - match any, field \\{ define equ define,.\#field,type, \\} - \common - match fields, define \\{ define@\#substruct fields \\} \} } - -enable@substruct - -macro define@union parent,name,[field,type,def] - { common - virtual at parent#.#name - forward - if ~ field eq . - virtual at parent#.#name - parent#field type def - sizeof.#parent#field = $ - parent#field - end virtual - if sizeof.#parent#field > $ - parent#.#name - rb sizeof.#parent#field - ($ - parent#.#name) - end if - else - virtual at parent#.#name - label parent#.#type - type def - end virtual - label name#.#type at parent#.#name - if sizeof.#type > $ - parent#.#name - rb sizeof.#type - ($ - parent#.#name) - end if - end if - common - sizeof.#name = $ - parent#.#name - end virtual - struc name [value] \{ \common - label .\#name - last@union equ - forward - match any, last@union \\{ virtual at .\#name - field type def - end virtual \\} - match , last@union \\{ match , value \\\{ field type def \\\} - match any, value \\\{ field type value \\\} \\} - last@union equ field - common rb sizeof.#name - ($ - .\#name) \} - macro name [value] \{ \common \local ..anonymous - ..anonymous name value \} } - -macro define@substruct parent,name,[field,type,def] - { common - virtual at parent#.#name - forward - if ~ field eq . - parent#field type def - sizeof.#parent#field = $ - parent#field - else - label parent#.#type - rb sizeof.#type - end if - common - sizeof.#name = $ - parent#.#name - end virtual - struc name value \{ - label .\#name - forward - match , value \\{ field type def \\} - match any, value \\{ field type value - if ~ field eq . - rb sizeof.#parent#field - ($-field) - end if \\} - common \} - macro name value \{ \local ..anonymous - ..anonymous name \} } diff --git a/programs/network/synergyc/synergyc.asm b/programs/network/synergyc/synergyc.asm index b2c20fb3be..23d6b0af23 100644 --- a/programs/network/synergyc/synergyc.asm +++ b/programs/network/synergyc/synergyc.asm @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; Synergyc.asm - Synergy client for KolibriOS ;; @@ -14,6 +14,9 @@ format binary as "" +BUFFERSIZE = 1024 +DEFAULTPORT = 24800 + use32 org 0x0 @@ -26,19 +29,12 @@ use32 dd 0 ; parameters dd path ; path -__DEBUG__ equ 1 ; enable/disable -__DEBUG_LEVEL__ equ 1 ; 1 = all, 2 = errors - - -BUFFERSIZE equ 1024 -DEFAULTPORT equ 24800 - -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' +include '../../proc32.inc' +include '../../dll.inc' -include '../network.inc' +include '../../network.inc' start: @@ -68,13 +64,7 @@ start: push 80 call [con_init] - push path - call [con_write_asciiz] - - push newline - call [con_write_asciiz] - - push newline + push str0 call [con_write_asciiz] invoke ini.get_str, path, str_remote, str_ip, buffer_ptr, 16, 0 @@ -97,13 +87,22 @@ start: mcall socket, AF_INET4, SOCK_STREAM, 0 cmp eax, -1 je error - mov [socketnum], eax +; resolve name + push esp ; reserve stack place + push esp ; ptr to result + push 0 ; addrinfo hints + push 0 ; servname push buffer_ptr ; hostname - call [inet_addr] - cmp eax, -1 - je error + call [getaddrinfo] + pop esi +; test for error + test eax, eax + jnz error + + mov eax, [esi+addrinfo.ai_addr] + mov eax, [eax+sockaddr_in.sin_addr] mov [sockaddr1.ip], eax mcall connect, [socketnum], sockaddr1, 18 @@ -111,7 +110,7 @@ start: push str7 call [con_write_asciiz] - mcall 40, 1 shl 7; + 7 + mcall 40, EVM_STACK login: call wait_for_data @@ -273,12 +272,14 @@ error: push str_err call [con_write_asciiz] - call [con_gets] +; call [con_gets] + + call [con_getch2] + + mcall close, [socketnum] push 1 call [con_exit] - - mcall close, [socketnum] exit: mcall -1 @@ -292,7 +293,7 @@ wait_for_data: je wait_for_data cmp eax, 8 - jl wait_for_data + jb wait_for_data ; FIXME ret @@ -300,15 +301,16 @@ wait_for_data: ; data title db 'Synergy client',0 +str0 db 'Welcome to the software KM switch for KolibriOS.',10,10,0 str1 db 'Connecting to: ',0 -str7 db 'Connected!',13,10,0 -str2 db 13,10,'Handshake received',13,10,0 +str7 db 'Connected!',10,0 +str2 db 10,'Handshake received',10,0 str3 db 'Unsupported command: ',0 -newline db 13,10,0 -str4 db 'mouse moved',13,10,0 -str5 db 'mouse buttons changed',13,10,0 -str6 db 'Enter screen',13,10,0 -str_err db 'Error occured !',13,10,'Press any key to quit',0 +newline db 10,0 +str4 db 'mouse moved',10,0 +str5 db 'mouse buttons changed',10,0 +str6 db 'Enter screen',10,0 +str_err db 'Uh-Oh.. some error occured !',10,'Press any key to quit.',0 screeninfo: dd (screeninfo.length - 4) shl 24 @@ -360,7 +362,7 @@ library console, 'console.obj',\ libini, 'libini.obj' import network,\ - inet_addr, 'inet_addr' + getaddrinfo, 'getaddrinfo' import console, \ con_start, 'START',\ diff --git a/programs/network/tcpserv/tcpserv.asm b/programs/network/tcpserv/tcpserv.asm index 2795aa53b2..022bf748c7 100644 --- a/programs/network/tcpserv/tcpserv.asm +++ b/programs/network/tcpserv/tcpserv.asm @@ -1,5 +1,21 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; tcpserv.asm - TCP demo program for KolibriOS ;; +;; ;; +;; Written by hidnplayr@kolibrios.org ;; +;; ;; +;; GNU GENERAL PUBLIC LICENSE ;; +;; Version 2, June 1991 ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + format binary as "" +BUFFERSIZE = 1500 + use32 ; standard header db 'MENUET01' ; signature @@ -12,14 +28,12 @@ use32 dd 0 ; path -BUFFERSIZE equ 1500 -; useful includes -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' +include '../../proc32.inc' +include '../../dll.inc' -include '../network.inc' +include '../../network.inc' ; entry point start: diff --git a/programs/network/telnet/telnet.asm b/programs/network/telnet/telnet.asm index 84f340b000..24917198fa 100644 --- a/programs/network/telnet/telnet.asm +++ b/programs/network/telnet/telnet.asm @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; telnet.asm - Telnet client for KolibriOS ;; @@ -14,9 +14,9 @@ format binary as "" -__DEBUG__ equ 0 -__DEBUG_LEVEL__ equ 1 -BUFFERSIZE equ 4096 +__DEBUG__ = 0 +__DEBUG_LEVEL__ = 1 +BUFFERSIZE = 4096 use32 ; standard header @@ -29,12 +29,12 @@ use32 dd hostname ; parameters dd 0 ; path -include '../macros.inc' +include '../../macros.inc' purge mov,add,sub -include '../proc32.inc' -include '../dll.inc' -include '../debug-fdo.inc' -include '../network.inc' +include '../../proc32.inc' +include '../../dll.inc' +include '../../debug-fdo.inc' +include '../../network.inc' ; entry point start: diff --git a/programs/network/tftpc/tftpc.asm b/programs/network/tftpc/tftpc.asm index 99a6ace09a..5fd41e2670 100644 --- a/programs/network/tftpc/tftpc.asm +++ b/programs/network/tftpc/tftpc.asm @@ -1,37 +1,48 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; tftpc.asm - TFTP client for KolibriOS ;; +;; ;; +;; Written by hidnplayr@kolibrios.org ;; +;; ;; +;; GNU GENERAL PUBLIC LICENSE ;; +;; Version 2, June 1991 ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + format binary as "" use32 - org 0x0 + org 0x0 - db 'MENUET01' - dd 0x1 - dd START - dd I_END - dd IM_END - dd IM_END - dd 0, 0 + db 'MENUET01' + dd 0x1 + dd START + dd I_END + dd IM_END+0x1000 + dd IM_END+0x1000 + dd 0, 0 -include '../proc32.inc' -include '../macros.inc' -include '../libio.inc' -include '../dll.inc' +include '../../proc32.inc' +include '../../macros.inc' +include '../../libio.inc' +include '../../dll.inc' include '../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../network.inc' +include '../../network.inc' -filebuffer_size equ 4*4096 ; 16kb (dont try to change it yet..) -TIMEOUT equ 100 -buffer_len equ 1500 +filebuffer_size = 4*4096 ; 16kb (dont try to change it yet..) +TIMEOUT = 100 +buffer_len = 1500 -AF_INET4 equ 2 -IP_PROTO_UDP equ 17 - -opcode_rrq equ 1 -opcode_wrq equ 2 -opcode_data equ 3 -opcode_ack equ 4 -opcode_error equ 5 +opcode_rrq = 1 +opcode_wrq = 2 +opcode_data = 3 +opcode_ack = 4 +opcode_error = 5 ; read/write request packet ; @@ -561,6 +572,4 @@ mouse_dd dd ? buffer: rb buffer_len -rb 0x1000 ; stack - IM_END: \ No newline at end of file diff --git a/programs/network/vncc/vncc.asm b/programs/network/vncc/vncc.asm index 9887fa1b6f..eaab83c02b 100644 --- a/programs/network/vncc/vncc.asm +++ b/programs/network/vncc/vncc.asm @@ -1,39 +1,47 @@ -; -; -; VNC Client for kolibrios by hidnplayr -; -; hidnplayr@gmail.com -; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; vncc.asm - VNC client for KolibriOS ;; +;; ;; +;; Written by hidnplayr@kolibrios.org ;; +;; ;; +;; GNU GENERAL PUBLIC LICENSE ;; +;; Version 2, June 1991 ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; format binary as "" +__DEBUG__ = 1 +__DEBUG_LEVEL__ = 1 + +STRLEN = 64 ; password and server max length +xpos = 4 ; coordinates of image +ypos = 22 ; + +TIMEOUT = 5 ; timeout in seconds + use32 org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd I_END ; size of image - dd IM_END ; memory for app - dd IM_END ; esp - dd 0x0 , 0x0 ; I_Param , I_Path + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd IM_END ; memory for app + dd IM_END ; esp + dd 0x0 , 0x0 ; I_Param , I_Path -__DEBUG__ equ 1 -__DEBUG_LEVEL__ equ 1 -STRLEN = 64 ; password and server max length -xpos = 4 ; coordinates of image -ypos = 22 ; - -TIMEOUT = 5 ; timeout in seconds - -include '../macros.inc' -include '../debug-fdo.inc' -include '../proc32.inc' -include '../dll.inc' -include '../struct.inc' -include '../network.inc' +include '../../macros.inc' +include '../../debug-fdo.inc' +include '../../proc32.inc' +include '../../dll.inc' +include '../../struct.inc' +include '../../network.inc' include 'structs.inc' include 'logon.inc' diff --git a/programs/network/zeroconf/zeroconf.asm b/programs/network/zeroconf/zeroconf.asm index 3754ef5711..95c19d1d34 100644 --- a/programs/network/zeroconf/zeroconf.asm +++ b/programs/network/zeroconf/zeroconf.asm @@ -9,7 +9,7 @@ ;; Some code contributed by Derpenguin ;; ;; ;; ;; DHCP code is based on that by Mike Hibbet ;; -; (DHCP client for menuetos) ;; +;; (DHCP client for menuetos) ;; ;; ;; ;; GNU GENERAL PUBLIC LICENSE ;; ;; Version 2, June 1991 ;; @@ -18,17 +18,6 @@ format binary as "" -use32 - org 0x0 - - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd IM_END ; size of image - dd (I_END+0x100) ; memory for app - dd (I_END+0x100) ; esp - dd 0, 0 ; I_Param, I_Path - ; CONFIGURATION TIMEOUT = 60 ; in seconds @@ -53,13 +42,24 @@ RATE_LIMIT_INTERVAL = 60 ; seconds (delay between successive atte DEFEND_INTERVAL = 10 ; seconds (min. wait between defensive ARPs) +use32 + org 0x0 -include '../proc32.inc' -include '../macros.inc' -include '../debug-fdo.inc' -include '../network.inc' + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd IM_END ; size of image + dd (I_END+0x100) ; memory for app + dd (I_END+0x100) ; esp + dd 0, 0 ; I_Param, I_Path + + +include '../../proc32.inc' +include '../../macros.inc' +include '../../debug-fdo.inc' +include '../../network.inc' include 'dhcp.inc' -include '../dll.inc' +include '../../dll.inc' Ip2dword: