Subversion Repositories Kolibri OS

Rev

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

Rev 86 Rev 88
Line 2206... Line 2206...
2206
 
2206
 
2207
  not_2dot:
2207
  not_2dot:
Line 2208... Line -...
2208
    ret
-
 
2209
 
-
 
2210
 
-
 
2211
get_filesize:
-
 
2212
;-----------------------------------------------------------
-
 
2213
; input  : eax = file name
-
 
2214
;          edx = path
-
 
2215
;          edi = if 0 - read rootdir else normal dir/file size
-
 
2216
; output : eax = 0 - ok
-
 
2217
;                3 - unknown FS
-
 
2218
;                5 - file not found
-
 
2219
;               10 - access denied
-
 
2220
;          ebx = file size
-
 
2221
;-----------------------------------------------------------
-
 
2222
    cmp   [fat_type],0
-
 
2223
    jnz   get_filesize_fat_ok
-
 
2224
    xor   ebx,ebx
-
 
2225
    mov   eax,ERROR_UNKNOWN_FS
-
 
2226
    ret
-
 
2227
 
-
 
2228
  get_filesize_fat_ok:
-
 
2229
;    call  reserve_hd1
-
 
2230
 
-
 
2231
    pushad
-
 
2232
    xor   eax,eax
-
 
2233
    test  edi,edi               ; is read rootdir?
-
 
2234
    je    get_filesize_dirsize  ; yes
-
 
2235
 
-
 
2236
  get_filesize_no_root:
-
 
2237
    mov   ebx,edx
-
 
2238
    call  get_cluster_of_a_path
-
 
2239
    jc    get_filesize_not_found
-
 
2240
 
-
 
2241
    mov   ebx,PUSHAD_EAX        ; file name
-
 
2242
    call  analyze_directory
-
 
2243
    jc    get_filesize_not_found
-
 
2244
 
-
 
2245
    mov   eax,[ebx+28]          ; file size
-
 
2246
    test  byte [ebx+11],0x10    ; is it directory?
-
 
2247
    jz    get_filesize_set_size ; no
-
 
2248
 
-
 
2249
    mov   eax,[ebx+20-2]        ; FAT entry
-
 
2250
    mov   ax,[ebx+26]
-
 
2251
    and   eax,[fatMASK]
-
 
2252
 
-
 
2253
  get_filesize_dirsize:
-
 
2254
    call  get_dir_size
-
 
2255
    cmp   [hd_error],0
-
 
2256
    jne   get_filesize_access_denied
-
 
2257
 
-
 
2258
  get_filesize_set_size:
-
 
2259
    mov   PUSHAD_EBX,eax
-
 
2260
    popad
-
 
2261
    mov   [hd1_status],0
-
 
2262
    xor   eax,eax
-
 
2263
    ret
-
 
2264
 
-
 
2265
  get_filesize_not_found:
-
 
2266
    cmp   [hd_error],0
-
 
2267
    jne   get_filesize_access_denied
-
 
2268
    popad
-
 
2269
    mov   [hd1_status],0
-
 
2270
    xor   ebx,ebx
-
 
2271
    mov   eax,ERROR_FILE_NOT_FOUND
-
 
2272
    ret
-
 
2273
 
-
 
2274
  get_filesize_access_denied:
-
 
2275
    popad
-
 
2276
    mov   [hd1_status],0
-
 
2277
    xor   ebx,ebx
-
 
2278
    mov   eax,ERROR_ACCESS_DENIED
-
 
2279
    ret
-
 
2280
 
-
 
2281
get_fileattr:
-
 
2282
;-----------------------------------------------------------
-
 
2283
; input  : eax = file name
-
 
2284
;          edx = path
-
 
2285
; output : eax = 0 - ok
-
 
2286
;                3 - unknown FS
-
 
2287
;                5 - file not found
-
 
2288
;               10 - access denied
-
 
2289
;          ebx = file attribute
-
 
2290
;-----------------------------------------------------------
-
 
2291
    cmp   [fat_type],0
-
 
2292
    jnz   get_fileattr_fat_ok
-
 
2293
    xor   ebx,ebx
-
 
2294
    mov   eax,ERROR_UNKNOWN_FS
-
 
2295
    ret
-
 
2296
 
-
 
2297
  get_fileattr_fat_ok:
-
 
2298
;    call  reserve_hd1
-
 
2299
 
-
 
2300
    pushad
-
 
2301
    mov   ebx,edx
-
 
2302
    call  get_cluster_of_a_path
-
 
2303
    jc    get_fileattr_not_found
-
 
2304
 
-
 
2305
    mov   ebx,PUSHAD_EAX        ; file name
-
 
2306
    call  analyze_directory
-
 
2307
    jc    get_fileattr_not_found
-
 
2308
 
