Changeset 83805 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetFltUninstall.cpp
- Timestamp:
- Apr 18, 2020 11:08:25 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetFltUninstall.cpp
r82968 r83805 34 34 #define VBOX_NETFLT_RETRIES 10 35 35 36 static VOID winNetCfgLogger 36 static VOID winNetCfgLogger(LPCSTR szString) 37 37 { 38 38 printf("%s", szString); … … 42 42 { 43 43 INetCfg *pnc; 44 LPWSTR lpszLockedBy = NULL; 45 int r; 44 int rcExit = RTEXITCODE_FAILURE; 46 45 47 46 VBoxNetCfgWinSetLogging(winNetCfgLogger); … … 50 49 if (hr == S_OK) 51 50 { 52 int i = 0; 53 do 51 for (int i = 0;; i++) 54 52 { 55 hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &lpszLockedBy); 53 LPWSTR pwszLockedBy = NULL; 54 hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &pwszLockedBy); 56 55 if (hr == S_OK) 57 56 { 58 57 hr = VBoxNetCfgWinNetFltUninstall(pnc); 59 58 if (hr != S_OK && hr != S_FALSE) 60 { 61 wprintf(L"error uninstalling VBoxNetFlt (0x%x)\n", hr); 62 r = 1; 63 } 59 wprintf(L"error uninstalling VBoxNetFlt (%#lx)\n", hr); 64 60 else 65 61 { 66 62 wprintf(L"uninstalled successfully\n"); 67 r = 0;63 rcExit = RTEXITCODE_SUCCESS; 68 64 } 69 65 … … 71 67 break; 72 68 } 73 else if (hr == NETCFG_E_NO_WRITE_LOCK && lpszLockedBy) 69 70 if (hr == NETCFG_E_NO_WRITE_LOCK && pwszLockedBy) 74 71 { 75 if (i < VBOX_NETFLT_RETRIES && !wcscmp( lpszLockedBy, L"6to4svc.dll"))72 if (i < VBOX_NETFLT_RETRIES && !wcscmp(pwszLockedBy, L"6to4svc.dll")) 76 73 { 77 wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", ++i, VBOX_NETFLT_RETRIES);78 CoTaskMemFree( lpszLockedBy);74 wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", i + 1, VBOX_NETFLT_RETRIES); 75 CoTaskMemFree(pwszLockedBy); 79 76 } 80 77 else 81 78 { 82 wprintf(L"Error: write lock is owned by another application (%s), close the application and retry uninstalling\n", lpszLockedBy);83 r = 1;84 CoTaskMemFree( lpszLockedBy);79 wprintf(L"Error: write lock is owned by another application (%s), close the application and retry uninstalling\n", 80 pwszLockedBy); 81 CoTaskMemFree(pwszLockedBy); 85 82 break; 86 83 } … … 88 85 else 89 86 { 90 wprintf(L"Error getting the INetCfg interface (0x%x)\n", hr); 91 r = 1; 87 wprintf(L"Error getting the INetCfg interface (%#lx)\n", hr); 92 88 break; 93 89 } 94 } while (true);90 } 95 91 96 92 CoUninitialize(); 97 93 } 98 94 else 99 { 100 wprintf(L"Error initializing COM (0x%x)\n", hr); 101 r = 1; 102 } 95 wprintf(L"Error initializing COM (%#lx)\n", hr); 103 96 104 97 VBoxNetCfgWinSetLogging(NULL); 105 98 106 return r ;99 return rcExit; 107 100 } 108 101
Note:
See TracChangeset
for help on using the changeset viewer.