Condividi tramite


unione CLUSPROP_BUFFER_HELPER (clusapi.h)

Usato per compilare o analizzare un elenco di proprietà o un elenco di valori.

Sintassi

typedef union CLUSPROP_BUFFER_HELPER {
  BYTE                          *pb;
  WORD                          *pw;
  DWORD                         *pdw;
  LONG                          *pl;
  LPWSTR                        psz;
  PCLUSPROP_LIST                pList;
  PCLUSPROP_SYNTAX              pSyntax;
  PCLUSPROP_PROPERTY_NAME       pName;
  PCLUSPROP_VALUE               pValue;
  PCLUSPROP_BINARY              pBinaryValue;
  PCLUSPROP_WORD                pWordValue;
  PCLUSPROP_DWORD               pDwordValue;
  PCLUSPROP_LONG                pLongValue;
  PCLUSPROP_ULARGE_INTEGER      pULargeIntegerValue;
  PCLUSPROP_LARGE_INTEGER       pLargeIntegerValue;
  PCLUSPROP_SZ                  pStringValue;
  PCLUSPROP_MULTI_SZ            pMultiSzValue;
  PCLUSPROP_SECURITY_DESCRIPTOR pSecurityDescriptor;
  PCLUSPROP_RESOURCE_CLASS      pResourceClassValue;
  PCLUSPROP_RESOURCE_CLASS_INFO pResourceClassInfoValue;
  PCLUSPROP_DISK_SIGNATURE      pDiskSignatureValue;
  PCLUSPROP_SCSI_ADDRESS        pScsiAddressValue;
  PCLUSPROP_DISK_NUMBER         pDiskNumberValue;
  PCLUSPROP_PARTITION_INFO      pPartitionInfoValue;
  PCLUSPROP_REQUIRED_DEPENDENCY pRequiredDependencyValue;
  PCLUSPROP_PARTITION_INFO_EX   pPartitionInfoValueEx;
  PCLUSPROP_PARTITION_INFO_EX2  pPartitionInfoValueEx2;
  PCLUSPROP_FILETIME            pFileTimeValue;
} CLUSPROP_BUFFER_HELPER, *PCLUSPROP_BUFFER_HELPER;

Members

pb

Puntatore a un buffer contenente una matrice di byte.

pw

Puntatore a un buffer contenente una matrice di valori WORD .

pdw

Puntatore a un buffer contenente una matrice di valori DWORD .

pl

Puntatore a un buffer contenente una matrice di valori lunghi firmati.

psz

Puntatore a un buffer contenente un valore stringa Unicode con terminazione NULL.

pList

Puntatore a una struttura CLUSPROP_LIST che descrive l'inizio di un elenco di proprietà.

pSyntax

Puntatore a una struttura CLUSPROP_SYNTAX che descrive il formato e il tipo di un valore.

pName

Puntatore a una struttura CLUSPROP_PROPERTY_NAME contenente un valore del nome della proprietà.

pValue

Puntatore a una struttura CLUSPROP_VALUE che descrive il formato, il tipo e la lunghezza di un valore di dati.

pBinaryValue

Puntatore a una struttura CLUSPROP_BINARY contenente un valore di dati binario.

pWordValue

Puntatore a una struttura CLUSPROP_WORD contenente un valore numerico.

pDwordValue

Puntatore a una struttura CLUSPROP_DWORD contenente un valore numerico.

pLongValue

Puntatore a una struttura CLUSPROP_LONG contenente un valore long con segno.

pULargeIntegerValue

Puntatore a una struttura CLUSPROP_ULARGE_INTEGER contenente un valore intero di grandi dimensioni senza segno.

pLargeIntegerValue

Puntatore a una struttura CLUSPROP_LARGE_INTEGER contenente un valore intero di grandi dimensioni.

pStringValue

Puntatore a una struttura CLUSPROP_SZ contenente un valore stringa Unicode con terminazione NULL.

pMultiSzValue

Puntatore a una struttura CLUSPROP_MULTI_SZ contenente più valori stringa Unicode con terminazione Null.

pSecurityDescriptor

Puntatore a una struttura CLUSPROP_SECURITY_DESCRIPTOR contenente un descrittore di sicurezza.

pResourceClassValue

Puntatore a una struttura CLUSPROP_RESOURCE_CLASS contenente un valore della classe di risorse.

pResourceClassInfoValue

Puntatore a una struttura CLUSPROP_RESOURCE_CLASS_INFO contenente un valore di informazioni sulla classe di risorse.

pDiskSignatureValue

Puntatore a una struttura CLUSPROP_DISK_SIGNATURE contenente un valore di firma del disco.

pScsiAddressValue

Puntatore a una struttura CLUSPROP_SCSI_ADDRESS contenente un valore di indirizzo SCSI .

pDiskNumberValue

Puntatore a una struttura CLUSPROP_DISK_NUMBER contenente un valore numerico del disco.

pPartitionInfoValue

Puntatore a una struttura CLUSPROP_PARTITION_INFO contenente un valore di informazioni sulla partizione.

pRequiredDependencyValue

Puntatore a una struttura CLUSPROP_REQUIRED_DEPENDENCY contenente un valore di dipendenza della risorsa.

pPartitionInfoValueEx

Puntatore a una struttura CLUSPROP_PARTITION_INFO_EX contenente un valore di informazioni sulla partizione.

pPartitionInfoValueEx2

Puntatore a una struttura CLUSPROP_PARTITION_INFO_EX2 che contiene un valore di informazioni sulla partizione.

Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2 e Windows Server 2008: Questo membro non è disponibile prima della Windows Server 2016.

pFileTimeValue

Puntatore a una struttura CLUSPROP_FILETIME contenente un valore di data/ora.

Commenti

