开发者

Java library for Windows VHD API

开发者 https://www.devze.com 2023-02-16 05:14 出处:网络
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

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号