[Wine-patches] [eter-1.0.12] [eterhack] kernel32: Show warning about too long host name (eterbug #7316).

Alexander Morozov amorozov на etersoft.ru
Чт Авг 18 18:31:03 MSD 2011


----------- следующая часть -----------
From 4f3781b286f6378087187e9ad5ed49328d8b1fe4 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Thu, 18 Aug 2011 18:22:14 +0400
Subject: [PATCH] kernel32: Show warning about too long host name (eterbug
 #7316).

---
 dlls/kernel32/computername.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/computername.c b/dlls/kernel32/computername.c
index af20387..fb60db6 100644
--- a/dlls/kernel32/computername.c
+++ b/dlls/kernel32/computername.c
@@ -43,6 +43,7 @@
 #include "winternl.h"
 #include "wine/unicode.h"
 #include "wine/exception.h"
+#include "wine/svcctl.h"
 #include "wine/debug.h"
 
 #include "kernel_private.h"
@@ -227,6 +228,34 @@ static BOOL get_use_dns_option(void)
     return ret;
 }
 
+/***********************************************************************
+ *           show_longhostname_warn
+ */
+static void show_longhostname_warn(void)
+{
+    static const WCHAR longhostnameMutexW[] = {'_','_','w','i','n','e','_',
+                                               'l','o','n','g','h','o','s','t','n','a','m','e',0};
+    static const WCHAR svcctl_started_event[] = SVCCTL_STARTED_EVENT;
+    HANDLE event = CreateEventW( NULL, TRUE, FALSE, svcctl_started_event );
+    DWORD ret;
+
+    if (!event)
+        return;
+    ret = WaitForSingleObject( event, 0 );
+    if (ret == WAIT_OBJECT_0)
+    {
+        HANDLE mutex = CreateMutexW( NULL, TRUE, longhostnameMutexW );
+        if (mutex)
+        {
+            if (GetLastError() != ERROR_ALREADY_EXISTS)
+                system( "eterx11msg -longhostname" );
+            else
+                CloseHandle( mutex );
+        }
+    }
+    CloseHandle(event);
+}
+
 
 /*********************************************************************** 
  *                      COMPUTERNAME_Init    (INTERNAL)
@@ -279,6 +308,8 @@ void COMPUTERNAME_Init (void)
                     strcat(hbuf,"-");
                     strcat(hbuf, user);
                 }
+                else
+                    show_longhostname_warn();
             }
         }
 
-- 
1.7.6



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