Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5882 → Rev 5883

/programs/cmm/lib/dll.h
16,6 → 16,11
 
char a_libdir[43] = "/sys/lib/\0";
 
dword GLOBAL_FUNC_LIB = 0;
dword G_FUNC_LOAD = 0;
dword G_FUNC_GET = 0;
dword PATH_LIBRARY_LOADING = "/rd/1/lib/library.obj";
 
:inline void error_init(dword text)
{
dword TEXT_ERROR = malloc(1024);
25,7 → 30,7
}
 
// stdcall with 1 parameter
void dll_Load() {
:void dll_Load() {
asm {
push ebp
mov ebp, esp
83,7 → 88,7
}
 
//stdcall with 2 parameters
void dll_Link() {
:void dll_Link() {
asm {
push ebp
mov ebp, esp
113,7 → 118,7
 
 
//stdcall with 1 parameter
void dll_Init() {
:void dll_Init() {
asm {
push ebp
mov ebp, esp
131,7 → 136,7
 
 
// stdcall with 2 parameters
void dll_GetProcAddress(){
:void dll_GetProcAddress(){
asm {
push ebp
mov ebp, esp
161,7 → 166,7
 
 
// stdcall with 2 parameters
void dll_StrCmp() {
:void dll_StrCmp() {
asm {
push ebp
mov ebp, esp
187,7 → 192,7
}
}
 
int load_dll2(dword dllname, import_table, byte need_init)
:int load_dll2(dword dllname, import_table, byte need_init)
{
//dword dllentry=0;
// load DLL
239,7 → 244,7
return -1;
}
 
byte load_dll(dword dllname, import_table, byte need_init)
:byte load_dll(dword dllname, import_table, byte need_init)
{
if (load_dll2(dllname, import_table, need_init))
{
249,5 → 254,42
return true;
}
 
:struct OBJECT
{
void load(dword dllname);
dword get(dword fname);
} library;
 
:void OBJECT::load(dword dllname)
{
dword tmp;
IF(!GLOBAL_FUNC_LIB)
{
$mov eax, 68
$mov ebx, 19
ECX=#PATH_LIBRARY_LOADING;
$int 0x40
tmp = EAX;
GLOBAL_FUNC_LIB = tmp;
tmp+=4;
G_FUNC_LOAD = DSDWORD[tmp];
tmp+=8;
G_FUNC_GET = DSDWORD[tmp];
}
G_FUNC_LOAD stdcall(dllname);
}
 
:dword OBJECT::get(dword fname)
{
dword tmp=fname;
G_FUNC_GET stdcall(tmp);
return EAX;
}
 
/*
#define INIT_(name) byte init_#name(){object.load(name);
#define IMPORT(name) name = object.get(name);
#define _INIT return 1;}
*/
 
#endif
/programs/cmm/lib/kolibri.h
25,6 → 25,8
char param[4096];
char program_path[4096];
 
dword TEMP = 0;
 
#define NULL 0
#define OLD -1
#define true 1
/programs/cmm/lib/obj/fs.h
0,0 → 1,68
#ifndef INCLUDE_LIBFS_H
#define INCLUDE_LIBFS_H
#print "[include <obj/fs.h>]\n"
 
#ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h"
#endif
 
#ifndef INCLUDE_DLL_H
#include "../lib/dll.h"
#endif
 
:struct FILE_SYSTEM_FUNCTION
{
dword remove_pointer;
byte remove(dword path);
dword move_pointer;
byte move(dword path1,path2);
dword copy_pointer;
byte copy(dword path1,path2);
dword get_size_pointer;
qword get_size(dword path);
} fs;
 
:byte FILE_SYSTEM_FUNCTION::remove(dword path)
{
dword tmp = path;
remove_pointer stdcall(tmp);
return EAX;
}
 
:qword FILE_SYSTEM_FUNCTION::get_size(dword path)
{
dword tmp = path;
get_size_pointer stdcall(tmp);
return EAX;
}
 
:byte FILE_SYSTEM_FUNCTION::move(dword path1,path2)
{
dword tmp1 = path1;
dword tmp2 = path2;
move_pointer stdcall(tmp1,tmp2);
return EAX;
}
 
:byte FILE_SYSTEM_FUNCTION::copy(dword path1,path2)
{
dword tmp1 = path1;
dword tmp2 = path2;
copy_pointer stdcall(tmp1,tmp2);
return EAX;
}
 
:void lib_init_fs()
{
library.load("/sys/LIB/FS.OBJ");
fs.remove_pointer = library.get("fs.remove");
fs.get_size_pointer = library.get("fs.get_size");
fs.move_pointer = library.get("fs.move");
fs.copy_pointer = library.get("fs.copy");
//alert(itoa(fs.get_size("/sys/")));
}
 
#endif