🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.win32
Article #2183

RasEnumConnections always returns 0 entries

#2183
From: Vic Metcalfe
Date: Sun, 18 Jan 1998 00:00
51 lines
2513 bytes
I am trying to get a list of active RAS connections on an NT 4.0 RAS
server.  I'm programming with Delphi 3.0, but if that's the problem I
can switch to VC++ 4.0.  Every time I call RasEnumConnections, it
returns 0 (no error) but does not list any active connections.  If I run
the Remote Access Admin however, it correctly lists the connections.  In
the code example below, the third showmessage shows that bufsize,
numconnections and result are all zero.

I've looked for help on Dejanews, but everyone seems to be talking about
detecting and/or initiating RAS connections on the client side. 
Shouldn't this be the same as detecting client side connections?  It
seems to me that this should be a really easy task, and I must be
missing something really simple.  I hope someone will be able to point
out the error to me!

Thanks in advance,
  Vic.

function TForm1.UpdateConnectList:longint;
var
  n:longint;
  bufsize:longint;
  RASConnect: Array[1..500] OF TRASConn;
  NumConnections: DWord;
  RASEvent:Word;
begin
  RASEvent := RegisterWindowMessage(RASDialEvent);
  If RASEvent = 0 THEN
     RASEvent := WM_RASDialEvent;
  bufsize:=sizeof(RasConnect);
  NumConnections:=500;
  RasConnect[1].dwSize:=sizeof(TRasConn);
  showmessage('Buffer size: '+inttostr(bufsize)+'  NumConnections: '+
    inttostr(NumConnections));
  result:=RasEnumConnections(@RASConnect, BufSize, NumConnections);
  if result<>0 then
  begin
    RasGetErrorString(result,pchar(@rasconnect),sizeof(rasconnect));
    showmessage('Error: '+pchar(@rasconnect));
    exit;
  end;
  showmessage('Buffer size: '+inttostr(bufsize)+'  NumConnections: '+
    inttostr(NumConnections)+'  Result: '+inttostr(Result));
  ConnectList.items.clear;
  for n:=1 to NumConnections do
  begin
    { ConnectList is a TListBox on Form1. }
    ConnectList.Items.Add(RasConnect[n].szEntryName);
  end;
end;
Technical Details
Message-ID: <34C2110A.166E918B@zymsys.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb362,727dba52da29726b,start
X-Google-Attributes: gidfb362,public
X-Google-Thread: 113dfb,727dba52da29726b,start
X-Google-Attributes: gid113dfb,public
From: Vic Metcalfe <vic@brutus.tlug.org>
Subject: RasEnumConnections always returns 0 entries
Date: 1998/01/18
Message-ID: <34C2110A.166E918B@zymsys.com>
X-Deja-AN: 317072870
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: Zymurgy Sytems
Mime-Version: 1.0
Newsgroups: comp.os.ms-windows.programmer.win32,borland.public.delphi.internet