wineboot: Create serial comm registry keys

André Hentschel nerv at dawncrow.de
Thu Feb 11 17:32:54 CST 2016


Signed-off-by: André Hentschel <nerv at dawncrow.de>
---

For https://bugs.winehq.org/show_bug.cgi?id=11811


 programs/wineboot/wineboot.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index ee5b8d4..c0620e7 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -274,6 +274,44 @@ static void create_hardware_registry_keys(void)
     HeapFree( GetProcessHeap(), 0, power_info );
 }
 
+static void create_serial_registry_keys(void)
+{
+    static const WCHAR SerialCommW[] = {'H','a','r','d','w','a','r','e','\\',
+                                        'D','e','v','i','c','e','m','a','p','\\',
+                                        'S','e','r','i','a','l','C','o','m','m',0};
+    static const WCHAR ComDescW[] = {'C','O','M','%','d',0};
+    const char *config_dir = wine_get_config_dir();
+    char *path;
+    HKEY key;
+    int i;
+
+    if (RegCreateKeyExW( HKEY_LOCAL_MACHINE, SerialCommW, 0, NULL, REG_OPTION_VOLATILE,
+                         KEY_ALL_ACCESS, NULL, &key, NULL ))
+        return;
+
+    if (!(path = HeapAlloc( GetProcessHeap(), 0, strlen(config_dir) + strlen("/dosdevices/") + 5 )))
+    {
+        RegCloseKey( key );
+        return;
+    }
+
+    for (i = 1; i <= 9; i++)
+    {
+        WCHAR comW[5 /* com + single number + \0 */];
+
+        sprintf( path, "%s/dosdevices/com%d", config_dir, i );
+        sprintfW( comW, ComDescW, i );
+
+        if (access( path, R_OK | W_OK ))
+            RegDeleteValueW( key, comW );
+        else
+            set_reg_value( key, comW, comW );
+    }
+
+    HeapFree( GetProcessHeap(), 0, path );
+    RegCloseKey( key );
+}
+
 
 /* create the DynData registry keys */
 static void create_dynamic_registry_keys(void)
@@ -1233,6 +1271,7 @@ int main( int argc, char *argv[] )
     create_hardware_registry_keys();
     create_dynamic_registry_keys();
     create_environment_registry_keys();
+    create_serial_registry_keys();
     wininit();
     pendingRename();
 
-- 
1.9.1




More information about the wine-patches mailing list