Java library for Windows VHD API
I need to mount and navigate a Windows VHD from Java. Anyone know of a Java library t开发者_如何学JAVAhat wraps the Windows Virtual Hard Drive API or is there perhaps source code that uses JNA that I can look at. My google searches did not give me much.
Even some sample code on how to convert the OpenVirtualDisk function to JNA structures would give me enough to do the rest I believe.
The VHD APIs are on MSDN. Here is a link to one of the APIs.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd323692(v=vs.85).aspx
Here is a JNA usage example to load the VHD library with JNA (adjust/define types as necessary):
public interface VHDLibrary extends Library {
VHDLibrary INSTANCE = (VHDLibrary) Native.loadLibrary("VirtDisk", VHDLibrary.class);
DWORD AttachVirtualDisk(HANDLE p1, Pointer p2, int p3, long p4, Pointer p5, Pointer p6);
}
And to invoke the function via JNA (adjust/define params as necessary):
VHDLibrary.INSTANCE.AttachVirtualDisk(null, null, 0, 0, null, null);
精彩评论