Changeset 96572 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfUninstall.cpp
- Timestamp:
- Sep 1, 2022 8:36:22 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfUninstall.cpp
r96407 r96572 35 35 */ 36 36 37 38 /********************************************************************************************************************************* 39 * Header Files * 40 *********************************************************************************************************************************/ 37 41 #include <VBox/VBoxNetCfg-win.h> 38 #include <stdio.h>39 42 43 #include <iprt/initterm.h> 44 #include <iprt/message.h> 45 #include <iprt/utf16.h> 46 47 48 /********************************************************************************************************************************* 49 * Defined Constants And Macros * 50 *********************************************************************************************************************************/ 40 51 #define VBOX_NETCFG_APP_NAME L"NetLwfUninstall" 41 52 #define VBOX_NETLWF_RETRIES 10 42 53 54 43 55 static DECLCALLBACK(void) winNetCfgLogger(const char *pszString) 44 56 { 45 printf("%s", pszString);57 RTMsgInfo("%s", pszString); 46 58 } 47 59 48 60 static int VBoxNetLwfUninstall() 49 61 { 50 INetCfg *pnc;51 62 int rcExit = RTEXITCODE_FAILURE; 52 63 … … 59 70 { 60 71 LPWSTR pwszLockedBy = NULL; 72 INetCfg *pnc = NULL; 61 73 hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &pwszLockedBy); 62 74 if (hr == S_OK) … … 65 77 if (hr == S_OK) 66 78 { 67 wprintf(L"uninstalled successfully\n");79 RTMsgInfo("uninstalled successfully!"); 68 80 rcExit = RTEXITCODE_SUCCESS; 69 81 } 70 82 else 71 wprintf(L"error uninstalling VBoxNetLwf (%#lx)\n", hr);83 RTMsgError("error uninstalling VBoxNetLwf: %Rhrc"); 72 84 73 85 VBoxNetCfgWinReleaseINetCfg(pnc, TRUE); … … 77 89 if (hr == NETCFG_E_NO_WRITE_LOCK && pwszLockedBy) 78 90 { 79 if (i < VBOX_NETLWF_RETRIES && !wcscmp(pwszLockedBy, L"6to4svc.dll"))91 if (i < VBOX_NETLWF_RETRIES && RTUtf16ICmpAscii(pwszLockedBy, "6to4svc.dll") == 0) 80 92 { 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); 82 94 CoTaskMemFree(pwszLockedBy); 83 95 } 84 96 else 85 97 { 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); 88 100 CoTaskMemFree(pwszLockedBy); 89 101 break; … … 92 104 else 93 105 { 94 wprintf(L"Error getting the INetCfg interface (%#lx)\n", hr);106 RTMsgError("Failed getting the INetCfg interface: %Rhrc", hr); 95 107 break; 96 108 } … … 100 112 } 101 113 else 102 wprintf(L"Error initializing COM (%#lx)\n", hr);114 RTMsgError("Failed initializing COM: %Rhrc", hr); 103 115 104 116 VBoxNetCfgWinSetLogging(NULL); … … 109 121 int __cdecl main(int argc, char **argv) 110 122 { 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 112 128 return VBoxNetLwfUninstall(); 113 129 } 130
Note:
See TracChangeset
for help on using the changeset viewer.