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  [ 5 posts ] 
Author Message
 Post subject: Tracks to Mod issues
PostPosted: October 17th, 2018, 7:50 
Offline

Joined: September 17th, 2016, 16:06
Posts: 167
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: 12433
Location: Australia
Thanks.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: Tracks to Mod issues
PostPosted: February 29th, 2020, 17:09 
Offline

Joined: September 17th, 2016, 16:06
Posts: 167
Location: India
Sorry, just a little correction. Now the mod names should load up perfectly.
#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);

//correction being here
printf("Royl header with modname %x%x found at offset\t", buffer[i+9] , buffer[i+8]); puts(hex);
j=0; //set current location j to zero so that it aligns with i later on//
}
i++;
}
}

Now the mod names should display correctly with appropriate sequence of letters as required.
Thanks
--


Top
 Profile  
 
 Post subject: Re: Tracks to Mod issues
PostPosted: March 2nd, 2020, 15:23 
Offline

Joined: October 3rd, 2005, 0:40
Posts: 3096
Location: Hungary
take one more step and build dir module based on your findings...

pepe

_________________
Adatmentés - Data recovery
No bitcoin donations :)


Top
 Profile  
 
 Post subject: Re: Tracks to Mod issues
PostPosted: March 4th, 2020, 7:05 
Offline

Joined: September 17th, 2016, 16:06
Posts: 167
Location: India
Thanks for motivation. Means a lot to me you replying to this thread.

There are bugs in this code itself in terms of naming of the found royl mods. The rest of the code may also have uninvestigated flaws..


I have tried to do something on the lines you are guiding me by taking a working wd, relocating its mods and finding the changes in 01....i could map the the differences and calculate the internal offsets but never tried to program it for any representation of 01 or edit.

Thanks a ton.

Simran Arora
--


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

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 7 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