diff options
53 files changed, 1883 insertions, 28 deletions
diff --git a/plugins/Actman30/actman.dpr b/plugins/Actman30/actman30.dpr index 4515e35c1e..149ffeb744 100644 --- a/plugins/Actman30/actman.dpr +++ b/plugins/Actman30/actman30.dpr @@ -38,6 +38,7 @@ uses dbsettings,
mirutils,
syswin,
+ base64,
question,
mApiCardM,
global,
@@ -55,6 +56,7 @@ uses iac_program,
iac_chain,
iac_contact,
+ iac_call,
inoutxml,
sedit,
strans,
@@ -201,6 +203,9 @@ begin HookEvent(ME_SYSTEM_SHUTDOWN{ME_SYSTEM_OKTOEXIT},@PreShutdown);
NotifyEventHooks(hHookChanged,twparam(ACTM_LOADED),0);
+ //----- DBEDITOR support -----
+// CallService(MS_DBEDIT_REGISTERSINGLEMODULE,twparam(PluginShort),0);
+
IsMultiThread:=true;
// Load additional modules
ptr:=ActionLink;
diff --git a/plugins/Actman30/ask.res b/plugins/Actman30/ask.res Binary files differnew file mode 100644 index 0000000000..15a00e0218 --- /dev/null +++ b/plugins/Actman30/ask.res diff --git a/plugins/Actman30/dlgshare.res b/plugins/Actman30/dlgshare.res Binary files differnew file mode 100644 index 0000000000..13c4bf49cd --- /dev/null +++ b/plugins/Actman30/dlgshare.res diff --git a/plugins/Actman30/editwrapper.res b/plugins/Actman30/editwrapper.res Binary files differnew file mode 100644 index 0000000000..a0019a92ae --- /dev/null +++ b/plugins/Actman30/editwrapper.res diff --git a/plugins/Actman30/hooks.res b/plugins/Actman30/hooks.res Binary files differnew file mode 100644 index 0000000000..1cf202f414 --- /dev/null +++ b/plugins/Actman30/hooks.res diff --git a/plugins/Actman30/i_cnst_call.inc b/plugins/Actman30/i_cnst_call.inc new file mode 100644 index 0000000000..8b8118ed28 --- /dev/null +++ b/plugins/Actman30/i_cnst_call.inc @@ -0,0 +1,23 @@ +{resource constants}
+const
+ IDC_LIST_FUNC = 2101;
+ IDC_LIST_DLL = 2102;
+ IDC_CDECL = 2103;
+ IDC_STDCALL = 2104;
+ IDC_ARGCOUNT = 2105;
+ IDC_ARGSTAT = 2106;
+
+ IDC_ARGNUM = 2110;
+ IDC_FLAG_PAR = 2111;
+ IDC_EDIT_PAR = 2112;
+ IDC_STRUCT = 2113;
+
+ IDC_DLL = 2115;
+ IDC_DLL_CACHE = 2116;
+{
+ IDC_DLL_IMM = 2116;
+ IDC_DLL_MACRO = 2117;
+ IDC_DLL_END = 2118;
+}
+ IDC_CLOSE_ARG = 2119;
+ IDC_CLOSE_RES = 2120;
diff --git a/plugins/Actman30/i_opt_dlg.inc b/plugins/Actman30/i_opt_dlg.inc index e7a9e206ef..62a0a6c66f 100644 --- a/plugins/Actman30/i_opt_dlg.inc +++ b/plugins/Actman30/i_opt_dlg.inc @@ -17,7 +17,7 @@ var i:integer;
begin
result:=0;
- NoDescription:=TranslateW('No description');
+ NoDescription:=TranslateW('No Description');
StrCopyW(xmlfilename,'c:\export.xml');
diff --git a/plugins/Actman30/i_sparam_const.inc b/plugins/Actman30/i_sparam_const.inc new file mode 100644 index 0000000000..5571dd96e0 --- /dev/null +++ b/plugins/Actman30/i_sparam_const.inc @@ -0,0 +1,10 @@ +const
+ IDC_FLAG_PAR = 2150;
+ IDC_EDIT_PAR = 2151;
+ IDC_STRUCT = 2152;
+ IDC_STAT_PAR = 2153;
+
+ IDC_RES_TYPE = 2160;
+ IDC_RES_FREEMEM = 2161;
+ IDC_RES_GROUP = 2162;
+ IDC_RES_STAT = 2163;
diff --git a/plugins/Actman30/iac_call.pas b/plugins/Actman30/iac_call.pas new file mode 100644 index 0000000000..9b0c8dbe3a --- /dev/null +++ b/plugins/Actman30/iac_call.pas @@ -0,0 +1,948 @@ +unit iac_call;
+
+interface
+
+implementation
+
+uses
+ windows, messages, commctrl,
+ sparam,
+ common, wrapper, memini,
+ iac_global, global,
+ m_api, dbsettings, mirutils;
+
+{$include i_cnst_call.inc}
+{$resource iac_call.res}
+
+const
+ MaxArgCount = 8;
+ MaxArgNameLen = 32;
+
+const
+ API_FUNCTION_FILE:pAnsiChar = 'plugins\services.ini';
+ namespace = 'Function';
+
+const
+ opt_dllname = 'dllname';
+ opt_funcname = 'funcname';
+ opt_argcount = 'argcount';
+ opt_argf = 'argtype';
+ opt_argn = 'argname';
+ opt_argv = 'argvalue';
+
+type
+ tCallAction = class(tBaseAction)
+ private
+ dllname:pAnsiChar;
+ funcname:pAnsiChar;
+
+ argcount:integer;
+ argf:array [0..MaxArgCount-1] of dword;
+ argv:array [0..MaxArgCount-1] of uint_ptr;
+ argn:array [0..MaxArgCount-1,0..MaxArgNameLen-1] of AnsiChar;
+ public
+ constructor Create(uid:dword);
+ destructor Destroy; override;
+// function Clone:tBaseAction; override;
+ function DoAction(var WorkData:tWorkData):LRESULT; override;
+ procedure Save(node:pointer;fmt:integer); override;
+ procedure Load(node:pointer;fmt:integer); override;
+ end;
+
+var
+ storage:pointer;
+
+const
+ ACF_CDECL = $00000001;
+ ACF_CACHE_NOW = $00000002;
+ ACF_CACHE_MACRO = $00000004;
+
+// param flags, same as for service
+const
+ ACF_RSTRING = $00010000; // Service result is string
+ ACF_RUNICODE = $00020000; // Service result is Widestring
+ ACF_RSTRUCT = $00040000; // Service result in structure
+ ACF_RFREEMEM = $00080000; // Need to free memory
+
+ ACF_SCRIPT_PARAM = $00001000;
+ // dummy
+ ACF_STRING = 0;
+
+type
+ sp0 = function:int_ptr; stdcall;
+ sp1 = function(arg1:int_ptr):int_ptr; stdcall;
+ sp2 = function(arg1,arg2:uint_ptr):int_ptr; stdcall;
+ sp3 = function(arg1,arg2,arg3:uint_ptr):int_ptr; stdcall;
+ sp4 = function(arg1,arg2,arg3,arg4:uint_ptr):int_ptr; stdcall;
+ sp5 = function(arg1,arg2,arg3,arg4,arg5:uint_ptr):int_ptr; stdcall;
+ sp6 = function(arg1,arg2,arg3,arg4,arg5,arg6:uint_ptr):int_ptr; stdcall;
+ sp7 = function(arg1,arg2,arg3,arg4,arg5,arg6,arg7:uint_ptr):int_ptr; stdcall;
+ sp8 = function(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8:uint_ptr):int_ptr; stdcall;
+
+ cp0 = function:int_ptr; cdecl;
+ cp1 = function(arg1:uint_ptr):int_ptr; cdecl;
+ cp2 = function(arg1,arg2:uint_ptr):int_ptr; cdecl;
+ cp3 = function(arg1,arg2,arg3:uint_ptr):int_ptr; cdecl;
+ cp4 = function(arg1,arg2,arg3,arg4:uint_ptr):int_ptr; cdecl;
+ cp5 = function(arg1,arg2,arg3,arg4,arg5:uint_ptr):int_ptr; cdecl;
+ cp6 = function(arg1,arg2,arg3,arg4,arg5,arg6:uint_ptr):int_ptr; cdecl;
+ cp7 = function(arg1,arg2,arg3,arg4,arg5,arg6,arg7:uint_ptr):int_ptr; cdecl;
+ cp8 = function(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8:uint_ptr):int_ptr; cdecl;
+
+//----- Support functions -----
+
+//----- Object realization -----
+
+constructor tCallAction.Create(uid:dword);
+begin
+ inherited Create(uid);
+
+ argcount:=0;
+ dllname :=nil;
+ funcname:=nil;
+end;
+
+destructor tCallAction.Destroy;
+begin
+ mFreeMem(dllname);
+ mFreeMem(funcname);
+
+ inherited Destroy;
+end;
+{
+function tCallAction.Clone:tBaseAction;
+begin
+ result:=.Create(0);
+ Duplicate(result);
+
+end;
+}
+function tCallAction.DoAction(var WorkData:tWorkData):LRESULT;
+var
+ hDLL:THANDLE;
+ pp:pointer;
+ res:LRESULT;
+ largv:array [0..MaxArgCount-1] of uint_ptr;
+ i:integer;
+begin
+ result:=0;
+ if (dllname =nil) or (dllname^ =#0) or
+ (funcname=nil) or (funcname^=#0) then
+ begin
+ // clear last result?
+ exit;
+ end;
+
+ hDLL:=LoadLibraryA(dllname);
+// hDLL:=GetDllHandle(dllname);
+ if hDLL<>0 then
+ begin
+ pp:=GetProcAddress(hDLL,funcname);
+ if pp<>nil then
+ begin
+ // prepare arguments?
+ for i:=0 to argcount-1 do
+ begin
+ largv[i]:=argv[i];
+ PreProcess(argf[i],LPARAM(largv[i]),WorkData);
+ end;
+ // call function
+ case argcount of
+ 0: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp0(pp)
+ else
+ res:=sp0(pp);
+ end;
+ 1: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp1(pp)(largv[0])
+ else
+ res:=sp1(pp)(largv[0]);
+ end;
+ 2: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp2(pp)(largv[0],largv[1])
+ else
+ res:=sp2(pp)(largv[0],largv[1]);
+ end;
+ 3: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp3(pp)(largv[0],largv[1],largv[2])
+ else
+ res:=sp3(pp)(largv[0],largv[1],largv[2]);
+ end;
+ 4: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp4(pp)(largv[0],largv[1],largv[2],largv[3])
+ else
+ res:=sp4(pp)(largv[0],largv[1],largv[2],largv[3]);
+ end;
+ 5: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp5(pp)(largv[0],largv[1],largv[2],largv[3],largv[4])
+ else
+ res:=sp5(pp)(largv[0],largv[1],largv[2],largv[3],largv[4]);
+ end;
+ 6: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp6(pp)(largv[0],largv[1],largv[2],largv[3],largv[4],largv[5])
+ else
+ res:=sp6(pp)(largv[0],largv[1],largv[2],largv[3],largv[4],largv[5]);
+ end;
+ 7: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp7(pp)(largv[0],largv[1],largv[2],largv[3],largv[4],largv[5],largv[6])
+ else
+ res:=sp7(pp)(largv[0],largv[1],largv[2],largv[3],largv[4],largv[5],largv[6]);
+ end;
+ 8: begin
+ if (flags and ACF_CDECL)<>0 then
+ res:=cp8(pp)(largv[0],largv[1],largv[2],largv[3],largv[4],largv[5],largv[6],largv[7])
+ else
+ res:=sp8(pp)(largv[0],largv[1],largv[2],largv[3],largv[4],largv[5],largv[6],largv[7]);
+ end;
+ end;
+
+ ClearResult(WorkData);
+ // result type processing
+ if (flags and ACF_RSTRING)<>0 then
+ begin
+ if (flags and ACF_RUNICODE)=0 then
+ AnsiToWide(pAnsiChar(res),pWideChar(WorkData.LastResult),MirandaCP)
+ else
+ StrDupW(pWideChar(WorkData.LastResult),pWideChar(res));
+ WorkData.ResultType:=rtWide;
+
+ if (flags and ACF_RFREEMEM)<>0 then
+ mFreeMem(pAnsiChar(res)); //?? Miranda MM??
+ end
+ else if (flags and ACF_RSTRUCT)=0 then
+ begin
+ WorkData.ResultType:=rtInt
+{!!!!
+ end
+ else if (flags and ACF_RSTRUCT)<>0 then
+ begin
+ PostProcess(flags ,lwparam,WorkData);
+ PostProcess(flags2,llparam,WorkData);
+}
+ end;
+
+ end;
+// FreeDllHandle(hDLL);
+ FreeLibrary(hDLL);
+ end;
+
+end;
+
+procedure LoadParam(section:PAnsiChar;flags:dword; var param:pointer);
+begin
+ if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then
+ begin
+ if (flags and ACF_STRUCT)<>0 then
+ param:=DBReadUTF8(0,DBBranch,section,nil)
+ else
+ param:=DBReadUnicode(0,DBBranch,section,nil);
+ end;
+end;
+
+procedure tCallAction.Load(node:pointer;fmt:integer);
+var
+ section: array [0..127] of AnsiChar;
+ pc,p,pd,ppd:pAnsiChar;
+ i:integer;
+begin
+ inherited Load(node,fmt);
+ case fmt of
+ 0: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+ StrCopy(pc,opt_dllname ); dllname :=DBReadString(0,DBBranch,section);
+ StrCopy(pc,opt_funcname); funcname:=DBReadString(0,DBBranch,section);
+ StrCopy(pc,opt_argcount); argcount:=DBReadByte (0,DBBranch,section);
+ if argcount>0 then
+ begin
+ pd:=nil;
+ for i:=0 to argcount-1 do
+ begin
+ IntToStr(StrCopyE(pc,opt_argf),i); argf[i]:=DBReadDWord (0,DBBranch,section);
+ IntToStr(StrCopyE(pc,opt_argn),i); p :=DBReadString(0,DBBranch,section);
+ if (p=nil) or (p^=#0) then
+ begin
+ if pd=nil then
+ pd:=Translate('Argument');
+ ppd:=StrCopyE(argn[i],pd); ppd^:=' '; inc(ppd);
+ IntToStr(ppd,i+1);
+ end
+ else
+ StrCopy(argn[i],p);
+ mFreeMem(p);
+ IntToStr(StrCopyE(pc,opt_argv),i); LoadParam(section,argf[i],pointer(argv[i]));
+ end;
+ end;
+ end;
+{
+ 1: begin
+ end;
+}
+ end;
+end;
+
+procedure SaveParam(section:PAnsiChar;flags:dword; param:pointer);
+begin
+ if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then
+ begin
+ if pointer(param)<>nil then
+ begin
+ if (flags and ACF_STRUCT)<>0 then
+ DBWriteUTF8(0,DBBranch,section,param)
+ else
+ DBWriteUnicode(0,DBBranch,section,param);
+ end;
+ end;
+end;
+
+procedure tCallAction.Save(node:pointer;fmt:integer);
+var
+ section: array [0..127] of AnsiChar;
+ pc:pAnsiChar;
+ i:integer;
+begin
+ inherited Save(node,fmt);
+ case fmt of
+ 0: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+ StrCopy(pc,opt_dllname ); DBWriteString(0,DBBranch,section,dllname);
+ StrCopy(pc,opt_funcname); DBWriteString(0,DBBranch,section,funcname);
+ StrCopy(pc,opt_argcount); DBWriteByte (0,DBBranch,section,argcount);
+ if argcount>0 then
+ begin
+ for i:=0 to argcount-1 do
+ begin
+ IntToStr(StrCopyE(pc,opt_argf),i); DBWriteDWord (0,DBBranch,section,argf[i]);
+ IntToStr(StrCopyE(pc,opt_argn),i); DBWriteString(0,DBBranch,section,argn[i]);
+ IntToStr(StrCopyE(pc,opt_argv),i); SaveParam(section,argf[i],pointer(argv[i]));
+ end;
+ end;
+ end;
+{
+ 1: begin
+ end;
+}
+ end;
+end;
+
+//----- Dialog realization -----
+
+{
+ IDC_ARGNUM userdata = current item (argument number)
+ IDC_ARGCOUNT userdata = arguments buffer
+ Dialog userdata = parameter control
+}
+
+type
+ peditvalues = ^teditvalues;
+ teditvalues = record
+ argf:array [0..MaxArgCount-1] of dword;
+ argv:array [0..MaxArgCount-1] of uint_ptr;
+ argn:array [0..MaxArgCount-1,0..MaxArgNameLen-1] of AnsiChar;
+ end;
+
+function GetArgumentWindow(Dialog:HWND):HWND;
+begin
+ result:=GetWindowLongPtrW(GetDlgItem(Dialog,IDC_CLOSE_ARG),GWLP_USERDATA);
+end;
+
+function GetResultWindow(Dialog:HWND):HWND;
+begin
+ result:=GetWindowLongPtrW(GetDlgItem(Dialog,IDC_CLOSE_RES),GWLP_USERDATA);
+end;
+
+function GetEditValues(Dialog:HWND):pointer;
+begin
+ result:=pointer(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_ARGCOUNT),GWLP_USERDATA));
+end;
+
+function ChangeArgNumber(Dialog:HWND;cnt:integer=-1):integer;
+var
+ wnd,wnd1:HWND;
+ tr:bool;
+ pe:peditvalues;
+ i:integer;
+begin
+ if cnt<0 then
+ cnt:=GetDlgItemInt(Dialog,IDC_ARGCOUNT,tr,false)
+// cnt:=CB_GetData(GetDlgItem(Dialog,IDC_ARGCOUNT))
+ else
+ SendMessage(GetDlgItem(Dialog,IDC_ARGCOUNT),CB_SETCURSEL,cnt,0);
+
+ wnd :=GetArgumentWindow(Dialog);
+ wnd1:=GetDlgItem(Dialog,IDC_ARGNUM);
+ SendMessage(wnd1,CB_RESETCONTENT,0,0);
+ if cnt=0 then
+ begin
+ ShowWindow(wnd ,SW_HIDE);
+ ShowWindow(wnd1,SW_HIDE);
+ end
+ else
+ begin
+ if IsDlgButtonChecked(Dialog,IDC_CLOSE_ARG)<>BST_UNCHECKED then
+ begin
+ ShowWindow(wnd ,SW_SHOW);
+ ShowWindow(wnd1,SW_SHOW);
+ end;
+ pe:=GetEditValues(Dialog);
+
+ for i:=0 to cnt-1 do
+ begin
+ InsertString(wnd1,i,@pe^.argn[i]);
+ end;
+ SendMessage(wnd1,CB_SETCURSEL,0,0);
+ end;
+ result:=cnt;
+end;
+
+procedure FillTemplates(fwnd:HWND);
+var
+ p,pp,pz:pAnsiChar;
+ lptr:pointer;
+ i:integer;
+begin
+ SendMessage(fwnd,CB_RESETCONTENT,0,0);
+
+ p:=GetSectionList(storage,namespace);
+ pp:=p;
+ i:=0;
+ while p^<>#0 do
+ begin
+ lptr:=SearchSection(storage,p,namespace);
+ pz:=StrScan(p,'$');
+ if pz=nil then
+ pz:=p-1;
+ // add function if not found
+ if SendMessageA(fwnd,CB_FINDSTRINGEXACT,-1,LParam(pz+1))=CB_ERR then
+ CB_AddStrData(fwnd,pz+1,int_ptr(lptr){not so required}, i);
+
+ while p^<>#0 do inc(p); inc(p);
+ inc(i);
+ end;
+ FreeSectionList(pp);
+ if i>0 then
+ begin
+ SendMessage(fwnd,CB_SETCURSEL,0,0);
+ end;
+end;
+
+procedure SearchDllByFName(flist,dlist:HWND;idx:Integer=-1);
+var
+ pc,p,pp,pz:pAnsiChar;
+ lptr:pointer;
+ buf:array [0..31] of AnsiChar;
+ buf1:array [0..63] of AnsiChar;
+ i:integer;
+begin
+ if idx<0 then
+ pc:=GetDlgText(flist,true)
+ else
+ begin
+ pc:=@buf1;
+ SendMessageA(flist,CB_GETLBTEXT,idx,LParam(@buf1));
+ end;
+
+ SendMessage(dlist,CB_RESETCONTENT,0,0);
+
+ p:=GetSectionList(storage,namespace);
+ pp:=p;
+ i:=0;
+ while p^<>#0 do
+ begin
+ lptr:=SearchSection(storage,p,namespace);
+ pz:=StrScan(p,'$');
+ if (pz<>nil) and (StrCmp(pz+1,pc)=0) then
+ begin
+ // add dll name
+ StrCopy(buf,p,pz-p);
+ CB_AddStrData(dlist,buf,int_ptr(lptr), i);
+ inc(i);
+ end;
+
+ while p^<>#0 do inc(p); inc(p);
+ end;
+ FreeSectionList(pp);
+ if idx<0 then
+ mFreeMem(pc);
+
+ if i>0 then
+ SendMessage(dlist,CB_SETCURSEL,0,0);
+end;
+
+procedure FillByTemplate(Dialog:HWND);
+var
+ buf:array [0..15] of AnsiChar;
+ fwnd,dwnd:HWND;
+ sect:pointer;
+ pe:peditvalues;
+ pc,pd,ppd:pAnsiChar;
+ sel,cnt,i:integer;
+begin
+ fwnd:=GetDlgItem(Dialog,IDC_LIST_FUNC);
+ dwnd:=GetDlgItem(Dialog,IDC_LIST_DLL);
+ // right now, without manual typing, by selecting only
+ sect:=nil;
+ sel:=SendMessage(dwnd,CB_GETCURSEL,0,0);
+ if sel=CB_ERR then
+ begin
+ sel:=SendMessage(fwnd,CB_GETCURSEL,0,0);
+ if sel<>CB_ERR then
+ sect:=pointer(CB_GetData(fwnd,sel));
+ end
+ else
+ sect:=pointer(CB_GetData(dwnd,sel));
+ if sect=nil then
+ exit;
+
+// ClearFields if templated found
+ if StrCmp(GetParamSectionStr(sect,'calltype',nil),'cdecl')=0 then
+ begin
+ CheckDlgButton(Dialog,IDC_CDECL,BST_CHECKED);
+ CheckDlgButton(Dialog,IDC_STDCALL,BST_UNCHECKED);
+ end
+ else
+ begin
+ CheckDlgButton(Dialog,IDC_CDECL,BST_UNCHECKED);
+ CheckDlgButton(Dialog,IDC_STDCALL,BST_CHECKED);
+ end;
+
+ cnt:=GetParamSectionInt(sect,'argcount');
+ pe:=GetEditValues(Dialog);
+ pd:=nil;
+ for i:=0 to cnt-1 do
+ begin
+ IntToStr(StrCopyE(buf,opt_argn),i+1); pc:=GetParamSectionStr(sect,buf);
+ if (pc=nil) or (pc^=#0) then
+ begin
+ if pd=nil then
+ pd:=Translate('Argument');
+ ppd:=StrCopyE(pe^.argn[i],pd); ppd^:=' '; inc(ppd);
+ IntToStr(ppd,i+1);
+ end
+ else
+ StrCopy(pe^.argn[i],pc);
+
+ IntToStr(StrCopyE(buf,opt_argv),i+1);
+
+ mFreeMem(pe^.argv[i]);
+ StrDup(pAnsiChar(pe^.argv[i]),GetParamSectionStr(sect,buf,''));
+ pe^.argf[i]:=ACF_TEMPLATE;
+ end;
+ ChangeArgNumber(Dialog,cnt);
+ FillParam(GetArgumentWindow(Dialog),pointer(pe^.argv[0]));
+
+end;
+
+function FillDllName(Dialog:HWND;idc:integer):boolean;
+var
+ pw:array [0..1023] of WideChar;
+ ppw:pWideChar;
+begin
+// mGetMem(pw,1024*SizeOf(WideChar));
+ ppw:=GetDlgText(Dialog,idc);
+ result:=ShowDlgW(pw,ppw);
+ if result then
+ begin
+ SetDlgItemTextW(Dialog,idc,pw);
+ end;
+ mFreeMem(ppw);
+// mFreeMem(pw);
+end;
+
+procedure ShowHideBlock(Dialog:HWND;showarg:boolean);
+var
+ wnd,wnd1:HWND;
+ rc:TRECT;
+ pt:TPOINT;
+ tr:bool;
+ arg,res:integer;
+begin
+ wnd1:=GetArgumentWindow(Dialog);
+ if showarg then
+ begin
+ arg:=SW_SHOW;
+ res:=SW_HIDE;
+ wnd:=wnd1;
+ end
+ else
+ begin
+ arg:=SW_HIDE;
+ res:=SW_SHOW;
+ wnd:=GetDlgItem(Dialog,IDC_CLOSE_ARG);
+ end;
+
+ GetWindowRect(wnd,rc);
+ pt.x:=rc.left;
+ pt.y:=rc.bottom;
+ ScreenToClient(Dialog,pt);
+ SetWindowPos(GetDlgItem(Dialog,IDC_CLOSE_RES),
+ HWND_TOP,1,pt.y+2,0,0,SWP_NOZORDER or SWP_NOSIZE);
+
+ ShowWindow(GetResultWindow(Dialog),res);
+
+
+ ShowWindow(GetDlgItem(Dialog,IDC_ARGSTAT ),arg);
+ ShowWindow(GetDlgItem(Dialog,IDC_ARGCOUNT),arg);
+
+ if GetDlgItemInt(Dialog,IDC_ARGCOUNT,tr,false)=0 then
+// if CB_GetData(GetDlgItem(Dialog,IDC_ARGCOUNT))=0 then
+ arg:=SW_HIDE;
+
+ ShowWindow(GetDlgItem(Dialog,IDC_ARGNUM),arg);
+ ShowWindow(wnd1,arg);
+end;
+
+procedure MakeDLLCacheList(wnd:HWND);
+begin
+ SendMessage(wnd,CB_RESETCONTENT,0,0);
+ InsertString(wnd,0,'Keep to end');
+ InsertString(wnd,1,'Close immediately');
+ InsertString(wnd,2,'Close for macro');
+ SendMessage(wnd,CB_SETCURSEL,0,0);
+end;
+
+procedure ClearFields(Dialog:HWND);
+begin
+ CheckDlgButton(Dialog,IDC_CDECL ,BST_UNCHECKED);
+ CheckDlgButton(Dialog,IDC_STDCALL,BST_UNCHECKED);
+{!!
+ CheckDlgButton(Dialog,IDC_DLL_IMM ,BST_UNCHECKED);
+ CheckDlgButton(Dialog,IDC_DLL_MACRO,BST_UNCHECKED);
+ CheckDlgButton(Dialog,IDC_DLL_END ,BST_UNCHECKED);
+}
+ ClearParamFields (GetArgumentWindow(Dialog));
+ ClearResultFields(GetResultWindow (Dialog));
+
+ ShowHideBlock(Dialog,true);
+end;
+
+function DlgProc(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
+var
+ wnd,wnd1:HWND;
+ buf:array [0..63] of AnsiChar;
+ pc:pAnsiChar;
+ pe:peditvalues;
+ rc:TRECT;
+ pt:TPOINT;
+ tr:bool;
+ i:integer;
+begin
+ result:=0;
+
+ case hMessage of
+ WM_DESTROY: begin
+ pe:=GetEditValues(Dialog);
+ for i:=0 to MaxArgCount-1 do
+ begin
+ //?? depends of copying from edit to action
+ ClearParam(pe.argf[i],pe.argv[i]);
+ end;
+ mFreeMem(pe);
+
+ CloseStorage(storage);
+ end;
+
+ WM_INITDIALOG: begin
+ //insert additional dialogs
+ CheckDlgButton(Dialog,IDC_CLOSE_ARG,BST_CHECKED);
+ wnd1:=GetDlgItem(Dialog,IDC_CLOSE_ARG);
+ EnableWindow(wnd1,false);
+ wnd:=GetDlgItem(Dialog,IDC_ARGNUM); // count offset from
+ GetWindowRect(wnd,rc);
+ pt.x:=rc.left;
+ pt.y:=rc.bottom;
+ ScreenToClient(Dialog,pt);
+ SetWindowLongPtrW(wnd1,GWLP_USERDATA,CreateParamBlock(Dialog,0,pt.y+2,168));
+
+ CheckDlgButton(Dialog,IDC_CLOSE_RES,BST_UNCHECKED);
+ wnd:=GetDlgItem(Dialog,IDC_CLOSE_RES); // count offset from initial pos
+ GetWindowRect(wnd,rc);
+ EnableWindow(wnd,true);
+ pt.x:=rc.left;
+ pt.y:=rc.bottom;
+ ScreenToClient(Dialog,pt);
+ wnd1:=CreateResultBlock(Dialog,0,pt.y+2,168);
+ SetWindowLongPtrW(wnd,GWLP_USERDATA,wnd1);
+ ShowWindow(wnd1,SW_HIDE);
+
+ mGetMem(pe,SizeOf(teditvalues));
+ FillChar(pe^,SizeOf(teditvalues),0);
+ SetWindowLongPtrW(GetDlgItem(Dialog,IDC_ARGCOUNT),GWLP_USERDATA,uint_ptr(pe));
+
+ // function argument amount list
+ wnd1:=GetDlgItem(Dialog,IDC_ARGCOUNT);
+ SendMessage(wnd1,CB_RESETCONTENT,0,0);
+ for i:=0 to MaxArgCount do
+ begin
+ InsertString(wnd1,i,IntToStr(buf,i));
+ end;
+ SendMessage(wnd1,CB_SETCURSEL,0,0);
+
+ // function templates
+ storage:=OpenStorage(API_FUNCTION_FILE);
+ if storage<>nil then
+ begin
+ wnd :=GetDlgItem(Dialog,IDC_LIST_FUNC);
+ FillTemplates(wnd)
+ end;
+
+ MakeDLLCacheList(GetDlgItem(Dialog,IDC_DLL_CACHE));
+
+ TranslateDialogDefault(Dialog);
+ end;
+
+ WM_ACT_SETVALUE: begin
+ ClearFields(Dialog);
+
+ with tCallAction(lParam) do
+ begin
+
+ // set function
+ SetDlgItemTextA(Dialog,IDC_LIST_FUNC,funcname);
+ // sset dll name (semi-auto)
+ SetDlgItemTextA(Dialog,IDC_LIST_DLL ,dllname);
+ // set call type (auto)
+ if (flags and ACF_CDECL)<>0 then
+ CheckDlgButton(Dialog,IDC_CDECL ,BST_CHECKED)
+ else
+ CheckDlgButton(Dialog,IDC_STDCALL,BST_CHECKED);
+{!!
+ // set dll cache option
+ if (flags and ACF_CACHE_NOW)<>0 then
+ CheckDlgButton(Dialog,IDC_DLL_IMM,BST_CHECKED)
+ else if (flags and ACF_CACHE_MACRO)<>0 then
+ CheckDlgButton(Dialog,IDC_DLL_MACRO,BST_CHECKED)
+ else
+ CheckDlgButton(Dialog,IDC_DLL_END,BST_CHECKED);
+}
+ if (flags and ACF_CACHE_NOW)<>0 then
+ i:=1
+ else if (flags and ACF_CACHE_MACRO)<>0 then
+ i:=2
+ else
+ i:=0;
+ SendMessage(GetDlgItem(Dialog,IDC_DLL_CACHE),CB_SETCURSEL,i,0);
+
+ // set argument amount
+ // (auto)
+ ChangeArgNumber(Dialog,argcount);
+ if argcount>0 then
+ begin
+ // copy action values to edit values
+ pe:=GetEditValues(Dialog);
+ // need to clear ALL params before? or keep as is?
+ // depends of enabled or disabled arg amount combo
+ for i:=0 to argcount-1 do
+ begin
+ StrCopy(pe^.argn[i],argn[i]);
+ pe^.argf[i]:=DuplicateParam(argf[i],argv[i],pe^.argv[i]);
+ end;
+
+ wnd1:=GetDlgItem(Dialog,IDC_ARGNUM);
+ SendMessage(wnd1,CB_RESETCONTENT,0,0);
+
+ for i:=0 to argcount-1 do
+ begin
+ InsertString(wnd1,i,@pe^.argn[i]);
+ end;
+ SendMessage(wnd1,CB_SETCURSEL,0,0);
+
+ SetParamValue (GetArgumentWindow(Dialog),argf[0],pointer(argv[0]));
+ SetResultValue(GetResultWindow (Dialog),flags);
+ end;
+
+ end;
+ end;
+
+ WM_ACT_RESET: begin
+ ClearFields(Dialog);
+ SetDlgItemTextW(Dialog,IDC_LIST_FUNC,nil);
+ SetDlgItemTextW(Dialog,IDC_LIST_DLL ,nil);
+ SendMessage(GetDlgItem(Dialog,IDC_LIST_DLL),CB_RESETCONTENT,0,0);
+ CheckDlgButton(Dialog,IDC_STDCALL,BST_CHECKED);
+//!! CheckDlgButton(Dialog,IDC_DLL_END,BST_CHECKED);
+ SendMessage(GetDlgItem(Dialog,IDC_DLL_CACHE),CB_SETCURSEL,0,0);
+
+ ChangeArgNumber(Dialog,0);
+
+ pe:=GetEditValues(Dialog);
+
+ pc:=StrCopyE(buf,Translate('Argument')); pc^:=' '; inc(pc);
+ for i:=0 to MaxArgCount-1 do
+ begin
+ IntToStr(pc,i+1);
+ StrCopy(pe^.argn[i],buf);
+ ClearParam(pe.argf[i],pe.argv[i]);
+ end;
+
+ end;
+
+ WM_ACT_SAVE: begin
+ with tCallAction(lParam) do
+ begin
+ argcount:=GetDlgItemInt(Dialog,IDC_ARGCOUNT,tr,false);
+ if argcount>0 then
+ begin
+ pe:=GetEditValues(Dialog);
+ // save current argument
+ i:=GetWindowLongPtrW(GetDlgItem(Dialog,IDC_ARGNUM),GWLP_USERDATA); // current saved
+// i:=CB_GetData(GetDlgItem(Dialog,IDC_ARGNUM)); // current from data
+ GetParamValue(GetArgumentWindow(Dialog),pe^.argf[i],pointer(pe^.argv[i]));
+
+ // copy edit values to action values
+ for i:=0 to argcount-1 do
+ begin
+ StrCopy(argn[i],pe^.argn[i]);
+ argf[i]:=DuplicateParam(pe^.argf[i],pe^.argv[i],argv[i]);
+ end;
+ end;
+
+ flags:=flags or GetResultValue(GetResultWindow(Dialog));
+ if IsDlgButtonChecked(Dialog,IDC_CDECL)<>BST_UNCHECKED then
+ flags:=flags or ACF_CDECL;
+{!!
+ if IsDlgButtonChecked(Dialog,IDC_DLL_IMM)<>BST_UNCHECKED then
+ flags:=flags or ACF_CACHE_NOW
+ else if IsDlgButtonChecked(Dialog,IDC_DLL_MACRO)<>BST_UNCHECKED then
+ flags:=flags or ACF_CACHE_MACRO;
+}
+ case SendMessage(GetDlgItem(Dialog,IDC_DLL_CACHE),CB_GETCURSEL,0,0) of
+ 1: flags:=flags or ACF_CACHE_NOW;
+ 2: flags:=flags or ACF_CACHE_MACRO;
+ end;
+
+ funcname:=GetDlgText(Dialog,IDC_LIST_FUNC,true);
+ dllname :=GetDlgText(Dialog,IDC_LIST_DLL ,true);
+
+ end;
+ end;
+
+ WM_COMMAND: begin
+ case wParam shr 16 of
+
+ BN_CLICKED: begin
+ case loword(wParam) of
+ IDC_DLL: begin
+ if not FillDllName(Dialog,IDC_LIST_DLL) then
+ exit;
+ end;
+
+ IDC_CLOSE_RES: begin
+ // close buttons
+ EnableWindow(LParam,false);
+ EnableWindow(GetDlgItem(Dialog,IDC_CLOSE_ARG),true);
+ CheckDlgButton(Dialog,IDC_CLOSE_ARG,BST_UNCHECKED);
+
+ ShowHideBlock(Dialog,false);
+ end;
+
+ IDC_CLOSE_ARG: begin
+ // close buttons
+ EnableWindow(LParam,false);
+ EnableWindow(GetDlgItem(Dialog,IDC_CLOSE_RES),true);
+ CheckDlgButton(Dialog,IDC_CLOSE_RES,BST_UNCHECKED);
+
+ ShowHideBlock(Dialog,true);
+ end;
+ end;
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+ end;
+
+ CBN_EDITCHANGE,
+ EN_CHANGE: begin
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+
+ if loword(wParam)=IDC_LIST_FUNC then
+ begin
+ wnd :=GetDlgItem(Dialog,IDC_LIST_FUNC);
+ wnd1:=GetDlgItem(Dialog,IDC_LIST_DLL);
+ SearchDllByFName(wnd,wnd1);
+ end;
+ end;
+
+ CBN_SELCHANGE: begin
+ case loword(wParam) of
+ IDC_LIST_FUNC: begin
+ // search in templates
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+
+ wnd :=GetDlgItem(Dialog,IDC_LIST_FUNC);
+ wnd1:=GetDlgItem(Dialog,IDC_LIST_DLL);
+ // search this name as part in all ini templates,
+ // fill IDC_LIST_DLL combobox
+ SearchDllByFName(wnd,wnd1,SendMessage(wnd,CB_GETCURSEL,0,0));
+ FillByTemplate(Dialog);
+ end;
+
+ IDC_LIST_DLL: begin
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+ FillByTemplate(Dialog);
+ end;
+
+ IDC_ARGNUM: begin
+ pe:=GetEditValues(Dialog);
+
+ wnd:=GetArgumentWindow(Dialog);
+ // 1 - save old argument value (save as for dialogs?)
+ i:=GetWindowLongPtrW(lParam,GWLP_USERDATA);
+ GetParamValue(wnd,pe^.argf[i],pointer(pe^.argv[i]));
+ // 2 - set new argument value
+ i:=CB_GetData(lParam);
+ SetParamValue(wnd,pe^.argf[i],pointer(pe^.argv[i]));
+
+ SetWindowLongPtrW(lParam,GWLP_USERDATA,i);
+ end;
+
+ IDC_ARGCOUNT: begin
+ ChangeArgNumber(Dialog);
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+ end;
+ end;
+ end;
+ end;
+ end;
+
+ WM_HELP: begin
+ result:=1;
+ end;
+
+ end;
+end;
+
+//----- Export/interface functions -----
+
+var
+ vc:tActModule;
+
+function CreateAction:tBaseAction;
+begin
+ result:=tCallAction.Create(vc.Hash);
+end;
+
+function CreateDialog(parent:HWND):HWND;
+begin
+ result:=CreateDialogW(hInstance,'IDD_ACTCALL',parent,@DlgProc);
+end;
+
+procedure Init;
+begin
+ vc.Next :=ModuleLink;
+
+ vc.Name :='Function call';
+ vc.Dialog :=@CreateDialog;
+ vc.Create :=@CreateAction;
+ vc.Icon :='IDI_CALL';
+
+ ModuleLink :=@vc;
+end;
+
+begin
+ Init;
+end.
diff --git a/plugins/Actman30/iac_call.rc b/plugins/Actman30/iac_call.rc new file mode 100644 index 0000000000..f32f7bc303 --- /dev/null +++ b/plugins/Actman30/iac_call.rc @@ -0,0 +1,38 @@ +#include "i_cnst_call.inc"
+
+LANGUAGE 0,0
+
+IDD_ACTCALL DIALOGEX 0, 0, 168, 200, 0
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0
+{
+ RTEXT "Function name", -1, 1, 0, 166, 12, SS_CENTERIMAGE
+ COMBOBOX IDC_LIST_FUNC , 1, 12, 166, 128, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL
+ RTEXT "DLL name" , -1, 1, 26, 166, 12, SS_CENTERIMAGE
+ COMBOBOX IDC_LIST_DLL , 1, 38, 148, 48, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL
+ PUSHBUTTON "...", IDC_DLL , 151, 38, 16, 12
+
+ GROUPBOX "Call type" , -1, 1, 52, 166, 22, WS_GROUP
+ AUTORADIOBUTTON "cdecl" , IDC_CDECL , 4, 61, 52, 11
+ AUTORADIOBUTTON "stdcall" , IDC_STDCALL , 57, 61, 52, 11
+
+ AUTOCHECKBOX "Arguments", IDC_CLOSE_ARG, 1, 78, 166, 11, BS_PUSHLIKE
+ AUTOCHECKBOX "Result" , IDC_CLOSE_RES, 1, 91, 166, 11, BS_PUSHLIKE
+
+ RTEXT "Number of arguments", IDC_ARGSTAT, 1, 90, 132, 12, SS_CENTERIMAGE
+ COMBOBOX IDC_ARGCOUNT , 137, 89, 30, 76, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL
+ // argument list fills by amount of it?
+ COMBOBOX IDC_ARGNUM , 1, 104, 166, 76, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL
+
+ RTEXT "DLL Handle Cache", -1, 1, 173, 166, 12, SS_CENTERIMAGE
+ COMBOBOX IDC_DLL_CACHE , 1, 185, 166, 76, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL
+/*
+ GROUPBOX "DLL Handle Cache" , -1, 1, 156, 166, 44, WS_GROUP
+ AUTORADIOBUTTON "Close immediately", IDC_DLL_IMM , 4, 165, 162, 11
+ AUTORADIOBUTTON "Close for macro" , IDC_DLL_MACRO, 4, 176, 162, 11
+ AUTORADIOBUTTON "Keep to end" , IDC_DLL_END , 4, 187, 162, 11
+*/
+}
+
+IDI_CALL ICON "ico\call.ico"
diff --git a/plugins/Actman30/iac_call.res b/plugins/Actman30/iac_call.res Binary files differnew file mode 100644 index 0000000000..bda9bc40b1 --- /dev/null +++ b/plugins/Actman30/iac_call.res diff --git a/plugins/Actman30/iac_chain.res b/plugins/Actman30/iac_chain.res Binary files differnew file mode 100644 index 0000000000..a9ba4f5515 --- /dev/null +++ b/plugins/Actman30/iac_chain.res diff --git a/plugins/Actman30/iac_contact.rc b/plugins/Actman30/iac_contact.rc index 65a7d2843e..b3923502b3 100644 --- a/plugins/Actman30/iac_contact.rc +++ b/plugins/Actman30/iac_contact.rc @@ -7,7 +7,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0
{
- RTEXT "Choose contact", -1 , 0, 2, 160, 10
+ RTEXT "Choose Contact", -1 , 0, 2, 160, 10
CONTROL "Refresh",IDC_CNT_REFRESH,"MButtonClass",WS_TABSTOP,1,12,16,16,$18000000
COMBOBOX IDC_CONTACTLIST, 19, 14, 148, 128, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
AUTOCHECKBOX "Keep handle only", IDC_CNT_KEEP , 1, 31, 160, 11
diff --git a/plugins/Actman30/iac_contact.res b/plugins/Actman30/iac_contact.res Binary files differnew file mode 100644 index 0000000000..2b8b4ba352 --- /dev/null +++ b/plugins/Actman30/iac_contact.res diff --git a/plugins/Actman30/iac_database.res b/plugins/Actman30/iac_database.res Binary files differnew file mode 100644 index 0000000000..b74dee1d7b --- /dev/null +++ b/plugins/Actman30/iac_database.res diff --git a/plugins/Actman30/iac_global.pas b/plugins/Actman30/iac_global.pas index ef069d8e34..11bfbba275 100644 --- a/plugins/Actman30/iac_global.pas +++ b/plugins/Actman30/iac_global.pas @@ -12,7 +12,7 @@ var const
IcoLibPrefix = 'action_type_';
const
- NoDescription:PWideChar='No description';
+ NoDescription:PWideChar='No Description';
const
protostr = '<proto>';
const
@@ -94,7 +94,7 @@ function ImportContactINI(node:pointer):THANDLE; implementation
-uses Common, global, dbsettings, mirutils;
+uses Common, global, dbsettings, base64, mirutils;
//----- tBaseAction code -----
const
@@ -308,7 +308,6 @@ var dbv:TDBVARIANT;
tmp:pWideChar;
is_chat:boolean;
- bufLen:int;
begin
with xmlparser do
begin
@@ -337,8 +336,7 @@ begin DBVT_UTF8 : WideToUTF8(tmp,dbv.szVal.A);
DBVT_WCHAR : dbv.szVal.W:=tmp;
DBVT_BLOB : begin
- dbv.pbVal := mir_base64_decode(FastWideToAnsi(tmp,pAnsiChar(dbv.pbVal)),bufLen);
- dbv.cpbVal := bufLen;
+ Base64Decode(FastWideToAnsi(tmp,pAnsiChar(dbv.pbVal)),dbv.pbVal);
end;
end;
end;
@@ -427,4 +425,73 @@ begin end;
end;
}
+
+//----- DLL Handle Cache -----
+type
+ tDLLCacheElement = record
+ DLLName :PAnsiChar;
+ DLLHandle:THANDLE;
+ count :word; // count for end-of-macro flag
+ flags :byte; // handle free mode
+ end;
+ tDLLCache = array of tDLLCacheElement;
+
+const
+ actDLLCache: tDLLCache = nil;
+
+function GetDllHandle(dllname:pAnsiChar;mode:dword=0):THANDLE;
+var
+ i:integer;
+begin
+ result:=LoadLibraryA(dllname);
+exit;
+ i:=0;
+ while i<=HIGH(actDLLCache) do
+ begin
+ if StrCmp(actDLLCache[i].DllName,dllname)=0 then
+ begin
+ result:=actDLLCache[i].DllHandle;
+ // check mode
+ exit;
+ end;
+ inc(i);
+ end;
+ result:=LoadLibraryA(dllname);
+ // check mode
+ SetLength(actDLLCache,i);
+ StrDup(actDLLCache[i].DllName,dllname);
+ actDLLCache[i].DllHandle:=result;
+// actDLLCache.flags:=;
+end;
+
+procedure CloseDllHandle(handle:THANDLE);
+var
+ i:integer;
+begin
+ FreeLibrary(handle);
+exit;
+ i:=0;
+ while i<=HIGH(actDLLCache) do
+ begin
+ if actDLLCache[i].DllHandle=handle then
+ begin
+ // check mode
+ FreeLibrary(actDLLCache[i].DllHandle);
+ exit;
+ end;
+ inc(i);
+ end;
+ FreeLibrary(handle);
+end;
+
+procedure FreeDllHandleCache;
+var
+ i:integer;
+begin
+ i:=0;
+ while i<=HIGH(actDLLCache) do
+ begin
+ end;
+end;
+
end.
diff --git a/plugins/Actman30/iac_inout.res b/plugins/Actman30/iac_inout.res Binary files differnew file mode 100644 index 0000000000..f912dc3066 --- /dev/null +++ b/plugins/Actman30/iac_inout.res diff --git a/plugins/Actman30/iac_jump.pas b/plugins/Actman30/iac_jump.pas index 9a54d7181b..7d3d405f2a 100644 --- a/plugins/Actman30/iac_jump.pas +++ b/plugins/Actman30/iac_jump.pas @@ -373,7 +373,7 @@ begin SendMessage(wnd,CB_RESETCONTENT,0,0);
InsertString(wnd,cardinal(aeGT),'> greater');
- InsertString(wnd,cardinal(aeLT),'> lesser');
+ InsertString(wnd,cardinal(aeLT),'< lesser');
InsertString(wnd,cardinal(aeEQ),'= equ');
InsertString(wnd,cardinal(aeXR),'^ xor');
InsertString(wnd,cardinal(aeND),'& and');
diff --git a/plugins/Actman30/iac_jump.res b/plugins/Actman30/iac_jump.res Binary files differnew file mode 100644 index 0000000000..387b85dfdd --- /dev/null +++ b/plugins/Actman30/iac_jump.res diff --git a/plugins/Actman30/iac_messagebox.res b/plugins/Actman30/iac_messagebox.res Binary files differnew file mode 100644 index 0000000000..27a3297a61 --- /dev/null +++ b/plugins/Actman30/iac_messagebox.res diff --git a/plugins/Actman30/iac_program.pas b/plugins/Actman30/iac_program.pas index 56e494b3d2..83cc60a5f9 100644 --- a/plugins/Actman30/iac_program.pas +++ b/plugins/Actman30/iac_program.pas @@ -320,13 +320,14 @@ begin CheckDlgButton(Dialog,IDC_FLAG_PARALLEL,BST_UNCHECKED);
end;
-procedure FillFileName(Dialog:HWND;idc:integer);
+function FillFileName(Dialog:HWND;idc:integer):boolean;
var
pw,ppw:pWideChar;
begin
mGetMem(pw,1024*SizeOf(WideChar));
ppw:=GetDlgText(Dialog,idc);
- if ShowDlgW(pw,ppw) then
+ result:=ShowDlgW(pw,ppw);
+ if result then
begin
SetDlgItemTextW(Dialog,idc,pw);
SetEditFlags(Dialog,idc,EF_SCRIPT,0);
@@ -437,7 +438,8 @@ begin BN_CLICKED: begin
case loword(wParam) of
IDC_PROGRAM: begin
- FillFileName(Dialog,IDC_EDIT_PRGPATH);
+ if not FillFileName(Dialog,IDC_EDIT_PRGPATH) then
+ exit;
end;
end;
SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
diff --git a/plugins/Actman30/iac_program.res b/plugins/Actman30/iac_program.res Binary files differnew file mode 100644 index 0000000000..a7754455b4 --- /dev/null +++ b/plugins/Actman30/iac_program.res diff --git a/plugins/Actman30/iac_service.res b/plugins/Actman30/iac_service.res Binary files differnew file mode 100644 index 0000000000..35c7e96161 --- /dev/null +++ b/plugins/Actman30/iac_service.res diff --git a/plugins/Actman30/iac_settings.res b/plugins/Actman30/iac_settings.res Binary files differnew file mode 100644 index 0000000000..ee1b268205 --- /dev/null +++ b/plugins/Actman30/iac_settings.res diff --git a/plugins/Actman30/iac_storage.res b/plugins/Actman30/iac_storage.res Binary files differnew file mode 100644 index 0000000000..b87ec5fec2 --- /dev/null +++ b/plugins/Actman30/iac_storage.res diff --git a/plugins/Actman30/iac_text.res b/plugins/Actman30/iac_text.res Binary files differnew file mode 100644 index 0000000000..19c1025c8c --- /dev/null +++ b/plugins/Actman30/iac_text.res diff --git a/plugins/Actman30/ico/call.ico b/plugins/Actman30/ico/call.ico Binary files differnew file mode 100644 index 0000000000..ddddb59074 --- /dev/null +++ b/plugins/Actman30/ico/call.ico diff --git a/plugins/Actman30/mApiCard.res b/plugins/Actman30/mApiCard.res Binary files differnew file mode 100644 index 0000000000..7d6ed320b9 --- /dev/null +++ b/plugins/Actman30/mApiCard.res diff --git a/plugins/Actman30/make.bat b/plugins/Actman30/make.bat index 6e10afe21f..0512c815b6 100644 --- a/plugins/Actman30/make.bat +++ b/plugins/Actman30/make.bat @@ -1,18 +1,30 @@ @echo off
-set myopts=-dMiranda
-set dprname=actman.dpr
-
-for /R %%I in (*.rc) do brcc32.exe %myopts% %%I -fo%%~npI.res >nul
-
+set p1=%1
+set p2=%2
+if "%p1%" == "" (echo "please specify target platform by adding 'fpc' or 'fpc64 parameter to command line!'"&&pause&&goto :EOF)
+if "%p2%" == "" (echo "please specify target output directory by adding 10 for bin10 or 11 for bin11 to command line!'"&&pause&&goto :EOF)
if /i '%1' == 'fpc' (
- ..\FPC\bin\fpc.exe %myopts% %dprname% %2 %3 %4 %5 %6 %7 %8 %9
+ set OUTDIR="..\..\bin%2\Release\Plugins"
+ set FPCBIN=fpc.exe
) else if /i '%1' == 'fpc64' (
- ..\FPC\bin64\ppcrossx64.exe %myopts% %dprname% %2 %3 %4 %5 %6 %7 %8 %9
-) else if /i '%1' == 'xe2' (
- ..\XE2\BIN\dcc32.exe %myopts% %dprname% %2 %3 %4 %5 %6 %7 %8 %9
-) else if /i '%1' == 'xe64' (
- ..\XE2\BIN\dcc64.exe %myopts% %dprname% %2 %3 %4 %5 %6 %7 %8 %9
-) else (
- ..\delphi\dcc32 %myopts% %dprname% %1 %2 %3 %4 %5 %6 %7 %8 %9
+ set OUTDIR="..\..\bin%2\Release64\Plugins"
+ set FPCBIN=ppcrossx64.exe
)
-del /Q /S *.res >nul
+set PROJECT=Actman30
+
+if not exist %OUTDIR% mkdir %OUTDIR%
+md tmp
+
+rem brcc32.exe %myopts% options.rc -fooptions.res
+rem brcc32.exe %myopts% hooks\hooks.rc -fohooks\hooks.res
+rem brcc32.exe %myopts% tasks\tasks.rc -fotasks\tasks.res
+rem brcc32.exe %myopts% ua\ua.rc -foua\ua.res
+
+%FPCBIN% @..\Utils.pas\fpc.cfg %PROJECT%.dpr %3 %4 %5 %6 %7 %8 %9
+if errorlevel 1 exit /b 1
+
+move .\tmp\%PROJECT%.dll %OUTDIR%
+move .\tmp\%PROJECT%.map .
+del /Q tmp\*
+rd tmp
+exit /b 0
diff --git a/plugins/Actman30/options.res b/plugins/Actman30/options.res Binary files differnew file mode 100644 index 0000000000..3ca52285ec --- /dev/null +++ b/plugins/Actman30/options.res diff --git a/plugins/Actman30/services.ini b/plugins/Actman30/services.ini index 1366cf950d..3e3f51ca28 100644 --- a/plugins/Actman30/services.ini +++ b/plugins/Actman30/services.ini @@ -450,21 +450,21 @@ descr=Display XStatus detail [Event:Actions/Changed]
alias=ME_ACT_CHANGED
plugin=ActMan
-descr='action group list was changed: some was added or deleted'
+descr='Action group list was changed: some was added or deleted'
wparam=ACTM_NEW|ACTM_DELETE|ACTM_RELOAD|ACTM_RENAME|ACTM_SORT|ACTM_LOADED
lparam=0
[Event:CList/PreBuildContactMenu]
alias=ME_CLIST_PREBUILDCONTACTMENU
plugin=contact list
-descr='the context menu for a contact is about to be built'
+descr='The context menu for a contact is about to be built'
wparam=hContact
lparam=0
[Event:CList/DoubleClicked]
alias=ME_CLIST_DOUBLECLICKED
plugin=contact list
-descr='double click on the CList'
+descr='Double click on the CList'
wparam=hContact
lparam=0
@@ -521,3 +521,18 @@ value=40079 value=40080
[Const:ID_STATUS_IDLE]
value=40081
+
+[Function:user32.dll$MessageBoxA]
+;dll=
+calltype=stdcall
+argcount=4
+argvalue1=0
+argvalue2=Ansi message
+argvalue3=Ansi caption
+argvalue4=0
+argname1=hWnd
+argname2=lpText
+argname3=lpCaption
+argname4=uType
+return=int 0
+descr=Displays a modal dialog box that contains a system icon, a set of buttons, and a brief application-specific message, such as status or error information.
diff --git a/plugins/Actman30/sparam.pas b/plugins/Actman30/sparam.pas new file mode 100644 index 0000000000..e29d375ae4 --- /dev/null +++ b/plugins/Actman30/sparam.pas @@ -0,0 +1,708 @@ +unit sparam;
+
+interface
+
+uses windows,iac_global;
+
+const
+ ACF_PARNUM = $00000001; // Param is number
+ ACF_UNICODE = $00000002; // Param is Unicode string
+ ACF_CURRENT = $00000004; // Param is ignored, used current user handle
+ // from current message window
+ ACF_RESULT = $00000008; // Param is previous action result
+ ACF_PARAM = $00000010; // Param is Call parameter
+ ACF_STRUCT = $00000020;
+ ACF_PARTYPE = ACF_PARNUM or ACF_UNICODE or
+ ACF_CURRENT or ACF_RESULT or
+ ACF_PARAM or ACF_STRUCT;
+ ACF_TEMPLATE = $00000800;
+ ACF_SCRIPT_PARAM = $00001000;
+ // dummy
+ ACF_STRING = 0;
+
+ ACF_RSTRING = $00010000; // Service result is string
+ ACF_RUNICODE = $00020000; // Service result is Widestring
+ ACF_RSTRUCT = $00040000; // Service result in structure
+ ACF_RFREEMEM = $00080000; // Need to free memory
+
+function CreateParamBlock(parent:HWND;x,y,width:integer):THANDLE;
+procedure ClearParamFields(Dialog:HWND);
+function FillParam (Dialog:HWND;txt:pAnsiChar):integer;
+function SetParamValue (Dialog:HWND; flags:dword; value:pointer):boolean;
+function GetParamValue (Dialog:HWND;var flags:dword;var value:pointer):boolean;
+
+procedure ClearParam (flags:dword; var param);
+function DuplicateParam(flags:dword; var sparam,dparam):dword;
+
+procedure PreProcess(flags:dword;var l_param:LPARAM;const WorkData:tWorkData);
+
+function CreateResultBlock(parent:HWND;x,y,width:integer):THANDLE;
+procedure ClearResultFields(Dialog:HWND);
+function SetResultValue(Dialog:HWND;flags:dword):integer;
+function GetResultValue(Dialog:HWND):dword;
+
+implementation
+
+uses
+ messages,
+ common, editwrapper, wrapper, syswin,
+ m_api, sedit, strans, mirutils;
+
+{$include i_sparam_const.inc}
+{$resource sparam.res}
+
+const
+ ptNumber = 0;
+ ptString = 1;
+ ptUnicode = 2;
+ ptCurrent = 3;
+ ptResult = 4;
+ ptParam = 5;
+ ptStruct = 6;
+
+const
+ sresInt = 0;
+ sresString = 1;
+ sresWide = 2;
+ sresStruct = 3;
+
+//----- Processing functions -----
+
+procedure PreProcess(flags:dword;var l_param:LPARAM;const WorkData:tWorkData);
+var
+ tmp1:pWideChar;
+begin
+ with WorkData do
+ begin
+ if (flags and ACF_STRUCT)<>0 then
+ begin
+ l_param:=uint_ptr(MakeStructure(pAnsiChar(l_param),Parameter,LastResult,ResultType))
+ end
+ else if (flags and ACF_PARAM)<>0 then
+ begin
+ l_param:=Parameter;
+ end
+ else if (flags and ACF_RESULT)<>0 then
+ begin
+ l_param:=LastResult;
+ end
+ else if (flags and ACF_CURRENT)<>0 then
+ begin
+ l_param:=WndToContact(WaitFocusedWndChild(GetForegroundwindow){GetFocus});
+ end
+ else
+ begin
+ if (flags and ACF_SCRIPT_PARAM)<>0 then
+ l_param:=uint_ptr(ParseVarString(pWideChar(l_param),Parameter));
+
+ tmp1:=pWideChar(l_param);
+ if (flags and ACF_PARNUM)=0 then
+ begin
+ if (flags and ACF_UNICODE)=0 then
+ WideToAnsi(tmp1,pAnsiChar(l_param),MirandaCP)
+ else
+ StrDupW(pWideChar(l_param),tmp1);
+ end
+ else
+ l_param:=NumToInt(tmp1);
+
+ if (flags and ACF_SCRIPT_PARAM)<>0 then
+ mFreeMem(tmp1);
+ end;
+ end;
+end;
+
+procedure PostProcess(flags:dword;var l_param:LPARAM; var WorkData:tWorkData);
+var
+ code:integer;
+ len:integer;
+ pc:pAnsiChar;
+begin
+ if (flags and ACF_STRUCT)<>0 then
+ begin
+ with WorkData do
+ begin
+ LastResult:=GetStructureResult(l_param,@code,@len);
+ case code of
+{
+ SST_LAST: begin
+ result:=LastResult;
+ end;
+}
+ SST_PARAM: begin //??
+ LastResult:=Parameter;
+ ResultType:=rtInt;
+ end;
+ SST_BYTE,SST_WORD,SST_DWORD,
+ SST_QWORD,SST_NATIVE: begin
+ ResultType:=rtInt;
+ end;
+ SST_BARR: begin
+ StrDup(pAnsiChar(pc),pAnsiChar(LastResult),len);
+ AnsiToWide(pAnsiChar(pc),PWideChar(LastResult),MirandaCP);
+ mFreeMem(pAnsiChar(pc));
+ ResultType:=rtWide;
+ end;
+ SST_WARR: begin
+ StrDupW(pWideChar(LastResult),pWideChar(LastResult),len);
+ ResultType:=rtWide;
+ end;
+ SST_BPTR: begin
+ AnsiToWide(pAnsiChar(LastResult),pWideChar(LastResult),MirandaCP);
+ ResultType:=rtWide;
+ end;
+ SST_WPTR: begin
+ StrDupW(pWideChar(LastResult),pWideChar(LastResult));
+ ResultType:=rtWide;
+ end;
+ end;
+ FreeStructure(l_param);
+ l_param:=0;
+ end
+ end;
+end;
+
+//----- Dialog functions -----
+
+procedure MakeParamTypeList(wnd:HWND);
+begin
+ SendMessage(wnd,CB_RESETCONTENT,0,0);
+ InsertString(wnd,ptNumber ,'number value');
+ InsertString(wnd,ptString ,'ANSI string');
+ InsertString(wnd,ptUnicode,'Unicode string');
+ InsertString(wnd,ptCurrent,'current contact');
+ InsertString(wnd,ptResult ,'last result');
+ InsertString(wnd,ptParam ,'parameter');
+ InsertString(wnd,ptStruct ,'structure');
+ SendMessage(wnd,CB_SETCURSEL,0,0);
+end;
+
+function IsParamNumber(txt:pAnsiChar):boolean;
+begin
+ if (txt[0] in ['0'..'9']) or ((txt[0]='-') and (txt[1] in ['0'..'9'])) or
+ ((txt[0]='$') and (txt[1] in sHexNum)) or
+ ((txt[0]='0') and (txt[1]='x') and (txt[2] in sHexNum)) then
+ result:=true
+ else
+ result:=false;
+end;
+
+// Set parameter type by parameter template
+function FixParam(buf:PAnsiChar):integer;
+begin
+ if StrCmp(buf,'hContact' )=0 then result:=ptCurrent
+ else if StrCmp(buf,'parameter' )=0 then result:=ptParam
+ else if StrCmp(buf,'result' )=0 then result:=ptResult
+ else if StrCmp(buf,'structure' )=0 then result:=ptStruct
+ else if StrCmp(buf,'Unicode text')=0 then result:=ptUnicode
+ else result:=ptString;
+end;
+
+// get line from template
+function GetParamLine(src:pAnsiChar;dst:pWideChar;var ltype:integer):pAnsiChar;
+var
+ pp,pc:pAnsiChar;
+ savechar:AnsiChar;
+ j:integer;
+begin
+ pc:=StrScan(src,'|');
+
+ if pc<>nil then
+ begin
+ savechar:=pc^;
+ pc^:=#0;
+ end;
+
+ if IsParamNumber(src) then
+ begin
+ j:=0;
+ pp:=src;
+ repeat
+ dst[j]:=WideChar(pp^);
+ inc(j); inc(pp);
+ until (pp^=#0) or (pp^=' ');
+ dst[j]:=WideChar(pp^); // anyway, #0 or " " needs
+ if pp^<>#0 then
+ begin
+ dst[j+1]:='-'; dst[j+2]:=' '; inc(j,3);
+ FastAnsitoWideBuf(pp+1,dst+j);
+ StrCopyW(dst+j,TranslateW(dst+j));
+ end;
+ ltype:=ptNumber;
+ end
+ else
+ begin
+ ltype:=FixParam(src);
+ StrCopyW(dst,TranslateW(FastAnsitoWideBuf(src,dst)));
+ end;
+
+ if pc<>nil then
+ begin
+ pc^:=savechar;
+ inc(pc);
+ end;
+
+ result:=pc;
+end;
+
+// Set parameter value by parameter template
+function FillParam(Dialog:HWND;txt:pAnsiChar):integer;
+var
+ bufw:array [0..2047] of WideChar;
+ wnd:HWND;
+ p,pc:PAnsiChar;
+ ltype:integer;
+begin
+ wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR);
+ SendMessage(wnd,CB_RESETCONTENT,0,0);
+ if (txt<>nil) and (txt^<>#0) then
+ begin
+ result:=-1;
+ p:=txt;
+ repeat
+ pc:=GetParamLine(p,bufw,ltype);
+ if result<0 then
+ result:=ltype;
+ SendMessageW(wnd,CB_ADDSTRING,0,lparam(@bufw));
+
+ if result=ptStruct then
+ break
+ else
+ p:=pc;
+ until pc=nil;
+ end
+ else
+ result:=ptNumber;
+ SendMessage(wnd,CB_SETCURSEL,0,0);
+end;
+
+procedure ClearParamFields(Dialog:HWND);
+var
+ wnd:HWND;
+begin
+ ShowWindow(GetDlgItem(Dialog,IDC_STRUCT),SW_HIDE);
+ wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR);
+ ShowEditField (wnd,SW_SHOW);
+ EnableEditField(wnd,true);
+ SendMessage (wnd,CB_RESETCONTENT,0,0);
+ SetEditFlags (wnd,EF_ALL,0);
+ CB_SelectData(Dialog,IDC_FLAG_PAR,ptNumber);
+end;
+
+function ParamDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl;
+begin
+ case urc^.wId of
+ IDC_FLAG_PAR: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; //RD_ANCHORX_RIGHT
+ IDC_EDIT_PAR: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP;
+ IDC_STRUCT: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP;
+ IDC_STAT_PAR: result:=RD_ANCHORX_LEFT or RD_ANCHORY_TOP;
+// IDC_CLOSE: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP;
+ else
+ result:=0;
+ end;
+end;
+
+function DlgParamProc(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
+var
+ wnd,wnd1:HWND;
+ i:integer;
+ pcw:pWideChar;
+ pc:pAnsiChar;
+ urd:TUTILRESIZEDIALOG;
+begin
+ result:=0;
+
+ case hMessage of
+ WM_DESTROY: begin
+ pc:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA));
+ mFreeMem(pc);
+ end;
+
+ WM_INITDIALOG: begin
+ MakeEditField(Dialog,IDC_EDIT_PAR);
+
+ MakeParamTypeList(GetDlgItem(Dialog,IDC_FLAG_PAR));
+ end;
+
+ WM_SIZE: begin
+ FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
+ urd.cbSize :=SizeOf(urd);
+ urd.hwndDlg :=Dialog;
+ urd.hInstance :=hInstance;
+ urd.lpTemplate:=MAKEINTRESOURCEA('IDD_SPARAM');
+ urd.lParam :=0;
+ urd.pfnResizer:=@ParamDlgResizer;
+ CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ end;
+
+ WM_SHOWWINDOW: begin
+ // hide window by ShowWindow function
+ if (lParam=0) and (wParam=0) then
+ begin
+ pc:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA,0));
+ mFreeMem(pc);
+ end;
+ end;
+
+ WM_COMMAND: begin
+ case wParam shr 16 of
+ CBN_EDITCHANGE,
+ EN_CHANGE: begin
+ SendMessage(GetParent(Dialog),WM_COMMAND,CBN_EDITCHANGE shl 16,Dialog);
+ end;
+
+ CBN_SELCHANGE: begin
+ SendMessage(GetParent(Dialog),WM_COMMAND,CBN_EDITCHANGE shl 16,Dialog);
+ case loword(wParam) of
+ IDC_FLAG_PAR: begin
+ wnd :=GetDlgItem(Dialog,IDC_EDIT_PAR);
+ wnd1:=GetDlgItem(Dialog,IDC_STRUCT);
+
+ i:=CB_GetData(GetDlgItem(Dialog,loword(wParam)));
+
+ if i=ptStruct then
+ begin
+ ShowEditField(wnd ,SW_HIDE);
+ ShowWindow (wnd1,SW_SHOW);
+ end
+ else
+ begin
+ ShowEditField(wnd ,SW_SHOW);
+ ShowWindow (wnd1,SW_HIDE);
+
+ if i in [ptCurrent,ptResult,ptParam] then
+ EnableEditField(wnd,false)
+ else
+ begin
+ if i=ptNumber then
+ begin
+ pcw:='0';
+ SendMessageW(wnd,WM_SETTEXT,0,TLParam(pcw));
+ end;
+ EnableEditField(wnd,true);
+ end;
+ end;
+ end;
+ end;
+ end;
+ end;
+ end;
+ end;
+end;
+
+//----- Common interface functions -----
+
+function CreateParamBlock(parent:HWND;x,y,width:integer):THANDLE;
+var
+ rc,rc1:TRECT;
+begin
+ SetRect(rc,x,y,x+width,y+0{dlgheight});
+ MapDialogRect(parent,rc);
+
+ result:=CreateDialogW(hInstance,'IDD_SPARAM',parent,@DlgParamProc);
+ GetClientRect(result,rc1);
+ SetWindowPos(result,0,
+ x,y{rc.left,rc.top},rc.right-rc.left,rc1.bottom-rc1.top,
+ SWP_NOZORDER);
+end;
+
+// if separate
+function DestroyBlock(block:pointer):integer;
+begin
+ result:=0;
+end;
+
+function SetParamValue(Dialog:HWND;flags:dword;value:pointer):boolean;
+var
+ wnd,wnd1:HWND;
+ pc:pAnsiChar;
+ vtype:integer;
+begin
+ result:=true;
+//?? Check for "Apply" activation
+
+ wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR);
+ if (flags and ACF_TEMPLATE)<>0 then
+ begin
+ vtype:=FillParam(Dialog,value);
+ end
+ else if (flags and ACF_PARAM)<>0 then
+ begin
+ SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Parameter')));
+ EnableWindow(wnd,false);
+ vtype:=ptParam;
+ end
+ else if (flags and ACF_RESULT)<>0 then
+ begin
+ SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Last result')));
+ EnableWindow(wnd,false);
+ vtype:=ptResult;
+ end
+ else if (flags and ACF_CURRENT)<>0 then
+ begin
+ SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Current user')));
+ EnableWindow(wnd,false);
+ vtype:=ptCurrent;
+ end
+ else if (flags and ACF_STRUCT)<>0 then
+ begin
+ vtype:=ptStruct;
+
+ ShowEditField(wnd,SW_HIDE);
+ wnd1:=GetDlgItem(Dialog,IDC_STRUCT);
+ ShowWindow(wnd1,SW_SHOW);
+ // delete old value
+ pc:=pAnsiChar(GetWindowLongPtrW(wnd1,GWLP_USERDATA));
+ mFreeMem(pc);
+ // set newly allocated
+ SetWindowLongPtrW(wnd1,GWLP_USERDATA,long_ptr(StrDup(pc,pAnsiChar(value))));
+//!!!!!!!!
+ end
+ else if (flags and ACF_PARNUM)<>0 then
+ begin
+ vtype:=ptNumber;
+ SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value));
+ end
+ else if (flags and ACF_UNICODE)<>0 then
+ begin
+ vtype:=ptUnicode;
+ SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value));
+ end
+ else
+ begin
+ vtype:=ptString;
+ SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value));
+ end;
+ SetEditFlags(wnd,EF_SCRIPT,ord((flags and ACF_SCRIPT_PARAM)<>0));
+
+ CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_PAR),vtype);
+end;
+
+function GetParamValue(Dialog:HWND;var flags:dword;var value:pointer):boolean;
+var
+ wnd:HWND;
+begin
+ result:=true;
+ flags:=0;
+ value:=nil;
+ wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR);
+ case CB_GetData(GetDlgItem(Dialog,IDC_FLAG_PAR)) of
+ ptParam: begin
+ flags:=flags or ACF_PARAM
+ end;
+ ptResult: begin
+ flags:=flags or ACF_RESULT
+ end;
+ ptCurrent: begin
+ flags:=flags or ACF_CURRENT
+ end;
+ ptNumber: begin
+ flags:=flags or ACF_PARNUM;
+ value:=GetDlgText(wnd);
+ end;
+ ptStruct: begin
+ flags:=flags or ACF_STRUCT;
+ StrDup(pAnsiChar(value),
+ pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA)));
+ end;
+ ptUnicode: begin
+ flags:=flags or ACF_UNICODE;
+ value:=GetDlgText(wnd);
+ end;
+ ptString: value:=GetDlgText(wnd);
+ end;
+ if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then
+ flags:=flags or ACF_SCRIPT_PARAM;
+end;
+
+procedure ClearParam(flags:dword; var param);
+begin
+ if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then
+ mFreeMem(pointer(param));
+end;
+
+function DuplicateParam(flags:dword; var sparam,dparam):dword;
+var
+ tmpdst:array [0..2047] of WideChar;
+ ltype:integer;
+begin
+ mFreeMem(dparam);
+
+ if (flags and ACF_TEMPLATE)<>0 then
+ begin
+ flags:=flags and not (ACF_TEMPLATE or ACF_PARTYPE);
+ GetParamLine(pAnsiChar(sparam),tmpdst,ltype);
+ case ltype of
+ ptNumber: begin
+ flags:=flags or ACF_PARNUM;
+ StrDupW(pWideChar(dparam),pWideChar(@tmpdst));
+ end;
+ ptString: begin
+ flags:=flags or ACF_STRING;
+ StrDupW(pWideChar(dparam),pWideChar(@tmpdst));
+ end;
+ ptUnicode: begin
+ flags:=flags or ACF_UNICODE;
+ StrDupW(pWideChar(dparam),pWideChar(@tmpdst));
+ end;
+ ptStruct: begin
+ flags:=flags or ACF_STRUCT;
+ StrDup(pAnsiChar(dparam),pAnsiChar(sparam)+10); //10=StrLen('structure|')
+ end;
+ ptCurrent: flags:=flags or ACF_CURRENT;
+ ptResult : flags:=flags or ACF_RESULT;
+ ptParam : flags:=flags or ACF_PARAM;
+ end;
+ end
+ else if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then
+ begin
+ if (flags and ACF_PARNUM)<>0 then
+ StrDupW(pWideChar(dparam),pWideChar(sparam))
+ else if (flags and ACF_STRUCT)<>0 then
+ StrDup(pAnsiChar(dparam),pAnsiChar(sparam))
+ else if (flags and ACF_UNICODE)<>0 then
+ StrDupW(pWideChar(dparam),pWideChar(sparam))
+ else
+ StrDupW(pWideChar(dparam),pWideChar(sparam));
+ end;
+ result:=flags;
+end;
+
+//----- result block -----
+
+procedure MakeResultTypeList(wnd:HWND);
+begin
+ SendMessage(wnd,CB_RESETCONTENT,0,0);
+ InsertString(wnd,sresInt ,'Integer');
+ InsertString(wnd,sresString,'String');
+ InsertString(wnd,sresWide ,'Wide String');
+ InsertString(wnd,sresStruct,'Structure');
+ SendMessage(wnd,CB_SETCURSEL,0,0);
+end;
+
+function ResultDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl;
+begin
+ case urc^.wId of
+ IDC_RES_TYPE : result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; //RD_ANCHORX_RIGHT
+ IDC_RES_FREEMEM: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP;
+ IDC_RES_STAT : result:=RD_ANCHORX_LEFT or RD_ANCHORY_TOP;
+ IDC_RES_GROUP : result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP;
+ else
+ result:=0;
+ end;
+end;
+
+procedure ClearResultFields(Dialog:HWND);
+begin
+ CheckDlgButton(Dialog,IDC_RES_FREEMEM,BST_UNCHECKED);
+ ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_HIDE);
+ CB_SelectData(Dialog,IDC_RES_TYPE,sresInt);
+end;
+
+function DlgResultProc(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
+var
+ urd:TUTILRESIZEDIALOG;
+ i:integer;
+begin
+ result:=0;
+
+ case hMessage of
+ WM_INITDIALOG: begin
+ MakeResultTypeList(GetDlgItem(Dialog,IDC_RES_TYPE));
+ end;
+
+ WM_SIZE: begin
+ FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
+ urd.cbSize :=SizeOf(urd);
+ urd.hwndDlg :=Dialog;
+ urd.hInstance :=hInstance;
+ urd.lpTemplate:=MAKEINTRESOURCEA('IDD_SRESULT');
+ urd.lParam :=0;
+ urd.pfnResizer:=@ResultDlgResizer;
+ CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ end;
+
+ WM_COMMAND: begin
+ case wParam shr 16 of
+ CBN_SELCHANGE: begin
+ case loword(wParam) of
+ IDC_RES_TYPE: begin
+ case CB_GetData(lParam) of
+ sresInt,sresStruct: begin
+ i:=SW_HIDE;
+ end;
+ sresString,sresWide: begin
+ i:=SW_SHOW;
+ end;
+ end;
+ ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),i);
+ end;
+ end;
+ end;
+ end;
+ end;
+ end;
+end;
+
+function CreateResultBlock(parent:HWND;x,y,width:integer):THANDLE;
+var
+ rc,rc1:TRECT;
+begin
+ SetRect(rc,x,y,x+width,y+0{dlgheight});
+ MapDialogRect(parent,rc);
+
+ result:=CreateDialogW(hInstance,'IDD_SRESULT',parent,@DlgResultProc);
+ GetClientRect(result,rc1);
+ SetWindowPos(result,0,
+ x,y{rc.left,rc.top},rc.right-rc.left,rc1.bottom-rc1.top,
+ SWP_NOZORDER);
+end;
+
+function SetResultValue(Dialog:HWND;flags:dword):integer;
+var
+ btn:integer;
+begin
+ // RESULT
+ if (flags and ACF_RSTRUCT)<>0 then
+ result:=sresStruct
+ else if (flags and ACF_RSTRING)<>0 then
+ begin
+ if (flags and ACF_RFREEMEM)<>0 then
+ btn:=BST_CHECKED
+ else
+ btn:=BST_UNCHECKED;
+ CheckDlgButton(Dialog,IDC_RES_FREEMEM,btn);
+
+ if (flags and ACF_RUNICODE)<>0 then
+ result:=sresWide
+ else
+ result:=sresString;
+ end
+ else
+ begin
+ result:=sresInt;
+ end;
+ CB_SelectData(Dialog,IDC_RES_TYPE,result);
+end;
+
+function GetResultValue(Dialog:HWND):dword;
+begin
+ case CB_GetData(GetDlgItem(Dialog,IDC_RES_TYPE)) of
+ sresString: begin
+ result:=ACF_RSTRING;
+ if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then
+ result:=result or ACF_RFREEMEM;
+ end;
+ sresWide: begin
+ result:=ACF_RSTRING or ACF_RUNICODE;
+ if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then
+ result:=result or ACF_RFREEMEM;
+ end;
+ sresStruct: result:=ACF_RSTRUCT;
+ else
+ result:=0;
+ end;
+
+end;
+
+end.
diff --git a/plugins/Actman30/sparam.rc b/plugins/Actman30/sparam.rc new file mode 100644 index 0000000000..a36fc5b680 --- /dev/null +++ b/plugins/Actman30/sparam.rc @@ -0,0 +1,27 @@ +#include "i_sparam_const.inc"
+
+LANGUAGE 0,0
+
+IDD_SPARAM DIALOGEX 0, 0, 168, 31, 0
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0
+{
+// PUSHBUTTON "open/close" , IDC_CLOSE , 1, 116, 166, 14
+ RTEXT "wParam type", IDC_STAT_PAR, 1, 1, 63, 14, SS_CENTERIMAGE
+ COMBOBOX IDC_FLAG_PAR, 66, 1, 102, 56, CBS_DROPDOWNLIST | WS_VSCROLL
+// RTEXT "wParam" , -1, 1, 116, 160, 8
+ COMBOBOX IDC_EDIT_PAR, 1, 16, 166, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL
+ PUSHBUTTON "Structure" , IDC_STRUCT , 1, 16, 166, 14
+}
+
+IDD_SRESULT DIALOGEX 0, 0, 168, 53, 0
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0
+{
+ GROUPBOX "Result" , IDC_RES_GROUP , 1, 0, 166, 50, WS_GROUP
+ RTEXT "Result type" , IDC_RES_STAT , 4, 9, 159, 11
+ COMBOBOX IDC_RES_TYPE , 4, 20, 159, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL
+ AUTOCHECKBOX "Free memory" , IDC_RES_FREEMEM, 4, 36, 159, 11
+}
diff --git a/plugins/Actman30/sparam.res b/plugins/Actman30/sparam.res Binary files differnew file mode 100644 index 0000000000..0491ec8f83 --- /dev/null +++ b/plugins/Actman30/sparam.res diff --git a/plugins/Actman30/structopts.res b/plugins/Actman30/structopts.res Binary files differnew file mode 100644 index 0000000000..f651b686f2 --- /dev/null +++ b/plugins/Actman30/structopts.res diff --git a/plugins/Actman30/tasks.res b/plugins/Actman30/tasks.res Binary files differnew file mode 100644 index 0000000000..bc72f06406 --- /dev/null +++ b/plugins/Actman30/tasks.res diff --git a/plugins/Actman30/tmp/FreeImage.ppu b/plugins/Actman30/tmp/FreeImage.ppu Binary files differnew file mode 100644 index 0000000000..f25e2c85ec --- /dev/null +++ b/plugins/Actman30/tmp/FreeImage.ppu diff --git a/plugins/Actman30/tmp/PsAPI.ppu b/plugins/Actman30/tmp/PsAPI.ppu Binary files differnew file mode 100644 index 0000000000..ef67c967e3 --- /dev/null +++ b/plugins/Actman30/tmp/PsAPI.ppu diff --git a/plugins/Actman30/tmp/ask.res b/plugins/Actman30/tmp/ask.res Binary files differnew file mode 100644 index 0000000000..15a00e0218 --- /dev/null +++ b/plugins/Actman30/tmp/ask.res diff --git a/plugins/Actman30/tmp/commctrl.ppu b/plugins/Actman30/tmp/commctrl.ppu Binary files differnew file mode 100644 index 0000000000..4456f8e7b5 --- /dev/null +++ b/plugins/Actman30/tmp/commctrl.ppu diff --git a/plugins/Actman30/tmp/common.ppu b/plugins/Actman30/tmp/common.ppu Binary files differnew file mode 100644 index 0000000000..43cef92527 --- /dev/null +++ b/plugins/Actman30/tmp/common.ppu diff --git a/plugins/Actman30/tmp/dbsettings.ppu b/plugins/Actman30/tmp/dbsettings.ppu Binary files differnew file mode 100644 index 0000000000..7ce66f7110 --- /dev/null +++ b/plugins/Actman30/tmp/dbsettings.ppu diff --git a/plugins/Actman30/tmp/global.ppu b/plugins/Actman30/tmp/global.ppu Binary files differnew file mode 100644 index 0000000000..46e10fc2cc --- /dev/null +++ b/plugins/Actman30/tmp/global.ppu diff --git a/plugins/Actman30/tmp/io.ppu b/plugins/Actman30/tmp/io.ppu Binary files differnew file mode 100644 index 0000000000..73b9a58bd5 --- /dev/null +++ b/plugins/Actman30/tmp/io.ppu diff --git a/plugins/Actman30/tmp/mApiCard.res b/plugins/Actman30/tmp/mApiCard.res Binary files differnew file mode 100644 index 0000000000..7d6ed320b9 --- /dev/null +++ b/plugins/Actman30/tmp/mApiCard.res diff --git a/plugins/Actman30/tmp/mApiCardM.ppu b/plugins/Actman30/tmp/mApiCardM.ppu Binary files differnew file mode 100644 index 0000000000..8db033ec05 --- /dev/null +++ b/plugins/Actman30/tmp/mApiCardM.ppu diff --git a/plugins/Actman30/tmp/m_api.ppu b/plugins/Actman30/tmp/m_api.ppu Binary files differnew file mode 100644 index 0000000000..94ef17fde8 --- /dev/null +++ b/plugins/Actman30/tmp/m_api.ppu diff --git a/plugins/Actman30/tmp/memini.ppu b/plugins/Actman30/tmp/memini.ppu Binary files differnew file mode 100644 index 0000000000..34fa7338bb --- /dev/null +++ b/plugins/Actman30/tmp/memini.ppu diff --git a/plugins/Actman30/tmp/mirutils.ppu b/plugins/Actman30/tmp/mirutils.ppu Binary files differnew file mode 100644 index 0000000000..1627956ef1 --- /dev/null +++ b/plugins/Actman30/tmp/mirutils.ppu diff --git a/plugins/Actman30/tmp/question.ppu b/plugins/Actman30/tmp/question.ppu Binary files differnew file mode 100644 index 0000000000..a00b7fa2c2 --- /dev/null +++ b/plugins/Actman30/tmp/question.ppu diff --git a/plugins/Actman30/tmp/syswin.ppu b/plugins/Actman30/tmp/syswin.ppu Binary files differnew file mode 100644 index 0000000000..bd3a2a4040 --- /dev/null +++ b/plugins/Actman30/tmp/syswin.ppu diff --git a/plugins/Actman30/tmp/wrapper.ppu b/plugins/Actman30/tmp/wrapper.ppu Binary files differnew file mode 100644 index 0000000000..2fe9202853 --- /dev/null +++ b/plugins/Actman30/tmp/wrapper.ppu diff --git a/plugins/Actman30/ua.res b/plugins/Actman30/ua.res Binary files differnew file mode 100644 index 0000000000..8316b81f51 --- /dev/null +++ b/plugins/Actman30/ua.res |