崩溃隔离编解码器工作进程

HotPDF 可以将高风险的 DCTDecode、JPXDecode 和 JBIG2Decode 图像解码移出宿主进程

隔离模式

一旦可用的工作进程接受请求,cimAutomatic 不会在宿主进程中重试失败或恶意输入

进程边界

每个解码请求在分配给单进程 Windows 作业对象的全新隐藏进程中运行

配置

PDF.CodecIsolationMode := cimRequired;
PDF.CodecWorkerExecutable :=
  'C:\Program Files\MyApp\HotPDFCodecWorker.exe';
PDF.CodecWorkerTimeoutMilliseconds := 5000;
PDF.CodecWorkerMemoryLimitBytes := 256 * 1024 * 1024;

Bitmap := PDF.ExtractLoadedImage(0);
if Bitmap = nil then
begin
  PDF.GetLastCodecWorkerInfo(Info);
  Writeln(Ord(Info.Status), ': ', Info.ErrorMessage);
end;

空的 CodecWorkerExecutable 解析为当前应用旁的 HotPDFCodecWorker.exe

遥测

GetLastCodecWorkerInfo 报告状态、进程标识符、退出代码、经过的毫秒数和有界的宿主端诊断

GetLastJPEGReducedDecodeInfo 在隔离的 reduced JPEG 请求后报告源、缩放、输出和扫描线几何

不同状态涵盖不可用或无法启动的工作进程、超时、崩溃、解码拒绝、协议不匹配和解码输出限制

构建与部署

build-HotPDF-Codec-Worker.cmd

构建命令在 tools\CodecWorker\<platform>\Release 下生成单独的 Win32 和 Win64 工作进程;部署与宿主进程架构匹配的工作进程

相关 API