Delphi 图像 DLL 在 Azure 中不工作

Delphi Image DLL not working in Azure

我们有一个 dll 来处理我们软件的一些图像。 我最近在golang中创建了一个应用程序,它使用了这个DLL,在测试环境中一切正常,但是在azure中,创建的图像都是黑色的,我不知道这是不是delphi限制,OS, azure, 如果有人有小费.. 在生成图像的代码下方,即使是只有一个 Draw 的简单代码,图像也会变黑。

AOut := 'test.bmp';
vBitmap := TBitmap.Create;
vBitmap.Width := 2399;
vBitmap.Height := 3337;
vBitmap.PixelFormat := pf24bit;
vBitmap.Canvas.Brush.Color := clRed;
vBitmap.Brush.Style := bsSolid;
vBitmap.Canvas.FillRect(Rect(0,0,2399,3337));
vBitmap.SaveToFile(AOut);

附加信息,如果我得到 canvas 的高度和宽度信息,我在 azure 中的所有内容都是 0,但在其他机器中尺寸是正确的。

Azure A​​pp Service 有一些沙盒限制,尤其是在 GDI 方面。因此,您的部分(或全部)User32/GDI32 API 调用失败。

Win32k.sys (User32/GDI32) Restrictions

For the sake of radical attack surface area reduction, the sandbox prevents almost all of the Win32k.sys APIs from being called, which practically means that most of User32/GDI32 system calls are blocked.

For most applications this is not an issue since most Azure Web Apps do not require access to Windows UI functionality (they are web applications after all).

有关更多信息,请参阅 this wiki document