Rev 3081 | Rev 3412 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3067 | leency | 1 | struct f70{ |
2 | dword func; |
||
3 | dword param1; |
||
4 | dword param2; |
||
5 | dword param3; |
||
6 | dword param4; |
||
7 | char rezerv; |
||
8 | dword name; |
||
9 | }; |
||
10 | |||
11 | struct BDVK{ |
||
12 | dword attr; |
||
13 | byte type_name; |
||
14 | byte rez1, rez2, rez3; |
||
15 | dword timecreate; |
||
16 | dword datecreate; |
||
17 | dword timelastaccess; |
||
18 | dword datelastaccess; |
||
19 | dword timelastedit; |
||
20 | dword datelastedit; |
||
21 | dword sizelo; |
||
22 | dword sizehi; |
||
23 | char name[518]; |
||
24 | }; |
||
25 | |||
26 | |||
27 | /////////////////////////// |
||
28 | // Запуск программы // |
||
29 | /////////////////////////// |
||
30 | f70 run_file_70; |
||
3363 | leency | 31 | signed int RunProgram(dword run_path, run_param) |
3067 | leency | 32 | { |
33 | run_file_70.func = 7; |
||
34 | run_file_70.param1 = |
||
35 | run_file_70.param3 = |
||
36 | run_file_70.param4 = |
||
37 | run_file_70.rezerv = 0; |
||
38 | run_file_70.param2 = run_param; |
||
39 | run_file_70.name = run_path; |
||
40 | $mov eax,70 |
||
41 | $mov ebx,#run_file_70.func |
||
42 | $int 0x40 |
||
43 | } |
||
44 | |||
45 | /////////////////////////// |
||
46 | // Создание папки // |
||
47 | /////////////////////////// |
||
48 | f70 create_dir_70; |
||
49 | :int CreateDir(dword new_folder_path) |
||
50 | { |
||
51 | create_dir_70.func = 9; |
||
52 | create_dir_70.param1 = |
||
53 | create_dir_70.param2 = |
||
54 | create_dir_70.param3 = |
||
55 | create_dir_70.param4 = |
||
56 | create_dir_70.rezerv = 0; |
||
57 | create_dir_70.name = new_folder_path; |
||
58 | $mov eax,70 |
||
59 | $mov ebx,#create_dir_70.func |
||
60 | $int 0x40 |
||
61 | } |
||
62 | |||
63 | //////////////////////////// |
||
64 | // Удаление файла/папки // |
||
65 | //////////////////////////// |
||
66 | f70 del_file_70; |
||
67 | :int DeleteFile(dword del_file_path) |
||
68 | { |
||
69 | del_file_70.func = 8; |
||
70 | del_file_70.param1 = |
||
71 | del_file_70.param2 = |
||
72 | del_file_70.param3 = |
||
73 | del_file_70.param4 = |
||
74 | del_file_70.rezerv = 0; |
||
75 | del_file_70.name = del_file_path; |
||
76 | $mov eax,70 |
||
77 | $mov ebx,#del_file_70.func |
||
78 | $int 0x40 |
||
79 | } |
||
80 | |||
81 | //////////////////////////// |
||
82 | // Прочитать файл // |
||
83 | //////////////////////////// |
||
84 | f70 read_file_70; |
||
85 | :int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path) |
||
86 | { |
||
87 | read_file_70.func = 0; |
||
88 | read_file_70.param1 = read_pos; |
||
89 | read_file_70.param2 = 0; |
||
90 | read_file_70.param3 = read_file_size; |
||
91 | read_file_70.param4 = read_buffer; |
||
92 | read_file_70.rezerv = 0; |
||
93 | read_file_70.name = read_file_path; |
||
94 | $mov eax,70 |
||
95 | $mov ebx,#read_file_70.func |
||
96 | $int 0x40 |
||
97 | } |
||
98 | |||
3363 | leency | 99 | :int GetFile(dword buf, filesize, read_path) |
100 | { |
||
101 | BDVK ReadFile_atr; |
||
102 | dword rBuf=0; |
||
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 | |||
3067 | leency | 117 | //////////////////////////// |
118 | // Записать файл // |
||
119 | //////////////////////////// |
||
120 | f70 write_file_70; |
||
121 | :int WriteFile(dword write_file_size, write_buffer, write_file_path) |
||
122 | { |
||
123 | write_file_70.func = 2; |
||
124 | write_file_70.param1 = 0; |
||
125 | write_file_70.param2 = 0; |
||
126 | write_file_70.param3 = write_file_size; |
||
127 | write_file_70.param4 = write_buffer; |
||
128 | write_file_70.rezerv = 0; |
||
129 | write_file_70.name = write_file_path; |
||
130 | $mov eax,70 |
||
131 | $mov ebx,#write_file_70.func |
||
132 | $int 0x40 |
||
133 | } |
||
134 | |||
135 | /////////////////////////// |
||
136 | // Прочитать папку // |
||
137 | /////////////////////////// |
||
138 | f70 read_dir_70; |
||
139 | :int ReadDir(dword file_count, read_buffer, dir_path) |
||
3363 | leency | 140 | { |
3067 | leency | 141 | read_dir_70.func = 1; |
142 | read_dir_70.param1 = |
||
143 | read_dir_70.param2 = |
||
144 | read_dir_70.rezerv = 0; |
||
145 | read_dir_70.param3 = file_count; |
||
146 | read_dir_70.param4 = read_buffer; |
||
147 | read_dir_70.name = dir_path; |
||
148 | $mov eax,70 |
||
149 | $mov ebx,#read_dir_70.func |
||
150 | $int 0x40 |
||
151 | } |
||
152 | |||
153 | |||
3363 | leency | 154 | :int GetDir(dword dir_buf, file_count, path) |
155 | { |
||
156 | dword buf, fcount, error; |
||
157 | buf = malloc(32); |
||
158 | error = ReadDir(0, buf, path); |
||
159 | if (!error) |
||
160 | { |
||
161 | fcount = ESDWORD[buf+8]; |
||
162 | buf = realloc(buf, fcount+1*304+32); |
||
163 | ReadDir(fcount, buf, path); |
||
164 | if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
||
165 | if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);} |
||
166 | ESDWORD[dir_buf] = buf; |
||
167 | ESDWORD[file_count] = fcount; |
||
168 | } |
||
169 | return error; |
||
170 | } |
||
171 | |||
172 | |||
3067 | leency | 173 | /////////////////////////// |
174 | // Параметры файла // |
||
175 | /////////////////////////// |
||
176 | f70 getinfo_file_70; |
||
3363 | leency | 177 | :dword GetFileInfo(dword file_path, bdvk_struct) |
3067 | leency | 178 | { |
179 | getinfo_file_70.func = 5; |
||
180 | getinfo_file_70.param1 = |
||
181 | getinfo_file_70.param2 = |
||
182 | getinfo_file_70.param3 = 0; |
||
3363 | leency | 183 | getinfo_file_70.param4 = bdvk_struct; |
3067 | leency | 184 | getinfo_file_70.rezerv = 0; |
185 | getinfo_file_70.name = file_path; |
||
186 | $mov eax,70 |
||
187 | $mov ebx,#getinfo_file_70.func |
||
188 | $int 0x40 |
||
189 | } |
||
190 | |||
191 | |||
192 | /////////////////////////// |
||
193 | // Скопировать файл // |
||
194 | /////////////////////////// |
||
195 | :int CopyFile(dword copy_from, copy_in) |
||
196 | { |
||
197 | BDVK CopyFile_atr; |
||
198 | dword cBufer=0; |
||
3363 | leency | 199 | char rezult = -1; |
200 | if (! GetFileInfo(copy_from, #CopyFile_atr)) |
||
3067 | leency | 201 | { |
3363 | leency | 202 | cBufer = malloc(CopyFile_atr.sizelo); |
3081 | leency | 203 | if (! ReadFile(0, CopyFile_atr.sizelo, cBufer, copy_from)) |
3363 | leency | 204 | { |
205 | rezult = WriteFile(CopyFile_atr.sizelo, cBufer, copy_in); |
||
206 | } |
||
3067 | leency | 207 | } |
3363 | leency | 208 | free(cBufer); |
209 | return rezult; |
||
3067 | leency | 210 | } |
211 | |||
212 | inline fastcall void SetCurDir( ECX) |
||
213 | { |
||
214 | $mov eax,30 |
||
215 | $mov ebx,1 |
||
216 | $int 0x40 |
||
217 | } |
||
218 | |||
219 | inline fastcall void GetCurDir( ECX, EDX) |
||
220 | { |
||
221 | $mov eax,30 |
||
222 | $mov ebx,2 |
||
223 | $int 0x40 |
||
224 | } |
||
225 | |||
226 | void notify(dword notify_param) |
||
227 | { |
||
228 | RunProgram("@notify", notify_param); |
||
3081 | leency | 229 | } |