Skip to content

Commit 735616f

Browse files
committed
Add pixel data offset to bmp header
1 parent 77a2f6d commit 735616f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/pe_resource_loader.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ void * PeResourceLoader_ProcessIconData(void * data, uint32_t * size) {
453453
}
454454

455455
void * PeResourceLoader_ProcessBitmapData(void * data, uint32_t * size) {
456-
uint8_t bmp_header[] = {0x42, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00};
456+
uint8_t bmp_header[] = {0x42, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
457457
uint32_t return_size = sizeof(bmp_header) + *size;
458458

459459
// Fix size in the header
@@ -462,6 +462,9 @@ void * PeResourceLoader_ProcessBitmapData(void * data, uint32_t * size) {
462462
bmp_header[4] = (return_size >> 16) & 0xFF;
463463
bmp_header[5] = return_size >> 24;
464464

465+
// Set the offset of the pixel data
466+
bmp_header[10] = sizeof(bmp_header) + ((uint32_t *) data)[0];
467+
465468
void * return_data = calloc(1, return_size);
466469
memcpy(return_data, bmp_header, sizeof(bmp_header));
467470
memcpy((uint8_t *) return_data + (sizeof(bmp_header)), data, *size);

0 commit comments

Comments
 (0)