다음을 통해 공유


MprAdminIsDomainRasServer 함수(mprapi.h)

MprAdminIsDomainRasServer 함수는 지정된 컴퓨터가 도메인의 원격 액세스 서버로 등록되었는지 여부에 대한 정보를 반환합니다.

구문

DWORD MprAdminIsDomainRasServer(
  [in]  LPWSTR pszDomain,
  [in]  LPWSTR pszMachine,
  [out] PBOOL  pbIsRasServer
);

매개 변수

[in] pszDomain

원격 액세스 서버를 쿼리할 도메인입니다.

[in] pszMachine

원격 액세스 서버의 이름입니다.

[out] pbIsRasServer

컴퓨터가 도메인에 등록된 경우 TRUE 를 반환하고, 그렇지 않으면 FALSE를 반환합니다.

반환 값

함수가 성공하면 반환 값이 NO_ERROR.

함수가 실패하면 반환 값은 다음 오류 코드 중 하나입니다.

의미
ERROR_DS_SERVER_DOWN
pszDomain이 잘못되었습니다.
ERROR_NOT_FOUND
pszMachine이 잘못되었습니다.
ERROR_DS_OPERATIONS_ERROR
사용자는 도메인이 아닌 사용자입니다.
ERROR_NO_SUCH_DOMAIN
도메인에 가입되지 않은 컴퓨터에서 실행되는 함수입니다.

설명

이 함수는 도메인에 가입된 컴퓨터에서만 실행해야 합니다.

예제

다음 예제 코드는 MprAdminIsDomainRasServerMprAdminEstablishDomainRasServer 함수의 사용을 보여 줍니다.

#include <windows.h>
#include <stdio.h>
#include "mprapi.h"
#pragma comment(lib, "mprapi.lib")

int __cdecl main(){
    
    // The domain and RAS machine names being queried. These MUST be changed before using this sample code.
    PWCHAR pszDomain = L"YourDomainName.com";
    PWCHAR pszMachine = L"YourRASMachine";
    
    BOOL bIsRegistered = FALSE;
    DWORD dwRes = ERROR_SUCCESS;
    MPR_SERVER_HANDLE phMprServer;

    // Make sure RRAS is running on the remote server
    dwRes = MprAdminServerConnect(pszMachine, &phMprServer);
    if(dwRes != ERROR_SUCCESS){
        wprintf (L"RRAS is not running on %s.\n", pszMachine);
        return dwRes;
    }
     
    // Close RRAS handle. It's not needed.
    MprAdminServerDisconnect(&phMprServer);
 
    // Check to see if pszMachine is a RAS server for the domain
    dwRes = MprAdminIsDomainRasServer (pszDomain, pszMachine, &bIsRegistered);
    if (dwRes != ERROR_SUCCESS){
        //
        // Handle errors here
        //
       return dwRes;
    }

    if (bIsRegistered == TRUE){
        wprintf (L"The RRAS Server on %s is already registered in domain %s.\n", pszMachine, pszDomain);
        return ERROR_SUCCESS;
    }

    wprintf (L"The RRAS Server on %s is NOT registered in domain %s. Registering now...\n", pszMachine, pszDomain);
    dwRes = MprAdminEstablishDomainRasServer (pszDomain, pszMachine, TRUE);
    if (dwRes != ERROR_SUCCESS){
        //
        // Handle errors here
        //
        return dwRes;
    }
    return ERROR_SUCCESS;
}

요구 사항

요구 사항
지원되는 최소 클라이언트 지원되는 버전 없음
지원되는 최소 서버 Windows Server 2003 [데스크톱 앱만 해당]
대상 플랫폼 Windows
헤더 mprapi.h
라이브러리 Mprapi.lib
DLL Mprapi.dll

추가 정보

라우터 관리 함수

라우터 관리 참조