Share via


ACTIVATION_CONTEXT_DETAILED_INFORMATION struttura (winnt.h)

La struttura ACTIVATION_CONTEXT_DETAILED_INFORMATION viene usata dalla funzione QueryActCtxW .

Sintassi

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;

Members

dwFlags

Il valore è sempre 0 .

ulFormatVersion

Questo valore specifica il formato delle informazioni restituite. In Windows XP e Windows Server 2003 questo membro è sempre 1.

ulAssemblyCount

Numero di assembly nel contesto di attivazione.

ulRootManifestPathType

Specifica il tipo di percorso da cui è stato caricato il manifesto dell'assembly.

Questo membro è sempre una delle costanti seguenti:

ulRootManifestPathChars

Numero di caratteri nel percorso del manifesto.

ulRootConfigurationPathType

Specifica il tipo di percorso da cui è stato caricato il manifesto di configurazione dell'assembly.

Questo membro è sempre una delle costanti seguenti:

ulRootConfigurationPathChars

Numero di caratteri in qualsiasi percorso del file di configurazione dell'applicazione.

ulAppDirPathType

Specifica il tipo di percorso da cui è stato caricato il manifesto dell'applicazione.

Questo membro è sempre una delle costanti seguenti:

ulAppDirPathChars

Numero di caratteri nella directory dell'applicazione.

lpRootManifestPath

Percorso del manifesto dell'applicazione.

lpRootConfigurationPath

Percorso del file di configurazione.

lpAppDirPath

Percorso della directory dell'applicazione.

Commenti

Se QueryActCtxW viene chiamato con l'opzione ActivationContextDetailedInformation e la funzione ha esito positivo, le informazioni nel buffer restituito sono sotto forma di struttura ACTIVATION_CONTEXT_DETAILED_INFORMATION . Di seguito è riportato un esempio di struttura usata per contenere informazioni dettagliate sul contesto di attivazione e una chiamata da 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;
    }


Requisiti

Requisito Valore
Client minimo supportato Windows XP [solo app desktop]
Server minimo supportato Windows Server 2003 [solo app desktop]
Intestazione winnt.h (includere Windows.h)