Ftpc: change sorting of folders and files, clean code
This commit is contained in:
@@ -83,12 +83,12 @@ start: ;////////////////////////////////////////////////////////////////////////
|
|||||||
;< none ;;
|
;< none ;;
|
||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
; initialize heap for using dynamic blocks
|
; initialize heap for using dynamic blocks
|
||||||
mcall 68, 11
|
mcall SF_SYS_MISC, SSF_HEAP_INIT
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je exit2
|
je exit2
|
||||||
|
|
||||||
; disable all events except network event
|
; disable all events except network event
|
||||||
mcall 40, EV_STACK
|
mcall SF_SET_EVENTS_MASK, EV_STACK
|
||||||
; load libraries
|
; load libraries
|
||||||
stdcall dll.Load, @IMPORT
|
stdcall dll.Load, @IMPORT
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@@ -125,16 +125,16 @@ start: ;////////////////////////////////////////////////////////////////////////
|
|||||||
mov [acti_port_stop], ax
|
mov [acti_port_stop], ax
|
||||||
|
|
||||||
invoke ini.get_str, path, str_general, str_dir, buf_buffer1, BUFFERSIZE, 0
|
invoke ini.get_str, path, str_general, str_dir, buf_buffer1, BUFFERSIZE, 0
|
||||||
mcall 30, 1, buf_buffer1 ; set working directory
|
mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_buffer1 ; set working directory
|
||||||
|
|
||||||
; initialize log file
|
; initialize log file
|
||||||
invoke ini.get_str, path, str_general, str_logfile, log_file, 512, 0
|
invoke ini.get_str, path, str_general, str_logfile, log_file, 512, 0
|
||||||
mov [filestruct2.subfn], 2
|
mov [filestruct2.subfn], SSF_CREATE_FILE
|
||||||
mov [filestruct2.offset], 0
|
mov [filestruct2.offset], 0
|
||||||
mov [filestruct2.size], 0
|
mov [filestruct2.size], 0
|
||||||
mov [filestruct2.ptr], 0
|
mov [filestruct2.ptr], 0
|
||||||
mov [filestruct2.name], log_file
|
mov [filestruct2.name], log_file
|
||||||
mcall 70, filestruct2
|
mcall SF_FILE, filestruct2
|
||||||
|
|
||||||
; Usage: ftpc [-cli] [ftp://username:password@server:port/path]
|
; Usage: ftpc [-cli] [ftp://username:password@server:port/path]
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
|
|||||||
|
|
||||||
; receive socket data with timeout
|
; receive socket data with timeout
|
||||||
.receive:
|
.receive:
|
||||||
mcall 26, 9
|
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
|
||||||
add eax, TIMEOUT*100
|
add eax, TIMEOUT*100
|
||||||
mov [timeout], eax
|
mov [timeout], eax
|
||||||
.again:
|
.again:
|
||||||
@@ -365,11 +365,11 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
|
|||||||
je .closed
|
je .closed
|
||||||
cmp ebx, EWOULDBLOCK
|
cmp ebx, EWOULDBLOCK
|
||||||
jne .sock_err
|
jne .sock_err
|
||||||
mcall 26, 9
|
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
|
||||||
mov ebx, [timeout]
|
mov ebx, [timeout]
|
||||||
sub ebx, eax
|
sub ebx, eax
|
||||||
jle .timeout
|
jle .timeout
|
||||||
mcall 23 ; Wait for event with timeout
|
mcall SF_WAIT_EVENT_TIMEOUT ; Wait for event with timeout
|
||||||
jmp .again
|
jmp .again
|
||||||
|
|
||||||
.sock_err:
|
.sock_err:
|
||||||
@@ -524,7 +524,7 @@ transfer_queued:
|
|||||||
|
|
||||||
; Error occured, we reached the end of the buffer before [queued] reached 0
|
; Error occured, we reached the end of the buffer before [queued] reached 0
|
||||||
mov [queued], 0
|
mov [queued], 0
|
||||||
mcall 68, 13, [ptr_fname] ; free buffer
|
mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz error_heap
|
jz error_heap
|
||||||
jmp wait_for_usercommand
|
jmp wait_for_usercommand
|
||||||
@@ -535,7 +535,7 @@ transfer_queued:
|
|||||||
dec [queued]
|
dec [queued]
|
||||||
jnz cmd_retr
|
jnz cmd_retr
|
||||||
|
|
||||||
mcall 68, 13, [ptr_fname] ; free buffer
|
mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz error_heap
|
jz error_heap
|
||||||
jmp cmd_retr
|
jmp cmd_retr
|
||||||
@@ -655,12 +655,12 @@ write_to_file: ;////////////////////////////////////////////////////////////////
|
|||||||
mov eax, 0
|
mov eax, 0
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
mov [filestruct2.subfn], 3
|
mov [filestruct2.subfn], SSF_WRITE_FILE
|
||||||
m2m [filestruct2.offset], [logfile_offset]
|
m2m [filestruct2.offset], [logfile_offset]
|
||||||
mov [filestruct2.size], ecx
|
mov [filestruct2.size], ecx
|
||||||
mov [filestruct2.ptr], eax
|
mov [filestruct2.ptr], eax
|
||||||
mov [filestruct2.name], log_file
|
mov [filestruct2.name], log_file
|
||||||
mcall 70, filestruct2
|
mcall SF_FILE, filestruct2
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
mov [logfile_offset], -1 ; disable logging
|
mov [logfile_offset], -1 ; disable logging
|
||||||
@@ -754,7 +754,7 @@ wait_for_keypress:
|
|||||||
exit:
|
exit:
|
||||||
mcall close, [controlsocket]
|
mcall close, [controlsocket]
|
||||||
exit2:
|
exit2:
|
||||||
mcall -1
|
mcall SF_TERMINATE_PROCESS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -45,8 +45,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .exit
|
jnz .exit
|
||||||
|
|
||||||
mcall 48, 3, sc, sizeof.system_colors
|
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
|
||||||
mcall 40, 0xC0000027 ; set event mask
|
mcall SF_SET_EVENTS_MASK, 0xC0000027 ; set event mask
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.server_addr:
|
.server_addr:
|
||||||
@@ -84,7 +84,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
mov [filestruct.subfn], 0
|
mov [filestruct.subfn], 0
|
||||||
mov [filestruct.offset], 54
|
mov [filestruct.offset], 54
|
||||||
mov [filestruct.size], ecx
|
mov [filestruct.size], ecx
|
||||||
mcall 70, filestruct
|
mcall SF_FILE, filestruct
|
||||||
cmp ebx, 0
|
cmp ebx, 0
|
||||||
jl @f
|
jl @f
|
||||||
m2m dword[tree1.data_img_sys], dword[icon_tl_sys]
|
m2m dword[tree1.data_img_sys], dword[icon_tl_sys]
|
||||||
@@ -98,7 +98,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
;mov [filestruct.subfn], 0
|
;mov [filestruct.subfn], 0
|
||||||
;mov [filestruct.offset], 54
|
;mov [filestruct.offset], 54
|
||||||
mov [filestruct.size], ecx
|
mov [filestruct.size], ecx
|
||||||
mcall 70, filestruct
|
mcall SF_FILE, filestruct
|
||||||
cmp ebx, 0
|
cmp ebx, 0
|
||||||
jl @f
|
jl @f
|
||||||
m2m dword[tree1.data_img], dword[icon_tl_nod]
|
m2m dword[tree1.data_img], dword[icon_tl_nod]
|
||||||
@@ -121,7 +121,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
.still:
|
.still:
|
||||||
mcall 10
|
mcall SF_WAIT_EVENT
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz .redraw
|
jz .redraw
|
||||||
@@ -146,65 +146,65 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
.draw:
|
.draw:
|
||||||
mcall 12, 1
|
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||||
; main window
|
; main window
|
||||||
mcall 0, <35,830>, <20,555>, 0x34000000+SYS_COL, 0x805080DD, str_title
|
mcall SF_CREATE_WINDOW, <35,830>, <20,555>, 0x34000000+SYS_COL, 0x805080DD, str_title
|
||||||
|
|
||||||
;-------------------------
|
;-------------------------
|
||||||
; textedit components
|
; textedit components
|
||||||
;-------------------------
|
;-------------------------
|
||||||
mcall 9, procinfo, -1
|
mcall SF_THREAD_INFO, procinfo, -1
|
||||||
mov edi, tedit0
|
mov edi, tedit0
|
||||||
call EvSize
|
call EvSize
|
||||||
|
|
||||||
movzx ebx,word[procinfo.client_box.width]
|
movzx ebx,word[procinfo.client_box.width]
|
||||||
inc bx
|
inc bx
|
||||||
mcall 13, , ted_wnd_t
|
mcall SF_DRAW_RECT, , ted_wnd_t
|
||||||
stdcall [ted_draw], tedit0
|
stdcall [ted_draw], tedit0
|
||||||
|
|
||||||
; draw "disconnect" button
|
; draw "disconnect" button
|
||||||
mcall 8, <50,95>, <25,25>, 3, BT_COL
|
mcall SF_DEFINE_BUTTON, <50,95>, <25,25>, 3, BT_COL
|
||||||
; string "disconnect"
|
; string "disconnect"
|
||||||
mcall 4, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect
|
mcall SF_DRAW_TEXT, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect
|
||||||
; draw "Copy" button
|
; draw "Copy" button
|
||||||
mcall 8, <50,40>, <326,25>, 4, BT_COL
|
mcall SF_DEFINE_BUTTON, <50,40>, <326,25>, 4, BT_COL
|
||||||
; string "copy"
|
; string "copy"
|
||||||
mcall 4, <50+5,326+5>, 0xb0000000+STR_COL, str_copy
|
mcall SF_DRAW_TEXT, <50+5,326+5>, 0xb0000000+STR_COL, str_copy
|
||||||
; draw "Search" button
|
; draw "Search" button
|
||||||
mcall 8, <TLIST2_X+TLIST_SZ-55,55>, <20,25>, 5, BT_COL
|
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-55,55>, <20,25>, 5, BT_COL
|
||||||
; string "Search"
|
; string "Search"
|
||||||
mcall 4, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search
|
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search
|
||||||
|
|
||||||
; draw "LIST" button
|
; draw "LIST" button
|
||||||
mcall 8, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL
|
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL
|
||||||
; string "LIST"
|
; string "LIST"
|
||||||
mcall 4, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list
|
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list
|
||||||
; draw "DELE" button
|
; draw "DELE" button
|
||||||
mcall 8, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL
|
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL
|
||||||
; string "DELE"
|
; string "DELE"
|
||||||
mcall 4, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele
|
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele
|
||||||
; draw "RDIR" button
|
; draw "RDIR" button
|
||||||
mcall 8, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL
|
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL
|
||||||
; string "RDIR"
|
; string "RDIR"
|
||||||
mcall 4, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir
|
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir
|
||||||
; draw "RMD" button
|
; draw "RMD" button
|
||||||
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL
|
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL
|
||||||
; string "RMD"
|
; string "RMD"
|
||||||
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd
|
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd
|
||||||
|
|
||||||
; draw "mkd" button
|
; draw "mkd" button
|
||||||
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL
|
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL
|
||||||
; string "mkd"
|
; string "mkd"
|
||||||
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd
|
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd
|
||||||
|
|
||||||
; draw "cancel" button
|
; draw "cancel" button
|
||||||
;mcall 8, <555,55>, <308,25>, 10, BT_COL
|
;mcall SF_DEFINE_BUTTON, <555,55>, <308,25>, 10, BT_COL
|
||||||
; string "Cancel"
|
; string "Cancel"
|
||||||
;mcall 4, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
|
;mcall SF_DRAW_TEXT, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
|
||||||
; draw "change volume" button
|
; draw "change volume" button
|
||||||
mcall 8, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL
|
mcall SF_DEFINE_BUTTON, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL
|
||||||
; string "Change"
|
; string "Change"
|
||||||
mcall 4, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change
|
mcall SF_DRAW_TEXT, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change
|
||||||
|
|
||||||
;--------------------------
|
;--------------------------
|
||||||
; tree list components
|
; tree list components
|
||||||
@@ -222,12 +222,12 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
stdcall [edit_box_draw], edit_volume
|
stdcall [edit_box_draw], edit_volume
|
||||||
stdcall [edit_box_draw], edit_search
|
stdcall [edit_box_draw], edit_search
|
||||||
|
|
||||||
mcall 12,2
|
mcall SF_REDRAW, SSF_END_DRAW
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
.mouse:
|
.mouse:
|
||||||
mcall 37, 1
|
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
|
||||||
cmp word[tedit0.wnd.top], ax
|
cmp word[tedit0.wnd.top], ax
|
||||||
jg .no_edit
|
jg .no_edit
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
cmp word[tedit0.wnd.left], ax
|
cmp word[tedit0.wnd.left], ax
|
||||||
jg .no_edit
|
jg .no_edit
|
||||||
|
|
||||||
mcall 37, 3
|
mcall SF_MOUSE_GET, SSF_BUTTON_EXT
|
||||||
bt eax, 24
|
bt eax, 24
|
||||||
jnc @f
|
jnc @f
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
|
|
||||||
align 16
|
align 16
|
||||||
.key:
|
.key:
|
||||||
mcall 2
|
mcall SF_GET_KEY
|
||||||
stdcall [tl_key], tree1
|
stdcall [tl_key], tree1
|
||||||
stdcall [tl_key], tree2
|
stdcall [tl_key], tree2
|
||||||
stdcall [edit_box_key], edit_mkd
|
stdcall [edit_box_key], edit_mkd
|
||||||
@@ -266,7 +266,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
|
|
||||||
align 16
|
align 16
|
||||||
.button:
|
.button:
|
||||||
mcall 17
|
mcall SF_GET_BUTTON
|
||||||
|
|
||||||
cmp ah, 3
|
cmp ah, 3
|
||||||
jne @f
|
jne @f
|
||||||
@@ -424,6 +424,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
mov byte[edi], 0
|
mov byte[edi], 0
|
||||||
|
|
||||||
; add node to tree list
|
; add node to tree list
|
||||||
|
and dword[tree2.style], not 8
|
||||||
|
stdcall [tl_cur_next], tree2
|
||||||
cmp word[node_entry2], 'fi'
|
cmp word[node_entry2], 'fi'
|
||||||
jne @f
|
jne @f
|
||||||
stdcall [tl_node_add], tree2, 0, node_entry2
|
stdcall [tl_node_add], tree2, 0, node_entry2
|
||||||
@@ -470,6 +472,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
jne @b
|
jne @b
|
||||||
|
|
||||||
.done_parsing:
|
.done_parsing:
|
||||||
|
stdcall [tl_cur_beg], tree2
|
||||||
|
or dword[tree2.style], 8
|
||||||
call .draw ; to update tree list immediately in case of "auto_list"
|
call .draw ; to update tree list immediately in case of "auto_list"
|
||||||
pop eax
|
pop eax
|
||||||
pop edx
|
pop edx
|
||||||
@@ -494,7 +498,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
|
|||||||
;;================================================================================================;;
|
;;================================================================================================;;
|
||||||
|
|
||||||
; detect abort
|
; detect abort
|
||||||
mcall 17
|
mcall SF_GET_BUTTON
|
||||||
cmp ah, 10
|
cmp ah, 10
|
||||||
je cmd_abor
|
je cmd_abor
|
||||||
|
|
||||||
@@ -641,7 +645,7 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
|
|||||||
jne @f
|
jne @f
|
||||||
|
|
||||||
; removes last file name from filestruct.name
|
; removes last file name from filestruct.name
|
||||||
mcall 30, 2, filestruct.name,1024 ; get absolute path for cwd
|
mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name,1024 ; get absolute path for cwd
|
||||||
lea edi, [filestruct.name+eax] ; edi = pointer to the tail of file name
|
lea edi, [filestruct.name+eax] ; edi = pointer to the tail of file name
|
||||||
mov al, '/'
|
mov al, '/'
|
||||||
mov ecx, -1
|
mov ecx, -1
|
||||||
@@ -652,15 +656,15 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
|
|||||||
mov ecx, filestruct.name
|
mov ecx, filestruct.name
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mcall 30, 1, ; set cwd
|
mcall SF_CURRENT_FOLDER, SSF_SET_CF ; set cwd
|
||||||
mcall 30, 2, filestruct.name, 1024 ; get absolute path for cwd
|
mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name, 1024 ; get absolute path for cwd
|
||||||
; clear all nodes in tree list
|
; clear all nodes in tree list
|
||||||
stdcall [tl_info_clear], tree1
|
stdcall [tl_info_clear], tree1
|
||||||
mov [filestruct.offset], 0
|
mov [filestruct.offset], 0
|
||||||
|
|
||||||
; read 32 blocks
|
; read 32 blocks
|
||||||
.outer:
|
.outer:
|
||||||
mcall 70, filestruct
|
mcall SF_FILE, filestruct
|
||||||
;int3
|
;int3
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
|
@@ -27,7 +27,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
|
|||||||
.get_username:
|
.get_username:
|
||||||
; in case of error when either login_gui.server_addr or
|
; in case of error when either login_gui.server_addr or
|
||||||
; login_gui.get_username is called, should resize window
|
; login_gui.get_username is called, should resize window
|
||||||
mcall 67, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
|
mcall SF_CHANGE_WINDOW, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
|
||||||
|
|
||||||
.redraw:
|
.redraw:
|
||||||
call .draw
|
call .draw
|
||||||
@@ -44,22 +44,22 @@ login_gui: ;////////////////////////////////////////////////////////////////////
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
.draw:
|
.draw:
|
||||||
mcall 12, 1
|
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||||
mcall 48, 3, sc, 40
|
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, 40
|
||||||
edit_boxes_set_sys_color edit_usr,editboxes_end,sc
|
edit_boxes_set_sys_color edit_usr,editboxes_end,sc
|
||||||
mov edx, 0x34000000
|
mov edx, 0x34000000
|
||||||
or edx, [sc.work]
|
or edx, [sc.work]
|
||||||
mcall 0, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title
|
mcall SF_CREATE_WINDOW, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title
|
||||||
|
|
||||||
call .draw_editboxes
|
call .draw_editboxes
|
||||||
|
|
||||||
; draw "connect" button
|
; draw "connect" button
|
||||||
mcall 8, <162,65>, <150,25>, 2, [sc.work_button]
|
mcall SF_DEFINE_BUTTON, <162,65>, <150,25>, 2, [sc.work_button]
|
||||||
|
|
||||||
; draw strings
|
; draw strings
|
||||||
mov ecx, 0x90000000
|
mov ecx, 0x90000000
|
||||||
or ecx, [sc.work_text]
|
or ecx, [sc.work_text]
|
||||||
mcall 4, <3, 8>, , gui_str_usr
|
mcall SF_DRAW_TEXT, <3, 8>, , gui_str_usr
|
||||||
mcall , <3,PAD*1+8>, , gui_str_pass
|
mcall , <3,PAD*1+8>, , gui_str_pass
|
||||||
mcall , <3,PAD*2+8>, , gui_str_server
|
mcall , <3,PAD*2+8>, , gui_str_server
|
||||||
mcall , <3,PAD*3+8>, , gui_str_port
|
mcall , <3,PAD*3+8>, , gui_str_port
|
||||||
@@ -74,12 +74,12 @@ login_gui: ;////////////////////////////////////////////////////////////////////
|
|||||||
mcall
|
mcall
|
||||||
mov [str_error_addr], gui_str_null ; reset error string address
|
mov [str_error_addr], gui_str_null ; reset error string address
|
||||||
|
|
||||||
mcall 12, 2
|
mcall SF_REDRAW, SSF_END_DRAW
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.still:
|
.still:
|
||||||
mcall 10 ; wait for event
|
mcall SF_WAIT_EVENT
|
||||||
dec eax
|
dec eax
|
||||||
jz .redraw
|
jz .redraw
|
||||||
dec eax
|
dec eax
|
||||||
@@ -96,7 +96,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
|
|||||||
jmp .still
|
jmp .still
|
||||||
|
|
||||||
.button:
|
.button:
|
||||||
mcall 17
|
mcall SF_GET_BUTTON
|
||||||
|
|
||||||
dec ah
|
dec ah
|
||||||
jz .exit
|
jz .exit
|
||||||
@@ -107,7 +107,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
|
|||||||
jmp .still
|
jmp .still
|
||||||
|
|
||||||
.key:
|
.key:
|
||||||
mcall 2
|
mcall SF_GET_KEY
|
||||||
|
|
||||||
cmp ah,13
|
cmp ah,13
|
||||||
je .connect
|
je .connect
|
||||||
@@ -124,7 +124,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
|
|||||||
jmp .still
|
jmp .still
|
||||||
|
|
||||||
.connect:
|
.connect:
|
||||||
mcall 67, 35, 20, 830, 555 ; resize to main gui window's coordinates
|
mcall SF_CHANGE_WINDOW, 35, 20, 830, 555 ; resize to main gui window's coordinates
|
||||||
cmp [param_server_addr], 0
|
cmp [param_server_addr], 0
|
||||||
jne gui.main
|
jne gui.main
|
||||||
|
|
||||||
|
@@ -190,7 +190,7 @@ data_loop:
|
|||||||
mov [filestruct.ptr], buf_buffer2
|
mov [filestruct.ptr], buf_buffer2
|
||||||
mov [filestruct.size], eax
|
mov [filestruct.size], eax
|
||||||
push eax
|
push eax
|
||||||
mcall 70, filestruct
|
mcall SF_FILE, filestruct
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
call error_fs
|
call error_fs
|
||||||
@@ -204,7 +204,7 @@ data_loop:
|
|||||||
|
|
||||||
; storing, send all data
|
; storing, send all data
|
||||||
.stor:
|
.stor:
|
||||||
mcall 70, filestruct
|
mcall SF_FILE, filestruct
|
||||||
cmp eax, 6 ; end of file
|
cmp eax, 6 ; end of file
|
||||||
je .last_call
|
je .last_call
|
||||||
test eax, eax ; error
|
test eax, eax ; error
|
||||||
@@ -244,7 +244,7 @@ data_loop:
|
|||||||
mov ecx, eax ; eax is size of buffer received
|
mov ecx, eax ; eax is size of buffer received
|
||||||
inc ecx
|
inc ecx
|
||||||
add ecx, [size_fname] ; added old size to form new required size
|
add ecx, [size_fname] ; added old size to form new required size
|
||||||
mcall 68, 20, , [ptr_fname] ; realloc
|
mcall SF_SYS_MISC, SSF_MEM_REALLOC, , [ptr_fname]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je error_heap
|
je error_heap
|
||||||
mov [ptr_fname], eax ; eax contains the new block now
|
mov [ptr_fname], eax ; eax contains the new block now
|
||||||
|
@@ -82,13 +82,13 @@ cmd_retr:
|
|||||||
mov ecx, 256-5
|
mov ecx, 256-5
|
||||||
call set_filename
|
call set_filename
|
||||||
|
|
||||||
mov [filestruct.subfn], 2 ; create/rewrite file
|
mov [filestruct.subfn], SSF_CREATE_FILE ; create/rewrite file
|
||||||
mov [filestruct.offset], 0
|
mov [filestruct.offset], 0
|
||||||
mov [filestruct.offset+4], 0
|
mov [filestruct.offset+4], 0
|
||||||
mov [filestruct.size], 0
|
mov [filestruct.size], 0
|
||||||
mov [filestruct.ptr], 0
|
mov [filestruct.ptr], 0
|
||||||
|
|
||||||
mcall 70, filestruct
|
mcall SF_FILE, filestruct
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
call error_fs
|
call error_fs
|
||||||
@@ -96,7 +96,7 @@ cmd_retr:
|
|||||||
@@:
|
@@:
|
||||||
; Prepare to write to the file
|
; Prepare to write to the file
|
||||||
|
|
||||||
mov [filestruct.subfn], 3 ; write to file
|
mov [filestruct.subfn], SSF_WRITE_FILE
|
||||||
mov [operation], OPERATION_RETR
|
mov [operation], OPERATION_RETR
|
||||||
|
|
||||||
; Request the file from server
|
; Request the file from server
|
||||||
@@ -138,7 +138,7 @@ cmd_stor:
|
|||||||
mov [operation], OPERATION_STOR
|
mov [operation], OPERATION_STOR
|
||||||
|
|
||||||
; get file size
|
; get file size
|
||||||
mov [filestruct.subfn], 5
|
mov [filestruct.subfn], SSF_GET_INFO
|
||||||
mov [filestruct.offset], 0
|
mov [filestruct.offset], 0
|
||||||
mov [filestruct.offset+4], 0
|
mov [filestruct.offset+4], 0
|
||||||
mov [filestruct.size], 0
|
mov [filestruct.size], 0
|
||||||
@@ -148,12 +148,12 @@ cmd_stor:
|
|||||||
mov ecx, 256-5
|
mov ecx, 256-5
|
||||||
call set_filename
|
call set_filename
|
||||||
|
|
||||||
mcall 70, filestruct
|
mcall SF_FILE, filestruct
|
||||||
|
|
||||||
mov eax, dword[folder_buf+32] ; supports file size upto 4GB
|
mov eax, dword[folder_buf+32] ; supports file size upto 4GB
|
||||||
mov [file_size], eax
|
mov [file_size], eax
|
||||||
|
|
||||||
mov [filestruct.subfn], 0 ; read file
|
mov [filestruct.subfn], SSF_READ_FILE
|
||||||
; mov [filestruct.offset], 0
|
; mov [filestruct.offset], 0
|
||||||
; mov [filestruct.offset+4], 0
|
; mov [filestruct.offset+4], 0
|
||||||
mov [filestruct.size], BUFFERSIZE
|
mov [filestruct.size], BUFFERSIZE
|
||||||
@@ -191,12 +191,12 @@ cmd_lcwd:
|
|||||||
mov byte[esi-1], 0
|
mov byte[esi-1], 0
|
||||||
|
|
||||||
; check whether entered path is valid (folder exists)
|
; check whether entered path is valid (folder exists)
|
||||||
mov [filestruct2.subfn], 5
|
mov [filestruct2.subfn], SSF_GET_INFO
|
||||||
mov [filestruct2.offset], 0
|
mov [filestruct2.offset], 0
|
||||||
mov [filestruct2.size], 0
|
mov [filestruct2.size], 0
|
||||||
mov [filestruct2.ptr], folder_buf
|
mov [filestruct2.ptr], folder_buf
|
||||||
mov [filestruct2.name], buf_cmd+5
|
mov [filestruct2.name], buf_cmd+5
|
||||||
mcall 70, filestruct2
|
mcall SF_FILE, filestruct2
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
cmp eax, 2
|
cmp eax, 2
|
||||||
@@ -205,10 +205,10 @@ cmd_lcwd:
|
|||||||
jmp wait_for_usercommand
|
jmp wait_for_usercommand
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mcall 30, 1, buf_cmd+5 ; set working directory
|
mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_cmd+5 ; set working directory
|
||||||
|
|
||||||
.print:
|
.print:
|
||||||
mcall 30, 2, buf_cmd, 256 ; and read it again
|
mcall SF_CURRENT_FOLDER, SSF_GET_CF, buf_cmd, 256 ; and read it again
|
||||||
icall eax, interface_addr, interface.print, str_lcwd, buf_cmd, str_newline
|
icall eax, interface_addr, interface.print, str_lcwd, buf_cmd, str_newline
|
||||||
|
|
||||||
jmp wait_for_usercommand
|
jmp wait_for_usercommand
|
||||||
|
Reference in New Issue
Block a user