#include <errno.h>
#include <string.h>
#ifdef AFS_NT40_ENV
+#include <rpc.h>
#include <winsock2.h>
#include <process.h>
#else
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;
if (!uuid_init_done) {
- union {
- uuid_time_t t;
- u_short seed[4];
- } uuid_time;
- u_short seed = 0;
+ uuid_time_t t;
+ u_short seedp[4], seed = 0;
rand_m = 971;;
rand_ia = 11113;
rand_ib = 104322;
* independent. Then for good measure to ensure a unique seed when there
* are multiple processes creating UUID's on a system, we add in the PID.
*/
- uuid__get_os_time(&uuid_time.t);
- seed ^= uuid_time.seed[0];
- seed ^= uuid_time.seed[1];
- seed ^= uuid_time.seed[2];
- seed ^= uuid_time.seed[3];
+ uuid__get_os_time(&t);
+ memcpy(&seedp, &t, sizeof(seedp));
+ seed ^= seedp[0];
+ seed ^= seedp[1];
+ seed ^= seedp[2];
+ seed ^= seedp[3];
#if defined(KERNEL) && defined(AFS_XBSD_ENV)
rand_irand += seed + (afs_uint32) curproc->p_pid;
#elif defined(UKERNEL)
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;
}