Writing directly on a harddisk without using File
-
Hi all, How can we write at a given sector in my hard disk? I have tried it using this code but nothing happens
HANDLE hFile ;
DWORD dwResult;hFile = CreateFile (L"\\\\\\\\.\\\\PhysicalDrive3", GENERIC\_WRITE, 0, // do not share NULL, // default security CREATE\_ALWAYS, // overwrite existing FILE\_ATTRIBUTE\_NORMAL, // normal file NULL); WriteFile (hFile, TEST\_STR, strlen(TEST\_STR), &dwResult, NULL);
Can anybody help me in this? Thanks in advance
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
-
Hi all, How can we write at a given sector in my hard disk? I have tried it using this code but nothing happens
HANDLE hFile ;
DWORD dwResult;hFile = CreateFile (L"\\\\\\\\.\\\\PhysicalDrive3", GENERIC\_WRITE, 0, // do not share NULL, // default security CREATE\_ALWAYS, // overwrite existing FILE\_ATTRIBUTE\_NORMAL, // normal file NULL); WriteFile (hFile, TEST\_STR, strlen(TEST\_STR), &dwResult, NULL);
Can anybody help me in this? Thanks in advance
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
I wrote some small tool to read and write HDD sectors 6 years ago under WinXP. If I recall correctly, the buffer has to fit the size of a sector (or n folds, aka: N * 512 bytes). Otherwise it rejects and nothing will happen.
Maxwell Chen
-
Hi all, How can we write at a given sector in my hard disk? I have tried it using this code but nothing happens
HANDLE hFile ;
DWORD dwResult;hFile = CreateFile (L"\\\\\\\\.\\\\PhysicalDrive3", GENERIC\_WRITE, 0, // do not share NULL, // default security CREATE\_ALWAYS, // overwrite existing FILE\_ATTRIBUTE\_NORMAL, // normal file NULL); WriteFile (hFile, TEST\_STR, strlen(TEST\_STR), &dwResult, NULL);
Can anybody help me in this? Thanks in advance
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
Well unfortunately Windows OS after 2000 or may be NT wouldn't allow you this, check out my post here http://cyberlifeday.blogspot.com/2009/12/booting-windowslinux-os-any.html in brief to do same, you'll need to change drive letter to A: or B:, read the post for reason and behind the scenes. :)