Fixes in netstat/zeroconf

update of netcfg 

git-svn-id: svn://kolibrios.org@1192 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2009-10-02 19:49:42 +00:00
parent 9637c89d66
commit d5c54dd1d0
4 changed files with 126 additions and 94 deletions

View File

@ -44,11 +44,15 @@ button: ; button
cmp ah, 4 cmp ah, 4
je hook je hook
cmp ah, 5
je reset
cmp ah, 6
je unload
jmp still jmp still
@@: @@:
shr eax, 16 shr eax, 16
mov dword[MAC],0
mov word [MAC+4],0
mov word [selected], ax mov word [selected], ax
call load_drv call load_drv
@ -97,19 +101,25 @@ hook:
mov byte[drivernumber], al mov byte[drivernumber], al
printhdwaddr: reset:
movzx ebx, byte[drivernumber]
mcall 73,,2
call draw_window ret
jmp still unload:
movzx ebx, byte[drivernumber]
mcall 73,,3
ret
draw_window: draw_window:
mcall 12, 1 ; start of draw mcall 12, 1 ; start of draw
mcall 0, dword [Form], dword [Form + 4], 0x13ffffff, 0x805080d0, title mcall 0, dword [Form], dword [Form + 4], 0x13ffffff, 0x805080d0, title
mcall 73, 0 ; mcall 73, 1,
mov ecx, eax ; mov ecx, eax
mcall 47, 1 shl 18, , 50 shl 16 + 10, 0x00000000 ; mcall 47, 1 shl 18, , 50 shl 16 + 10, 0x00000000
call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device
@ -118,49 +128,22 @@ draw_window:
mcall 4, 20 shl 16 + 100, 1 shl 31 + 0x00000000 , caption mcall 4, 20 shl 16 + 100, 1 shl 31 + 0x00000000 , caption
mcall 8, 122 shl 16 + 100, 50 shl 16 + 18, 0x00000004, 0x00007f00 mov ax , [selected]
mcall ,, 70 shl 16 + 18, 0x00000005, 0x007f0000 test ax, ax
jz .done
mcall 4, 137 shl 16 + 57, 1 shl 31 + 0x00ffffff , btn_start mcall 8, 18 shl 16 + 100, 35 shl 16 + 18, 4, 0x00007f00
mcall , 140 shl 16 + 77, , btn_stop mcall ,, 55 shl 16 + 18, 5, 0x0000007f
mcall ,, 75 shl 16 + 18, 6, 0x007f0000
mcall , 240 shl 16 + 77, 1 shl 31 + 0x00000000 , lbl_hdw_addr mcall 4, 33 shl 16 + 42, 1 shl 31 + 0x00ffffff , btn_start
mcall , 312 shl 16 + 57, , lbl_type mcall , 33 shl 16 + 62, , btn_reset
add ebx, 38 shl 16 mcall , 36 shl 16 + 82, , btn_stop
cmp byte [type],type_ethernet
jne @f
mcall , , 1 shl 31 + 0x00000000, lbl_ethernet
mcall 8,345 shl 16 + 17, 73 shl 16 + 14, 0x00000006, 0x00aaaa00 ; mcall , 140 shl 16 + 62, 1 shl 31 + 0x00000000 , devicename
mcall ,365 shl 16 + 17, , 0x00000007
mcall ,385 shl 16 + 17, , 0x00000008
mcall ,405 shl 16 + 17, , 0x00000009
mcall ,425 shl 16 + 17, , 0x0000000a
mcall ,445 shl 16 + 17, , 0x0000000b
movzx ecx,byte[MAC]
mcall 47, 1 shl 17 + 1 shl 8,,349 shl 16 + 77, 0x000022cc
movzx ecx,byte[MAC+1]
add edx, 20 shl 16
mcall
movzx ecx,byte[MAC+2]
add edx, 20 shl 16
mcall
movzx ecx,byte[MAC+3]
add edx, 20 shl 16
mcall
movzx ecx,byte[MAC+4]
add edx, 20 shl 16
mcall
movzx ecx,byte[MAC+5]
add edx, 20 shl 16
mcall
jmp .done jmp .done
@@:
mcall 4, , 1 shl 31 + 0x00ff0000, lbl_unknown
jmp .done
.nonefound : .nonefound :
mcall 4, 20 shl 16 + 30, 1 shl 31 + 0x00ff0000 , nonefound mcall 4, 20 shl 16 + 30, 1 shl 31 + 0x00ff0000 , nonefound
.done: .done:
@ -411,15 +394,20 @@ Form: dw 800 ; window width (no more, special for 800x600)
title db 'Network Driver Control Center', 0 title db 'Network Driver Control Center', 0
caption db 'Vendor Device Bus Dev Rev IRQ Company Description DRIVER',0 caption db 'Vendor Device Bus Dev Rev IRQ Company Description DRIVER',0
lbl_1 db 'Hardware control',0 ;lbl_1 db 'Hardware control',0
nonefound db 'No compatible devices were found!',0 nonefound db 'No compatible devices were found!',0
btn_start db 'Start driver',0 btn_start db 'Start device',0
btn_stop db 'Stop driver',0 btn_reset db 'Reset device',0
lbl_hdw_addr db 'hardware address:',0 btn_stop db 'Stop device',0
lbl_type db 'type:',0 ;lbl_hdw_addr db 'hardware address:',0
;lbl_type db 'type:',0
lbl_none db 'none',0 lbl_none db 'none',0
lbl_unknown db 'unknown',0 ;lbl_unknown db 'unknown',0
lbl_ethernet db 'ethernet',0 ;lbl_ethernet db 'ethernet',0
devicename db 'test'
rb 64
db 0
IOCTL: IOCTL:

