API calls

Just starting out? Need help? Post your questions and find answers here.
8bit
User
User
Posts: 11
Joined: Sat Jun 14, 2003 3:33 pm
Contact:

API calls

Post 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!!!
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Check out allapi.net - they have an excellent little utility describing a lot of API calls..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
8bit
User
User
Posts: 11
Joined: Sat Jun 14, 2003 3:33 pm
Contact:

;)

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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. :wink:

Timo
quidquid Latine dictum sit altum videtur
8bit
User
User
Posts: 11
Joined: Sat Jun 14, 2003 3:33 pm
Contact:

hmmm

Post 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" :wink:
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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
8bit
User
User
Posts: 11
Joined: Sat Jun 14, 2003 3:33 pm
Contact:

Post 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.
8bit
User
User
Posts: 11
Joined: Sat Jun 14, 2003 3:33 pm
Contact:

whaaA?

Post 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?
HarryO
User
User
Posts: 42
Joined: Wed May 07, 2003 4:25 am
Location: Palatine,IL.,USA

Post 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
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: whaaA?

Post 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.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
8bit
User
User
Posts: 11
Joined: Sat Jun 14, 2003 3:33 pm
Contact:

Re: whaaA?

Post 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
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: whaaA?

Post 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
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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.
8bit
User
User
Posts: 11
Joined: Sat Jun 14, 2003 3:33 pm
Contact:

Post 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.
Post Reply