Index: /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp	(revision 50405)
+++ /trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp	(revision 50406)
@@ -534,5 +534,10 @@
 {
     const char *pszEnvTemp;
-
+/** @todo r=bird: This isn't up to scratch. The life time of an RTEnvGet
+ *        return value is only up to the next RTEnv*, *getenv, *putenv,
+ *        setenv call in _any_ process in the system and the it has known and
+ *        documented code page issues.
+ *
+ *        Use RTEnvGetEx instead! */
     if ((pszEnvTemp = RTEnvGet("VBOX_CAPTUREWIDTH")) != 0)
     {
@@ -650,16 +655,16 @@
     unsigned fCSAM  = ~0U;
 #ifdef VBOX_WITH_VIDEO_REC
-    unsigned fVIDEOREC = 0;
+    bool fVideoRec = 0;
     unsigned long ulFrameWidth = 800;
     unsigned long ulFrameHeight = 600;
-    unsigned long ulBitRate = 300000;
-    char pszMPEGFile[RTPATH_MAX];
+    unsigned long ulBitRate = 300000; /** @todo r=bird: The COM type ULONG isn't unsigned long, it's 32-bit unsigned int. */
+    char szMpegFile[RTPATH_MAX];
     const char *pszFileNameParam = "VBox-%d.vob";
 #endif /* VBOX_WITH_VIDEO_REC */
 
-    LogFlow (("VBoxHeadless STARTED.\n"));
-    RTPrintf (VBOX_PRODUCT " Headless Interface " VBOX_VERSION_STRING "\n"
-              "(C) 2008-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
-              "All rights reserved.\n\n");
+    LogFlow(("VBoxHeadless STARTED.\n"));
+    RTPrintf(VBOX_PRODUCT " Headless Interface " VBOX_VERSION_STRING "\n"
+             "(C) 2008-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
+             "All rights reserved.\n\n");
 
 #ifdef VBOX_WITH_VIDEO_REC
@@ -792,5 +797,5 @@
 #ifdef VBOX_WITH_VIDEO_REC
             case 'c':
-                fVIDEOREC = true;
+                fVideoRec = true;
                 break;
             case 'w':
@@ -856,5 +861,5 @@
         return 1;
     }
-    RTStrPrintf(&pszMPEGFile[0], RTPATH_MAX, pszFileNameParam, RTProcSelf());
+    RTStrPrintf(&szMpegFile[0], RTPATH_MAX, pszFileNameParam, RTProcSelf());
 #endif /* defined VBOX_WITH_VIDEO_REC */
 
@@ -971,5 +976,5 @@
         PFNREGISTERVIDEORECFB pfnRegisterVideoRecFB;
 
-        if (fVIDEOREC)
+        if (fVideoRec)
         {
             HRESULT         rcc = S_OK;
@@ -995,5 +1000,5 @@
                 Log2(("VBoxHeadless: calling pfnRegisterVideoRecFB\n"));
                 rcc = pfnRegisterVideoRecFB(ulFrameWidth, ulFrameHeight, ulBitRate,
-                                         pszMPEGFile, &pFramebuffer);
+                                         szMpegFile, &pFramebuffer);
                 if (rcc != S_OK)
                     LogError("Failed to initialise video capturing - make sure that the file format\n"
@@ -1021,5 +1026,5 @@
         {
 # ifdef VBOX_WITH_VIDEO_REC
-            if (fVIDEOREC && uScreenId == 0)
+            if (fVideoRec && uScreenId == 0)
             {
                 /* Already registered. */
Index: /trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp	(revision 50405)
+++ /trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp	(revision 50406)
@@ -168,5 +168,5 @@
 #ifdef RT_OS_WINDOWS
     /* default to DirectX if nothing else set */
-    if (!RTEnvGet("SDL_VIDEODRIVER"))
+    if (!RTEnvExist("SDL_VIDEODRIVER"))
     {
         _putenv("SDL_VIDEODRIVER=directx");
Index: /trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp	(revision 50405)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp	(revision 50406)
@@ -32,5 +32,5 @@
 bool RTCALL VBoxOglIs3DAccelerationSupported()
 {
-    if (RTEnvGet("VBOX_CROGL_FORCE_SUPPORTED"))
+    if (RTEnvExist("VBOX_CROGL_FORCE_SUPPORTED"))
     {
         LogRel(("VBOX_CROGL_FORCE_SUPPORTED is specified, skipping 3D test, and treating as supported\n"));
Index: /trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp	(revision 50405)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp	(revision 50406)
@@ -32,5 +32,5 @@
 bool RTCALL VBoxOglIs3DAccelerationSupported()
 {
-    if (RTEnvGet("VBOX_CROGL_FORCE_SUPPORTED"))
+    if (RTEnvExist("VBOX_CROGL_FORCE_SUPPORTED"))
     {
         LogRel(("VBOX_CROGL_FORCE_SUPPORTED is specified, skipping 3D test, and treating as supported\n"));
Index: /trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp	(revision 50405)
+++ /trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp	(revision 50406)
@@ -177,12 +177,16 @@
     for (unsigned i = 0; i < RT_ELEMENTS(s_aProps); i++)
     {
-        const char *pszEnvValue = RTEnvGet(s_aProps[i].pszEnvName);
-        if (pszEnvValue)
+        char szEnvValue[8192];
+        int rcEnv = RTEnvGetEx(RTENV_DEFAULT, s_aProps[i].pszEnvName, szEnvValue, sizeof(szEnvValue), NULL);
+        if (RT_SUCCESS(rc))
         {
-            rc = RTDbgCfgChangeString(pUVM->dbgf.s.hDbgCfg, s_aProps[i].enmProp, RTDBGCFGOP_PREPEND, pszEnvValue);
+            rc = RTDbgCfgChangeString(pUVM->dbgf.s.hDbgCfg, s_aProps[i].enmProp, RTDBGCFGOP_PREPEND, szEnvValue);
             if (RT_FAILURE(rc))
                 return VMR3SetError(pUVM, rc, RT_SRC_POS,
-                                    "DBGF Config Error: %s=%s -> %Rrc", s_aProps[i].pszEnvName, pszEnvValue, rc);
+                                    "DBGF Config Error: %s=%s -> %Rrc", s_aProps[i].pszEnvName, szEnvValue, rc);
         }
+        else if (rc != VERR_ENV_VAR_NOT_FOUND)
+            return VMR3SetError(pUVM, rc, RT_SRC_POS,
+                                "DBGF Config Error: Error querying env.var. %s: %Rrc", s_aProps[i].pszEnvName, rc);
 
         char *pszCfgValue;