View File

@ -1,5 +1,5 @@
; ;
; Netstat for KolibriOS v0.1 ; Netstat for KolibriOS v0.1 (still alpha version)
; ;
; hidnplayr@gmail.com ; hidnplayr@gmail.com
; ;
@ -11,10 +11,10 @@ use32
db 'MENUET01' ; 8 byte id db 'MENUET01' ; 8 byte id
dd 0x01 ; header version dd 0x01 ; header version
dd START ; start of code dd START ; start of code
dd I_END ; size of image dd IM_END ; size of image
dd IM_END ; memory for app dd (I_END+0x100) ; memory for app
dd IM_END ; esp dd (I_END+0x100) ; esp
dd I_PARAM , 0x0 ; I_Param , I_Icon dd I_PARAM , 0x0 ; I_Param , I_Icon
__DEBUG__ equ 1 __DEBUG__ equ 1
__DEBUG_LEVEL__ equ 1 __DEBUG_LEVEL__ equ 1
@ -79,8 +79,6 @@ START: ; start of execution
mov edx, str_queue_out mov edx, str_queue_out
mcall mcall
push end_of_draw
mov ebx,1337 shl 16 + 4 mov ebx,1337 shl 16 + 4
mov bh, [device] mov bh, [device]
mcall 75 mcall 75
@ -88,7 +86,8 @@ START: ; start of execution
push bx push bx
mov edx, 135 shl 16 + 75 + 4*18 mov edx, 135 shl 16 + 75 + 4*18
jmp draw_mac call draw_mac
jmp end_of_draw
@@: @@:
@ -201,18 +200,21 @@ START: ; start of execution
mov ebx, 1337 shl 16 + 0 mov ebx, 1337 shl 16 + 0
mov bh, [device] mov bh, [device]
@@: @@:
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
cmp bl, 3 cmp bl, 3
jle @r jle @r
inc bl ;5
inc bl inc bl ;6
inc bl
@@: @@:
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
cmp bl, 7 cmp bl, 7
@ -251,10 +253,14 @@ START: ; start of execution
mov ebx, 0 shl 16 mov ebx, 0 shl 16
mov bh, [device] mov bh, [device]
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
@ -279,13 +285,19 @@ START: ; start of execution
mov ebx, 0x0608 shl 16 + 0 mov ebx, 0x0608 shl 16 + 0
mov bh, [device] mov bh, [device]
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
@ -312,10 +324,14 @@ not_103:
mov ebx, 1 shl 16 + 0 mov ebx, 1 shl 16 + 0
mov bh, [device] mov bh, [device]
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
@ -339,10 +355,14 @@ not_104:
mov ebx, 17 shl 16 + 0 mov ebx, 17 shl 16 + 0
mov bh, [device] mov bh, [device]
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
@ -366,10 +386,14 @@ not_105:
mov ebx, 6 shl 16 + 0 mov ebx, 6 shl 16 + 0
mov bh, [device] mov bh, [device]
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
push ebx
mcall 75 mcall 75
pop ebx
push eax push eax
inc bl inc bl
@ -414,33 +438,34 @@ draw_mac:
mov esi, 0x40000000 mov esi, 0x40000000
mov edi, 0x00bcbcbc mov edi, 0x00bcbcbc
mov cl, [esp]
mcall
mov cl, [esp+1]
add edx, 15 shl 16
mcall
mov cl, [esp+2]
add edx, 15 shl 16
mcall
mov cl, [esp+3]
add edx, 15 shl 16
mcall
mov cl, [esp+4] mov cl, [esp+4]
mcall
mov cl, [esp+4+1]
add edx, 15 shl 16 add edx, 15 shl 16
mcall mcall
mov cl, [esp+5] mov cl, [esp+4+2]
add edx, 15 shl 16 add edx, 15 shl 16
mcall mcall
add esp, 6 mov cl, [esp+4+3]
add edx, 15 shl 16
mcall
mov cl, [esp+4+4]
add edx, 15 shl 16
mcall
mov cl, [esp+4+5]
add edx, 15 shl 16
mcall
mov eax, [esp]
add esp, 6+4
sub edx, 5*15 shl 16 sub edx, 5*15 shl 16
ret jmp eax
draw_ip: draw_ip:
@ -475,7 +500,7 @@ draw_ip:
; DATA AREA ; DATA AREA
I_END: IM_END:
name db 'Netstat',0 name db 'Netstat',0
mode db 101 mode db 101
@ -499,6 +524,6 @@ include_debug_strings ; ALWAYS present in data section
I_PARAM rb 1024 I_PARAM rb 1024
IM_END: I_END:

