Index: trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
===================================================================
--- trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp	(revision 37622)
+++ trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp	(revision 37765)
@@ -63,5 +63,5 @@
 static void LogString(MSIHANDLE hInstall, LPCSTR szString, ...)
 {
-    PMSIHANDLE newHandle = ::MsiCreateRecord(2);
+    PMSIHANDLE newHandle = MsiCreateRecord(2);
 
     char szBuffer[1024] = {0};
@@ -82,5 +82,5 @@
 static void LogStringW(MSIHANDLE hInstall, LPCWSTR szString, ...)
 {
-    PMSIHANDLE newHandle = ::MsiCreateRecord(2);
+    PMSIHANDLE newHandle = MsiCreateRecord(2);
 
     TCHAR szBuffer[1024] = {0};
@@ -111,5 +111,7 @@
 }
 
-DWORD Exec(MSIHANDLE hModule, TCHAR* szAppName, TCHAR* szCmdLine, TCHAR* szWorkDir, DWORD* dwExitCode)
+DWORD Exec(MSIHANDLE hModule,
+           const TCHAR *pszAppName, TCHAR *pszCmdLine, const TCHAR *pszWorkDir,
+           DWORD *pdwExitCode)
 {
     STARTUPINFO si;
@@ -117,5 +119,5 @@
     DWORD rc = ERROR_SUCCESS;
 
-    ::ZeroMemory(&si, sizeof(si));
+    ZeroMemory(&si, sizeof(si));
     si.dwFlags = STARTF_USESHOWWINDOW;
 #ifdef UNICODE
@@ -124,22 +126,22 @@
     si.wShowWindow = SW_HIDE; /* For debugging: SW_SHOW; */
     si.cb = sizeof(si);
-    ::ZeroMemory(&pi, sizeof(pi));
+    ZeroMemory(&pi, sizeof(pi));
 
     LogStringW(hModule, TEXT("Executing command line: %s %s (Working Dir: %s)"),
-               szAppName, szCmdLine, szWorkDir == NULL ? L"Current" : szWorkDir);
-
-    ::SetLastError(0);
-    if (!::CreateProcess(szAppName,    /* Module name. */
-                         szCmdLine,    /* Command line. */
-                         NULL,         /* Process handle not inheritable. */
-                         NULL,         /* Thread handle not inheritable. */
-                         FALSE,        /* Set handle inheritance to FALSE .*/
-                         0,            /* No creation flags. */
-                         NULL,         /* Use parent's environment block. */
-                         szWorkDir,    /* Use parent's starting directory. */
-                         &si,          /* Pointer to STARTUPINFO structure. */
-                         &pi))         /* Pointer to PROCESS_INFORMATION structure. */
-    {
-        rc = ::GetLastError();
+               pszAppName, pszCmdLine, pszWorkDir == NULL ? L"Current" : pszWorkDir);
+
+    SetLastError(0);
+    if (!CreateProcess(pszAppName,    /* Module name. */
+                       pszCmdLine,    /* Command line. */
+                       NULL,         /* Process handle not inheritable. */
+                       NULL,         /* Thread handle not inheritable. */
+                       FALSE,        /* Set handle inheritance to FALSE .*/
+                       0,            /* No creation flags. */
+                       NULL,         /* Use parent's environment block. */
+                       pszWorkDir,    /* Use parent's starting directory. */
+                       &si,          /* Pointer to STARTUPINFO structure. */
+                       &pi))         /* Pointer to PROCESS_INFORMATION structure. */
+    {
+        rc = GetLastError();
         LogStringW(hModule, TEXT("Executing command line: CreateProcess() failed! Error: %ld"), rc);
         return rc;
@@ -147,14 +149,14 @@
 
     /* Wait until child process exits. */
-    if (WAIT_FAILED == ::WaitForSingleObject(pi.hProcess, 30 * 1000 /* Wait 30 secs max. */))
-    {
-        rc = ::GetLastError();
+    if (WAIT_FAILED == WaitForSingleObject(pi.hProcess, 30 * 1000 /* Wait 30 secs max. */))
+    {
+        rc = GetLastError();
         LogStringW(hModule, TEXT("Executing command line: WaitForSingleObject() failed! Error: %ld"), rc);
     }
     else
     {
-        if (0 == ::GetExitCodeProcess(pi.hProcess, dwExitCode))
-        {
-            rc = ::GetLastError();
+        if (!GetExitCodeProcess(pi.hProcess, pdwExitCode))
+        {
+            rc = GetLastError();
             LogStringW(hModule, TEXT("Executing command line: GetExitCodeProcess() failed! Error: %ld"), rc);
         }
@@ -162,8 +164,8 @@
 
     /* Close process and thread handles. */
-    ::CloseHandle(pi.hProcess);
-    ::CloseHandle(pi.hThread);
-
-    LogStringW(hModule, TEXT("Executing command returned: %ld (exit code %ld)"), rc, *dwExitCode);
+    CloseHandle(pi.hProcess);
+    CloseHandle(pi.hThread);
+
+    LogStringW(hModule, TEXT("Executing command returned: %ld (exit code %ld)"), rc, *pdwExitCode);
     return rc;
 }
@@ -175,5 +177,5 @@
     HKEY hkPythonCore = NULL;
     BOOL bFound = FALSE;
-    LONG rc = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Python\\PythonCore", 0, KEY_READ, &hkPythonCore);
+    LONG rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Python\\PythonCore", 0, KEY_READ, &hkPythonCore);
     if (rc != ERROR_SUCCESS)
     {
@@ -191,5 +193,5 @@
         DWORD dwKeyType = REG_SZ;
 
-        rc = ::RegEnumKeyEx(hkPythonCore, i, szRoot, &dwLen, NULL, NULL, NULL, NULL);
+        rc = RegEnumKeyEx(hkPythonCore, i, szRoot, &dwLen, NULL, NULL, NULL, NULL);
         if (rc != ERROR_SUCCESS || dwLen <= 0)
             break;
@@ -199,15 +201,15 @@
 
         HKEY hkPythonInstPath = NULL;
-        rc = ::RegOpenKeyEx(hkPythonCore, szPath, 0, KEY_READ,  &hkPythonInstPath);
+        rc = RegOpenKeyEx(hkPythonCore, szPath, 0, KEY_READ,  &hkPythonInstPath);
         if (rc != ERROR_SUCCESS)
             continue;
 
-        rc = ::RegQueryValueEx(hkPythonInstPath, L"", NULL, &dwKeyType, (LPBYTE)szVal, &dwLen);
+        rc = RegQueryValueEx(hkPythonInstPath, L"", NULL, &dwKeyType, (LPBYTE)szVal, &dwLen);
         if (rc == ERROR_SUCCESS)
             LogStringW(hModule, TEXT("InstallPythonAPI: Path \"%s\" detected."), szVal);
 
-        ::RegCloseKey(hkPythonInstPath);
-    }
-    ::RegCloseKey(hkPythonCore);
+        RegCloseKey(hkPythonInstPath);
+    }
+    RegCloseKey(hkPythonCore);
 
     /* Python path found? */
@@ -215,5 +217,5 @@
     TCHAR szCmdLine[MAX_PATH] = { 0 };
     DWORD dwExitCode = 0;
-    if (::_tcslen(szVal) > 0)
+    if (_tcslen(szVal) > 0)
     {
         /* Cool, check for installed Win32 extensions. */
@@ -222,6 +224,7 @@
         _stprintf_s(szCmdLine, sizeof(szCmdLine) / sizeof(TCHAR), L"%s\\python.exe -c \"import win32api\"", szVal);
 
-        if (   (0 == Exec(hModule, szExec, szCmdLine, NULL, &dwExitCode))
-            && (0 == dwExitCode))
+        DWORD dwRetExec = Exec(hModule, szExec, szCmdLine, NULL, &dwExitCode);
+        if (   (ERROR_SUCCESS == dwRetExec)
+            && (            0 == dwExitCode))
         {
             /* Did we get the correct error level (=0)? */
@@ -229,5 +232,6 @@
             bFound = TRUE;
         }
-        else LogStringW(hModule, TEXT("InstallPythonAPI: Win32 extensions not found."));
+        else
+            LogStringW(hModule, TEXT("InstallPythonAPI: Win32 extensions not found."));
     }
 
@@ -236,30 +240,41 @@
     {
         /* Get the VBoxAPI setup string. */
-        TCHAR szVBoxAPISetupPath[MAX_PATH] = {0};
-        VBoxGetProperty(hModule, L"INSTALLDIR", szVBoxAPISetupPath, sizeof(szVBoxAPISetupPath));
-
-        /* Set final path. */
-        _stprintf_s(szPath, sizeof(szPath) / sizeof(TCHAR), L"%s\\sdk\\install", szVBoxAPISetupPath);
-
-        /* Install our API module. */
-        _stprintf_s(szCmdLine, sizeof(szCmdLine) / sizeof(TCHAR), L"%s\\python.exe vboxapisetup.py install", szVal);
-
-        /* Set required environment variables. */
-        if (!SetEnvironmentVariable(L"VBOX_INSTALL_PATH", szVBoxAPISetupPath))
-        {
-            LogStringW(hModule, TEXT("InstallPythonAPI: Could set environment variable VBOX_INSTALL_PATH!"));
+        TCHAR szPathTargetDir[MAX_PATH] = {0};
+        VBoxGetProperty(hModule, L"CustomActionData", szPathTargetDir, sizeof(szPathTargetDir));
+        if (_tcslen(szPathTargetDir))
+        {
+
+            /* Set final path. */
+            _stprintf_s(szPath, sizeof(szPath) / sizeof(TCHAR), L"%s\\sdk\\install", szPathTargetDir);
+
+            /* Install our API module. */
+            _stprintf_s(szCmdLine, sizeof(szCmdLine) / sizeof(TCHAR), L"%s\\python.exe vboxapisetup.py install", szVal);
+
+            /* Set required environment variables. */
+            if (!SetEnvironmentVariable(L"VBOX_INSTALL_PATH", szPathTargetDir))
+            {
+                LogStringW(hModule, TEXT("InstallPythonAPI: Could set environment variable VBOX_INSTALL_PATH!"));
+            }
+            else
+            {
+                DWORD dwRetExec = Exec(hModule, szExec, szCmdLine, szPath, &dwExitCode);
+                if (   (ERROR_SUCCESS == dwRetExec)
+                    && (            0 == dwExitCode))
+                {
+                    /* All done! */
+                    LogStringW(hModule, TEXT("InstallPythonAPI: VBoxAPI for Python successfully installed."));
+                    bInstalled = TRUE;
+                }
+                else
+                {
+                    if (dwRetExec)
+                        LogStringW(hModule, TEXT("InstallPythonAPI: Error while executing installation of VBox API: %ld"), dwRetExec);
+                    else
+                        LogStringW(hModule, TEXT("InstallPythonAPI: Python reported an error while installing VBox API: %ld"), dwExitCode);
+                }
+            }
         }
         else
-        {
-            if (   (0 == Exec(hModule, szExec, szCmdLine, szPath, &dwExitCode))
-                && (0 == dwExitCode))
-            {
-                /* All done! */
-                LogStringW(hModule, TEXT("InstallPythonAPI: VBoxAPI for Python successfully installed."));
-                bInstalled = TRUE;
-            }
-            else
-                LogStringW(hModule, TEXT("InstallPythonAPI: Error while installing VBox API: %ld"), dwExitCode);
-        }
+            LogStringW(hModule, TEXT("InstallPythonAPI: Unable to retrieve VBox installation path!"));
     }
 
@@ -409,5 +424,5 @@
     TCHAR szPathDest[_MAX_PATH];
 
-    rc = VBoxGetProperty(hModule, L"INSTALLDIR", szPathTargetDir, sizeof(szPathTargetDir));
+    rc = VBoxGetProperty(hModule, L"CustomActionData", szPathTargetDir, sizeof(szPathTargetDir));
     if (rc == ERROR_SUCCESS)
     {
@@ -441,5 +456,5 @@
     if (rc == ERROR_SUCCESS)
     {
-        rc = VBoxGetProperty(hModule, L"INSTALLDIR", szPathTargetDir, sizeof(szPathTargetDir));
+        rc = VBoxGetProperty(hModule, L"CustomActionData", szPathTargetDir, sizeof(szPathTargetDir));
         if (rc == ERROR_SUCCESS)
         {
Index: trunk/src/VBox/Installer/win/VirtualBox.wxs
===================================================================
--- trunk/src/VBox/Installer/win/VirtualBox.wxs	(revision 37622)
+++ trunk/src/VBox/Installer/win/VirtualBox.wxs	(revision 37765)
@@ -162,7 +162,13 @@
         <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
         <CustomAction Id="ca_CheckSerial" BinaryKey="VBoxInstallHelper" DllEntry="CheckSerial" Impersonate="no"/>
-        <CustomAction Id="ca_InstallPythonAPI" BinaryKey="VBoxInstallHelper" DllEntry="InstallPythonAPI" Execute="deferred" Impersonate="no"/>
-        <CustomAction Id="ca_InstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="InstallBranding" Execute="deferred" Impersonate="no"/>
-        <CustomAction Id="ca_UninstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="UninstallBranding" Execute="deferred" Impersonate="no"/>
+
+        <CustomAction Id="ca_InstallPythonAPI" BinaryKey="VBoxInstallHelper" DllEntry="InstallPythonAPI" Execute="deferred" Return="check" Impersonate="no"/>
+        <CustomAction Id="ca_InstallPythonAPIArgs" Property="ca_InstallPythonAPI" Value="[INSTALLDIR]" Execute="immediate"/>
+
+        <CustomAction Id="ca_InstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="InstallBranding" Execute="deferred" Return="check" Impersonate="no"/>
+        <CustomAction Id="ca_InstallBrandingArgs" Property="ca_InstallBranding" Value="[INSTALLDIR]" Execute="immediate"/>
+
+        <CustomAction Id="ca_UninstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="UninstallBranding" Execute="deferred" Return="check" Impersonate="no"/>
+        <CustomAction Id="ca_UninstallBrandingArgs" Property="ca_UninstallBranding" Value="[INSTALLDIR]" Execute="immediate"/>
 
         <CustomAction Id="ca_UninstallTAPInstances" BinaryKey="VBoxInstallHelper"
@@ -170,6 +176,6 @@
 
 <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+        <CustomAction Id="ca_CreateHostOnlyInterface"  BinaryKey="VBoxInstallHelper"  DllEntry="CreateHostOnlyInterface" Execute="deferred" Return="check" Impersonate="no"/>
         <CustomAction Id="ca_CreateHostOnlyInterfaceArgs" Property="ca_CreateHostOnlyInterface" Value="[INSTALLDIR]" Execute="immediate"/>
-        <CustomAction Id="ca_CreateHostOnlyInterface"  BinaryKey="VBoxInstallHelper"  DllEntry="CreateHostOnlyInterface" Execute="deferred" Return="check" Impersonate="no"/>
 
         <CustomAction Id="ca_RemoveHostOnlyInterfaces" BinaryKey="VBoxInstallHelper"  DllEntry="RemoveHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
@@ -724,5 +730,5 @@
 
 <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
-            <Feature Id="ft_VBoxPython" Title="VirtualBox Python Support" Level="1"
+            <Feature Id="ft_VBoxPython" Title="VirtualBox Python 2.x Support" Level="1"
                     Description="!(loc.VB_Python)"
                     ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand" >
@@ -762,6 +768,11 @@
             <Custom Action="ca_UninstallNetFlt" After="InstallInitialize" ><![CDATA[&ft_VBoxNetworkFlt=2]]></Custom>
 <?endif?>
+            <Custom Action="ca_InstallPythonAPIArgs" Before="ca_InstallPythonAPI" ><![CDATA[&ft_VBoxPython=3]]></Custom>
             <Custom Action="ca_InstallPythonAPI" Before="InstallFinalize" ><![CDATA[&ft_VBoxPython=3]]></Custom>
+
+            <Custom Action="ca_InstallBrandingArgs" Before="ca_InstallBranding" ><![CDATA[NOT REMOVE]]></Custom>
             <Custom Action="ca_InstallBranding" Before="InstallFinalize" ><![CDATA[NOT REMOVE]]></Custom>
+
+            <Custom Action="ca_UninstallBrandingArgs" Before="ca_UninstallBranding" ><![CDATA[REMOVE]]></Custom>
             <Custom Action="ca_UninstallBranding" Before="InstallFinalize" ><![CDATA[REMOVE]]></Custom>
 
