win32 porting

Change-Id: I78cbe7f12d9ce61558f9115a37d7e15c0b0510a5
Reviewed-on: http://review.couchbase.org/30188
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>