Shared.CompilerInt.pas 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. unit Shared.CompilerInt;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2024 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Compiler interface
  8. }
  9. interface
  10. uses
  11. Shared.CompilerInt.Struct;
  12. const
  13. ISCmplrDLL = 'ISCmplr.dll';
  14. var
  15. ISCmplrLibrary: HMODULE;
  16. { The ISDllCompileScript function begins compilation of a script. See the above
  17. description of the TCompileScriptParams record. Return value is one of the
  18. isce* constants. }
  19. ISDllCompileScript: function(const Params: TCompileScriptParamsEx): Integer; stdcall;
  20. { The ISDllGetVersion returns a pointer to a TCompilerVersionInfo record which
  21. contains information about the compiler version. }
  22. ISDllGetVersion: function: PCompilerVersionInfo; stdcall;
  23. procedure InitISCmplrLibrary;
  24. implementation
  25. uses
  26. Windows,
  27. SysUtils,
  28. PathFunc, TrustFunc;
  29. procedure InitISCmplrLibrary;
  30. begin
  31. var FileName := AddBackslash(PathExtractPath(ParamStr(0))) + ISCmplrDLL;
  32. ISCmplrLibrary := LoadTrustedLibrary(FileName, [ltloTrustAllOnDebug]);
  33. if ISCmplrLibrary <> 0 then begin
  34. ISDllCompileScript := GetProcAddress(ISCmplrLibrary, 'ISDllCompileScriptW');
  35. ISDllGetVersion := GetProcAddress(ISCmplrLibrary, 'ISDllGetVersion');
  36. if not Assigned(ISDllCompileScript) or not Assigned(ISDllGetVersion) then begin
  37. FreeLibrary(ISCmplrLibrary);
  38. ISCmplrLibrary := 0;
  39. ISDllCompileScript := nil;
  40. ISDllGetVersion := nil;
  41. end;
  42. end;
  43. end;
  44. end.