Java Library for the Windows VHD API

I need to mount and move Windows VHD with Java. Does anyone know a Java library that wraps the Windows Virtual Hard Drive API or possibly source code that uses JNA that I can look at. My searches didn’t give me much.

Even some sample code on how to convert the OpenVirtualDisk function to JNA structures will provide me with enough to do the rest that I believe in.

+4
source share
1 answer

VHD APIs are located 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 an example of using JNA to load a VHD library using JNA (adjust / define types if 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 call the function through JNA (if necessary, edit / define the parameters):

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

Source: https://habr.com/ru/post/1342980/


All Articles