// // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved // // *************************************************************************** // // Original Author: Rajesh Rao // // $Author: rajeshr $ // $Date: 6/11/98 4:43p $ // $Workfile:adsiclas.cpp $ // // $Modtime: 6/11/98 11:21a $ // $Revision: 1 $ // $Nokeywords: $ // // // Description: Contains the implementation of the CADSIClass which encapsulates an ADSI class // //*************************************************************************** #include "precomp.h" //*************************************************************************** // // CADSIClass::CADSIClass // // Purpose : Constructor // // Parameters: // lpszWBEMClassName : The WBEM name of the Class being created. A copy of this is made // lpszADSIClassName : The ADSI name of the Class being created. A copy of this is made //*************************************************************************** CADSIClass :: CADSIClass(LPCWSTR lpszWBEMClassName, LPCWSTR lpszADSIClassName) : CRefCountedObject(lpszADSIClassName) { if(lpszWBEMClassName) { m_lpszWBEMClassName = new WCHAR[wcslen(lpszWBEMClassName) + 1]; wcscpy(m_lpszWBEMClassName, lpszWBEMClassName); } else { m_lpszWBEMClassName = NULL; } // Set the attributes to theri default values m_lpszCommonName = NULL; m_lpszSuperClassLDAPName = NULL; m_lpszGovernsID = NULL; m_pSchemaIDGUIDOctets = NULL; m_dwSchemaIDGUIDLength = 0; m_lpszRDNAttribute = NULL; m_lpszDefaultSecurityDescriptor = NULL; m_dwObjectClassCategory = 0; m_dwNTSecurityDescriptorLength = 0; m_pNTSecurityDescriptor = NULL; m_lpszDefaultObjectCategory = NULL; m_bSystemOnly = FALSE; // Initialize the property book keeping m_lppszAuxiliaryClasses = NULL; m_dwAuxiliaryClassesCount = 0; m_lppszSystemAuxiliaryClasses = NULL; m_dwSystemAuxiliaryClassesCount = 0; m_lppszPossibleSuperiors = NULL; m_dwPossibleSuperiorsCount = 0; m_lppszSystemPossibleSuperiors = NULL; m_dwSystemPossibleSuperiorsCount = 0; m_lppszMayContains = NULL; m_dwMayContainsCount = 0; m_lppszSystemMayContains = NULL; m_dwSystemMayContainsCount = 0; m_lppszMustContains = NULL; m_dwMustContainsCount = 0; m_lppszSystemMustContains = NULL; m_dwSystemMustContainsCount = 0; } //*************************************************************************** // // CADSIClass :: ~CADSIClass // // Purpose : Destructor //*************************************************************************** CADSIClass :: ~CADSIClass() { // Delete the WBEM Name. The ADSI Name is deleted in the base class destructor if ( m_lpszWBEMClassName ) { delete [] m_lpszWBEMClassName; m_lpszWBEMClassName = NULL; } // Delete the attributes if ( m_lpszCommonName ) { delete [] m_lpszCommonName; m_lpszCommonName = NULL; } if ( m_lpszSuperClassLDAPName ) { delete [] m_lpszSuperClassLDAPName; m_lpszSuperClassLDAPName = NULL; } if ( m_lpszGovernsID ) { delete [] m_lpszGovernsID; m_lpszGovernsID = NULL; } if ( m_pSchemaIDGUIDOctets ) { delete [] m_pSchemaIDGUIDOctets; m_pSchemaIDGUIDOctets = NULL; } if ( m_lpszRDNAttribute ) { delete [] m_lpszRDNAttribute; m_lpszRDNAttribute = NULL; } if ( m_lpszDefaultSecurityDescriptor ) { delete [] m_lpszDefaultSecurityDescriptor; m_lpszDefaultSecurityDescriptor = NULL; } if ( m_pNTSecurityDescriptor ) { delete [] m_pNTSecurityDescriptor; m_pNTSecurityDescriptor = NULL; } if ( m_lpszDefaultObjectCategory ) { delete [] m_lpszDefaultObjectCategory; m_lpszDefaultObjectCategory = NULL; } DWORD i; // Delete the list of Auxiliary Classes if ( m_lppszAuxiliaryClasses ) { for(i=0; iCaseIgnoreString) + 1]; wcscpy(m_lppszAuxiliaryClasses[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszAuxiliaryClasses ) { m_dwAuxiliaryClassesCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszAuxiliaryClasses [ dw ] ) { delete [] m_lppszAuxiliaryClasses [ dw ]; m_lppszAuxiliaryClasses [ dw ] = NULL; } } delete [] m_lppszAuxiliaryClasses; m_lppszAuxiliaryClasses = NULL; } throw; } pValues ++; } } //*************************************************************************** // // CADSIClass :: GetSystemAuxiliaryClasses // // Purpose : See Header //*************************************************************************** LPCWSTR *CADSIClass :: GetSystemAuxiliaryClasses(DWORD *pdwCount) { *pdwCount = m_dwSystemAuxiliaryClassesCount; return (LPCWSTR *)m_lppszSystemAuxiliaryClasses; } //*************************************************************************** // // CADSIClass :: SetSystemAuxiliaryClasses // // Purpose : See Header //*************************************************************************** void CADSIClass :: SetSystemAuxiliaryClasses(PADSVALUE pValues, DWORD dwNumValues) { DWORD i = 0; // Delete the list of possible superiors if ( m_lppszSystemAuxiliaryClasses ) { for ( i = 0; iCaseIgnoreString) + 1]; wcscpy(m_lppszSystemAuxiliaryClasses[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszSystemAuxiliaryClasses ) { m_dwSystemAuxiliaryClassesCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszSystemAuxiliaryClasses [ dw ] ) { delete [] m_lppszSystemAuxiliaryClasses [ dw ]; m_lppszSystemAuxiliaryClasses [ dw ] = NULL; } } delete [] m_lppszSystemAuxiliaryClasses; m_lppszSystemAuxiliaryClasses = NULL; } throw; } pValues ++; } } //*************************************************************************** // // CADSIClass :: GetPossibleSuperiors // // Purpose : See Header //*************************************************************************** LPCWSTR *CADSIClass :: GetPossibleSuperiors(DWORD *pdwCount) { *pdwCount = m_dwPossibleSuperiorsCount; return (LPCWSTR *)m_lppszPossibleSuperiors; } //*************************************************************************** // // CADSIClass :: SetPossibleSuperiors // // Purpose : See Header //*************************************************************************** void CADSIClass :: SetPossibleSuperiors(PADSVALUE pValues, DWORD dwNumValues) { DWORD i = 0; // Delete the list of possible superiors if ( m_lppszPossibleSuperiors ) { for ( i = 0; iCaseIgnoreString) + 1]; wcscpy(m_lppszPossibleSuperiors[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszPossibleSuperiors ) { m_dwPossibleSuperiorsCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszPossibleSuperiors [ dw ] ) { delete [] m_lppszPossibleSuperiors [ dw ]; m_lppszPossibleSuperiors [ dw ] = NULL; } } delete [] m_lppszPossibleSuperiors; m_lppszPossibleSuperiors = NULL; } throw; } pValues ++; } } //*************************************************************************** // // CADSIClass :: GetSystemPossibleSuperiors // // Purpose : See Header //*************************************************************************** LPCWSTR *CADSIClass :: GetSystemPossibleSuperiors(DWORD *pdwCount) { *pdwCount = m_dwSystemPossibleSuperiorsCount; return (LPCWSTR *)m_lppszSystemPossibleSuperiors; } //*************************************************************************** // // CADSIClass :: SetSystemPossibleSuperiors // // Purpose : See Header //*************************************************************************** void CADSIClass :: SetSystemPossibleSuperiors(PADSVALUE pValues, DWORD dwNumValues) { DWORD i = 0; // Delete the list of possible superiors if ( m_lppszSystemPossibleSuperiors ) { for ( i = 0; iCaseIgnoreString) + 1]; wcscpy(m_lppszSystemPossibleSuperiors[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszSystemPossibleSuperiors ) { m_dwSystemPossibleSuperiorsCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszSystemPossibleSuperiors [ dw ] ) { delete [] m_lppszSystemPossibleSuperiors [ dw ]; m_lppszSystemPossibleSuperiors [ dw ] = NULL; } } delete [] m_lppszSystemPossibleSuperiors; m_lppszSystemPossibleSuperiors = NULL; } throw; } pValues ++; } } //*************************************************************************** // // CADSIClass :: GetMayContains // // Purpose : See Header //*************************************************************************** LPCWSTR *CADSIClass :: GetMayContains(DWORD *pdwCount) { *pdwCount = m_dwMayContainsCount; return (LPCWSTR *)m_lppszMayContains; } //*************************************************************************** // // CADSIClass :: SetMayContains // // Purpose : See Header //*************************************************************************** void CADSIClass :: SetMayContains(PADSVALUE pValues, DWORD dwNumValues) { DWORD i = 0; // Delete the list of possible superiors if ( m_lppszMayContains ) { for ( i = 0; iCaseIgnoreString) + 1]; wcscpy(m_lppszMayContains[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszMayContains ) { m_dwMayContainsCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszMayContains [ dw ] ) { delete [] m_lppszMayContains [ dw ]; m_lppszMayContains [ dw ] = NULL; } } delete [] m_lppszMayContains; m_lppszMayContains = NULL; } throw; } pValues ++; } } //*************************************************************************** // // CADSIClass :: GetSystemMayContains // // Purpose : See Header //*************************************************************************** LPCWSTR *CADSIClass :: GetSystemMayContains(DWORD *pdwCount) { *pdwCount = m_dwSystemMayContainsCount; return (LPCWSTR *)m_lppszSystemMayContains; } //*************************************************************************** // // CADSIClass :: SetSystemMayContains // // Purpose : See Header //*************************************************************************** void CADSIClass :: SetSystemMayContains(PADSVALUE pValues, DWORD dwNumValues) { DWORD i = 0; // Delete the list of possible superiors if ( m_lppszSystemMayContains ) { for ( i = 0; iCaseIgnoreString) + 1]; wcscpy(m_lppszSystemMayContains[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszSystemMayContains ) { m_dwSystemMayContainsCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszSystemMayContains [ dw ] ) { delete [] m_lppszSystemMayContains [ dw ]; m_lppszSystemMayContains [ dw ] = NULL; } } delete [] m_lppszSystemMayContains; m_lppszSystemMayContains = NULL; } throw; } pValues ++; } } //*************************************************************************** // // CADSIClass :: GetMustContains // // Purpose : See Header //*************************************************************************** LPCWSTR *CADSIClass :: GetMustContains(DWORD *pdwCount) { *pdwCount = m_dwMustContainsCount; return (LPCWSTR *)m_lppszMustContains; } //*************************************************************************** // // CADSIClass :: SetMustContains // // Purpose : See Header //*************************************************************************** void CADSIClass :: SetMustContains(PADSVALUE pValues, DWORD dwNumValues) { DWORD i = 0; // Delete the list of possible superiors if ( m_lppszMustContains ) { for ( i = 0; iCaseIgnoreString) + 1]; wcscpy(m_lppszMustContains[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszMustContains ) { m_dwMustContainsCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszMustContains [ dw ] ) { delete [] m_lppszMustContains [ dw ]; m_lppszMustContains [ dw ] = NULL; } } delete [] m_lppszMustContains; m_lppszMustContains = NULL; } throw; } pValues ++; } } //*************************************************************************** // // CADSIClass :: GetSystemMustContains // // Purpose : See Header //*************************************************************************** LPCWSTR *CADSIClass :: GetSystemMustContains(DWORD *pdwCount) { *pdwCount = m_dwSystemMustContainsCount; return (LPCWSTR *)m_lppszSystemMustContains; } //*************************************************************************** // // CADSIClass :: SetSystemMustContains // // Purpose : See Header //*************************************************************************** void CADSIClass :: SetSystemMustContains(PADSVALUE pValues, DWORD dwNumValues) { DWORD i = 0; // Delete the list of possible superiors if ( m_lppszSystemMustContains ) { for ( i = 0; iCaseIgnoreString) + 1]; wcscpy(m_lppszSystemMustContains[i], pValues->CaseIgnoreString); } catch ( ... ) { if ( m_lppszSystemMustContains ) { m_dwSystemMustContainsCount = 0; for ( DWORD dw = 0; dw < i; dw++ ) { if ( m_lppszSystemMustContains [ dw ] ) { delete [] m_lppszSystemMustContains [ dw ]; m_lppszSystemMustContains [ dw ] = NULL; } } delete [] m_lppszSystemMustContains; m_lppszSystemMustContains = NULL; } throw; } pValues ++; } }