Rev 5493 | Rev 5554 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5487 | leency | 1 | :struct f70{ |
3067 | leency | 2 | dword func; |
3 | dword param1; |
||
4 | dword param2; |
||
5 | dword param3; |
||
6 | dword param4; |
||
7 | char rezerv; |
||
8 | dword name; |
||
9 | }; |
||
10 | |||
5487 | leency | 11 | :struct date |
12 | { |
||
13 | byte day; |
||
14 | byte month; |
||
15 | word year; |
||
16 | }; |
||
17 | |||
18 | :struct BDVK { |
||
19 | dword readonly:1, hidden:1, system:1, volume_label:1, isfolder:1, notarchived:1, :0; |
||
3067 | leency | 20 | byte type_name; |
4898 | leency | 21 | byte rez1, rez2, selected; |
5487 | leency | 22 | dword timecreate; |
23 | date datecreate; |
||
3067 | leency | 24 | dword timelastaccess; |
5487 | leency | 25 | date datelastaccess; |
3067 | leency | 26 | dword timelastedit; |
5487 | leency | 27 | date datelastedit; |
3067 | leency | 28 | dword sizelo; |
29 | dword sizehi; |
||
30 | char name[518]; |
||
31 | }; |
||
32 | |||
33 | |||
5487 | leency | 34 | :void DrawDate(dword x, y, color, dword in_date) |
35 | { |
||
36 | EDI = in_date; |
||
37 | EAX = 47; |
||
38 | EBX = 2<<16; |
||
39 | EDX = x<<16+y; |
||
40 | ESI = 0x80<<24+color; |
||
41 | ECX = EDI.date.day; |
||
42 | $int 0x40; |
||
43 | EDX += 18<<16; |
||
44 | ECX = EDI.date.month; |
||
45 | $int 0x40; |
||
46 | EDX += 18<<16; |
||
47 | EBX = 4<<16; |
||
48 | ECX = EDI.date.year; |
||
49 | $int 0x40; |
||
50 | } |
||
51 | |||
52 | |||
3067 | leency | 53 | /////////////////////////// |
3440 | leency | 54 | // Параметры файла // |
55 | /////////////////////////// |
||
5472 | leency | 56 | :f70 getinfo_file_70; |
3440 | leency | 57 | :dword GetFileInfo(dword file_path, bdvk_struct) |
58 | { |
||
59 | getinfo_file_70.func = 5; |
||
60 | getinfo_file_70.param1 = |
||
61 | getinfo_file_70.param2 = |
||
62 | getinfo_file_70.param3 = 0; |
||
63 | getinfo_file_70.param4 = bdvk_struct; |
||
64 | getinfo_file_70.rezerv = 0; |
||
65 | getinfo_file_70.name = file_path; |
||
66 | $mov eax,70 |
||
67 | $mov ebx,#getinfo_file_70.func |
||
3444 | leency | 68 | $int 0x40 |
3440 | leency | 69 | } |
70 | |||
71 | /////////////////////////// |
||
3067 | leency | 72 | // Запуск программы // |
73 | /////////////////////////// |
||
5472 | leency | 74 | :f70 run_file_70; |
75 | :signed int RunProgram(dword run_path, run_param) |
||
3067 | leency | 76 | { |
77 | run_file_70.func = 7; |
||
78 | run_file_70.param1 = |
||
79 | run_file_70.param3 = |
||
80 | run_file_70.param4 = |
||
81 | run_file_70.rezerv = 0; |
||
82 | run_file_70.param2 = run_param; |
||
83 | run_file_70.name = run_path; |
||
84 | $mov eax,70 |
||
85 | $mov ebx,#run_file_70.func |
||
86 | $int 0x40 |
||
87 | } |
||
88 | |||
89 | /////////////////////////// |
||
90 | // Создание папки // |
||
91 | /////////////////////////// |
||
5472 | leency | 92 | :f70 create_dir_70; |
3067 | leency | 93 | :int CreateDir(dword new_folder_path) |
94 | { |
||
95 | create_dir_70.func = 9; |
||
96 | create_dir_70.param1 = |
||
97 | create_dir_70.param2 = |
||
98 | create_dir_70.param3 = |
||
99 | create_dir_70.param4 = |
||
100 | create_dir_70.rezerv = 0; |
||
101 | create_dir_70.name = new_folder_path; |
||
102 | $mov eax,70 |
||
103 | $mov ebx,#create_dir_70.func |
||
104 | $int 0x40 |
||
105 | } |
||
106 | |||
107 | //////////////////////////// |
||
108 | // Удаление файла/папки // |
||
109 | //////////////////////////// |
||
5472 | leency | 110 | :f70 del_file_70; |
3067 | leency | 111 | :int DeleteFile(dword del_file_path) |
112 | { |
||
113 | del_file_70.func = 8; |
||
114 | del_file_70.param1 = |
||
115 | del_file_70.param2 = |
||
116 | del_file_70.param3 = |
||
117 | del_file_70.param4 = |
||
118 | del_file_70.rezerv = 0; |
||
119 | del_file_70.name = del_file_path; |
||
120 | $mov eax,70 |
||
121 | $mov ebx,#del_file_70.func |
||
122 | $int 0x40 |
||
123 | } |
||
124 | |||
125 | //////////////////////////// |
||
126 | // Прочитать файл // |
||
127 | //////////////////////////// |
||
5472 | leency | 128 | :f70 read_file_70; |
3067 | leency | 129 | :int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path) |
130 | { |
||
131 | read_file_70.func = 0; |
||
132 | read_file_70.param1 = read_pos; |
||
133 | read_file_70.param2 = 0; |
||
134 | read_file_70.param3 = read_file_size; |
||
135 | read_file_70.param4 = read_buffer; |
||
136 | read_file_70.rezerv = 0; |
||
137 | read_file_70.name = read_file_path; |
||
138 | $mov eax,70 |
||
139 | $mov ebx,#read_file_70.func |
||
140 | $int 0x40 |
||
141 | } |
||
142 | |||
143 | //////////////////////////// |
||
144 | // Записать файл // |
||
145 | //////////////////////////// |
||
5472 | leency | 146 | :f70 write_file_70; |
3067 | leency | 147 | :int WriteFile(dword write_file_size, write_buffer, write_file_path) |
148 | { |
||
149 | write_file_70.func = 2; |
||
150 | write_file_70.param1 = 0; |
||
151 | write_file_70.param2 = 0; |
||
152 | write_file_70.param3 = write_file_size; |
||
153 | write_file_70.param4 = write_buffer; |
||
154 | write_file_70.rezerv = 0; |
||
155 | write_file_70.name = write_file_path; |
||
156 | $mov eax,70 |
||
157 | $mov ebx,#write_file_70.func |
||
158 | $int 0x40 |
||
5542 | leency | 159 | } |
3067 | leency | 160 | |
5542 | leency | 161 | ////////////////////////////////////////// |
162 | // WriteInFileThatAlredyExists // |
||
163 | ////////////////////////////////////////// |
||
164 | :f70 write_file_offset_70; |
||
165 | :int WriteFileWithOffset(dword write_data_size, write_buffer, write_file_path, offset) |
||
166 | { |
||
167 | write_file_offset_70.func = 3; |
||
168 | write_file_offset_70.param1 = offset; |
||
169 | write_file_offset_70.param2 = 0; |
||
170 | write_file_offset_70.param3 = write_data_size; |
||
171 | write_file_offset_70.param4 = write_buffer; |
||
172 | write_file_offset_70.rezerv = 0; |
||
173 | write_file_offset_70.name = write_file_path; |
||
174 | $mov eax,70 |
||
175 | $mov ebx,#write_file_offset_70.func |
||
176 | $int 0x40 |
||
177 | } |
||
178 | |||
3067 | leency | 179 | /////////////////////////// |
180 | // Прочитать папку // |
||
181 | /////////////////////////// |
||
5472 | leency | 182 | :f70 read_dir_70; |
3067 | leency | 183 | :int ReadDir(dword file_count, read_buffer, dir_path) |
3363 | leency | 184 | { |
3067 | leency | 185 | read_dir_70.func = 1; |
186 | read_dir_70.param1 = |
||
187 | read_dir_70.param2 = |
||
188 | read_dir_70.rezerv = 0; |
||
189 | read_dir_70.param3 = file_count; |
||
190 | read_dir_70.param4 = read_buffer; |
||
191 | read_dir_70.name = dir_path; |
||
192 | $mov eax,70 |
||
193 | $mov ebx,#read_dir_70.func |
||
194 | $int 0x40 |
||
195 | } |
||
196 | |||
5472 | leency | 197 | :char isdir(dword fpath) |
3440 | leency | 198 | { |
199 | BDVK fpath_atr; |
||
200 | GetFileInfo(fpath, #fpath_atr); |
||
5487 | leency | 201 | return fpath_atr.isfolder; |
3440 | leency | 202 | } |
3877 | leency | 203 | |
3440 | leency | 204 | :int GetFile(dword buf, filesize, read_path) |
205 | { |
||
206 | BDVK ReadFile_atr; |
||
207 | dword rBuf; |
||
208 | if (! GetFileInfo(read_path, #ReadFile_atr)) |
||
209 | { |
||
210 | rBuf = malloc(ReadFile_atr.sizelo); |
||
211 | if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path)) |
||
212 | { |
||
213 | ESDWORD[buf] = rBuf; |
||
214 | ESDWORD[filesize] = ReadFile_atr.sizelo; |
||
215 | return 1; |
||
216 | } |
||
217 | } |
||
218 | free(rBuf); |
||
219 | return 0; |
||
220 | } |
||
3067 | leency | 221 | |
3444 | leency | 222 | enum |
3363 | leency | 223 | { |
3444 | leency | 224 | DIRS_ALL, |
225 | DIRS_NOROOT, |
||
226 | DIRS_ONLYREAL |
||
227 | }; |
||
228 | :int GetDir(dword dir_buf, file_count, path, doptions) |
||
229 | { |
||
3363 | leency | 230 | dword buf, fcount, error; |
231 | buf = malloc(32); |
||
232 | error = ReadDir(0, buf, path); |
||
233 | if (!error) |
||
234 | { |
||
235 | fcount = ESDWORD[buf+8]; |
||
236 | buf = realloc(buf, fcount+1*304+32); |
||
237 | ReadDir(fcount, buf, path); |
||
3440 | leency | 238 | //fcount=EBX; |
3444 | leency | 239 | |
240 | if (doptions == DIRS_ONLYREAL) |
||
241 | { |
||
242 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
||