PDA

Ver la Versión Completa : Ayuda RasGetEntryProperties


antonioeligio
09-03-2005, 13:38:48
en el siguiente codigo no me lee ni escriove correctamente ciertos valores de las estructura TheRasEntry , estos valores son en concreto :

TheRasEntry.dwRedialCount
TheRasEntry.dwRedialPause


, aunque si funciona

TheRasEntry.szLocalPhoneNumber,

mi codigo es el siguiente


String NombreConexion = BuscaPrimeraConexionConfigurada();

// Selecciona el primer modem que encuentra
DWORD dwLength, dwNumDispositivos;
BYTE bDeviceInfo = NULL;
DWORD dwDeviceInfoSize = sizeof(bDeviceInfo);

// Crea o modifica una nueva conexión RAS
RASENTRY TheRasEntry;
ZeroMemory(&TheRasEntry, sizeof(TheRasEntry));
LPTSTR nombre = BuscaPrimeraConexionConfigurada().c_str();
DWORD dwEntrySize = 0;
DWORD a = 0;
DWORD b = 0;

// No se sabe porque pero para leer los RasGetEntryProperties hay que hacer esto

int j = RasGetEntryProperties(NULL,NULL,0,&a,0,0);
int k = RasGetEntryProperties(NULL,NombreConexion.c_str(),0,&b,0,0);
TheRasEntry.dwSize = a;
int n = RasGetEntryProperties(NULL,NombreConexion.c_str(),&TheRasEntry,&b,0,0);
// if (n!=0) loggerGsm("Error Leyendo Properties de Conexion GSM ");

if (FListaTelefonos.Length > 0)
{
strcpy(TheRasEntry.szLocalPhoneNumber, FListaTelefonos[0].c_str());
// en principio cogeremos el primero hasta que nos enteremos como se guardan todo
}

// TheRasEntry.ipaddr

TheRasEntry.dwRedialCount = FNumeroReintentos;
TheRasEntry.dwRedialPause = FTiempoEntreReintentos;
// en principio cogeremos el primero hasta que nos enteremos como se guardan todos

DWORD fRet;
DWORD g = sizeof(TheRasEntry);
fRet = RasSetEntryProperties(NULL,NombreConexion.c_str() ,&TheRasEntry, g, NULL, 0);
if (fRet != 0)
throw Exception("Error :: RasSetEntryProperties");

// Añade el nombre de usuario y clave a la entrada creada