winetest: Refuse to run if the mount manager isn't running.
authorAlexandre Julliard <julliard@winehq.org>
Thu, 28 Jan 2010 14:50:52 +0000 (15:50 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 28 Jan 2010 14:50:52 +0000 (15:50 +0100)
This usually indicates that the Wine prefix isn't valid.

programs/winetest/main.c

index bb68ed107857f02281509b0bc0e0dceebb06467d..69b7da69cb10f1d740194675c1fae0d5c9214082 100644 (file)
@@ -132,6 +132,18 @@ static int running_under_wine (void)
     return (GetProcAddress(module, "wine_server_call") != NULL);
 }
 
+static int check_mount_mgr(void)
+{
+    if (running_under_wine())
+    {
+        HANDLE handle = CreateFileA( "\\\\.\\MountPointManager", GENERIC_READ,
+                                     FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
+        if (handle == INVALID_HANDLE_VALUE) return FALSE;
+        CloseHandle( handle );
+    }
+    return TRUE;
+}
+
 static int running_on_visible_desktop (void)
 {
     HWND desktop;
@@ -1021,6 +1033,9 @@ int main( int argc, char *argv[] )
         if (!running_on_visible_desktop ())
             report (R_FATAL, "Tests must be run on a visible desktop");
 
+        if (!check_mount_mgr())
+            report (R_FATAL, "Mount manager not running, most likely your WINEPREFIX wasn't created correctly");
+
         SetConsoleCtrlHandler(ctrl_handler, TRUE);
 
         if (reset_env)