Index: /trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp
===================================================================
--- /trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp	(revision 33461)
+++ /trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp	(revision 33462)
@@ -121,23 +121,26 @@
     do
     {
-        AssertBreakStmt(pszDataName, "Resource name is empty!");
+        AssertMsgBreak(pszDataName, ("Resource name is empty!\n"));
 
         /* Find our resource. */
         HRSRC hRsrc = FindResourceEx(hInst, RT_RCDATA, pszDataName, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
-        AssertBreakStmt(hRsrc, "Could not find resource!");
+        AssertMsgBreak(hRsrc, ("Could not find resource!\n"));
 
         /* Get resource size. */
         *pdwSize = SizeofResource(hInst, hRsrc);
-        AssertBreakStmt(*pdwSize > 0, "Size of resource is invalid!");
+        AssertMsgBreak((*pdwSize > 0, "Size of resource is invalid!\n"));
 
         /* Get pointer to resource. */
         HGLOBAL hData = LoadResource(hInst, hRsrc);
-        AssertBreakStmt(hData, "Could not load resource!");
+        AssertMsgBreak(hData, ("Could not load resource!\n"));
 
         /* Lock resource. */
         *ppvResource = LockResource(hData);
-        AssertBreakStmt(*ppvResource, "Could not lock resource!");
+        AssertMsgBreak(*ppvResource, ("Could not lock resource!\n"));
+        return VINF_SUCCESS;
+
     } while (0);
-    return *ppvResource ? VINF_SUCCESS : VERR_IO_GEN_FAILURE;
+
+    return VERR_IO_GEN_FAILURE;
 }
 
@@ -157,5 +160,7 @@
                             char       **ppszTempFile)
 {
-    return RTStrAPrintf(ppszTempFile, "%s\\%s", pszTempPath, pszTargetFileName);
+    if (RTStrAPrintf(ppszTempFile, "%s\\%s", pszTempPath, pszTargetFileName) >= 0)
+        return VINF_SUCCESS;
+    return VERR_NO_STR_MEMORY;
 }
 
@@ -179,6 +184,6 @@
     do
     {
-        AssertBreakStmt(pszResourceName, "Resource pointer invalid!");
-        AssertBreakStmt(pszTempFile, "Temp file pointer invalid!");
+        AssertMsgBreak(pszResourceName, ("Resource pointer invalid!\n"));
+        AssertMsgBreak(pszTempFile, ("Temp file pointer invalid!"));
 
         /* Read the data of the built-in resource. */
@@ -186,5 +191,5 @@
         DWORD dwDataSize = 0;
         rc = ReadData(NULL, pszResourceName, &pvData, &dwDataSize);
-        AssertRCBreakStmt(rc, "Could not read resource data!");
+        AssertMsgRCBreak(rc, ("Could not read resource data!\n"));
 
         /* Create new (and replace an old) file. */
@@ -194,5 +199,5 @@
                         | RTFILE_O_DENY_NOT_DELETE
                         | RTFILE_O_DENY_WRITE);
-        AssertRCBreakStmt(rc, "Could not open file for writing!");
+        AssertMsgRCBreak(rc, ("Could not open file for writing!\n"));
         bCreatedFile = TRUE;
 
@@ -200,6 +205,6 @@
         size_t cbWritten = 0;
         rc = RTFileWrite(fh, pvData, dwDataSize, &cbWritten);
-        AssertRCBreakStmt(rc, "Could not open file for writing!");
-        AssertBreakStmt((dwDataSize == cbWritten), "File was not extracted completely! Disk full?");
+        AssertMsgRCBreak(rc, ("Could not open file for writing!\n"));
+        AssertMsgBreak(dwDataSize == cbWritten, ("File was not extracted completely! Disk full?\n"));
 
     } while (0);
@@ -346,9 +351,8 @@
     BOOL fEnableLogging = FALSE;
     BOOL bExit = FALSE;
-    char *pszTempPathFull = NULL; /* Contains the final extraction directory later. */
 
     /* Temp variables for arguments. */
