PROPLIST.H

///////////////////////////////////////////////////////////////////////////// 
//
//Copyright (c) 1997 <company name>
//
//Module Name:
//PropList.h
//
//Abstract:
//Definition of the CClusPropList class.
//
//Implementation File:
//PropList.cpp
//
//Author:
//<name> (<e-mail name>) Mmmm DD, 1997
//
//Revision History:
//
//Notes:
//
/////////////////////////////////////////////////////////////////////////////

#ifndef _PROPLIST_H_
#define _PROPLIST_H_

/////////////////////////////////////////////////////////////////////////////
// Include Files
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
// Forward Class Declarations
/////////////////////////////////////////////////////////////////////////////

class CClusPropList;

/////////////////////////////////////////////////////////////////////////////
// External Class Declarations
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
// CObjectProperty
/////////////////////////////////////////////////////////////////////////////

#pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union

class CObjectProperty
{
public:
LPCWSTRm_pwszName;
CLUSTER_PROPERTY_FORMATm_propFormat;

union CValue
{
CString *pstr;
DWORD *pdw;
BOOL *pb;
struct
{
PBYTE *ppb;
DWORD *pcb;
};
};
CValuem_value;
CValuem_valuePrev;

voidSet(
IN LPCWSTR pwszName,
IN CString & rstrValue,
IN CString & rstrPrevValue
)
{
m_pwszName = pwszName;
m_propFormat = CLUSPROP_FORMAT_SZ;
m_value.pstr = &rstrValue;
m_value.pcb = NULL;
m_valuePrev.pstr = &rstrPrevValue;
m_valuePrev.pcb = NULL;
}

voidSet(
IN LPCWSTR pwszName,
IN DWORD & rdwValue,
IN DWORD & rdwPrevValue
)
{
m_pwszName = pwszName;
m_propFormat = CLUSPROP_FORMAT_DWORD;
m_value.pdw = &rdwValue;
m_value.pcb = NULL;
m_valuePrev.pdw = &rdwPrevValue;
m_valuePrev.pcb = NULL;
}

voidSet(
IN LPCWSTR pwszName,
IN BOOL & rbValue,
IN BOOL & rbPrevValue
)
{
m_pwszName = pwszName;
m_propFormat = CLUSPROP_FORMAT_DWORD;
m_value.pb = &rbValue;
m_value.pcb = NULL;
m_valuePrev.pb = &rbPrevValue;
m_valuePrev.pcb = NULL;
}

voidSet(
IN LPCWSTR pwszName,
IN PBYTE & rpbValue,
IN DWORD & rcbValue,
IN PBYTE & rpbPrevValue,
IN DWORD & rcbPrevValue
)
{
m_pwszName = pwszName;
m_propFormat = CLUSPROP_FORMAT_BINARY;
m_value.ppb = &rpbValue;
m_value.pcb = &rcbValue;
m_valuePrev.ppb = &rpbPrevValue;
m_valuePrev.pcb = &rcbPrevValue;
}

voidSet(
IN LPCWSTR pwszName,
IN LPWSTR & rpwszValue,
IN DWORD & rcbValue,
IN LPWSTR & rpwszPrevValue,
IN DWORD & rcbPrevValue
)
{
m_pwszName = pwszName;
m_propFormat = CLUSPROP_FORMAT_MULTI_SZ;
m_value.ppb = (PBYTE *) &rpwszValue;
m_value.pcb = &rcbValue;
m_valuePrev.ppb = (PBYTE *) &rpwszPrevValue;
m_valuePrev.pcb = &rcbPrevValue;
}

}; //*** class CObjectProperty

/////////////////////////////////////////////////////////////////////////////
// CClusPropList dialog
/////////////////////////////////////////////////////////////////////////////

