WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

RAS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Set Domain in a RAS Connectoid in XP


Question:

I want to know how to set domain in a RAS connectoid in XP? I need to be able to specify the domain to log in as when using RAS extender. Possible?

Answer:

Sorry there is currently no support for specifying a domain in the Ras Extender.

However, here is some code I threw together assuming you already have a RAS ENTRY created:

AddExtender("wwras34i.dll")
raslist = RasItemize()
entryname = AskItemlist("Choose a RAS entry",raslist,@TAB,@UNSORTED,@SINGLE)

RASCM_UserName = 1
RASCM_Password = 2
RASCM_Domain = 4

mask = RASCM_UserName|RASCM_Password|RASCM_Domain
size = 540
RASCREDENTIALS = BinaryAlloc(size)
BinaryPoke4(RASCREDENTIALS, 0, size) ;set size of structure
BinaryPoke4(RASCREDENTIALS, 4, mask)
BinaryPokeStr(RASCREDENTIALS, 8, "testname")
BinaryPokeStr(RASCREDENTIALS, 265, "password")
BinaryPokeStr(RASCREDENTIALS, 522, "domain")
BinaryEodSet( RASCREDENTIALS, size)

dllfilename = StrCat(DirWindows(1), "Rasapi32.dll")
ret = DllCall( dllfilename, long:"RasSetCredentialsA" , lpnull, lpstr:entryname, lpbinary:RASCREDENTIALS, long:0)
If ret != 0
   Message("RasSetCredentials Error",ret)
   BinaryFree(RASCREDENTIALS)
   Exit
EndIf

BinaryFree(RASCREDENTIALS)
exi

Article ID:   W16855
File Created: 2007:07:03:14:26:36
Last Updated: 2007:07:03:14:26:36