-    char szExtractPath[1024] = {0};
-    char szMSIArgs[1024] = {0};
+    char szExtractPath[RTPATH_MAX] = {0};
+    char szMSIArgs[RTPATH_MAX] = {0};
 
     /* Process arguments. */
@@ -382,5 +386,4 @@
         {
             vrc = ::StringCbCat(szExtractPath, sizeof(szExtractPath), pArgV[i+1]);
-            pszTempPathFull = szExtractPath; /* Point to the new path. */
             i++; /* Avoid the specify path from being parsed */
         }
@@ -445,20 +448,19 @@
     HRESULT hr = S_OK;
 
-    do
+    do /* break loop */
     {
         /* Get/create our temp path (only if not already set). */
-        if (pszTempPathFull == NULL)
-        {
-            char szTemp[_MAX_PATH] = {0};
-            vrc = RTPathTemp(szTemp, sizeof(szTemp));
-            AssertRCBreakStmt(vrc, "Could not retrieve temp directory!");
-            vrc = RTStrAPrintf(&pszTempPathFull, "%s\\VirtualBox", szTemp);
-            AssertRCBreakStmt(vrc, "Could not construct temp directory!");
-        }
-
-        if (!RTDirExists(pszTempPathFull))
-        {
-            vrc = RTDirCreate(pszTempPathFull, 0700);
-            AssertRCBreakStmt(vrc, "Could not create temp directory!");
+        if (szExtractPath[0] == '\0')
+        {
+            vrc = RTPathTemp(szExtractPath, sizeof(szExtractPath));
+            AssertMsgRCBreak(vrc, ("Could not retrieve temp directory!\n"));
+
+            vrc = RTPathAppend(szExtractPath, sizeof(szExtractPath), "VirtualBox");
+            AssertMsgRCBreak(vrc, ("Could not construct temp directory!\n"));
+        }
+        if (!RTDirExists(szExtractPath))
+        {
+            vrc = RTDirCreate(szExtractPath, 0700);
+            AssertMsgRCBreak(vrc, ("Could not create temp directory!\n"));
         }
 
@@ -472,5 +474,5 @@
         DWORD cbHeader = 0;
         vrc = ReadData(NULL, "MANIFEST", (LPVOID*)&pHeader, &cbHeader);
-        AssertRCBreakStmt(vrc, "Manifest not found!");
+        AssertMsgRCBreak(vrc, ("Manifest not found!\n"));
 
         /* Extract files. */
@@ -483,13 +485,13 @@
             hr = ::StringCchPrintf(szHeaderName, _MAX_PATH, "HDR_%02d", k);
             vrc = ReadData(NULL, szHeaderName, (LPVOID*)&pPackage, &cbPackage);
-            AssertRCBreakStmt(vrc, "Header not found!"); /** @todo include header name, how? */
+            AssertMsgRCBreak(vrc, ("Header not found!\n")); /** @todo include header name, how? */
 
             if (PackageIsNeeded(pPackage) || fExtractOnly)
             {
                 char *pszTempFile = NULL;
-                vrc = GetTempFileAlloc(pszTempPathFull, pPackage->szFileName, &pszTempFile);
-                AssertRCBreakStmt(vrc, "Could not create name for temporary extracted file!");
+                vrc = GetTempFileAlloc(szExtractPath, pPackage->szFileName, &pszTempFile);
+                AssertMsgRCBreak(vrc, ("Could not create name for temporary extracted file!\n"));
                 vrc = Extract(pPackage, pszTempFile);
-                AssertRCBreakStmt(vrc, "Could not extract file!");
+                AssertMsgRCBreak(vrc, ("Could not extract file!\n"));
                 RTStrFree(pszTempFile);
             }
@@ -502,9 +504,8 @@
              * file(s) can use it.
              */
-            char *pszPathCustomDir;
-            vrc = RTStrAPrintf(&pszPathCustomDir, "%s\\.custom", szPathExe);
-            if (RT_SUCCESS(vrc) && RTDirExists(pszPathCustomDir))
+            char *pszPathCustomDir = RTPathJoinA(szPathExe, ".custom");
+            if (pszPathCustomDir && RTDirExists(pszPathCustomDir))
             {
-                vrc = CopyDir(pszTempPathFull, pszPathCustomDir);
+                vrc = CopyDir(szExtractPath, pszPathCustomDir);
                 if (RT_FAILURE(vrc)) /* Don't fail if it's missing! */
                     vrc = VINF_SUCCESS;
@@ -522,5 +523,5 @@
                 hr = StringCchPrintf(szHeaderName, _MAX_PATH, "HDR_%02d", k);
                 vrc = ReadData(NULL, szHeaderName, (LPVOID*)&pPackage, &cbPackage);
-                AssertRCBreakStmt(vrc, "Package not found!");
+                AssertMsgRCBreak(vrc, ("Package not found!\n"));
 
                 if (PackageIsNeeded(pPackage))
@@ -528,6 +529,6 @@
                     char *pszTempFile = NULL;
 
-                    vrc = GetTempFileAlloc(pszTempPathFull, pPackage->szFileName, &pszTempFile);
-                    AssertRCBreakStmt(vrc, "Could not create name for temporary action file!");
+                    vrc = GetTempFileAlloc(szExtractPath, pPackage->szFileName, &pszTempFile);
+                    AssertMsgRCBreak(vrc, ("Could not create name for temporary action file!\n"));
 
                     /* Handle MSI files. */
@@ -539,17 +540,15 @@
                                                                   : INSTALLUILEVEL_FULL,
                                                                     NULL);
-                        AssertBreakStmt((UILevel != INSTALLUILEVEL_NOCHANGE), "Could not set installer UI level!");
+                        AssertMsgBreak(UILevel != INSTALLUILEVEL_NOCHANGE, ("Could not set installer UI level!\n"));
 
                         /* Enable logging? */
                         if (fEnableLogging)
                         {
-                            char *pszLog = NULL;
-                            vrc = RTStrAPrintf(&pszLog, "%s\\VBoxInstallLog.txt", pszTempPathFull);
-                            char *pszMSILog = NULL;
-                            AssertRCBreakStmt(vrc, "Could not convert MSI log string to current codepage!");
+                            char *pszLog = RTPathJoinA(szExtractPath, "VBoxInstallLog.txt");
+                            AssertMsgRCBreak(vrc, ("Could not convert MSI log string to current codepage!\n"));
                             UINT uLogLevel = MsiEnableLog(INSTALLLOGMODE_VERBOSE,
                                                           pszLog, INSTALLLOGATTRIBUTES_FLUSHEACHLINE);
                             RTStrFree(pszLog);
-                            AssertBreakStmt((uLogLevel == ERROR_SUCCESS), "Could not set installer logging level!");
+                            AssertMsgBreak(uLogLevel == ERROR_SUCCESS, ("Could not set installer logging level!\n"));
                         }
 
@@ -596,5 +595,5 @@
             for (int i=0; i<5; i++)
             {
-                vrc = RTDirRemoveRecursive(pszTempPathFull, 0 /*fFlags*/);
+                vrc = RTDirRemoveRecursive(szExtractPath, 0 /*fFlags*/);
                 if (RT_SUCCESS(vrc))
                     break;
@@ -607,16 +606,12 @@
     if (RT_SUCCESS(vrc))
     {
-        if (    fExtractOnly
-            && !fSilent
-            )
-        {
-            ShowInfo("Files were extracted to: %s", pszTempPathFull);
+        if (   fExtractOnly
+            && !fSilent)
+        {
+            ShowInfo("Files were extracted to: %s", szExtractPath);
         }
 
         /** @todo Add more post installation stuff here if required. */
     }
-
-    if (strlen(szExtractPath) <= 0)
-        RTStrFree(pszTempPathFull);
 
     /* Release instance mutex. */
