Check that at least one drive is defined on startup
Mike Hearn
mh at codeweavers.com
Sun May 23 21:48:17 CDT 2004
Mike Hearn <mh at codeweavers.com>
Add a check to process_init() to ensure at least one drive is defined,
as things break if that isn't the case.
Generated from:
* mike at navi.cx--2004/wine--mainline--0.9--patch-22
--- orig/dlls/kernel/process.c
+++ mod/dlls/kernel/process.c
@@ -832,6 +832,56 @@
TRACE_(file)( "SystemDir = %s\n", debugstr_w(DIR_System) );
}
+/***********************************************************************
+ * check_drive_config
+ *
+ * Perform a sanity check on the users drives configuration.
+ */
+static BOOL check_drive_config()
+{
+ HKEY key;
+ char buffer[256];
+ KEY_FULL_INFORMATION *info = (KEY_FULL_INFORMATION *)buffer;
+ OBJECT_ATTRIBUTES attr;
+ DWORD total_size;
+
+ static const WCHAR drivesW[] = {'M','a','c','h','i','n','e','\\',
+ 'S','o','f','t','w','a','r','e','\\',
+ 'W','i','n','e','\\',
+ 'D','r','i','v','e','s', 0};
+ UNICODE_STRING drives;
+
+ RtlInitUnicodeString( &drives, drivesW );
+
+ attr.Length = sizeof(attr);
+ attr.RootDirectory = 0;
+ attr.ObjectName = &drives;
+ attr.Attributes = 0;
+ attr.SecurityDescriptor = NULL;
+ attr.SecurityQualityOfService = NULL;
+
+ if (NtOpenKey( &key, KEY_ALL_ACCESS, &attr ) != STATUS_SUCCESS) {
+ MESSAGE("wine: no [HKEY_LOCAL_MACHINE\\Software\\Wine\\Drives] key. Wine has not been configured correctly.\n");
+ return FALSE;
+ }
+
+ ZeroMemory( buffer, sizeof(buffer) );
+ if (NtQueryKey( key, KeyFullInformation, buffer, sizeof(buffer), &total_size ) != STATUS_SUCCESS) {
+ ERR("Could not query Drives key\n");
+ NtClose( key );
+ return FALSE;
+ }
+
+ if (!info->SubKeys) {
+ MESSAGE("wine: no drives are defined in the registry. Please define drive C in system.reg and then try again.\n");
+ NtClose( key );
+ return FALSE;
+ }
+
+ NtClose( key );
+ return TRUE;
+}
+
/***********************************************************************
* process_init
@@ -935,6 +985,9 @@
/* registry initialisation */
SHELL_LoadRegistry();
+ /* perform quick sanity check on drive configuration */
+ if (!check_drive_config()) return FALSE;
+
/* global boot finished, the rest is process-local */
SERVER_START_REQ( boot_done )
{
More information about the wine-patches
mailing list