La struttura CLUSPROP_BUFFER_HELPER è utile per l'utilizzo di elenchi di proprietà e valori. Le applicazioni possono usare un puntatore di CLUSPROP_BUFFER_HELPER generico per passare tramite offset tramite le voci di un elenco di proprietà o di un elenco di valori, recuperando o impostando valori senza dover eseguire il cast al tipo di dati appropriato.

Una struttura alternativa, RESUTIL_PROPERTY_ITEM, può essere usata anche per lavorare con più proprietà.

Prestare attenzione quando si fa riferimento a valori interi di grandi dimensioni in strutture allineate con DWORD, ad esempio elenchi di valori, elenchi di proprietà e blocchi di parametri. Per i sistemi basati su Windows Server per Itanium, un valore intero di grandi dimensioni allineato naturalmente inizia sempre su un indirizzo che termina in 0 o 8h. L'allineamento DWORD può causare l'inizio di valori di grandi dimensioni sui limiti non allineati (indirizzi che terminano in 4h o C), causando un errore di allineamento quando i dati vengono letti o scritti. È possibile evitare errori di allineamento gestendo separatamente le parti elevate e basse di valori di grandi dimensioni oppure usando variabili locali, che sono sicuramente allineate in modo naturale.

Esempio

Oltre all'esempio seguente, vedere Creazione di elenchi di proprietà, analisi di elenchi di proprietà, creazione di elenchi di valori e analisi di un elenco di valori.

//////////////////////////////////////////////////////////////////////
//  
//    HOW TO USE CLUSPROP_BUFFER HELPER
//  
//    (1) Position cbh to the next read or write location.
//    (2) Read or write data using an appropriate pointer.
//    (3) Check position within buffer.
//  
//    Repeat (1)(2)(3)
//    
//////////////////////////////////////////////////////////////////////
void ClusDocEx_UsingCBH()
{
    LPVOID lp = LocalAlloc( LPTR, 100 ); // It is important for cbh
                                         // to know the allocated
                                         // size.
    CLUSPROP_BUFFER_HELPER cbh;

   
// ( 1 )
//
//    Position cbh.  The pb member is convenient for
//    targeting single bytes.
//

      cbh.pb = (LPBYTE) lp;     


//
//    The pb member points to the first byte of lp.
//
//    lp -----> 0 0 0 0 0 0 0 0 0 0 0 ... 0 
//
//    cbh.pb-->|-|
//
//
//    Note what happens when different cbh pointer types are used:
//
//                   lp -----> 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 
//
//    cbh.pdw              -->|-------|
//    cbh.psz              -->|-|
//    cbh.pValue           -->|---------------|
//    cbh.pValue->Syntax.dw-->|-------|
//    cbh.pValue->cbLength         -->|-------|
//
//
//    The configuration of bytes that will be affected by a read
//    or write operation depends on the type of pointer used.
//


// ( 2 )
//
//    Read or write data to the present location.  Note how the
//    structure pointers let you "reach over" intervening members.
//

      cbh.pValue->Syntax.dw = CLUSPROP_SYNTAX_LIST_VALUE_DWORD; 
    
      cbh.pValue->cbLength = sizeof( DWORD );

      cbh.pDwordValue->dw  = 0x0000EEEEL;

//
//    Result:   lp ----->| syntax | length |  value  | 0 0 0 0 ... 0 
//


// ( 3 )
//
//    Check your remaining space.  Be sure you have room to advance
//    cbh past the current data and perform a read operation on the
//    next value.
//
      
      DWORD cbPosition = cbh.pb - (LPBYTE) lp;

      DWORD cbAdvance = ClusDocEx_ListEntrySize( sizeof( DWORD ) );  // See "ClusDocEx.h"

      if( ( cbPosition + cbAdvance + sizeof( DWORD ) ) > 100 )
      {
          // handle the fact that there's more data than the reported size of the buffer
      }

//
//    Repeat ( 1 ), ( 2 ), and ( 3 ) for the next value:
// 

      // Position cbh

      cbh.pb += cbAdvance;


      // Write next entry

      cbh.pStringValue->Syntax.dw = CLUSPROP_SYNTAX_LIST_VALUE_SZ;

      cbh.pStringValue->cbLength = ( lstrlenW( L"String Value" ) + 1 ) * sizeof( WCHAR );
      
      StringCchCopyW( cbh.pStringValue->sz, cbh.pStringValue->cbLength, L"String Value" );


      // Check space
      
      cbPosition = cbh.pb - (LPBYTE) lp;

      cbAdvance = ClusDocEx_ListEntrySize( cbh.pStringValue->cbLength ); 

      if( ( cbPosition + cbAdvance + sizeof( DWORD ) ) > 100 )
      {
          // 
      }

//
//    Repeat ( 1 ), ( 2 ), and ( 3 )  until all values have been written or read.
//


      cbh.pb = NULL;

      LocalFree( lp );
}

Requisiti

   
Client minimo supportato Nessuno supportato
Server minimo supportato Windows Server 2008 Enterprise, Windows Server 2008 Datacenter
Intestazione clusapi.h

Vedi anche

CLUSPROP_BINARY

CLUSPROP_DISK_NUMBER

CLUSPROP_DISK_SIGNATURE

CLUSPROP_DWORD

CLUSPROP_LIST

CLUSPROP_MULTI_SZ

CLUSPROP_PARTITION_INFO

CLUSPROP_PROPERTY_NAME

CLUSPROP_REQUIRED_DEPENDENCY

CLUSPROP_RESOURCE_CLASS

CLUSPROP_RESOURCE_CLASS_INFO

CLUSPROP_SCSI_ADDRESS

CLUSPROP_SYNTAX

CLUSPROP_SZ

CLUSPROP_ULARGE_INTEGER

CLUSPROP_VALUE