---
name: "libvhdi"
section: "3"
platform: "linux"
package: "libvhdi-dev"
version: "20240509-2+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libvhdi"
---

# libvhdi(3)

Library to access the Virtual Hard Disk (VHD) image format

## NAME

**libvhdi.h** – Library to access the Virtual Hard Disk (VHD) image format

## SYNOPSIS

**#include \<libvhdi.h\>**

Support functions

*const* *char* *\**\

**libvhdi\_get\_version**(*void*);

*int*\

**libvhdi\_get\_access\_flags\_read**(*void*);

*int*\

**libvhdi\_get\_access\_flags\_read\_write**(*void*);

*int*\

**libvhdi\_get\_access\_flags\_write**(*void*);

*int*\

**libvhdi\_get\_codepage**(*int \*codepage*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_set\_codepage**(*int codepage*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_check\_file\_signature**(*const char \*filename*, *libvhdi\_error\_t \*\*error*);

Available when compiled with wide character string support:

*int*\

**libvhdi\_check\_file\_signature\_wide**(*const wchar\_t \*filename*, *libvhdi\_error\_t \*\*error*);

Available when compiled with libbfio support:

*int*\

**libvhdi\_check\_file\_signature\_file\_io\_handle**(*libbfio\_handle\_t \*file\_io\_handle*, *libvhdi\_error\_t \*\*error*);

Notify functions

*void*\

**libvhdi\_notify\_set\_verbose**(*int verbose*);

*int*\

**libvhdi\_notify\_set\_stream**(*FILE \*stream*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_notify\_stream\_open**(*const char \*filename*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_notify\_stream\_close**(*libvhdi\_error\_t \*\*error*);

Error functions

*void*\

**libvhdi\_error\_free**(*libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_error\_fprint**(*libvhdi\_error\_t \*error*, *FILE \*stream*);

*int*\

**libvhdi\_error\_sprint**(*libvhdi\_error\_t \*error*, *char \*string*, *size\_t size*);

*int*\

**libvhdi\_error\_backtrace\_fprint**(*libvhdi\_error\_t \*error*, *FILE \*stream*);

*int*\

**libvhdi\_error\_backtrace\_sprint**(*libvhdi\_error\_t \*error*, *char \*string*, *size\_t size*);

File functions

*int*\

**libvhdi\_file\_initialize**(*libvhdi\_file\_t \*\*file*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_free**(*libvhdi\_file\_t \*\*file*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_signal\_abort**(*libvhdi\_file\_t \*file*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_open**(*libvhdi\_file\_t \*file*, *const char \*filename*, *int access\_flags*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_close**(*libvhdi\_file\_t \*file*, *libvhdi\_error\_t \*\*error*);

*ssize\_t*\

**libvhdi\_file\_read\_buffer**(*libvhdi\_file\_t \*file*, *void \*buffer*, *size\_t buffer\_size*, *libvhdi\_error\_t \*\*error*);

*ssize\_t*\

**libvhdi\_file\_read\_buffer\_at\_offset**(*libvhdi\_file\_t \*file*, *void \*buffer*, *size\_t buffer\_size*, *off64\_t offset*, *libvhdi\_error\_t \*\*error*);

*off64\_t*\

**libvhdi\_file\_seek\_offset**(*libvhdi\_file\_t \*file*, *off64\_t offset*, *int whence*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_offset**(*libvhdi\_file\_t \*file*, *off64\_t \*offset*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_set\_parent\_file**(*libvhdi\_file\_t \*file*, *libvhdi\_file\_t \*parent\_file*, *libvhdi\_error\_t \*\*error*);

Available when compiled with wide character string support:

*int*\

**libvhdi\_file\_open\_wide**(*libvhdi\_file\_t \*file*, *const wchar\_t \*filename*, *int access\_flags*, *libvhdi\_error\_t \*\*error*);

Available when compiled with libbfio support:

*int*\

**libvhdi\_file\_open\_file\_io\_handle**(*libvhdi\_file\_t \*file*, *libbfio\_handle\_t \*file\_io\_handle*, *int access\_flags*, *libvhdi\_error\_t \*\*error*);

Meta data functions

*int*\

**libvhdi\_file\_get\_file\_type**(*libvhdi\_file\_t \*file*, *int \*file\_type*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_format\_version**(*libvhdi\_file\_t \*file*, *uint16\_t \*major\_version*, *uint16\_t \*minor\_version*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_disk\_type**(*libvhdi\_file\_t \*file*, *uint32\_t \*disk\_type*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_media\_size**(*libvhdi\_file\_t \*file*, *size64\_t \*media\_size*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_bytes\_per\_sector**(*libvhdi\_file\_t \*file*, *uint32\_t \*bytes\_per\_sector*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_identifier**(*libvhdi\_file\_t \*file*, *uint8\_t \*guid\_data*, *size\_t guid\_data\_size*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_parent\_identifier**(*libvhdi\_file\_t \*file*, *uint8\_t \*guid\_data*, *size\_t guid\_data\_size*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_utf8\_parent\_filename\_size**(*libvhdi\_file\_t \*file*, *size\_t \*utf8\_string\_size*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_utf8\_parent\_filename**(*libvhdi\_file\_t \*file*, *uint8\_t \*utf8\_string*, *size\_t utf8\_string\_size*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_utf16\_parent\_filename\_size**(*libvhdi\_file\_t \*file*, *size\_t \*utf16\_string\_size*, *libvhdi\_error\_t \*\*error*);

*int*\

**libvhdi\_file\_get\_utf16\_parent\_filename**(*libvhdi\_file\_t \*file*, *uint16\_t \*utf16\_string*, *size\_t utf16\_string\_size*, *libvhdi\_error\_t \*\*error*);

## DESCRIPTION

The **libvhdi\_get\_version**() function is used to retrieve the library version.

## RETURN VALUES

Most of the functions return NULL or -1 on error, dependent on the return type. For the actual return values see "libvhdi.h".

## ENVIRONMENT

None

## FILES

None

## NOTES

libvhdi can be compiled with wide character support (wchar\_t).

To compile libvhdi with wide character support use: *./configure* *--enable-wide-character-type=yes*\
  or define: *\_UNICODE*\
  or *UNICODE*\
  during compilation.

*LIBVHDI\_WIDE\_CHARACTER\_TYPE*\
  in libvhdi/features.h can be used to determine if libvhdi was compiled with wide character support.

## BUGS

Please report bugs of any kind on the project issue tracker: https://github.com/libyal/libvhdi/issues

## AUTHOR

These man pages are generated from "libvhdi.h".

## COPYRIGHT

Copyright (C) 2012-2024, Joachim Metz \<joachim.metz@gmail.com\>.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO

the libvhdi.h include file
