OK, so trust me there's a reason I want to do this. Maybe not using Java, but there is. I am able to raw access the disk on Windows 7 using the UNC-style paths, for example:
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile("\\\\.\\PhysicalDrive0","r");
byte [] block = new byte [2048];
raf.seek(0);
raf.readFully(block);
System.out.println("READ BYTES RAW:\n" + new String(block));
} catch (IOException ioe) {
System.out.println("File not found or access denied. Cause: " + ioe.getMessage());
return;
} finally {
try {
if (raf != null) raf.close();
System.out.println("Exiting...");
} catch (IOException ioe) {
System.out.println("That was bad.");
}
}
But if I switch to "rw" mode, a NullPointerException arises and even I run the program as an Administrator, I'm not getting the handle for raw writing to the disk. I know this has been asked already, but mainly for reading... so, what about writing? Do I need JNI? If so, any suggestions?
Cheers