2006-01-03 10:43:31 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; ;
|
2006-09-19 12:58:07 +02:00
|
|
|
|
; Tiny HTTP Server v 0.5 for KolibriOS ;
|
2006-01-03 10:43:31 +01:00
|
|
|
|
; ;
|
|
|
|
|
; License GPL / See file COPYING for details. ;
|
|
|
|
|
; Copyright 2003 Ville Turjanmaa ;
|
|
|
|
|
; ;
|
2006-09-19 12:58:07 +02:00
|
|
|
|
; Compile with FASM for Menuet/KolibriOS ;
|
2006-01-03 10:43:31 +01:00
|
|
|
|
; ;
|
|
|
|
|
; Request /TinyStat for server statistics ;
|
|
|
|
|
; Request /TinyBoard for server message board ;
|
|
|
|
|
; ;
|
2006-09-19 12:58:07 +02:00
|
|
|
|
; Special version for KoOS by Hex && Heavyiron ;
|
|
|
|
|
; ;
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
appname equ 'Kolibri HTTP Server '
|
|
|
|
|
version equ '0.6'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
use32
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
org 0x0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
|
dd 0x01 ; required os
|
|
|
|
|
dd START ; program start
|
|
|
|
|
dd I_END ; program image size
|
|
|
|
|
dd 0x400000 ; required amount of memory
|
|
|
|
|
dd 0x20000
|
|
|
|
|
dd 0,0 ; reserved=no extended header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
include "MACROS.INC"
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; 0x0+ - program image
|
|
|
|
|
; 0x1ffff - stack
|
|
|
|
|
; 0x20000+ - message board
|
|
|
|
|
; 0x100000+ - requested file
|
|
|
|
|
|
|
|
|
|
filel:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd 50000
|
|
|
|
|
dd 0x20000
|
|
|
|
|
db '/rd/1/board.htm',0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
files:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
dd 2
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0x20000
|
|
|
|
|
db '/rd/1/board.htm',0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
START: ; start of execution
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,filel
|
|
|
|
|
int 0x40
|
|
|
|
|
mov [board_size],ebx
|
|
|
|
|
cmp eax,0
|
|
|
|
|
je board_found
|
|
|
|
|
|
|
|
|
|
mov [board_size],board_end-board
|
|
|
|
|
mov esi,board
|
|
|
|
|
mov edi,0x20000
|
|
|
|
|
mov ecx,[board_size]
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
board_found:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,files
|
|
|
|
|
mov ecx,[board_size]
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [files+12],ecx
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov [status],-1
|
|
|
|
|
mov [last_status],-2
|
|
|
|
|
call clear_input
|
2006-09-19 12:58:07 +02:00
|
|
|
|
red:
|
|
|
|
|
call draw_window ; at first, draw the window
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
still:
|
|
|
|
|
|
|
|
|
|
call check_status
|
|
|
|
|
cmp [status],4
|
|
|
|
|
je start_transmission
|
|
|
|
|
|
|
|
|
|
cmp [status],0
|
|
|
|
|
jne nnn
|
|
|
|
|
cmp [server_active],1
|
|
|
|
|
jne nnn
|
|
|
|
|
call ops
|
|
|
|
|
nnn:
|
|
|
|
|
|
|
|
|
|
mov eax,5
|
|
|
|
|
mov ebx,1
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov eax,11
|
|
|
|
|
int 0x40
|
|
|
|
|
call check_events
|
|
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
last_status dd 0x0
|
|
|
|
|
|
|
|
|
|
check_events:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp eax,1 ; redraw request ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jz red
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp eax,2 ; key in buffer ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jz key
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp eax,3 ; button in buffer ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jz button
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
key: ; Keys are not valid at this part of the
|
|
|
|
|
mov al,2 ; loop. Just read it and ignore
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
ret
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
button: ; button
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov al,17 ; get id
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp ah,1 ; close
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jnz tst2
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,8
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
int 0x40
|
|
|
|
|
mov eax,-1
|
|
|
|
|
int 0x40
|
|
|
|
|
tst2:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp ah,2 ; button id=2 ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jnz tst3
|
|
|
|
|
; open socket
|
|
|
|
|
ops:
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,5
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ecx,80 ; local port # - http
|
|
|
|
|
mov edx,0 ; no remote port specified
|
|
|
|
|
mov esi,0 ; no remote ip specified
|
|
|
|
|
mov edi,0 ; PASSIVE open
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
mov [socket], eax
|
|
|
|
|
mov [posy],1
|
|
|
|
|
mov [posx],0
|
|
|
|
|
call check_for_incoming_data
|
|
|
|
|
call clear_input
|
|
|
|
|
call draw_data
|
|
|
|
|
mov [server_active],1
|
|
|
|
|
call check_status
|
|
|
|
|
ret
|
|
|
|
|
tst3:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp ah,4 ; button id=4 ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jnz no4
|
|
|
|
|
mov [server_active],0
|
|
|
|
|
close_socket:
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,8
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
int 0x40
|
|
|
|
|
mov eax,5
|
|
|
|
|
mov ebx,2
|
|
|
|
|
int 0x40
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,8
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
cmp [server_active],1
|
|
|
|
|
jne no_re_open
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,5
|
|
|
|
|
mov ecx,80 ; local port # - http
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov edx,0 ; no remote port specified
|
|
|
|
|
mov esi,0 ; no remote ip specified
|
|
|
|
|
mov edi,0 ; PASSIVE open
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
mov [socket], eax
|
|
|
|
|
no_re_open:
|
|
|
|
|
|
|
|
|
|
mov edi,input_text+256*15+1
|
|
|
|
|
mov [edi+2],dword ': :'
|
|
|
|
|
call set_time
|
|
|
|
|
mov edi,input_text+256*16+1
|
|
|
|
|
mov [edi+2],dword '. .'
|
|
|
|
|
call set_date
|
|
|
|
|
|
|
|
|
|
mov eax,[documents_served]
|
|
|
|
|
mov ecx,9
|
|
|
|
|
mov edi,input_text+256*15+12
|
|
|
|
|
call set_value
|
|
|
|
|
|
|
|
|
|
mov eax,[bytes_transferred]
|
|
|
|
|
mov ecx,9
|
|
|
|
|
mov edi,input_text+256*16+12
|
|
|
|
|
call set_value
|
|
|
|
|
|
|
|
|
|
call draw_data
|
|
|
|
|
|
|
|
|
|
mov esp,0x1ffff
|
|
|
|
|
jmp still
|
|
|
|
|
no4:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp ah,6 ; read directory
|
|
|
|
|
je read_string
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clear_input:
|
|
|
|
|
|
|
|
|
|
mov edi,input_text
|
|
|
|
|
mov eax,0
|
|
|
|
|
mov ecx,256*30
|
|
|
|
|
cld
|
|
|
|
|
rep stosb
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retries dd 50
|
|
|
|
|
|
|
|
|
|
start_transmission:
|
|
|
|
|
|
|
|
|
|
mov [posy],1
|
|
|
|
|
mov [posx],0
|
|
|
|
|
call clear_input
|
|
|
|
|
mov [retries],50
|
|
|
|
|
|
|
|
|
|
wait_for_data:
|
|
|
|
|
call check_for_incoming_data
|
|
|
|
|
cmp [input_text+256+1],dword 'GET '
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je data_received
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [input_text+256+1],dword 'POST'
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je data_received
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,5
|
|
|
|
|
mov ebx,1
|
|
|
|
|
int 0x40
|
|
|
|
|
dec [retries]
|
|
|
|
|
jnz wait_for_data
|
|
|
|
|
jmp no_http_request
|
|
|
|
|
data_received:
|
|
|
|
|
|
|
|
|
|
mov eax,0x100000
|
|
|
|
|
mov ebx,0x2f0000 / 512
|
|
|
|
|
call read_file
|
|
|
|
|
|
|
|
|
|
call wait_for_empty_slot
|
|
|
|
|
call send_header
|
|
|
|
|
|
|
|
|
|
mov [filepos],0x100000
|
|
|
|
|
mov [fileadd],700
|
|
|
|
|
|
|
|
|
|
call check_status
|
|
|
|
|
call draw_data
|
|
|
|
|
|
|
|
|
|
newblock:
|
|
|
|
|
|
|
|
|
|
call wait_for_empty_slot
|
|
|
|
|
|
|
|
|
|
mov edx,[fileadd]
|
|
|
|
|
cmp edx,[file_left]
|
|
|
|
|
jbe file_size_ok
|
|
|
|
|
mov edx,[file_left]
|
|
|
|
|
file_size_ok:
|
|
|
|
|
sub [file_left],edx
|
|
|
|
|
|
|
|
|
|
; write to socket
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,7
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
mov esi,[filepos]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov eax,esi
|
|
|
|
|
add eax,edx
|
|
|
|
|
sub eax,0x100000
|
|
|
|
|
call display_progress
|
|
|
|
|
|
|
|
|
|
mov edx,[fileadd]
|
|
|
|
|
add [filepos],edx
|
|
|
|
|
|
|
|
|
|
cmp [file_left],0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jg newblock
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
no_http_request:
|
|
|
|
|
|
|
|
|
|
jmp close_socket
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filepos dd 0x100000
|
|
|
|
|
fileadd dd 0x1
|
|
|
|
|
filesize dd 0x0
|
|
|
|
|
file_left dd 0x0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wait_for_empty_slot:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
wait_more:
|
|
|
|
|
|
|
|
|
|
mov eax,5
|
|
|
|
|
mov ebx,1
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov eax,11
|
|
|
|
|
int 0x40
|
|
|
|
|
call check_events
|
|
|
|
|
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,255
|
|
|
|
|
mov ecx,103
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
cmp eax,0
|
|
|
|
|
je no_wait_more
|
|
|
|
|
|
|
|
|
|
jmp wait_more
|
|
|
|
|
|
|
|
|
|
no_wait_more:
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
display_progress:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
mov edi,eax
|
|
|
|
|
|
|
|
|
|
mov eax,13
|
|
|
|
|
mov ebx,115*65536+8*6
|
|
|
|
|
mov ecx,178*65536+10
|
|
|
|
|
mov edx,0xffffff
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov eax,47
|
|
|
|
|
mov ebx,8*65536
|
|
|
|
|
mov ecx,edi
|
|
|
|
|
mov edx,115*65536+178
|
|
|
|
|
mov esi,0x000000
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
send_header:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,53 ; send response and file length
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,7
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
mov edx,h_len-html_header
|
|
|
|
|
mov esi,html_header
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,53 ; send file type
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,7
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
mov edx,[type_len]
|
|
|
|
|
mov esi,[file_type]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
fileinfo dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd 512
|
|
|
|
|
dd 0x100000
|
|
|
|
|
getf db '/rd/1/'
|
|
|
|
|
times 50 db 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
wanted_file: times 100 db 0
|
|
|
|
|
|
|
|
|
|
getflen dd 6
|
|
|
|
|
|
|
|
|
|
make_room:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov edx,ecx
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov esi,0x20000
|
|
|
|
|
add esi,[board_size]
|
|
|
|
|
mov edi,esi
|
|
|
|
|
add edi,edx
|
|
|
|
|
mov ecx,[board_size]
|
|
|
|
|
sub ecx,board1-board
|
|
|
|
|
inc ecx
|
2006-01-03 10:43:31 +01:00
|
|
|
|
std
|
2006-09-19 12:58:07 +02:00
|
|
|
|
rep movsb
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cld
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
from_i dd 0x0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
from_len dd 0x0
|
|
|
|
|
|
|
|
|
|
message dd 0x0
|
|
|
|
|
message_len dd 0x0
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
read_file: ; start of execution
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [fileinfo+16],eax
|
|
|
|
|
shl ebx, 9
|
|
|
|
|
mov [fileinfo+12],ebx
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov [file_type],unk
|
|
|
|
|
mov [type_len],unkl-unk
|
|
|
|
|
mov [filename+40*2+6],dword 'UNK '
|
|
|
|
|
|
|
|
|
|
cmp [input_text+256+1],dword 'POST'
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je yes_new_message
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
cmp [input_text+256+11],dword 'oard' ; server board message
|
|
|
|
|
jne no_server_message_2
|
|
|
|
|
|
|
|
|
|
yes_new_message:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,filel
|
|
|
|
|
int 0x40
|
|
|
|
|
mov [board_size],ebx
|
|
|
|
|
|
|
|
|
|
cmp [input_text+256+1],dword 'POST'
|
|
|
|
|
jne no_new_message
|
|
|
|
|
|
|
|
|
|
mov edi,bsmt
|
|
|
|
|
call set_time
|
|
|
|
|
mov edi,bsmd
|
|
|
|
|
call set_date
|
|
|
|
|
|
|
|
|
|
call check_for_incoming_data
|
|
|
|
|
|
|
|
|
|
mov esi,input_text+256 ; from
|
|
|
|
|
newfroms:
|
|
|
|
|
inc esi
|
|
|
|
|
cmp esi,input_text+256*20
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je no_server_message_2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [esi],dword 'from'
|
|
|
|
|
jne newfroms
|
|
|
|
|
|
|
|
|
|
add esi,5
|
|
|
|
|
mov [from_i],esi
|
|
|
|
|
|
|
|
|
|
mov edx,0
|
|
|
|
|
name_new_len:
|
|
|
|
|
cmp [esi+edx],byte 13
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je name_found_len
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [esi+edx],byte '&'
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je name_found_len
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp edx,1000
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je name_found_len
|
2006-01-03 10:43:31 +01:00
|
|
|
|
inc edx
|
|
|
|
|
jmp name_new_len
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
name_found_len:
|
|
|
|
|
|
|
|
|
|
mov [from_len],edx
|
|
|
|
|
|
|
|
|
|
mov esi,input_text+256
|
|
|
|
|
newmessages:
|
|
|
|
|
inc esi
|
|
|
|
|
cmp esi,input_text+256*20
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je no_server_message_2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [esi],dword 'sage'
|
|
|
|
|
jne newmessages
|
|
|
|
|
|
|
|
|
|
add esi,5
|
|
|
|
|
mov [message],esi
|
|
|
|
|
|
|
|
|
|
mov edx,0
|
|
|
|
|
new_len:
|
|
|
|
|
inc edx
|
|
|
|
|
cmp [esi+edx],byte ' '
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je found_len
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [esi+edx],byte 13
|
|
|
|
|
jbe found_len
|
|
|
|
|
cmp edx,input_text+5000
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je found_len
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp new_len
|
|
|
|
|
found_len:
|
|
|
|
|
mov [message_len],edx
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov edx,0
|
|
|
|
|
|
|
|
|
|
change_letters:
|
|
|
|
|
|
|
|
|
|
cmp [esi+edx],byte '+'
|
|
|
|
|
jne no_space
|
|
|
|
|
mov [esi+edx],byte ' '
|
|
|
|
|
no_space:
|
|
|
|
|
|
|
|
|
|
cmp [esi+edx+1],word '0D'
|
|
|
|
|
jne no_br
|
|
|
|
|
mov [esi+edx],dword '<br>'
|
|
|
|
|
mov [esi+edx+4],word ' '
|
|
|
|
|
no_br:
|
|
|
|
|
|
|
|
|
|
cmp [esi+edx],byte '%'
|
|
|
|
|
jne no_ascii
|
|
|
|
|
movzx eax,byte [esi+edx+2]
|
|
|
|
|
sub eax,48
|
|
|
|
|
cmp eax,9
|
|
|
|
|
jbe eax_ok
|
|
|
|
|
sub eax,7
|
|
|
|
|
eax_ok:
|
|
|
|
|
movzx ebx,byte [esi+edx+1]
|
|
|
|
|
sub ebx,48
|
|
|
|
|
cmp ebx,9
|
|
|
|
|
jbe ebx_ok
|
|
|
|
|
sub ebx,7
|
|
|
|
|
ebx_ok:
|
|
|
|
|
imul ebx,16
|
|
|
|
|
add ebx,eax
|
|
|
|
|
mov [esi+edx],bl
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [esi+edx+1],word ''
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add edx,2
|
|
|
|
|
no_ascii:
|
|
|
|
|
|
|
|
|
|
inc edx
|
|
|
|
|
cmp edx,[message_len]
|
|
|
|
|
jbe change_letters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov edx,board1e-board1 + board2e-board2 + board3e-board3
|
|
|
|
|
add edx,[from_len]
|
|
|
|
|
add edx,[message_len]
|
|
|
|
|
|
|
|
|
|
add [board_size],edx
|
|
|
|
|
|
|
|
|
|
mov ecx,edx
|
|
|
|
|
call make_room
|
|
|
|
|
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov esi,board1 ; first part
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edi,0x20000
|
|
|
|
|
add edi,board1-board
|
|
|
|
|
mov ecx,edx
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov esi,[from_i] ; name
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edi,0x20000
|
2006-09-19 12:58:07 +02:00
|
|
|
|
add edi,board1-board
|
|
|
|
|
add edi,board1e-board1
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ecx,[from_len]
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov esi,board2 ; middle part
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edi,0x20000
|
|
|
|
|
add edi,board1-board + board1e-board1
|
|
|
|
|
add edi,[from_len]
|
|
|
|
|
mov ecx,board2e-board2
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov esi,[message] ; message
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edi,0x20000
|
2006-09-19 12:58:07 +02:00
|
|
|
|
add edi,board1-board + board1e-board1 + board2e-board2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add edi,[from_len]
|
|
|
|
|
mov ecx,[message_len]
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
mov esi,board3 ; end part
|
|
|
|
|
mov edi,0x20000
|
2006-09-19 12:58:07 +02:00
|
|
|
|
add edi,board1-board + board1e-board1 + board2e-board2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add edi,[from_len]
|
|
|
|
|
add edi,[message_len]
|
|
|
|
|
mov ecx,board3e-board3
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
inc [board_messages]
|
|
|
|
|
|
|
|
|
|
mov eax,[board_size]
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [files+12],eax
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,files
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
no_new_message:
|
|
|
|
|
mov esi,0x20000
|
|
|
|
|
mov edi,0x100000
|
|
|
|
|
mov ecx,[board_size]
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov ebx,[board_size]
|
|
|
|
|
|
|
|
|
|
mov [file_type],htm
|
|
|
|
|
mov [type_len],html-htm
|
|
|
|
|
mov [filename+40*2+6],dword 'HTM '
|
|
|
|
|
|
|
|
|
|
jmp file_loaded
|
|
|
|
|
no_server_message_2:
|
|
|
|
|
|
|
|
|
|
cmp [input_text+256+9],dword 'ySta' ; server message
|
|
|
|
|
jne no_server_message_1
|
|
|
|
|
mov edi,smt
|
|
|
|
|
call set_time
|
|
|
|
|
mov edi,smd
|
|
|
|
|
call set_date
|
|
|
|
|
mov eax,[documents_served]
|
|
|
|
|
mov ecx,9
|
|
|
|
|
mov edi,sms+21
|
|
|
|
|
call set_value
|
|
|
|
|
mov eax,[bytes_transferred]
|
|
|
|
|
mov ecx,9
|
|
|
|
|
mov edi,smb+21
|
|
|
|
|
call set_value
|
|
|
|
|
mov eax,[board_messages]
|
|
|
|
|
mov ecx,9
|
|
|
|
|
mov edi,smm+21
|
|
|
|
|
call set_value
|
|
|
|
|
mov eax,[board_size]
|
|
|
|
|
mov ecx,9
|
|
|
|
|
mov edi,smz+21
|
|
|
|
|
call set_value
|
|
|
|
|
mov esi,sm
|
|
|
|
|
mov edi,0x100000
|
|
|
|
|
mov ecx,sme-sm
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov ebx,sme-sm
|
|
|
|
|
|
|
|
|
|
mov [file_type],htm
|
|
|
|
|
mov [type_len],html-htm
|
|
|
|
|
mov [filename+40*2+6],dword 'HTM '
|
|
|
|
|
|
|
|
|
|
jmp file_loaded
|
|
|
|
|
no_server_message_1:
|
|
|
|
|
|
|
|
|
|
mov esi,input_text+256+6
|
|
|
|
|
cmp [input_text+256+1],dword 'GET '
|
|
|
|
|
jne no_new_let
|
|
|
|
|
mov edi,wanted_file
|
|
|
|
|
cld
|
|
|
|
|
new_let:
|
|
|
|
|
cmp [esi],byte ' '
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je no_new_let
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp edi,wanted_file+30
|
|
|
|
|
jge no_new_let
|
|
|
|
|
movsb
|
|
|
|
|
jmp new_let
|
|
|
|
|
no_new_let:
|
|
|
|
|
mov [edi+0],dword 0
|
|
|
|
|
mov [edi+4],dword 0
|
|
|
|
|
mov [edi+8],dword 0
|
|
|
|
|
|
|
|
|
|
cmp esi,input_text+256+6
|
|
|
|
|
jne no_index
|
|
|
|
|
mov edi,wanted_file
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [edi+0],dword 'inde'
|
|
|
|
|
mov [edi+4],dword 'x.ht'
|
|
|
|
|
mov [edi+8],byte 'm'
|
|
|
|
|
mov [edi+9],byte 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add edi,9
|
|
|
|
|
|
|
|
|
|
mov [file_type],htm
|
|
|
|
|
mov [type_len],html-htm
|
|
|
|
|
mov [filename+40*2+6],dword 'HTM '
|
|
|
|
|
|
|
|
|
|
jmp html_file
|
|
|
|
|
no_index:
|
|
|
|
|
|
|
|
|
|
cmp [edi-3],dword 'htm'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je htm_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi-3],dword 'HTM'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je htm_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp no_htm_header
|
|
|
|
|
htm_header:
|
|
|
|
|
mov [file_type],htm
|
|
|
|
|
mov [type_len],html-htm
|
|
|
|
|
mov [filename+40*2+6],dword 'HTM '
|
|
|
|
|
jmp found_file_type
|
|
|
|
|
no_htm_header:
|
|
|
|
|
|
|
|
|
|
cmp [edi-3],dword 'png'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je png_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi-3],dword 'PNG'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je png_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp no_png_header
|
|
|
|
|
png_header:
|
|
|
|
|
mov [file_type],png
|
|
|
|
|
mov [type_len],pngl-png
|
|
|
|
|
mov [filename+40*2+6],dword 'PNG '
|
|
|
|
|
jmp found_file_type
|
|
|
|
|
no_png_header:
|
|
|
|
|
|
|
|
|
|
cmp [edi-3],dword 'gif'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je gif_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi-3],dword 'GIF'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je gif_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp no_gif_header
|
|
|
|
|
gif_header:
|
|
|
|
|
mov [file_type],gif
|
|
|
|
|
mov [type_len],gifl-gif
|
|
|
|
|
mov [filename+40*2+6],dword 'GIF '
|
|
|
|
|
jmp found_file_type
|
|
|
|
|
no_gif_header:
|
|
|
|
|
|
|
|
|
|
cmp [edi-3],dword 'jpg'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je jpg_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi-3],dword 'JPG'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je jpg_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp no_jpg_header
|
|
|
|
|
jpg_header:
|
|
|
|
|
mov [file_type],jpg
|
|
|
|
|
mov [type_len],jpgl-jpg
|
|
|
|
|
mov [filename+40*2+6],dword 'JPG '
|
|
|
|
|
jmp found_file_type
|
|
|
|
|
no_jpg_header:
|
|
|
|
|
|
|
|
|
|
cmp [edi-3],dword 'asm'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je txt_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi-3],dword 'ASM'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je txt_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi-3],dword 'txt'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je txt_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi-3],dword 'TXT'+0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je txt_header
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp no_txt_header
|
|
|
|
|
txt_header:
|
|
|
|
|
mov [file_type],txt
|
|
|
|
|
mov [type_len],txtl-txt
|
|
|
|
|
mov [filename+40*2+6],dword 'TXT '
|
|
|
|
|
jmp found_file_type
|
|
|
|
|
no_txt_header:
|
|
|
|
|
|
|
|
|
|
html_file:
|
|
|
|
|
|
|
|
|
|
found_file_type:
|
|
|
|
|
|
|
|
|
|
mov edi,getf
|
|
|
|
|
add edi,[getflen]
|
|
|
|
|
mov esi,wanted_file
|
|
|
|
|
mov ecx,40
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
mov esi,getf
|
|
|
|
|
mov edi,filename
|
|
|
|
|
mov ecx,35
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [fileinfo+12],dword 1 ; file exists ?
|
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,fileinfo
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp eax,0 ; file not found - message
|
|
|
|
|
je file_found
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edi,et
|
|
|
|
|
call set_time
|
|
|
|
|
mov edi,ed
|
|
|
|
|
call set_date
|
|
|
|
|
mov esi,fnf
|
|
|
|
|
mov edi,0x100000
|
|
|
|
|
mov ecx,fnfe-fnf
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov ebx,fnfe-fnf
|
|
|
|
|
|
|
|
|
|
mov [file_type],htm
|
|
|
|
|
mov [type_len],html-htm
|
|
|
|
|
mov [filename+40*2+6],dword 'HTM '
|
|
|
|
|
|
|
|
|
|
jmp file_not_found
|
|
|
|
|
|
|
|
|
|
file_found:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [fileinfo+12],dword 0x2f0000 ; read all of file
|
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,fileinfo
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
file_not_found:
|
|
|
|
|
file_loaded:
|
|
|
|
|
|
|
|
|
|
and ebx,0x3fffff
|
|
|
|
|
mov [filesize],ebx
|
|
|
|
|
mov [file_left],ebx
|
|
|
|
|
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
mov edi,c_l+5
|
|
|
|
|
mov ebx,10
|
|
|
|
|
newl:
|
|
|
|
|
xor edx,edx
|
|
|
|
|
div ebx
|
|
|
|
|
mov ecx,edx
|
|
|
|
|
add cl,48
|
|
|
|
|
mov [edi],cl
|
|
|
|
|
dec edi
|
|
|
|
|
cmp edi,c_l
|
|
|
|
|
jge newl
|
|
|
|
|
|
|
|
|
|
mov esi,c_l
|
|
|
|
|
mov edi,filename+46
|
|
|
|
|
mov ecx,7
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
inc [documents_served]
|
|
|
|
|
mov eax,[filesize]
|
|
|
|
|
add [bytes_transferred],eax
|
|
|
|
|
|
|
|
|
|
call draw_data
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_value:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
add edi,ecx
|
|
|
|
|
mov ebx,10
|
|
|
|
|
new_value:
|
|
|
|
|
xor edx,edx
|
|
|
|
|
div ebx
|
|
|
|
|
add dl,48
|
|
|
|
|
mov [edi],dl
|
|
|
|
|
dec edi
|
|
|
|
|
loop new_value
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_time:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
mov eax,3
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov ecx,3
|
|
|
|
|
new_time_digit:
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
and ebx,0xff
|
|
|
|
|
shl ebx,4
|
|
|
|
|
shr bl,4
|
|
|
|
|
add bx,48*256+48
|
|
|
|
|
mov [edi],bh
|
|
|
|
|
mov [edi+1],bl
|
|
|
|
|
add edi,3
|
|
|
|
|
shr eax,8
|
|
|
|
|
loop new_time_digit
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_date:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
mov eax,29
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov ecx,3
|
|
|
|
|
add edi,6
|
|
|
|
|
new_date_digit:
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
and ebx,0xff
|
|
|
|
|
shl ebx,4
|
|
|
|
|
shr bl,4
|
|
|
|
|
add bx,48*256+48
|
|
|
|
|
mov [edi],bh
|
|
|
|
|
mov [edi+1],bl
|
|
|
|
|
sub edi,3
|
|
|
|
|
shr eax,8
|
|
|
|
|
loop new_date_digit
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
check_for_incoming_data:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
check:
|
|
|
|
|
|
|
|
|
|
mov eax, 53
|
|
|
|
|
mov ebx, 2
|
|
|
|
|
mov ecx, [socket]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
cmp eax,0
|
|
|
|
|
je _ret_now
|
|
|
|
|
|
|
|
|
|
new_data:
|
|
|
|
|
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,2
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
cmp eax,0
|
|
|
|
|
je _ret
|
|
|
|
|
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,3
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
cmp bl,10
|
|
|
|
|
jne no_lf
|
|
|
|
|
inc [posy]
|
|
|
|
|
mov [posx],0
|
|
|
|
|
jmp new_data
|
|
|
|
|
no_lf:
|
|
|
|
|
|
|
|
|
|
cmp bl,20
|
|
|
|
|
jb new_data
|
|
|
|
|
|
|
|
|
|
inc [posx]
|
|
|
|
|
cmp [posy],20
|
|
|
|
|
jbe yok
|
|
|
|
|
mov [posy],1
|
|
|
|
|
yok:
|
|
|
|
|
|
|
|
|
|
mov eax,[posy]
|
|
|
|
|
imul eax,256
|
|
|
|
|
add eax,[posx]
|
|
|
|
|
|
|
|
|
|
mov [input_text+eax],bl
|
|
|
|
|
|
|
|
|
|
jmp new_data
|
|
|
|
|
|
|
|
|
|
_ret:
|
|
|
|
|
|
|
|
|
|
call draw_data
|
|
|
|
|
|
|
|
|
|
mov eax,5
|
|
|
|
|
mov ebx,1
|
|
|
|
|
cmp [input_text+256+1],dword 'POST'
|
|
|
|
|
jne no_ld
|
|
|
|
|
mov ebx,50
|
|
|
|
|
no_ld:
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
jmp check
|
|
|
|
|
|
|
|
|
|
_ret_now:
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
posy dd 1
|
|
|
|
|
posx dd 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
check_status:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
mov eax,53
|
|
|
|
|
mov ebx,6
|
|
|
|
|
mov ecx,[socket]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
cmp eax,[status]
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je c_ret
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov [status],eax
|
|
|
|
|
add al,48
|
|
|
|
|
mov [text+12],al
|
|
|
|
|
call draw_data
|
|
|
|
|
c_ret:
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
addr dd 0x0
|
|
|
|
|
ya dd 0x0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
filename2: times 100 db 32
|
|
|
|
|
|
|
|
|
|
read_string:
|
|
|
|
|
|
|
|
|
|
mov [addr],dword getf
|
|
|
|
|
mov [ya],dword 139
|
|
|
|
|
|
|
|
|
|
mov edi,[addr]
|
|
|
|
|
mov eax,0
|
|
|
|
|
mov ecx,30
|
|
|
|
|
cld
|
|
|
|
|
rep stosb
|
|
|
|
|
|
|
|
|
|
call print_text
|
|
|
|
|
|
|
|
|
|
mov edi,[addr]
|
|
|
|
|
|
|
|
|
|
f11:
|
|
|
|
|
mov eax,10
|
|
|
|
|
int 0x40
|
|
|
|
|
cmp eax,2
|
|
|
|
|
jne read_done
|
|
|
|
|
mov eax,2
|
|
|
|
|
int 0x40
|
|
|
|
|
shr eax,8
|
|
|
|
|
cmp eax,13
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je read_done
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp eax,8
|
|
|
|
|
jnz nobsl
|
|
|
|
|
cmp edi,[addr]
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jz f11
|
2006-01-03 10:43:31 +01:00
|
|
|
|
sub edi,1
|
|
|
|
|
mov [edi],byte 32
|
|
|
|
|
call print_text
|
|
|
|
|
jmp f11
|
|
|
|
|
nobsl:
|
|
|
|
|
mov [edi],al
|
|
|
|
|
|
|
|
|
|
call print_text
|
|
|
|
|
|
|
|
|
|
add edi,1
|
|
|
|
|
mov esi,[addr]
|
|
|
|
|
add esi,30
|
|
|
|
|
cmp esi,edi
|
|
|
|
|
jnz f11
|
|
|
|
|
|
|
|
|
|
read_done:
|
|
|
|
|
|
|
|
|
|
push edi
|
|
|
|
|
|
|
|
|
|
mov ecx,40
|
|
|
|
|
mov eax,32
|
|
|
|
|
cld
|
|
|
|
|
rep stosb
|
|
|
|
|
|
|
|
|
|
call print_text
|
|
|
|
|
|
|
|
|
|
pop edi
|
|
|
|
|
sub edi,[addr]
|
|
|
|
|
mov [getflen],edi
|
|
|
|
|
|
|
|
|
|
mov esi,getf
|
|
|
|
|
mov edi,dirp+12
|
|
|
|
|
mov ecx,28
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print_text:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
mov eax,4
|
|
|
|
|
mov edx,[addr]
|
|
|
|
|
mov ebx,97*65536
|
|
|
|
|
add ebx,[ya]
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ecx,0x40000000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov esi,23
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov edi,0xffffff
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; *********************************************
|
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
|
mov ebx,1 ; 1, start of draw
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
; DRAW WINDOW
|
|
|
|
|
mov eax,0 ; function 0 : define and draw window
|
|
|
|
|
mov ebx,100*65536+480 ; [x start] *65536 + [x size]
|
|
|
|
|
mov ecx,100*65536+215 ; [y start] *65536 + [y size]
|
|
|
|
|
mov edx,0x13ffffff ; color of work area RRGGBB
|
|
|
|
|
mov edi,header ; WINDOW LABEL
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,8 ; function 8 : define and draw button
|
|
|
|
|
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
|
|
|
|
|
mov ecx,59*65536+9 ; [y start] *65536 + [y size]
|
|
|
|
|
mov edx,2 ; button id
|
|
|
|
|
mov esi,0x66aa66 ; button color RRGGBB
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
; function 8 : define and draw button
|
|
|
|
|
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
|
|
|
|
|
mov ecx,72*65536+9 ; [y start] *65536 + [y size]
|
|
|
|
|
mov edx,4 ; button id
|
|
|
|
|
mov esi,0xaa6666 ; button color RRGGBB
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
; Enter directory
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,(25)*65536+66
|
|
|
|
|
mov ecx,135*65536+15
|
|
|
|
|
mov edx,6
|
|
|
|
|
mov esi,0x3388dd
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov eax,38
|
|
|
|
|
mov ebx,240*65536+240
|
|
|
|
|
mov ecx,22*65536+210
|
|
|
|
|
mov edx,0x6699cc ; 002288
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,241*65536+241
|
|
|
|
|
mov ecx,22*65536+210
|
|
|
|
|
mov edx,0x336699 ; 002288
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
call draw_data
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
|
mov ebx,2 ; 2, end of draw
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_data:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ebx,25*65536+35 ; draw info text with function 4
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ecx,0x000000
|
|
|
|
|
mov edx,text
|
|
|
|
|
mov esi,35
|
|
|
|
|
newline:
|
|
|
|
|
pusha
|
|
|
|
|
cmp ebx,25*65536+61
|
|
|
|
|
je now
|
|
|
|
|
cmp ebx,25*65536+74
|
|
|
|
|
je now
|
|
|
|
|
cmp ebx,25*65536+74+13*5
|
|
|
|
|
je now
|
|
|
|
|
mov ecx,ebx
|
|
|
|
|
mov bx,35*6
|
|
|
|
|
shl ecx,16
|
|
|
|
|
mov cx,9
|
|
|
|
|
mov eax,13
|
|
|
|
|
mov edx,0xffffff
|
|
|
|
|
int 0x40
|
|
|
|
|
now:
|
|
|
|
|
popa
|
|
|
|
|
mov eax,4
|
|
|
|
|
int 0x40
|
|
|
|
|
add ebx,13
|
|
|
|
|
add edx,40
|
|
|
|
|
cmp [edx],byte 'x'
|
|
|
|
|
jnz newline
|
|
|
|
|
|
|
|
|
|
mov [input_text+0],dword 'RECE'
|
|
|
|
|
mov [input_text+4],dword 'IVED'
|
|
|
|
|
mov [input_text+8],dword ': '
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ebx,255*65536+35 ; draw info text with function 4
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ecx,0x000000
|
|
|
|
|
mov edx,input_text
|
|
|
|
|
mov esi,35
|
|
|
|
|
mov edi,17
|
|
|
|
|
newline2:
|
|
|
|
|
pusha
|
|
|
|
|
mov ecx,ebx
|
|
|
|
|
mov bx,35*6
|
|
|
|
|
shl ecx,16
|
|
|
|
|
mov cx,9
|
|
|
|
|
mov eax,13
|
|
|
|
|
mov edx,0xffffff
|
|
|
|
|
int 0x40
|
|
|
|
|
popa
|
|
|
|
|
mov eax,4
|
|
|
|
|
int 0x40
|
|
|
|
|
add ebx,10
|
|
|
|
|
add edx,256
|
|
|
|
|
dec edi
|
|
|
|
|
jnz newline2
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
status dd 0x0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
text:
|
|
|
|
|
db 'TCB status: x '
|
|
|
|
|
db ' '
|
|
|
|
|
db ' Activate server '
|
|
|
|
|
db ' Stop server '
|
|
|
|
|
db ' '
|
|
|
|
|
db 'Requests: /TinyStat -statistics '
|
|
|
|
|
db ' /TinyBoard -message board '
|
|
|
|
|
db ' '
|
|
|
|
|
dirp:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db ' Files: /rd/1/ '
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db ' '
|
|
|
|
|
filename:
|
|
|
|
|
db ' '
|
|
|
|
|
db 'Size: ------- '
|
|
|
|
|
db 'Type: --- '
|
|
|
|
|
db 'x' ; <- END MARKER, DONT DELETE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
html_header:
|
|
|
|
|
|
|
|
|
|
db 'HTTP/1.0 200 OK',13,10
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db 'Server: KolibriOS HTTP Server',13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db 'Content-Length: '
|
|
|
|
|
c_l: db '000000',13,10
|
|
|
|
|
|
|
|
|
|
h_len:
|
|
|
|
|
|
|
|
|
|
fnf:
|
|
|
|
|
db '<body>'
|
|
|
|
|
db '<pre>'
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "HTTP-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> v ",version," <20><><EFBFBD> KolibriOS",13,10,13,10
|
|
|
|
|
db "<H1>Error <FONT color=red>404</FONT> - File not found</H1>",13,10,13,10
|
|
|
|
|
db "<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /TinyStat",13,10,13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
et: db "xx:xx:xx",13,10
|
|
|
|
|
ed: db "xx.xx.xx",13,10
|
|
|
|
|
db "</pre></body>"
|
|
|
|
|
fnfe:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sm:
|
|
|
|
|
db '<body>'
|
|
|
|
|
db '<pre>'
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "HTTP-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> v ",version," <20><><EFBFBD> KolibriOS",13,10,13,10
|
|
|
|
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: (<28><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",13,10,13,10
|
|
|
|
|
sms: db "- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: xxxxxxxxx",13,10
|
|
|
|
|
smb: db "- <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : xxxxxxxxx",13,10
|
|
|
|
|
db "- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <a href=/TinyStat><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a>",13,10,13,10
|
|
|
|
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:",13,10,13,10
|
|
|
|
|
smm: db "- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : xxxxxxxxx",13,10
|
|
|
|
|
smz: db "- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : xxxxxxxxx",13,10
|
|
|
|
|
db "- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <a href=/TinyBoard><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a>",13,10,13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
smt: db "xx:xx:xx",13,10
|
|
|
|
|
smd: db "xx.xx.xx",13,10
|
|
|
|
|
db '</pre></body>'
|
|
|
|
|
sme:
|
|
|
|
|
|
|
|
|
|
documents_served dd 0x0
|
|
|
|
|
bytes_transferred dd 0x0
|
|
|
|
|
|
|
|
|
|
file_type dd 0
|
|
|
|
|
type_len dd 0
|
|
|
|
|
|
|
|
|
|
htm: db 'Content-Type: text/html',13,10,13,10
|
|
|
|
|
html:
|
|
|
|
|
txt: db 'Content-Type: text/plain',13,10,13,10
|
|
|
|
|
txtl:
|
|
|
|
|
png: db 'Content-Type: image/png',13,10,13,10
|
|
|
|
|
pngl:
|
|
|
|
|
gif: db 'Content-Type: image/gif',13,10,13,10
|
|
|
|
|
gifl:
|
|
|
|
|
jpg: db 'Content-Type: image/jpeg',13,10,13,10
|
|
|
|
|
jpgl:
|
|
|
|
|
unk: db 'Content-Type: unknown/unknown',13,10,13,10
|
|
|
|
|
unkl:
|
|
|
|
|
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
header db appname,version,0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
socket dd 0x0
|
|
|
|
|
server_active db 0x0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
board:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "<HTML><HEAD><TITLE>INTKolibriOS - /<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/</TITLE></HEAD>",13,10
|
|
|
|
|
db "<BODY background=bgnd.gif BGCOLOR=#ffffff ALINK=black VLINK=black><br>",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db "<center>",13,10
|
|
|
|
|
db "<TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0 bgcolor=#ffffff width=600>"
|
|
|
|
|
db 13,10
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "<TR VALIGN=top><TD ALIGN=center bgcolor=F4F4F4>",13,10
|
|
|
|
|
db "<font size=4><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> INTKolibriOS</TD></TR></TABLE><br>",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db "<TABLE CELLPADDING=14 CELLSPACING=2 BORDER=0 bgcolor=#ffffff width=600>"
|
|
|
|
|
db 13,10,13,10
|
|
|
|
|
|
|
|
|
|
board1:
|
|
|
|
|
|
|
|
|
|
db "<TR VALIGN=top>",13,10
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "<TD ALIGN=left width=80 bgcolor=F4F4F4><P>",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db "<font size=3>",13,10
|
|
|
|
|
board1e:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "Hex",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
board2:
|
|
|
|
|
db "</font>",13,10
|
|
|
|
|
db "<br><br><br>",13,10
|
|
|
|
|
db "<br><br><br><br>",13,10
|
|
|
|
|
bsmt:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "15.23.45<br>",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
bsmd:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "22.03.06",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db "</P></TD>",13,10
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "<TD bgcolor=F4F4F4><P>",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
board2e:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> INTKolibriOS! (-:<br>"
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db 13,10
|
|
|
|
|
board3:
|
|
|
|
|
db "</P></TD></TR>",13,10,13,10
|
|
|
|
|
board3e:
|
|
|
|
|
|
|
|
|
|
boardadd:
|
|
|
|
|
|
|
|
|
|
db "</TABLE>",13,10
|
|
|
|
|
db "<br>",13,10
|
|
|
|
|
db "<TABLE CELLPADDING=14 CELLSPACING=3 BORDER=0 bgcolor=#ffffff width=600>"
|
|
|
|
|
db 13,10
|
|
|
|
|
db "<TR VALIGN=top>",13,10
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "<TD ALIGN=left bgcolor=F4F4F4><P>",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db "<form method=Post Action=/TinyBoard>",13,10
|
2006-09-19 12:58:07 +02:00
|
|
|
|
db "<22><><EFBFBD>: <br><input type=text name=from size=20 MAXLENGTH=20><br>",13,10
|
|
|
|
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <br><textarea cols=60 rows=6 name=message></textarea><br>",13,10
|
|
|
|
|
db "<input type=Submit Value=' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '></form>",13,10
|
2006-01-03 10:43:31 +01:00
|
|
|
|
db "</TD></TR>",13,10
|
|
|
|
|
db "</TABLE>",13,10
|
|
|
|
|
db "</BODY>",13,10
|
|
|
|
|
db "</HTML>",13,10
|
|
|
|
|
|
|
|
|
|
board_end:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
board_size dd 0x0
|
|
|
|
|
board_messages dd 0x0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
input_text:
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
I_END:
|