ACTIVATION_CONTEXT_DETAILED_INFORMATION structure (winnt.h)

La structure ACTIVATION_CONTEXT_DETAILED_INFORMATION est utilisée par la fonction QueryActCtxW .

Syntaxe

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;

Membres

dwFlags

Cette valeur est toujours 0.

ulFormatVersion

Cette valeur spécifie le format des informations retournées. Sur Windows Xp et Windows Server 2003, ce membre est toujours 1.

ulAssemblyCount

Nombre d’assemblys dans le contexte d’activation.

ulRootManifestPathType

Spécifie le type de chemin d’accès à partir duquel le manifeste de cet assembly a été chargé.

Ce membre est toujours l’une des constantes suivantes :

ulRootManifestPathChars

Nombre de caractères dans le chemin du manifeste.

ulRootConfigurationPathType

Spécifie le type de chemin d’accès à partir duquel le manifeste de configuration d’application de cet assembly a été chargé.

Ce membre est toujours l’une des constantes suivantes :

ulRootConfigurationPathChars

Nombre de caractères dans n’importe quel chemin d’accès au fichier de configuration d’application.

ulAppDirPathType

Spécifie le type de chemin d’accès à partir duquel ce manifeste d’application a été chargé.

Ce membre est toujours l’une des constantes suivantes :

ulAppDirPathChars

Nombre de caractères dans le répertoire de l’application.

lpRootManifestPath

Chemin du manifeste de l’application.

lpRootConfigurationPath

Chemin du fichier de configuration.

lpAppDirPath

Chemin du répertoire de l’application.

Remarques

Si QueryActCtxW est appelé avec l’option ActivationContextDetailedInformation et que la fonction réussit, les informations dans la mémoire tampon retournée sont sous la forme de la structure ACTIVATION_CONTEXT_DETAILED_INFORMATION . Voici un exemple de structure utilisée pour contenir des informations détaillées sur le contexte d’activation et un appel à partir de 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;
    }


Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows XP [applications de bureau uniquement]
Serveur minimal pris en charge Windows Server 2003 [applications de bureau uniquement]
En-tête winnt.h (inclure Windows.h)