Nikolay Sivov : services: Mark WOW64 services in registry.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 27 08:00:16 CST 2015


Module: wine
Branch: master
Commit: 1896064332f785a69f665d02e220d5878ead5bf8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1896064332f785a69f665d02e220d5878ead5bf8

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Feb 27 01:30:54 2015 +0300

services: Mark WOW64 services in registry.

---

 programs/services/rpc.c      |  1 +
 programs/services/services.c | 15 +++++++++++++--
 programs/services/services.h |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/programs/services/rpc.c b/programs/services/rpc.c
index 43eb3cd..9ecc09c 100644
--- a/programs/services/rpc.c
+++ b/programs/services/rpc.c
@@ -510,6 +510,7 @@ static DWORD create_serviceW(
     }
 
     entry->ref_count = 1;
+    entry->is_wow64 = is_wow64;
     entry->config.dwServiceType = entry->status.dwServiceType = dwServiceType;
     entry->config.dwStartType = dwStartType;
     entry->config.dwErrorControl = dwErrorControl;
diff --git a/programs/services/services.c b/programs/services/services.c
index 54d9e89..dd79770 100644
--- a/programs/services/services.c
+++ b/programs/services/services.c
@@ -66,7 +66,7 @@ static const WCHAR SZ_OBJECT_NAME[]       = {'O','b','j','e','c','t','N','a','m'
 static const WCHAR SZ_TAG[]               = {'T','a','g',0};
 static const WCHAR SZ_DESCRIPTION[]       = {'D','e','s','c','r','i','p','t','i','o','n',0};
 static const WCHAR SZ_PRESHUTDOWN[]       = {'P','r','e','s','h','u','t','d','o','w','n','T','i','m','e','o','u','t',0};
-
+static const WCHAR SZ_WOW64[]             = {'W','O','W','6','4',0};
 
 DWORD service_create(LPCWSTR name, struct service_entry **entry)
 {
@@ -108,7 +108,7 @@ void free_service_entry(struct service_entry *entry)
 
 static DWORD load_service_config(HKEY hKey, struct service_entry *entry)
 {
-    DWORD err;
+    DWORD err, value = 0;
     WCHAR *wptr;
 
     if ((err = load_reg_string(hKey, SZ_IMAGE_PATH,   TRUE, &entry->config.lpBinaryPathName)) != 0)
@@ -137,6 +137,9 @@ static DWORD load_service_config(HKEY hKey, struct service_entry *entry)
     if ((err = load_reg_dword(hKey, SZ_PRESHUTDOWN, &entry->preshutdown_timeout)) != 0)
         return err;
 
+    if (load_reg_dword(hKey, SZ_WOW64, &value) == 0 && value == 1)
+        entry->is_wow64 = TRUE;
+
     WINE_TRACE("Image path           = %s\n", wine_dbgstr_w(entry->config.lpBinaryPathName) );
     WINE_TRACE("Group                = %s\n", wine_dbgstr_w(entry->config.lpLoadOrderGroup) );
     WINE_TRACE("Service account name = %s\n", wine_dbgstr_w(entry->config.lpServiceStartName) );
@@ -216,6 +219,14 @@ DWORD save_service_config(struct service_entry *entry)
         goto cleanup;
     if ((err = RegSetValueExW(hKey, SZ_PRESHUTDOWN, 0, REG_DWORD, (LPBYTE)&entry->preshutdown_timeout, sizeof(DWORD))) != 0)
         goto cleanup;
+    if ((err = RegSetValueExW(hKey, SZ_PRESHUTDOWN, 0, REG_DWORD, (LPBYTE)&entry->preshutdown_timeout, sizeof(DWORD))) != 0)
+        goto cleanup;
+    if (entry->is_wow64)
+    {
+        const DWORD is_wow64 = 1;
+        if ((err = RegSetValueExW(hKey, SZ_WOW64, 0, REG_DWORD, (LPBYTE)&is_wow64, sizeof(DWORD))) != 0)
+            goto cleanup;
+    }
 
     if (entry->config.dwTagId)
         err = RegSetValueExW(hKey, SZ_TAG, 0, REG_DWORD, (LPBYTE)&entry->config.dwTagId, sizeof(DWORD));
diff --git a/programs/services/services.h b/programs/services/services.h
index 88a84ad..9090542 100644
--- a/programs/services/services.h
+++ b/programs/services/services.h
@@ -49,6 +49,7 @@ struct service_entry
     HANDLE overlapped_event;
     HANDLE status_changed_event;
     BOOL marked_for_delete;
+    BOOL is_wow64;
 };
 
 extern struct scmdatabase *active_database;




More information about the wine-cvs mailing list