mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-02-02 00:03:32 +00:00
[host] app: implement stubs for platform specific guest information
This commit is contained in:
parent
7ccd202d36
commit
fdb38a227e
5 changed files with 58 additions and 4 deletions
|
@ -85,14 +85,15 @@ enum
|
||||||
KVMFR_RECORD_OSINFO
|
KVMFR_RECORD_OSINFO
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
typedef enum
|
||||||
{
|
{
|
||||||
KVMFR_OS_LINUX,
|
KVMFR_OS_LINUX,
|
||||||
KVMFR_OS_BSD,
|
KVMFR_OS_BSD,
|
||||||
KVMFR_OS_OSX,
|
KVMFR_OS_OSX,
|
||||||
KVMFR_OS_WINDOWS,
|
KVMFR_OS_WINDOWS,
|
||||||
KVMFR_OS_OTHER
|
KVMFR_OS_OTHER
|
||||||
};
|
}
|
||||||
|
KVMFROS;
|
||||||
|
|
||||||
typedef struct KVMFRRecord_VMInfo
|
typedef struct KVMFRRecord_VMInfo
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "common/KVMFR.h"
|
||||||
|
|
||||||
// exit code for user opted to exit looking-glass-host
|
// exit code for user opted to exit looking-glass-host
|
||||||
#define LG_HOST_EXIT_USER 0x10
|
#define LG_HOST_EXIT_USER 0x10
|
||||||
|
@ -46,3 +47,13 @@ void os_showMessage(const char * caption, const char * msg);
|
||||||
bool os_blockScreensaver();
|
bool os_blockScreensaver();
|
||||||
bool os_hasSetCursorPos(void);
|
bool os_hasSetCursorPos(void);
|
||||||
void os_setCursorPos(int x, int y);
|
void os_setCursorPos(int x, int y);
|
||||||
|
|
||||||
|
// return the KVMFR OS type
|
||||||
|
KVMFROS os_getKVMFRType(void);
|
||||||
|
|
||||||
|
// returns the OS name & version if possible
|
||||||
|
const char * os_getOSName(void);
|
||||||
|
|
||||||
|
// returns the UUID that was given to the VM, this can be obtained from the
|
||||||
|
// SMBIOS. Must return exactly 16 bytes or NULL.
|
||||||
|
const uint8_t * os_getUUID(void);
|
||||||
|
|
|
@ -95,3 +95,20 @@ bool os_hasSetCursorPos(void)
|
||||||
void os_setCursorPos(int x, int y)
|
void os_setCursorPos(int x, int y)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KVMFROS os_getKVMFRType(void)
|
||||||
|
{
|
||||||
|
return KVMFR_OS_LINUX;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * os_getOSName(void)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t * os_getUUID(void)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -589,3 +589,20 @@ void os_setCursorPos(int x, int y)
|
||||||
{
|
{
|
||||||
SetCursorPos(x, y);
|
SetCursorPos(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KVMFROS os_getKVMFRType(void)
|
||||||
|
{
|
||||||
|
return KVMFR_OS_WINDOWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * os_getOSName(void)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t * os_getUUID(void)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -604,6 +604,10 @@ static bool newKVMFRData(KVMFRUserData * dst)
|
||||||
|
|
||||||
strncpy(vmInfo->capture, app.iface->shortName, sizeof(vmInfo->capture) - 1);
|
strncpy(vmInfo->capture, app.iface->shortName, sizeof(vmInfo->capture) - 1);
|
||||||
|
|
||||||
|
const uint8_t * uuid = os_getUUID();
|
||||||
|
if (uuid)
|
||||||
|
memcpy(vmInfo->uuid, uuid, 16);
|
||||||
|
|
||||||
char * model = allocUserData(dst, 1024, false);
|
char * model = allocUserData(dst, 1024, false);
|
||||||
if (!model)
|
if (!model)
|
||||||
return false;
|
return false;
|
||||||
|
@ -630,8 +634,12 @@ static bool newKVMFRData(KVMFRUserData * dst)
|
||||||
record->type = KVMFR_RECORD_OSINFO;
|
record->type = KVMFR_RECORD_OSINFO;
|
||||||
record->size = sizeof(*osInfo);
|
record->size = sizeof(*osInfo);
|
||||||
|
|
||||||
osInfo->os = KVMFR_OS_OTHER;
|
osInfo->os = os_getKVMFRType();
|
||||||
if (!appendBuffer(dst, record, "Unknown", 8))
|
const char * osName = os_getOSName();
|
||||||
|
if (!osName)
|
||||||
|
osName = "";
|
||||||
|
|
||||||
|
if (!appendBuffer(dst, record, osName, strlen(osName) + 1))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue