All times are UTC - 5 hours [ DST ]


Forum rules


Please do not post questions about data recovery cases here (use this forum instead). This forum is for topics on finding new ways to recover data. Accessing firmware, writing programs, reading bits off the platter, recovering data from dust...



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Tracks to Mod issues
PostPosted: October 17th, 2018, 7:50 
Offline

Joined: September 17th, 2016, 16:06
Posts: 74
Location: India
Hi, I rx a drive from Gujrat (beautiful state in India btw) from a a starter DR guy. It was a WD PURZ with MOD 01 erased.
I tried to load various other available 01s in RAM to access the SA however very less portion of the SA alligned with the address pointer loaded in the RAM (ie donor 01). So it was decided to take a track dump from primary heads 0 and 1.
DFL has an option to do Tracks to Mods however it apparently first locates 01 in the track files and then using the same as reference manages to extract other modules while also performing the checksum on them (can save mods with err in checksum aswell).

So I wrote a little C program to find all ROYL headers in the loaded track file, display its offset and display the mod name associated with the header...
Here it is, hope you enjoy. Also, last step needs to be programmed where it perform this program over and over for all track files.
I may have included extra header files. One can also load up ROM code to localize mods.


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<stddef.h>
#include <string.h>
int main(void) {
FILE *file;
unsigned char *buffer;
unsigned long fileLen;
unsigned char roylheader[4] = {0x52,0x4F,0x59,0x4C};
file = fopen("C:\\rom.bin","rb");
//Get file length
fseek(file, 0, SEEK_END);
fileLen=ftell(file);
fseek(file, 0, SEEK_SET);
//Allocate memory
buffer=(unsigned char *)malloc(fileLen+1);
if (!buffer)
{
fprintf(stderr, "Memory error!");
fclose(file);
return 0 ;
}
//Read file contents into buffer
fread(buffer, fileLen, 1, file);
fclose(file);
//Do what ever with buffer
int i=0;
while ( i <fileLen) {
int j = i;
//printf("%X ", buffer[i]);
// if ((i+1)%16 == 0) printf("\n");
if(buffer[j] == roylheader[0] && buffer[j+1] == roylheader[1] && buffer[j+2] == roylheader[2] && buffer[j+3] == roylheader[3] )
{
char hex[5];
sprintf(hex, "%x", j);
printf("Royl header with modname %x%x found at offset\t", buffer[i+8] , buffer[i+9]); puts(hex);
j=0; //set current location j to zero so that it aligns with i later on//
}
i++;
}
}


Top
 Profile  
 
 Post subject: Re: Tracks to Mod issues
PostPosted: October 17th, 2018, 15:45 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 10958
Location: Australia
Thanks.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Google Adsense [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group