class CClusPropList : public CObject
{
DECLARE_DYNAMIC(CClusPropList);

// Construction
public:
CClusPropList(IN BOOL bAlwaysAddProp = FALSE);
~CClusPropList(void);

// Attributes
protected:
BOOLm_bAlwaysAddProp;

CLUSPROP_BUFFER_HELPERm_proplist;
CLUSPROP_BUFFER_HELPERm_propCurrent;
DWORDm_cbBufferSize;
DWORDm_cbDataSize;

public:
const CLUSPROP_BUFFER_HELPER const *Proplist(void) const{ return &m_proplist; }
PBYTEPbProplist(void) const{ return m_proplist.pb; }
DWORDCbProplist(void) const{ return m_cbDataSize + sizeof(CLUSPROP_SYNTAX); /*endmark*/ }
DWORDCprops(void) const
{
if (m_proplist.pb == NULL)
return 0;
return m_proplist.pList->nPropertyCount;
}

voidAddProp(
IN LPCWSTRpwszName,
IN const CString &rstrValue,
IN const CString &rstrPrevValue
);
voidAddProp(
IN LPCWSTRpwszName,
IN DWORDdwValue,
IN DWORDdwPrevValue
);
voidAddProp(
IN LPCWSTRpwszName,
IN const PBYTEpbValue,
IN DWORDcbValue,
IN const PBYTEpbPrevValue,
IN DWORDcbPrevValue
);

voidAllocPropList(IN DWORD cbMinimum);

// Operations
public:
DWORDDwGetNodeProperties(
IN HNODEhNode,
IN DWORDdwControlCode,
IN HNODEhHostNode= NULL,
IN LPVOIDlpInBuffer= NULL,
IN DWORDcbInBufferSize= 0
);

DWORDDwGetGroupProperties(
IN HGROUPhGroup,
IN DWORDdwControlCode,
IN HNODEhHostNode= NULL,
IN LPVOIDlpInBuffer= NULL,
IN DWORDcbInBufferSize= 0
);

DWORDDwGetResourceProperties(
IN HRESOURCEhResource,
IN DWORDdwControlCode,
IN HNODEhHostNode= NULL,
IN LPVOIDlpInBuffer= NULL,
IN DWORDcbInBufferSize= 0
);

DWORDDwGetResourceTypeProperties(
IN HCLUSTERhCluster,
IN LPCWSTRpwszResTypeName,
IN DWORDdwControlCode,
IN HNODEhHostNode= NULL,
IN LPVOIDlpInBuffer= NULL,
IN DWORDcbInBufferSize= 0
);

DWORDDwGetNetworkProperties(
IN HNETWORKhNetwork,
IN DWORDdwControlCode,
IN HNODEhHostNode= NULL,
IN LPVOIDlpInBuffer= NULL,
IN DWORDcbInBufferSize= 0
);

DWORDDwGetNetInterfaceProperties(
IN HNETINTERFACEhNetInterface,
IN DWORDdwControlCode,
IN HNODEhHostNode= NULL,
IN LPVOIDlpInBuffer= NULL,
IN DWORDcbInBufferSize= 0
);

// Overrides

// Implementation
protected:
voidCopyProp(
IN PCLUSPROP_SZpprop,
IN CLUSTER_PROPERTY_TYPEproptype,
IN LPCWSTRpwsz,
IN DWORDcbsz = 0
);
voidCopyProp(
IN PCLUSPROP_DWORDpprop,
IN CLUSTER_PROPERTY_TYPEproptype,
IN DWORDdw
);
voidCopyProp(
IN PCLUSPROP_BINARYpprop,
IN CLUSTER_PROPERTY_TYPEproptype,
IN const PBYTEpb,
IN DWORDcb
);

DWORDDwGetPrivateProps(
OUT PBYTE *ppbProps,
IN CLUSTER_CONTROL_OBJECTccobjtype = CLUS_OBJECT_RESOURCE
);
DWORDDwSetPrivateProps(
IN PBYTEpbProps,
IN DWORDcbProps,
IN CLUSTER_CONTROL_OBJECTccobjtype = CLUS_OBJECT_RESOURCE
);

}; //*** class CClusPropList

#pragma warning( default : 4201 )

/////////////////////////////////////////////////////////////////////////////

#endif // _PROPLIST_H_