VirtualBox

Ignore:
Timestamp:
Sep 1, 2022 8:36:22 PM (2 years ago)
Author:
vboxsync
Message:

HostDrives,Installer/win: Reworked the windows installer related code for no-CRT mode, where applicable, and changed the XxxxInstall.exe/XxxxUninstall.exe utilities to link against VBoxRT.dll instead of being statically linked. Lot's of cleanup. The change is uncomfortably large, but difficult to detangle these things. bugref:10261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfUninstall.cpp

    r96407 r96572  
    3535 */
    3636
     37
     38/*********************************************************************************************************************************
     39*   Header Files                                                                                                                 *
     40*********************************************************************************************************************************/
    3741#include <VBox/VBoxNetCfg-win.h>
    38 #include <stdio.h>
    3942
     43#include <iprt/initterm.h>
     44#include <iprt/message.h>
     45#include <iprt/utf16.h>
     46
     47
     48/*********************************************************************************************************************************
     49*   Defined Constants And Macros                                                                                                 *
     50*********************************************************************************************************************************/
    4051#define VBOX_NETCFG_APP_NAME L"NetLwfUninstall"
    4152#define VBOX_NETLWF_RETRIES 10
    4253
     54
    4355static DECLCALLBACK(void) winNetCfgLogger(const char *pszString)
    4456{
    45     printf("%s", pszString);
     57    RTMsgInfo("%s", pszString);
    4658}
    4759
    4860static int VBoxNetLwfUninstall()
    4961{
    50     INetCfg *pnc;
    5162    int rcExit = RTEXITCODE_FAILURE;
    5263
     
    5970        {
    6071            LPWSTR pwszLockedBy = NULL;
     72            INetCfg *pnc = NULL;
    6173            hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &pwszLockedBy);
    6274            if (hr == S_OK)
     
    6577                if (hr == S_OK)
    6678                {
    67                     wprintf(L"uninstalled successfully\n");
     79                    RTMsgInfo("uninstalled successfully!");
    6880                    rcExit = RTEXITCODE_SUCCESS;
    6981                }
    7082                else
    71                     wprintf(L"error uninstalling VBoxNetLwf (%#lx)\n", hr);
     83                    RTMsgError("error uninstalling VBoxNetLwf: %Rhrc");
    7284
    7385                VBoxNetCfgWinReleaseINetCfg(pnc, TRUE);
     
    7789            if (hr == NETCFG_E_NO_WRITE_LOCK && pwszLockedBy)
    7890            {
    79                 if (i < VBOX_NETLWF_RETRIES && !wcscmp(pwszLockedBy, L"6to4svc.dll"))
     91                if (i < VBOX_NETLWF_RETRIES && RTUtf16ICmpAscii(pwszLockedBy, "6to4svc.dll") == 0)
    8092                {
    81                     wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", i + 1, VBOX_NETLWF_RETRIES);
     93                    RTMsgInfo("6to4svc.dll is holding the lock - retry %d out of %d ...", i + 1, VBOX_NETLWF_RETRIES);
    8294                    CoTaskMemFree(pwszLockedBy);
    8395                }
    8496                else
    8597                {
    86                     wprintf(L"Error: write lock is owned by another application (%s), close the application and retry uninstalling\n",
    87                              pwszLockedBy);
     98                    RTMsgError("Write lock is owned by another application (%ls), close the application and retry uninstalling",
     99                               pwszLockedBy);
    88100                    CoTaskMemFree(pwszLockedBy);
    89101                    break;
     
    92104            else
    93105            {
    94                 wprintf(L"Error getting the INetCfg interface (%#lx)\n", hr);
     106                RTMsgError("Failed getting the INetCfg interface: %Rhrc", hr);
    95107                break;
    96108            }
     
    100112    }
    101113    else
    102         wprintf(L"Error initializing COM (%#lx)\n", hr);
     114        RTMsgError("Failed initializing COM: %Rhrc", hr);
    103115
    104116    VBoxNetCfgWinSetLogging(NULL);
     
    109121int __cdecl main(int argc, char **argv)
    110122{
    111     RT_NOREF2(argc, argv);
     123    RTR3InitExeNoArguments(0);
     124    if (argc != 1)
     125        return RTMsgErrorExit(RTEXITCODE_SYNTAX, "This utility takes no arguments\n");
     126    NOREF(argv);
     127
    112128    return VBoxNetLwfUninstall();
    113129}
     130
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette