简体   繁体   English

适用于Windows VHD API的Java库

[英]Java library for Windows VHD API

I need to mount and navigate a Windows VHD from Java. 我需要从Java安装和导航Windows VHD。 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. 任何人都知道包装Windows虚拟硬盘驱动器API的Java库,或者可能有使用JNA的源代码,我可以看一下。 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. 甚至一些关于如何将OpenVirtualDisk函数转换为JNA结构的示例代码也足以让我完成其余的工作。

The VHD APIs are on MSDN. VHD API在MSDN上。 Here is a link to one of the APIs. 以下是其中一个API的链接。

http://msdn.microsoft.com/en-us/library/windows/desktop/dd323692(v=vs.85).aspx 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): 这是一个JNA用法示例,用于加载带有JNA的VHD库(根据需要调整/定义类型):

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): 并通过JNA调用函数(根据需要调整/定义参数):

VHDLibrary.INSTANCE.AttachVirtualDisk(null, null, 0, 0, null, null);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM