0xC0000054 / PSFilterPdn

A Paint.NET effect plugin that enables the use of 3rd party 8bf filters.
https://forums.getpaint.net/index.php?/topic/20622-psfilterpdn/
MIT License
39 stars 3 forks source link

Problems with MaxSpace and reserved fields #5

Closed danielmarschall closed 3 years ago

danielmarschall commented 3 years ago

Hello,

I found a few incompatibility problems during plugin development:

(1) pb->MaxSpace seems to be hardcoded to 1 GB? I get the value 1073741824 on a 16 GB system with 64bit Paint.net

(2) pb->MaxSpace64 is not implemented. It would be nice if it could be implemented. The file FilterRecord.cs shows that the fields of version 6.0 are missing (see the latest fields in the Adobe Photoshop SDK)

(3) Very important: The reserved (unimplemented) fields of FilterRecord.cs must be initialized with value 0, otherwise you will receive weird values. For example, MaxSpace64 has the value -8070442948892596903 which crashes my plugin

0xC0000054 commented 3 years ago

(1) pb->MaxSpace seems to be hardcoded to 1 GB? I get the value 1073741824 on a 16 GB system with 64bit Paint.net

This was done to avoid any compatibility issues with plugins handling 2 GB - 1. If there is less than 1 GB of available space the plugin will report that value.

(2) pb->MaxSpace64 is not implemented. It would be nice if it could be implemented.

As a 3rd-party plugin host I cannot legally use any fields introduced after Photoshop 6.0, Adobe changed the SDK license for the 7.0 and later SDKs to prohibit 3rd party hosts from using them.

(3) Very important: The reserved (unimplemented) fields of FilterRecord.cs must be initialized with value 0, otherwise you will receive weird values. For example, MaxSpace64 has the value -8070442948892596903 which crashes my plugin

They are set to 0 when the FilterRecord structure is created.

The problem appears to be that Adobe keeps increasing the size of the reserved field in the post-6.0 SDKs The 32-bit FilterRecord structure is 452 bytes in the 6.0 SDK, 456 bytes in the CS6 SDK, and 488 bytes in the CC 2017 SDK.

You should probably check if the BufferSuite implements the 64-bit APIs (numBufferProcs >= 8) before relying on the MaxSpace64 fields.

danielmarschall commented 3 years ago

Thank you for the quick reply, and the hint with numBufferProcs. I will use that.

I'm sorry, I had made a mistake in my debug process. "maxSpace64" is actually 0. Your plugin has set the reserved/unimplemented fields correctly to 0. Sorry for inconveniences!