Добрый День! Столкнулся с проблемой, никак не могу изменить параметр Dial Up соединения, функци RasSetEntryProperties постоянно возвращает код ошибка 87...
Вопрос: - Как можно изменить к примеру IP адрес DNS в существующем соединение, все параметры его я получаю, а вот при изменении, всегда возвщарается 87...
if (RasEnumEntries(NULL,NULL, rasentry, &dSize, &dNumber) == 0)
for (int i = 0; i < dNumber; i++)
{
RASENTRY ras;
memset(&ras,0,sizeof(RASENTRY));
ras.dwSize = sizeof(RASENTRY);
if (RasGetEntryProperties(NULL,rasentry[i].szEntryName,&ras,&ras.dwSize,NULL,NULL) == NULL)
{
ras.ipaddrDns.a = 13;
ras.ipaddrDns.b = 13;
ras.ipaddrDns.c = 13;
ras.ipaddrDns.d = 13;
int res = RasSetEntryProperties(NULL, rasentry[i].szEntryName, &ras, ras.dwSize, NULL, 0);
if (res) // << Тут все время код ошибка
{
MessageBox(0,"RasSetEntryProperties failed..", 0,0);
} else
{
MessageBox(0,"Ok","Ok",0);
}
}
}
Что не так?
[c++] rtfm, msdn. memset(&ras,0,sizeof(rasentry)) вызывает ошибку в параметре lprasentry. перед вызовом функции требуется заполнить некоторые поля структуры. читай отрывок в теле поста.31.01.06 13:31 Автор: kstati <Евгений Борисов> Статус: Elderman
lpRasEntry [in] Pointer to the RASENTRY structure that specifies the new connection data to be associated with the phone-book entry indicated by the lpszEntry parameter.
The caller must provide values for the following members in the RASENTRY structure.
Important: dwType is only valid if WINVER >= 0x500.
If values are not provided for these members, RasSetEntryProperties fails with ERROR_INVALID_PARAMETER.
The structure might be followed by an array of null-terminated alternate phone number strings. The last string is terminated by two consecutive null characters. The dwAlternateOffset member of the RASENTRY structure contains the offset to the first string.
Windows Me/98/95 OSR2: The Microsoft Layer for Unicode does not support dwAlternateOffset in RASENTRY.