Share via


CertSrvBackupGetDatabaseNamesW 함수(certbcli.h)

CertSrvBackupGetDatabaseNames 함수는 지정된 백업 컨텍스트에 대해 백업해야 하는 Certificate Services 데이터베이스 파일 이름 목록을 검색합니다.

구문

HRESULT CERTBCLI_API CertSrvBackupGetDatabaseNamesW(
  [in]  HCSBC hbc,
  [out] PWSTR *ppwszzAttachmentInformation,
  [out] DWORD *pcbSize
);

매개 변수

[in] hbc

Certificate Services 백업 컨텍스트에 대한 핸들입니다.

[out] ppwszzAttachmentInformation

null로 종료된 데이터베이스 파일 이름 목록을 받을 WCHAR 포인터에 대한 포인터입니다. 모든 파일 이름 뒤에는 null 문자가 있고 목록 끝에는 추가 null 문자가 있습니다. 파일 이름은 UNC 형식 "## \\Server\SharePoint\... Path...\FileName.ext". 디렉터리 이름은 형식이 같지만 후행 "\FileName.ext"가 없습니다. "##" 텍스트는 인증서 서비스 백업 파일 형식(CSBFT_*)을 표시하며 각 UNC 경로에 접두사로 접두사로 null이 아닌 단일 유니코드 문자로 저장됩니다. 형식 태그는 Certbcli.h에 정의되며 이 함수에 대해 다음 값이 될 수 있습니다.

의미
CSBFT_CERTSERVER_DATABASE
경로를 포함한 Certificate Services 데이터베이스 파일 이름입니다.
 

CertSrvBackupFree를 호출하면 할당된 메모리를 해제해야 합니다. 이 함수를 호출하기 전에 *ppwszzAttachmentInformationNULL 로 설정하는 것은 선택 사항입니다.

[out] pcbSize

ppwszzAttachmentInformation의 바이트 수를 지정하는 DWORD 값에 대한 포인터입니다.

반환 값

반환 값은 HRESULT입니다. S_OK 값은 성공을 나타냅니다.

설명

Certadm.dll 이 함수의 이름은 CertSrvBackupGetDatabaseNamesW입니다. GetProcAddress를 호출할 때 이 형식의 이름을 사용해야 합니다. 또한 이 함수는 Certbcli.h 헤더 파일에서 FNCERTSRVBACKUPGETDATABASENAMESW 형식으로 정의됩니다.

예제

FNCERTSRVBACKUPGETDATABASENAMESW* pfnGetDBNames;
char * szGetDBNamesFunc = "CertSrvBackupGetDatabaseNamesW";
WCHAR *    pwszzDBFiles;
DWORD      nListBytes=0;
HRESULT    hr=0;

// Get the address for the desired function.    
// hInst was set by calling LoadLibrary for Certadm.dll.
pfnGetDBNames = (FNCERTSRVBACKUPGETDATABASENAMESW*)
    GetProcAddress(hInst, szGetDBNamesFunc);

if ( NULL == pfnGetDBNames )
{
    printf("Failed GetProcAddress - %s, error=%d\n",
           szGetDBNamesFunc,
           GetLastError() );
    exit(1); // Or other appropriate error action.
}

// Determine the names of the database files.
// hCSBC was set by an earlier call to CertSrvBackupPrepare
hr = pfnGetDBNames(hCSBC, &pwszzDBFiles, &nListBytes);
if (FAILED(hr))
{
    printf("Failed pfnGetDBNames call [%x]\n", hr);
    exit(1); // Or other appropriate error action.
}
else
{
    printf("%d bytes for DB file names\n", nListBytes);
    WCHAR * pwszFile = pwszzDBFiles;
    // Process the list.
    while ( L'\0' != *pwszFile )
    {
        // Use the file name referenced by pwszFile.
        // Here it is merely displayed.
        printf("%02x: %ws\n", *pwszFile, &pwszFile[1]);
        // Move to the next database file name.
        // + 1 moves past the null terminator.
        pwszFile+=(wcslen(pwszFile)) + 1; 
    }
    // Free the allocated memory.
    // pfnBackupFree is the address of the 
    // CertSrvBackupFree function.
    pfnBackupFree(pwszzDBFiles);
}

요구 사항

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

추가 정보

CertSrvBackupFree

CertSrvBackupOpenFile

인증서 서비스 백업 및 복원 함수 사용