Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/Makefile.kmk
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/Makefile.kmk	(revision 98128)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/Makefile.kmk	(revision 98138)
@@ -30,5 +30,5 @@
 
 PROGRAMS += VBoxGaD3DTest
-VBoxGaD3DTest_TEMPLATE    = VBOXR3STATIC
+VBoxGaD3DTest_TEMPLATE    = VBoxR3Static
 VBoxGaD3DTest_DEFS        = D3DTEST_STANDALONE
 VBoxGaD3DTest_LIBS        = d3d9.lib
@@ -47,5 +47,5 @@
 
 PROGRAMS += VBoxD3D11
-VBoxD3D11_TEMPLATE    = VBOXR3STATIC
+VBoxD3D11_TEMPLATE    = VBoxR3Static
 VBoxD3D11_CXXFLAGS   += -wd4458 -wd4668 -wd4838 -wd5029 -wd5039
 VBoxD3D11_INCS       += $(PATH_ROOT)/src/VBox/Devices/Graphics/shaders
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d11main.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d11main.cpp	(revision 98128)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d11main.cpp	(revision 98138)
@@ -28,5 +28,5 @@
 #include "d3d11render.h"
 
-#include <stdio.h>
+#include <iprt/string.h>
 
 class D3D11Test : public D3D11DeviceProvider
@@ -36,5 +36,5 @@
     ~D3D11Test();
 
-    HRESULT Init(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow);
+    HRESULT Init(HINSTANCE hInstance, int argc, char **argv, int nCmdShow);
     int Run();
 
@@ -47,5 +47,5 @@
     HRESULT initWindow(HINSTANCE hInstance, int nCmdShow);
     HRESULT initDirect3D11();
-    void parseCmdLine(LPSTR lpCmdLine);
+    void parseCmdLine(int argc, char **argv);
     static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
 
@@ -249,7 +249,7 @@
     if (FeatureLevel != D3D_FEATURE_LEVEL_11_1)
     {
-        char s[128];
-        sprintf(s, "Feature level %x", FeatureLevel);
-        D3DTestShowError(hr, s);
+        char sz[128];
+        RTStrPrintf(sz, sizeof(sz), "Feature level %x", FeatureLevel);
+        D3DTestShowError(hr, sz);
     }
 
@@ -379,46 +379,29 @@
 }
 
-void D3D11Test::parseCmdLine(LPSTR lpCmdLine)
+void D3D11Test::parseCmdLine(int argc, char **argv)
 {
     /* Very simple: a test identifier followed by the render mode. */
-    if (!lpCmdLine)
-        return;
-
-    char *p = lpCmdLine;
-
-    while (*p == ' ')
-        ++p;
-
-    if (!*p)
-         return;
 
     /* First number is the render id. */
-    miRenderId = atoi(p);
-
-    while ('0' <= *p && *p <= '9')
-        ++p;
-
-    while (*p == ' ')
-        ++p;
-
-    if (!*p)
-         return;
+    if (argc >= 2)
+        miRenderId = RTStrToInt32(argv[1]);
 
     /* Second number is the render/step mode. */
-    int i = atoi(p);
-    switch (i)
-    {
-        default:
-        case 0: miRenderMode = RenderModeStep;       break;
-        case 1: miRenderMode = RenderModeContinuous; break;
-        case 2: miRenderMode = RenderModeFPS;        break;
-    }
-}
-
-HRESULT D3D11Test::Init(HINSTANCE hInstance,
-                       LPSTR lpCmdLine,
-                       int nCmdShow)
-{
-    parseCmdLine(lpCmdLine);
+    if (argc >= 3)
+    {
+        int i = RTStrToInt32(argv[2]);
+        switch (i)
+        {
+            default:
+            case 0: miRenderMode = RenderModeStep;       break;
+            case 1: miRenderMode = RenderModeContinuous; break;
+            case 2: miRenderMode = RenderModeFPS;        break;
+        }
+    }
+}
+
+HRESULT D3D11Test::Init(HINSTANCE hInstance, int argc, char **argv, int nCmdShow)
+{
+    parseCmdLine(argc, argv);
 
     HRESULT hr = initWindow(hInstance, nCmdShow);
@@ -823,5 +806,6 @@
                     float msPerFrame = elapsed * 1000.0f / (float)cFrames;
                     char sz[256];
-                    _snprintf(sz, sizeof(sz), "D3D11 Test FPS %d Frame Time %fms", cFrames, msPerFrame);
+                    RTStrPrintf(sz, sizeof(sz), "D3D11 Test FPS %d Frame Time %u.%03ums",
+                                cFrames, (unsigned)msPerFrame, (unsigned)(msPerFrame * 1000) % 1000);
                     SetWindowTextA(mHwnd, sz);
 
@@ -859,20 +843,13 @@
 }
 
-int WINAPI WinMain(HINSTANCE hInstance,
-                   HINSTANCE hPrevInstance,
-                   LPSTR lpCmdLine,
-                   int nCmdShow)
-{
-    (void)hPrevInstance;
-
-    int result = 0;
+int main(int argc, char **argv)
+{
+    int      rcExit = RTEXITCODE_FAILURE;
+
     D3D11Test test;
-
-    HRESULT hr = test.Init(hInstance, lpCmdLine, nCmdShow);
+    HRESULT hr = test.Init(GetModuleHandleW(NULL), argc, argv, SW_SHOWDEFAULT);
     if (SUCCEEDED(hr))
-    {
-        result = test.Run();
-    }
-
-    return result;
-}
+        rcExit = test.Run();
+
+    return rcExit;
+}
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d9main.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d9main.cpp	(revision 98128)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/gallium/test/d3d9main.cpp	(revision 98138)
@@ -28,5 +28,5 @@
 #include "d3d9render.h"
 
-#include <stdio.h>
+#include <iprt/string.h>
 
 #define D3D9TEST_MAX_DEVICES 2
@@ -38,5 +38,5 @@
     ~D3D9Test();
 
-    HRESULT Init(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow);
+    HRESULT Init(HINSTANCE hInstance, int argc, char **argv, int nCmdShow);
     int Run();
 
@@ -47,5 +47,5 @@
     HRESULT initWindow(HINSTANCE hInstance, int nCmdShow);
     HRESULT initDirect3D9(int cDevices);
-    void parseCmdLine(LPSTR lpCmdLine);
+    void parseCmdLine(int argc, char **argv);
     static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
 
@@ -232,48 +232,31 @@
 }
 
-void D3D9Test::parseCmdLine(LPSTR lpCmdLine)
+void D3D9Test::parseCmdLine(int argc, char **argv)
 {
     /* Very simple: test number followed by step flag.
      * Default is test 0, step mode: 0 1
      */
-    if (!lpCmdLine)
-        return;
-
-    char *p = lpCmdLine;
-
-    while (*p == ' ')
-        ++p;
-
-    if (!*p)
-         return;
 
     /* First number is the render id. */
-    miRenderId = atoi(p);
-
-    while ('0' <= *p && *p <= '9')
-        ++p;
-
-    while (*p == ' ')
-        ++p;
-
-    if (!*p)
-         return;
+    if (argc >= 2)
+        miRenderId = RTStrToInt32(argv[1]);
 
     /* Second number is the render/step mode. */
-    int i = atoi(p);
-    switch (i)
-    {
-        default:
-        case 0: miRenderMode = RenderModeStep;       break;
-        case 1: miRenderMode = RenderModeContinuous; break;
-        case 2: miRenderMode = RenderModeFPS;        break;
-    }
-}
-
-HRESULT D3D9Test::Init(HINSTANCE hInstance,
-                       LPSTR lpCmdLine,
-                       int nCmdShow)
-{
-    parseCmdLine(lpCmdLine);
+    if (argc >= 3)
+    {
+        int i = RTStrToInt32(argv[2]);
+        switch (i)
+        {
+            default:
+            case 0: miRenderMode = RenderModeStep;       break;
+            case 1: miRenderMode = RenderModeContinuous; break;
+            case 2: miRenderMode = RenderModeFPS;        break;
+        }
+    }
+}
+
+HRESULT D3D9Test::Init(HINSTANCE hInstance, int argc, char **argv, int nCmdShow)
+{
+    parseCmdLine(argc, argv);
 
     HRESULT hr = initWindow(hInstance, nCmdShow);
@@ -376,5 +359,6 @@
                     float msPerFrame = elapsed * 1000.0f / (float)cFrames;
                     char sz[256];
-                    _snprintf(sz, sizeof(sz), "D3D9 Test FPS %d Frame Time %fms", cFrames, msPerFrame);
+                    RTStrPrintf(sz, sizeof(sz), "D3D9 Test FPS %d Frame Time %u.%03ums",
+                                cFrames, (unsigned)msPerFrame, (unsigned)(msPerFrame * 1000) % 1000);
                     SetWindowTextA(mHwnd, sz);
 
@@ -403,20 +387,13 @@
 }
 
-int WINAPI WinMain(HINSTANCE hInstance,
-                   HINSTANCE hPrevInstance,
-                   LPSTR lpCmdLine,
-                   int nCmdShow)
-{
-    (void)hPrevInstance;
-
-    int result = 0;
+int main(int argc, char **argv)
+{
+    int      rcExit = RTEXITCODE_FAILURE;
+
     D3D9Test test;
-
-    HRESULT hr = test.Init(hInstance, lpCmdLine, nCmdShow);
+    HRESULT hr = test.Init(GetModuleHandleW(NULL), argc, argv, SW_SHOWDEFAULT);
     if (SUCCEEDED(hr))
-    {
-        result = test.Run();
-    }
-
-    return result;
-}
+        rcExit = test.Run();
+
+    return rcExit;
+}
