winecfg: Remove autodetected version from default settings

Vitaliy Margolen wine-patch at kievinfo.com
Mon Oct 10 14:49:35 CDT 2005


This time remove automatically detected version. Wine defaults to win2k if there
is no version defined.

Vitaliy Margolen

changelog:
  winecfg:
  Remove "Automatically detect windows version". Default to win2k.
-------------- next part --------------
Index: programs/winecfg/appdefaults.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/appdefaults.c,v
retrieving revision 1.19
diff -u -p -r1.19 appdefaults.c
--- programs/winecfg/appdefaults.c	17 Aug 2005 11:37:34 -0000	1.19
+++ programs/winecfg/appdefaults.c	10 Oct 2005 19:18:13 -0000
@@ -63,53 +63,52 @@ static const struct
 
 static void update_comboboxes(HWND dialog)
 {
-  int i;
+    int i;
 
-  char *winver;
+    char *winver;
   
-  /* retrieve the registry values */
-  winver = get_reg_key(config_key, keypath(""), "Version", "");
+    /* retrieve the registry values */
+    winver = get_reg_key(config_key, keypath(""), "Version", "");
 
-  /* empty winver means use automatic mode (ie the builtin dll linkage heuristics)  */
-  WINE_TRACE("winver is %s\n", *winver != '\0' ? winver : "null (automatic mode)");
+    if (*winver == '\0')
+    {
+        HeapFree(GetProcessHeap(), 0, winver);
 
-  /* normalize the version strings */
-  if (*winver != '\0')
-  {
-      for (i = 0; i < NB_VERSIONS; i++)
-      {
-	if (!strcasecmp (win_versions[i].szVersion, winver))
-	{
-	  SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, (WPARAM) (i + 1), 0);
-	  WINE_TRACE("match with %s\n", win_versions[i].szVersion);
+        if (current_app) /* no explicit setting */
+        {
+            WINE_TRACE("setting winver combobox to default\n");
+            SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, 0, 0);
+            return;
+        }
+        winver = strdupA("win2k");
+    }
+    WINE_TRACE("winver is %s\n", winver);
+
+    /* normalize the version strings */
+    for (i = 0; i < NB_VERSIONS; i++)
+    {
+        if (!strcasecmp (win_versions[i].szVersion, winver))
+        {
+            SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL,
+                                (WPARAM) i + (current_app?1:0), 0);
+            WINE_TRACE("match with %s\n", win_versions[i].szVersion);
+            break;
 	}
-      }
-  }
-  else /* no explicit setting */
-  {
-    WINE_TRACE("setting winver combobox to automatic/default\n");
-    SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, 0, 0);
-  }
+    }
 