View File

@ -12,9 +12,9 @@ use32
dd 0x01 ; header version dd 0x01 ; header version
dd START ; start of code dd START ; start of code
dd IM_END ; size of image dd IM_END ; size of image
dd I_END ; memory for app dd (I_END+0x100) ; memory for app
dd I_END ; esp dd (I_END+0x100) ; esp
dd 0x0 , path ; I_Param , I_Icon dd 0x0 , path ; I_Param , I_Icon
; CONFIGURATION ; CONFIGURATION

View File

@ -119,7 +119,7 @@ stack_handler:
je .exit je .exit
mov [last_1hsTick], eax mov [last_1hsTick], eax
; call tcp_tx_handler call tcp_tx_handler
.sec_tick: .sec_tick:
@ -134,7 +134,7 @@ stack_handler:
call ARP_decrease_entry_ttls call ARP_decrease_entry_ttls
call IPv4_decrease_fragment_ttls call IPv4_decrease_fragment_ttls
; call tcp_tcb_handler call tcp_tcb_handler
.exit: .exit:
ret ret
@ -201,7 +201,8 @@ sys_network:
test bl, bl ; 0 = Get device type (ethernet/token ring/...) test bl, bl ; 0 = Get device type (ethernet/token ring/...)
jnz @f jnz @f
;TODO: write code here xor eax, eax
jmp .return
@@: @@:
@ -215,20 +216,38 @@ sys_network:
mov ecx, 64 ; max length mov ecx, 64 ; max length
repnz movsb repnz movsb
ret xor eax, eax
jmp .return
; TODO: create function wich outputs number of active network devices
@@: @@:
dec bl ; 2 = Reset the device
jnz @f
mov esi, [esi + ETH_DRV_LIST]
call [esi + ETH_DEVICE.reset]
jmp .return
@@:
dec bl ; 3 = Stop driver for this device
jnz @f
mov esi, [esi + ETH_DRV_LIST]
call [esi + ETH_DEVICE.unload]
jmp .return
@@:
.doesnt_exist: .doesnt_exist:
DEBUGF 1,"sys_network: invalid device/function specified!\n" DEBUGF 1,"sys_network: invalid device/function specified!\n"
mov eax, -1 mov eax, -1
.return:
mov [esp+28+4], eax
ret ret
;---------------------------------------------------------------- ;----------------------------------------------------------------
; ;
; System Function To work with Protocols (75) ; System Function To work with Protocols (75)