Page 1 of 4

RAS connect and so on

Posted: Sun Oct 05, 2003 8:19 pm
by Stronler
Id like to write a small dialer for myself, but I cant really find out how to work with API in PB... Can anyone help me?

Posted: Sun Oct 05, 2003 11:25 pm
by PureUser
I've got the same problem...I can not run PPP Daemon with PB

Posted: Sun Oct 05, 2003 11:29 pm
by blueznl
http://www.xs4all.nl/~bluez/datatalk/pure1.htm

doc still unchecked, but perhaps it could help you

there's a very small section on using winapi calls, it's not that difficult

Posted: Sun Oct 05, 2003 11:50 pm
by Jurgen
What Api function do you want to use ? :)

Posted: Mon Oct 06, 2003 8:53 am
by PureUser
Structure RASDIALPARAMS
dwSize.f
szEntryName.s
szPhoneNumber.s
szCallbackNumber.s
szUserName.s
szPassword.s
szDomain.s
EndStructure

Dim lol.rasdialparams(100)
lol(0)\dwSize = SizeOf(RASDIALPARAMS)
lol(0)\szEntryName = "test"
lol(0)\szPhoneNumber = "1-800-test"
lol(0)\szCallbackNumber
lol(0)\szUserName = "test"
lol(0)\szPassword = "test"
lol(0)\szDomain = "*"

RASDIALPARAMS = *RASDIALPARAMS



RasDial_(null, null, *RASDIALPARAMS, null, null, null )

Maybe this source can help you... I am not really sure that it is without mistakes, still...maybe GURU coders will check this out and correct it...

Posted: Mon Oct 06, 2003 11:27 am
by blueznl
> RASDIALPARAMS = *RASDIALPARAMS

why do this?

Posted: Mon Oct 06, 2003 11:30 am
by blueznl
typedef struct _RASDIALPARAMS {
DWORD dwSize;
TCHAR szEntryName[RAS_MaxEntryName + 1];
TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1];
TCHAR szCallbackNumber[RAS_MaxCallbackNumber + 1];
TCHAR szUserName[UNLEN + 1];
TCHAR szPassword[PWLEN + 1];
TCHAR szDomain[DNLEN + 1] ;
} RASDIALPARAMS;

aren't these fixed length strings instead of pointers? your definition makes them pointers, or am i wrong? see also viewtopic.php?t=7766

Posted: Mon Oct 06, 2003 11:42 am
by PureUser
it is said in api help that RasDial_ uses pointer...that is why i made pointer.... but unfortunately nothing works... :( Any Ideas?

Posted: Mon Oct 06, 2003 11:52 am
by blueznl
i was refering to the structure itself which is, i think, incorrectly translated to purebasic

Posted: Mon Oct 06, 2003 12:17 pm
by PureUser
So maybe you will post correct idea? ;)

Posted: Mon Oct 06, 2003 12:20 pm
by blueznl
i have no idea how ras works, but as for the structure, i think you have to translate the TCHAR stuff with byte fields

TCHAR x[255]

would then become

x.b[255]

in pure, you cannot assign a string to such a bytefield, so the c statement

variable.x = "test"

would become in pure:

pokes(@variable.b,"test")

or something along those lines...

now i only have to figure out what TCHAR does... :roll:

Posted: Mon Oct 06, 2003 12:51 pm
by freak
TCHAR is on non-unicode systems defined as a CHAR, which is just a byte
in fact.

Structure should look like this:

Code: Select all

#RAS_MaxEntryName = 256
#RAS_MaxPhoneNumber = 128
#RAS_MaxCallbackNumber = 48
#UNLEN = 256
#PWLEN = 256
#DNLEN = 15

Structure RASDIALPARAMS 
  dwSize.l
  szEntryName.b[#RAS_MaxEntryName + 1]
  szPhoneNumber.b[#RAS_MaxPhoneNumber + 1]
  szCallbackNumber.b[#RAS_MaxCallbackNumber + 1]
  szUserName.b[#UNLEN + 1]
  szPassword.b[#PWLEN + 1]
  szDomain.b[#DNLEN + 1] 
EndStructure
Timo

Posted: Mon Oct 06, 2003 12:55 pm
by PureUser
hm... and then is useful to use writwbyte func. ?

Posted: Mon Oct 06, 2003 1:03 pm
by blueznl
writebyte? you mean pokes i assume?

x.rasdialparams
pokes(@rasdialparamams\szEntryName,"test")

Posted: Mon Oct 06, 2003 1:46 pm
by sec
hello,

i have log wvdial under linux:
[root@localhost root]# wvdial sec911
--> WvDial: Internet dialer version 1.53
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATI7
ATI7
Country: USA
OK
--> Modem initialized.
--> Sending: ATDT911
--> Waiting for carrier.
ATDT911
...
can anybody opencom(), senddata(), closecom() ,...? modem on com3 :?: in windows
?