1 /*
2   Plugin API for Far Manager 3.0 build 4444
3   License: Public Domain
4 */
5 
6 module farplugin;
7 
8 import std.stdint;
9 import core.sys.windows.windows;
10 
11 align(1) struct GUID {  // size is 16
12 	DWORD   Data1;
13 	WORD    Data2;
14 	WORD    Data3;
15 	BYTE[8] Data4;
16 }
17 
18 const FARMANAGERVERSION_MAJOR = 3;
19 const FARMANAGERVERSION_MINOR = 0;
20 const FARMANAGERVERSION_REVISION = 0;
21 const FARMANAGERVERSION_BUILD = 4444;
22 const FARMANAGERVERSION_STAGE = VERSION_STAGE.VS_RELEASE;
23 
24 const CP_UNICODE    = cast(uintptr_t)1200;
25 const CP_REVERSEBOM = cast(uintptr_t)1201;
26 const CP_DEFAULT    = cast(uintptr_t)-1;
27 const CP_REDETECT   = cast(uintptr_t)-2;
28 
29 alias ulong FARCOLORFLAGS;
30 const FARCOLORFLAGS
31     FCF_FG_4BIT = 0x0000000000000001UL,
32     FCF_BG_4BIT = 0x0000000000000002UL,
33     FCF_4BITMASK = FCF_FG_4BIT|FCF_BG_4BIT, // 0x0000000000000003UL
34 
35     FCF_RAWATTR_MASK = 0x000000000000FF00UL, // stored console attributes
36 
37     FCF_EXTENDEDFLAGS = ~FCF_4BITMASK, // 0xFFFFFFFFFFFFFFFCUL
38     FCF_FG_BOLD = 0x1000000000000000UL,
39     FCF_FG_ITALIC = 0x2000000000000000UL,
40     FCF_FG_UNDERLINE = 0x4000000000000000UL,
41     FCF_STYLEMASK = FCF_FG_BOLD|FCF_FG_ITALIC|FCF_FG_UNDERLINE, // 0x7000000000000000UL
42     FCF_NONE = 0UL;
43 
44 struct rgba { byte r, g, b, a; }
45 
46 struct FarColor
47 {
48     FARCOLORFLAGS Flags;
49     union
50     {
51         COLORREF ForegroundColor;
52         rgba ForegroundRGBA;
53     }
54     union
55     {
56         COLORREF BackgroundColor;
57         rgba BackgroundRGBA;
58     }
59     void* Reserved;
60 }
61 
62 const INDEXMASK = 0x0000000F;
63 const COLORMASK = 0x00FFFFFF;
64 const ALPHAMASK = 0xFF000000;
65 
66 auto INDEXVALUE(ARG1)(ARG1 x) { return ((x)&INDEXMASK); }
67 auto COLORVALUE(ARG1)(ARG1 x) { return ((x)&COLORMASK); }
68 auto ALPHAVALUE(ARG1)(ARG1 x) { return ((x)&ALPHAMASK); }
69 
70 auto IS_OPAQUE(ARG1)(ARG1 x) { return (ALPHAVALUE(x)==ALPHAMASK); }
71 auto IS_TRANSPARENT(ARG1)(ARG1 x) { return (!ALPHAVALUE(x)); }
72 void MAKE_OPAQUE(ARG1)(ref ARG1 x) { (x|=ALPHAMASK); }
73 void MAKE_TRANSPARENT(ARG1)(ref ARG1 x) { (x&=COLORMASK); }
74 
75 alias ulong COLORDIALOGFLAGS;
76 const COLORDIALOGFLAGS CDF_NONE = 0UL;
77 
78 alias extern (Windows) BOOL function(
79     in GUID* PluginId,
80     COLORDIALOGFLAGS Flags,
81     FarColor* Color) FARAPICOLORDIALOG;
82 
83 alias ulong FARMESSAGEFLAGS;
84 const FARMESSAGEFLAGS
85     FMSG_WARNING             = 0x0000000000000001UL,
86     FMSG_ERRORTYPE           = 0x0000000000000002UL,
87     FMSG_KEEPBACKGROUND      = 0x0000000000000004UL,
88     FMSG_LEFTALIGN           = 0x0000000000000008UL,
89     FMSG_ALLINONE            = 0x0000000000000010UL,
90     FMSG_MB_OK               = 0x0000000000010000UL,
91     FMSG_MB_OKCANCEL         = 0x0000000000020000UL,
92     FMSG_MB_ABORTRETRYIGNORE = 0x0000000000030000UL,
93     FMSG_MB_YESNO            = 0x0000000000040000UL,
94     FMSG_MB_YESNOCANCEL      = 0x0000000000050000UL,
95     FMSG_MB_RETRYCANCEL      = 0x0000000000060000UL,
96     FMSG_NONE                = 0UL;
97 
98 alias extern (Windows) intptr_t function(
99     in GUID* PluginId,
100     in GUID* Id,
101     FARMESSAGEFLAGS Flags,
102     in wchar* HelpTopic,
103     in wchar** Items,
104     size_t ItemsNumber,
105     intptr_t ButtonsNumber) FARAPIMESSAGE;
106 
107 enum FARDIALOGITEMTYPES
108 {
109     DI_TEXT                         =  0,
110     DI_VTEXT                        =  1,
111     DI_SINGLEBOX                    =  2,
112     DI_DOUBLEBOX                    =  3,
113     DI_EDIT                         =  4,
114     DI_PSWEDIT                      =  5,
115     DI_FIXEDIT                      =  6,
116     DI_BUTTON                       =  7,
117     DI_CHECKBOX                     =  8,
118     DI_RADIOBUTTON                  =  9,
119     DI_COMBOBOX                     = 10,
120     DI_LISTBOX                      = 11,
121 
122     DI_USERCONTROL                  =255,
123 }
124 
125 /*
126    Check diagol element type has inputstring?
127    (DI_EDIT, DI_FIXEDIT, DI_PSWEDIT, etc)
128 */
129 BOOL  IsEdit(FARDIALOGITEMTYPES Type)
130 {
131     with (FARDIALOGITEMTYPES)
132         switch (Type)
133         {
134             case DI_EDIT:
135             case DI_FIXEDIT:
136             case DI_PSWEDIT:
137             case DI_COMBOBOX:
138                 return TRUE;
139             default:
140                 return FALSE;
141         }
142 }
143 
144 alias ulong FARDIALOGITEMFLAGS;
145 const FARDIALOGITEMFLAGS
146     DIF_BOXCOLOR              = 0x0000000000000200UL,
147     DIF_GROUP                 = 0x0000000000000400UL,
148     DIF_LEFTTEXT              = 0x0000000000000800UL,
149     DIF_MOVESELECT            = 0x0000000000001000UL,
150     DIF_SHOWAMPERSAND         = 0x0000000000002000UL,
151     DIF_CENTERGROUP           = 0x0000000000004000UL,
152     DIF_NOBRACKETS            = 0x0000000000008000UL,
153     DIF_MANUALADDHISTORY      = 0x0000000000008000UL,
154     DIF_SEPARATOR             = 0x0000000000010000UL,
155     DIF_SEPARATOR2            = 0x0000000000020000UL,
156     DIF_EDITOR                = 0x0000000000020000UL,
157     DIF_LISTNOAMPERSAND       = 0x0000000000020000UL,
158     DIF_LISTNOBOX             = 0x0000000000040000UL,
159     DIF_HISTORY               = 0x0000000000040000UL,
160     DIF_BTNNOCLOSE            = 0x0000000000040000UL,
161     DIF_CENTERTEXT            = 0x0000000000040000UL,
162     DIF_SEPARATORUSER         = 0x0000000000080000UL,
163     DIF_SETSHIELD             = 0x0000000000080000UL,
164     DIF_EDITEXPAND            = 0x0000000000080000UL,
165     DIF_DROPDOWNLIST          = 0x0000000000100000UL,
166     DIF_USELASTHISTORY        = 0x0000000000200000UL,
167     DIF_MASKEDIT              = 0x0000000000400000UL,
168     DIF_LISTTRACKMOUSE        = 0x0000000000400000UL,
169     DIF_LISTTRACKMOUSEINFOCUS = 0x0000000000800000UL,
170     DIF_SELECTONENTRY         = 0x0000000000800000UL,
171     DIF_3STATE                = 0x0000000000800000UL,
172     DIF_EDITPATH              = 0x0000000001000000UL,
173     DIF_LISTWRAPMODE          = 0x0000000001000000UL,
174     DIF_NOAUTOCOMPLETE        = 0x0000000002000000UL,
175     DIF_LISTAUTOHIGHLIGHT     = 0x0000000002000000UL,
176     DIF_LISTNOCLOSE           = 0x0000000004000000UL,
177     DIF_EDITPATHEXEC          = 0x0000000004000000UL,
178     DIF_HIDDEN                = 0x0000000010000000UL,
179     DIF_READONLY              = 0x0000000020000000UL,
180     DIF_NOFOCUS               = 0x0000000040000000UL,
181     DIF_DISABLE               = 0x0000000080000000UL,
182     DIF_DEFAULTBUTTON         = 0x0000000100000000UL,
183     DIF_FOCUS                 = 0x0000000200000000UL,
184     DIF_RIGHTTEXT             = 0x0000000400000000UL,
185     DIF_WORDWRAP              = 0x0000000800000000UL,
186     DIF_NONE                  = 0UL;
187 
188 enum FARMESSAGE
189 {
190     DM_FIRST                        = 0,
191     DM_CLOSE                        = 1,
192     DM_ENABLE                       = 2,
193     DM_ENABLEREDRAW                 = 3,
194     DM_GETDLGDATA                   = 4,
195     DM_GETDLGITEM                   = 5,
196     DM_GETDLGRECT                   = 6,
197     DM_GETTEXT                      = 7,
198     DM_KEY                          = 9,
199     DM_MOVEDIALOG                   = 10,
200     DM_SETDLGDATA                   = 11,
201     DM_SETDLGITEM                   = 12,
202     DM_SETFOCUS                     = 13,
203     DM_REDRAW                       = 14,
204     DM_SETTEXT                      = 15,
205     DM_SETMAXTEXTLENGTH             = 16,
206     DM_SHOWDIALOG                   = 17,
207     DM_GETFOCUS                     = 18,
208     DM_GETCURSORPOS                 = 19,
209     DM_SETCURSORPOS                 = 20,
210     DM_SETTEXTPTR                   = 22,
211     DM_SHOWITEM                     = 23,
212     DM_ADDHISTORY                   = 24,
213 
214     DM_GETCHECK                     = 25,
215     DM_SETCHECK                     = 26,
216     DM_SET3STATE                    = 27,
217 
218     DM_LISTSORT                     = 28,
219     DM_LISTGETITEM                  = 29,
220     DM_LISTGETCURPOS                = 30,
221     DM_LISTSETCURPOS                = 31,
222     DM_LISTDELETE                   = 32,
223     DM_LISTADD                      = 33,
224     DM_LISTADDSTR                   = 34,
225     DM_LISTUPDATE                   = 35,
226     DM_LISTINSERT                   = 36,
227     DM_LISTFINDSTRING               = 37,
228     DM_LISTINFO                     = 38,
229     DM_LISTGETDATA                  = 39,
230     DM_LISTSETDATA                  = 40,
231     DM_LISTSETTITLES                = 41,
232     DM_LISTGETTITLES                = 42,
233 
234     DM_RESIZEDIALOG                 = 43,
235     DM_SETITEMPOSITION              = 44,
236 
237     DM_GETDROPDOWNOPENED            = 45,
238     DM_SETDROPDOWNOPENED            = 46,
239 
240     DM_SETHISTORY                   = 47,
241 
242     DM_GETITEMPOSITION              = 48,
243     DM_SETINPUTNOTIFY               = 49,
244     DM_SETMOUSEEVENTNOTIFY          = DM_SETINPUTNOTIFY,
245 
246     DM_EDITUNCHANGEDFLAG            = 50,
247 
248     DM_GETITEMDATA                  = 51,
249     DM_SETITEMDATA                  = 52,
250 
251     DM_LISTSET                      = 53,
252 
253     DM_GETCURSORSIZE                = 54,
254     DM_SETCURSORSIZE                = 55,
255 
256     DM_LISTGETDATASIZE              = 56,
257 
258     DM_GETSELECTION                 = 57,
259     DM_SETSELECTION                 = 58,
260 
261     DM_GETEDITPOSITION              = 59,
262     DM_SETEDITPOSITION              = 60,
263 
264     DM_SETCOMBOBOXEVENT             = 61,
265     DM_GETCOMBOBOXEVENT             = 62,
266 
267     DM_GETCONSTTEXTPTR              = 63,
268     DM_GETDLGITEMSHORT              = 64,
269     DM_SETDLGITEMSHORT              = 65,
270 
271     DM_GETDIALOGINFO                = 66,
272 
273     DM_GETDIALOGTITLE               = 67,
274 
275     DN_FIRST                        = 4096,
276     DN_BTNCLICK                     = 4097,
277     DN_CTLCOLORDIALOG               = 4098,
278     DN_CTLCOLORDLGITEM              = 4099,
279     DN_CTLCOLORDLGLIST              = 4100,
280     DN_DRAWDIALOG                   = 4101,
281     DN_DRAWDLGITEM                  = 4102,
282     DN_EDITCHANGE                   = 4103,
283     DN_ENTERIDLE                    = 4104,
284     DN_GOTFOCUS                     = 4105,
285     DN_HELP                         = 4106,
286     DN_HOTKEY                       = 4107,
287     DN_INITDIALOG                   = 4108,
288     DN_KILLFOCUS                    = 4109,
289     DN_LISTCHANGE                   = 4110,
290     DN_DRAGGED                      = 4111,
291     DN_RESIZECONSOLE                = 4112,
292     DN_DRAWDIALOGDONE               = 4113,
293     DN_LISTHOTKEY                   = 4114,
294     DN_INPUT                        = 4115,
295     DN_CONTROLINPUT                 = 4116,
296     DN_CLOSE                        = 4117,
297     DN_GETVALUE                     = 4118,
298     DN_DROPDOWNOPENED               = 4119,
299     DN_DRAWDLGITEMDONE              = 4120,
300 
301     DM_USER                         = 0x4000,
302 }
303 
304 enum FARCHECKEDSTATE
305 {
306     BSTATE_UNCHECKED = 0,
307     BSTATE_CHECKED   = 1,
308     BSTATE_3STATE    = 2,
309     BSTATE_TOGGLE    = 3,
310 }
311 
312 enum FARCOMBOBOXEVENTTYPE
313 {
314     CBET_KEY         = 0x00000001,
315     CBET_MOUSE       = 0x00000002,
316 }
317 
318 alias ulong LISTITEMFLAGS;
319 const LISTITEMFLAGS
320     LIF_SELECTED           = 0x0000000000010000UL,
321     LIF_CHECKED            = 0x0000000000020000UL,
322     LIF_SEPARATOR          = 0x0000000000040000UL,
323     LIF_DISABLE            = 0x0000000000080000UL,
324     LIF_GRAYED             = 0x0000000000100000UL,
325     LIF_HIDDEN             = 0x0000000000200000UL,
326     LIF_DELETEUSERDATA     = 0x0000000080000000UL,
327     LIF_NONE               = 0UL;
328 
329 struct FarListItem
330 {
331     LISTITEMFLAGS Flags;
332     const(wchar)* Text;
333     intptr_t[2] Reserved;
334 }
335 
336 struct FarListUpdate
337 {
338     size_t StructSize;
339     intptr_t Index;
340     FarListItem Item;
341 }
342 
343 struct FarListInsert
344 {
345     size_t StructSize;
346     intptr_t Index;
347     FarListItem Item;
348 }
349 
350 struct FarListGetItem
351 {
352     size_t StructSize;
353     intptr_t ItemIndex;
354     FarListItem Item;
355 }
356 
357 struct FarListPos
358 {
359     size_t StructSize;
360     intptr_t SelectPos;
361     intptr_t TopPos;
362 }
363 
364 alias ulong FARLISTFINDFLAGS;
365 const FARLISTFINDFLAGS
366     LIFIND_EXACTMATCH = 0x0000000000000001UL,
367     LIFIND_NONE       = 0UL;
368 
369 struct FarListFind
370 {
371     size_t StructSize;
372     intptr_t StartIndex;
373     const(wchar)* Pattern;
374     FARLISTFINDFLAGS Flags;
375 }
376 
377 struct FarListDelete
378 {
379     size_t StructSize;
380     intptr_t StartIndex;
381     intptr_t Count;
382 }
383 
384 alias ulong FARLISTINFOFLAGS;
385 const FARLISTINFOFLAGS
386     LINFO_SHOWNOBOX             = 0x0000000000000400UL,
387     LINFO_AUTOHIGHLIGHT         = 0x0000000000000800UL,
388     LINFO_REVERSEHIGHLIGHT      = 0x0000000000001000UL,
389     LINFO_WRAPMODE              = 0x0000000000008000UL,
390     LINFO_SHOWAMPERSAND         = 0x0000000000010000UL,
391     LINFO_NONE                  = 0UL;
392 
393 struct FarListInfo
394 {
395     size_t StructSize;
396     FARLISTINFOFLAGS Flags;
397     size_t ItemsNumber;
398     intptr_t SelectPos;
399     intptr_t TopPos;
400     intptr_t MaxHeight;
401     intptr_t MaxLength;
402 }
403 
404 struct FarListItemData
405 {
406     size_t StructSize;
407     intptr_t Index;
408     size_t DataSize;
409     void* Data;
410 }
411 
412 struct FarList
413 {
414     size_t StructSize;
415     size_t ItemsNumber;
416     FarListItem* Items;
417 }
418 
419 struct FarListTitles
420 {
421     size_t StructSize;
422     size_t TitleSize;
423     const(wchar)* Title;
424     size_t BottomSize;
425     const(wchar)* Bottom;
426 }
427 
428 struct FarDialogItemColors
429 {
430     size_t StructSize;
431     ulong Flags;
432     size_t ColorsCount;
433     FarColor* Colors;
434 }
435 
436 struct FAR_CHAR_INFO
437 {
438     wchar Char;
439     FarColor Attributes;
440 
441     static FAR_CHAR_INFO make(wchar Char, in FarColor Attributes)
442     {
443         return FAR_CHAR_INFO(Char, cast(FarColor) Attributes);
444     }
445 }
446 
447 struct FarDialogItem
448 {
449     FARDIALOGITEMTYPES Type;
450     intptr_t X1,Y1,X2,Y2;
451     union
452     {
453         intptr_t Selected;
454         FarList* ListItems;
455         FAR_CHAR_INFO* VBuf;
456         intptr_t Reserved0;
457     }
458     const(wchar)* History;
459     const(wchar)* Mask;
460     FARDIALOGITEMFLAGS Flags;
461     const(wchar)* Data;
462     size_t MaxLength; // terminate 0 not included (if == 0 string size is unlimited)
463     intptr_t UserData;
464     intptr_t[2] Reserved;
465 }
466 
467 struct FarDialogItemData
468 {
469     size_t StructSize;
470     size_t PtrLength;
471     wchar* PtrData;
472 }
473 
474 struct FarDialogEvent
475 {
476     size_t StructSize;
477     HANDLE hDlg;
478     intptr_t Msg;
479     intptr_t Param1;
480     void* Param2;
481     intptr_t Result;
482 }
483 
484 struct OpenDlgPluginData
485 {
486     size_t StructSize;
487     HANDLE hDlg;
488 }
489 
490 struct DialogInfo
491 {
492     size_t StructSize;
493     GUID Id;
494     GUID Owner;
495 }
496 
497 struct FarGetDialogItem
498 {
499     size_t StructSize;
500     size_t Size;
501     FarDialogItem* Item;
502 }
503 
504 alias ulong FARDIALOGFLAGS;
505 const FARDIALOGFLAGS
506     FDLG_WARNING             = 0x0000000000000001UL,
507     FDLG_SMALLDIALOG         = 0x0000000000000002UL,
508     FDLG_NODRAWSHADOW        = 0x0000000000000004UL,
509     FDLG_NODRAWPANEL         = 0x0000000000000008UL,
510     FDLG_KEEPCONSOLETITLE    = 0x0000000000000010UL,
511     FDLG_NONE                = 0UL;
512 
513 alias extern (Windows) intptr_t function(HANDLE hDlg, intptr_t Msg, intptr_t Param1, void* Param2)FARWINDOWPROC;
514 
515 alias extern (Windows) intptr_t function(HANDLE hDlg, intptr_t Msg, intptr_t Param1, void* Param2)FARAPISENDDLGMESSAGE;
516 
517 alias extern (Windows) intptr_t function(HANDLE hDlg, intptr_t Msg, intptr_t Param1, void* Param2)FARAPIDEFDLGPROC;
518 
519 alias extern (Windows) HANDLE function(
520     in GUID* PluginId,
521     in GUID* Id,
522     intptr_t X1,
523     intptr_t Y1,
524     intptr_t X2,
525     intptr_t Y2,
526     in wchar* HelpTopic,
527     in FarDialogItem* Item,
528     size_t ItemsNumber,
529     intptr_t Reserved,
530     FARDIALOGFLAGS Flags,
531     FARWINDOWPROC DlgProc,
532     void* Param) FARAPIDIALOGINIT;
533 
534 alias extern (Windows) intptr_t function(HANDLE hDlg)FARAPIDIALOGRUN;
535 
536 alias extern (Windows) void function(HANDLE hDlg)FARAPIDIALOGFREE;
537 
538 struct FarKey
539 {
540     WORD VirtualKeyCode;
541     DWORD ControlKeyState;
542 }
543 
544 alias ulong MENUITEMFLAGS;
545 const MENUITEMFLAGS
546     MIF_SELECTED   = 0x000000000010000UL,
547     MIF_CHECKED    = 0x000000000020000UL,
548     MIF_SEPARATOR  = 0x000000000040000UL,
549     MIF_DISABLE    = 0x000000000080000UL,
550     MIF_GRAYED     = 0x000000000100000UL,
551     MIF_HIDDEN     = 0x000000000200000UL,
552     MIF_NONE       = 0UL;
553 
554 struct FarMenuItem
555 {
556     MENUITEMFLAGS Flags;
557     const(wchar)* Text;
558     FarKey AccelKey;
559     intptr_t UserData;
560     intptr_t[2] Reserved;
561 }
562 
563 alias ulong FARMENUFLAGS;
564 const FARMENUFLAGS
565     FMENU_SHOWAMPERSAND        = 0x0000000000000001UL,
566     FMENU_WRAPMODE             = 0x0000000000000002UL,
567     FMENU_AUTOHIGHLIGHT        = 0x0000000000000004UL,
568     FMENU_REVERSEAUTOHIGHLIGHT = 0x0000000000000008UL,
569     FMENU_CHANGECONSOLETITLE   = 0x0000000000000010UL,
570     FMENU_NONE                 = 0UL;
571 
572 alias extern (Windows) intptr_t function(
573     in GUID* PluginId,
574     in GUID* Id,
575     intptr_t X,
576     intptr_t Y,
577     intptr_t MaxHeight,
578     const FARMENUFLAGS Flags,
579     in wchar* Title,
580     in wchar* Bottom,
581     in wchar* HelpTopic,
582     in FarKey* BreakKeys,
583     intptr_t* BreakCode,
584     in FarMenuItem* Item,
585     size_t ItemsNumber) FARAPIMENU;
586 
587 alias ulong PLUGINPANELITEMFLAGS;
588 const PLUGINPANELITEMFLAGS
589     PPIF_SELECTED               = 0x0000000040000000UL,
590     PPIF_PROCESSDESCR           = 0x0000000080000000UL,
591     PPIF_NONE                   = 0UL;
592 
593 struct FarPanelItemFreeInfo
594 {
595     size_t StructSize;
596     HANDLE hPlugin;
597 }
598 
599 alias extern (Windows) void function(
600     void* UserData,
601     in FarPanelItemFreeInfo* Info) FARPANELITEMFREECALLBACK;
602 
603 struct UserDataItem
604 {
605     void* Data;
606     FARPANELITEMFREECALLBACK FreeData;
607 }
608 
609 struct PluginPanelItem
610 {
611     FILETIME CreationTime;
612     FILETIME LastAccessTime;
613     FILETIME LastWriteTime;
614     FILETIME ChangeTime;
615     ulong FileSize;
616     ulong AllocationSize;
617     const(wchar)* FileName;
618     const(wchar)* AlternateFileName;
619     const(wchar)* Description;
620     const(wchar)* Owner;
621     const(wchar*)* CustomColumnData;
622     size_t CustomColumnNumber;
623     PLUGINPANELITEMFLAGS Flags;
624     UserDataItem UserData;
625     uintptr_t FileAttributes;
626     uintptr_t NumberOfLinks;
627     uintptr_t CRC32;
628     intptr_t[2] Reserved;
629 }
630 
631 struct FarGetPluginPanelItem
632 {
633     size_t StructSize;
634     size_t Size;
635     PluginPanelItem* Item;
636 }
637 
638 struct SortingPanelItem
639 {
640 	FILETIME CreationTime;
641 	FILETIME LastAccessTime;
642 	FILETIME LastWriteTime;
643 	FILETIME ChangeTime;
644 	ulong FileSize;
645 	ulong AllocationSize;
646 	const(wchar)* FileName;
647 	const(wchar)* AlternateFileName;
648 	const(wchar)* Description;
649 	const(wchar)* Owner;
650 	const(wchar*)* CustomColumnData;
651 	size_t CustomColumnNumber;
652 	PLUGINPANELITEMFLAGS Flags;
653 	UserDataItem UserData;
654 	uintptr_t FileAttributes;
655 	uintptr_t NumberOfLinks;
656 	uintptr_t CRC32;
657 	intptr_t Position;
658 	intptr_t SortGroup;
659 	uintptr_t NumberOfStreams;
660 	ulong StreamsSize;
661 }
662 
663 alias ulong PANELINFOFLAGS;
664 const PANELINFOFLAGS
665     PFLAGS_SHOWHIDDEN         = 0x0000000000000001UL,
666     PFLAGS_HIGHLIGHT          = 0x0000000000000002UL,
667     PFLAGS_REVERSESORTORDER   = 0x0000000000000004UL,
668     PFLAGS_USESORTGROUPS      = 0x0000000000000008UL,
669     PFLAGS_SELECTEDFIRST      = 0x0000000000000010UL,
670     PFLAGS_REALNAMES          = 0x0000000000000020UL,
671     PFLAGS_NUMERICSORT        = 0x0000000000000040UL,
672     PFLAGS_PANELLEFT          = 0x0000000000000080UL,
673     PFLAGS_DIRECTORIESFIRST   = 0x0000000000000100UL,
674     PFLAGS_USECRC32           = 0x0000000000000200UL,
675     PFLAGS_CASESENSITIVESORT  = 0x0000000000000400UL,
676     PFLAGS_PLUGIN             = 0x0000000000000800UL,
677     PFLAGS_VISIBLE            = 0x0000000000001000UL,
678     PFLAGS_FOCUS              = 0x0000000000002000UL,
679     PFLAGS_ALTERNATIVENAMES   = 0x0000000000004000UL,
680     PFLAGS_SHORTCUT           = 0x0000000000008000UL,
681     PFLAGS_NONE               = 0UL;
682 
683 enum PANELINFOTYPE
684 {
685     PTYPE_FILEPANEL                 = 0,
686     PTYPE_TREEPANEL                 = 1,
687     PTYPE_QVIEWPANEL                = 2,
688     PTYPE_INFOPANEL                 = 3,
689 }
690 
691 enum OPENPANELINFO_SORTMODES
692 {
693     SM_DEFAULT                   =  0,
694     SM_UNSORTED                  =  1,
695     SM_NAME                      =  2,
696     SM_EXT                       =  3,
697     SM_MTIME                     =  4,
698     SM_CTIME                     =  5,
699     SM_ATIME                     =  6,
700     SM_SIZE                      =  7,
701     SM_DESCR                     =  8,
702     SM_OWNER                     =  9,
703     SM_COMPRESSEDSIZE            = 10,
704     SM_NUMLINKS                  = 11,
705     SM_NUMSTREAMS                = 12,
706     SM_STREAMSSIZE               = 13,
707     SM_FULLNAME                  = 14,
708     SM_CHTIME                    = 15,
709 }
710 
711 struct PanelInfo
712 {
713     size_t StructSize;
714     HANDLE PluginHandle;
715     GUID OwnerGuid;
716     PANELINFOFLAGS Flags;
717     size_t ItemsNumber;
718     size_t SelectedItemsNumber;
719     RECT PanelRect;
720     size_t CurrentItem;
721     size_t TopPanelItem;
722     intptr_t ViewMode;
723     PANELINFOTYPE PanelType;
724     OPENPANELINFO_SORTMODES SortMode;
725 }
726 
727 struct PanelRedrawInfo
728 {
729     size_t StructSize;
730     size_t CurrentItem;
731     size_t TopPanelItem;
732 }
733 
734 struct CmdLineSelect
735 {
736     size_t StructSize;
737     intptr_t SelStart;
738     intptr_t SelEnd;
739 }
740 
741 struct FarPanelDirectory
742 {
743     size_t StructSize;
744     const(wchar)* Name;
745     const(wchar)* Param;
746     GUID PluginId;
747     const(wchar)* File;
748 }
749 
750 const PANEL_NONE = cast(HANDLE)-1;
751 const PANEL_ACTIVE = cast(HANDLE)-1;
752 const PANEL_PASSIVE = cast(HANDLE)-2;
753 const PANEL_STOP = cast(HANDLE)-1;
754 
755 enum FILE_CONTROL_COMMANDS
756 {
757     FCTL_CLOSEPANEL                 = 0,
758     FCTL_GETPANELINFO               = 1,
759     FCTL_UPDATEPANEL                = 2,
760     FCTL_REDRAWPANEL                = 3,
761     FCTL_GETCMDLINE                 = 4,
762     FCTL_SETCMDLINE                 = 5,
763     FCTL_SETSELECTION               = 6,
764     FCTL_SETVIEWMODE                = 7,
765     FCTL_INSERTCMDLINE              = 8,
766     FCTL_SETUSERSCREEN              = 9,
767     FCTL_SETPANELDIRECTORY          = 10,
768     FCTL_SETCMDLINEPOS              = 11,
769     FCTL_GETCMDLINEPOS              = 12,
770     FCTL_SETSORTMODE                = 13,
771     FCTL_SETSORTORDER               = 14,
772     FCTL_SETCMDLINESELECTION        = 15,
773     FCTL_GETCMDLINESELECTION        = 16,
774     FCTL_CHECKPANELSEXIST           = 17,
775     FCTL_SETNUMERICSORT             = 18,
776     FCTL_GETUSERSCREEN              = 19,
777     FCTL_ISACTIVEPANEL              = 20,
778     FCTL_GETPANELITEM               = 21,
779     FCTL_GETSELECTEDPANELITEM       = 22,
780     FCTL_GETCURRENTPANELITEM        = 23,
781     FCTL_GETPANELDIRECTORY          = 24,
782     FCTL_GETCOLUMNTYPES             = 25,
783     FCTL_GETCOLUMNWIDTHS            = 26,
784     FCTL_BEGINSELECTION             = 27,
785     FCTL_ENDSELECTION               = 28,
786     FCTL_CLEARSELECTION             = 29,
787     FCTL_SETDIRECTORIESFIRST        = 30,
788     FCTL_GETPANELFORMAT             = 31,
789     FCTL_GETPANELHOSTFILE           = 32,
790     FCTL_SETCASESENSITIVESORT       = 33,
791     FCTL_GETPANELPREFIX             = 34,
792     FCTL_SETACTIVEPANEL             = 35,
793 }
794 
795 alias extern (Windows) void function(
796     intptr_t X,
797     intptr_t Y,
798     in FarColor* Color,
799     in wchar* Str) FARAPITEXT;
800 
801 alias extern (Windows) HANDLE function(intptr_t X1, intptr_t Y1, intptr_t X2, intptr_t Y2)FARAPISAVESCREEN;
802 
803 alias extern (Windows) void function(HANDLE hScreen)FARAPIRESTORESCREEN;
804 
805 alias extern (Windows) intptr_t function(
806     in wchar* Dir,
807     PluginPanelItem** pPanelItem,
808     size_t* pItemsNumber) FARAPIGETDIRLIST;
809 
810 alias extern (Windows) intptr_t function(
811     in GUID* PluginId,
812     HANDLE hPanel,
813     in wchar* Dir,
814     PluginPanelItem** pPanelItem,
815     size_t* pItemsNumber) FARAPIGETPLUGINDIRLIST;
816 
817 alias extern (Windows) void function(PluginPanelItem* PanelItem, size_t nItemsNumber)FARAPIFREEDIRLIST;
818 
819 alias extern (Windows) void function(HANDLE hPanel, PluginPanelItem* PanelItem, size_t nItemsNumber)FARAPIFREEPLUGINDIRLIST;
820 
821 alias ulong VIEWER_FLAGS;
822 const VIEWER_FLAGS
823     VF_NONMODAL              = 0x0000000000000001UL,
824     VF_DELETEONCLOSE         = 0x0000000000000002UL,
825     VF_ENABLE_F6             = 0x0000000000000004UL,
826     VF_DISABLEHISTORY        = 0x0000000000000008UL,
827     VF_IMMEDIATERETURN       = 0x0000000000000100UL,
828     VF_DELETEONLYFILEONCLOSE = 0x0000000000000200UL,
829     VF_NONE                  = 0UL;
830 
831 alias extern (Windows) intptr_t function(
832     in wchar* FileName,
833     in wchar* Title,
834     intptr_t X1,
835     intptr_t Y1,
836     intptr_t X2,
837     intptr_t Y2,
838     VIEWER_FLAGS Flags,
839     uintptr_t CodePage) FARAPIVIEWER;
840 
841 alias ulong EDITOR_FLAGS;
842 const EDITOR_FLAGS
843     EF_NONMODAL              = 0x0000000000000001UL,
844     EF_CREATENEW             = 0x0000000000000002UL,
845     EF_ENABLE_F6             = 0x0000000000000004UL,
846     EF_DISABLEHISTORY        = 0x0000000000000008UL,
847     EF_DELETEONCLOSE         = 0x0000000000000010UL,
848     EF_IMMEDIATERETURN       = 0x0000000000000100UL,
849     EF_DELETEONLYFILEONCLOSE = 0x0000000000000200UL,
850     EF_LOCKED                = 0x0000000000000400UL,
851     EF_DISABLESAVEPOS        = 0x0000000000000800UL,
852     EF_OPENMODE_MASK         = 0x00000000F0000000UL,
853     EF_OPENMODE_QUERY        = 0x0000000000000000UL,
854     EF_OPENMODE_NEWIFOPEN    = 0x0000000010000000UL,
855     EF_OPENMODE_USEEXISTING  = 0x0000000020000000UL,
856     EF_OPENMODE_BREAKIFOPEN  = 0x0000000030000000UL,
857     EF_OPENMODE_RELOADIFOPEN = 0x0000000040000000UL,
858     EN_NONE                  = 0UL;
859 
860 enum EDITOR_EXITCODE
861 {
862     EEC_OPEN_ERROR          = 0,
863     EEC_MODIFIED            = 1,
864     EEC_NOT_MODIFIED        = 2,
865     EEC_LOADING_INTERRUPTED = 3,
866 }
867 
868 alias extern (Windows) intptr_t function(
869     in wchar* FileName,
870     in wchar* Title,
871     intptr_t X1,
872     intptr_t Y1,
873     intptr_t X2,
874     intptr_t Y2,
875     EDITOR_FLAGS Flags,
876     int StartLine,
877     int StartChar,
878     uintptr_t CodePage) FARAPIEDITOR;
879 
880 alias extern (Windows) const(wchar)* function(
881     in GUID* PluginId,
882     intptr_t MsgId) FARAPIGETMSG;
883 
884 alias ulong FARHELPFLAGS;
885 const FARHELPFLAGS
886     FHELP_NOSHOWERROR = 0x0000000080000000UL,
887     FHELP_SELFHELP    = 0x0000000000000000UL,
888     FHELP_FARHELP     = 0x0000000000000001UL,
889     FHELP_CUSTOMFILE  = 0x0000000000000002UL,
890     FHELP_CUSTOMPATH  = 0x0000000000000004UL,
891     FHELP_GUID        = 0x0000000000000008UL,
892     FHELP_USECONTENTS = 0x0000000040000000UL,
893     FHELP_NONE        = 0UL;
894 
895 alias extern (Windows) BOOL function(
896     in wchar* ModuleName,
897     in wchar* Topic,
898     FARHELPFLAGS Flags) FARAPISHOWHELP;
899 
900 enum ADVANCED_CONTROL_COMMANDS
901 {
902     ACTL_GETFARMANAGERVERSION       = 0,
903     ACTL_WAITKEY                    = 2,
904     ACTL_GETCOLOR                   = 3,
905     ACTL_GETARRAYCOLOR              = 4,
906     ACTL_GETWINDOWINFO              = 6,
907     ACTL_GETWINDOWCOUNT             = 7,
908     ACTL_SETCURRENTWINDOW           = 8,
909     ACTL_COMMIT                     = 9,
910     ACTL_GETFARHWND                 = 10,
911     ACTL_SETARRAYCOLOR              = 16,
912     ACTL_REDRAWALL                  = 19,
913     ACTL_SYNCHRO                    = 20,
914     ACTL_SETPROGRESSSTATE           = 21,
915     ACTL_SETPROGRESSVALUE           = 22,
916     ACTL_QUIT                       = 23,
917     ACTL_GETFARRECT                 = 24,
918     ACTL_GETCURSORPOS               = 25,
919     ACTL_SETCURSORPOS               = 26,
920     ACTL_PROGRESSNOTIFY             = 27,
921     ACTL_GETWINDOWTYPE              = 28,
922 }
923 
924 enum FAR_MACRO_CONTROL_COMMANDS
925 {
926     MCTL_LOADALL           = 0,
927     MCTL_SAVEALL           = 1,
928     MCTL_SENDSTRING        = 2,
929     MCTL_GETSTATE          = 5,
930     MCTL_GETAREA           = 6,
931     MCTL_ADDMACRO          = 7,
932     MCTL_DELMACRO          = 8,
933     MCTL_GETLASTERROR      = 9,
934     MCTL_EXECSTRING        = 10,
935 }
936 
937 alias ulong FARKEYMACROFLAGS;
938 const FARKEYMACROFLAGS
939     KMFLAGS_SILENTCHECK         = 0x0000000000000001UL,
940     KMFLAGS_NOSENDKEYSTOPLUGINS = 0x0000000000000002UL,
941     KMFLAGS_ENABLEOUTPUT        = 0x0000000000000004UL,
942     KMFLAGS_LANGMASK            = 0x0000000000000070UL, // 3 bits reserved for 8 languages
943     KMFLAGS_LUA                 = 0x0000000000000000UL,
944     KMFLAGS_MOONSCRIPT          = 0x0000000000000010UL,
945     KMFLAGS_NONE                = 0UL;
946 
947 enum FARMACROSENDSTRINGCOMMAND
948 {
949     MSSC_POST              =0,
950     MSSC_CHECK             =2,
951 }
952 
953 enum FARMACROAREA
954 {
955     MACROAREA_OTHER                      =   0,   // Mode of copying text from the screen; vertical menus
956     MACROAREA_SHELL                      =   1,   // File panels
957     MACROAREA_VIEWER                     =   2,   // Internal viewer program
958     MACROAREA_EDITOR                     =   3,   // Editor
959     MACROAREA_DIALOG                     =   4,   // Dialogs
960     MACROAREA_SEARCH                     =   5,   // Quick search in panels
961     MACROAREA_DISKS                      =   6,   // Menu of disk selection
962     MACROAREA_MAINMENU                   =   7,   // Main menu
963     MACROAREA_MENU                       =   8,   // Other menus
964     MACROAREA_HELP                       =   9,   // Help system
965     MACROAREA_INFOPANEL                  =  10,   // Info panel
966     MACROAREA_QVIEWPANEL                 =  11,   // Quick view panel
967     MACROAREA_TREEPANEL                  =  12,   // Folders tree panel
968     MACROAREA_FINDFOLDER                 =  13,   // Find folder
969     MACROAREA_USERMENU                   =  14,   // User menu
970     MACROAREA_SHELLAUTOCOMPLETION        =  15,   // Autocompletion list in command line
971     MACROAREA_DIALOGAUTOCOMPLETION       =  16,   // Autocompletion list in dialogs
972 
973     MACROAREA_COMMON                     = 255,
974 }
975 
976 enum FARMACROSTATE
977 {
978     MACROSTATE_NOMACRO          = 0,
979     MACROSTATE_EXECUTING        = 1,
980     MACROSTATE_EXECUTING_COMMON = 2,
981     MACROSTATE_RECORDING        = 3,
982     MACROSTATE_RECORDING_COMMON = 4,
983 }
984 
985 enum FARMACROPARSEERRORCODE
986 {
987     MPEC_SUCCESS = 0,
988     MPEC_ERROR   = 1,
989 }
990 
991 struct MacroParseResult
992 {
993     size_t StructSize;
994     DWORD ErrCode;
995     COORD ErrPos;
996     const(wchar)* ErrSrc;
997 }
998 
999 struct MacroSendMacroText
1000 {
1001     size_t StructSize;
1002     FARKEYMACROFLAGS Flags;
1003     INPUT_RECORD AKey;
1004     const(wchar)* SequenceText;
1005 }
1006 
1007 alias ulong FARADDKEYMACROFLAGS;
1008 const FARADDKEYMACROFLAGS AKMFLAGS_NONE = 0UL;
1009 
1010 alias extern (Windows) intptr_t function(void* Id, FARADDKEYMACROFLAGS Flags)FARMACROCALLBACK;
1011 
1012 struct MacroAddMacro
1013 {
1014     size_t StructSize;
1015     void* Id;
1016     const(wchar)* SequenceText;
1017     const(wchar)* Description;
1018     FARKEYMACROFLAGS Flags;
1019     INPUT_RECORD AKey;
1020     FARMACROAREA Area;
1021     FARMACROCALLBACK Callback;
1022 }
1023 
1024 enum FARMACROVARTYPE
1025 {
1026     FMVT_UNKNOWN                = 0,
1027     FMVT_INTEGER                = 1,
1028     FMVT_STRING                 = 2,
1029     FMVT_DOUBLE                 = 3,
1030     FMVT_BOOLEAN                = 4,
1031     FMVT_BINARY                 = 5,
1032     FMVT_POINTER                = 6,
1033     FMVT_NIL                    = 7,
1034     FMVT_ARRAY                  = 8,
1035     FMVT_PANEL                  = 9,
1036 }
1037 
1038 struct FarMacroValueBinary
1039 {
1040     void* Data;
1041     size_t Size;
1042 }
1043 
1044 struct FarMacroValueArray
1045 {
1046     FarMacroValue* Values;
1047     size_t Count;
1048 }
1049 
1050 struct FarMacroValue
1051 {
1052     FARMACROVARTYPE Type = FARMACROVARTYPE.FMVT_NIL;
1053     union
1054     {
1055         long Integer;
1056         long Boolean;
1057         double Double;
1058         const(wchar)* String;
1059         void* Pointer;
1060         FarMacroValueBinary Binary;
1061         FarMacroValueArray Array;
1062     }
1063 
1064     this(int v)              { Type=FARMACROVARTYPE.FMVT_INTEGER; Integer=v; }
1065     this(uint v)             { Type=FARMACROVARTYPE.FMVT_INTEGER; Integer=v; }
1066     this(long v)             { Type=FARMACROVARTYPE.FMVT_INTEGER; Integer=v; }
1067     this(ulong v)            { Type=FARMACROVARTYPE.FMVT_INTEGER; Integer=v; }
1068     this(bool v)             { Type=FARMACROVARTYPE.FMVT_BOOLEAN; Boolean=v; }
1069     this(double v)           { Type=FARMACROVARTYPE.FMVT_DOUBLE; Double=v; }
1070     this(const(wchar)* v)  { Type=FARMACROVARTYPE.FMVT_STRING; String=v; }
1071     this(void* v)            { Type=FARMACROVARTYPE.FMVT_POINTER; Pointer=v; }
1072     this(ref const GUID v)   { Type=FARMACROVARTYPE.FMVT_BINARY; Binary.Data=cast(void*)&v; Binary.Size=GUID.sizeof; }
1073     this(FarMacroValue* arr,size_t count) { Type=FARMACROVARTYPE.FMVT_ARRAY; Array.Values=arr; Array.Count=count; }
1074 }
1075 
1076 struct FarMacroCall
1077 {
1078     size_t StructSize;
1079     size_t Count;
1080     FarMacroValue* Values;
1081     extern (Windows) void function(void* CallbackData, FarMacroValue* Values, size_t Count) Callback;
1082     void* CallbackData;
1083 }
1084 
1085 struct FarGetValue
1086 {
1087     size_t StructSize;
1088     intptr_t Type;
1089     FarMacroValue Value;
1090 }
1091 
1092 struct MacroExecuteString
1093 {
1094     size_t StructSize;
1095     FARKEYMACROFLAGS Flags;
1096     const(wchar)* SequenceText;
1097     size_t InCount;
1098     FarMacroValue* InValues;
1099     size_t OutCount;
1100     const(FarMacroValue)* OutValues;
1101 }
1102 
1103 struct FarMacroLoad
1104 {
1105 	size_t StructSize;
1106 	const(wchar)* Path;
1107 	ulong Flags;
1108 }
1109 
1110 alias ulong FARSETCOLORFLAGS;
1111 const FARSETCOLORFLAGS
1112     FSETCLR_REDRAW                 = 0x0000000000000001UL,
1113     FSETCLR_NONE                   = 0UL;
1114 
1115 struct FarSetColors
1116 {
1117     size_t StructSize;
1118     FARSETCOLORFLAGS Flags;
1119     size_t StartIndex;
1120     size_t ColorsCount;
1121     FarColor* Colors;
1122 }
1123 
1124 enum WINDOWINFO_TYPE
1125 {
1126     WTYPE_DESKTOP                   = 0,
1127     WTYPE_PANELS                    = 1,
1128     WTYPE_VIEWER                    = 2,
1129     WTYPE_EDITOR                    = 3,
1130     WTYPE_DIALOG                    = 4,
1131     WTYPE_VMENU                     = 5,
1132     WTYPE_HELP                      = 6,
1133 }
1134 
1135 alias ulong WINDOWINFO_FLAGS;
1136 const WINDOWINFO_FLAGS
1137     WIF_MODIFIED = 0x0000000000000001UL,
1138     WIF_CURRENT  = 0x0000000000000002UL,
1139     WIF_MODAL    = 0x0000000000000004UL;
1140 
1141 struct WindowInfo
1142 {
1143     size_t StructSize;
1144     intptr_t Id;
1145     wchar* TypeName;
1146     wchar* Name;
1147     intptr_t TypeNameSize;
1148     intptr_t NameSize;
1149     intptr_t Pos;
1150     WINDOWINFO_TYPE Type;
1151     WINDOWINFO_FLAGS Flags;
1152 }
1153 
1154 struct WindowType
1155 {
1156     size_t StructSize;
1157     WINDOWINFO_TYPE Type;
1158 }
1159 
1160 enum TASKBARPROGRESSTATE
1161 {
1162     TBPS_NOPROGRESS   =0x0,
1163     TBPS_INDETERMINATE=0x1,
1164     TBPS_NORMAL       =0x2,
1165     TBPS_ERROR        =0x4,
1166     TBPS_PAUSED       =0x8,
1167 }
1168 
1169 struct ProgressValue
1170 {
1171     size_t StructSize;
1172     ulong Completed;
1173     ulong Total;
1174 }
1175 
1176 enum VIEWER_CONTROL_COMMANDS
1177 {
1178     VCTL_GETINFO                    = 0,
1179     VCTL_QUIT                       = 1,
1180     VCTL_REDRAW                     = 2,
1181     VCTL_SETKEYBAR                  = 3,
1182     VCTL_SETPOSITION                = 4,
1183     VCTL_SELECT                     = 5,
1184     VCTL_SETMODE                    = 6,
1185     VCTL_GETFILENAME                = 7,
1186 }
1187 
1188 alias ulong VIEWER_OPTIONS;
1189 const VIEWER_OPTIONS
1190     VOPT_SAVEFILEPOSITION   = 0x0000000000000001UL,
1191     VOPT_AUTODETECTCODEPAGE = 0x0000000000000002UL,
1192     VOPT_NONE               = 0UL;
1193 
1194 enum VIEWER_SETMODE_TYPES
1195 {
1196     VSMT_VIEWMODE                   = 0,
1197     VSMT_WRAP                       = 1,
1198     VSMT_WORDWRAP                   = 2,
1199 }
1200 
1201 alias ulong VIEWER_SETMODEFLAGS_TYPES;
1202 const VIEWER_SETMODEFLAGS_TYPES VSMFL_REDRAW = 0x0000000000000001UL;
1203 
1204 struct ViewerSetMode
1205 {
1206     size_t StructSize;
1207     VIEWER_SETMODE_TYPES Type;
1208     union
1209     {
1210         intptr_t iParam;
1211         wchar* wszParam;
1212     }
1213     VIEWER_SETMODEFLAGS_TYPES Flags;
1214 }
1215 
1216 struct ViewerSelect
1217 {
1218     size_t StructSize;
1219     long BlockStartPos;
1220     long BlockLen;
1221 }
1222 
1223 alias ulong VIEWER_SETPOS_FLAGS;
1224 const VIEWER_SETPOS_FLAGS
1225     VSP_NOREDRAW    = 0x0000000000000001UL,
1226     VSP_PERCENT     = 0x0000000000000002UL,
1227     VSP_RELATIVE    = 0x0000000000000004UL,
1228     VSP_NORETNEWPOS = 0x0000000000000008UL;
1229 
1230 struct ViewerSetPosition
1231 {
1232     size_t StructSize;
1233     VIEWER_SETPOS_FLAGS Flags;
1234     long StartPos;
1235     long LeftPos;
1236 }
1237 
1238 alias ulong VIEWER_MODE_FLAGS;
1239 const VIEWER_MODE_FLAGS
1240     VMF_WRAP     = 0x0000000000000001UL,
1241     VMF_WORDWRAP = 0x0000000000000002UL;
1242 
1243 enum VIEWER_MODE_TYPE
1244 {
1245     VMT_TEXT    =0,
1246     VMT_HEX     =1,
1247     VMT_DUMP    =2,
1248 }
1249 
1250 struct ViewerMode
1251 {
1252     uintptr_t CodePage;
1253     VIEWER_MODE_FLAGS Flags;
1254     VIEWER_MODE_TYPE ViewMode;
1255 }
1256 
1257 struct ViewerInfo
1258 {
1259     size_t StructSize;
1260     intptr_t ViewerID;
1261     intptr_t TabSize;
1262     ViewerMode CurMode;
1263     long FileSize;
1264     long FilePos;
1265     long LeftPos;
1266     VIEWER_OPTIONS Options;
1267     intptr_t WindowSizeX;
1268     intptr_t WindowSizeY;
1269 }
1270 
1271 enum VIEWER_EVENTS
1272 {
1273     VE_READ       =0,
1274     VE_CLOSE      =1,
1275 
1276     VE_GOTFOCUS   =6,
1277     VE_KILLFOCUS  =7,
1278 }
1279 
1280 enum EDITOR_EVENTS
1281 {
1282     EE_READ       =0,
1283     EE_SAVE       =1,
1284     EE_REDRAW     =2,
1285     EE_CLOSE      =3,
1286 
1287     EE_GOTFOCUS   =6,
1288     EE_KILLFOCUS  =7,
1289     EE_CHANGE     =8,
1290 }
1291 
1292 enum DIALOG_EVENTS
1293 {
1294     DE_DLGPROCINIT    =0,
1295     DE_DEFDLGPROCINIT =1,
1296     DE_DLGPROCEND     =2,
1297 }
1298 
1299 enum SYNCHRO_EVENTS
1300 {
1301     SE_COMMONSYNCHRO  =0,
1302 }
1303 
1304 const EEREDRAW_ALL   = cast(void*)0;
1305 const CURRENT_EDITOR = -1;
1306 
1307 enum EDITOR_CONTROL_COMMANDS
1308 {
1309     ECTL_GETSTRING                  = 0,
1310     ECTL_SETSTRING                  = 1,
1311     ECTL_INSERTSTRING               = 2,
1312     ECTL_DELETESTRING               = 3,
1313     ECTL_DELETECHAR                 = 4,
1314     ECTL_INSERTTEXT                 = 5,
1315     ECTL_GETINFO                    = 6,
1316     ECTL_SETPOSITION                = 7,
1317     ECTL_SELECT                     = 8,
1318     ECTL_REDRAW                     = 9,
1319     ECTL_TABTOREAL                  = 10,
1320     ECTL_REALTOTAB                  = 11,
1321     ECTL_EXPANDTABS                 = 12,
1322     ECTL_SETTITLE                   = 13,
1323     ECTL_READINPUT                  = 14,
1324     ECTL_PROCESSINPUT               = 15,
1325     ECTL_ADDCOLOR                   = 16,
1326     ECTL_GETCOLOR                   = 17,
1327     ECTL_SAVEFILE                   = 18,
1328     ECTL_QUIT                       = 19,
1329     ECTL_SETKEYBAR                  = 20,
1330 
1331     ECTL_SETPARAM                   = 22,
1332     ECTL_GETBOOKMARKS               = 23,
1333     ECTL_DELETEBLOCK                = 25,
1334     ECTL_ADDSESSIONBOOKMARK         = 26,
1335     ECTL_PREVSESSIONBOOKMARK        = 27,
1336     ECTL_NEXTSESSIONBOOKMARK        = 28,
1337     ECTL_CLEARSESSIONBOOKMARKS      = 29,
1338     ECTL_DELETESESSIONBOOKMARK      = 30,
1339     ECTL_GETSESSIONBOOKMARKS        = 31,
1340     ECTL_UNDOREDO                   = 32,
1341     ECTL_GETFILENAME                = 33,
1342     ECTL_DELCOLOR                   = 34,
1343     ECTL_SUBSCRIBECHANGEEVENT       = 36,
1344     ECTL_UNSUBSCRIBECHANGEEVENT     = 37,
1345     ECTL_GETTITLE                   = 38,
1346 }
1347 
1348 enum EDITOR_SETPARAMETER_TYPES
1349 {
1350     ESPT_TABSIZE                    = 0,
1351     ESPT_EXPANDTABS                 = 1,
1352     ESPT_AUTOINDENT                 = 2,
1353     ESPT_CURSORBEYONDEOL            = 3,
1354     ESPT_CHARCODEBASE               = 4,
1355     ESPT_CODEPAGE                   = 5,
1356     ESPT_SAVEFILEPOSITION           = 6,
1357     ESPT_LOCKMODE                   = 7,
1358     ESPT_SETWORDDIV                 = 8,
1359     ESPT_GETWORDDIV                 = 9,
1360     ESPT_SHOWWHITESPACE             = 10,
1361     ESPT_SETBOM                     = 11,
1362 }
1363 
1364 struct EditorSetParameter
1365 {
1366     size_t StructSize;
1367     EDITOR_SETPARAMETER_TYPES Type;
1368     union
1369     {
1370         intptr_t iParam;
1371         wchar* wszParam;
1372         intptr_t Reserved;
1373     }
1374     ulong Flags;
1375     size_t Size;
1376 }
1377 
1378 enum EDITOR_UNDOREDO_COMMANDS
1379 {
1380     EUR_BEGIN                       = 0,
1381     EUR_END                         = 1,
1382     EUR_UNDO                        = 2,
1383     EUR_REDO                        = 3,
1384 }
1385 
1386 struct EditorUndoRedo
1387 {
1388     size_t StructSize;
1389     EDITOR_UNDOREDO_COMMANDS Command;
1390 }
1391 
1392 struct EditorGetString
1393 {
1394     size_t StructSize;
1395     intptr_t StringNumber;
1396     intptr_t StringLength;
1397     const(wchar)* StringText;
1398     const(wchar)* StringEOL;
1399     intptr_t SelStart;
1400     intptr_t SelEnd;
1401 }
1402 
1403 struct EditorSetString
1404 {
1405     size_t StructSize;
1406     intptr_t StringNumber;
1407     intptr_t StringLength;
1408     const(wchar)* StringText;
1409     const(wchar)* StringEOL;
1410 }
1411 
1412 enum EXPAND_TABS
1413 {
1414     EXPAND_NOTABS                   = 0,
1415     EXPAND_ALLTABS                  = 1,
1416     EXPAND_NEWTABS                  = 2,
1417 }
1418 
1419 enum EDITOR_OPTIONS
1420 {
1421     EOPT_EXPANDALLTABS     = 0x00000001,
1422     EOPT_PERSISTENTBLOCKS  = 0x00000002,
1423     EOPT_DELREMOVESBLOCKS  = 0x00000004,
1424     EOPT_AUTOINDENT        = 0x00000008,
1425     EOPT_SAVEFILEPOSITION  = 0x00000010,
1426     EOPT_AUTODETECTCODEPAGE= 0x00000020,
1427     EOPT_CURSORBEYONDEOL   = 0x00000040,
1428     EOPT_EXPANDONLYNEWTABS = 0x00000080,
1429     EOPT_SHOWWHITESPACE    = 0x00000100,
1430     EOPT_BOM               = 0x00000200,
1431     EOPT_SHOWLINEBREAK     = 0x00000400,
1432 }
1433 
1434 enum EDITOR_BLOCK_TYPES
1435 {
1436     BTYPE_NONE                      = 0,
1437     BTYPE_STREAM                    = 1,
1438     BTYPE_COLUMN                    = 2,
1439 }
1440 
1441 enum EDITOR_CURRENTSTATE
1442 {
1443     ECSTATE_MODIFIED       = 0x00000001,
1444     ECSTATE_SAVED          = 0x00000002,
1445     ECSTATE_LOCKED         = 0x00000004,
1446 }
1447 
1448 struct EditorInfo
1449 {
1450     size_t StructSize;
1451     intptr_t EditorID;
1452     intptr_t WindowSizeX;
1453     intptr_t WindowSizeY;
1454     intptr_t TotalLines;
1455     intptr_t CurLine;
1456     intptr_t CurPos;
1457     intptr_t CurTabPos;
1458     intptr_t TopScreenLine;
1459     intptr_t LeftPos;
1460     intptr_t Overtype;
1461     intptr_t BlockType;
1462     intptr_t BlockStartLine;
1463     uintptr_t Options;
1464     intptr_t TabSize;
1465     size_t BookmarkCount;
1466     size_t SessionBookmarkCount;
1467     uintptr_t CurState;
1468     uintptr_t CodePage;
1469 }
1470 
1471 struct EditorBookmarks
1472 {
1473     size_t StructSize;
1474     size_t Size;
1475     size_t Count;
1476     intptr_t* Line;
1477     intptr_t* Cursor;
1478     intptr_t* ScreenLine;
1479     intptr_t* LeftPos;
1480 }
1481 
1482 struct EditorSetPosition
1483 {
1484     size_t StructSize;
1485     intptr_t CurLine;
1486     intptr_t CurPos;
1487     intptr_t CurTabPos;
1488     intptr_t TopScreenLine;
1489     intptr_t LeftPos;
1490     intptr_t Overtype;
1491 }
1492 
1493 struct EditorSelect
1494 {
1495     size_t StructSize;
1496     intptr_t BlockType;
1497     intptr_t BlockStartLine;
1498     intptr_t BlockStartPos;
1499     intptr_t BlockWidth;
1500     intptr_t BlockHeight;
1501 }
1502 
1503 struct EditorConvertPos
1504 {
1505     size_t StructSize;
1506     intptr_t StringNumber;
1507     intptr_t SrcPos;
1508     intptr_t DestPos;
1509 }
1510 
1511 
1512 alias ulong EDITORCOLORFLAGS;
1513 const EDITORCOLORFLAGS
1514     ECF_TABMARKFIRST   = 0x0000000000000001UL,
1515     ECF_TABMARKCURRENT = 0x0000000000000002UL,
1516     ECF_AUTODELETE     = 0x0000000000000004UL;
1517 
1518 struct EditorColor
1519 {
1520     size_t StructSize;
1521     intptr_t StringNumber;
1522     intptr_t ColorItem;
1523     intptr_t StartPos;
1524     intptr_t EndPos;
1525     uintptr_t Priority;
1526     EDITORCOLORFLAGS Flags;
1527     FarColor Color;
1528     GUID Owner;
1529 }
1530 
1531 struct EditorDeleteColor
1532 {
1533     size_t StructSize;
1534     GUID Owner;
1535     intptr_t StringNumber;
1536     intptr_t StartPos;
1537 }
1538 
1539 const EDITOR_COLOR_NORMAL_PRIORITY = 0x80000000U;
1540 
1541 struct EditorSaveFile
1542 {
1543     size_t StructSize;
1544     const(wchar)* FileName;
1545     const(wchar)* FileEOL;
1546     uintptr_t CodePage;
1547 }
1548 
1549 enum EDITOR_CHANGETYPE
1550 {
1551     ECTYPE_CHANGED = 0,
1552     ECTYPE_ADDED   = 1,
1553     ECTYPE_DELETED = 2,
1554 }
1555 
1556 struct EditorChange
1557 {
1558     size_t StructSize;
1559     EDITOR_CHANGETYPE Type;
1560     intptr_t StringNumber;
1561 }
1562 
1563 struct EditorSubscribeChangeEvent
1564 {
1565     size_t StructSize;
1566     GUID PluginId;
1567 }
1568 
1569 alias ulong INPUTBOXFLAGS;
1570 const INPUTBOXFLAGS
1571     FIB_ENABLEEMPTY      = 0x0000000000000001UL,
1572     FIB_PASSWORD         = 0x0000000000000002UL,
1573     FIB_EXPANDENV        = 0x0000000000000004UL,
1574     FIB_NOUSELASTHISTORY = 0x0000000000000008UL,
1575     FIB_BUTTONS          = 0x0000000000000010UL,
1576     FIB_NOAMPERSAND      = 0x0000000000000020UL,
1577     FIB_EDITPATH         = 0x0000000000000040UL,
1578     FIB_EDITPATHEXEC     = 0x0000000000000080UL,
1579     FIB_NONE             = 0UL;
1580 
1581 alias extern (Windows) intptr_t function(
1582     in GUID* PluginId,
1583     in GUID* Id,
1584     in wchar* Title,
1585     in wchar* SubTitle,
1586     in wchar* HistoryName,
1587     in wchar* SrcText,
1588     wchar* DestText,
1589     size_t DestSize,
1590     in wchar* HelpTopic,
1591     INPUTBOXFLAGS Flags) FARAPIINPUTBOX;
1592 
1593 enum FAR_PLUGINS_CONTROL_COMMANDS
1594 {
1595     PCTL_LOADPLUGIN           = 0,
1596     PCTL_UNLOADPLUGIN         = 1,
1597     PCTL_FORCEDLOADPLUGIN     = 2,
1598     PCTL_FINDPLUGIN           = 3,
1599     PCTL_GETPLUGININFORMATION = 4,
1600     PCTL_GETPLUGINS           = 5,
1601 }
1602 
1603 enum FAR_PLUGIN_LOAD_TYPE
1604 {
1605     PLT_PATH = 0,
1606 }
1607 
1608 enum FAR_PLUGIN_FIND_TYPE
1609 {
1610     PFM_GUID       = 0,
1611     PFM_MODULENAME = 1,
1612 }
1613 
1614 alias ulong FAR_PLUGIN_FLAGS;
1615 const FAR_PLUGIN_FLAGS
1616     FPF_LOADED         = 0x0000000000000001UL,
1617     FPF_ANSI           = 0x1000000000000000UL,
1618     FPF_NONE           = 0UL;
1619 
1620 enum FAR_FILE_FILTER_CONTROL_COMMANDS
1621 {
1622     FFCTL_CREATEFILEFILTER          = 0,
1623     FFCTL_FREEFILEFILTER            = 1,
1624     FFCTL_OPENFILTERSMENU           = 2,
1625     FFCTL_STARTINGTOFILTER          = 3,
1626     FFCTL_ISFILEINFILTER            = 4,
1627 }
1628 
1629 enum FAR_FILE_FILTER_TYPE
1630 {
1631     FFT_PANEL                       = 0,
1632     FFT_FINDFILE                    = 1,
1633     FFT_COPY                        = 2,
1634     FFT_SELECT                      = 3,
1635     FFT_CUSTOM                      = 4,
1636 }
1637 
1638 enum FAR_REGEXP_CONTROL_COMMANDS
1639 {
1640     RECTL_CREATE                    = 0,
1641     RECTL_FREE                      = 1,
1642     RECTL_COMPILE                   = 2,
1643     RECTL_OPTIMIZE                  = 3,
1644     RECTL_MATCHEX                   = 4,
1645     RECTL_SEARCHEX                  = 5,
1646     RECTL_BRACKETSCOUNT             = 6,
1647 }
1648 
1649 struct RegExpMatch
1650 {
1651     intptr_t start,end;
1652 }
1653 
1654 struct RegExpSearch
1655 {
1656     const(wchar)* Text;
1657     intptr_t Position;
1658     intptr_t Length;
1659     RegExpMatch* Match;
1660     intptr_t Count;
1661     void* Reserved;
1662 }
1663 
1664 enum FAR_SETTINGS_CONTROL_COMMANDS
1665 {
1666     SCTL_CREATE                     = 0,
1667     SCTL_FREE                       = 1,
1668     SCTL_SET                        = 2,
1669     SCTL_GET                        = 3,
1670     SCTL_ENUM                       = 4,
1671     SCTL_DELETE                     = 5,
1672     SCTL_CREATESUBKEY               = 6,
1673     SCTL_OPENSUBKEY                 = 7,
1674 }
1675 
1676 enum FARSETTINGSTYPES
1677 {
1678     FST_UNKNOWN                     = 0,
1679     FST_SUBKEY                      = 1,
1680     FST_QWORD                       = 2,
1681     FST_STRING                      = 3,
1682     FST_DATA                        = 4,
1683 }
1684 
1685 enum FARSETTINGS_SUBFOLDERS
1686 {
1687     FSSF_ROOT                       =  0,
1688     FSSF_HISTORY_CMD                =  1,
1689     FSSF_HISTORY_FOLDER             =  2,
1690     FSSF_HISTORY_VIEW               =  3,
1691     FSSF_HISTORY_EDIT               =  4,
1692     FSSF_HISTORY_EXTERNAL           =  5,
1693     FSSF_FOLDERSHORTCUT_0           =  6,
1694     FSSF_FOLDERSHORTCUT_1           =  7,
1695     FSSF_FOLDERSHORTCUT_2           =  8,
1696     FSSF_FOLDERSHORTCUT_3           =  9,
1697     FSSF_FOLDERSHORTCUT_4           = 10,
1698     FSSF_FOLDERSHORTCUT_5           = 11,
1699     FSSF_FOLDERSHORTCUT_6           = 12,
1700     FSSF_FOLDERSHORTCUT_7           = 13,
1701     FSSF_FOLDERSHORTCUT_8           = 14,
1702     FSSF_FOLDERSHORTCUT_9           = 15,
1703     FSSF_CONFIRMATIONS              = 16,
1704     FSSF_SYSTEM                     = 17,
1705     FSSF_PANEL                      = 18,
1706     FSSF_EDITOR                     = 19,
1707     FSSF_SCREEN                     = 20,
1708     FSSF_DIALOG                     = 21,
1709     FSSF_INTERFACE                  = 22,
1710     FSSF_PANELLAYOUT                = 23,
1711 }
1712 
1713 enum FAR_PLUGIN_SETTINGS_LOCATION
1714 {
1715     PSL_ROAMING = 0,
1716     PSL_LOCAL   = 1,
1717 }
1718 
1719 struct FarSettingsCreate
1720 {
1721     size_t StructSize;
1722     GUID Guid;
1723     HANDLE Handle;
1724 }
1725 
1726 struct FarSettingsItemData
1727 {
1728     size_t Size;
1729     const(void)* Data;
1730 }
1731 
1732 struct FarSettingsItem
1733 {
1734     size_t StructSize;
1735     size_t Root;
1736     const(wchar)* Name;
1737     FARSETTINGSTYPES Type;
1738     union
1739     {
1740         ulong Number;
1741         const(wchar)* String;
1742         FarSettingsItemData Data;
1743     }
1744 }
1745 
1746 struct FarSettingsName
1747 {
1748     const(wchar)* Name;
1749     FARSETTINGSTYPES Type;
1750 }
1751 
1752 struct FarSettingsHistory
1753 {
1754     const(wchar)* Name;
1755     const(wchar)* Param;
1756     GUID PluginId;
1757     const(wchar)* File;
1758     FILETIME Time;
1759     BOOL Lock;
1760 }
1761 
1762 struct FarSettingsEnum
1763 {
1764     size_t StructSize;
1765     size_t Root;
1766     size_t Count;
1767     union
1768     {
1769         const(FarSettingsName)* Items;
1770         const(FarSettingsHistory)* Histories;
1771     }
1772 }
1773 
1774 struct FarSettingsValue
1775 {
1776     size_t StructSize;
1777     size_t Root;
1778     const(wchar)* Value;
1779 }
1780 
1781 alias extern (Windows) intptr_t function(HANDLE hPanel, FILE_CONTROL_COMMANDS Command, intptr_t Param1, void* Param2)FARAPIPANELCONTROL;
1782 
1783 alias extern (Windows) intptr_t function(
1784     in GUID* PluginId,
1785     ADVANCED_CONTROL_COMMANDS Command,
1786     intptr_t Param1,
1787     void* Param2) FARAPIADVCONTROL;
1788 
1789 alias extern (Windows) intptr_t function(intptr_t ViewerID, VIEWER_CONTROL_COMMANDS Command, intptr_t Param1, void* Param2)FARAPIVIEWERCONTROL;
1790 
1791 alias extern (Windows) intptr_t function(intptr_t EditorID, EDITOR_CONTROL_COMMANDS Command, intptr_t Param1, void* Param2)FARAPIEDITORCONTROL;
1792 
1793 alias extern (Windows) intptr_t function(
1794     in GUID* PluginId,
1795     FAR_MACRO_CONTROL_COMMANDS Command,
1796     intptr_t Param1,
1797     void* Param2) FARAPIMACROCONTROL;
1798 
1799 alias extern (Windows) intptr_t function(HANDLE hHandle, FAR_PLUGINS_CONTROL_COMMANDS Command, intptr_t Param1, void* Param2)FARAPIPLUGINSCONTROL;
1800 
1801 alias extern (Windows) intptr_t function(HANDLE hHandle, FAR_FILE_FILTER_CONTROL_COMMANDS Command, intptr_t Param1, void* Param2)FARAPIFILEFILTERCONTROL;
1802 
1803 alias extern (Windows) intptr_t function(HANDLE hHandle, FAR_REGEXP_CONTROL_COMMANDS Command, intptr_t Param1, void* Param2)FARAPIREGEXPCONTROL;
1804 
1805 alias extern (Windows) intptr_t function(HANDLE hHandle, FAR_SETTINGS_CONTROL_COMMANDS Command, intptr_t Param1, void* Param2)FARAPISETTINGSCONTROL;
1806 
1807 enum FARCLIPBOARD_TYPE
1808 {
1809     FCT_ANY=0,
1810     FCT_STREAM=1,
1811     FCT_COLUMN=2
1812 }
1813 
1814 alias extern (C) int function(wchar* Buffer, in wchar* Format, ...) FARSTDSPRINTF;
1815 
1816 alias extern (C) int function(wchar* Buffer, size_t Sizebuf, in wchar* Format, ...) FARSTDSNPRINTF;
1817 
1818 alias extern (C) int function(in wchar* Buffer, in wchar* Format, ...) FARSTDSSCANF;
1819 
1820 alias extern (Windows) void function(void* base, size_t nelem, size_t width, int function(in void* , in void* , void* userparam)fcmp, void* userparam) FARSTDQSORT;
1821 
1822 alias extern (Windows) void* function(in void* key, in void* base, size_t nelem, size_t width, int function(in void* , in void* , void* userparam)fcmp, void* userparam) FARSTDBSEARCH;
1823 
1824 alias extern (Windows) size_t function(in wchar* Computer, in wchar* Name, wchar* Owner, size_t Size) FARSTDGETFILEOWNER;
1825 
1826 alias extern (Windows) size_t function(in wchar* Name) FARSTDGETNUMBEROFLINKS;
1827 
1828 alias extern (Windows) int function(in wchar* s) FARSTDATOI;
1829 
1830 alias extern (Windows) long function(in wchar* s) FARSTDATOI64;
1831 
1832 alias extern (Windows) wchar* function(long value, wchar* Str, int radix)FARSTDITOA64;
1833 
1834 alias extern (Windows) wchar* function(int value, wchar* Str, int radix)FARSTDITOA;
1835 
1836 alias extern (Windows) wchar* function(wchar* Str)FARSTDLTRIM;
1837 
1838 alias extern (Windows) wchar* function(wchar* Str)FARSTDRTRIM;
1839 
1840 alias extern (Windows) wchar* function(wchar* Str)FARSTDTRIM;
1841 
1842 alias extern (Windows) wchar* function(wchar* Str, intptr_t MaxLength)FARSTDTRUNCSTR;
1843 
1844 alias extern (Windows) wchar* function(wchar* Str, intptr_t MaxLength)FARSTDTRUNCPATHSTR;
1845 
1846 alias extern (Windows) wchar* function(wchar* Str)FARSTDQUOTESPACEONLY;
1847 
1848 alias extern (Windows) const(wchar)* function(in wchar* Path) FARSTDPOINTTONAME;
1849 
1850 alias extern (Windows) BOOL function(wchar* Path)FARSTDADDENDSLASH;
1851 
1852 alias extern (Windows) BOOL function(FARCLIPBOARD_TYPE Type, in wchar* Data) FARSTDCOPYTOCLIPBOARD;
1853 
1854 alias extern (Windows) size_t function(FARCLIPBOARD_TYPE Type, wchar* Data, size_t Size)FARSTDPASTEFROMCLIPBOARD;
1855 
1856 alias extern (Windows) int function(wchar Ch)FARSTDLOCALISLOWER;
1857 
1858 alias extern (Windows) int function(wchar Ch)FARSTDLOCALISUPPER;
1859 
1860 alias extern (Windows) int function(wchar Ch)FARSTDLOCALISALPHA;
1861 
1862 alias extern (Windows) int function(wchar Ch)FARSTDLOCALISALPHANUM;
1863 
1864 alias extern (Windows) wchar function(wchar LowerChar)FARSTDLOCALUPPER;
1865 
1866 alias extern (Windows) wchar function(wchar UpperChar)FARSTDLOCALLOWER;
1867 
1868 alias extern (Windows) void function(wchar* Buf, intptr_t Length)FARSTDLOCALUPPERBUF;
1869 
1870 alias extern (Windows) void function(wchar* Buf, intptr_t Length)FARSTDLOCALLOWERBUF;
1871 
1872 alias extern (Windows) void function(wchar* s1)FARSTDLOCALSTRUPR;
1873 
1874 alias extern (Windows) void function(wchar* s1)FARSTDLOCALSTRLWR;
1875 
1876 alias extern (Windows) int function(in wchar* s1, in wchar* s2) FARSTDLOCALSTRICMP;
1877 
1878 alias extern (Windows) int function(in wchar* s1, in wchar* s2, intptr_t n) FARSTDLOCALSTRNICMP;
1879 
1880 alias extern (Windows) ulong function() FARSTDFARCLOCK;
1881 
1882 alias ulong PROCESSNAME_FLAGS;
1883 const PROCESSNAME_FLAGS
1884     //             0xFFFF - length
1885     //           0xFF0000 - mode
1886     // 0xFFFFFFFFFF000000 - flags
1887     PN_CMPNAME          = 0x0000000000000000UL,
1888     PN_CMPNAMELIST      = 0x0000000000010000UL,
1889     PN_GENERATENAME     = 0x0000000000020000UL,
1890     PN_CHECKMASK        = 0x0000000000030000UL,
1891     PN_SKIPPATH         = 0x0000000001000000UL,
1892     PN_SHOWERRORMESSAGE = 0x0000000002000000UL;
1893 
1894 alias extern (Windows) size_t function(
1895     in wchar* param1,
1896     wchar* param2,
1897     size_t size,
1898     PROCESSNAME_FLAGS flags) FARSTDPROCESSNAME;
1899 
1900 alias extern (Windows) void function(wchar* Str)FARSTDUNQUOTE;
1901 
1902 alias ulong XLAT_FLAGS;
1903 const XLAT_FLAGS
1904     XLAT_SWITCHKEYBLAYOUT  = 0x0000000000000001UL,
1905     XLAT_SWITCHKEYBBEEP    = 0x0000000000000002UL,
1906     XLAT_USEKEYBLAYOUTNAME = 0x0000000000000004UL,
1907     XLAT_CONVERTALLCMDLINE = 0x0000000000010000UL,
1908     XLAT_NONE              = 0UL;
1909 
1910 alias extern (Windows) size_t function(
1911     in INPUT_RECORD* Key,
1912     wchar* KeyText,
1913     size_t Size) FARSTDINPUTRECORDTOKEYNAME;
1914 
1915 alias extern (Windows) wchar* function(wchar* Line, intptr_t StartPos, intptr_t EndPos, XLAT_FLAGS Flags)FARSTDXLAT;
1916 
1917 alias extern (Windows) BOOL function(
1918     in wchar* Name,
1919     INPUT_RECORD* Key) FARSTDKEYNAMETOINPUTRECORD;
1920 
1921 alias extern (Windows) int function(
1922     in PluginPanelItem* FData,
1923     in wchar* FullName,
1924     void* Param) FRSUSERFUNC;
1925 
1926 alias ulong FRSMODE;
1927 const FRSMODE
1928     FRS_RETUPDIR             = 0x0000000000000001UL,
1929     FRS_RECUR                = 0x0000000000000002UL,
1930     FRS_SCANSYMLINK          = 0x0000000000000004UL;
1931 
1932 alias extern (Windows) void function(
1933     in wchar* InitDir,
1934     in wchar* Mask,
1935     FRSUSERFUNC Func,
1936     FRSMODE Flags,
1937     void* Param) FARSTDRECURSIVESEARCH;
1938 
1939 alias extern (Windows) size_t function(
1940     wchar* Dest,
1941     size_t DestSize,
1942     in wchar* Prefix) FARSTDMKTEMP;
1943 
1944 alias extern (Windows) size_t function(
1945     in wchar* Path,
1946     wchar* Root,
1947     size_t DestSize) FARSTDGETPATHROOT;
1948 
1949 enum LINK_TYPE
1950 {
1951     LINK_HARDLINK         = 1,
1952     LINK_JUNCTION         = 2,
1953     LINK_VOLMOUNT         = 3,
1954     LINK_SYMLINKFILE      = 4,
1955     LINK_SYMLINKDIR       = 5,
1956     LINK_SYMLINK          = 6,
1957 }
1958 
1959 alias ulong MKLINK_FLAGS;
1960 const MKLINK_FLAGS
1961     MLF_SHOWERRMSG       = 0x0000000000010000UL,
1962     MLF_DONOTUPDATEPANEL = 0x0000000000020000UL,
1963     MLF_HOLDTARGET       = 0x0000000000040000UL,
1964     MLF_NONE             = 0UL;
1965 
1966 alias extern (Windows) BOOL function(
1967     in wchar* Src,
1968     in wchar* Dest,
1969     LINK_TYPE Type,
1970     MKLINK_FLAGS Flags) FARSTDMKLINK;
1971 
1972 alias extern (Windows) size_t function(
1973     in wchar* Src,
1974     wchar* Dest,
1975     size_t DestSize) FARGETREPARSEPOINTINFO;
1976 
1977 enum CONVERTPATHMODES
1978 {
1979     CPM_FULL                        = 0,
1980     CPM_REAL                        = 1,
1981     CPM_NATIVE                      = 2,
1982 }
1983 
1984 alias extern (Windows) size_t function(
1985     CONVERTPATHMODES Mode,
1986     in wchar* Src,
1987     wchar* Dest,
1988     size_t DestSize) FARCONVERTPATH;
1989 
1990 alias extern (Windows) size_t function(size_t Size, wchar* Buffer)FARGETCURRENTDIRECTORY;
1991 
1992 alias ulong FARFORMATFILESIZEFLAGS;
1993 const FARFORMATFILESIZEFLAGS
1994     FFFS_COMMAS                 = 0x0100000000000000UL,
1995     FFFS_FLOATSIZE              = 0x0200000000000000UL,
1996     FFFS_SHOWBYTESINDEX         = 0x0400000000000000UL,
1997     FFFS_ECONOMIC               = 0x0800000000000000UL,
1998     FFFS_THOUSAND               = 0x1000000000000000UL,
1999     FFFS_MINSIZEINDEX           = 0x2000000000000000UL,
2000     FFFS_MINSIZEINDEX_MASK      = 0x0000000000000003UL;
2001 
2002 alias extern (Windows) size_t function(ulong Size, intptr_t Width, FARFORMATFILESIZEFLAGS Flags, wchar* Dest, size_t DestSize)FARFORMATFILESIZE;
2003 
2004 struct FarStandardFunctions
2005 {
2006     size_t StructSize;
2007     FARSTDATOI atoi;
2008     FARSTDATOI64 atoi64;
2009     FARSTDITOA itoa;
2010     FARSTDITOA64 itoa64;
2011     FARSTDSPRINTF sprintf;
2012     FARSTDSSCANF sscanf;
2013     FARSTDQSORT qsort;
2014     FARSTDBSEARCH bsearch;
2015     FARSTDSNPRINTF snprintf;
2016     FARSTDLOCALISLOWER LIsLower;
2017     FARSTDLOCALISUPPER LIsUpper;
2018     FARSTDLOCALISALPHA LIsAlpha;
2019     FARSTDLOCALISALPHANUM LIsAlphanum;
2020     FARSTDLOCALUPPER LUpper;
2021     FARSTDLOCALLOWER LLower;
2022     FARSTDLOCALUPPERBUF LUpperBuf;
2023     FARSTDLOCALLOWERBUF LLowerBuf;
2024     FARSTDLOCALSTRUPR LStrupr;
2025     FARSTDLOCALSTRLWR LStrlwr;
2026     FARSTDLOCALSTRICMP LStricmp;
2027     FARSTDLOCALSTRNICMP LStrnicmp;
2028     FARSTDUNQUOTE Unquote;
2029     FARSTDLTRIM LTrim;
2030     FARSTDRTRIM RTrim;
2031     FARSTDTRIM Trim;
2032     FARSTDTRUNCSTR TruncStr;
2033     FARSTDTRUNCPATHSTR TruncPathStr;
2034     FARSTDQUOTESPACEONLY QuoteSpaceOnly;
2035     FARSTDPOINTTONAME PointToName;
2036     FARSTDGETPATHROOT GetPathRoot;
2037     FARSTDADDENDSLASH AddEndSlash;
2038     FARSTDCOPYTOCLIPBOARD CopyToClipboard;
2039     FARSTDPASTEFROMCLIPBOARD PasteFromClipboard;
2040     FARSTDINPUTRECORDTOKEYNAME FarInputRecordToName;
2041     FARSTDKEYNAMETOINPUTRECORD FarNameToInputRecord;
2042     FARSTDXLAT XLat;
2043     FARSTDGETFILEOWNER GetFileOwner;
2044     FARSTDGETNUMBEROFLINKS GetNumberOfLinks;
2045     FARSTDRECURSIVESEARCH FarRecursiveSearch;
2046     FARSTDMKTEMP MkTemp;
2047     FARSTDPROCESSNAME ProcessName;
2048     FARSTDMKLINK MkLink;
2049     FARCONVERTPATH ConvertPath;
2050     FARGETREPARSEPOINTINFO GetReparsePointInfo;
2051     FARGETCURRENTDIRECTORY GetCurrentDirectory;
2052     FARFORMATFILESIZE FormatFileSize;
2053     FARSTDFARCLOCK FarClock;
2054 }
2055 alias FarStandardFunctions FARSTANDARDFUNCTIONS;
2056 
2057 struct PluginStartupInfo
2058 {
2059     size_t StructSize;
2060     const(wchar)* ModuleName;
2061     FARAPIMENU Menu;
2062     FARAPIMESSAGE Message;
2063     FARAPIGETMSG GetMsg;
2064     FARAPIPANELCONTROL PanelControl;
2065     FARAPISAVESCREEN SaveScreen;
2066     FARAPIRESTORESCREEN RestoreScreen;
2067     FARAPIGETDIRLIST GetDirList;
2068     FARAPIGETPLUGINDIRLIST GetPluginDirList;
2069     FARAPIFREEDIRLIST FreeDirList;
2070     FARAPIFREEPLUGINDIRLIST FreePluginDirList;
2071     FARAPIVIEWER Viewer;
2072     FARAPIEDITOR Editor;
2073     FARAPITEXT Text;
2074     FARAPIEDITORCONTROL EditorControl;
2075     FARSTANDARDFUNCTIONS* FSF;
2076     FARAPISHOWHELP ShowHelp;
2077     FARAPIADVCONTROL AdvControl;
2078     FARAPIINPUTBOX InputBox;
2079     FARAPICOLORDIALOG ColorDialog;
2080     FARAPIDIALOGINIT DialogInit;
2081     FARAPIDIALOGRUN DialogRun;
2082     FARAPIDIALOGFREE DialogFree;
2083     FARAPISENDDLGMESSAGE SendDlgMessage;
2084     FARAPIDEFDLGPROC DefDlgProc;
2085     FARAPIVIEWERCONTROL ViewerControl;
2086     FARAPIPLUGINSCONTROL PluginsControl;
2087     FARAPIFILEFILTERCONTROL FileFilterControl;
2088     FARAPIREGEXPCONTROL RegExpControl;
2089     FARAPIMACROCONTROL MacroControl;
2090     FARAPISETTINGSCONTROL SettingsControl;
2091     void* Private;
2092     void* Instance;
2093 }
2094 
2095 alias extern (Windows) HANDLE function(
2096     in wchar* Object,
2097     DWORD DesiredAccess,
2098     DWORD ShareMode,
2099     LPSECURITY_ATTRIBUTES SecurityAttributes,
2100     DWORD CreationDistribution,
2101     DWORD FlagsAndAttributes,
2102     HANDLE TemplateFile) FARAPICREATEFILE;
2103 
2104 alias extern (Windows) DWORD function(in wchar* FileName) FARAPIGETFILEATTRIBUTES;
2105 
2106 alias extern (Windows) BOOL function(
2107     in wchar* FileName,
2108     DWORD dwFileAttributes) FARAPISETFILEATTRIBUTES;
2109 
2110 alias extern (Windows) BOOL function(
2111     in wchar* ExistingFileName,
2112     in wchar* NewFileName,
2113     DWORD dwFlags) FARAPIMOVEFILEEX;
2114 
2115 alias extern (Windows) BOOL function(in wchar* FileName) FARAPIDELETEFILE;
2116 
2117 alias extern (Windows) BOOL function(in wchar* DirName) FARAPIREMOVEDIRECTORY;
2118 
2119 alias extern (Windows) BOOL function(
2120     in wchar* PathName,
2121     LPSECURITY_ATTRIBUTES lpSecurityAttributes) FARAPICREATEDIRECTORY;
2122 
2123 struct ArclitePrivateInfo
2124 {
2125     size_t StructSize;
2126     FARAPICREATEFILE CreateFile;
2127     FARAPIGETFILEATTRIBUTES GetFileAttributes;
2128     FARAPISETFILEATTRIBUTES SetFileAttributes;
2129     FARAPIMOVEFILEEX MoveFileEx;
2130     FARAPIDELETEFILE DeleteFile;
2131     FARAPIREMOVEDIRECTORY RemoveDirectory;
2132     FARAPICREATEDIRECTORY CreateDirectory;
2133 }
2134 
2135 struct NetBoxPrivateInfo
2136 {
2137     size_t StructSize;
2138     FARAPICREATEFILE CreateFile;
2139     FARAPIGETFILEATTRIBUTES GetFileAttributes;
2140     FARAPISETFILEATTRIBUTES SetFileAttributes;
2141     FARAPIMOVEFILEEX MoveFileEx;
2142     FARAPIDELETEFILE DeleteFile;
2143     FARAPIREMOVEDIRECTORY RemoveDirectory;
2144     FARAPICREATEDIRECTORY CreateDirectory;
2145 }
2146 
2147 struct MacroPluginReturn
2148 {
2149     intptr_t ReturnType;
2150     size_t Count;
2151     FarMacroValue* Values;
2152 }
2153 
2154 alias extern (Windows) intptr_t function(intptr_t CheckCode, FarMacroCall* Data) FARAPICALLFAR;
2155 
2156 struct MacroPrivateInfo
2157 {
2158     size_t StructSize;
2159     FARAPICALLFAR CallFar;
2160 }
2161 
2162 alias ulong PLUGIN_FLAGS;
2163 const PLUGIN_FLAGS
2164     PF_PRELOAD        = 0x0000000000000001UL,
2165     PF_DISABLEPANELS  = 0x0000000000000002UL,
2166     PF_EDITOR         = 0x0000000000000004UL,
2167     PF_VIEWER         = 0x0000000000000008UL,
2168     PF_FULLCMDLINE    = 0x0000000000000010UL,
2169     PF_DIALOG         = 0x0000000000000020UL,
2170     PF_NONE           = 0UL;
2171 
2172 struct PluginMenuItem
2173 {
2174     const(GUID)* Guids;
2175     const(wchar*)* Strings;
2176     size_t Count;
2177 }
2178 
2179 enum VERSION_STAGE
2180 {
2181     VS_RELEASE                      = 0,
2182     VS_ALPHA                        = 1,
2183     VS_BETA                         = 2,
2184     VS_RC                           = 3,
2185 }
2186 
2187 struct VersionInfo
2188 {
2189     DWORD Major;
2190     DWORD Minor;
2191     DWORD Revision;
2192     DWORD Build;
2193     VERSION_STAGE Stage;
2194 }
2195 
2196 BOOL CheckVersion(in VersionInfo* Current, in VersionInfo* Required)
2197 {
2198     return (Current.Major > Required.Major) || (Current.Major == Required.Major && Current.Minor > Required.Minor) || (Current.Major == Required.Major && Current.Minor == Required.Minor && Current.Revision > Required.Revision) || (Current.Major == Required.Major && Current.Minor == Required.Minor && Current.Revision == Required.Revision && Current.Build >= Required.Build);
2199 }
2200 
2201 VersionInfo MakeFarVersion(DWORD Major, DWORD Minor, DWORD Revision, DWORD Build, VERSION_STAGE Stage)
2202 {
2203     return VersionInfo(Major, Minor, Revision, Build, Stage);
2204 }
2205 auto FARMANAGERVERSION() { return MakeFarVersion(FARMANAGERVERSION_MAJOR, FARMANAGERVERSION_MINOR, FARMANAGERVERSION_REVISION, FARMANAGERVERSION_BUILD, FARMANAGERVERSION_STAGE); }
2206 
2207 struct GlobalInfo
2208 {
2209     size_t StructSize;
2210     VersionInfo MinFarVersion;
2211     VersionInfo Version;
2212     GUID Guid;
2213     const(wchar)* Title;
2214     const(wchar)* Description;
2215     const(wchar)* Author;
2216     void* Instance;
2217 }
2218 
2219 struct PluginInfo
2220 {
2221     size_t StructSize;
2222     PLUGIN_FLAGS Flags;
2223     PluginMenuItem DiskMenu;
2224     PluginMenuItem PluginMenu;
2225     PluginMenuItem PluginConfig;
2226     const(wchar)* CommandPrefix;
2227     void* Instance;
2228 }
2229 
2230 struct FarGetPluginInformation
2231 {
2232     size_t StructSize;
2233     const(wchar)* ModuleName;
2234     FAR_PLUGIN_FLAGS Flags;
2235     PluginInfo* PInfo;
2236     GlobalInfo* GInfo;
2237 }
2238 
2239 alias ulong INFOPANELLINE_FLAGS;
2240 const INFOPANELLINE_FLAGS
2241     IPLFLAGS_SEPARATOR      = 0x0000000000000001UL;
2242 
2243 struct InfoPanelLine
2244 {
2245     const(wchar)* Text;
2246     const(wchar)* Data;
2247     INFOPANELLINE_FLAGS Flags;
2248 }
2249 
2250 alias ulong PANELMODE_FLAGS;
2251 const PANELMODE_FLAGS
2252     PMFLAGS_FULLSCREEN      = 0x0000000000000001UL,
2253     PMFLAGS_DETAILEDSTATUS  = 0x0000000000000002UL,
2254     PMFLAGS_ALIGNEXTENSIONS = 0x0000000000000004UL,
2255     PMFLAGS_CASECONVERSION  = 0x0000000000000008UL;
2256 
2257 struct PanelMode
2258 {
2259     const(wchar)* ColumnTypes;
2260     const(wchar)* ColumnWidths;
2261     const(wchar*)* ColumnTitles;
2262     const(wchar)* StatusColumnTypes;
2263     const(wchar)* StatusColumnWidths;
2264     PANELMODE_FLAGS Flags;
2265 }
2266 
2267 alias ulong OPENPANELINFO_FLAGS;
2268 const OPENPANELINFO_FLAGS
2269     OPIF_DISABLEFILTER           = 0x0000000000000001UL,
2270     OPIF_DISABLESORTGROUPS       = 0x0000000000000002UL,
2271     OPIF_DISABLEHIGHLIGHTING     = 0x0000000000000004UL,
2272     OPIF_ADDDOTS                 = 0x0000000000000008UL,
2273     OPIF_RAWSELECTION            = 0x0000000000000010UL,
2274     OPIF_REALNAMES               = 0x0000000000000020UL,
2275     OPIF_SHOWNAMESONLY           = 0x0000000000000040UL,
2276     OPIF_SHOWRIGHTALIGNNAMES     = 0x0000000000000080UL,
2277     OPIF_SHOWPRESERVECASE        = 0x0000000000000100UL,
2278     OPIF_COMPAREFATTIME          = 0x0000000000000400UL,
2279     OPIF_EXTERNALGET             = 0x0000000000000800UL,
2280     OPIF_EXTERNALPUT             = 0x0000000000001000UL,
2281     OPIF_EXTERNALDELETE          = 0x0000000000002000UL,
2282     OPIF_EXTERNALMKDIR           = 0x0000000000004000UL,
2283     OPIF_USEATTRHIGHLIGHTING     = 0x0000000000008000UL,
2284     OPIF_USECRC32                = 0x0000000000010000UL,
2285     OPIF_USEFREESIZE             = 0x0000000000020000UL,
2286     OPIF_SHORTCUT                = 0x0000000000040000UL,
2287     OPIF_NONE                    = 0UL;
2288 
2289 struct KeyBarLabel
2290 {
2291     FarKey Key;
2292     const(wchar)* Text;
2293     const(wchar)* LongText;
2294 }
2295 
2296 struct KeyBarTitles
2297 {
2298     size_t CountLabels;
2299     KeyBarLabel* Labels;
2300 }
2301 
2302 struct FarSetKeyBarTitles
2303 {
2304     size_t StructSize;
2305     KeyBarTitles* Titles;
2306 }
2307 
2308 alias ulong OPERATION_MODES;
2309 const OPERATION_MODES
2310     OPM_SILENT     =0x0000000000000001UL,
2311     OPM_FIND       =0x0000000000000002UL,
2312     OPM_VIEW       =0x0000000000000004UL,
2313     OPM_EDIT       =0x0000000000000008UL,
2314     OPM_TOPLEVEL   =0x0000000000000010UL,
2315     OPM_DESCR      =0x0000000000000020UL,
2316     OPM_QUICKVIEW  =0x0000000000000040UL,
2317     OPM_PGDN       =0x0000000000000080UL,
2318     OPM_COMMANDS   =0x0000000000000100UL,
2319     OPM_NONE       =0UL;
2320 
2321 struct OpenPanelInfo
2322 {
2323     size_t StructSize;
2324     HANDLE hPanel;
2325     OPENPANELINFO_FLAGS Flags;
2326     const(wchar)* HostFile;
2327     const(wchar)* CurDir;
2328     const(wchar)* Format;
2329     const(wchar)* PanelTitle;
2330     const(InfoPanelLine)* InfoLines;
2331     size_t InfoLinesNumber;
2332     const(wchar*)* DescrFiles;
2333     size_t DescrFilesNumber;
2334     const(PanelMode)* PanelModesArray;
2335     size_t PanelModesNumber;
2336     intptr_t StartPanelMode;
2337     OPENPANELINFO_SORTMODES StartSortMode;
2338     intptr_t StartSortOrder;
2339     const(KeyBarTitles)* KeyBar;
2340     const(wchar)* ShortcutData;
2341     ulong FreeSize;
2342     UserDataItem UserData;
2343     void* Instance;
2344 }
2345 
2346 struct AnalyseInfo
2347 {
2348     size_t StructSize;
2349     const(wchar)* FileName;
2350     void* Buffer;
2351     size_t BufferSize;
2352     OPERATION_MODES OpMode;
2353 	void* Instance;
2354 }
2355 
2356 struct OpenAnalyseInfo
2357 {
2358     size_t StructSize;
2359     AnalyseInfo* Info;
2360     HANDLE Handle;
2361 }
2362 
2363 struct OpenMacroInfo
2364 {
2365     size_t StructSize;
2366     size_t Count;
2367     FarMacroValue* Values;
2368 }
2369 
2370 alias ulong FAROPENSHORTCUTFLAGS;
2371 const FAROPENSHORTCUTFLAGS
2372     FOSF_ACTIVE = 0x0000000000000001UL,
2373     FOSF_NONE   = 0;
2374 
2375 struct OpenShortcutInfo
2376 {
2377     size_t StructSize;
2378     const(wchar)* HostFile;
2379     const(wchar)* ShortcutData;
2380     FAROPENSHORTCUTFLAGS Flags;
2381 }
2382 
2383 struct OpenCommandLineInfo
2384 {
2385     size_t StructSize;
2386     const(wchar)* CommandLine;
2387 }
2388 
2389 enum OPENFROM
2390 {
2391     OPEN_LEFTDISKMENU       = 0,
2392     OPEN_PLUGINSMENU        = 1,
2393     OPEN_FINDLIST           = 2,
2394     OPEN_SHORTCUT           = 3,
2395     OPEN_COMMANDLINE        = 4,
2396     OPEN_EDITOR             = 5,
2397     OPEN_VIEWER             = 6,
2398     OPEN_FILEPANEL          = 7,
2399     OPEN_DIALOG             = 8,
2400     OPEN_ANALYSE            = 9,
2401     OPEN_RIGHTDISKMENU      = 10,
2402     OPEN_FROMMACRO          = 11,
2403     OPEN_LUAMACRO           = 100,
2404 }
2405 
2406 enum MACROCALLTYPE
2407 {
2408 	MCT_MACROPARSE         = 0,
2409 	MCT_LOADMACROS         = 1,
2410 	MCT_ENUMMACROS         = 2,
2411 	MCT_WRITEMACROS        = 3,
2412 	MCT_GETMACRO           = 4,
2413 	MCT_RECORDEDMACRO      = 5,
2414 	MCT_DELMACRO           = 6,
2415 	MCT_RUNSTARTMACRO      = 7,
2416 	MCT_EXECSTRING         = 8,
2417 	MCT_PANELSORT          = 9,
2418 	MCT_GETCUSTOMSORTMODES = 10,
2419 	MCT_ADDMACRO           = 11,
2420 	MCT_KEYMACRO           = 12,
2421 }
2422 
2423 enum MACROPLUGINRETURNTYPE
2424 {
2425     MPRT_NORMALFINISH  = 0,
2426     MPRT_ERRORFINISH   = 1,
2427     MPRT_ERRORPARSE    = 2,
2428     MPRT_KEYS          = 3,
2429     MPRT_PRINT         = 4,
2430     MPRT_PLUGINCALL    = 5,
2431     MPRT_PLUGINMENU    = 6,
2432     MPRT_PLUGINCONFIG  = 7,
2433     MPRT_PLUGINCOMMAND = 8,
2434     MPRT_USERMENU      = 9,
2435     MPRT_HASNOMACRO    = 10,
2436 }
2437 
2438 struct OpenMacroPluginInfo
2439 {
2440     MACROCALLTYPE CallType;
2441     FarMacroCall* Data;
2442 	MacroPluginReturn Ret;
2443 }
2444 
2445 enum FAR_EVENTS
2446 {
2447     FE_CHANGEVIEWMODE   =0,
2448     FE_REDRAW           =1,
2449     FE_IDLE             =2,
2450     FE_CLOSE            =3,
2451     FE_BREAK            =4,
2452     FE_COMMAND          =5,
2453 
2454     FE_GOTFOCUS         =6,
2455     FE_KILLFOCUS        =7,
2456     FE_CHANGESORTPARAMS =8,
2457 }
2458 
2459 struct OpenInfo
2460 {
2461     size_t StructSize;
2462     OPENFROM OpenFrom;
2463     const(GUID)* Guid;
2464     intptr_t Data;
2465 	void* Instance;
2466 }
2467 
2468 struct SetDirectoryInfo
2469 {
2470     size_t StructSize;
2471     HANDLE hPanel;
2472     const(wchar)* Dir;
2473     intptr_t Reserved;
2474     OPERATION_MODES OpMode;
2475     UserDataItem UserData;
2476 	void* Instance;
2477 }
2478 
2479 struct SetFindListInfo
2480 {
2481     size_t StructSize;
2482     HANDLE hPanel;
2483     const(PluginPanelItem)* PanelItem;
2484     size_t ItemsNumber;
2485 	void* Instance;
2486 }
2487 
2488 struct PutFilesInfo
2489 {
2490     size_t StructSize;
2491     HANDLE hPanel;
2492     PluginPanelItem* PanelItem;
2493     size_t ItemsNumber;
2494     BOOL Move;
2495     const(wchar)* SrcPath;
2496     OPERATION_MODES OpMode;
2497 	void* Instance;
2498 }
2499 
2500 struct ProcessHostFileInfo
2501 {
2502     size_t StructSize;
2503     HANDLE hPanel;
2504     PluginPanelItem* PanelItem;
2505     size_t ItemsNumber;
2506     OPERATION_MODES OpMode;
2507 	void* Instance;
2508 }
2509 
2510 struct MakeDirectoryInfo
2511 {
2512     size_t StructSize;
2513     HANDLE hPanel;
2514     const(wchar)* Name;
2515     OPERATION_MODES OpMode;
2516 	void* Instance;
2517 }
2518 
2519 struct CompareInfo
2520 {
2521     size_t StructSize;
2522     HANDLE hPanel;
2523     const(PluginPanelItem)* Item1;
2524     const(PluginPanelItem)* Item2;
2525     OPENPANELINFO_SORTMODES Mode;
2526 	void* Instance;
2527 }
2528 
2529 struct GetFindDataInfo
2530 {
2531     size_t StructSize;
2532     HANDLE hPanel;
2533     PluginPanelItem* PanelItem;
2534     size_t ItemsNumber;
2535     OPERATION_MODES OpMode;
2536 	void* Instance;
2537 }
2538 
2539 struct FreeFindDataInfo
2540 {
2541     size_t StructSize;
2542     HANDLE hPanel;
2543     PluginPanelItem* PanelItem;
2544     size_t ItemsNumber;
2545 	void* Instance;
2546 }
2547 
2548 struct GetFilesInfo
2549 {
2550     size_t StructSize;
2551     HANDLE hPanel;
2552     PluginPanelItem* PanelItem;
2553     size_t ItemsNumber;
2554     BOOL Move;
2555     const(wchar)* DestPath;
2556     OPERATION_MODES OpMode;
2557 	void* Instance;
2558 }
2559 
2560 struct DeleteFilesInfo
2561 {
2562     size_t StructSize;
2563     HANDLE hPanel;
2564     PluginPanelItem* PanelItem;
2565     size_t ItemsNumber;
2566     OPERATION_MODES OpMode;
2567 	void* Instance;
2568 }
2569 
2570 struct ProcessPanelInputInfo
2571 {
2572     size_t StructSize;
2573     HANDLE hPanel;
2574     INPUT_RECORD Rec;
2575 	void* Instance;
2576 }
2577 
2578 struct ProcessEditorInputInfo
2579 {
2580     size_t StructSize;
2581     INPUT_RECORD Rec;
2582 	void* Instance;
2583 }
2584 
2585 alias ulong PROCESSCONSOLEINPUT_FLAGS;
2586 const PROCESSCONSOLEINPUT_FLAGS
2587     PCIF_FROMMAIN = 0x0000000000000001UL,
2588     PCIF_NONE     = 0;
2589 
2590 struct ProcessConsoleInputInfo
2591 {
2592     size_t StructSize;
2593     PROCESSCONSOLEINPUT_FLAGS Flags;
2594     INPUT_RECORD Rec;
2595 	void* Instance;
2596 }
2597 
2598 struct ExitInfo
2599 {
2600     size_t StructSize;
2601 	void* Instance;
2602 }
2603 
2604 struct ProcessPanelEventInfo
2605 {
2606     size_t StructSize;
2607     intptr_t Event;
2608     void* Param;
2609     HANDLE hPanel;
2610 	void* Instance;
2611 }
2612 
2613 struct ProcessEditorEventInfo
2614 {
2615     size_t StructSize;
2616     intptr_t Event;
2617     void* Param;
2618     intptr_t EditorID;
2619 	void* Instance;
2620 }
2621 
2622 struct ProcessDialogEventInfo
2623 {
2624     size_t StructSize;
2625     intptr_t Event;
2626     FarDialogEvent* Param;
2627 	void* Instance;
2628 }
2629 
2630 struct ProcessSynchroEventInfo
2631 {
2632     size_t StructSize;
2633     intptr_t Event;
2634     void* Param;
2635 	void* Instance;
2636 }
2637 
2638 struct ProcessViewerEventInfo
2639 {
2640     size_t StructSize;
2641     intptr_t Event;
2642     void* Param;
2643     intptr_t ViewerID;
2644 	void* Instance;
2645 }
2646 
2647 struct ClosePanelInfo
2648 {
2649     size_t StructSize;
2650     HANDLE hPanel;
2651 	void* Instance;
2652 }
2653 
2654 struct CloseAnalyseInfo
2655 {
2656     size_t StructSize;
2657     HANDLE Handle;
2658 	void* Instance;
2659 }
2660 
2661 struct ConfigureInfo
2662 {
2663     size_t StructSize;
2664     const(GUID)* Guid;
2665 	void* Instance;
2666 }
2667 
2668 struct GetContentFieldsInfo
2669 {
2670     size_t StructSize;
2671     size_t Count;
2672     const(wchar*)* Names;
2673     void* Instance;
2674 }
2675 
2676 struct GetContentDataInfo
2677 {
2678     size_t StructSize;
2679     const(wchar)* FilePath;
2680     size_t Count;
2681     const(wchar*)* Names;
2682     const(wchar)** Values;
2683     void* Instance;
2684 }
2685 
2686 GUID FarGuid = {0x00000000, 0x0000, 0x0000, [0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00]};
2687 
2688 // Exported Functions
2689 
2690 extern (Windows) HANDLE AnalyseW(in AnalyseInfo* Info);
2691 
2692 extern (Windows) void CloseAnalyseW(in CloseAnalyseInfo* Info);
2693 
2694 extern (Windows) void ClosePanelW(in ClosePanelInfo* Info);
2695 
2696 extern (Windows) intptr_t CompareW(in CompareInfo* Info);
2697 
2698 extern (Windows) intptr_t ConfigureW(in ConfigureInfo* Info);
2699 
2700 extern (Windows) intptr_t DeleteFilesW(in DeleteFilesInfo* Info);
2701 
2702 extern (Windows) void ExitFARW(in ExitInfo* Info);
2703 
2704 extern (Windows) void FreeFindDataW(in FreeFindDataInfo* Info);
2705 
2706 extern (Windows) intptr_t GetFilesW(GetFilesInfo* Info);
2707 
2708 extern (Windows) intptr_t GetFindDataW(GetFindDataInfo* Info);
2709 
2710 extern (Windows) void GetGlobalInfoW(GlobalInfo* Info);
2711 
2712 extern (Windows) void GetOpenPanelInfoW(OpenPanelInfo* Info);
2713 
2714 extern (Windows) void GetPluginInfoW(PluginInfo* Info);
2715 
2716 extern (Windows) intptr_t MakeDirectoryW(MakeDirectoryInfo* Info);
2717 
2718 extern (Windows) HANDLE OpenW(in OpenInfo* Info);
2719 
2720 extern (Windows) intptr_t ProcessDialogEventW(in ProcessDialogEventInfo* Info);
2721 
2722 extern (Windows) intptr_t ProcessEditorEventW(in ProcessEditorEventInfo* Info);
2723 
2724 extern (Windows) intptr_t ProcessEditorInputW(in ProcessEditorInputInfo* Info);
2725 
2726 extern (Windows) intptr_t ProcessPanelEventW(in ProcessPanelEventInfo* Info);
2727 
2728 extern (Windows) intptr_t ProcessHostFileW(in ProcessHostFileInfo* Info);
2729 
2730 extern (Windows) intptr_t ProcessPanelInputW(in ProcessPanelInputInfo* Info);
2731 
2732 extern (Windows) intptr_t ProcessConsoleInputW(ProcessConsoleInputInfo* Info);
2733 
2734 extern (Windows) intptr_t ProcessSynchroEventW(in ProcessSynchroEventInfo* Info);
2735 
2736 extern (Windows) intptr_t ProcessViewerEventW(in ProcessViewerEventInfo* Info);
2737 
2738 extern (Windows) intptr_t PutFilesW(in PutFilesInfo* Info);
2739 
2740 extern (Windows) intptr_t SetDirectoryW(in SetDirectoryInfo* Info);
2741 
2742 extern (Windows) intptr_t SetFindListW(in SetFindListInfo* Info);
2743 
2744 extern (Windows) void SetStartupInfoW(in PluginStartupInfo* Info);
2745 
2746 extern (Windows) intptr_t GetContentFieldsW(in GetContentFieldsInfo* Info);
2747 
2748 extern (Windows) intptr_t GetContentDataW(GetContentDataInfo* Info);
2749 
2750 extern (Windows) void FreeContentDataW(in GetContentDataInfo* Info);