I've been stuck on recover.c for a while now, and looking into the GDB, I've seen that when I fread card.raw into a variable to be able to pass it on, and found that there wasn't a single time in the beginning where the first 4 bytes were 0xff, 0xd8, 0xff, 0xe0, or 0xff, 0xd8, 0xff, 0xe1. What can I do to find out the real signature, or what I did wrong?
Here's the code where the whole thing is started.
FILE* file = fopen("card.raw", "r");
BYTE printJPG[511];
int counter = 0;
int blockCounter = 0;
char fileName[10];
FILE* writing;
sprintf(fileName, "00%i.jpg", counter);
writing = fopen(fileName, "w");
while(!feof(file)) {
fseek(file, ((blockCounter * 512) + 1), SEEK_SET);
fread(&printJPG[0], 1, 1, file);
if(printJPG[0] == 0xff)
{
fread(&printJPG[1], 1, 1, file);
if(printJPG[1] == 0xd8)
{
fread(&printJPG[2], 1, 1, file);
if(printJPG[2] == 0xff) {
fread(&printJPG[3], 1, 1, file);
if(printJPG[3] == 0xe0) {
//more stuff happens here
} else if(printJPG[3] == 0xe1) {
//again
}
//not much code after this, and nothing pertaining to my question.