Skip to content

Instantly share code, notes, and snippets.

@SegFaultAX
Created March 14, 2019 19:58
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save SegFaultAX/9a21d5bd69d804d7acab1906b044795e to your computer and use it in GitHub Desktop.
vmGuestLib [Python] [ctypes]
from ctypes import CDLL, c_void_p, byref
from ctypes.util import find_library
# The following code fails on ubuntu 18.04, but succeeds on 14.04
lib = CDLL(find_library('guestlib'))
handle = c_void_p()
ret = lib.VMGuestLib_OpenHandle(byref(handle))
if ret != 0:
raise RuntimeError("failed to get handle")
ret = lib.VMGuestLib_UpdateInfo(handle.value)
if ret != 0:
raise RuntimeError("unable to update guest information")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment