From 0564f9aed4bdb5b80d9b13be2fe38d963234f06a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 30 May 2015 02:23:44 +0200
Subject: winecfg: Add checkbox to enable/disable HideWineExports registry key.

---
 programs/winecfg/resource.h |  1 +
 programs/winecfg/staging.c  | 22 ++++++++++++++++++++++
 programs/winecfg/winecfg.rc |  1 +
 3 files changed, 24 insertions(+)

diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 4f5a93e..57ebe9d 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -216,6 +216,7 @@
 #define IDC_ENABLE_CSMT                 9001
 #define IDC_ENABLE_VAAPI                9002
 #define IDC_ENABLE_EAX                  9003
+#define IDC_ENABLE_HIDEWINE             9004
 
 /* About tab */
 #define IDC_ABT_OWNER                8432
diff --git a/programs/winecfg/staging.c b/programs/winecfg/staging.c
index 5a4dd16..903ce7e 100644
--- a/programs/winecfg/staging.c
+++ b/programs/winecfg/staging.c
@@ -87,11 +87,29 @@ static void eax_set(BOOL status)
     set_reg_key(config_key, keypath("DirectSound"), "EAXEnabled", status ? "Y" : "N");
 }
 
+/*
+ * Hide Wine exports from applications
+ */
+static BOOL hidewine_get(void)
+{
+    BOOL ret;
+    char *value = get_reg_key(config_key, keypath(""), "HideWineExports", "N");
+    ret = IS_OPTION_TRUE(*value);
+    HeapFree(GetProcessHeap(), 0, value);
+    return ret;
+}
+static void hidewine_set(BOOL status)
+{
+    set_reg_key(config_key, keypath(""), "HideWineExports", status ? "Y" : "N");
+}
+
+
 static void load_staging_settings(HWND dialog)
 {
     CheckDlgButton(dialog, IDC_ENABLE_CSMT, csmt_get() ? BST_CHECKED : BST_UNCHECKED);
     CheckDlgButton(dialog, IDC_ENABLE_VAAPI, vaapi_get() ? BST_CHECKED : BST_UNCHECKED);
     CheckDlgButton(dialog, IDC_ENABLE_EAX, eax_get() ? BST_CHECKED : BST_UNCHECKED);
+    CheckDlgButton(dialog, IDC_ENABLE_HIDEWINE, hidewine_get() ? BST_CHECKED : BST_UNCHECKED);
 
 #ifndef HAVE_VAAPI
     disable(IDC_ENABLE_VAAPI);
@@ -133,6 +151,10 @@ INT_PTR CALLBACK StagingDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
             eax_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_EAX) == BST_CHECKED);
             SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
             return TRUE;
+        case IDC_ENABLE_HIDEWINE:
+            hidewine_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_HIDEWINE) == BST_CHECKED);
+            SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+            return TRUE;
         }
         break;
     }
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
index 0855074..c2d106c 100644
--- a/programs/winecfg/winecfg.rc
+++ b/programs/winecfg/winecfg.rc
@@ -318,6 +318,7 @@ BEGIN
     CONTROL     "Enable &CSMT for better graphic performance",IDC_ENABLE_CSMT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,40,230,8
     CONTROL     "Enable &VAAPI as backend for DXVA2 GPU decoding",IDC_ENABLE_VAAPI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,55,230,8
     CONTROL     "Enable Environmental Audio E&xtensions (EAX)",IDC_ENABLE_EAX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,230,8
+    CONTROL     "&Hide Wine version from applications",IDC_ENABLE_HIDEWINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,85,230,8
 END
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-- 
2.4.2

