-CoreExport DIR * opendir(const char * path);
-CoreExport dirent * readdir(DIR * handle);
-CoreExport void closedir(DIR * handle);
-
-CoreExport int gettimeofday(struct timeval * tv, void * tz);
-
-/* Disable these stupid warnings.. */
-#pragma warning(disable:4800)
-#pragma warning(disable:4251)
-#pragma warning(disable:4275)
-#pragma warning(disable:4244) // warning C4244: '=' : conversion from 'long' to 'short', possible loss of data
-#pragma warning(disable:4267) // warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
-#pragma warning(disable:4805) // warning C4805: '!=' : unsafe mix of type 'char' and type 'bool' in operation
-#pragma warning(disable:4311) // warning C4311: 'type cast' : pointer truncation from 'accept_overlap *' to 'int'
-#pragma warning(disable:4312) // warning C4312: 'type cast' : conversion from 'int' to 'HANDLE' of greater size
-#pragma warning(disable:4355) // warning C4355: 'this' : used in base member initializer list
-#pragma warning(disable:4996) // warning C4996: 'std::_Traits_helper::move_s' was declared deprecated
-#pragma warning(disable:4706) // warning C4706: assignment within conditional expression
-#pragma warning(disable:4201) // mmsystem.h generates this warning
-
-/* Mehhhh... typedefs. */
-
-typedef unsigned char uint8_t;
-typedef unsigned long long uint64_t;
-typedef signed char int8_t;
-typedef signed long int32_t;
-typedef signed long long int64_t;
-
-/* Shared memory allocation functions */
-void * ::operator new(size_t iSize);
-void ::operator delete(void * ptr);
-
-/* IPC Handlers */
-class InspIRCd;
-class ValueItem;
-class ServerConfig;
-
-/* Look up the nameserver in use from the registry on windows */
-CoreExport std::string FindNameServerWin();
-
-/* Clear a windows console */
-CoreExport void ClearConsole();
-
-CoreExport DWORD WindowsForkStart(InspIRCd* Instance);
-
-CoreExport void WindowsForkKillOwner(InspIRCd* Instance);
-
-CoreExport void ChangeWindowsSpecificPointers(InspIRCd* Instance);
-
-CoreExport bool ValidateWindowsDnsServer(ServerConfig* conf, const char* tag, const char* value, ValueItem &data);
-
-CoreExport bool initwmi();
-CoreExport void donewmi();
-CoreExport int getcpu();
-
-
-#endif
-
+inline ssize_t writev(int fd, const WindowsIOVec* iov, int count)
+{
+ DWORD sent;
+ int ret = WSASend(fd, reinterpret_cast<LPWSABUF>(const_cast<WindowsIOVec*>(iov)), count, &sent, 0, NULL, NULL);
+ if (ret == 0)
+ return sent;
+ return -1;
+}
+
+// This wrapper is just so we don't need to do #ifdef _WIN32 everywhere in the socket code. It is
+// not actually used and does not need to be the same size as sockaddr_un on UNIX systems.
+struct sockaddr_un
+{
+ ADDRESS_FAMILY sun_family;
+ char sun_path[6];
+};