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