RasEnumAutodialAddressesA 関数 (ras.h)
RasEnumAutodialAddresses 関数は、AutoDial マッピング データベース内のすべてのアドレスの一覧を返します。
構文
DWORD RasEnumAutodialAddressesA(
[in, out] LPSTR *lppRasAutodialAddresses,
[in, out] LPDWORD lpdwcbRasAutodialAddresses,
[out] LPDWORD lpdwcRasAutodialAddresses
);
パラメーター
[in, out] lppRasAutodialAddresses
文字列ポインターの配列へのポインター。バッファーの末尾に文字列自体を格納するための領域が追加されています。
出力時に、各文字列は AutoDial マッピング データベース内のアドレスの名前を受け取ります。
入力時に lppAddresses が NULL の 場合、 RasEnumAutodialAddresses は lpdwcbAddresses パラメーターと lpdwcAddresses パラメーターを設定して、必要なサイズ (バイト単位)、およびデータベース内のアドレス エントリの数を示します。
[in, out] lpdwcbRasAutodialAddresses
入力時に lpRasEnumAutodialAddressespAddresses パラメーターで指定されたバッファーのサイズ (バイト単位) を含む変数へのポインター。
必要なバッファー サイズを確認するには、lppAddresses を NULL に設定して RasEnumAutodialAddresses を呼び出します。 lpdwcbAddresses によって指される変数は 0 に設定する必要があります。 この関数は、 lpdwcbAddresses の必要なバッファー サイズと 、ERROR_BUFFER_TOO_SMALLのエラー コードを返します。
[out] lpdwcRasAutodialAddresses
lppAddresses バッファーで返されるアドレス文字列の数を受け取る変数へのポインター。
戻り値
関数が成功した場合、戻り値は ERROR_SUCCESS。
関数が失敗した場合、戻り値は次のいずれかのエラー コードか、 ルーティングとリモート アクセスのエラー コード または Winerror.h からの値です。
値 | 意味 |
---|---|
|
lpdwcbAddresses または lpdwcAddresses パラメーターにNULL が渡されました。 |
|
lppAddresses バッファーが NULL で、lpdwcbAddresses が 0 でした。 この関数は、 lpdwcbAddresses が指す変数に必要なバッファー サイズを返します。 |
注釈
次のコード サンプル コードでは 、RasEnumAutodialAddresses を使用して Autodial マッピング データベースを列挙します。
#include <windows.h>
#include <stdio.h>
#include "ras.h"
#include "raserror.h"
#include <tchar.h>
DWORD __cdecl wmain(){
DWORD dwBytes = 0;
DWORD dwRet = ERROR_SUCCESS;
DWORD dwAddresses = 0;
LPTSTR * lppAddresses = NULL;
LPCTSTR lpEntryAddress = L"www.microsoft.com";
// Allocate memory for a new Autodial address to add to the mapping database
LPRASAUTODIALENTRY lpentry = (LPRASAUTODIALENTRY) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASAUTODIALENTRY));
lpentry->dwSize = sizeof(RASAUTODIALENTRY);
// Add a (non-functional) address to the Autodial mapping database
// (this ensures RasEnumAutodialAddresses() has something to return)
dwRet = RasSetAutodialAddress(lpEntryAddress, 0, lpentry, lpentry->dwSize, 1);
// Call RasEnumAutodialAddresses() with lppAddresses = NULL. dwBytes is returned with the
// required buffer size and a return code of ERROR_BUFFER_TOO_SMALL
dwRet = RasEnumAutodialAddresses(lppAddresses, &dwBytes, &dwAddresses);
if (dwRet == ERROR_BUFFER_TOO_SMALL){
// Allocate the memory needed for the array of RAS Autodial addresses.
lppAddresses = (LPTSTR *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwBytes);
if (lppAddresses == NULL){
wprintf(L"HeapAlloc failed!\n");
return 0;
}
// Call RasEnumAutodialAddresses() to enumerate all RAS Autodial addresses
dwRet = RasEnumAutodialAddresses(lppAddresses, &dwBytes, &dwAddresses);
// If successful, print the RAS Autodial addresses
if (dwRet == ERROR_SUCCESS){
wprintf(L"The following RAS Autodial addresses were found:\n");
for (DWORD i = 0; i < dwAddresses; i++){
wprintf(L"%s\n", lppAddresses[i]);
}
}
// Remove the address
dwRet = RasSetAutodialAddress(lpEntryAddress, 0, NULL, 0, 0);
//Deallocate memory for the address buffers
HeapFree(GetProcessHeap(), 0, lppAddresses);
HeapFree(GetProcessHeap(), 0, lpentry);
lppAddresses = NULL;
return 0;
}
// There was either a problem with RAS or there are no RAS Autodial addresses to enumerate
if(dwAddresses >= 1){
wprintf(L"The operation failed to acquire the buffer size.\n");
}else{
wprintf(L"There were no RAS Autodial addresses found.\n");
}
// Remove the address
dwRet = RasSetAutodialAddress(lpEntryAddress, 0, NULL, 0, 0);
HeapFree(GetProcessHeap(), 0, lpentry);
return 0;
}
注意
ras.h ヘッダーは、RasEnumAutodialAddresses をエイリアスとして定義し、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI または Unicode バージョンを自動的に選択します。 エンコードに依存しないエイリアスをエンコードニュートラルでないコードと組み合わせて使用すると、コンパイルまたはランタイム エラーが発生する不一致が発生する可能性があります。 詳細については、「 関数プロトタイプの規則」を参照してください。
要件
要件 | 値 |
---|---|
サポートされている最小のクライアント | Windows 2000 Professional [デスクトップ アプリのみ] |
サポートされている最小のサーバー | Windows 2000 Server [デスクトップ アプリのみ] |
対象プラットフォーム | Windows |
ヘッダー | ras.h |
Library | Rasapi32.lib |
[DLL] | Rasapi32.dll |
こちらもご覧ください
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示