diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2010-03-25 20:49:48 +0800 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2010-03-25 20:51:07 +0800 |
commit | 2fabf227bb51ea8eefdb56760103f5b338ba1200 (patch) | |
tree | 714fc993f471a867bbe65ba282c7d8aaac5a89f1 | |
parent | 0ba5b9bca48eb476f3ffd9035ad0e7716578be2b (diff) | |
download | gsoc2013-evolution-2fabf227bb51ea8eefdb56760103f5b338ba1200.tar.gz gsoc2013-evolution-2fabf227bb51ea8eefdb56760103f5b338ba1200.tar.zst gsoc2013-evolution-2fabf227bb51ea8eefdb56760103f5b338ba1200.zip |
[win32] Generate UUID on the fly in Windows SENS module
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | modules/windows-sens/evolution-windows-sens.cxx | 21 |
2 files changed, 16 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index cec9257d23..86ac1b4621 100644 --- a/configure.ac +++ b/configure.ac @@ -1154,10 +1154,10 @@ AC_MSG_CHECKING([if Windows SENS support is enabled]) AC_MSG_RESULT([$enable_sens]) if test "$enable_sens" = yes; then AC_PROG_CXX - AC_CHECK_HEADERS([eventsys.h sensevts.h],[ enable_sens="yes" ],[ enable_sens="no" ]) + AC_CHECK_HEADERS([eventsys.h sensevts.h rpc.h],[ enable_sens="yes" ],[ enable_sens="no" ]) fi if test "$enable_sens" = yes; then - SENS_LIBS="-lole32 -loleaut32 -luuid" + SENS_LIBS="-lole32 -loleaut32 -luuid -lrpcrt4" AC_SUBST(HAVE_SENS) AC_SUBST(SENS_LIBS) fi diff --git a/modules/windows-sens/evolution-windows-sens.cxx b/modules/windows-sens/evolution-windows-sens.cxx index b43e69d25c..848c893365 100644 --- a/modules/windows-sens/evolution-windows-sens.cxx +++ b/modules/windows-sens/evolution-windows-sens.cxx @@ -24,9 +24,9 @@ extern "C" { #include <windows.h> #include <eventsys.h> #include <sensevts.h> +#include <rpc.h> #include <stdio.h> - #include <shell/e-shell.h> #include <e-util/e-extension.h> @@ -194,8 +194,6 @@ windows_sens_constructed (GObject *object) static const char* eventclassid="{D5978620-5B9F-11D1-8DD2-00AA004ABD5E}"; static const char* methods[]={"ConnectionMade","ConnectionMadeNoQOCInfo","ConnectionLost","DestinationReachable","DestinationReachableNoQOCInfo"}; static const char* names[]={"EWS_ConnectionMade","EWS_ConnectionMadeNoQOCInfo","EWS_ConnectionLost","EWS_DestinationReachable","EWS_DestinationReachableNoQOCInfo"}; - static const char* subids[]={"{cd1dcbd6-a14d-4823-a0d2-8473afde360f}","{a82f0e80-1305-400c-ba56-375ae04264a1}","{45233130-b6c3-44fb-a6af-487c47cee611}", - "{51377df7-1d29-49eb-af32-4fff77b059fb}","{d16830d3-7a3a-4240-994b-a1fa344385dd}"}; EWindowsSENS *extension = (E_WINDOWS_SENS (object)); static SensNetwork_Listener *pISensNetwork = new SensNetwork_Listener (extension); @@ -211,15 +209,22 @@ windows_sens_constructed (GObject *object) res=CoCreateInstance (CLSID_CEventSubscription, 0, CLSCTX_SERVER, IID_IEventSubscription, (LPVOID*)&pIEventSubscription); if (res == S_OK && pIEventSubscription) { - if ((res=pIEventSubscription->put_EventClassID (_mb2wchar (eventclassid)))) + unsigned char *subid; + UUID tmp_uuid; + UuidCreate(&tmp_uuid); + UuidToString(&tmp_uuid, &subid); + if ((res=pIEventSubscription->put_SubscriptionID (_mb2wchar ((char*)subid)))) { + RpcStringFree(&subid); break; - if ((res=pIEventSubscription->put_SubscriberInterface ((IUnknown*)pISensNetwork))) + } + RpcStringFree(&subid); + if ((res=pIEventSubscription->put_SubscriptionName (_mb2wchar (names[i])))) break; if ((res=pIEventSubscription->put_MethodName (_mb2wchar (methods[i])))) break; - if ((res=pIEventSubscription->put_SubscriptionName (_mb2wchar (names[i])))) + if ((res=pIEventSubscription->put_EventClassID (_mb2wchar (eventclassid)))) break; - if ((res=pIEventSubscription->put_SubscriptionID (_mb2wchar (subids[i])))) + if ((res=pIEventSubscription->put_SubscriberInterface ((IUnknown*)pISensNetwork))) break; /* Make the subscription receive the event only if the owner of the subscription * is logged on to the same computer as the publisher. This makes this module @@ -234,6 +239,8 @@ windows_sens_constructed (GObject *object) pIEventSubscription=0; } } + if (pIEventSubscription) + pIEventSubscription->Release(); } /* Do not try to get initial state when we are sure we will not get system events. |