from a first look I see various errors.
the first is "C:\\test.in" without the final 'i'
then the absence of the handling of the return value in GetPrivateProfileInt, indeed the correct usage is:
Code:
total = GetPrivateProfileInt("Main","total",0,"C:\\test.ini");
then the "search" and "replace" which are pointer and not buffer and more.
the following is the corrected code:
Code:
int mysend(SOCKET s, u_char **retbuf, int len, int flags) {
u_char *buf = *retbuf; // do NOT touch this
/*test start*/
int total,current;
char search[50];
char replaced[50];
char keys[50];
char keyr[50];
total = GetPrivateProfileInt("Main","total",0,"C:\\test.ini");
if(total>0)
{
for(current=0;current<total;current++)
{
sprintf(keys,"search(%i)",current);
sprintf(keyr,"replace(%i)",current);
if(!GetPrivateProfileString("REPLACE", keyr, NULL, replaced, sizeof(replaced), "C:\\test.ini")) continue;
if(!GetPrivateProfileString("SEARCH", keys, NULL, search, sizeof(search), "C:\\test.ini")) continue;
buf=find_replace_string(buf, &len, search,replaced);
}
}
/*test end*/
*retbuf = buf; // do NOT touch this
return(len);
}