diff --git a/.gitignore b/.gitignore index b0643fb..b20aa73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,10 @@ /src_win32_vc4/Debug /src_mfc_vc4/Debug +*.dll +*.exp +*.ilk +*.lib +*.pdb +*.pch +Debug/WSAWrapper.obj +Debug/vc40.idb diff --git a/WSAWrapper.cpp b/WSAWrapper.cpp new file mode 100644 index 0000000..1bef9ae --- /dev/null +++ b/WSAWrapper.cpp @@ -0,0 +1,379 @@ +// Copyright © 2023 Dmitry Tretyakov (aka. Tinelix) +// +// This program is free software: you can redistribute it and/or modify it under the terms of +// the GNU Lesser General Public License as published by the Free Software Foundation, either +// version 2.1 of the License, or (at your option) any later version. +// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License along with this +// program. If not, see https://www.gnu.org/licenses/. +// +// Source code: https://github.com/tinelix/WSAWrapper + + +#include +#include +#include +#include "WSAWrapper.h" + +#pragma comment(lib, "wsock32.lib"); + +SOCKET s; +int BUFFER_LENGTH = 4096; +char* recv_buff; +struct hostent *hostent; +char hostent_char[MAXGETHOSTSTRUCT]; +struct sockaddr_in addr; +char* g_address; +int g_port; +char debug_str[400]; +char ip_addr[40]; +BOOL is_win32s; +int error_code = 0; +BOOL debug; + +struct NetworkStatistics stats; + +int WINAPI DllMain(HINSTANCE hInst, DWORD fdReas, PVOID pvRes) { + switch(fdReas) { + case DLL_PROCESS_ATTACH: + error_code = 0; + // Checking if it's Win32s + if(GetVersion() & 0x80000000 && (GetVersion() & 0xFF) == 3) { + is_win32s = TRUE; + } else { + is_win32s = FALSE; + } + + debug = FALSE; + + if(!is_win32s) { + OutputDebugString("\r\nWinsock Wrapper - Win32 DLL implementation" + "\r\nCopyright © 2023 Dmitry Tretyakov (aka. Tinelix). Licensed under LGPLv2.1." + "\r\nSource code: https://github.com/tinelix/WSAWrapper\r\n"); + } + InitializeWinSock(); + break; + case DLL_PROCESS_DETACH: + CloseConnection(); + WSACleanup(); + if(!is_win32s) { + OutputDebugString("\r\nWinsock Wrapper is shutting down...\r\n"); + } + break; + } + + return TRUE; +} + +EXPORT void CALLBACK EnableDebugging(BOOL value) { + if(!is_win32s) { + debug = value; + if(debug == TRUE) { + sprintf(debug_str, "\r\n[WSAWrapper] Debug Enabled"); + OutputDebugString(debug_str); + } + } else { + MessageBox(NULL, "Direct DLL debugging is not possible in the current Windows version.", + "WSAWrapper", MB_ICONSTOP|MB_OK); + } +} + +EXPORT BOOL CALLBACK InitializeWinSock() { + WSADATA wsadata; + if(FAILED(WSAStartup(MAKEWORD(1,1), &wsadata))) { + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Winsock initialization " + "failed / Error Code: %d", WSAGetLastError()); + OutputDebugString(debug_str); + } + return FALSE; + } + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Winsock 1.1+ initialized."); + OutputDebugString(debug_str); + } + return TRUE; +} + +EXPORT BOOL CALLBACK EnableCustomAsyncMessages(HWND hWnd, int message, int nStatus) { + if(message != 0xAFFE) { + int WSAAsync = WSAAsyncSelect(s, hWnd, 0xAFFF, nStatus); + if(hWnd != NULL) { + if(WSAAsync > 0 && debug) { + error_code = WSAGetLastError(); + if(!is_win32s) { + sprintf(debug_str, "\r\n[WSAWrapper] Async Messages initialization " + "failed / Error code: %d", error_code); + OutputDebugString(debug_str); + } + return FALSE; + } + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Async Messages initialized."); + OutputDebugString(debug_str); + } + return TRUE; + } else { + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Async Messages initialization " + "failed / hWnd is NULL"); + OutputDebugString(debug_str); + } + return FALSE; + } + } else { + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Async Messages initialization " + "failed / Invalid message code"); + OutputDebugString(debug_str); + } + return FALSE; + } +} + +EXPORT BOOL CALLBACK EnableAsyncMessages(HWND hWnd) { + int WSAAsync = WSAAsyncSelect(s, hWnd, 0xAFFF, FD_READ); + if(hWnd != NULL) { + if(WSAAsync > 0) { + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Async Messages initialization " + "failed / Error Code: %d", WSAGetLastError()); + OutputDebugString(debug_str); + } + return EnableCustomAsyncMessages(hWnd, 0xE0001, FD_CLOSE); + } + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Async Messages initialized."); + OutputDebugString(debug_str); + } + return TRUE; + } else { + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Async Messages initialization " + "failed / hWnd is NULL"); + OutputDebugString(debug_str); + } + return FALSE; + } +} + +EXPORT int CALLBACK GetWSAError() { + return error_code; +} + +EXPORT BOOL CALLBACK CreateConnection(char* address, int port) { + error_code = 0; + + stats.packets_read = 0; + stats.packets_sent = 0; + stats.total_bytes_read = 0; + stats.total_bytes_sent = 0; + + g_address = address; + if(INVALID_SOCKET == (s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))) { + error_code = WSAGetLastError(); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Socket initialization failed / Error Code: %d", error_code); + OutputDebugString(debug_str); + } + return FALSE; + } + ZeroMemory(&addr, sizeof(addr)); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Searching IP Address of %s:%d...", address, port); + OutputDebugString(debug_str); + } + hostent = gethostbyname(address); + addr.sin_family = AF_INET; + if(hostent) { + addr.sin_addr.S_un.S_addr = + inet_addr((char*)inet_ntoa(**(in_addr**)hostent->h_addr_list)); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] IP Address Found: %s:%d -> %s:%d", address, port, + (char*)inet_ntoa(**(in_addr**)hostent->h_addr_list), port); + OutputDebugString(debug_str); + } + } else { + error_code = WSAGetLastError(); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] IP Search failed / Error Code: %d", error_code); + OutputDebugString(debug_str); + } + return FALSE; + } + addr.sin_port = htons(port); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Connecting to %s:%d...", address, port); + OutputDebugString(debug_str); + } + if(SOCKET_ERROR == (connect(s, (sockaddr*)&addr, sizeof(addr)))) { + error_code = WSAGetLastError(); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Connection failed / Error Code: %d", error_code); + OutputDebugString(debug_str); + } + return FALSE; + } + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Successfully connected!"); + OutputDebugString(debug_str); + } + error_code = 0; + return TRUE; +} + +EXPORT int CALLBACK CreateAsyncConnection( + char* address, int port, int part, int message, HWND hWnd + ) { + if(part == 0) { + g_address = address; + g_port = port; + PostMessage(hWnd, 0xAFFE, 0, 0); + if(INVALID_SOCKET == (s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))) { + error_code = WSAGetLastError(); + if(!is_win32s) { + sprintf(debug_str, "\r\n[WSAWrapper] Socket initialization failed / " + "Error Code: %d", error_code); + OutputDebugString(debug_str); + } + return 0; + } + ZeroMemory(&addr, sizeof(addr)); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Searching IP Address of %s:%d...", address, port); + OutputDebugString(debug_str); + } + WSAAsyncGetHostByName(hWnd, message, g_address, hostent_char, sizeof(hostent_char)); + return 2; + } else { + hostent = (struct hostent*)hostent_char; + addr.sin_family = AF_INET; + if(hostent) { + addr.sin_addr.S_un.S_addr = inet_addr((char*)inet_ntoa(**(in_addr**)hostent->h_addr_list)); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Redirecting: %s:%d -> %s:%d", g_address, g_port, + (char*)inet_ntoa(**(in_addr**)hostent->h_addr_list), g_port); + OutputDebugString(debug_str); + } + } else { + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] IP Search failed / Error Code: %d", WSAGetLastError()); + OutputDebugString(debug_str); + } + return 0; + } + addr.sin_port = htons(g_port); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Connecting to %s:%d...", g_address, g_port); + OutputDebugString(debug_str); + } + if(SOCKET_ERROR == (connect(s, (sockaddr*)&addr, sizeof(addr)))) { + error_code = WSAGetLastError(); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Connection failed / Error Code: %d", error_code); + OutputDebugString(debug_str); + } + return 0; + } + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Successfully connected!"); + OutputDebugString(debug_str); + } + return 1; + } +} + +EXPORT BOOL CALLBACK SendData(char* buff) { + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Sending data to %s... (%d bytes)", + g_address, strlen(buff)); + OutputDebugString(debug_str); + } + + int length = send(s, buff, strlen(buff), 0); + + if(SOCKET_ERROR == length) { + error_code = WSAGetLastError(); + if(error_code > 0) { // workaround: check error code + if(!is_win32s) { + sprintf(debug_str, "\r\n[WSAWrapper] Send Data failed / Error Code: %d", error_code); + OutputDebugString(debug_str); + } + return FALSE; + } else { + stats.packets_sent = stats.total_bytes_sent / BUFFER_LENGTH; + stats.total_bytes_sent += strlen(buff); + error_code = 0; + return TRUE; + } + } else { + stats.packets_sent = stats.total_bytes_sent / BUFFER_LENGTH; + stats.total_bytes_sent += strlen(buff); + } + error_code = 0; + return TRUE; +} + + +EXPORT char* CALLBACK GetInputBuffer(SOCKET s) { + int length = 0; + recv_buff = new char[BUFFER_LENGTH]; + length = recv(s, (char*)recv_buff, BUFFER_LENGTH, 0); + if(SOCKET_ERROR == length) { + error_code = WSAGetLastError(); + if(error_code == 10035) { // workaround: if it's non-blocking socket + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Buffer Read error / " + " Error Code: %d", g_address, error_code); + OutputDebugString(debug_str); + } + sprintf(recv_buff, "\r\n[Missing Socket Data]"); + Sleep(200); + } else if(error_code > 0) { // workaround: check error code + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Connection with %s closed / " + " Error Code: %d", g_address, error_code); + OutputDebugString(debug_str); + } + closesocket(s); + sprintf(recv_buff, "[WSAWrapper] 0xE0001\r\n"); + } else { + stats.total_bytes_read += length; + stats.packets_read = stats.total_bytes_read / BUFFER_LENGTH; + recv_buff[length] = '\0'; + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Receiving Data from %s... (%d bytes)", + g_address, length); + OutputDebugString(debug_str); + } + } + } else { + stats.total_bytes_read += length; + stats.packets_read = stats.total_bytes_read / BUFFER_LENGTH; + recv_buff[length] = '\0'; + } + return recv_buff; +} + +EXPORT struct NetworkStatistics GetNetworkStatistics() { + return stats; +} + +EXPORT void CALLBACK CloseConnection() { + try { + error_code = 0; + closesocket(s); + if(!is_win32s && debug) { + sprintf(debug_str, "\r\n[WSAWrapper] Successfully closed!"); + OutputDebugString(debug_str); + } + } catch(...) { + + } +} + + + diff --git a/WSAWrapper.def b/WSAWrapper.def new file mode 100644 index 0000000..9a158cc --- /dev/null +++ b/WSAWrapper.def @@ -0,0 +1,13 @@ +LIBRARY "WSAWrapper" +DESCRIPTION "Winsock Wrapper" + +EXPORTS +EnableDebugging @14 +EnableAsyncMessages @15 +GetWSAError @16 +CreateConnection @17 +CreateAsyncConnection @18 +SendData @19 +GetInputBuffer @20 +GetNetworkStatistics @21 +CloseConnection @22 diff --git a/WSAWrapper.h b/WSAWrapper.h new file mode 100644 index 0000000..5badd14 --- /dev/null +++ b/WSAWrapper.h @@ -0,0 +1,35 @@ +// Copyright © 2023 Dmitry Tretyakov (aka. Tinelix) +// +// This program is free software: you can redistribute it and/or modify it under the terms of +// the GNU Lesser General Public License as published by the Free Software Foundation, either +// version 2.1 of the License, or (at your option) any later version. +// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License along with this +// program. If not, see https://www.gnu.org/licenses/. +// +// Source code: https://github.com/tinelix/WSAWrapper + + +#define EXPORT extern "C" __declspec (dllexport) + +struct NetworkStatistics { + int packets_read; + int packets_sent; + int total_bytes_sent; + int total_bytes_read; +} NetworkStats; + +EXPORT void CALLBACK EnableDebugging(BOOL value); +EXPORT BOOL CALLBACK InitializeWinSock(); +EXPORT BOOL CALLBACK EnableCustomAsyncMessages(HWND hWnd, int message, int nStatus); +EXPORT BOOL CALLBACK EnableAsyncMessages(HWND hWnd); +EXPORT int CALLBACK GetWSAError(); +EXPORT BOOL CALLBACK CreateConnection(char* address, int port); +EXPORT int CALLBACK CreateAsyncConnection(char* address, int port, int part, int message, HWND hWnd); +EXPORT BOOL CALLBACK SendData(char* buff); +EXPORT char* CALLBACK GetInputBuffer(SOCKET s); +EXPORT struct NetworkStatistics GetNetworkStatistics(); +EXPORT void CALLBACK CloseConnection(); \ No newline at end of file diff --git a/WSAWrapper.mak b/WSAWrapper.mak new file mode 100644 index 0000000..80f9a7f --- /dev/null +++ b/WSAWrapper.mak @@ -0,0 +1,253 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=WSAWrapper - Win32 Debug +!MESSAGE No configuration specified. Defaulting to WSAWrapper - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "WSAWrapper - Win32 Release" && "$(CFG)" !=\ + "WSAWrapper - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "WSAWrapper.mak" CFG="WSAWrapper - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "WSAWrapper - Win32 Release" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE "WSAWrapper - Win32 Debug" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "WSAWrapper - Win32 Debug" +MTL=mktyplib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "WSAWrapper - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\wsawrap.dll" + +CLEAN : + -@erase ".\Release\wsawrap.dll" + -@erase ".\Release\WSAWrapper.obj" + -@erase ".\Release\wsawrap.lib" + -@erase ".\Release\wsawrap.exp" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/WSAWrapper.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x419 /d "NDEBUG" +# ADD RSC /l 0x419 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/WSAWrapper.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"Release/wsawrap.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\ + /pdb:"$(OUTDIR)/wsawrap.pdb" /machine:I386 /def:".\WSAWrapper.def"\ + /out:"$(OUTDIR)/wsawrap.dll" /implib:"$(OUTDIR)/wsawrap.lib" +DEF_FILE= \ + ".\WSAWrapper.def" +LINK32_OBJS= \ + "$(INTDIR)/WSAWrapper.obj" + +"$(OUTDIR)\wsawrap.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "WSAWrapper - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\wsawrap.dll" + +CLEAN : + -@erase ".\Debug\vc40.pdb" + -@erase ".\Debug\vc40.idb" + -@erase ".\Debug\wsawrap.dll" + -@erase ".\Debug\WSAWrapper.obj" + -@erase ".\Debug\wsawrap.ilk" + -@erase ".\Debug\wsawrap.lib" + -@erase ".\Debug\wsawrap.exp" + -@erase ".\Debug\wsawrap.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/WSAWrapper.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x419 /d "_DEBUG" +# ADD RSC /l 0x419 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/WSAWrapper.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug/wsawrap.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\ + /pdb:"$(OUTDIR)/wsawrap.pdb" /debug /machine:I386 /def:".\WSAWrapper.def"\ + /out:"$(OUTDIR)/wsawrap.dll" /implib:"$(OUTDIR)/wsawrap.lib" +DEF_FILE= \ + ".\WSAWrapper.def" +LINK32_OBJS= \ + "$(INTDIR)/WSAWrapper.obj" + +"$(OUTDIR)\wsawrap.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "WSAWrapper - Win32 Release" +# Name "WSAWrapper - Win32 Debug" + +!IF "$(CFG)" == "WSAWrapper - Win32 Release" + +!ELSEIF "$(CFG)" == "WSAWrapper - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\WSAWrapper.h + +!IF "$(CFG)" == "WSAWrapper - Win32 Release" + +!ELSEIF "$(CFG)" == "WSAWrapper - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\WSAWrapper.cpp + +!IF "$(CFG)" == "WSAWrapper - Win32 Release" + +DEP_CPP_WSAWR=\ + ".\WSAWrapper.h"\ + +NODEP_CPP_WSAWR=\ + ".\stats.packets_read"\ + ".\total_bytes_read"\ + + +"$(INTDIR)\WSAWrapper.obj" : $(SOURCE) $(DEP_CPP_WSAWR) "$(INTDIR)" + + +!ELSEIF "$(CFG)" == "WSAWrapper - Win32 Debug" + +DEP_CPP_WSAWR=\ + ".\WSAWrapper.h"\ + + +"$(INTDIR)\WSAWrapper.obj" : $(SOURCE) $(DEP_CPP_WSAWR) "$(INTDIR)" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\WSAWrapper.def + +!IF "$(CFG)" == "WSAWrapper - Win32 Release" + +!ELSEIF "$(CFG)" == "WSAWrapper - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/WSAWrapper.mdp b/WSAWrapper.mdp new file mode 100644 index 0000000..8de0a91 Binary files /dev/null and b/WSAWrapper.mdp differ diff --git a/WSAWrapper.ncb b/WSAWrapper.ncb new file mode 100644 index 0000000..6cb50ce Binary files /dev/null and b/WSAWrapper.ncb differ