Shared.CompilerInt.pas 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. implementation
  24. uses
  25. Windows,
  26. SysUtils,
  27. PathFunc, TrustFunc;
  28. initialization
  29. var FileName := AddBackslash(PathExtractPath(ParamStr(0))) + ISCmplrDLL;
  30. if TrustedFile(FileName) then begin
  31. ISCmplrLibrary := SafeLoadLibrary(PChar(FileName), SEM_NOOPENFILEERRORBOX);
  32. if ISCmplrLibrary <> 0 then begin
  33. ISDllCompileScript := GetProcAddress(ISCmplrLibrary, 'ISDllCompileScriptW');
  34. ISDllGetVersion := GetProcAddress(ISCmplrLibrary, 'ISDllGetVersion');
  35. if not Assigned(ISDllCompileScript) or not Assigned(ISDllGetVersion) then begin
  36. FreeLibrary(ISCmplrLibrary);
  37. ISCmplrLibrary := 0;
  38. ISDllCompileScript := nil;
  39. ISDllGetVersion := nil;
  40. end;
  41. end;
  42. end;
  43. end.