Okay, so trust me that I want to do this. Maybe not using Java, but there is. I can perform raw disk access in Windows 7 using 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 is thrown, and even I run the program as an administrator, I do not get a handle to raw write to disk. I know this has already been asked, but mainly for reading ... so, what about writing? Do I need JNI? If so, any suggestions?
Greetings
source share