hidden hit counter
Help!

program to write on unallocated space of hard-disk

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> File System RSS
Next:  cannot see folder  
Author Message
erajaysharma
External


Since: Jul 04, 2007
Posts: 6



PostPosted: Fri Jul 06, 2007 5:02 am    Post subject: program to write on unallocated space of hard-disk
Archived from groups: microsoft>public>win2000>file_system (more info?)

Hi,

Can some one please tell how can i write some data on sector 0 of a
hard disk...entire hard-disk is unallocated...

Thanks
Ajay
Back to top
erajaysharma
External


Since: Jul 04, 2007
Posts: 6



PostPosted: Fri Jul 06, 2007 5:02 am    Post subject: Re: program to write on unallocated space of hard-disk [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 6, 10:02 am, erajaysha....RemoveThis@gmail.com wrote:
> Hi,
>
> Can some one please tell how can i writesome data on sector 0 of ahard disk...entirehard-diskisunallocated...
>
> Thanks
> Ajay

I am using following program....but it is not working....it works if a
disk partition is allocated...
Device ID of that harddisk is physicaldrive1 and i am using following
program but CreateFile is always failing....

#define SIZE 512
int main()
{
DWORD dwBytesWrite=0;
unsigned char data[SIZE];
HANDLE hFloppy;
char drive[]="\\\\.\\physicaldrive1";

fstream inFile;
inFile.open("image.bin", ios::in | ios::binary);
if(inFile.fail())
{
printf("inFile not opened\n");
return 0;
}
inFile.read(data,SIZE);
inFile.close();

hFloppy = CreateFile(
drive,
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
0,
NULL);
if(hFloppy == INVALID_HANDLE_VALUE)
{
DWORD Err = GetLastError();
printf("CreateFile failed : %d\n",Err);
}
if(!WriteFile(hFloppy, &data, SIZE,&dwBytesWrite, NULL))
{
printf("Write failed.\n");
return 0;
}
printf("dwBytesWrite: %d\n",dwBytesWrite);
return 0;
}
Back to top
Roedy Green
External


Since: Apr 11, 2007
Posts: 7



PostPosted: Sun Jul 08, 2007 3:59 pm    Post subject: Re: program to write on unallocated space of hard-disk [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 06 Jul 2007 05:02:57 -0000, erajaysharma RemoveThis @gmail.com wrote,
quoted or indirectly quoted someone who said :

>Can some one please tell how can i write some data on sector 0 of a
>hard disk...entire hard-disk is unallocated...

The DOS tools to write sector 0 are disabled in Vista out of security
concerns. They are too useful to viruses.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Back to top
"Pegasus
External


Since: Oct 14, 2005
Posts: 1845



PostPosted: Sun Jul 08, 2007 6:43 pm    Post subject: Re: program to write on unallocated space of hard-disk [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

<erajaysharma RemoveThis @gmail.com> wrote in message
news:1183698177.286265.114480@x35g2000prf.googlegroups.com...
> Hi,
>
> Can some one please tell how can i write some data on sector 0 of a
> hard disk...entire hard-disk is unallocated...
>
> Thanks
> Ajay
>

You could boot the machine with a DOS boot disk and use
debug.exe to write data on sector 0.
Back to top
erajaysharma
External


Since: Jul 04, 2007
Posts: 6



PostPosted: Tue Jul 10, 2007 2:30 am    Post subject: Re: program to write on unallocated space of hard-disk [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 8, 9:43 pm, "Pegasus \(MVP\)" <I....TakeThisOut@fly.com> wrote:
> <erajaysha....TakeThisOut@gmail.com> wrote in message
>
> news:1183698177.286265.114480@x35g2000prf.googlegroups.com...
>
> > Hi,
>
> > Can some one please tell how can i writesome data on sector 0 of a
> >hard disk...entirehard-diskisunallocated...
>
> > Thanks
> > Ajay
>
> You could boot the machine with a DOS boot disk and use
> debug.exe towritedata on sector 0.

Thanks Roedy and Pegasus

Ajay
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> File System All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum