diff -ur IceE-1.2.0/config/Make.rules.Linux IceE-1.2.0-hack/config/Make.rules.Linux --- IceE-1.2.0/config/Make.rules.Linux 2007-05-08 21:54:16.000000000 +0200 +++ IceE-1.2.0-hack/config/Make.rules.Linux 2008-12-08 10:19:56.000000000 +0100 @@ -111,19 +111,22 @@ # CXXLIBS = -mkshlib = $(CXX) -shared $(LDFLAGS) -o $(1) -Wl,-h,$(2) $(3) $(4) -lpthread +#mkshlib = $(CXX) -shared $(LDFLAGS) -o $(1) -Wl,-h,$(2) $(3) $(4) -lpthread +mkshlib = $(CXX) -shared $(LDFLAGS) -o $(1) -Wl,-h,$(2) $(3) $(4) -lws2_32 -lrpcdce4 -liphlpapi mklib = $(AR) cr $(1) $(2) -LDPLATFORMFLAGS = -Wl,--enable-new-dtags -Wl,-rpath,$(install_libdir) +#LDPLATFORMFLAGS = -Wl,--enable-new-dtags -Wl,-rpath,$(install_libdir) +LDPLATFORMFLAGS = -Wl,-rpath,$(install_libdir) -BASELIBS = $(STLPORT_LIBS) -lpthread +#BASELIBS = $(STLPORT_LIBS) -lpthread +BASELIBS = $(STLPORT_LIBS) LIBS = -lIceE $(BASELIBS) MINLIBS = -lIceEC $(BASELIBS) TESTLIBS = -lTestCommon $(LIBS) ICEUTIL_OS_LIBS = -ICE_OS_LIBS = -ldl +#ICE_OS_LIBS = -ldl PLATFORM_HAS_READLINE = yes diff -ur IceE-1.2.0/src/IceE/Acceptor.h IceE-1.2.0-hack/src/IceE/Acceptor.h --- IceE-1.2.0/src/IceE/Acceptor.h 2007-04-26 15:39:11.000000000 +0200 +++ IceE-1.2.0-hack/src/IceE/Acceptor.h 2008-12-08 10:07:09.000000000 +0100 @@ -20,7 +20,7 @@ #ifdef _WIN32 # include -typedef int ssize_t; +//typedef int ssize_t; #else # define SOCKET int # include // For struct sockaddr_in diff -ur IceE-1.2.0/src/IceE/Network.h IceE-1.2.0-hack/src/IceE/Network.h --- IceE-1.2.0/src/IceE/Network.h 2007-04-11 16:20:22.000000000 +0200 +++ IceE-1.2.0-hack/src/IceE/Network.h 2008-12-08 10:06:53.000000000 +0100 @@ -18,7 +18,7 @@ #ifdef _WIN32 # include -typedef int ssize_t; +//typedef int ssize_t; #else # include # include diff -ur IceE-1.2.0/src/IceE/Transceiver.h IceE-1.2.0-hack/src/IceE/Transceiver.h --- IceE-1.2.0/src/IceE/Transceiver.h 2007-04-26 15:39:11.000000000 +0200 +++ IceE-1.2.0-hack/src/IceE/Transceiver.h 2008-12-08 10:06:31.000000000 +0100 @@ -18,7 +18,7 @@ #ifdef _WIN32 # include -typedef int ssize_t; +//typedef int ssize_t; #else # define SOCKET int #endif diff -ur IceE-1.2.0/src/IceE/UUID.cpp IceE-1.2.0-hack/src/IceE/UUID.cpp --- IceE-1.2.0/src/IceE/UUID.cpp 2007-05-04 03:25:58.000000000 +0200 +++ IceE-1.2.0-hack/src/IceE/UUID.cpp 2008-12-08 10:55:05.000000000 +0100 @@ -158,21 +158,78 @@ } +int myUuidToString(UUID *Uuid, unsigned char** StringUuid) +{ + static UUID uuid_nil; + + *StringUuid = (unsigned char*)HeapAlloc( GetProcessHeap(), 0, sizeof(char) * 37); + + if(!(*StringUuid)) + return RPC_S_OUT_OF_MEMORY; + + if (!Uuid) Uuid = &uuid_nil; + + sprintf( (char*)*StringUuid, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + Uuid->Data1, Uuid->Data2, Uuid->Data3, + Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2], + Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5], + Uuid->Data4[6], Uuid->Data4[7] ); + +// return RPC_S_OK; + return 0; +} + + string IceUtil::generateUUID() { #if defined(_WIN32 ) && !defined(_WIN32_WCE) + static int first = 1; - UUID uuid; - UuidCreate(&uuid); + if (first) + { + srand(time(NULL)); + first = 0; + } + + struct hackUUID + { + unsigned char timeLow[4]; + unsigned char timeMid[2]; + unsigned char timeHighAndVersion[2]; + unsigned char clockSeqHiAndReserved; + unsigned char clockSeqLow; + unsigned char node[6]; + }; + hackUUID uuid; + char *ptr = (char*)&uuid; + + assert(sizeof(uuid) == 16); + + for (unsigned int i = 0; i < sizeof (uuid); i += 2) + { + int val = rand(); + + char byteval = val & 255; + memcpy(&ptr[2 * i], &byteval, 1); + + val >>= 8; + + byteval = val & 255; + memcpy(&ptr[2 * i] + 1, &byteval, 1); + } + +// UuidCreate(&uuid); unsigned char* str; - UuidToString(&uuid, &str); + myUuidToString((UUID*)&uuid, &str); string result = reinterpret_cast(str); - RpcStringFree(&str); +// RpcStringFree(&str); // Using my own hacked myUuidToString instead and thus free it with HeapFree(). + HeapFree(GetProcessHeap(), 0, str); + return result; #else @@ -224,7 +281,7 @@ IceUtil::StaticMutex::Lock lock(staticMutex); if(fd == -1) { - fd = open("/dev/urandom", O_RDONLY); + fd = _open("/dev/urandom", O_RDONLY); if (fd == -1) { assert(0); @@ -246,7 +303,7 @@ // while(reads <= 20 && index != sizeof(UUID)) { - ssize_t bytesRead = read(fd, buffer + index, sizeof(UUID) - index); + ssize_t bytesRead = _read(fd, buffer + index, sizeof(UUID) - index); if(bytesRead == -1 && errno != EINTR) {