Rev 5421 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5421 | Rev 5472 | ||
---|---|---|---|
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 BDVK{ |
11 | struct BDVK{ |
12 | dword attr; |
12 | dword attr; |
13 | byte type_name; |
13 | byte type_name; |
14 | byte rez1, rez2, selected; |
14 | byte rez1, rez2, selected; |
15 | dword timecreate; |
15 | dword timecreate; |
16 | dword datecreate; |
16 | dword datecreate; |
17 | dword timelastaccess; |
17 | dword timelastaccess; |
18 | dword datelastaccess; |
18 | dword datelastaccess; |
19 | dword timelastedit; |
19 | dword timelastedit; |
20 | dword datelastedit; |
20 | dword datelastedit; |
21 | dword sizelo; |
21 | dword sizelo; |
22 | dword sizehi; |
22 | dword sizehi; |
23 | char name[518]; |
23 | char name[518]; |
24 | }; |
24 | }; |
25 | 25 | ||
26 | 26 | ||
27 | /////////////////////////// |
27 | /////////////////////////// |
28 | // Ïàðàìåòðû ôàéëà // |
28 | // Ïàðàìåòðû ôàéëà // |
29 | /////////////////////////// |
29 | /////////////////////////// |
30 | f70 getinfo_file_70; |
30 | :f70 getinfo_file_70; |
31 | :dword GetFileInfo(dword file_path, bdvk_struct) |
31 | :dword GetFileInfo(dword file_path, bdvk_struct) |
32 | { |
32 | { |
33 | getinfo_file_70.func = 5; |
33 | getinfo_file_70.func = 5; |
34 | getinfo_file_70.param1 = |
34 | getinfo_file_70.param1 = |
35 | getinfo_file_70.param2 = |
35 | getinfo_file_70.param2 = |
36 | getinfo_file_70.param3 = 0; |
36 | getinfo_file_70.param3 = 0; |
37 | getinfo_file_70.param4 = bdvk_struct; |
37 | getinfo_file_70.param4 = bdvk_struct; |
38 | getinfo_file_70.rezerv = 0; |
38 | getinfo_file_70.rezerv = 0; |
39 | getinfo_file_70.name = file_path; |
39 | getinfo_file_70.name = file_path; |
40 | $mov eax,70 |
40 | $mov eax,70 |
41 | $mov ebx,#getinfo_file_70.func |
41 | $mov ebx,#getinfo_file_70.func |
42 | $int 0x40 |
42 | $int 0x40 |
43 | } |
43 | } |
44 | 44 | ||
45 | /////////////////////////// |
45 | /////////////////////////// |
46 | // Çàïóñê ïðîãðàììû // |
46 | // Çàïóñê ïðîãðàììû // |
47 | /////////////////////////// |
47 | /////////////////////////// |
48 | f70 run_file_70; |
48 | :f70 run_file_70; |
49 | signed int RunProgram(dword run_path, run_param) |
49 | :signed int RunProgram(dword run_path, run_param) |
50 | { |
50 | { |
51 | run_file_70.func = 7; |
51 | run_file_70.func = 7; |
52 | run_file_70.param1 = |
52 | run_file_70.param1 = |
53 | run_file_70.param3 = |
53 | run_file_70.param3 = |
54 | run_file_70.param4 = |
54 | run_file_70.param4 = |
55 | run_file_70.rezerv = 0; |
55 | run_file_70.rezerv = 0; |
56 | run_file_70.param2 = run_param; |
56 | run_file_70.param2 = run_param; |
57 | run_file_70.name = run_path; |
57 | run_file_70.name = run_path; |
58 | $mov eax,70 |
58 | $mov eax,70 |
59 | $mov ebx,#run_file_70.func |
59 | $mov ebx,#run_file_70.func |
60 | $int 0x40 |
60 | $int 0x40 |
61 | } |
61 | } |
62 | 62 | ||
63 | /////////////////////////// |
63 | /////////////////////////// |
64 | // Ñîçäàíèå ïàïêè // |
64 | // Ñîçäàíèå ïàïêè // |
65 | /////////////////////////// |
65 | /////////////////////////// |
66 | f70 create_dir_70; |
66 | :f70 create_dir_70; |
67 | :int CreateDir(dword new_folder_path) |
67 | :int CreateDir(dword new_folder_path) |
68 | { |
68 | { |
69 | create_dir_70.func = 9; |
69 | create_dir_70.func = 9; |
70 | create_dir_70.param1 = |
70 | create_dir_70.param1 = |
71 | create_dir_70.param2 = |
71 | create_dir_70.param2 = |
72 | create_dir_70.param3 = |
72 | create_dir_70.param3 = |
73 | create_dir_70.param4 = |
73 | create_dir_70.param4 = |
74 | create_dir_70.rezerv = 0; |
74 | create_dir_70.rezerv = 0; |
75 | create_dir_70.name = new_folder_path; |
75 | create_dir_70.name = new_folder_path; |
76 | $mov eax,70 |
76 | $mov eax,70 |
77 | $mov ebx,#create_dir_70.func |
77 | $mov ebx,#create_dir_70.func |
78 | $int 0x40 |
78 | $int 0x40 |
79 | } |
79 | } |
80 | 80 | ||
81 | //////////////////////////// |
81 | //////////////////////////// |
82 | // Óäàëåíèå ôàéëà/ïàïêè // |
82 | // Óäàëåíèå ôàéëà/ïàïêè // |
83 | //////////////////////////// |
83 | //////////////////////////// |
84 | f70 del_file_70; |
84 | :f70 del_file_70; |
85 | :int DeleteFile(dword del_file_path) |
85 | :int DeleteFile(dword del_file_path) |
86 | { |
86 | { |
87 | del_file_70.func = 8; |
87 | del_file_70.func = 8; |
88 | del_file_70.param1 = |
88 | del_file_70.param1 = |
89 | del_file_70.param2 = |
89 | del_file_70.param2 = |
90 | del_file_70.param3 = |
90 | del_file_70.param3 = |
91 | del_file_70.param4 = |
91 | del_file_70.param4 = |
92 | del_file_70.rezerv = 0; |
92 | del_file_70.rezerv = 0; |
93 | del_file_70.name = del_file_path; |
93 | del_file_70.name = del_file_path; |
94 | $mov eax,70 |
94 | $mov eax,70 |
95 | $mov ebx,#del_file_70.func |
95 | $mov ebx,#del_file_70.func |
96 | $int 0x40 |
96 | $int 0x40 |
97 | } |
97 | } |
98 | 98 | ||
99 | //////////////////////////// |
99 | //////////////////////////// |
100 | // Ïðî÷èòàòü ôàéë // |
100 | // Ïðî÷èòàòü ôàéë // |
101 | //////////////////////////// |
101 | //////////////////////////// |
102 | f70 read_file_70; |
102 | :f70 read_file_70; |
103 | :int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path) |
103 | :int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path) |
104 | { |
104 | { |
105 | read_file_70.func = 0; |
105 | read_file_70.func = 0; |
106 | read_file_70.param1 = read_pos; |
106 | read_file_70.param1 = read_pos; |
107 | read_file_70.param2 = 0; |
107 | read_file_70.param2 = 0; |
108 | read_file_70.param3 = read_file_size; |
108 | read_file_70.param3 = read_file_size; |
109 | read_file_70.param4 = read_buffer; |
109 | read_file_70.param4 = read_buffer; |
110 | read_file_70.rezerv = 0; |
110 | read_file_70.rezerv = 0; |
111 | read_file_70.name = read_file_path; |
111 | read_file_70.name = read_file_path; |
112 | $mov eax,70 |
112 | $mov eax,70 |
113 | $mov ebx,#read_file_70.func |
113 | $mov ebx,#read_file_70.func |
114 | $int 0x40 |
114 | $int 0x40 |
115 | } |
115 | } |
116 | 116 | ||
117 | //////////////////////////// |
117 | //////////////////////////// |
118 | // Çàïèñàòü ôàéë // |
118 | // Çàïèñàòü ôàéë // |
119 | //////////////////////////// |
119 | //////////////////////////// |
120 | f70 write_file_70; |
120 | :f70 write_file_70; |
121 | :int WriteFile(dword write_file_size, write_buffer, write_file_path) |
121 | :int WriteFile(dword write_file_size, write_buffer, write_file_path) |
122 | { |
122 | { |
123 | write_file_70.func = 2; |
123 | write_file_70.func = 2; |
124 | write_file_70.param1 = 0; |
124 | write_file_70.param1 = 0; |
125 | write_file_70.param2 = 0; |
125 | write_file_70.param2 = 0; |
126 | write_file_70.param3 = write_file_size; |
126 | write_file_70.param3 = write_file_size; |
127 | write_file_70.param4 = write_buffer; |
127 | write_file_70.param4 = write_buffer; |
128 | write_file_70.rezerv = 0; |
128 | write_file_70.rezerv = 0; |
129 | write_file_70.name = write_file_path; |
129 | write_file_70.name = write_file_path; |
130 | $mov eax,70 |
130 | $mov eax,70 |
131 | $mov ebx,#write_file_70.func |
131 | $mov ebx,#write_file_70.func |
132 | $int 0x40 |
132 | $int 0x40 |
133 | } |
133 | } |
134 | 134 | ||
135 | /////////////////////////// |
135 | /////////////////////////// |
136 | // Ïðî÷èòàòü ïàïêó // |
136 | // Ïðî÷èòàòü ïàïêó // |
137 | /////////////////////////// |
137 | /////////////////////////// |
138 | f70 read_dir_70; |
138 | :f70 read_dir_70; |
139 | :int ReadDir(dword file_count, read_buffer, dir_path) |
139 | :int ReadDir(dword file_count, read_buffer, dir_path) |
140 | { |
140 | { |
141 | read_dir_70.func = 1; |
141 | read_dir_70.func = 1; |
142 | read_dir_70.param1 = |
142 | read_dir_70.param1 = |
143 | read_dir_70.param2 = |
143 | read_dir_70.param2 = |
144 | read_dir_70.rezerv = 0; |
144 | read_dir_70.rezerv = 0; |
145 | read_dir_70.param3 = file_count; |
145 | read_dir_70.param3 = file_count; |
146 | read_dir_70.param4 = read_buffer; |
146 | read_dir_70.param4 = read_buffer; |
147 | read_dir_70.name = dir_path; |
147 | read_dir_70.name = dir_path; |
148 | $mov eax,70 |
148 | $mov eax,70 |
149 | $mov ebx,#read_dir_70.func |
149 | $mov ebx,#read_dir_70.func |
150 | $int 0x40 |
150 | $int 0x40 |
151 | } |
151 | } |
152 | 152 | ||
153 | char isdir(dword fpath) |
153 | :char isdir(dword fpath) |
154 | { |
154 | { |
155 | BDVK fpath_atr; |
155 | BDVK fpath_atr; |
156 | GetFileInfo(fpath, #fpath_atr); |
156 | GetFileInfo(fpath, #fpath_atr); |
157 | if (TestBit( fpath_atr.attr, 4)) return 1; else return 0; |
157 | if (TestBit( fpath_atr.attr, 4)) return 1; else return 0; |
158 | } |
158 | } |
159 | 159 | ||
160 | :int GetFile(dword buf, filesize, read_path) |
160 | :int GetFile(dword buf, filesize, read_path) |
161 | { |
161 | { |
162 | BDVK ReadFile_atr; |
162 | BDVK ReadFile_atr; |
163 | dword rBuf; |
163 | dword rBuf; |
164 | if (! GetFileInfo(read_path, #ReadFile_atr)) |
164 | if (! GetFileInfo(read_path, #ReadFile_atr)) |
165 | { |
165 | { |
166 | rBuf = malloc(ReadFile_atr.sizelo); |
166 | rBuf = malloc(ReadFile_atr.sizelo); |
167 | if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path)) |
167 | if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path)) |
168 | { |
168 | { |
169 | ESDWORD[buf] = rBuf; |
169 | ESDWORD[buf] = rBuf; |
170 | ESDWORD[filesize] = ReadFile_atr.sizelo; |
170 | ESDWORD[filesize] = ReadFile_atr.sizelo; |
171 | return 1; |
171 | return 1; |
172 | } |
172 | } |
173 | } |
173 | } |
174 | free(rBuf); |
174 | free(rBuf); |
175 | return 0; |
175 | return 0; |
176 | } |
176 | } |
177 | 177 | ||
178 | enum |
178 | enum |
179 | { |
179 | { |
180 | DIRS_ALL, |
180 | DIRS_ALL, |
181 | DIRS_NOROOT, |
181 | DIRS_NOROOT, |
182 | DIRS_ONLYREAL |
182 | DIRS_ONLYREAL |
183 | }; |
183 | }; |
184 | :int GetDir(dword dir_buf, file_count, path, doptions) |
184 | :int GetDir(dword dir_buf, file_count, path, doptions) |
185 | { |
185 | { |
186 | dword buf, fcount, error; |
186 | dword buf, fcount, error; |
187 | buf = malloc(32); |
187 | buf = malloc(32); |
188 | error = ReadDir(0, buf, path); |
188 | error = ReadDir(0, buf, path); |
189 | if (!error) |
189 | if (!error) |
190 | { |
190 | { |
191 | fcount = ESDWORD[buf+8]; |
191 | fcount = ESDWORD[buf+8]; |
192 | buf = realloc(buf, fcount+1*304+32); |
192 | buf = realloc(buf, fcount+1*304+32); |
193 | ReadDir(fcount, buf, path); |
193 | ReadDir(fcount, buf, path); |
194 | //fcount=EBX; |
194 | //fcount=EBX; |
195 | 195 | ||
196 | if (doptions == DIRS_ONLYREAL) |
196 | if (doptions == DIRS_ONLYREAL) |
197 | { |
197 | { |
198 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
198 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
199 | if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
199 | if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
200 | } |
200 | } |
201 | if (doptions == DIRS_NOROOT) |
201 | if (doptions == DIRS_NOROOT) |
202 | { |
202 | { |
203 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
203 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
204 | } |
204 | } |
205 | 205 | ||
206 | ESDWORD[dir_buf] = buf; |
206 | ESDWORD[dir_buf] = buf; |
207 | ESDWORD[file_count] = fcount; |
207 | ESDWORD[file_count] = fcount; |
208 | } |
208 | } |
209 | else |
209 | else |
210 | { |
210 | { |
211 | ESDWORD[file_count] = 0; |
211 | ESDWORD[file_count] = 0; |
212 | ESDWORD[dir_buf] = free(buf); |
212 | ESDWORD[dir_buf] = free(buf); |
213 | } |
213 | } |
214 | return error; |
214 | return error; |
215 | } |
215 | } |
216 | 216 | ||
217 | :dword notify(dword notify_param) |
217 | :dword notify(dword notify_param) |
218 | { |
218 | { |
219 | return RunProgram("@notify", notify_param); |
219 | return RunProgram("@notify", notify_param); |
220 | } |
220 | } |
221 | 221 | ||
222 | :dword abspath(dword relative_path) //GetAbsolutePathFromRelative() |
222 | :dword abspath(dword relative_path) //GetAbsolutePathFromRelative() |
223 | { |
223 | { |
224 | char absolute_path[4096]; |
224 | char absolute_path[4096]; |
225 | if (ESBYTE[relative_path]=='/') |
225 | if (ESBYTE[relative_path]=='/') |
226 | { |
226 | { |
227 | strcpy(#absolute_path, relative_path); |
227 | strcpy(#absolute_path, relative_path); |
228 | } |
228 | } |
229 | else |
229 | else |
230 | { |
230 | { |
231 | strcpy(#absolute_path, #program_path); |
231 | strcpy(#absolute_path, #program_path); |
232 | absolute_path[strrchr(#absolute_path, '/')] = '\0'; |
232 | absolute_path[strrchr(#absolute_path, '/')] = '\0'; |
233 | strcat(#absolute_path, relative_path); |
233 | strcat(#absolute_path, relative_path); |
234 | } |
234 | } |
235 | return #absolute_path; |
235 | return #absolute_path; |
236 | } |
236 | } |