mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-29 17:59:50 +03:00
d7512224b5
git-svn-id: svn://kolibrios.org@631 a494cfbc-eb01-0410-851d-a64ba20cac60
150 lines
8.7 KiB
Plaintext
150 lines
8.7 KiB
Plaintext
<EFBFBD>« £¨ ¯à¥¤áâ ¢«ï¥â ᮡ®© áâ ¤ àâãî ¤«ï Š®«¨¡à¨ ¤¨ ¬¨ç¥áªãî ¡¨¡«¨®â¥ªã (ä®à¬ â COFF),
|
||
íªá¯®àâ¨àãîéãî á«¥¤ãî騥 äãªæ¨¨ ¨ ¯¥à¥¬¥ë¥ (¥ª®â®àë¥ äãªæ¨¨ ¬®£ãâ ®âáãâá⢮¢ âì).
|
||
”ãªæ¨¨ ¬®£ãâ à §àãè âì «î¡ë¥ ॣ¨áâàë. kfar £ à â¨àã¥â á¡à®è¥ë© ä« £ ¯à ¢«¥¨ï DF
|
||
¯à¨ ¢ë§®¢¥ íªá¯®àâ¨à㥬ëå äãªæ¨© ¨ ®¦¨¤ ¥â ⮣® ¦¥ ¤«ï callback-äãªæ¨©.
|
||
|
||
int version;
|
||
‚¥àá¨ï ¨â¥à䥩á kfar, ª®â®àãî à ááç¨â ¯« £¨. ‘¥©ç á ¤®«¦ ¡ëâì 2.
|
||
|
||
int __stdcall plugin_load(kfar_info* info);
|
||
‚ë§ë¢ ¥âáï ¯à¨ § £à㧪¥ ¯« £¨ .
|
||
typedef struct
|
||
{
|
||
int StructSize; // = sizeof(kfar_info)
|
||
int kfar_ver; // 10000h*major + minor
|
||
/* ‚ᥠcallback-äãªæ¨¨ á®åà ïî⠢ᥠॣ¨áâàë, § ¨áª«î票¥¬ eax. */
|
||
/* ”ãªæ¨¨ à ¡®âë á ä ©« ¬¨: */
|
||
void* open; // HANDLE __stdcall open(const char* name, int mode);
|
||
// mode - ª®¬¡¨ æ¨ï ¡¨â®¢ëå ä« £®¢
|
||
// O_READ = 1 - ¤®áâ㯠¤«ï ç⥨ï
|
||
// O_WRITE = 2 - ¤®áâ㯠¤«ï § ¯¨á¨
|
||
// O_CREATE = 4 - ¥á«¨ ä ©« ¥ áãé¥áâ¢ã¥â, ᮧ¤ âì ¥£®
|
||
// O_TRUNCATE = 8 - ãá¥çì ä ©« ¤® ã«¥¢®© ¤«¨ë
|
||
void* open2; // HANDLE __stdcall open2(int plugin_id, HANDLE plugin_instance,
|
||
// const char* name, int mode);
|
||
// «®£¨ç® open, ® ®âªàë¢ ¥â ä ©« á ¯ ¥«¨ ¯« £¨
|
||
// open2(0,<anything>,name,mode) = open(name,mode)
|
||
void* read; // unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
|
||
void* write; // ¥éñ ¥ ॠ«¨§®¢ ®
|
||
void* seek; // void __stdcall seek(HANDLE hFile, int method, __int64 newpos);
|
||
void* tell; // __int64 __stdcall tell(HANDLE hFile);
|
||
void* flush; // ¥éñ ¥ ॠ«¨§®¢ ®
|
||
void* filesize; // __int64 __stdcall filesize(HANDLE hFile);
|
||
void* close; // void __stdcall close(HANDLE hFile);
|
||
/* ”ãªæ¨¨ à ¡®âë á ¯ ¬ïâìî (¯®áâà ¨ç®): */
|
||
void* pgalloc; // in: ecx=size, out: eax=pointer or NULL
|
||
// ¯à¨ ¥å¢ ⪥ ¯ ¬ï⨠ᮮ¡é ¥â ¯®«ì§®¢ â¥«î ¨ ¢®§¢à é ¥â NULL
|
||
void* pgrealloc; // in: edx=pointer, ecx=new size, out: eax=pointer or NULL
|
||
// ¯à¨ ¥å¢ ⪥ ¯ ¬ï⨠ᮮ¡é ¥â ¯®«ì§®¢ â¥«î ¨ ¢®§¢à é ¥â NULL
|
||
void* pgfree; // in: ecx=pointer
|
||
void* getfreemem; // unsigned __stdcall getfreemem(void);
|
||
// ¢®§¢à é ¥â à §¬¥à ᢮¡®¤®© ®¯¥à ⨢®© ¯ ¬ï⨠¢ Š¡
|
||
void* pgalloc2; // void* __stdcall pgalloc2(unsigned size);
|
||
void* pgrealloc2; // void* __stdcall pgrealloc2(void* pointer, unsigned size);
|
||
void* pgfree2; // void __stdcall pgfree2(void* pointer);
|
||
/* ”ãªæ¨¨ à ¡®âë á ¤¨ «®£ ¬¨: */
|
||
void* menu; // int __stdcall menu(void* variants, const char* title, unsigned flags);
|
||
// variants 㪠§ë¢ ¥â ⥪ã騩 í«¥¬¥â ¢ ¤¢ãá¢ï§®¬ ᯨ᪥
|
||
void* menu_centered_in; // int __stdcall menu_centered_in(unsigned left, unsigned top,
|
||
// unsigned width, unsigned height,
|
||
// void* variants, const char* title, unsigned flags);
|
||
void* DialogBox; // int __stdcall DialogBox(DLGDATA* dlg);
|
||
void* SayErr; // int __stdcall SayErr(int num_strings, const char** strings,
|
||
// int num_buttons, const char** buttons);
|
||
void* Message; // int __stdcall Message(const char* title,
|
||
// int num_strings, const char** strings,
|
||
// int num_buttons, const char** buttons);
|
||
// may be x=-1 and/or y=-1
|
||
struct {unsigned width;unsigned height;}* cur_console_size;
|
||
} kfar_info;
|
||
‚®§¢à é ¥¬®¥ § 票¥:
|
||
0 = ãᯥè ï ¨¨æ¨ «¨§ æ¨ï
|
||
1 = ®è¨¡ª ¨¨æ¨ «¨§ 樨 (kfar ¢ë¤ áâ á®®¡é¥¨¥ ¯®«ì§®¢ ⥫î)
|
||
2 = ®è¨¡ª ¨¨æ¨ «¨§ 樨 (kfar ¯à®¤®«¦¨â ¡¥§ á®®¡é¥¨©)
|
||
|
||
void __stdcall plugin_unload(void);
|
||
‚ë§ë¢ ¥âáï ¯à¨ ¢ë£à㧪¥ ¯« £¨ (¢ ¯à®æ¥áᥠ§ ¢¥à襨ï à ¡®âë kfar).
|
||
|
||
HANDLE __stdcall OpenFilePlugin(HANDLE basefile,
|
||
const void* attr, const void* data, int datasize,
|
||
int baseplugin_id, HANDLE baseplugin_instance, const char* name);
|
||
Žâªàë¢ ¥â ¯« £¨, í¬ã«¨àãî騩 ä ©«®¢ãî á¨á⥬㠡 §¥ ä ©« ( ¯à¨¬¥à, à娢 ).
|
||
|
||
basefile - åí¤« ä ©« (ª ª®â®à®¬ã ¯à¨¬¥¨¬ë äãªæ¨¨ read ¨ seek ¨§ kfar_info)
|
||
attr - 㪠§ ⥫ì áâàãªâãàã á âਡãâ ¬¨ ä ©« ¢ ä®à¬ ⥠á¨á⥬®© äãªæ¨¨ 70.1
|
||
data - ¡ãä¥à, ᮤ¥à¦ 騩 ¤ ë¥ ¨§ ç « ä ©« (¬®¦¥â ¨á¯®«ì§®¢ âìáï ¤«ï ®¯à¥¤¥«¥¨ï ⨯ ä ©« )
|
||
datasize - à §¬¥à ¤ ëå ¢ data. ‚ ⥪ã饩 ॠ«¨§ 樨 min(1024,à §¬¥à ä ©« )
|
||
baseplugin_id - ¨¤¥â¨ä¨ª â®à ¯« £¨ , ¯ ¥«¨ ª®â®à®£® à ᯮ« £ ¥âáï ®âªàë¢ ¥¬ë© ä ©«;
|
||
0 ¢ á«ãç ¥ ®¡ëçëå ¯ ¥«¥©
|
||
baseplugin_instance - åí¤«, ¢®§¢à éñë© ¨§ äãªæ¨¨ GetOpenPluginInfo ¯« £¨ ,
|
||
®¯à¥¤¥«ï¥¬®£® ¯® baseplugin_id
|
||
name - ¨¬ï ä ©« (¢® ¢à¥¬¥®¬ ¡ãä¥à¥) (¯®«®¥ ¨¬ï ®â®á¨â¥«ì® baseplugin)
|
||
|
||
…᫨ ¯« £¨ ®¡à ¡ âë¢ ¥â ¯¥à¥¤ ë© ä ©«, â® ® ¤®«¦¥ ¢¥àãâì ®¢ë© ®¯¨á ⥫ì,
|
||
ª®â®àë© ¢ ¤ «ì¥©è¥¬ ¡ã¤¥â ¨á¯®«ì§®¢ âì kfar ¤«ï ®¡à é¥¨ï ª ¯« £¨ã. ‚ í⮬ á«ãç ¥
|
||
¯« £¨ ¤®«¦¥ á ¬®áâ®ïâ¥«ì® § ªàëâì basefile äãªæ¨¥© close ¨§ kfar_info ( ¯à¨¬¥à,
|
||
¯à¨ § ªàë⨨ ®¯¨á â¥«ï ¯« £¨ ¢ ClosePlugin ¨«¨ ¥¯®á।á⢥® ¢ OpenFilePlugin,
|
||
¥á«¨ basefile ¢®®¡é¥ ¢¯®á«¥¤á⢨¨ ¥ 㦥).
|
||
…᫨ ¯« £¨ ¥ ®¡à ¡ âë¢ ¥â ¯¥à¥¤ ë© ä ©«, ¤®«¦¥ ¢®§¢à é âìáï 0.
|
||
…᫨ ®¯¥à æ¨ï ¯à¥à¢ ¯®«ì§®¢ ⥫¥¬, ¤®«¦® ¢®§¢à é âìáï § 票¥ -1.
|
||
|
||
void __stdcall ClosePlugin(HANDLE hPlugin);
|
||
‡ ªàë¢ ¥â ᮧ¤ ë© ¢ OpenFilePlugin ®¯¨á ⥫ì.
|
||
|
||
void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* Info);
|
||
<EFBFBD>®«ãç¨âì ¨ä®à¬ æ¨î ®¡ ®âªàë⮬ íª§¥¬¯«ïॠ¯« £¨ .
|
||
typedef struct
|
||
{
|
||
unsigned flags; // ¡¨â 0: ¤®¡ ¢«ïâì í«¥¬¥â '..', ¥á«¨ ® ®âáãâáâ¢ã¥â
|
||
// ¡¨â 1: ª®¯¨à®¢ ¨¥ ®¡à ¡ âë¢ ¥âáï äãªæ¨¥© GetFiles
|
||
} OpenPluginInfo;
|
||
|
||
void __stdcall GetPanelTitle(HANDLE hPlugin, char title[1024],
|
||
const char* host_file, const char* curdir);
|
||
<EFBFBD>®«ãç¨âì § £®«®¢®ª ¯ ¥«¨ ¯« £¨ . <20> à ¬¥âà host_file ᮢ¯ ¤ ¥â á ¨¬¥¥¬ ä ©« , ¯¥à¥¤ ë¬
|
||
¢ OpenFilePlugin. <20> à ¬¥âà curdir ᮢ¯ ¤ ¥â á ⥪ã饩 ¯ ¯ª®©, ãáâ ¢«¨¢ ¥¬®© ¢ SetFolder.
|
||
|
||
int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start,
|
||
unsigned dirinfo_size, void* dirdata);
|
||
—¨â ¥â ⥪ãéãî ¯ ¯ªã. hPlugin - ¢®§¢à éñë© ¨§ OpenFilePlugin ®¯¨á ⥫ì.
|
||
dirinfo_start - á ª ª®£® ä ©« ç¨â âì, dirinfo_size - ᪮«ìª® ä ©«®¢ ç¨â âì.
|
||
‚®§¢à é ¥¬®¥ § 票¥ ¨ ¢®§¢à é ¥¬ë¥ ¢ dirdata ¤ ë¥ ¤®«¦ë ᮮ⢥âá⢮¢ âì äãªæ¨¨ 70.1.
|
||
|
||
bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, const char* absolute_path);
|
||
“áâ ®¢¨âì ⥪ãéãî ¯ ¯ªã. relative_path - ®â®á¨â¥«ìë© ¯ãâì (".." ¨«¨ ¨¬ï ¯®¤¯ ¯ª¨),
|
||
absolute_path - ¡á®«îâë© ¯ãâì (¯ ¯ª í¬ã«¨à㥬®© ¯« £¨®¬ ä ©«®¢®© á¨á⥬ë).
|
||
|
||
void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir);
|
||
bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile);
|
||
bool __stdcall adddir(const char* name, void* bdfe_info);
|
||
‚ë§ë¢ ¥âáï ¤«ï ª®¯¨à®¢ ¨ï, ¥á«¨ ¢® ä« £ å, ¢®§¢à é ¥¬ëå GetOpenPluginInfo, ãáâ ®¢«¥ ¡¨â 1.
|
||
<EFBFBD>âã äãªæ¨î ४®¬¥¤ã¥âáï ॠ«¨§®¢ë¢ âì ¢ á«ãç ¥, ¥á«¨ áâ ¤ àâë© à¥ªãàá¨¢ë© ®¡å®¤ ¯ ¯®ª
|
||
¥ã¤®¡¥.
|
||
hPlugin - ®¯¨á ⥫ì, ᮧ¤ ë© ¢ OpenFilePlugin.
|
||
NumItems - ç¨á«® ª®¯¨à㥬ëå í«¥¬¥â®¢.
|
||
items - ¬ áᨢ ª®¯¨à㥬ëå í«¥¬¥â®¢, ª ¦¤ë© ¨§ ª®â®àëå § ¤ ñâáï 㪠§ ⥫¥¬ áâàãªâãàã BDFE.
|
||
‘¯¥æ¨ «ìë© á«ãç © NumItems=-1, items=NULL ®§ ç ¥â "¢á¥ ä ©«ë" (¢ ⥪ã饩 ¯ ¯ª¥ ¨ ¯®¤¯ ¯ª å).
|
||
addfile, adddir - callback-äãªæ¨¨ kfar' . ‚®§¢à â false ®§ ç ¥â "¯à¥à¢ âì ª®¯¨à®¢ ¨¥".
|
||
<EFBFBD> à ¬¥âà name ¤®«¦¥ § ¤ ¢ âì ¨¬ï ®â®á¨â¥«ì® ⥪ã饩 ¯ ¯ª¨. <20> à ¬¥âà bdfe_info -
|
||
㪠§ ⥫ì ᮪à éñãî (40 ¡ ©â) § ¯¨áì ¢ ä®à¬ ⥠äãªæ¨¨ 70.5.
|
||
Žâªàë⨥¬ ¨ § ªàë⨥¬ ®¯¨á ⥫ï hFile ¤®«¦¥ § ¨¬ âìáï ¯« £¨. ”ãªæ¨ï addfile ¡ã¤¥â
|
||
¢ë§ë¢ âì ⮫쪮 äãªæ¨î read.
|
||
|
||
int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info);
|
||
<EFBFBD>®«ãç¨âì ¨ä®à¬ æ¨î ® ä ©«¥. ‚®§¢à é ¥¬®¥ § 票¥ ¨ ¤ ë¥ ¢ info ¤®«¦ë ᮮ⢥âá⢮¢ âì
|
||
äãªæ¨¨ 70.5.
|
||
|
||
HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode);
|
||
Žâªàëâì ä ©« filename. <20> à ¬¥âà mode § १¥à¢¨à®¢ ¨ ¢ ⥪ã饩 ¢¥àᨨ kfar ¢á¥£¤ à ¢¥ 1.
|
||
|
||
unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
|
||
—⥨¥ size ¡ ©â ¢ ¡ãä¥à buf ¨§ ä ©« hFile, à ¥¥ ®âªàë⮣® ç¥à¥§ open.
|
||
kfar £ à â¨àã¥â, çâ® size ªà ⥠512 ¡ ©â.
|
||
‚®§¢à é ¥¬®¥ § 票¥: ç¨á«® ¯à®ç¨â ëå ¡ ©â, -1 ¯à¨ ®è¨¡ª¥.
|
||
|
||
void __stdcall setpos(HANDLE hFile, __int64 pos);
|
||
“áâ ®¢¨âì ⥪ãéãî ¯®§¨æ¨î ¢ ä ©«¥ hFile, à ¥¥ ®âªàë⮣® ç¥à¥§ open, ¢ pos.
|
||
ƒ à â¨àã¥âáï, çâ® pos ªà â® 512 ¡ ©â.
|
||
|
||
void __stdcall close(HANDLE hFile);
|