用于Windows VHD API的Java库 [英] Java library for Windows VHD API

查看:1132
本文介绍了用于Windows VHD API的Java库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Java安装和导航Windows VHD。任何人都知道包含 Windows Virtual的Java库硬盘驱动器API 或者是否有使用我可以查看的 JNA 的源代码。我的谷歌搜索没有给我太多。

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.

甚至一些示例代码如何转换 OpenVirtualDisk函数到JNA结构将给我足够的余下来做我相信的其余部分。

Even some sample code on how to convert the OpenVirtualDisk function to JNA structures would give me enough to do the rest I believe.

推荐答案

VHD API在MSDN上。以下是其中一个API的链接。

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

这是一个JNA用法示例,用于加载带有JNA的VHD库(根据需要调整/定义类型):

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

并通过JNA调用函数(根据需要调整/定义参数):

And to invoke the function via JNA (adjust/define params as necessary):

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

这篇关于用于Windows VHD API的Java库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