Add to Favorites    Make Home Page 1425 Online  
 Language Categories  
 Our Services  

Home » C Home » Hacking & Cracking, Virus Home » Partition Hiding Software in C

Title Partition Hiding Software in C
Author Tapan Kumar Mishra
Author Email titu_igit [at] rediffmail.com
Description This software read the partition info. from partition table
and change the system id to hidden
so that ur win will not mount it at the start up
Category C » Hacking & Cracking, Virus
Hits 397651
Code Select and Copy the Code
/* program to read the partition table of hard disk and can hide and revele partitions*/ /* Release date: 1.1.2006 Author: Tapan Kumar Mishra 7th sem ,Electrical Engg. IGIT Sarang,Orissa mailid:[email protected] About the program: This program is a part of my project to read ext2 linux file system under dos or win98.This program read the partition table of ur hard disk and print the informations about those.And can hide and revele the partitions by changing the systemid of that partions. Caution: Modification of the code may lead your disk unusable. The author is not responsible for any damage or dataloss. This program is tested under win98. compile it by Turbo c3 Any comment,feedback,query mail to [email protected] */ #include<stdio.h> #include<bios.h> #include<dos.h> #include<stdlib.h> typedef unsigned char BYTE; typedef unsigned int WORD; typedef unsigned long DWORD; enum BOOL {TRUE=0,FALSE=1}; struct PARTITIONINFO { BYTE bootid; /* bootable? 0=no, 128=yes */ BYTE beghead; /* beginning head number */ BYTE begsect; /* beginning sector number */ BYTE begcyl; /* 10 bit nmbr, with high 2 bits put in begsect */ BYTE systid; /* Operating System type indicator code */ BYTE endhead; /* ending head number */ BYTE endsect; /* ending sector number */ BYTE endcyl; /* also a 10 bit nmbr, with same high 2 bit trick */ DWORD relsect; /* first sector relative to start of disk */ DWORD numsect; /* number of sectors in partition */ }; struct DISK_ADD_PACKET { BYTE recordsize; BYTE reserved; WORD count; DWORD transferadd; DWORD lowbits; DWORD highbits; }; struct MBR{ BYTE codes[446]; struct PARTITIONINFO partition[4]; WORD mbrid; }; struct driveinfo{ DWORD startsect; BYTE sysid; }; WORD ExtentionCheck (BYTE drive) { union REGS regs; regs.h.ah = 0x41; regs.x.bx = 0x55aa; regs.h.dl = drive; int86(0x13,®s,®s); if(regs.x.bx != 0xaa55) return FALSE; return TRUE; } WORD ReadSect(BYTE disk, int nsects,DWORD lsects,void* data) { union REGS iregs,oregs; struct SREGS sregs; int count=0; struct DISK_ADD_PACKET * p; p = (struct DISK_ADD_PACKET *)malloc(sizeof(struct DISK_ADD_PACKET)); p->recordsize=sizeof(struct DISK_ADD_PACKET); p->count=nsects; p->transferadd=(DWORD)data; p->lowbits=lsects; p->highbits=0; /* We dont need to access HD > 2TB */ iregs.h.ah = 0x42; iregs.h.dl = disk; iregs.x.si = FP_OFF(p); sregs.ds = FP_SEG(p); int86x(0x13,&iregs,&oregs,&sregs); if(oregs.h.ah==0) { free(p); return TRUE; } free(p); return FALSE; } WORD WriteSect(BYTE disk, int nsects,DWORD lsects,void* data) { union REGS iregs,oregs; struct SREGS sregs; int count=0; struct DISK_ADD_PACKET * p; p = (struct DISK_ADD_PACKET *)malloc(sizeof(struct DISK_ADD_PACKET)); p->recordsize=sizeof(struct DISK_ADD_PACKET); p->count=nsects; p->transferadd=(DWORD)data; p->lowbits=lsects; p->highbits=0; /* We dont need to access HD > 2TB */ iregs.x.ax = 0x4302; iregs.h.dl = disk; iregs.x.si = FP_OFF(p); sregs.ds = FP_SEG(p); int86x(0x13,&iregs,&oregs,&sregs); if(oregs.h.ah==0) { free(p); return TRUE; } free(p); return FALSE; } DWORD lsect=0; void main() { BYTE disk=0x80; WORD nsect=1,index=0,i=0,hi,choice; DWORD extsect; BYTE hideindex[5],id; struct MBR *mbr; struct driveinfo dinfo[10];//max 10 partitions mbr=(struct MBR *)malloc(sizeof(struct MBR)); if(ExtentionCheck(disk)==FALSE) {printf("extended int 13 is not supported "); exit(1); } if(ReadSect(disk, nsect, lsect,(char *)mbr)==TRUE) for(i=0;i<4;i++) if(mbr->partition[i].systid!=0) {printpart(mbr,i); dinfo[index].startsect=lsect; dinfo[index].sysid=mbr->partition[i].systid; index++; } if(mbr->partition[1].systid==0xf)//0xf for extended partition {lsect=mbr->partition[1].relsect; extsect=lsect; link: if(ReadSect(disk, nsect, lsect,(char *)mbr)==TRUE) {printpart(mbr,0); dinfo[index].startsect=lsect; dinfo[index].sysid=mbr->partition[0].systid; index++; if(index>=10){printf("no of partition exceed max limit");exit(1);} if(mbr->partition[1].systid!=0) {lsect=extsect+mbr->partition[1].relsect; goto link; } } } printf(" Hide partition(1) "); printf("Revele partition(2) "); printf("Quit(3) Enter your choice(1/2/3):"); hideindex[0]=getche(); choice=atoi(hideindex); switch(choice) { case 1: printf(" Which drive do u want to hide:(0-%d):",index-1); scanf("%s",hideindex); hi=atoi(hideindex); if(hi<=index) { id=dinfo[hi].sysid; if(id==1||id==4||id==7||id==0xb||id==0xc||id==0xe) { lsect=dinfo[hi].startsect; id+=0x10; if(ReadSect(disk, nsect, lsect,(char *)mbr)==TRUE) {mbr->partition[0].systid=id; if(WriteSect(disk,nsect,lsect,(char *)mbr)==TRUE) printf(" HIDDEN SUCCESSFULLY"); } } else printf("Cant Hide"); } break; case 2: printf(" Which drive do u want to Revele:(0-%d):",index-1); scanf("%s",hideindex); hi=atoi(hideindex); if(hi<=index) { id=dinfo[hi].sysid; if(id==0x11||id==0x14||id==0x17||id==0x1b||id==0x1c||id==0x1e) { lsect=dinfo[hi].startsect; id-=0x10; if(ReadSect(disk, nsect, lsect,(char *)mbr)==TRUE) {mbr->partition[0].systid=id;printf("%x",mbr->partition[0].systid); if(WriteSect(disk,nsect,lsect,(char *)mbr)==TRUE) printf(" REVELED SUCCESSFULLY"); } } else printf("Cant Revele "); } break; case 3: exit(1);break; default: printf(" invalid choice");exit(1); break; }; } printpart(struct MBR *mbr,WORD i) { BYTE bootable[]="YES"; BYTE id[7]; static BYTE c=0,index=0; if(c==0)//to execute this for once { clrscr(); gotoxy(30,1); printf("Partition Table"); gotoxy(2,2); printf("INDEX"); gotoxy(8,2); printf("SystemID"); gotoxy(17,2); printf("Bootable"); gotoxy(26,2); printf("StartingLBA"); gotoxy(38,2); printf("SIZEINSECTORS"); gotoxy(52,2); printf("SIZEINGB"); c++; gotoxy(46,20); printf("Coded by Tapan Kumar Mishra"); gotoxy(55,21); printf("7th Sem,Electrical Engg."); gotoxy(55,22); printf("IGIT Sarang,Orissa"); gotoxy(46,23); printf("Email id:[email protected]"); } if(mbr->partition[i].bootid!=0x80) strcpy(bootable,"NO"); gotoxy(2,3+index); printf("%d",index); gotoxy(8,3+index); systemid((BYTE)mbr->partition[i].systid,id); printf("%s",id); gotoxy(17,3+index); printf("%s",bootable); gotoxy(26,3+index); printf("%ld",mbr->partition[i].relsect+lsect); gotoxy(38,3+index); printf("%ld ",mbr->partition[i].numsect); gotoxy(52,3+index); printf("%5.2fGB",(float)mbr->partition[i].numsect/2097152.0); index++; return 0; } systemid(BYTE systid,BYTE *id) { switch(systid) { case 00: strcpy(id,"empty"); break; case 01: strcpy(id,"FAT12"); break; case 04: strcpy(id,"FAT16"); break; case 05: strcpy(id,"EXTNED"); break; case 0xb: strcpy(id,"FAT32"); break; case 0xc: strcpy(id,"FAT32"); break; case 0xE: strcpy(id,"FAT16"); break; case 0xf: strcpy(id,"EXNDED"); break; case 0x82: strcpy(id,"SWAP"); break; case 0x83: strcpy(id,"EXT2fs"); break; case 0x11: case 0x14: case 0x15: case 0x16: case 0x17: case 0x1b: case 0x1c: case 0x1e: case 0x1f: strcpy(id,"hidden"); break; } } //End of code // if u are unable to see the code in proper format ,mail to // [email protected] //

Related Source Codes

Script Name Author
The Game Opposite as seen on Nokia 2300 Mobile Manikanta
RECURSIVE BALANCED QUICK SORT ashish
Radix Sort ashish
Change your mouse pointer Ashim
The blinking star Shashank
Data Validation Crylittlebaby
To search a file by giving file type like mp3 or mpeg or doc Prashanth SR
Menus Demonstration B.Chidhambaram
Employee Database Project Using C. Reenku Raman Nayak
Creating a Lexical Analyzer in c fahad bader al-buhairi �դ ?�� ��??���
Calendar Program Omkar & Devendra
Stop double Process for start in C Cedrik Jurak
Stop double Process for start in C Cedrik Jurak
Time Scheduler Atiq Anwar
A timepass game between atmost two players Rahul Roy

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=1094


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review