]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes to common source files not applicable to open-vm-tools.
authorKaty Feng <fkaty@vmware.com>
Thu, 16 Nov 2023 17:21:20 +0000 (09:21 -0800)
committerKaty Feng <fkaty@vmware.com>
Thu, 16 Nov 2023 17:21:20 +0000 (09:21 -0800)
open-vm-tools/hgfsclient/hgfsclient.c
open-vm-tools/lib/guestApp/guestApp.c
open-vm-tools/namespacetool/namespacetool.c
open-vm-tools/rpctool/rpctool.c
open-vm-tools/toolbox/toolbox-cmd.c
open-vm-tools/vgauthImport/vgauthImport.c

index 3bbe7634061b7bb6741a180674646d6c81dd6124..e345418554e63199fac9f0ce8dc28386c4ced8c5 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * 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
@@ -419,6 +419,9 @@ main(int argc,          // IN
 {
 #ifdef _WIN32
    WinUtil_EnableSafePathSearching(TRUE);
+#   if defined(VMX86_RELEASE)
+   WinUtil_VerifyExePathW();
+#   endif
 #endif
    if (argc == 2 &&
        (!strncmp(argv[1], "-h", 2) ||
index ddac5de6e789452412b9c2d333d703455fc41dae..35fde3794dcdbc26cd0004455b9e24188f6119f6 100644 (file)
@@ -31,6 +31,7 @@
 #include <windows.h>
 #include <shlobj.h>
 #include "productState.h"
+#include "conf.h" // for tools install path regkey
 #include "winregistry.h"
 #include "windowsUtil.h"
 #endif
@@ -133,9 +134,6 @@ GuestApp_GetDefaultScript(const char *confName) // IN
 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;
@@ -153,17 +151,20 @@ GuestApp_GetInstallPathW(void)
 #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;
    }
@@ -179,11 +180,11 @@ GuestApp_GetInstallPathW(void)
    }
 
    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;
    }
@@ -228,7 +229,7 @@ GuestApp_GetInstallPath(void)
 
    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());
index 915f149e5bbe06249ce697646a64f7fea0f4124b..fd842ed62930fed34f696fa617e48967fa37903f 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * 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
@@ -635,6 +635,9 @@ main(int argc, char *argv[])
 
 #if defined(_WIN32)
    WinUtil_EnableSafePathSearching(TRUE);
+#if defined(VMX86_RELEASE)
+   WinUtil_VerifyExePathW();
+#endif
 #endif
 
    gAppName = g_path_get_basename(argv[0]);
index 6220a0a835330f96d3dcf094c29862e12c3722a5..b343b7655b8ce9351c8ac62d1c00d724466ad043 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2002-2020 VMware, Inc. All rights reserved.
+ * Copyright (c) 2002-2020, 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
@@ -146,6 +146,9 @@ main(int argc, char *argv[])
 
 #ifdef _WIN32
    WinUtil_EnableSafePathSearching(TRUE);
+#if defined(VMX86_RELEASE)
+   WinUtil_VerifyExePathW();
+#endif
 #endif
 
    /*
index 585073f3353edb88400d436d15c80054f747a13a..ae9b209a371796659b3703b7be3780e51dab3fba 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * 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
@@ -462,6 +462,9 @@ main(int argc,    // IN: length of command line arguments
    char **argv;
 
    WinUtil_EnableSafePathSearching(TRUE);
+#   if defined(VMX86_RELEASE)
+   WinUtil_VerifyExePathW();
+#   endif
 
    Unicode_InitW(argc, wargv, NULL, &argv, NULL);
 #else
index e96d19de7cdf5c893ca2191333301a4e3e8631dc..3b2d1462941d140229ddeae823022c2256cfec91 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * 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
@@ -522,8 +522,17 @@ main(int argc, char *argv[])
       { 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
 
    /*