-
 
2309
    movzx eax,byte [ebx+11]     ; file attribute
-
 
2310
    mov   PUSHAD_EBX,eax
-
 
2311
    popad
-
 
2312
    mov   [hd1_status],0
-
 
2313
    xor   eax,eax
-
 
2314
    ret
-
 
2315
 
-
 
2316
  get_fileattr_not_found:
-
 
2317
    cmp   [hd_error],0
-
 
2318
    jne   get_fileattr_access_denied
-
 
2319
    popad
-
 
2320
    mov   [hd1_status],0
-
 
2321
    xor   ebx,ebx
-
 
2322
    mov   eax,ERROR_FILE_NOT_FOUND
-
 
2323
    ret
-
 
2324
 
-
 
2325
  get_fileattr_access_denied:
-
 
2326
    popad
-
 
2327
    mov   [hd1_status],0
-
 
2328
    xor   ebx,ebx
-
 
2329
    mov   eax,ERROR_ACCESS_DENIED
-
 
2330
    ret
-
 
2331
 
-
 
2332
get_filedate:
-
 
2333
;-----------------------------------------------------------
-
 
2334
; input  : eax = file name
-
 
2335
;          edx = path
-
 
2336
; output : eax = 0 - ok
-
 
2337
;                3 - unknown FS
-
 
2338
;                5 - file not found
-
 
2339
;               10 - access denied
-
 
2340
;          ebx = file date/time
-
 
2341
;                bits 31..25 = year-1980
-
 
2342
;                bits 24..21 = month
-
 
2343
;                bits 20..16 = day
-
 
2344
;                bits 15..11 = hour
-
 
2345
;                bits 10..5  = minute
-
 
2346
;                bits 4..0   = second/2
-
 
2347
;-----------------------------------------------------------
-
 
2348
    cmp   [fat_type],0
-
 
2349
    jnz   get_filedate_fat_ok
-
 
2350
    xor   ebx,ebx
-
 
2351
    mov   eax,ERROR_UNKNOWN_FS
-
 
2352
    ret
-
 
2353
 
-
 
2354
  get_filedate_fat_ok:
-
 
2355
;    call  reserve_hd1
-
 
2356
 
-
 
2357
    pushad
-
 
2358
    mov   ebx,edx
-
 
2359
    call  get_cluster_of_a_path
-
 
2360
    jc    get_filedate_not_found
-
 
2361
 
-
 
2362
    mov   ebx,PUSHAD_EAX        ; file name
-
 
2363
    call  analyze_directory
-
 
2364
    jc    get_filedate_not_found
-
 
2365
 
-
 
2366
    mov   eax,[ebx+22]          ; file date/time
-
 
2367
    mov   PUSHAD_EBX,eax
-
 
2368
    popad
-
 
2369
    mov   [hd1_status],0
-
 
2370
    xor   eax,eax
-
 
2371
    ret
-
 
2372
 
-
 
2373
  get_filedate_not_found:
-
 
2374
    cmp   [hd_error],0
-
 
2375
    jne   get_filedate_access_denied
-
 
2376
    popad
-
 
2377
    mov   [hd1_status],0
-
 
2378
    xor   ebx,ebx
-
 
2379
    mov   eax,ERROR_FILE_NOT_FOUND
-
 
2380
    ret
-
 
2381
 
-
 
2382
  get_filedate_access_denied:
-
 
2383
    popad
-
 
2384
    mov   [hd1_status],0
-
 
2385
    xor   ebx,ebx
-
 
2386
    mov   eax,ERROR_ACCESS_DENIED
2208
    ret
2387
    ret
2209
 
2388
 
2210
 
2389
get_hd_info:
2211
get_hd_info:
2390
;-----------------------------------------------------------
2212
;-----------------------------------------------------------
Line 2951... Line 2773...
2951
        cmp     byte [esi], 0
2773
        cmp     byte [esi], 0
2952
        jz      .found
2774
        jz      .found
2953
        test    byte [edi+11], 10h
2775
        test    byte [edi+11], 10h
2954
        jz      .notfound
2776
        jz      .notfound
2955
        and     dword [esp+12], 0
2777
        and     dword [esp+12], 0
-
 
2778
        mov     eax, [edi+20-2]
2956
        movzx   eax, word [edi+26]      ; cluster
2779
        mov     ax, [edi+26]    ; cluster
2957
.fat32:
2780
.fat32:
2958
        mov     [esp+8], eax
2781
        mov     [esp+8], eax
2959
        mov     dword [esp+4], fat_notroot_first
2782
        mov     dword [esp+4], fat_notroot_first
2960
        mov     dword [esp], fat_notroot_next
2783
        mov     dword [esp], fat_notroot_next
2961
        jmp     .loop
2784
        jmp     .loop