Hello!
I'm having an problem.. while compiling one of the sources.
ERROR =
Error 5 error LNK2019: unresolved external symbol "int __stdcall WSPConnect(unsigned int,struct sockaddr const *,int,struct _WSABUF *,struct _WSABUF *,struct _QualityOfService *,struct _QualityOfService *,int *)" (?WSPConnect@@YGHIPBUsockaddr@@HPAU_WSABUF@@1PAU_QualityOfService@@2PAH@Z) referenced in function _WSPStartup@76 spi.obj ifslsp
Thank You for your help.
int WSPAPI
WSPConnect(
SOCKET s,
struct sockaddr FAR * name,
int namelen,
LPWSABUF lpCallerData,
LPWSABUF lpCalleeData,
LPQOS lpSQOS,
LPQOS lpGQOS,
LPINT lpErrno)
{
SOCKET_CONTEXT *sockContext = NULL;
SOCKADDR *proxyAddr = NULL;
int proxyLen = 0,
rc = SOCKET_ERROR;
//////////////////////////////////////////////////////////////////////////
char rulesFile[MAX_PATH] = "";
// "l2.exe" 98.76.54.32 127.0.0.1 # Route to L2Net
char ruleLine[1024] = "";
char progName[MAX_PATH] = "L2.exe"; // L2.exe
char addrSource[MAX_PATH] = "83.171.11.25"; // 23.23.23.23 / h2.lr.bfdr.eu
char addrDest[MAX_PATH] = "127.0.0.1"; // 127.0.0.1 / localhost
if ( name->sa_family == AF_INET )
{
GetModuleFileName((HMODULE)&__ImageBase, rulesFile, MAX_PATH);
int i = lstrlen(rulesFile);
for(;rulesFile[i] != '\\'; i--) rulesFile[i] = 0x0;
lstrcat(rulesFile, "rules.cfg");
FILE *fp;
fp = fopen(rulesFile, "r");
if(fp) // Sucessful opening
{
while (!feof(fp))
{
if( fgets(ruleLine, sizeof(ruleLine), fp) != NULL )
{
ZeroMemory(progName, sizeof(progName));
ZeroMemory(addrSource, sizeof(addrSource));
ZeroMemory(addrDest, sizeof(addrDest));
ParseLine(ruleLine, progName, addrSource, addrDest);
if (!lstrlen(progName) || !lstrlen(addrSource) || !lstrlen(addrDest))
{ // If one of string args is wrong... clean all
ZeroMemory(progName, sizeof(progName));
ZeroMemory(addrSource, sizeof(addrSource));
ZeroMemory(addrDest, sizeof(addrDest));
}
else
{
// DO REDIRECTION STUFF HERE
char exePath[MAX_PATH] = "";
char exeName[MAX_PATH] = "";
GetModuleFileName(NULL, exePath, sizeof(exePath));
int i = lstrlen(exePath);
for(;exePath[i] != '\\'; i--); i++;
for(int j = 0; exePath[i] != 0; i++, j++) exeName[j] = exePath[i];
if(!lstrcmpi(exeName, progName))
{ // Equal... so rule is for current process
// Redirect one destination to another
LPCH ReqAddr = inet_ntoa(((SOCKADDR_IN*)name)->sin_addr);
if ( !lstrcmpi(ReqAddr, addrSource) ) // if Equal
{
// replace with NEW
((SOCKADDR_IN*)name)->sin_addr.s_addr = inet_addr(addrDest);
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< replasing goes here
}
//hostent* d_addr = gethostbyname(addrSource);
//mbEx("H_ADDR of host(%s): '%u.%u.%u.%u'", addrSource,
// d_addr->h_addr_list[0][0], d_addr->h_addr_list[0][1], d_addr->h_addr_list[0][2], d_addr->h_addr_list[0][3]);
//mbEx("exeName: \"%s\"\nprogName: \"%s\"\n\naddrSource: \"%s\"\naddrDest: \"%s\"",
// exeName, progName, addrSource, addrDest);
}
}
ZeroMemory(ruleLine, sizeof(ruleLine));
}
}
fclose(fp);
}
}