0 Members and 2 Guests are viewing this topic.
procedure MyFunc();begin WriteLn('MyFunc');end;procedure ActivateServer();begin AddCrossFuncRestriction('MyFunc'); MyFunc(); // 'MyFunc' gets written in the consoleend;
procedure AppOnIdle(const Ticks: cardinal);begin CrossFunc([], 'Foo.MyFunc'); // no action, or exceptionend;
function IsCrossFuncRestricted(const FuncName: string): boolean; // since each script can supply this function separately, the "const Script: string;" parameter is unnecessarybegin Result := (CrossFuncScript = 'Bar') and (FuncName = 'MyFunc'); // or even Result := (CrossFuncScript <> ScriptName) and (FuncName = 'MyFunc'); to not allow any script calling it CrossFuncScript := ''; // so if somebody CrossFuncs MyFunc, and then this script normally calls it, it doesn't think it was a CrossFunc that caused it and end up denying it when it should be allowed// or can use an array of functions not allowed (and even could create custom functions to add / del functions), or just an easy switch case statement; any of them could workend;procedure MyFunc();begin if (IsCrossFuncRestricted('MyFunc')) then exit; WriteLn('MyFunc');end;
open nature of scripts
If scripts aren't individually sandboxed, they should be.