Subversion Repositories Kolibri OS

Rev

Rev 1323 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1323 Rev 1325
Line 15... Line 15...
15
    db      'MENUET01'              ; 8 byte id
15
    db      'MENUET01'              ; 8 byte id
16
    dd      1                       ; header version
16
    dd      1                       ; header version
17
    dd      START                   ; program start
17
    dd      START                   ; program start
18
    dd      I_END                   ; program image size
18
    dd      I_END                   ; program image size
19
    dd      0x170000                ; required amount of memory
19
    dd      0x170000                ; required amount of memory
20
    dd      0x7FFF0                 ; esp = 0x7FFF0
20
    dd      0x16FFF0                ; esp = 0x16FFF0
21
    dd      0, 0                    ; no params, no path
21
    dd      0, 0                    ; no params, no path
Line 22... Line 22...
22
 
22
 
23
include 'macros.inc'
23
include 'macros.inc'
24
; Various states of client connection
24
; Various states of client connection
Line 1041... Line 1041...
1041
    je      sfp001
1041
    je      sfp001
1042
    cmp     [esi], byte '/'
1042
    cmp     [esi], byte '/'
1043
    je      sfp001
1043
    je      sfp001
Line 1044... Line 1044...
1044
 
1044
 
1045
    ; esi points to start of filename.
1045
    ; esi points to start of filename.
-
 
1046
    cld
Line 1046... Line 1047...
1046
 
1047
    push    esi
1047
 
1048
 
-
 
1049
    ; Copy across the directory path '/'
1048
    ; Copy across the directory path '/'
1050
    ; into the fileinfoblock
-
 
1051
    mov     esi, dirpath
-
 
1052
    mov     edi, filename
1049
    ; into the fileinfoblock
1053
sfp003:
-
 
1054
    movsb
1050
    mov     edi, filename
1055
    cmp     [esi], byte 0
-
 
1056
    jne     sfp003
1051
    mov     dword [edi], '/RD/'
1057
    mov     al, '/'
Line 1052... Line 1058...
1052
    mov     word [edi+4], '1/'
1058
    stosb
1053
    add     edi, 6
1059
    pop     esi
1054
 
-
 
1055
    ; Copy across the filename
1060
 
1056
sfp002:
1061
    ; Copy across the filename
1057
    cld
1062
sfp002:
1058
    movsb
1063
    movsb
1059
    cmp     [esi], byte 0x0d
1064
    cmp     [esi], byte 0x0d
Line 1159... Line 1164...
1159
    mcall
1164
    mcall
1160
    test    eax, eax
1165
    test    eax, eax
1161
    je      gf_sleep
1166
    je      gf_sleep
Line 1162... Line 1167...
1162
 
1167
 
1163
    mov     eax, 53
1168
    mov     eax, 53
1164
    mov     ebx, 11                 ; Get a bytes from socket
1169
    mov     ebx, 11                 ; Get bytes from socket
1165
    mov     ecx, [DataSocket]
1170
    mov     ecx, [DataSocket]
1166
    mov     edx, text + 0x1300
1171
    mov     edx, text + 0x1300
1167
    add     edx, dword [fsize]
1172
    add     edx, dword [fsize]
1168
    xor     esi, esi
1173
    xor     esi, esi
Line 1207... Line 1212...
1207
;   These handlers implement the functionality of each supported FTP Command
1212
;   These handlers implement the functionality of each supported FTP Command
1208
;
1213
;
1209
;***************************************************************************
1214
;***************************************************************************
Line 1210... Line 1215...
1210
 
1215
 
-
 
1216
cmdPWD:
-
 
1217
    cld
-
 
1218
    mov     edi, text+0x1300
-
 
1219
 
-
 
1220
    mov     esi, curdir_1
-
 
1221
    mov     ecx, curdir_2-curdir_1
-
 
1222
    rep     movsb
-
 
1223
 
-
 
1224
    mov     esi, [curdirptr]
-
 
1225
    cmp     [esi], byte 0
-
 
1226
    jne     cpwd_000
-
 
1227
    mov     al, '/'
-
 
1228
    stosb
-
 
1229
    jmp     cpwd_001
-
 
1230
 
-
 
1231
cpwd_000:
-
 
1232
    movsb
-
 
1233
    cmp     [esi], byte 0
-
 
1234
    jne     cpwd_000
-
 
1235
 
-
 
1236
cpwd_001:
-
 
1237
    mov     esi, curdir_2
-
 
1238
    mov     ecx, curdir_end-curdir_2
-
 
1239
    rep     movsb
1211
cmdPWD:
1240
 
-
 
1241
    ; OK, show the directory name text
1212
    ; OK, show the directory name text
1242
    mov     esi, text+0x1300
1213
    mov     esi, ramdir
1243
    mov     edx, edi
