Rev 3434 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3434 | Rev 3440 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | dword sizelo; |
21 | dword sizelo; |
22 | dword sizehi; |
22 | dword sizehi; |
23 | char name[518]; |
23 | char name[518]; |
24 | }; |
24 | }; |
Line -... | Line 25... | ||
- | 25 | ||
- | 26 | inline fastcall void SetCurDir( ECX) |
|
- | 27 | { |
|
- | 28 | $mov eax,30 |
|
- | 29 | $mov ebx,1 |
|
- | 30 | $int 0x40 |
|
- | 31 | } |
|
- | 32 | ||
- | 33 | inline fastcall void GetCurDir( ECX, EDX) |
|
- | 34 | { |
|
- | 35 | $mov eax,30 |
|
- | 36 | $mov ebx,2 |
|
- | 37 | $int 0x40 |
|
- | 38 | } |
|
- | 39 | ||
- | 40 | /////////////////////////// |
|
- | 41 | // Ïàðàìåòðû ôàéëà // |
|
- | 42 | /////////////////////////// |
|
- | 43 | f70 getinfo_file_70; |
|
- | 44 | :dword GetFileInfo(dword file_path, bdvk_struct) |
|
- | 45 | { |
|
- | 46 | getinfo_file_70.func = 5; |
|
- | 47 | getinfo_file_70.param1 = |
|
- | 48 | getinfo_file_70.param2 = |
|
- | 49 | getinfo_file_70.param3 = 0; |
|
- | 50 | getinfo_file_70.param4 = bdvk_struct; |
|
- | 51 | getinfo_file_70.rezerv = 0; |
|
- | 52 | getinfo_file_70.name = file_path; |
|
- | 53 | $mov eax,70 |
|
- | 54 | $mov ebx,#getinfo_file_70.func |
|
- | 55 | $int 0x40 |
|
Line 25... | Line 56... | ||
25 | 56 | } |
|
26 | 57 | ||
27 | /////////////////////////// |
58 | /////////////////////////// |
28 | // Çàïóñê ïðîãðàììû // |
59 | // Çàïóñê ïðîãðàììû // |
Line 94... | Line 125... | ||
94 | $mov eax,70 |
125 | $mov eax,70 |
95 | $mov ebx,#read_file_70.func |
126 | $mov ebx,#read_file_70.func |
96 | $int 0x40 |
127 | $int 0x40 |
97 | } |
128 | } |
Line 98... | Line -... | ||
98 | - | ||
99 | :int GetFile(dword buf, filesize, read_path) |
- | |
100 | { |
- | |
101 | BDVK ReadFile_atr; |
- | |
102 | dword rBuf; |
- | |
103 | if (! GetFileInfo(read_path, #ReadFile_atr)) |
- | |
104 | { |
- | |
105 | rBuf = malloc(ReadFile_atr.sizelo); |
- | |
106 | if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path)) |
- | |
107 | { |
- | |
108 | ESDWORD[buf] = rBuf; |
- | |
109 | ESDWORD[filesize] = ReadFile_atr.sizelo; |
- | |
110 | return 1; |
- | |
111 | } |
- | |
112 | } |
- | |
113 | free(rBuf); |
- | |
114 | return 0; |
- | |
115 | } |
- | |
116 | - | ||
117 | 129 | ||
118 | //////////////////////////// |
130 | //////////////////////////// |
119 | // Çàïèñàòü ôàéë // |
131 | // Çàïèñàòü ôàéë // |
120 | //////////////////////////// |
132 | //////////////////////////// |
121 | f70 write_file_70; |
133 | f70 write_file_70; |
Line 149... | Line 161... | ||
149 | $mov eax,70 |
161 | $mov eax,70 |
150 | $mov ebx,#read_dir_70.func |
162 | $mov ebx,#read_dir_70.func |
151 | $int 0x40 |
163 | $int 0x40 |
152 | } |
164 | } |
Line -... | Line 165... | ||
- | 165 | ||
- | 166 | char isdir(dword fpath) |
|
- | 167 | { |
|
- | 168 | BDVK fpath_atr; |
|
- | 169 | GetFileInfo(fpath, #fpath_atr); |
|
- | 170 | if (TestBit(fpath_atr.attr, 4)==1) return 1; else return 0; |
|
- | 171 | } |
|
- | 172 | :int GetFile(dword buf, filesize, read_path) |
|
- | 173 | { |
|
- | 174 | BDVK ReadFile_atr; |
|
- | 175 | dword rBuf; |
|
- | 176 | if (! GetFileInfo(read_path, #ReadFile_atr)) |
|
- | 177 | { |
|
- | 178 | rBuf = malloc(ReadFile_atr.sizelo); |
|
- | 179 | if (! ReadFile(0, ReadFile_atr.sizelo, rBuf, read_path)) |
|
- | 180 | { |
|
- | 181 | ESDWORD[buf] = rBuf; |
|
- | 182 | ESDWORD[filesize] = ReadFile_atr.sizelo; |
|
- | 183 | return 1; |
|
- | 184 | } |
|
- | 185 | } |
|
- | 186 | free(rBuf); |
|
- | 187 | return 0; |
|
Line 153... | Line 188... | ||
153 | 188 | } |
|
154 | 189 | ||
155 | :int GetDir(dword dir_buf, file_count, path) |
190 | :int GetDir(dword dir_buf, file_count, path) |
156 | { |
- | |
157 | dword buf, fcount, error; |
191 | { |
158 | ESDWORD[file_count] = 0; |
192 | dword buf, fcount, error; |
159 | buf = malloc(32); |
193 | buf = malloc(32); |
160 | error = ReadDir(0, buf, path); |
194 | error = ReadDir(0, buf, path); |
161 | if (!error) |
195 | if (!error) |
162 | { |
196 | { |
163 | fcount = ESDWORD[buf+8]; |
197 | fcount = ESDWORD[buf+8]; |
- | 198 | buf = realloc(buf, fcount+1*304+32); |
|
164 | buf = realloc(buf, fcount+1*304+32); |
199 | ReadDir(fcount, buf, path); |
165 | ReadDir(fcount, buf, path); |
200 | //fcount=EBX; |
166 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
201 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
167 | if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
202 | if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
168 | ESDWORD[dir_buf] = buf; |
203 | ESDWORD[dir_buf] = buf; |
169 | ESDWORD[file_count] = fcount; |
204 | ESDWORD[file_count] = fcount; |
170 | } |
- | |
171 | return error; |
- | |
172 | } |
- | |
173 | - | ||
174 | - | ||
175 | /////////////////////////// |
- | |
176 | // Ïàðàìåòðû ôàéëà // |
- | |
177 | /////////////////////////// |
- | |
178 | f70 getinfo_file_70; |
- | |
179 | :dword GetFileInfo(dword file_path, bdvk_struct) |
- | |
180 | { |
- | |
181 | getinfo_file_70.func = 5; |
- | |
182 | getinfo_file_70.param1 = |
- | |
183 | getinfo_file_70.param2 = |
- | |
184 | getinfo_file_70.param3 = 0; |
- | |
185 | getinfo_file_70.param4 = bdvk_struct; |
- | |
186 | getinfo_file_70.rezerv = 0; |
- | |
187 | getinfo_file_70.name = file_path; |
- | |
188 | $mov eax,70 |
- | |
189 | $mov ebx,#getinfo_file_70.func |
- | |
190 | $int 0x40 |
- | |
191 | } |
- | |
192 | - | ||
193 | - | ||
194 | /////////////////////////// |
- | |
195 | // Ñêîïèðîâàòü ôàéë // |
- | |
196 | /////////////////////////// |
- | |
197 | :int CopyFile(dword copy_from, copy_in) |
- | |
198 | { |
- | |
199 | BDVK CopyFile_atr; |
- | |
200 | dword cBufer=0; |
- | |
201 | char rezult = -1; |
205 | } |
202 | if (! GetFileInfo(copy_from, #CopyFile_atr)) |
206 | else |
203 | { |
207 | { |
204 | cBufer = malloc(CopyFile_atr.sizelo); |
- | |
205 | if (! ReadFile(0, CopyFile_atr.sizelo, cBufer, copy_from)) |
- | |
206 | { |
- | |
207 | rezult = WriteFile(CopyFile_atr.sizelo, cBufer, copy_in); |
208 | ESDWORD[file_count] = 0; |
208 | } |
- | |
209 | } |
209 | ESDWORD[dir_buf] = free(buf); |
210 | free(cBufer); |
- | |
211 | return rezult; |
- | |
212 | } |
- | |
213 | - | ||
214 | inline fastcall void SetCurDir( ECX) |
- | |
215 | { |
- | |
216 | $mov eax,30 |
- | |
217 | $mov ebx,1 |
- | |
218 | $int 0x40 |
- | |
219 | } |
- | |
220 | - | ||
221 | inline fastcall void GetCurDir( ECX, EDX) |
- | |
222 | { |
- | |
223 | $mov eax,30 |
- | |
224 | $mov ebx,2 |
210 | } |
Line 225... | Line 211... | ||
225 | $int 0x40 |
211 | return error; |
226 | } |
212 | } |
227 | 213 | ||
228 | void notify(dword notify_param) |
214 | :void notify(dword notify_param) |
Line 229... | Line 215... | ||
229 | { |
215 | { |
230 | RunProgram("@notify", notify_param); |
216 | RunProgram("@notify", notify_param); |
231 | } |
217 | } |
- | 218 | ||
232 | 219 | :dword abspath(dword relative_path) //GetAbsolutePathFromRelative() |
|
233 | :dword abspath(dword relative_path) //GetAbsolutePathFromRelative() |
220 | { |
234 | { |
221 | char absolute_path[4096]; |
235 | char absolute_path[4096]; |
222 | if (ESBYTE[relative_path]=='/') return relative_path; |
236 | strcpy(#absolute_path, #program_path); |
223 | strcpy(#absolute_path, #program_path); |