CUT_RAS::GetEntryProperties

Dundas

CUT_RAS::GetEntryProperties

Members | Overview

int GetEntryProperties(LPCSTR szEntryName, LPRASENTRY pRasEntry,DWORD* pnRasEntryLen)

Parameters

szEntryName

A phonebook entry.

pRasEntry

A pointer to an allocated RASENTRY structure. The dwSize member of the structure must be set to "sizeof(RASENTRY)".

pnRasEntryLen

The size of the pRasEntry buffer.

Return Value

UTE_SUCCESS

Operation completed successfully.

UTE_ERROR

Function failed (see GetLastRASError for more details).

UTE_BUFFER_TOO_SHORT

The supplied buffer was too small.

UTE_RAS_LOAD_ERROR

Unable to load the RAS DLLs.

Remarks

Retrieves the properties for a given phonebook entry. This function takes a pointer to a RASENTRY structure which must already exist.  

NOTE: the RASENTRY structure can 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.

Set the nRasEntryLen parameter to the total length of the given data buffer. If the buffer is too small then the function will fail.

To help ensure success call the function with pRasEntry set to NULL and nRasEntryLen set to 0. If the function returns with a value of UTE_BUFFER_TOO_SHORT then nRasEntryLen will contain the required size of the buffer. Allocate a buffer of the required size and call the function again.

Example

 

// if the entry name is passed then a modification call is made

// to this dialog instead of an add call.

if (m_pRas->GetEntryProperties(m_szEntryName, NULL,&size) == UTE_BUFFER_TOO_SHORT)

{

m_rasEntry = new RASENTRY[size];

m_rasEntry->dwSize = size;

 

// retrieve all properties for the selected book entry

if (m_pRas->GetEntryProperties(m_szEntryName, m_rasEntry,&size) == UTE_SUCCESS)

{


// get the username

if (m_pRas->GetEntryUserName(m_szEntryName, szTemp,sizeof(szTemp)) == UTE_SUCCESS)

{

SetDlgItemText(IDC_USER,szTemp);

}

 

// get the password

if (m_pRas->GetEntryPassword(m_szEntryName, szTemp,sizeof(szTemp)) == UTE_SUCCESS)

{

SetDlgItemText(IDC_PASSWORD,szTemp);

 

// get phone number and area code

if (m_pRas->GetEntryPhoneNumber(m_szEntryName,szTemp,sizeof(szTemp),szAreaCode,sizeof(szAreaCode) ) == UTE_SUCCESS)

{

SetDlgItemText(IDC_PHONE_NUMBER,szTemp);

SetDlgItemText(IDC_AREA_CODE,szAreaCode);

}

}

}