Changeset 83805 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfUninstall.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/VBoxNetLwfUninstall.cpp
r82968 r83805 31 31 #define VBOX_NETLWF_RETRIES 10 32 32 33 static VOID winNetCfgLogger 33 static VOID winNetCfgLogger(LPCSTR szString) 34 34 { 35 35 printf("%s", szString); … … 39 39 { 40 40 INetCfg *pnc; 41 LPWSTR lpszLockedBy = NULL; 42 int r; 41 int rcExit = RTEXITCODE_FAILURE; 43 42 44 43 VBoxNetCfgWinSetLogging(winNetCfgLogger); … … 47 46 if (hr == S_OK) 48 47 { 49 int i = 0; 50 do 48 for (int i = 0;; i++) 51 49 { 52 hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &lpszLockedBy); 50 LPWSTR pwszLockedBy = NULL; 51 hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &pwszLockedBy); 53 52 if (hr == S_OK) 54 53 { 55 54 hr = VBoxNetCfgWinNetLwfUninstall(pnc); 56 if (hr != S_OK)55 if (hr == S_OK) 57 56 { 58 wprintf(L" error uninstalling VBoxNetLwf (0x%x)\n", hr);59 r = 1;57 wprintf(L"uninstalled successfully\n"); 58 rcExit = RTEXITCODE_SUCCESS; 60 59 } 61 60 else 62 { 63 wprintf(L"uninstalled successfully\n"); 64 r = 0; 65 } 61 wprintf(L"error uninstalling VBoxNetLwf (%#lx)\n", hr); 66 62 67 63 VBoxNetCfgWinReleaseINetCfg(pnc, TRUE); 68 64 break; 69 65 } 70 else if (hr == NETCFG_E_NO_WRITE_LOCK && lpszLockedBy) 66 67 if (hr == NETCFG_E_NO_WRITE_LOCK && pwszLockedBy) 71 68 { 72 if (i < VBOX_NETLWF_RETRIES && !wcscmp( lpszLockedBy, L"6to4svc.dll"))69 if (i < VBOX_NETLWF_RETRIES && !wcscmp(pwszLockedBy, L"6to4svc.dll")) 73 70 { 74 wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", ++i, VBOX_NETLWF_RETRIES);75 CoTaskMemFree( lpszLockedBy);71 wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", i + 1, VBOX_NETLWF_RETRIES); 72 CoTaskMemFree(pwszLockedBy); 76 73 } 77 74 else 78 75 { 79 wprintf(L"Error: write lock is owned by another application (%s), close the application and retry uninstalling\n", lpszLockedBy);80 r = 1;81 CoTaskMemFree( lpszLockedBy);76 wprintf(L"Error: write lock is owned by another application (%s), close the application and retry uninstalling\n", 77 pwszLockedBy); 78 CoTaskMemFree(pwszLockedBy); 82 79 break; 83 80 } … … 85 82 else 86 83 { 87 wprintf(L"Error getting the INetCfg interface (0x%x)\n", hr); 88 r = 1; 84 wprintf(L"Error getting the INetCfg interface (%#lx)\n", hr); 89 85 break; 90 86 } 91 } while (true);87 } 92 88 93 89 CoUninitialize(); 94 90 } 95 91 else 96 { 97 wprintf(L"Error initializing COM (0x%x)\n", hr); 98 r = 1; 99 } 92 wprintf(L"Error initializing COM (%#lx)\n", hr); 100 93 101 94 VBoxNetCfgWinSetLogging(NULL); 102 95 103 return r ;96 return rcExit; 104 97 } 105 98
Note:
See TracChangeset
for help on using the changeset viewer.