다음을 통해 공유


ACTIVATION_CONTEXT_DETAILED_INFORMATION 구조체(winnt.h)

ACTIVATION_CONTEXT_DETAILED_INFORMATION 구조체는 QueryActCtxW 함수에서 사용됩니다.

구문

typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
  DWORD  dwFlags;
  DWORD  ulFormatVersion;
  DWORD  ulAssemblyCount;
  DWORD  ulRootManifestPathType;
  DWORD  ulRootManifestPathChars;
  DWORD  ulRootConfigurationPathType;
  DWORD  ulRootConfigurationPathChars;
  DWORD  ulAppDirPathType;
  DWORD  ulAppDirPathChars;
  PCWSTR lpRootManifestPath;
  PCWSTR lpRootConfigurationPath;
  PCWSTR lpAppDirPath;
} ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;

멤버

dwFlags

이 값은 항상 0입니다.

ulFormatVersion

이 값은 반환된 정보의 형식을 지정합니다. Windows XP 및 Windows Server 2003에서 이 멤버는 항상 1입니다.

ulAssemblyCount

활성화 컨텍스트의 어셈블리 수입니다.

ulRootManifestPathType

이 어셈블리의 매니페스트가 로드된 경로의 종류를 지정합니다.

이 멤버는 항상 다음 상수 중 하나입니다.

ulRootManifestPathChars

매니페스트 경로의 문자 수입니다.

ulRootConfigurationPathType

이 어셈블리의 애플리케이션 구성 매니페스트가 로드된 경로의 종류를 지정합니다.

이 멤버는 항상 다음 상수 중 하나입니다.

ulRootConfigurationPathChars

애플리케이션 구성 파일 경로의 문자 수입니다.

ulAppDirPathType

이 애플리케이션 매니페스트가 로드된 경로의 종류를 지정합니다.

이 멤버는 항상 다음 상수 중 하나입니다.

ulAppDirPathChars

애플리케이션 디렉터리의 문자 수입니다.

lpRootManifestPath

애플리케이션 매니페스트의 경로입니다.

lpRootConfigurationPath

구성 파일의 경로입니다.

lpAppDirPath

애플리케이션 디렉터리의 경로입니다.

설명

QueryActCtxW가 ActivationContextDetailedInformation 옵션을 사용하여 호출되고 함수가 성공하면 반환된 버퍼의 정보는 ACTIVATION_CONTEXT_DETAILED_INFORMATION 구조체의 형태입니다. 다음은 활성화 컨텍스트에 대한 자세한 정보와 QueryActCtxW의 호출을 보유하는 데 사용되는 구조체의 예입니다.

PACTIVATION_CONTEXT_DETAILED_INFORMATION pAssemblyInfo = NULL;
ACTIVATION_CONTEXT_QUERY_INDEX QueryIndex;
BOOL fSuccess = FALSE;
SIZE_T cbRequired;
HANDLE hActCtx = INVALID_HANDLE_VALUE;
BYTE bTemporaryBuffer[512];
PVOID pvDataBuffer = (PVOID)bTemporaryBuffer;
SIZE_T cbAvailable = sizeof(bTemporaryBuffer);

// Request the first file in the root assembly
QueryIndex.ulAssemblyIndex = 1;
QueryIndex.ulFileIndexInAssembly = 0;

if (GetCurrentActCtx(&hActCtx)) {

    // Attempt to use our stack-based buffer first - if that's not large
    // enough, allocate from the heap and try again.
    fSuccess = QueryActCtxW(
        0, 
        hActCtx, 
        (PVOID)&QueryIndex, 
        AssemblyDetailedInformationInActivationContext,
        pvDataBuffer,
        cbAvailable,
        &cbRequired);

    // Failed, because the buffer was too small.
    if (!fSuccess && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {

        // Allocate what we need from the heap - fail if there isn't enough
        // memory to do so.        
        pvDataBuffer = HeapAlloc(GetProcessHeap(), 0, cbRequired);
        if (pvDataBuffer == NULL) {
            fSuccess = FALSE;
            goto DoneQuerying;
        }
        cbAvailable = cbRequired;

        // If this fails again, exit out.
        fSuccess = QueryActCtxW(
            0, 
            hActCtx,
            (PVOID)&QueryIndex,
            AssemblyDetailedInformationInActivationContext,
            pvDataBuffer,
            cbAvailable,
            &cbRequired);

    }

    if (fSuccess) {
        // Now that we've found the assembly info, cast our target buffer back to
        // the assembly info pointer.  Use pAssemblyInfo->lpFileName
        pAssemblyInfo = (PACTIVATION_CONTEXT_DETAILED_INFORMATION)pvDataBuffer;
    }
}

DoneQuerying:
    if (hActCtx != INVALID_HANDLE_VALUE)
        ReleaseActCtx(hActCtx);

    if (pvDataBuffer && (pvDataBuffer != bTemporaryBuffer)) {
        HeapFree(GetProcessHeap(), 0, pvDataBuffer);
        pvDataBuffer = 0;
    }


요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP [데스크톱 앱만 해당]
지원되는 최소 서버 Windows Server 2003 [데스크톱 앱만 해당]
머리글 winnt.h(Windows.h 포함)