Windows: use system CreateUuid instead of afs variant
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 10 May 2010 00:49:05 +0000 (20:49 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Wed, 12 May 2010 05:24:15 +0000 (22:24 -0700)
The afs_create_uuid function on Windows results in
duplicate uuids being produced.  Windows provides its own
CreateUuid function.  Use it when afs_create_uuid is called.

Change-Id: Id7f14b13c003fb845d90b09c3ca40cf258a53dbc
Reviewed-on: http://gerrit.openafs.org/1937
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/NTMakefile
src/util/NTMakefile
src/util/uuid.c

index 77c242f..2d4dbc3 100644 (file)
@@ -214,7 +214,7 @@ CONF_DLLLIBS = \
     $(DESTDIR)\lib\afs\afsreg.lib
 
 $(CONF_DLLFILE): $(CONFOBJS) $(OUT)\libafsconf.res $(CONF_DLLLIBS)
-       $(DLLGUILINK) -def:libafsconf.def dnsapi.lib mpr.lib shell32.lib
+       $(DLLGUILINK) -def:libafsconf.def dnsapi.lib mpr.lib shell32.lib Rpcrt4.lib
         $(_VC_MANIFEST_EMBED_DLL)
        $(DLLPREP)
         $(CODESIGN_USERLAND)
index 9e705bc..3f463da 100644 (file)
@@ -107,7 +107,7 @@ $(LIBFILE): $(LIBOBJS)
        $(LIBARCH)
 
 $(MT_LIBFILE): $(MT_LIBOBJS)
-       $(LIBARCH)
+       $(LIBARCH) Rpcrt4.lib
 
 install_headers: $(INCFILES) 
 
index 6238c9c..fc29af4 100644 (file)
@@ -60,6 +60,7 @@
 #include <errno.h>
 #include <string.h>
 #ifdef AFS_NT40_ENV
+#include <rpc.h>
 #include <winsock2.h>
 #include <process.h>
 #else
@@ -243,6 +244,9 @@ afsUUID_to_string(const afsUUID * uuid, char *str, size_t strsz)
 afs_int32
 afs_uuid_create(afsUUID * uuid)
 {
+#ifdef AFS_NT40_ENV
+    UuidCreate((UUID *) uuid);
+#else /* AFS_NT40_ENV */
     uuid_address_t eaddr;
     afs_int32 got_no_time = 0, code;
 
@@ -333,6 +337,7 @@ afs_uuid_create(afsUUID * uuid)
     uuid->clock_seq_hi_and_reserved = (clock_seq & 0x3f00) >> 8;
     uuid->clock_seq_hi_and_reserved |= 0x80;
     uuid_memcpy((void *)uuid->node, (void *)&eaddr, sizeof(uuid_address_t));
+#endif /* AFS_NT40_ENV */
     return 0;
 }