Rev 5493 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5493 | Rev 5542 | ||
---|---|---|---|
1 | :struct f70{ |
1 | :struct f70{ |
2 | dword func; |
2 | dword func; |
3 | dword param1; |
3 | dword param1; |
4 | dword param2; |
4 | dword param2; |
5 | dword param3; |
5 | dword param3; |
6 | dword param4; |
6 | dword param4; |
7 | char rezerv; |
7 | char rezerv; |
8 | dword name; |
8 | dword name; |
9 | }; |
9 | }; |
10 | 10 | ||
11 | :struct date |
11 | :struct date |
12 | { |
12 | { |
13 | byte day; |
13 | byte day; |
14 | byte month; |
14 | byte month; |
15 | word year; |
15 | word year; |
16 | }; |
16 | }; |
17 | 17 | ||
18 | :struct BDVK { |
18 | :struct BDVK { |
19 | dword readonly:1, hidden:1, system:1, volume_label:1, isfolder:1, notarchived:1, :0; |
19 | dword readonly:1, hidden:1, system:1, volume_label:1, isfolder:1, notarchived:1, :0; |
20 | byte type_name; |
20 | byte type_name; |
21 | byte rez1, rez2, selected; |
21 | byte rez1, rez2, selected; |
22 | dword timecreate; |
22 | dword timecreate; |
23 | date datecreate; |
23 | date datecreate; |
24 | dword timelastaccess; |
24 | dword timelastaccess; |
25 | date datelastaccess; |
25 | date datelastaccess; |
26 | dword timelastedit; |
26 | dword timelastedit; |
27 | date datelastedit; |
27 | date datelastedit; |
28 | dword sizelo; |
28 | dword sizelo; |
29 | dword sizehi; |
29 | dword sizehi; |
30 | char name[518]; |
30 | char name[518]; |
31 | }; |
31 | }; |
32 | 32 | ||
33 | 33 | ||
34 | :void DrawDate(dword x, y, color, dword in_date) |
34 | :void DrawDate(dword x, y, color, dword in_date) |
35 | { |
35 | { |
36 | EDI = in_date; |
36 | EDI = in_date; |
37 | EAX = 47; |
37 | EAX = 47; |
38 | EBX = 2<<16; |
38 | EBX = 2<<16; |
39 | EDX = x<<16+y; |
39 | EDX = x<<16+y; |
40 | ESI = 0x80<<24+color; |
40 | ESI = 0x80<<24+color; |
41 | ECX = EDI.date.day; |
41 | ECX = EDI.date.day; |
42 | $int 0x40; |
42 | $int 0x40; |
43 | EDX += 18<<16; |
43 | EDX += 18<<16; |
44 | ECX = EDI.date.month; |
44 | ECX = EDI.date.month; |
45 | $int 0x40; |
45 | $int 0x40; |
46 | EDX += 18<<16; |
46 | EDX += 18<<16; |
47 | EBX = 4<<16; |
47 | EBX = 4<<16; |
48 | ECX = EDI.date.year; |
48 | ECX = EDI.date.year; |
49 | $int 0x40; |
49 | $int 0x40; |
50 | } |
50 | } |
51 | 51 | ||
52 | 52 | ||
53 | /////////////////////////// |
53 | /////////////////////////// |
54 | // Ïàðàìåòðû ôàéëà // |
54 | // Ïàðàìåòðû ôàéëà // |
55 | /////////////////////////// |
55 | /////////////////////////// |
56 | :f70 getinfo_file_70; |
56 | :f70 getinfo_file_70; |
57 | :dword GetFileInfo(dword file_path, bdvk_struct) |
57 | :dword GetFileInfo(dword file_path, bdvk_struct) |
58 | { |
58 | { |
59 | getinfo_file_70.func = 5; |
59 | getinfo_file_70.func = 5; |
60 | getinfo_file_70.param1 = |
60 | getinfo_file_70.param1 = |
61 | getinfo_file_70.param2 = |
61 | getinfo_file_70.param2 = |
62 | getinfo_file_70.param3 = 0; |
62 | getinfo_file_70.param3 = 0; |
63 | getinfo_file_70.param4 = bdvk_struct; |
63 | getinfo_file_70.param4 = bdvk_struct; |
64 | getinfo_file_70.rezerv = 0; |
64 | getinfo_file_70.rezerv = 0; |
65 | getinfo_file_70.name = file_path; |
65 | getinfo_file_70.name = file_path; |
66 | $mov eax,70 |
66 | $mov eax,70 |
67 | $mov ebx,#getinfo_file_70.func |
67 | $mov ebx,#getinfo_file_70.func |
68 | $int 0x40 |
68 | $int 0x40 |
69 | } |
69 | } |
70 | 70 | ||
71 | /////////////////////////// |
71 | /////////////////////////// |
72 | // Çàïóñê ïðîãðàììû // |
72 | // Çàïóñê ïðîãðàììû // |
73 | /////////////////////////// |
73 | /////////////////////////// |
74 | :f70 run_file_70; |
74 | :f70 run_file_70; |
75 | :signed int RunProgram(dword run_path, run_param) |
75 | :signed int RunProgram(dword run_path, run_param) |
76 | { |
76 | { |
77 | run_file_70.func = 7; |
77 | run_file_70.func = 7; |
78 | run_file_70.param1 = |
78 | run_file_70.param1 = |
79 | run_file_70.param3 = |
79 | run_file_70.param3 = |
80 | run_file_70.param4 = |
80 | run_file_70.param4 = |
81 | run_file_70.rezerv = 0; |
81 | run_file_70.rezerv = 0; |
82 | run_file_70.param2 = run_param; |
82 | run_file_70.param2 = run_param; |
83 | run_file_70.name = run_path; |
83 | run_file_70.name = run_path; |
84 | $mov eax,70 |
84 | $mov eax,70 |
85 | $mov ebx,#run_file_70.func |
85 | $mov ebx,#run_file_70.func |
86 | $int 0x40 |
86 | $int 0x40 |
87 | } |
87 | } |
88 | 88 | ||
89 | /////////////////////////// |
89 | /////////////////////////// |
90 | // Ñîçäàíèå ïàïêè // |
90 | // Ñîçäàíèå ïàïêè // |
91 | /////////////////////////// |
91 | /////////////////////////// |
92 | :f70 create_dir_70; |
92 | :f70 create_dir_70; |
93 | :int CreateDir(dword new_folder_path) |
93 | :int CreateDir(dword new_folder_path) |
94 | { |
94 | { |
95 | create_dir_70.func = 9; |
95 | create_dir_70.func = 9; |
96 | create_dir_70.param1 = |
96 | create_dir_70.param1 = |
97 | create_dir_70.param2 = |
97 | create_dir_70.param2 = |
98 | create_dir_70.param3 = |
98 | create_dir_70.param3 = |
99 | create_dir_70.param4 = |
99 | create_dir_70.param4 = |
100 | create_dir_70.rezerv = 0; |
100 | create_dir_70.rezerv = 0; |
101 | create_dir_70.name = new_folder_path; |
101 | create_dir_70.name = new_folder_path; |
102 | $mov eax,70 |
102 | $mov eax,70 |
103 | $mov ebx,#create_dir_70.func |
103 | $mov ebx,#create_dir_70.func |
104 | $int 0x40 |
104 | $int 0x40 |
105 | } |
105 | } |
106 | 106 | ||
107 | //////////////////////////// |
107 | //////////////////////////// |
108 | // Óäàëåíèå ôàéëà/ïàïêè // |
108 | // Óäàëåíèå ôàéëà/ïàïêè // |
109 | //////////////////////////// |
109 | //////////////////////////// |
110 | :f70 del_file_70; |
110 | :f70 del_file_70; |
111 | :int DeleteFile(dword del_file_path) |
111 | :int DeleteFile(dword del_file_path) |
112 | { |
112 | { |
113 | del_file_70.func = 8; |
113 | del_file_70.func = 8; |
114 | del_file_70.param1 = |
114 | del_file_70.param1 = |
115 | del_file_70.param2 = |
115 | del_file_70.param2 = |
116 | del_file_70.param3 = |
116 | del_file_70.param3 = |
117 | del_file_70.param4 = |
117 | del_file_70.param4 = |
118 | del_file_70.rezerv = 0; |
118 | del_file_70.rezerv = 0; |
119 | del_file_70.name = del_file_path; |
119 | del_file_70.name = del_file_path; |
120 | $mov eax,70 |
120 | $mov eax,70 |
121 | $mov ebx,#del_file_70.func |
121 | $mov ebx,#del_file_70.func |
122 | $int 0x40 |
122 | $int 0x40 |
123 | } |
123 | } |
124 | 124 | ||
125 | //////////////////////////// |
125 | //////////////////////////// |
126 | // Ïðî÷èòàòü ôàéë // |
126 | // Ïðî÷èòàòü ôàéë // |
127 | //////////////////////////// |
127 | //////////////////////////// |
128 | :f70 read_file_70; |
128 | :f70 read_file_70; |
129 | :int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path) |
129 | :int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path) |
130 | { |
130 | { |
131 | read_file_70.func = 0; |
131 | read_file_70.func = 0; |
132 | read_file_70.param1 = read_pos; |
132 | read_file_70.param1 = read_pos; |
133 | read_file_70.param2 = 0; |
133 | read_file_70.param2 = 0; |
134 | read_file_70.param3 = read_file_size; |
134 | read_file_70.param3 = read_file_size; |
135 | read_file_70.param4 = read_buffer; |
135 | read_file_70.param4 = read_buffer; |
136 | read_file_70.rezerv = 0; |
136 | read_file_70.rezerv = 0; |
137 | read_file_70.name = read_file_path; |
137 | read_file_70.name = read_file_path; |
138 | $mov eax,70 |
138 | $mov eax,70 |
139 | $mov ebx,#read_file_70.func |
139 | $mov ebx,#read_file_70.func |
140 | $int 0x40 |
140 | $int 0x40 |
141 | } |
141 | } |
142 | 142 | ||
143 | //////////////////////////// |
143 | //////////////////////////// |
144 | // Çàïèñàòü ôàéë // |
144 | // Çàïèñàòü ôàéë // |
145 | //////////////////////////// |
145 | //////////////////////////// |
146 | :f70 write_file_70; |
146 | :f70 write_file_70; |
147 | :int WriteFile(dword write_file_size, write_buffer, write_file_path) |
147 | :int WriteFile(dword write_file_size, write_buffer, write_file_path) |
148 | { |
148 | { |
149 | write_file_70.func = 2; |
149 | write_file_70.func = 2; |
150 | write_file_70.param1 = 0; |
150 | write_file_70.param1 = 0; |
151 | write_file_70.param2 = 0; |
151 | write_file_70.param2 = 0; |
152 | write_file_70.param3 = write_file_size; |
152 | write_file_70.param3 = write_file_size; |
153 | write_file_70.param4 = write_buffer; |
153 | write_file_70.param4 = write_buffer; |
154 | write_file_70.rezerv = 0; |
154 | write_file_70.rezerv = 0; |
155 | write_file_70.name = write_file_path; |
155 | write_file_70.name = write_file_path; |
156 | $mov eax,70 |
156 | $mov eax,70 |
157 | $mov ebx,#write_file_70.func |
157 | $mov ebx,#write_file_70.func |
158 | $int 0x40 |
158 | $int 0x40 |
159 | } |
159 | } |
- | 160 | ||
- | 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 | } |
|
160 | 178 | ||
161 | /////////////////////////// |
179 | /////////////////////////// |
162 | // Ïðî÷èòàòü ïàïêó // |
180 | // Ïðî÷èòàòü ïàïêó // |
163 | /////////////////////////// |
181 | /////////////////////////// |
164 | :f70 read_dir_70; |
182 | :f70 read_dir_70; |
165 | :int ReadDir(dword file_count, read_buffer, dir_path) |
183 | :int ReadDir(dword file_count, read_buffer, dir_path) |
166 | { |
184 | { |
167 | read_dir_70.func = 1; |
185 | read_dir_70.func = 1; |
168 | read_dir_70.param1 = |
186 | read_dir_70.param1 = |
169 | read_dir_70.param2 = |
187 | read_dir_70.param2 = |
170 | read_dir_70.rezerv = 0; |
188 | read_dir_70.rezerv = 0; |
171 | read_dir_70.param3 = file_count; |
189 | read_dir_70.param3 = file_count; |
172 | read_dir_70.param4 = read_buffer; |
190 | read_dir_70.param4 = read_buffer; |
173 | read_dir_70.name = dir_path; |
191 | read_dir_70.name = dir_path; |
174 | $mov eax,70 |
192 | $mov eax,70 |
175 | $mov ebx,#read_dir_70.func |
193 | $mov ebx,#read_dir_70.func |
176 | $int 0x40 |
194 | $int 0x40 |
177 | } |
195 | } |
178 | 196 | ||
179 | :char isdir(dword fpath) |
197 | :char isdir(dword fpath) |
180 | { |
198 | { |
181 | BDVK fpath_atr; |
199 | BDVK fpath_atr; |
182 | GetFileInfo(fpath, #fpath_atr); |
200 | GetFileInfo(fpath, #fpath_atr); |
183 | return fpath_atr.isfolder; |
201 | return fpath_atr.isfolder; |
184 | } |
202 | } |
185 | 203 | ||
186 | :int GetFile(dword buf, filesize, read_path) |
204 | :int GetFile(dword buf, filesize, read_path) |
187 | { |
205 | { |
188 | BDVK ReadFile_atr; |
206 | BDVK ReadFile_atr; |
189 | dword rBuf; |
207 | dword rBuf; |
190 | if (! GetFileInfo(read_path, #ReadFile_atr)) |
208 | if (! GetFileInfo(read_path, #ReadFile_atr)) |
191 | { |
209 | { |
192 | rBuf = malloc(ReadFile_atr.sizelo); |
210 | rBuf = malloc(ReadFile_atr.sizelo); |
193 | if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path)) |
211 | if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path)) |
194 | { |
212 | { |
195 | ESDWORD[buf] = rBuf; |
213 | ESDWORD[buf] = rBuf; |
196 | ESDWORD[filesize] = ReadFile_atr.sizelo; |
214 | ESDWORD[filesize] = ReadFile_atr.sizelo; |
197 | return 1; |
215 | return 1; |
198 | } |
216 | } |
199 | } |
217 | } |
200 | free(rBuf); |
218 | free(rBuf); |
201 | return 0; |
219 | return 0; |
202 | } |
220 | } |
203 | 221 | ||
204 | enum |
222 | enum |
205 | { |
223 | { |
206 | DIRS_ALL, |
224 | DIRS_ALL, |
207 | DIRS_NOROOT, |
225 | DIRS_NOROOT, |
208 | DIRS_ONLYREAL |
226 | DIRS_ONLYREAL |
209 | }; |
227 | }; |
210 | :int GetDir(dword dir_buf, file_count, path, doptions) |
228 | :int GetDir(dword dir_buf, file_count, path, doptions) |
211 | { |
229 | { |
212 | dword buf, fcount, error; |
230 | dword buf, fcount, error; |
213 | buf = malloc(32); |
231 | buf = malloc(32); |
214 | error = ReadDir(0, buf, path); |
232 | error = ReadDir(0, buf, path); |
215 | if (!error) |
233 | if (!error) |
216 | { |
234 | { |
217 | fcount = ESDWORD[buf+8]; |
235 | fcount = ESDWORD[buf+8]; |
218 | buf = realloc(buf, fcount+1*304+32); |
236 | buf = realloc(buf, fcount+1*304+32); |
219 | ReadDir(fcount, buf, path); |
237 | ReadDir(fcount, buf, path); |
220 | //fcount=EBX; |
238 | //fcount=EBX; |
221 | 239 | ||
222 | if (doptions == DIRS_ONLYREAL) |
240 | if (doptions == DIRS_ONLYREAL) |
223 | { |
241 | { |
224 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
242 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
225 | if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
243 | if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
226 | } |
244 | } |
227 | if (doptions == DIRS_NOROOT) |
245 | if (doptions == DIRS_NOROOT) |
228 | { |
246 | { |
229 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
247 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
230 | } |
248 | } |
231 | 249 | ||
232 | ESDWORD[dir_buf] = buf; |
250 | ESDWORD[dir_buf] = buf; |
233 | ESDWORD[file_count] = fcount; |
251 | ESDWORD[file_count] = fcount; |
234 | } |
252 | } |
235 | else |
253 | else |
236 | { |
254 | { |
237 | ESDWORD[file_count] = 0; |
255 | ESDWORD[file_count] = 0; |
238 | ESDWORD[dir_buf] = free(buf); |
256 | ESDWORD[dir_buf] = free(buf); |
239 | } |
257 | } |
240 | return error; |
258 | return error; |
241 | } |
259 | } |
242 | 260 | ||
243 | :dword notify(dword notify_param) |
261 | :dword notify(dword notify_param) |
244 | { |
262 | { |
245 | return RunProgram("@notify", notify_param); |
263 | return RunProgram("@notify", notify_param); |
246 | } |
264 | } |
247 | 265 | ||
248 | :dword abspath(dword relative_path) //GetAbsolutePathFromRelative() |
266 | :dword abspath(dword relative_path) //GetAbsolutePathFromRelative() |
249 | { |
267 | { |
250 | char absolute_path[4096]; |
268 | char absolute_path[4096]; |
251 | if (ESBYTE[relative_path]=='/') |
269 | if (ESBYTE[relative_path]=='/') |
252 | { |
270 | { |
253 | strcpy(#absolute_path, relative_path); |
271 | strcpy(#absolute_path, relative_path); |
254 | } |
272 | } |
255 | else |
273 | else |
256 | { |
274 | { |
257 | strcpy(#absolute_path, #program_path); |
275 | strcpy(#absolute_path, #program_path); |
258 | absolute_path[strrchr(#absolute_path, '/')] = '\0'; |
276 | absolute_path[strrchr(#absolute_path, '/')] = '\0'; |
259 | strcat(#absolute_path, relative_path); |
277 | strcat(#absolute_path, relative_path); |
260 | } |
278 | } |
261 | return #absolute_path; |
279 | return #absolute_path; |
262 | } |
280 | } |
263 | 281 | ||
264 | :dword ConvertSize(unsigned int bytes) |
282 | :dword ConvertSize(unsigned int bytes) |
265 | { |
283 | { |
266 | unsigned char size_prefix[8], size_nm[4]; |
284 | unsigned char size_prefix[8], size_nm[4]; |
267 | if (bytes>=1073741824) strcpy(#size_nm, " Gb"); |
285 | if (bytes>=1073741824) strcpy(#size_nm, " Gb"); |
268 | else if (bytes>=1048576) strcpy(#size_nm, " Mb"); |
286 | else if (bytes>=1048576) strcpy(#size_nm, " Mb"); |
269 | else if (bytes>=1024) strcpy(#size_nm, " Kb"); |
287 | else if (bytes>=1024) strcpy(#size_nm, " Kb"); |
270 | else strcpy(#size_nm, " b "); |
288 | else strcpy(#size_nm, " b "); |
271 | while (bytes>1023) bytes/=1024; |
289 | while (bytes>1023) bytes/=1024; |
272 | itoa_(#size_prefix, bytes); |
290 | itoa_(#size_prefix, bytes); |
273 | strcat(#size_prefix, #size_nm); |
291 | strcat(#size_prefix, #size_nm); |
274 | return #size_prefix; |
292 | return #size_prefix; |
275 | } |
293 | } |
276 | 294 | ||
277 | :dword ConvertSizeToKb(unsigned int bytes) |
295 | :dword ConvertSizeToKb(unsigned int bytes) |
278 | { |
296 | { |
279 | unsigned char size[25]=0; |
297 | unsigned char size[25]=0; |
280 | unsigned int kb; |
298 | unsigned int kb; |
281 | dword kb_line; |
299 | dword kb_line; |
282 | 300 | ||
283 | kb_line = itoa(bytes / 1024); |
301 | kb_line = itoa(bytes / 1024); |
284 | strcpy(#size, kb_line); |
302 | strcpy(#size, kb_line); |
285 | strcat(#size, " Kb"); |
303 | strcat(#size, " Kb"); |
286 | 304 | ||
287 | return #size; |
305 | return #size; |
288 | }16; |
306 | }16; |
289 | ><16; |
307 | ><16; |
290 | >16; |
308 | >16; |
291 | ><16; |
309 | ><16; |
292 | >16; |
310 | >16; |
293 | ><16; |
311 | ><16; |
294 | >24+color; |
312 | >24+color; |
295 | ><24+color; |
313 | ><24+color; |
296 | >16+y; |
314 | >16+y; |
297 | ><16+y; |
315 | ><16+y; |
298 | >16; |
316 | >16; |
299 | ><16; |
317 | ><16; |
300 | > |
318 | > |