Page 1 of 2
API calls
Posted: Sun Jun 15, 2003 10:18 pm
by 8bit
I am having trouble with the API Call "SetTcpEntry", For some reason, when ever call it, i get the error code 87, which is, The parameter is incorrect. I call it like this
Code: Select all
Errorcode.l = SetTcpEntry_ (@TcpRow)
I just cant seem to figure out why its not working?!
Any help/ suggestions?
PS. I LOVE the purebasic launguage...keep up the great launguage!!!
Posted: Sun Jun 15, 2003 10:29 pm
by freak
Can you also post the part, where you fill in the contents
of the MIB_TCPROW Structure? maybe there is something wrong
in there.
TImo
Posted: Sun Jun 15, 2003 10:29 pm
by Karbon
Check out allapi.net - they have an excellent little utility describing a lot of API calls..
;)
Posted: Mon Jun 16, 2003 3:13 am
by 8bit
Code: Select all
TcpRow.MIB_TCPROW
; Set state to DELETE_TCB, to kill the connection
TcpRow\dwLocalAddr = inet_addr_(GetGadgetItemText(#List1,1,0))
TcpRow\dwLocalPort = htons_(GetGadgetItemText(#List1,1,1))
TcpRow\dwRemoteAddr = inet_addr_(GetGadgetItemText(#List1,1,2))
TcpRow\dwRemotePort = htons_(GetGadgetItemText(#List1,1,3))
TcpRow\dwState=12
Thats how i do it.. lol is there a problem doing it the way i did? im new to using API
Posted: Mon Jun 16, 2003 3:45 pm
by freak
Hmm, the stuff looks korrect to me, however, i haven't used these
networking specific calls yet, so i can't tell, if you used the right
ones.
Timo
hmmm
Posted: Mon Jun 16, 2003 6:16 pm
by 8bit
*sigh* I debuged the output of dwLocalAddr, and its a negative number...but all the rest are positives.. The dwRemoteAddr is a positive number.. shouldnt dwLocalAddr be a positive. maybe ill look into a conversion? hmmm.. Thanks for your "help"

Posted: Mon Jun 16, 2003 8:38 pm
by GedB
8bit,
-1 usually signifies an error (although it varies, check the win32 docs).
Use the api calls GetLastError_() and FormatMessage_ () to find out exactly whats going on, like in this example:
viewtopic.php?t=3809&highlight=getlasterror
Posted: Mon Jun 16, 2003 9:07 pm
by 8bit
GedB wrote:8bit,
-1 usually signifies an error (although it varies, check the win32 docs).
Use the api calls GetLastError_() and FormatMessage_ () to find out exactly whats going on, like in this example:
viewtopic.php?t=3809&highlight=getlasterror
I made my own program matter of fact..you type in the error code and it looks up and gives out a message. But Like i said. Error code 87 = The parameter is incorrect. If you read my original post, I said this.
whaaA?
Posted: Mon Jun 16, 2003 10:55 pm
by 8bit
I did this :
Code: Select all
Result.s = GetErrorDLL()
debug Result
and it said : Overlapped I/O operation is in progress.
WTF? i wish i knew how to decode this message.. Overlapped? does that mean im somehow overflowwing a buffer? I/O is input/output lol i dunno..can anyone help me?
Posted: Tue Jun 17, 2003 3:16 am
by HarryO
8bit,
This is just a dumb guess but did you set the type for the items in the
structure to long? If not (like word or byte), then the value might be
passed as a negative number because of truncation.
HarryO
Re: whaaA?
Posted: Tue Jun 17, 2003 12:58 pm
by tinman
8bit wrote:and it said : Overlapped I/O operation is in progress.
WTF? i wish i knew how to decode this message.. Overlapped? does that mean im somehow overflowwing a buffer? I/O is input/output lol i dunno..can anyone help me?
It means the operation is in progress and is running at the same time (asynchronously) as your own code. This is not a failure.
Re: whaaA?
Posted: Tue Jun 17, 2003 1:11 pm
by 8bit
tinman wrote:
It means the operation is in progress and is running at the same time (asynchronously) as your own code. This is not a failure.
Hmm.. So Im not really sure what all that means. Could you give me a link that explains it.. or explain it your self better? Thanks. Oh and yep all the variables are longs
Re: whaaA?
Posted: Tue Jun 17, 2003 1:21 pm
by tinman
8bit wrote:tinman wrote:
It means the operation is in progress and is running at the same time (asynchronously) as your own code. This is not a failure.
Hmm.. So Im not really sure what all that means. Could you give me a link that explains it.. or explain it your self better? Thanks. Oh and yep all the variables are longs
I can't explain it with reference to your code because I can't test it here. And I just noticed that your original problem is different to the post I replied to so this probably isn't of any use to you. But I'll leave it in anyway :)
However, overlapped I/O is when Windows performs the I/O (or data transfer) at the same time as your thread runs. It does not stop your program running while the data transfer is taking place, so you can do other things in your program at the same time.
One example would be doing some network communications. If your program was stopped from running while the communications were taking place then the user would have to sit and wait for it to complete. However, because the communications are overlapped with your program, you can do other things such as allow the user to click on a "Cancel" button as your program will still be running to respond to it.
http://msdn.microsoft.com/library/defau ... us_i_o.asp
Posted: Tue Jun 17, 2003 2:42 pm
by GedB
8bit,
Sorry for not reading the whole post.
Doing some digging brought this up
http://www.netspace.net.au/~mheath/ieoverlap.html
and the related knowledge base article:
http://support.microsoft.com/search/pre ... -us;187770
Although it's only likely to be the problem if your using Win98 or IE4.
Posted: Tue Jun 17, 2003 10:50 pm
by 8bit
Well. If this is not a failure.. Then why doesnt it kill a connection? Ive even tried the SetTcpEntryToStack. Maybe this isnt the right program to be making in PureBasic.. The same code (modified a bit) Works fine in visual basic. Matter of fact, im just porting a application i made in Visual Basic into PureBasic, using the same API calls, and every thing.. Im just getting frusterated now.