Changeset 36941 in vbox for trunk/src/VBox/HostDrivers/VBoxUSB/win/Install
- Timestamp:
- May 3, 2011 2:56:08 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71528
- Location:
- trunk/src/VBox/HostDrivers/VBoxUSB/win/Install
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/Install/USBInstall.cpp
r31898 r36941 33 33 #include <stdio.h> 34 34 35 #include <VBox/VBoxDrvCfg-win.h> 36 37 static DECLCALLBACK(void) vboxUsbLog(VBOXDRVCFG_LOG_SEVERITY enmSeverity, char * msg, void * pvContext) 38 { 39 switch (enmSeverity) 40 { 41 case VBOXDRVCFG_LOG_SEVERITY_FLOW: 42 case VBOXDRVCFG_LOG_SEVERITY_REGULAR: 43 break; 44 case VBOXDRVCFG_LOG_SEVERITY_REL: 45 RTPrintf("%s", msg); 46 break; 47 default: 48 break; 49 } 50 } 51 52 static DECLCALLBACK(void) vboxUsbPanic(void * pvPanic) 53 { 54 AssertFailed(); 55 } 56 35 57 int usblibOsCreateService(void); 36 58 … … 43 65 } 44 66 67 VBoxDrvCfgLoggerSet(vboxUsbLog, NULL); 68 VBoxDrvCfgPanicSet(vboxUsbPanic, NULL); 69 45 70 RTPrintf("USB installation\n"); 46 71 … … 49 74 if (RT_SUCCESS(rc)) 50 75 { 51 LPSTR lpszFilePart; 52 TCHAR szFullPath[MAX_PATH]; 53 TCHAR szCurDir[MAX_PATH]; 76 LPWSTR lpszFilePart; 77 WCHAR szFullPath[MAX_PATH]; 54 78 DWORD len; 55 79 56 len = GetFullPathName (".\\VBoxUSB.inf", sizeof(szFullPath), szFullPath, &lpszFilePart);80 len = GetFullPathNameW(L".\\VBoxUSB.inf", RT_ELEMENTS(szFullPath), szFullPath, &lpszFilePart); 57 81 Assert(len); 58 82 59 if (GetCurrentDirectory(sizeof(szCurDir), szCurDir) == 0)60 {61 rc = RTErrConvertFromWin32(GetLastError());62 RTPrintf(" GetCurrentDirectory failed with rc=%Rrc\n", rc);83 HRESULT hr = VBoxDrvCfgInfInstall(szFullPath); 84 if (hr == S_OK) 85 { 86 RTPrintf("Installation successful.\n"); 63 87 } 64 88 else 65 89 { 66 /* Copy INF file to Windows\INF, so Windows will automatically install it when our USB device is detected */ 67 BOOL b = SetupCopyOEMInf(szFullPath, NULL, SPOST_PATH, 0, NULL, 0, NULL, NULL); 68 if (b == FALSE) 69 { 70 rc = RTErrConvertFromWin32(GetLastError()); 71 RTPrintf("SetupCopyOEMInf failed with rc=%Rrc\n", rc); 72 } 73 else 74 { 75 RTPrintf("Installation successful.\n"); 76 } 77 } 78 } 90 rc = -1; 91 } 92 } 93 94 if (RT_SUCCESS(rc)) 95 rc = 0; 79 96 80 97 /** @todo RTR3Term(); */ -
trunk/src/VBox/HostDrivers/VBoxUSB/win/Install/USBUninstall.cpp
r31898 r36941 23 23 #include <setupapi.h> 24 24 #include <newdev.h> 25 25 26 #include <iprt/assert.h> 26 27 #include <iprt/err.h> … … 29 30 #include <iprt/string.h> 30 31 #include <VBox/err.h> 32 #include <VBox/VBoxDrvCfg-win.h> 31 33 #include <stdio.h> 32 34 … … 35 37 int usblibOsDeleteService(void); 36 38 39 static DECLCALLBACK(void) vboxUsbLog(VBOXDRVCFG_LOG_SEVERITY enmSeverity, char * msg, void * pvContext) 40 { 41 switch (enmSeverity) 42 { 43 case VBOXDRVCFG_LOG_SEVERITY_FLOW: 44 case VBOXDRVCFG_LOG_SEVERITY_REGULAR: 45 break; 46 case VBOXDRVCFG_LOG_SEVERITY_REL: 47 printf("%s", msg); 48 break; 49 default: 50 break; 51 } 52 } 53 54 static DECLCALLBACK(void) vboxUsbPanic(void * pvPanic) 55 { 56 AssertFailed(); 57 } 58 37 59 38 60 int __cdecl main(int argc, char **argv) 39 61 { 40 BOOL rc; 41 TCHAR szFullPath[MAX_PATH]; 42 CHAR *lpszFilePart; 43 int len; 62 printf("USB uninstallation\n"); 44 63 45 printf("USB uninstallation\n"); 64 VBoxDrvCfgLoggerSet(vboxUsbLog, NULL); 65 VBoxDrvCfgPanicSet(vboxUsbPanic, NULL); 46 66 47 67 usblibOsStopService(); 48 68 usblibOsDeleteService(); 49 69 50 len = GetFullPathName(".\\VBoxUSB.inf", sizeof(szFullPath), szFullPath, &lpszFilePart); 51 Assert(len); 52 53 /* Remove the inf plus all associated files. */ 54 rc = SetupUninstallOEMInf(szFullPath, SUOI_FORCEDELETE, NULL); 55 if (rc == FALSE) 70 HRESULT hr = VBoxDrvCfgInfUninstallAllF(L"USB", L"USB\\VID_80EE&PID_CAFE", SUOI_FORCEDELETE); 71 if (hr != S_OK) 56 72 { 57 printf("SetupUninstallOEMInf failed with rc=%x\n", GetLastError());73 printf("SetupUninstallOEMInf failed with hr=0x%x\n", hr); 58 74 return 1; 59 75 } 76 77 printf("USB uninstallation succeeded!\n"); 78 60 79 return 0; 61 80 }
Note:
See TracChangeset
for help on using the changeset viewer.