66
66
* is the hardcoded value below. For Windows, it is
67
67
* determined dynamically in GuestApp_GetInstallPath(),
68
68
* so the empty string here is just for completeness.
69
* XXX. Whoever does the Mac port should do something
70
* intelligent for that platform as well.
74
#define GUESTAPP_TOOLS_INSTALL_PATH ""
72
# define GUESTAPP_TOOLS_INSTALL_PATH ""
73
#elif defined __APPLE__
74
# define GUESTAPP_TOOLS_INSTALL_PATH "/Library/Application Support/VMware Tools"
76
#define GUESTAPP_TOOLS_INSTALL_PATH "/etc/vmware-tools"
76
# define GUESTAPP_TOOLS_INSTALL_PATH "/etc/vmware-tools"
875
*------------------------------------------------------------------------------
877
* GuestApp_GetInstallPathW --
879
* Returns the tools installation path as a UTF-16 encoded string, or NULL on
880
* error. The caller must deallocate the returned string using free.
887
*------------------------------------------------------------------------------
891
GuestApp_GetInstallPathW(void)
893
static LPCWSTR TOOLS_KEY_NAME = L"Software\\VMware, Inc.\\VMware Tools";
894
static LPCWSTR INSTALLPATH_VALUE_NAME = L"InstallPath";
897
LONG rc = ERROR_SUCCESS;
902
rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TOOLS_KEY_NAME, 0, KEY_READ, &key);
903
if (ERROR_SUCCESS != rc) {
904
Debug("%s: Couldn't open key \"%S\".\n", __FUNCTION__, TOOLS_KEY_NAME);
905
Debug("%s: RegOpenKeyExW error 0x%x.\n", __FUNCTION__, GetLastError());
909
rc = RegQueryValueExW(key, INSTALLPATH_VALUE_NAME, 0, NULL, NULL, &cbData);
910
if (ERROR_SUCCESS != rc) {
911
Debug("%s: Couldn't get length of value \"%S\".\n", __FUNCTION__,
912
INSTALLPATH_VALUE_NAME);
913
Debug("%s: RegQueryValueExW error 0x%x.\n", __FUNCTION__, GetLastError());
918
* The data in the registry may not be null terminated. So allocate enough
919
* space for one extra WCHAR and use that space to write our own NULL.
921
data = (LPWSTR) malloc(cbData + sizeof(WCHAR));
923
Debug("%s: Couldn't allocate %d bytes.\n", __FUNCTION__, cbData);
928
rc = RegQueryValueExW(key, INSTALLPATH_VALUE_NAME, 0, NULL, (LPBYTE) data,
930
if (ERROR_SUCCESS != rc) {
931
Debug("%s: Couldn't get data for value \"%S\".\n", __FUNCTION__,
932
INSTALLPATH_VALUE_NAME);
933
Debug("%s: RegQueryValueExW error 0x%x.\n", __FUNCTION__, GetLastError());
937
data[cbData / sizeof(WCHAR)] = L'\0';
874
950
*----------------------------------------------------------------------
936
1012
* lib/user/win32util.c because we can't use that file inside guest
937
1013
* code. If we do, we'll break Win95 Tools.
939
* XXX: For Windows, this function will only fail on pre-2k/Me systems
940
* that haven't installed IE4 _and_ haven't ever used our installer
941
* (it is thought that the installer will copy shfolder.dll if the
1015
* XXX: For Windows, this function will only fail on pre-2k/Me systems
1016
* that haven't installed IE4 _and_ haven't ever used our installer
1017
* (it is thought that the installer will copy shfolder.dll if the
942
1018
* system needs it).
944
1020
* However, the function will also return NULL if we fail to create
974
1050
if (!pfnSHGetFolderPath) {
975
1051
HMODULE h = LoadLibraryW(L"shfolder.dll");
977
pfnSHGetFolderPath = (PSHGETFOLDERPATH)
1053
pfnSHGetFolderPath = (PSHGETFOLDERPATH)
978
1054
GetProcAddress(h, "SHGetFolderPathW");
981
1057
/* win32util.c avoids calling FreeLibrary() so we will too. */
985
* Get the Common Application data folder - create if it doesn't
1061
* Get the Common Application data folder - create if it doesn't
1232
1308
*-----------------------------------------------------------------------------
1234
* GuestApp_DiskShrink --
1239
* TRUE if the shrinking is successful
1240
* FALSE if disk shrinking is not successful
1244
*-----------------------------------------------------------------------------
1248
GuestApp_DiskShrink(void) {
1249
return RpcOut_sendOne(NULL, NULL, "disk.shrink");
1254
*-----------------------------------------------------------------------------
1256
1310
* GuestApp_GetPos --
1258
1312
* Retrieve the host notion of the guest pointer location. --hpreg
1621
1675
* GuestApp_RpcSendOneArgCPName --
1623
* Wrapper for GuestApp_RpcSendOneCPName with an extra argument. Sends a
1677
* Wrapper for GuestApp_RpcSendOneCPName with an extra argument. Sends a
1624
1678
* single RPCI command with arg and cpNameArg both in UTF-8 encodeding.
1626
1680
* The UTF-8 encoded arg is optional so that one can send a single UTF-8