/*********************************************************
- * Copyright (c) 2006-2019,2021 VMware, Inc. All rights reserved.
+ * Copyright (c) 2006-2019,2021,2023 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
{
#ifdef _WIN32
WinUtil_EnableSafePathSearching(TRUE);
+# if defined(VMX86_RELEASE)
+ WinUtil_VerifyExePathW();
+# endif
#endif
if (argc == 2 &&
(!strncmp(argv[1], "-h", 2) ||
#include <windows.h>
#include <shlobj.h>
#include "productState.h"
+#include "conf.h" // for tools install path regkey
#include "winregistry.h"
#include "windowsUtil.h"
#endif
LPWSTR
GuestApp_GetInstallPathW(void)
{
- static LPCWSTR TOOLS_KEY_NAME = L"Software\\VMware, Inc.\\VMware Tools";
- static LPCWSTR INSTALLPATH_VALUE_NAME = L"InstallPath";
-
HKEY key = NULL;
LONG rc;
DWORD cbData = 0;
#ifdef TOOLS_ARM64
samDesired |= KEY_WOW64_32KEY;
#endif
- rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TOOLS_KEY_NAME, 0, samDesired, &key);
+ rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, CONF_VMWARE_TOOLS_REGKEY_W, 0,
+ samDesired, &key);
if (ERROR_SUCCESS != rc) {
- Debug("%s: Couldn't open key \"%S\".\n", __FUNCTION__, TOOLS_KEY_NAME);
+ Debug("%s: Couldn't open key \"%S\".\n", __FUNCTION__,
+ CONF_VMWARE_TOOLS_REGKEY_W);
Debug("%s: RegOpenKeyExW error 0x%x.\n", __FUNCTION__, GetLastError());
goto exit;
}
- rc = RegQueryValueExW(key, INSTALLPATH_VALUE_NAME, 0, NULL, NULL, &cbData);
+ rc = RegQueryValueExW(key, CONF_VMWARE_TOOLS_INSTPATH_KEY_W, 0, NULL, NULL,
+ &cbData);
if (ERROR_SUCCESS != rc) {
Debug("%s: Couldn't get length of value \"%S\".\n", __FUNCTION__,
- INSTALLPATH_VALUE_NAME);
+ CONF_VMWARE_TOOLS_INSTPATH_KEY_W);
Debug("%s: RegQueryValueExW error 0x%x.\n", __FUNCTION__, GetLastError());
goto exit;
}
}
temp = cbData;
- rc = RegQueryValueExW(key, INSTALLPATH_VALUE_NAME, 0, NULL, (LPBYTE) data,
+ rc = RegQueryValueExW(key, CONF_VMWARE_TOOLS_INSTPATH_KEY_W, 0, NULL, (LPBYTE) data,
&temp);
if (ERROR_SUCCESS != rc) {
Debug("%s: Couldn't get data for value \"%S\".\n", __FUNCTION__,
- INSTALLPATH_VALUE_NAME);
+ CONF_VMWARE_TOOLS_INSTPATH_KEY_W);
Debug("%s: RegQueryValueExW error 0x%x.\n", __FUNCTION__, GetLastError());
goto exit;
}
if (WinReg_GetSZ(HKEY_LOCAL_MACHINE,
CONF_VMWARE_TOOLS_REGKEY,
- "InstallPath",
+ CONF_VMWARE_TOOLS_INSTPATH_KEY,
&pathUtf8) != ERROR_SUCCESS) {
Warning("%s: Unable to retrieve install path: %s\n",
__FUNCTION__, Msg_ErrString());
/*********************************************************
- * Copyright (c) 2016-2020,2022 VMware, Inc. All rights reserved.
+ * Copyright (c) 2016-2020,2022-2023 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
#if defined(_WIN32)
WinUtil_EnableSafePathSearching(TRUE);
+#if defined(VMX86_RELEASE)
+ WinUtil_VerifyExePathW();
+#endif
#endif
gAppName = g_path_get_basename(argv[0]);
/*********************************************************
- * Copyright (c) 2008-2021 VMware, Inc. All rights reserved.
+ * Copyright (c) 2008-2021,2023 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
char **argv;
WinUtil_EnableSafePathSearching(TRUE);
+# if defined(VMX86_RELEASE)
+ WinUtil_VerifyExePathW();
+# endif
Unicode_InitW(argc, wargv, NULL, &argv, NULL);
#else
/*********************************************************
- * Copyright (c) 2012,2018-2021 VMware, Inc. All rights reserved.
+ * Copyright (c) 2012,2018-2021, 2023 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
{ NULL },
};
GOptionContext *optCtx;
+
+/*
+ * Using WinUtil_EnableSafePathSearching() and WinUtil_VerifyExePathW() from
+ * "vmware/tools/win32util.h" rather than the ones
+ * in vgauth/common/winUtil.h, since this app is generic toolbox apps.
+ */
#ifdef _WIN32
WinUtil_EnableSafePathSearching(TRUE);
+#if defined(VMX86_RELEASE)
+ WinUtil_VerifyExePathW();
+#endif
#endif
/*