Changeset 38793 in vbox
- Timestamp:
- Sep 19, 2011 1:48:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
r38791 r38793 854 854 855 855 GUID guid; 856 WCHAR MpInf[MAX_PATH];857 DWORD c Size = sizeof(MpInf)/sizeof(MpInf[0]);858 LPCWSTR p InfPath = NULL;856 WCHAR wszMpInf[MAX_PATH]; 857 DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("drivers\\network\\netadp\\VBoxNetAdp.inf") - 1; 858 LPCWSTR pwszInfPath = NULL; 859 859 bool bIsFile = false; 860 UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", MpInf, &cSize);860 UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszMpInf, &cchMpInf); 861 861 if (uErr == ERROR_SUCCESS) 862 862 { 863 if (c Size)864 { 865 logStringW(hModule, L"CreateHostOnlyInterface: NetAdpDir property = %s", MpInf);866 if ( MpInf[cSize-1] != L'\\')863 if (cchMpInf) 864 { 865 logStringW(hModule, L"CreateHostOnlyInterface: NetAdpDir property = %s", wszMpInf); 866 if (wszMpInf[cchMpInf - 1] != L'\\') 867 867 { 868 MpInf[cSize] = L'\\'; 869 ++cSize; 870 MpInf[cSize] = L'\0'; 868 wszMpInf[cchMpInf++] = L'\\'; 869 wszMpInf[cchMpInf] = L'\0'; 871 870 } 872 871 873 /** @todo r=andy Avoid wcscat, can cause buffer overruns! */ 874 wcscat(MpInf, L"drivers\\network\\netadp\\VBoxNetAdp.inf"); 875 pInfPath = MpInf; 872 wcscat(wszMpInf, L"drivers\\network\\netadp\\VBoxNetAdp.inf"); 873 pwszInfPath = wszMpInf; 876 874 bIsFile = true; 877 875 878 logStringW(hModule, L"CreateHostOnlyInterface: Resulting INF path = %s", p InfPath);876 logStringW(hModule, L"CreateHostOnlyInterface: Resulting INF path = %s", pwszInfPath); 879 877 } 880 878 else … … 885 883 886 884 /* Make sure the inf file is installed. */ 887 if (!!pInfPath && bIsFile) 888 { 889 hr = VBoxDrvCfgInfInstall(pInfPath); 885 if (pwszInfPath != NULL && bIsFile) 886 { 887 logStringW(hModule, L"CreateHostOnlyInterface: Calling VBoxDrvCfgInfInstall(%s)", pwszInfPath); 888 hr = VBoxDrvCfgInfInstall(pwszInfPath); 889 logStringW(hModule, L"CreateHostOnlyInterface: VBoxDrvCfgInfInstall returns 0x%x", hr); 890 890 if (FAILED(hr)) 891 891 logStringW(hModule, L"CreateHostOnlyInterface: Failed to install INF file, error = 0x%x", hr); … … 894 894 if (SUCCEEDED(hr)) 895 895 { 896 hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface(pInfPath, bIsFile, &guid, NULL, NULL); 896 logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinCreateHostOnlyNetworkInterface"); 897 hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface(pwszInfPath, bIsFile, &guid, NULL, NULL); 898 logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface returns 0x%x", hr); 897 899 if (SUCCEEDED(hr)) 898 900 { 899 901 ULONG ip = inet_addr("192.168.56.1"); 900 902 ULONG mask = inet_addr("255.255.255.0"); 903 logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinEnableStaticIpConfig"); 901 904 hr = VBoxNetCfgWinEnableStaticIpConfig(&guid, ip, mask); 905 logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig returns 0x%x", hr); 902 906 if (FAILED(hr)) 903 907 logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig failed, error = 0x%x", hr); … … 911 915 912 916 /* Restore original setup mode. */ 917 logStringW(hModule, L"CreateHostOnlyInterface: almost done..."); 913 918 if (bSetupModeInteractive) 914 919 SetupSetNonInteractiveMode(bSetupModeInteractive); … … 918 923 #endif /* VBOX_WITH_NETFLT */ 919 924 925 logStringW(hModule, L"CreateHostOnlyInterface: returns success (ignoring all failures)"); 920 926 /* Never fail the install even if we did not succeed. */ 921 927 return ERROR_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.