Rev 5288 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5266 | eugene455 | 1 | format COFF |
2 | |||
3 | section '.text' code |
||
4 | |||
5 | include '../../../proc32.inc' |
||
6 | public __ksys_get_filesize |
||
7 | public __ksys_readfile |
||
8 | public __ksys_rewritefile |
||
9 | public __ksys_appendtofile |
||
10 | |||
11 | align 4 |
||
5288 | clevermous | 12 | proc __ksys_get_filesize stdcall uses ebx, filename:dword |
5266 | eugene455 | 13 | |
14 | xor eax,eax |
||
15 | mov ebx,[filename] |
||
16 | mov [fileinfo.subproc],dword 5 |
||
17 | mov [fileinfo.offset_l],eax |
||
18 | mov [fileinfo.offset_h],eax |
||
19 | mov [fileinfo.size],eax |
||
20 | mov [fileinfo.data],dword buffer_for_info |
||
21 | mov [fileinfo.letter],al |
||
22 | mov [fileinfo.filename],ebx |
||
23 | |||
24 | mov eax,70 |
||
25 | mov ebx,fileinfo |
||
26 | int 0x40 |
||
27 | |||
28 | test eax,eax |
||
29 | jnz error_for_file_size |
||
30 | |||
31 | mov eax,[buffer_for_info+32] ;file size |
||
32 | |||
33 | error_for_file_size: |
||
34 | |||
35 | ret |
||
36 | endp |
||
37 | |||
38 | |||
39 | align 4 |
||
5288 | clevermous | 40 | proc __ksys_readfile stdcall uses ebx,filename:dword,position:dword,sizeblock:dword,buffer:dword |
5266 | eugene455 | 41 | |
42 | xor eax,eax |
||
43 | mov ebx,[position] |
||
44 | mov ecx,[sizeblock] |
||
45 | mov edx,[buffer] |
||
46 | mov [fileinfo.subproc],eax |
||
47 | mov [fileinfo.offset_l],ebx |
||
48 | mov [fileinfo.offset_h],eax |
||
49 | mov [fileinfo.size],ecx |
||
5295 | clevermous | 50 | mov ecx,[filename] |
5266 | eugene455 | 51 | mov [fileinfo.data],edx |
52 | mov [fileinfo.letter],al |
||
5295 | clevermous | 53 | mov [fileinfo.filename],ecx |
5266 | eugene455 | 54 | |
55 | mov eax,70 |
||
56 | mov ebx,fileinfo |
||
57 | int 0x40 |
||
58 | |||
59 | ret |
||
60 | endp |
||
61 | |||
62 | align 4 |
||
5288 | clevermous | 63 | proc __ksys_rewritefile stdcall uses ebx,filename:dword,sizeblock:dword,data_write:dword |
5266 | eugene455 | 64 | |
65 | xor eax,eax |
||
66 | mov ebx,[sizeblock] |
||
67 | mov ecx,[data_write] |
||
68 | mov edx,[filename] |
||
69 | mov [fileinfo.subproc],dword 2 |
||
70 | mov [fileinfo.offset_l],eax |
||
71 | mov [fileinfo.offset_h],eax |
||
72 | mov [fileinfo.size],ebx |
||
73 | mov [fileinfo.data],ecx |
||
74 | mov [fileinfo.letter],al |
||
75 | mov [fileinfo.filename],edx |
||
76 | |||
77 | mov eax,70 |
||
78 | mov ebx,fileinfo |
||
79 | int 0x40 |
||
80 | |||
81 | ret |
||
82 | endp |
||
83 | |||
84 | align 4 |
||
5288 | clevermous | 85 | proc __ksys_appendtofile stdcall uses ebx,filename:dword,pos:dword,sizeblock:dword,data_append:dword |
5266 | eugene455 | 86 | |
87 | xor eax,eax |
||
88 | mov ebx,[pos] |
||
89 | mov ecx,[sizeblock] |
||
90 | mov edx,[data_append] |
||
91 | mov [fileinfo.subproc],dword 3 |
||
92 | mov [fileinfo.offset_l],ebx |
||
93 | mov [fileinfo.offset_h],eax |
||
94 | mov [fileinfo.size],ecx |
||
5295 | clevermous | 95 | mov ecx,[filename] |
5266 | eugene455 | 96 | mov [fileinfo.data],edx |
97 | mov [fileinfo.letter],al |
||
5295 | clevermous | 98 | mov [fileinfo.filename],ecx |
5266 | eugene455 | 99 | |
100 | mov eax,70 |
||
101 | mov ebx,fileinfo |
||
102 | int 0x40 |
||
103 | |||
104 | ret |
||
105 | endp |
||
106 | |||
107 | struc FILEIO |
||
108 | { |
||
109 | .subproc rd 1 |
||
110 | .offset_l rd 1 |
||
111 | .offset_h rd 1 |
||
112 | .size rd 1 |
||
113 | .data rd 1 |
||
114 | .letter rb 1 |
||
115 | .filename rd 1 |
||
116 | } |
||
117 | |||
118 | fileinfo FILEIO |
||
119 | buffer_for_info rd 11 |