-  HeapFree(GetProcessHeap(), 0, winver);
+    HeapFree(GetProcessHeap(), 0, winver);
 }
 
 static void
 init_comboboxes (HWND dialog)
 {
-  int i;
+    int i;
 
-  SendDlgItemMessage(dialog, IDC_WINVER, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage(dialog, IDC_WINVER, CB_RESETCONTENT, 0, 0);
 
-  /* add the default entries (automatic) which correspond to no setting  */
-  if (current_app)
-  {
-      SendDlgItemMessage(dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM) "Use global settings");
-  }
-  else
-  {
-      SendDlgItemMessage(dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM) "Automatically detect required version");
-  }
+    /* add the default entries (automatic) which correspond to no setting  */
+    if (current_app)
+        SendDlgItemMessage(dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM) "Use global settings");
 
     for (i = 0; i < NB_VERSIONS; i++)
     {
@@ -313,18 +312,18 @@ static void on_winver_change(HWND dialog
 {
     int selection = SendDlgItemMessage(dialog, IDC_WINVER, CB_GETCURSEL, 0, 0);
 
-    if (selection == 0)
+    if (!selection && current_app)
     {
-        WINE_TRACE("automatic/default selected so removing current setting\n");
+        WINE_TRACE("default selected so removing current setting\n");
         set_reg_key(config_key, keypath(""), "Version", NULL);
     }
     else
     {
-        WINE_TRACE("setting Version key to value '%s'\n", win_versions[selection - 1].szVersion);
-        set_reg_key(config_key, keypath(""), "Version", win_versions[selection - 1].szVersion);
+        WINE_TRACE("setting Version key to value '%s'\n", win_versions[selection - (current_app?1:0)].szVersion);
+        set_reg_key(config_key, keypath(""), "Version", win_versions[selection - (current_app?1:0)].szVersion);
     }
     /* global version only */
-    if (!current_app && selection != 0)
+    if (!current_app)
     {
         static const char szKey9x[] = "Software\\Microsoft\\Windows\\CurrentVersion";
         static const char szKeyNT[] = "Software\\Microsoft\\Windows NT\\CurrentVersion";
@@ -332,13 +331,13 @@ static void on_winver_change(HWND dialog
         static const char szKeyWindNT[] = "System\\CurrentControlSet\\Control\\Windows";
         char Buffer[40];
 
-        switch (win_versions[selection-1].dwPlatformId)
+        switch (win_versions[selection].dwPlatformId)
         {
         case VER_PLATFORM_WIN32_WINDOWS:
-            snprintf(Buffer, sizeof(Buffer), "%ld.%ld.%ld", win_versions[selection-1].dwMajorVersion,
-                     win_versions[selection-1].dwMinorVersion, win_versions[selection-1].dwBuildNumber);
+            snprintf(Buffer, sizeof(Buffer), "%ld.%ld.%ld", win_versions[selection].dwMajorVersion,
+                     win_versions[selection].dwMinorVersion, win_versions[selection].dwBuildNumber);
             set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "VersionNumber", Buffer);
-            set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "SubVersionNumber", win_versions[selection-1].szCSDVersion);
+            set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "SubVersionNumber", win_versions[selection].szCSDVersion);
 
             set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CSDVersion", NULL);
             set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentVersion", NULL);
@@ -348,16 +347,16 @@ static void on_winver_change(HWND dialog
             break;
 
         case VER_PLATFORM_WIN32_NT:
-            snprintf(Buffer, sizeof(Buffer), "%ld.%ld", win_versions[selection-1].dwMajorVersion,
-                     win_versions[selection-1].dwMinorVersion);
+            snprintf(Buffer, sizeof(Buffer), "%ld.%ld", win_versions[selection].dwMajorVersion,
+                     win_versions[selection].dwMinorVersion);
             set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentVersion", Buffer);
-            set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CSDVersion", win_versions[selection-1].szCSDVersion);
-            snprintf(Buffer, sizeof(Buffer), "%ld", win_versions[selection-1].dwBuildNumber);
+            set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CSDVersion", win_versions[selection].szCSDVersion);
+            snprintf(Buffer, sizeof(Buffer), "%ld", win_versions[selection].dwBuildNumber);
             set_reg_key(HKEY_LOCAL_MACHINE, szKeyNT, "CurrentBuildNumber", Buffer);
-            set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, "ProductType", win_versions[selection-1].szProductType);
+            set_reg_key(HKEY_LOCAL_MACHINE, szKeyProdNT, "ProductType", win_versions[selection].szProductType);
             set_reg_key_dword(HKEY_LOCAL_MACHINE, szKeyWindNT, "CSDVersion",
-                              MAKEWORD( win_versions[selection-1].wServicePackMinor,
-                                        win_versions[selection-1].wServicePackMajor ));
+                              MAKEWORD( win_versions[selection].wServicePackMinor,
+                                        win_versions[selection].wServicePackMajor ));
 
             set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "VersionNumber", NULL);
             set_reg_key(HKEY_LOCAL_MACHINE, szKey9x, "SubVersionNumber", NULL);


More information about the wine-patches mailing list