1214
    mov     edx, ramdir_end - ramdir
1244
    sub     edx, esi
Line 1215... Line -...
1215
    call    outputStr
-
 
1216
 
-
 
1217
    ; TODO give real directory
1245
    call    outputStr
Line 1218... Line 1246...
1218
 
1246
 
-
 
1247
    ret
-
 
1248
 
-
 
1249
 
-
 
1250
cmdCWD:
-
 
1251
    lea     esi, [buff+4]
-
 
1252
    mov     edi, [curdirptr]
1219
    ret
1253
    mov     ecx, -1
-
 
1254
    xor     eax, eax
-
 
1255
    repne   scasb
-
 
1256
    dec     edi
-
 
1257
    cmp     [esi], word '..'
-
 
1258
    je      ccwd_002
-
 
1259
    test    [esi], byte 0xE0
-
 
1260
    je      ccwd_000
-
 
1261
    push    edi
1220
 
1262
    mov     al, '/'
-
 
1263
    stosb
-
 
1264
@@:
-
 
1265
    movsb
-
 
1266
    cmp     [esi], byte 0xD
-
 
1267
    jne     @b
-
 
1268
    xor     al, al
-
 
1269
    stosb
-
 
1270
 
-
 
1271
    mov     eax, 70
-
 
1272
    mov     ebx, dirinfoblock
-
 
1273
    and     dword [ebx+4], 0
-
 
1274
    mcall
-
 
1275
    pop     edi
-
 
1276
    test    eax, eax
-
 
1277
    je      @f
-
 
1278
    cmp     eax, 6
-
 
1279
    jne     ccwd_000
-
 
1280
@@:
-
 
1281
    test    ebx, ebx
-
 
1282
    je      ccwd_000
-
 
1283
    mov     esi, text + 0x1300 + 0x20
1221
 
1284
 
Line -... Line 1285...
-
 
1285
    mov     al, byte [esi]
1222
cmdCWD:
1286
    and     al, 0x18
1223
    ; Only / is valid for the ramdisk
1287
    cmp     al, 0x10
1224
    cmp     [buff+5], byte 0x0d
1288
    jne     ccwd_000
1225
    jne     ccwd_000
1289
 
Line -... Line 1290...
-
 
1290
ccwd_ok:
-
 
1291
    ; OK, show the directory name text
-
 
1292
    mov     esi, chdir
-
 
1293
    mov     edx, chdir_end - chdir
-
 
1294
    jmp     ccwd_001
-
 
1295
 
-
 
1296
ccwd_002:
-
 
1297
    dec     edi
-
 
1298
    cmp     byte [edi], '/'
-
 
1299
    je      ccwd_003
-
 
1300
    cmp     edi, [curdirptr]
1226
 
1301
    ja      ccwd_002
-
 
1302
    jmp     ccwd_ok
1227
    ; OK, show the directory name text
1303
ccwd_003:
1228
    mov     esi, chdir
1304
    mov    byte [edi], 0
1229
    mov     edx, chdir_end - chdir
1305
    jmp     ccwd_ok
Line 1230... Line 1306...
1230
    jmp     ccwd_001
1306
 
Line 1574... Line 1650...
1574
byeStr_end:
1650
byeStr_end:
Line 1575... Line 1651...
1575
 
1651
 
1576
systStr:            db  '215 UNIX system type',0x0d,0x0a
1652
systStr:            db  '215 UNIX system type',0x0d,0x0a
Line -... Line 1653...
-
 
1653
systStr_end:
1577
systStr_end:
1654
 
1578
 
1655
curdir_1:           db  '257 "'
Line 1579... Line 1656...
1579
ramdir:             db  '257 "/"',0x0d,0x0a
1656
curdir_2:           db  '"',0x0d,0x0a
1580
ramdir_end:
1657
curdir_end:
Line 1581... Line 1658...
1581
 
1658
 
1582
chdir:              db  '200 directory changed to /',0x0d,0x0a
1659
chdir:              db  '250 CWD command successful',0x0d,0x0a
Line 1628... Line 1705...
1628
                    dd      0x00
1705
                    dd      0x00
1629
                    dd      0x00
1706
                    dd      0x00
1630
                    dd      DirBlocksPerCall
1707
                    dd      DirBlocksPerCall
1631
                    dd      text + 0x1300   ; data area
1708
                    dd      text + 0x1300   ; data area
1632
; The 'filename' for a directory listing
1709
; The 'filename' for a directory listing
1633
dirpath             db      '/sys',0
1710
dirpath:            db      '/sys'
-
 
1711
                    times 252 db 0
-
 
1712
curdirptr:          dd      dirpath+4
Line 1634... Line 1713...
1634
 
1713
 
Line 1635... Line 1714...
1635
fsize:              dd      0
1714
fsize:              dd      0
1636
 
1715