RAS connect and so on

Just starting out? Need help? Post your questions and find answers here.
PureUser
User
User
Posts: 31
Joined: Sun Oct 05, 2003 11:18 pm

Post by PureUser »

x.rasdialparams
???? .... hmm...and what "x" stands for, I wonder ???

2 sec... noop...sorry... I don't used linux about a year already...
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

sorry pureuser, i was perhaps a little quick, i tend to get 'overcondensed' now and again, but i overcompensate that by being loud and noisy the rest of the time :)

here's the same somewhat better...

struct rasdialparams ; the struct as was shown in another post
...
...
endstructure

x.rasdialparams ; make a variable x of type struct rasdialparams
pokes(@x\szEntryName,"test") ; and fill a certain field

that should be better :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PureUser
User
User
Posts: 31
Joined: Sun Oct 05, 2003 11:18 pm

Post by PureUser »

;)
By the way Pure User sounds like Poor ;) user ... It is rather funny... I've noticed it just today ;)
PureUser
User
User
Posts: 31
Joined: Sun Oct 05, 2003 11:18 pm

Post by PureUser »

RasDial_(null, null, [??], null, null, null )
To what should I place here pointer?
Maybe *poiner=x.rasdialparams ?
Am I right?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

rasdial_(0,0,@x,0,0,0)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Jurgen
User
User
Posts: 37
Joined: Mon Sep 08, 2003 11:53 pm

Post by Jurgen »

PureUser,

A pointer to structure/variabele = the adress of this structure/variabele.
a pointer is always a long.

If you do pointer.l = @mystructure, then you have the adres in pointer.

hope this helps
PureUser
User
User
Posts: 31
Joined: Sun Oct 05, 2003 11:18 pm

Post by PureUser »

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

x.rasdialparams ; make a variable x of type struct rasdialparams 
PokeL(@x\dwSize, SizeOf(RASDIALPARAMS)) 
PokeS(@x\szEntryName,"gin") ; and fill a certain field 
PokeS(@x\szPhoneNumber,"")
PokeS(@x\szCallBackNumber,"")
PokeS(@x\szUserName,"test")
PokeS(@x\szPassword,"test")
PokeS(@x\szDomain,"*")

res=RasDial_(null, null, @x, null, null, null ); it gives an error #610 on win 9x
;This means that the buffer was set incorrectly

;in C\C++ the key to fix trouble is to set 
;#define WINVER 0x400
;before 
;#include <ras.h>
               
Delay (99999)
res=RasDial_(null, null, @x, null, null, null ) gives an error #610 on win 9x
This means that the buffer was set incorrectly

in C\C++ the key to fix trouble is to set
#define WINVER 0x400
before
#include <ras.h>

Any ideas how to translate to PB ?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

at first glance this looks ok

you can set the dwsize field directly though, no need to poke it

PokeL(@x\dwSize, SizeOf(RASDIALPARAMS))

x\dwsize = SizeOf(RASDIALPARAMS))

on winxp, it returns 87, no other error reported
i'm afraid either i lost you or can't help you any further on this
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PureUser
User
User
Posts: 31
Joined: Sun Oct 05, 2003 11:18 pm

Post by PureUser »

x\dwsize = SizeOf(RASDIALPARAMS)
Nothing changes... The same error in buffer... :(
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

try it on another os and see what it does
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Jurgen
User
User
Posts: 37
Joined: Mon Sep 08, 2003 11:53 pm

Post by Jurgen »

checkout the vb example at http://www.mentalis.org/apilist/RasDial.shtml
example : http://www.mentalis.org/apilist/RasDial.shtml#

Code: Select all

#RAS_MaxEntryName = 256 
#RAS_MaxPhoneNumber = 128 
#RAS_MaxCallbackNumber = 128  ; this was wrong
#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

RDP.RASDIALPARAMS
hRasConn.l=NULL

RDP\dwSize = 1052  ;SizeOf(RASDIALPARAMS)
Debug RDP\dwSize
PokeS(@RDP\szEntryName,"test") 
PokeS(@RDP\szPhoneNumber,"012313213") 
PokeS(@RDP\szCallbackNumber ,"*")
PokeS(@RDP\szUserName,"test") 
PokeS(@RDP\szPassword,"test") 
PokeS(@RDP\szDomain,"*") 
res.l = 0
res = RasDial_(null, null, @RDP, null, null, @hRasConn) 
Debug res

Now you have to add a phone book entry with the same entryname.
PureUser
User
User
Posts: 31
Joined: Sun Oct 05, 2003 11:18 pm

Post by PureUser »

great thx... This source you should post to the CodeArchiv (imho)... It is V E R Y useful...
Jurgen
User
User
Posts: 37
Joined: Mon Sep 08, 2003 11:53 pm

Post by Jurgen »

I find it very strange that the sizeof doesn't work correctly, instead 1052 works ?

Does PB have something similar to the #if and #endif as in visual c++ ?

Code: Select all

#define RASDIALPARAMSA struct tagRASDIALPARAMSA
RASDIALPARAMSA
{
    DWORD dwSize;
    CHAR  szEntryName[ RAS_MaxEntryName + 1 ];
    CHAR  szPhoneNumber[ RAS_MaxPhoneNumber + 1 ];
    CHAR  szCallbackNumber[ RAS_MaxCallbackNumber + 1 ];
    CHAR  szUserName[ UNLEN + 1 ];
    CHAR  szPassword[ PWLEN + 1 ];
    CHAR  szDomain[ DNLEN + 1 ];
#if (WINVER >= 0x401)
    DWORD dwSubEntry;
    DWORD dwCallbackId;
#endif
};
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

Does PB have something similar to the #if and #endif as in visual c++ ?
I'm not sure what #if and #endif do, but if they're compiler directives, you can use CompilerIf and CompilerEndIf.
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
Jurgen
User
User
Posts: 37
Joined: Mon Sep 08, 2003 11:53 pm

Post by Jurgen »

Yes something like a compiler directive.

For example the structures members depend on the version of windows your using.

WINVER >= 0x401 (hexadecimal) for NT 4.0 or greater.
WINVER >= 0x500 for windows 2000 or greater.
Post Reply