[Wine-devel] Eter's patch is applied to winehq repo 04/03/13

builder-robot на etersoft.ru builder-robot на etersoft.ru
Ср Апр 3 20:21:50 MSK 2013


New Etersoft's patches since last build time:
commit a792a5b4867c7cdefb1de7da3ef87bea06b1b3de
Author: Alexander Morozov <amorozov на etersoft.ru>

    advapi32: Do not terminate a regular program if it calls StartServiceCtrlDispatcher.

commit da46ce10deeb8a327ad445ed86086dec33d16eae
Author: Sergey Guralnik <serhio на etersoft.ru>

    extrac32: Get default path only when it is really necessary.

commit 085c50683265b7482be2eb9b53d8367989ad3d2b
Author: Sergey Guralnik <serhio на etersoft.ru>

    extrac32: Extract by default when required files are specified.

commit 8c5deb56497494a66c8244bfdc40121d00103ec3
Author: Sergey Guralnik <serhio на etersoft.ru>

    extrac32: Allow leading '-' for command line switches.

commit a5ac00aaf422398a0bb6f47f815dd24eea10fc9e
Author: Sergey Guralnik <serhio на etersoft.ru>

    extrac32: Merge identical case statements.

---

commit a792a5b4867c7cdefb1de7da3ef87bea06b1b3de
Author: Alexander Morozov <amorozov на etersoft.ru>
Date:   Mon Apr 1 22:43:33 2013 +0400

    advapi32: Do not terminate a regular program if it calls StartServiceCtrlDispatcher.

diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index b591449..5f3f15f 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -75,6 +75,12 @@ typedef struct service_data_t
     WCHAR name[1];
 } service_data;
 
+typedef struct dispatcher_data_t
+{
+    SC_HANDLE manager;
+    HANDLE pipe;
+} dispatcher_data;
+
 static CRITICAL_SECTION service_cs;
 static CRITICAL_SECTION_DEBUG service_cs_debug =
 {
@@ -358,22 +364,7 @@ static DWORD service_handle_control(const service_data *service, DWORD dwControl
  */
 static DWORD WINAPI service_control_dispatcher(LPVOID arg)
 {
-    SC_HANDLE manager;
-    HANDLE pipe;
-
-    if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_CONNECT )))
-    {
-        ERR("failed to open service manager error %u\n", GetLastError());
-        return 0;
-    }
-
-    pipe = service_open_pipe();
-
-    if (pipe==INVALID_HANDLE_VALUE)
-    {
-        WARN("failed to create control pipe error = %d\n", GetLastError());
-        return 0;
-    }
+    dispatcher_data *disp = arg;
 
     /* dispatcher loop */
     while (1)
@@ -384,7 +375,7 @@ static DWORD WINAPI service_control_dispatcher(LPVOID arg)
         BOOL r;
         DWORD data_size = 0, count, result;
 
-        r = ReadFile( pipe, &info, FIELD_OFFSET(service_start_info,data), &count, NULL );
+        r = ReadFile( disp->pipe, &info, FIELD_OFFSET(service_start_info,data), &count, NULL );
         if (!r)
         {
             if (GetLastError() != ERROR_BROKEN_PIPE)
@@ -400,7 +391,7 @@ static DWORD WINAPI service_control_dispatcher(LPVOID arg)
         {
             data_size = info.total_size - FIELD_OFFSET(service_start_info,data);
             data = HeapAlloc( GetProcessHeap(), 0, data_size );
-            r = ReadFile( pipe, data, data_size, &count, NULL );
+            r = ReadFile( disp->pipe, data, data_size, &count, NULL );
             if (!r)
             {
                 if (GetLastError() != ERROR_BROKEN_PIPE)
@@ -433,8 +424,9 @@ static DWORD WINAPI service_control_dispatcher(LPVOID arg)
         case WINESERV_STARTINFO:
             if (!service->handle)
             {
-                if (!(service->handle = OpenServiceW( manager, data, SERVICE_SET_STATUS )) ||
-                    !(service->full_access_handle = OpenServiceW( manager, data, GENERIC_READ|GENERIC_WRITE )))
+                if (!(service->handle = OpenServiceW( disp->manager, data, SERVICE_SET_STATUS )) ||
+                    !(service->full_access_handle = OpenServiceW( disp->manager, data,
+                            GENERIC_READ|GENERIC_WRITE )))
                     FIXME( "failed to open service %s\n", debugstr_w(data) );
             }
             result = service_handle_start(service, data, data_size / sizeof(WCHAR));
@@ -449,12 +441,13 @@ static DWORD WINAPI service_control_dispatcher(LPVOID arg)
         }
 
     done:
-        WriteFile(pipe, &result, sizeof(result), &count, NULL);
+        WriteFile( disp->pipe, &result, sizeof(result), &count, NULL );
         HeapFree( GetProcessHeap(), 0, data );
     }
 
-    CloseHandle(pipe);
-    CloseServiceHandle( manager );
+    CloseHandle( disp->pipe );
+    CloseServiceHandle( disp->manager );
+    HeapFree( GetProcessHeap(), 0, disp );
     return 1;
 }
 
@@ -466,13 +459,32 @@ static BOOL service_run_main_thread(void)
     DWORD i, n, ret;
     HANDLE wait_handles[MAXIMUM_WAIT_OBJECTS];
     UINT wait_services[MAXIMUM_WAIT_OBJECTS];
