Bug 5703

Issue in BMP File Creation by using Windows API 10 June, 2021

Suguna Thamaraiselvan
07 December, 2020
Product: PowerBuilder Category: Runtime
Version: 2019 R2 Build: 2353
Classification: Issue Publishing: Public
Priority: P3
Status: Closed Reason: RESOLVED
Mark Lee @Appeon 10 June, 2021
Hi Suguna,

Thank you very much for your response!
We then proceed to close this ticket, please remember that you can always open another ticket in case you need it.
Have a nice day!

Mark lee
Suguna Thamaraiselvan 10 June, 2021
Hi Mark,

We have moved on to PB 2019 R3 also. Yes same issue occurred here also.
I have applied your solution.  Now working fine.
Images are creating properly.

Thank you for your great support.

Best Regards,
Mark Lee @Appeon 26 April, 2021
use 1-byte structure

Hi Suguna, 

We can reproduce this issue on our side in PB 2019 R3. And we've also found that PB 12.6 has the same behavior as well.
After a deep analysis of this issue, we think it is related to the structure member alignment in the external function.
You can refer to the following link for detail.
For your issue, you can work it around in two ways.
1. Add "progma_pack(1)" for the CopyBitmapFileHeader external function's declaration, like this:
Subroutine CopyBitmapFileHeader ( Ref blob Destination, bitmapfileheader Source, long Length ) Library "kernel32.dll" Alias For "RtlMoveMemory;Ansi"  progma_pack(1)
2. In the folder where your EXE resides, add a pb.ini file with the below content and see if it works.
If you run the test case under the PB 2019 R2 IDE, you need to go to Tools--->System Options to check the 'Use 1-byte structure member alignment in external function' option, click OK and then restart PB IDE and see if it works. (see attachment)

Mark Lee
Mark Lee @Appeon 02 April, 2021
Hi Suguna, 

Thanks for providing the test case.
We will be working on analyzing/reproducing your case. 
We will keep you posted on the results here.

Mark Lee
Suguna Thamaraiselvan 23 March, 2021
Sample_Applications.zip (33KB)


Sorry for replying late. I was quite busy with urgent projects.

Herewith attached the Sample Application created in both PB12.5.2 and PB2019R2.
Please check and let me know the result.

Best Regards,
armando.herrera 19 February, 2021
Hi Suguna,  

We have been trying to keep in touch with you to find out about the resolution of this issue, we are in the need to close it in the next 3 working days, according to our internal help support policy but please remember you can always open a new ticket.
armando.herrera 25 January, 2021
Hi Suguna, 

I'm just touching base with you about this ticket.  
Please let us know if there is something else to support you with.  

armando.herrera 04 January, 2021
Hi Suguna, 

Are you still facing this matter? 
Please, notice that you can also send us a small video or snapshots of this case. 

Govinda Lopez @Appeon 07 December, 2020

We were not able to reproduce your case. Can you provide us with a small reproducible test case? This will help us pinpoint out the problem faster.

Govinda Lopez @Appeon 07 December, 2020
Hi Suguna,

I will be working on analyzing/reproducing your case. We will keep you posted on the results here. 

Suguna Thamaraiselvan 07 December, 2020
PBMigration.zip (114KB)

Updated the Attachment. BMP file contain the blank space.
Suguna Thamaraiselvan 07 December, 2020
PB1252_Created.bmp (2KB)

BMP File creation failed after the PB Migration from 12.5.2 to 2019R2

*Reproduce Steps:
From our application, At run time, we have created the bmp file by using the CreateCompatibleDC, CreateCompatibleBitmap, CreateFile and WriteFile Windows API functions. This was working in the Powerbuilder 12.5.2.  But after migration, this is not working. 
Any reason, please advise.

Windows 10
Database Type:
Microsoft SQL Server
Database Version:
SQL 2014 SP2