From aa07fe1041b7107490cf2667aa5614ef4414a147 Mon Sep 17 00:00:00 2001 From: Dmitry Tretyakov <76806170+tretdm@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:26:23 +0700 Subject: [PATCH] Update gitignore --- .gitignore | 8 ++ WSAWrapper.cpp | 379 +++++++++++++++++++++++++++++++++++++++++++++++++ WSAWrapper.def | 13 ++ WSAWrapper.h | 35 +++++ WSAWrapper.mak | 253 +++++++++++++++++++++++++++++++++ WSAWrapper.mdp | Bin 0 -> 35328 bytes WSAWrapper.ncb | Bin 0 -> 58368 bytes 7 files changed, 688 insertions(+) create mode 100644 WSAWrapper.cpp create mode 100644 WSAWrapper.def create mode 100644 WSAWrapper.h create mode 100644 WSAWrapper.mak create mode 100644 WSAWrapper.mdp create mode 100644 WSAWrapper.ncb 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 0000000000000000000000000000000000000000..8de0a9185822cefbc45a9e8dc9f18c05abb318b9 GIT binary patch literal 35328 zcmeHQO>7&-6@Iit>&LP!)po1=c0=2Y|H73e|0;GOiBxRavZac0q!bQBid;#wNiM-3 zSuO&^2wL<~6h8FegAWFJNt2@JA=jclq-}uu;G+))>H-Pi_F|(jkOp<)es6YmNo}OG zw$j1^-vGmT+x5zcFk_e_X~T>e zp^2f>J>4M%PQ?ZX&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