Java library for Windows VHD API

一笑奈何 提交于 2019-12-07 11:39:05

问题


I need to mount and navigate a Windows VHD from Java. Anyone know of a Java library that 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.


回答1:


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


来源:https://stackoverflow.com/questions/5245167/java-library-for-windows-vhd-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!