Subversion Repositories Kolibri OS

Rev

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

Rev 8676 Rev 8680
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
4
;;  Distributed under terms of the GNU General Public License.  ;;
4
;;  Distributed under terms of the GNU General Public License.  ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 8676 $
8
$Revision: 8680 $
9
 
9
 
10
ERROR_SUCCESS        = 0
10
ERROR_SUCCESS        = 0
11
ERROR_DISK_BASE      = 1
11
ERROR_DISK_BASE      = 1
Line 24... Line 24...
24
maxPathLength = 1000h
24
maxPathLength = 1000h
Line 25... Line 25...
25
 
25
 
26
image_of_eax EQU esp+32
26
image_of_eax EQU esp+32
Line -... Line 27...
-
 
27
image_of_ebx EQU esp+20
-
 
28
 
-
 
29
; System function 70 security check
-
 
30
align 4
-
 
31
proc file_system_is_operation_safe stdcall, inf_struct_ptr: dword
-
 
32
; in:
-
 
33
;      inf_struct_ptr = pointer to information structure was given to sysfn70
-
 
34
; out: ZF = 1 if operation is safe
-
 
35
;      ZF = 0 if operation can cause kernel crash
-
 
36
        push    ebx ecx edx
-
 
37
        xor     ecx, ecx ; ecx - length of target buffer
-
 
38
 
-
 
39
        mov     ebx, [inf_struct_ptr]
-
 
40
        mov     edx, [ebx + 16] ; base of target buffer
-
 
41
 
-
 
42
        cmp     dword [ebx], 0 ; if 70.0
-
 
43
        jnz     .case1
-
 
44
        mov     ecx, dword [ebx + 12]
-
 
45
        jmp     .end_switch
-
 
46
 
-
 
47
.case1:
-
 
48
        cmp     dword [ebx], 1 ; if 70.1
-
 
49
        jnz     .case2_3
-
 
50
        ;mov     ecx, 32
-
 
51
        cmp     dword [ebx + 8], 1 ; check encoding
-
 
52
        jbe     .case1_304 ; if encdoing <= 1 i.e cpp866 
-
 
53
        mov     ecx, 560 ; if unicode then bdvk block len is 560 bytes
-
 
54
        jmp     .case1_end
-
 
55
.case1_304:
-
 
56
        mov     ecx, 304 ; if cp866 then bdvk block len is 304 bytes
-
 
57
.case1_end:
-
 
58
        imul    ecx, dword [ebx + 12] ; multiply bdvk length by their count
-
 
59
        add     ecx, 32 ; add result header len
-
 
60
        jmp     .end_switch
-
 
61
 
-
 
62
.case2_3:
-
 
63
        cmp     dword [ebx], 3
-
 
64
        ja      .case5 ; if subfn > 3
-
 
65
        mov     ecx, dword [ebx + 12]
-
 
66
        jmp     .end_switch
-
 
67
 
-
 
68
.case5:
-
 
69
        cmp     dword [ebx], 5
-
 
70
        jnz     .case6
-
 
71
        mov     ecx, 40
-
 
72
        jmp     .end_switch
-
 
73
 
-
 
74
.case6:
-
 
75
        cmp     dword [ebx], 6
-
 
76
        jnz     .switch_none
-
 
77
        mov     ecx, 32
-
 
78
        jmp     .end_switch
-
 
79
 
-
 
80
.switch_none:
-
 
81
        mov     ecx, 1
-
 
82
        test    ecx, ecx
-
 
83
        jmp     .ret
-
 
84
        
-
 
85
.end_switch:
-
 
86
        ;;
-
 
87
        stdcall is_region_userspace, edx, ecx
-
 
88
.ret:
-
 
89
        pop     edx ecx ebx
-
 
90
        ret
-
 
91
endp
-
 
92
 
-
 
93
syscall_fileSystemUnicode:
-
 
94
; in: ebx -> f.80 parameter structure
-
 
95
        stdcall file_system_is_operation_safe, ebx
-
 
96
        jnz     @f
-
 
97
 
-
 
98
        DEBUGF  1, "sysfn80 addr error\n"
-
 
99
        mov     dword [image_of_eax], ERROR_MEMORY_POINTER
-
 
100
        ret
-
 
101
@@:
-
 
102
        jmp     fileSystemUnicode
-
 
103
 
-
 
104
syscall_file_system_lfn:
-
 
105
; in: ebx -> f.70 parameter structure
-
 
106
        stdcall file_system_is_operation_safe, ebx
-
 
107
        jnz     @f
-
 
108
 
-
 
109
        DEBUGF  1, "sysfn70 addr error\n"
-
 
110
        mov     dword [image_of_eax], ERROR_MEMORY_POINTER
-
 
111
        ret
-
 
112
@@:
-
 
113
        jmp     file_system_lfn
27
image_of_ebx EQU esp+20
114
 
Line 28... Line 115...
28
 
115
 
29
; System function 70
116
; System function 70
30
 
117