I've been playing around recently with downloading BIOS updates for my ASUS laptop, and modifying the 'Energy Star' logo to my own custom design. Why do this? no reason really, except it's fun.
The following code (in C) is used to modify the section of the BIOS update file, which I know resides in the first 4096 bytes of the file header:
#include
#include
typedef unsigned char uint8_t;
// be *very* careful not to screw things up!!
#define FILE_SIZE 8998
#define IMG_START 0x100
int main(int argc, char **argv)
{
uint8_t *buf;
FILE *in;
FILE *out;
int check;
buf = (uint8_t *) malloc(sizeof(uint8_t)*FIL
out = fopen(argv[1], "r+");
in = fopen(argv[2], "r");
fseek(out, IMG_START, SEEK_SET);
check = fread(buf, sizeof(uint8_t), FILE_SIZE, in);
if (check != FILE_SIZE) {
printf("Error reading image\n");
exit(1);
fclose(in); fclose(out);
}
fwrite(buf, sizeof(uint8_t), FILE_SIZE, out);
fclose(in);
fclose(out);
}
Screenshots to be posted later, but what we end up with is an identical image to the first, but with a modified 8bit bitmap image inside.