Click to See Complete Forum and Search --> : RasEnumEntries
Jump_Around
March 5th, 2003, 11:37 AM
DWORD dwCb = sizeof(RASENTRYNAME);
DWORD dwErr = ERROR_SUCCESS;
DWORD dwRetries = 5;
DWORD dwEntries = 0;
RASENTRYNAME lpRasEntryName[20];
lpRasEntryName[0].dwSize = sizeof(RASENTRYNAME);
RasEnumEntries(NULL,NULL,lpRasEntryName,&dwCb,&dwEntries);
This is the code. the problem is that RasEnumEntries returns 610 which is ERROR_BUFFER_INVALID. What is wrong?
Please help me, please
Mick
March 5th, 2003, 12:14 PM
LPRASENTRYNAME lpRasEntryName = NULL;
DWORD nRet;
DWORD cb;
DWORD cEntries;
lpRasEntryName = (LPRASENTRYNAME)GlobalAlloc(GPTR, sizeof(RASENTRYNAME));
lpRasEntryName->dwSize = sizeof(RASENTRYNAME);
if ((nRet = RasEnumEntries(NULL, NULL, lpRasEntryName, &cb, &cEntries))
== ERROR_BUFFER_TOO_SMALL)
{
lpRasEntryName = (LPRASENTRYNAME)GlobalAlloc(GPTR, cb);
lpRasEntryName->dwSize = sizeof(RASENTRYNAME);
}
// Calling RasEnumEntries to enumerate the phone-book entries
nRet = RasEnumEntries(NULL, NULL, lpRasEntryName, &cb, &cEntries);
Make sure add GlobalFree() and more error checking.
Jump_Around
March 5th, 2003, 05:02 PM
Well I copied the code to VisualC++ on Windows 2000 (at home) and works fine. At work (win 98) using Builder C++ still gives the error 610.
Any suggestions?
Mick
March 5th, 2003, 05:19 PM
Yea don't support win98 ;) but seriously...hmm can't boot to win98 currently kinda have a messed up boot loader currently, so can't cross check it, but I'd advise checking IDE/help - MSDn help (msdn.microsoft.com) for rasenum, could be you need to install the unicode layer for win98...
Jump_Around
March 5th, 2003, 05:26 PM
Thanx Mick for quick advices, I really appreciate that. This is whaty I found.
Error 610- The buffer is invalid
Go into My computer > control panel > modems.
Go into properties of modem > Check port speed is set correctly.
If that did not work go into control panel > modems > remove modem > restart computer and then re-install modem.
I think my modem is not installed correctly, well I will check it tommorow and will let you know.
Take care :cool:
Mick
March 5th, 2003, 05:38 PM
Ok, no prob, like I posted (win2000) which I only have at home for my dev env..will work fine...I've got no way to verify win98, wish I did or I could tell you...or at least give you some hint, but if you figure it out at (work) win98, then post your workaround/resolution here so some future person won't have do ask your question :)
Jump_Around
March 6th, 2003, 04:08 AM
I am not happy because I got still error 610 even when I use your piece of code. What's going on. Please help
j0nas
March 6th, 2003, 05:44 PM
I think it has to do with microsoft's bad habit of using #ifdef:s inside structure definitions for handling different O/S.
Try this:
#include <windows.h>
#define WINVER 0x400
#include <ras.h>
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.