Subversion Repositories Kolibri OS

Rev

Rev 3045 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2568 leency 1
//CODED by Veliant, Leency 2008-2012. GNU GPL licence.
2
 
3
struct f70{
4
	dword	func;
5
	dword	param1;
6
	dword	param2;
7
	dword	param3;
8
	dword	param4;
9
	char	rezerv;
10
	dword	name;
11
};
12
 
13
struct BDVK{
14
	dword	attr;
15
	byte	type_name;
16
	byte	rez1, rez2, rez3;
17
	dword	timecreate;
18
	dword	datecreate;
19
	dword	timelastaccess;
20
	dword	datelastaccess;
21
	dword	timelastedit;
22
	dword	datelastedit;
23
	dword	sizelo;
24
	dword	sizehi;
25
	char	name[518];
26
};
27
 
28
////////////////////////////
2661 leency 29
//     Создать файл     //
2568 leency 30
////////////////////////////
3043 leency 31
f70 create_file_70;
32
int CreateFile(dword file_size, read_buffer, file_path)
2661 leency 33
{
34
	create_file_70.func = 2;
35
	create_file_70.param1 = 0;
36
	create_file_70.param2 = 0;
37
	create_file_70.param3 = file_size;
38
	create_file_70.param4 = read_buffer;
39
	create_file_70.rezerv = 0;
40
	create_file_70.name = file_path;
41
	$mov eax,70
42
	$mov ebx,#create_file_70.func
43
	$int 0x40
3043 leency 44
}
2661 leency 45
 
46
////////////////////////////
47
//     Прочитать файл     //
48
////////////////////////////
2568 leency 49
f70 read_file_70;
3043 leency 50
int ReadFile(dword pos, file_size, read_buffer, file_path)
2568 leency 51
{
52
	read_file_70.func = 0;
53
	read_file_70.param1 = pos;
54
	read_file_70.param2 = 0;
55
	read_file_70.param3 = file_size;
56
	read_file_70.param4 = read_buffer;
57
	read_file_70.rezerv = 0;
58
	read_file_70.name = file_path;
59
	$mov eax,70
60
	$mov ebx,#read_file_70.func
61
	$int 0x40
62
}
63
 
64
///////////////////////////
2661 leency 65
//    Прочитать папку    //
2568 leency 66
///////////////////////////
67
f70 read_dir_70;
68
int ReadDir(dword file_count, read_buffer, read_dir_path)
69
{
70
	read_dir_70.func = 1;
71
	read_dir_70.param1 = 0;
72
	read_dir_70.param2 = 0;
73
	read_dir_70.param3 = file_count;
74
	read_dir_70.param4 = read_buffer;
75
	read_dir_70.rezerv = 0;
76
	read_dir_70.name = read_dir_path;
77
	$mov eax,70
78
	$mov ebx,#read_dir_70.func
79
	$int 0x40
80
}
81
 
82
///////////////////////////
2661 leency 83
//   Запуск программv    //
2568 leency 84
///////////////////////////
85
f70 run_file_70;
86
int RunProgram(dword run_path, run_param)
87
{
88
    run_file_70.func = 7;
89
    run_file_70.param1 =
90
    run_file_70.param3 =
91
    run_file_70.param4 =
92
    run_file_70.rezerv = 0;
93
    run_file_70.param2 = run_param;
94
    run_file_70.name = run_path;
95
    $mov eax,70
96
    $mov ebx,#run_file_70.func
97
    $int 0x40
98
}
99
 
100
///////////////////////////
2661 leency 101
//    Создание папки     //
2568 leency 102
///////////////////////////
103
f70 create_dir_70;
104
int CreateFolder(dword new_folder_path)
105
{
106
	create_dir_70.func = 9;
107
	create_dir_70.param1 =
108
	create_dir_70.param2 =
109
	create_dir_70.param3 =
110
	create_dir_70.param4 =
111
	create_dir_70.rezerv = 0;
112
	create_dir_70.name = new_folder_path;
113
	$mov eax,70
114
	$mov ebx,#create_dir_70.func
115
	$int 0x40
116
}
117
 
118
////////////////////////////
2661 leency 119
//  Удаление файла/папки  //
2568 leency 120
////////////////////////////
121
f70 del_file_70;
122
int DeleleFile(dword del_file_path)
123
{
124
	del_file_70.func = 8;
125
	del_file_70.param1 =
126
	del_file_70.param2 =
127
	del_file_70.param3 =
128
	del_file_70.param4 =
129
	del_file_70.rezerv = 0;
130
	del_file_70.name = del_file_path;
131
	$mov eax,70
132
	$mov ebx,#del_file_70.func
133
	$int 0x40
134
}
135
 
136
///////////////////////////
3057 leency 137
//   Параметры файла    //
138
///////////////////////////
139
/*f70 getinfo_file_70;
140
BDVK getinfo_file_info;
141
:dword GetFileInfo(dword file_path)
142
{
143
    getinfo_file_70.func = 5;
144
    getinfo_file_70.param1 =
145
    getinfo_file_70.param2 =
146
    getinfo_file_70.param3 = 0;
147
    getinfo_file_70.param4 = #getinfo_file_info;
148
    getinfo_file_70.rezerv = 0;
149
    getinfo_file_70.name = file_path;
150
    $mov eax,70
151
    $mov ebx,#getinfo_file_70.func
152
    $int 0x40
153
}*/
154
 
155
///////////////////////////
2661 leency 156
//   Скопировать файл    //
2568 leency 157
///////////////////////////
158
f70	CopyFile_f;
159
inline fastcall int CopyFile(dword EBX,ECX)
160
{
161
	BDVK CopyFile_atr;
3057 leency 162
	dword s=EBX, d=ECX, cBufer=0, rezult;
2568 leency 163
	CopyFile_f.func = 5;
164
	CopyFile_f.param1 = 0;
165
	CopyFile_f.param2 = 0;
166
	CopyFile_f.param3 = 0;
167
	CopyFile_f.param4 = #CopyFile_atr;
168
	CopyFile_f.rezerv = 0;
169
	CopyFile_f.name = s;
170
	$mov eax, 70
171
	$mov ebx, #CopyFile_f
172
	$int 0x40
173
 
174
	if (!EAX)
175
	{
176
		cBufer = malloc(2*CopyFile_atr.sizelo);
3057 leency 177
		if (!ReadFile(0, CopyFile_atr.sizelo, cBufer, s))
178
			rezult = CreateFile(CopyFile_atr.sizelo, cBufer, d);
179
		free(cBufer);
2568 leency 180
	}
3057 leency 181
	return rezult;
2568 leency 182
 
183
}
184
 
3045 leency 185
void notify(dword notify_param)
186
{
187
	RunProgram("@notify", notify_param);
188
}