[gupnp: 3/5] Use Windows's built-in UUID generator
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp: 3/5] Use Windows's built-in UUID generator
- Date: Sat, 27 Oct 2012 13:19:56 +0000 (UTC)
commit cbb75b7d55f293d1d943d1cec632a712dca4f998
Author: Jens Georg <mail jensge org>
Date: Thu Aug 19 23:40:53 2010 +0300
Use Windows's built-in UUID generator
configure.ac | 2 ++
libgupnp/gupnp-service.c | 16 +++++++++++++++-
2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7ace3b7..1d0c8ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,8 @@ if test "x$os_win32" = "xno"; then
[--with-context-manager=@<:@network-manager/connman/unix/linux@:>@],
[Context Manager backend to use]),,
[with_context_manager="none"])
+else
+ LIBGUPNP_LIBS="$LIBGUPNP_LIBS -lrpcrt4"
fi
if test "x$with_context_manager" = "xnone"; then
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index e6aba2d..8c1709e 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -31,6 +31,7 @@
#include <gmodule.h>
#include <libsoup/soup-date.h>
#ifdef G_OS_WIN32
+#include <rpc.h>
#else
#include <uuid/uuid.h>
#endif
@@ -1081,7 +1082,20 @@ static char *
generate_sid (void)
{
#ifdef G_OS_WIN32
- return NULL;
+ char *ret = NULL;
+ UUID uuid;
+ RPC_STATUS stat;
+ stat = UuidCreate (&uuid);
+ if (stat == RPC_S_OK) {
+ unsigned char* uuidStr = NULL;
+ stat = UuidToString (&uuid, &uuidStr);
+ if (stat == RPC_S_OK) {
+ ret = g_strdup_printf ("uuid:%s", uuidStr);
+ RpcStringFree (&uuidStr);
+ }
+ }
+
+ return ret;
#else
uuid_t id;
char out[39];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]