Share via


struttura ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION (winnt.h)

La struttura ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION viene usata dalla funzione QueryActCtxW .

Sintassi

typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
  DWORD         ulFlags;
  DWORD         ulEncodedAssemblyIdentityLength;
  DWORD         ulManifestPathType;
  DWORD         ulManifestPathLength;
  LARGE_INTEGER liManifestLastWriteTime;
  DWORD         ulPolicyPathType;
  DWORD         ulPolicyPathLength;
  LARGE_INTEGER liPolicyLastWriteTime;
  DWORD         ulMetadataSatelliteRosterIndex;
  DWORD         ulManifestVersionMajor;
  DWORD         ulManifestVersionMinor;
  DWORD         ulPolicyVersionMajor;
  DWORD         ulPolicyVersionMinor;
  DWORD         ulAssemblyDirectoryNameLength;
  PCWSTR        lpAssemblyEncodedAssemblyIdentity;
  PCWSTR        lpAssemblyManifestPath;
  PCWSTR        lpAssemblyPolicyPath;
  PCWSTR        lpAssemblyDirectoryName;
  DWORD         ulFileCount;
} ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;

Members

ulFlags

Il valore è sempre 0 .

ulEncodedAssemblyIdentityLength

Lunghezza dell'identità dell'assembly codificata in byte.

ulManifestPathType

Questo valore è sempre una costante.

ulManifestPathLength

Lunghezza in byte del percorso del manifesto dell'assembly.

liManifestLastWriteTime

Ora dell'ultima scrittura del manifesto. Si tratta di una struttura di dati FILETIME .

ulPolicyPathType

Questo valore è sempre una costante.

ulPolicyPathLength

Lunghezza in byte del percorso dei criteri dell'editore.

liPolicyLastWriteTime

L'ultima volta che il criterio è stato scritto. Si tratta di una struttura di dati FILETIME .

ulMetadataSatelliteRosterIndex

Indice del roster satellite dei metadati.

ulManifestVersionMajor

Versione principale dell'assembly sottoposto a query da QueryActCtxW. Per altre informazioni, vedere Versioni assembly.

ulManifestVersionMinor

Versione secondaria dell'assembly sottoposto a query da QueryActCtxW. Per altre informazioni, vedere Versioni assembly.

ulPolicyVersionMajor

Versione principale di qualsiasi criterio, se presente.

ulPolicyVersionMinor

Versione secondaria di qualsiasi criterio, se presente.

ulAssemblyDirectoryNameLength

Lunghezza in byte del nome della directory dell'assembly.

lpAssemblyEncodedAssemblyIdentity

Puntatore a una stringa con terminazione Null che contiene un formato con codifica textually dell'identità dell'assembly.

lpAssemblyManifestPath

Puntatore a una stringa con terminazione Null che indica il percorso originale del manifesto dell'assembly.

lpAssemblyPolicyPath

Puntatore a una stringa con terminazione Null che indica il percorso dell'assembly dei criteri usato per determinare che deve essere caricata questa versione dell'assembly. Se questo membro è Null, non è stato usato alcun criterio per decidere di caricare questa versione.

lpAssemblyDirectoryName

Puntatore a una stringa con terminazione Null che indica la cartella da cui è stato caricato l'assembly.

ulFileCount

Commenti

Se QueryActCtxW viene chiamato con l'opzione AssemblyDetailedInformationInActivationContext e la funzione ha esito positivo, le informazioni nel buffer restituito sono sotto forma di struttura ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION .

PACTIVATION_CONTEXT_ASSEMBLY_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_ASSEMBLY_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 (include Windows.h)