+    dispatcher_data *disp = HeapAlloc( GetProcessHeap(), 0, sizeof(*disp) );
+
+    disp->manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_CONNECT );
+    if (!disp->manager)
+    {
+        ERR("failed to open service manager error %u\n", GetLastError());
+        HeapFree( GetProcessHeap(), 0, disp );
+        return FALSE;
+    }
+
+    disp->pipe = service_open_pipe();
+    if (disp->pipe == INVALID_HANDLE_VALUE)
+    {
+        WARN("failed to create control pipe error %u\n", GetLastError());
+        CloseServiceHandle( disp->manager );
+        HeapFree( GetProcessHeap(), 0, disp );
+        SetLastError( ERROR_FAILED_SERVICE_CONTROLLER_CONNECT );
+        return FALSE;
+    }
 
     service_event = CreateEventW( NULL, FALSE, FALSE, NULL );
     stop_event = CreateEventW( NULL, FALSE, FALSE, NULL );
 
     /* FIXME: service_control_dispatcher should be merged into the main thread */
     wait_handles[0] = __wine_make_process_system();
-    wait_handles[1] = CreateThread( NULL, 0, service_control_dispatcher, NULL, 0, NULL );
+    wait_handles[1] = CreateThread( NULL, 0, service_control_dispatcher, disp, 0, NULL );
     wait_handles[2] = service_event;
     wait_handles[3] = stop_event;
 
@@ -563,7 +575,6 @@ BOOL WINAPI StartServiceCtrlDispatcherA( const SERVICE_TABLE_ENTRYA *servent )
 {
     service_data *info;
     unsigned int i;
-    BOOL ret = TRUE;
 
     TRACE("%p\n", servent);
 
@@ -592,9 +603,7 @@ BOOL WINAPI StartServiceCtrlDispatcherA( const SERVICE_TABLE_ENTRYA *servent )
         services[i] = info;
     }
 
-    service_run_main_thread();
-
-    return ret;
+    return service_run_main_thread();
 }
 
 /******************************************************************************
@@ -614,7 +623,6 @@ BOOL WINAPI StartServiceCtrlDispatcherW( const SERVICE_TABLE_ENTRYW *servent )
 {
     service_data *info;
     unsigned int i;
-    BOOL ret = TRUE;
 
     TRACE("%p\n", servent);
 
@@ -643,9 +651,7 @@ BOOL WINAPI StartServiceCtrlDispatcherW( const SERVICE_TABLE_ENTRYW *servent )
         services[i] = info;
     }
 
-    service_run_main_thread();
-
-    return ret;
+    return service_run_main_thread();
 }
 
 /******************************************************************************

commit da46ce10deeb8a327ad445ed86086dec33d16eae
Author: Sergey Guralnik <serhio на etersoft.ru>
Date:   Sat Mar 30 07:27:44 2013 +0200

    extrac32: Get default path only when it is really necessary.

diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c
index 5216627..addd732 100644
--- a/programs/extrac32/extrac32.c
+++ b/programs/extrac32/extrac32.c
@@ -153,7 +153,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
         /* Use extraction by default if names of required files presents */
         cmd = i < argc ? 'E' : 'D';
 
-    if (!path[0])
+    if (cmd == 'E' && !path[0])
         GetCurrentDirectoryW(MAX_PATH, path);
 
     lstrcatW(path, backslash);

commit 085c50683265b7482be2eb9b53d8367989ad3d2b
Author: Sergey Guralnik <serhio на etersoft.ru>
Date:   Sat Mar 30 07:22:41 2013 +0200

    extrac32: Extract by default when required files are specified.

diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c
index ade7456..5216627 100644
--- a/programs/extrac32/extrac32.c
+++ b/programs/extrac32/extrac32.c
@@ -149,6 +149,9 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
         if (!GetFullPathNameW(argv[i], MAX_PATH, path, NULL))
             return 0;
     }
+    else if (!cmd)
+        /* Use extraction by default if names of required files presents */
+        cmd = i < argc ? 'E' : 'D';
 
     if (!path[0])
         GetCurrentDirectoryW(MAX_PATH, path);
@@ -166,7 +169,6 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
             /* Extract CAB archive */
             extract(cabfile, path);
             break;
-        case 0:
         case 'D':
             /* Display CAB archive */
             WINE_FIXME("/D not implemented\n");

commit 8c5deb56497494a66c8244bfdc40121d00103ec3
Author: Sergey Guralnik <serhio на etersoft.ru>
Date:   Sat Mar 30 07:12:47 2013 +0200

    extrac32: Allow leading '-' for command line switches.

diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c
index 11dd755..ade7456 100644
--- a/programs/extrac32/extrac32.c
+++ b/programs/extrac32/extrac32.c
@@ -105,7 +105,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
     for(i = 0; i < argc; i++)
     {
         /* Get cabfile */
-        if (argv[i][0] != '/')
+        if (argv[i][0] != '/' && argv[i][0] != '-')
         {
             if (!cabfile)
             {

commit a5ac00aaf422398a0bb6f47f815dd24eea10fc9e
Author: Sergey Guralnik <serhio на etersoft.ru>
Date:   Sat Mar 30 07:04:42 2013 +0200

    extrac32: Merge identical case statements.

diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c
index fc1ae1c..11dd755 100644
--- a/programs/extrac32/extrac32.c
+++ b/programs/extrac32/extrac32.c
@@ -130,9 +130,6 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
                     return 0;
                 break;
             case 'C':
-                if (cmd) return 0;
-                cmd = check;
-                break;
             case 'E':
             case 'D':
                 if (cmd) return 0;


Подробная информация о списке рассылки Wine-devel