Rev 8680 | Rev 8914 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8680 | Rev 8912 | ||
---|---|---|---|
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: 8680 $ |
8 | $Revision: 8912 $ |
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 27... | Line 27... | ||
27 | image_of_ebx EQU esp+20 |
27 | image_of_ebx EQU esp+20 |
28 | 28 | ||
29 | ; System function 70 security check |
29 | ; ; System function 70 security check |
30 | align 4 |
30 | ; align 4 |
31 | proc file_system_is_operation_safe stdcall, inf_struct_ptr: dword |
31 | ; proc file_system_is_operation_safe stdcall, inf_struct_ptr: dword |
32 | ; in: |
32 | ; ; in: |
33 | ; inf_struct_ptr = pointer to information structure was given to sysfn70 |
33 | ; ; inf_struct_ptr = pointer to information structure was given to sysfn70 |
34 | ; out: ZF = 1 if operation is safe |
34 | ; ; out: ZF = 1 if operation is safe |
35 | ; ZF = 0 if operation can cause kernel crash |
35 | ; ; ZF = 0 if operation can cause kernel crash |
36 | push ebx ecx edx |
36 | ; push ebx ecx edx |
37 | xor ecx, ecx ; ecx - length of target buffer |
37 | ; xor ecx, ecx ; ecx - length of target buffer |
38 | 38 | ||
39 | mov ebx, [inf_struct_ptr] |
39 | ; mov ebx, [inf_struct_ptr] |
40 | mov edx, [ebx + 16] ; base of target buffer |
40 | ; mov edx, [ebx + 16] ; base of target buffer |
41 | 41 | ||
42 | cmp dword [ebx], 0 ; if 70.0 |
42 | ; cmp dword [ebx], 0 ; if 70.0 |
43 | jnz .case1 |
43 | ; jnz .case1 |
44 | mov ecx, dword [ebx + 12] |
44 | ; mov ecx, dword [ebx + 12] |
45 | jmp .end_switch |
45 | ; jmp .end_switch |
46 | 46 | ||
47 | .case1: |
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: |
|
48 | cmp dword [ebx], 1 ; if 70.1 |
75 | ; cmp dword [ebx], 6 |
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 |
76 | ; jnz .switch_none |
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 |
77 | ; mov ecx, 32 |
78 | jmp .end_switch |
78 | ; jmp .end_switch |
79 | 79 | ||
80 | .switch_none: |
80 | ; .switch_none: |
81 | mov ecx, 1 |
81 | ; mov ecx, 1 |
82 | test ecx, ecx |
82 | ; test ecx, ecx |
83 | jmp .ret |
83 | ; jmp .ret |
84 | 84 | ||
85 | .end_switch: |
85 | ; .end_switch: |
86 | ;; |
86 | ; ;; |
87 | stdcall is_region_userspace, edx, ecx |
87 | ; stdcall is_region_userspace, edx, ecx |
88 | .ret: |
88 | ; .ret: |
89 | pop edx ecx ebx |
89 | ; pop edx ecx ebx |
Line 90... | Line 90... | ||
90 | ret |
90 | ; ret |
91 | endp |
91 | ; endp |
92 | 92 | ||
93 | syscall_fileSystemUnicode: |
93 | syscall_fileSystemUnicode: |
Line 99... | Line 99... | ||
99 | mov dword [image_of_eax], ERROR_MEMORY_POINTER |
99 | mov dword [image_of_eax], ERROR_MEMORY_POINTER |
100 | ret |
100 | ret |
101 | @@: |
101 | @@: |
102 | jmp fileSystemUnicode |
102 | jmp fileSystemUnicode |
Line -... | Line 103... | ||
- | 103 | ||
- | 104 | ; temporarily commented out cause acpi driver (drivers/devman) uses sysfn70 via 0x40 |
|
- | 105 | ; so because drivers it kernel space, pointer checking fails |
|
- | 106 | ; TODO solution: add filesystem functions without pointer checking to kernel exports |
|
103 | 107 | ; and make the driver use them, not int 0x40 |
|
104 | syscall_file_system_lfn: |
108 | ; syscall_file_system_lfn: ; with user pointer correctness checking |
105 | ; in: ebx -> f.70 parameter structure |
109 | ; ; in: ebx -> f.70 parameter structure |
106 | stdcall file_system_is_operation_safe, ebx |
110 | ; stdcall file_system_is_operation_safe, ebx |
107 | jnz @f |
111 | ; jnz @f |
108 | 112 | ||
109 | DEBUGF 1, "sysfn70 addr error\n" |
113 | ; DEBUGF 1, "sysfn70 addr error\n" |
110 | mov dword [image_of_eax], ERROR_MEMORY_POINTER |
114 | ; mov dword [image_of_eax], ERROR_MEMORY_POINTER |
111 | ret |
115 | ; ret |
112 | @@: |
116 | ; @@: |
Line 113... | Line 117... | ||
113 | jmp file_system_lfn |
117 | ; jmp file_system_lfn |
Line 114... | Line 118... | ||
114 | 118 |