ACLCLS.CPP
// --aclcls.cpp------------------------------------------------------------- 
// 
//  API entry points into the ACL Class Library (aclcls). 
// 
//  Copyright (C) Microsoft Corp. 1986-1996.  All rights reserved. 
// 
// --------------------------------------------------------------------------- 
 
#include "edk.h" 
#include "srowlst.h" 
#include "aclclsf.h" 
 
#include "aclcls.chk" 
 
// 
// Functions 
// 
 
// $--HrFolderACLsOpen----------------------------------------------------- 
// 
// DESCRIPTION:Get a ptr to an object which implements the IExchangeFolderACLs 
//interface defined in aclcls.h. 
// 
// INPUT: 
// 
//  [lpSession]         -- Pointer to MAPI session. 
//  [lpMDB]-- Ptr to message store containing folder. 
//  [cbentryid]-- Number of bytes in folder's entry identifier. 
//  [lpentryid]-- Folder's entry identifier. 
// 
// OUTPUT: 
// 
//  [lppFolderACLs]-- Ptr to object which supports interface; 
//   NULL if none. 
// 
// RETURNS:     NOERRORif successful; 
//E_INVALIDARGif bad input; 
//E_OUTOFMEMORYif not enough memory; 
//E_NOINTERFACEif acl table does not exist on folder; 
//              E_FAILotherwise. 
// 
//----------------------------------------------------------------------------- 
 
STDAPI 
HrFolderACLsOpen(// RETURNS: HRESULT 
    IN      LPMAPISESSION       lpSession,      // MAPI session pointer 
    INLPMDBlpMDB,// MAPI MDB store ptr 
INULONGcbentryid,// # bytes in entry ID 
INLPENTRYIDlpentryid,// entry ID ptr 
OUTLPFOLDERACLS FAR *lppFolderACLs// IExchangeFolderACLs ptr ptr 
) 
{ 
    HRESULThr =NOERROR; 
    CFolderACLs FAR *pFolderACLs =NULL; 
 
    DEBUGPUBLIC("HrFolderACLsOpen().\n"); 
 
    hr = CHK_HrFolderACLsOpen(cbentryid, lpentryid, lppFolderACLs); 
 
    if (FAILED(hr)) 
        RETURN(hr);         
 
    *lppFolderACLs = NULL; 
 
    // Initialize controlling class object. 
 
    pFolderACLs = new CFolderACLs(); 
 
if (pFolderACLs == NULL) 
    { 
        hr = HR_LOG(E_OUTOFMEMORY); 
 
        goto cleanup; 
    } 
 
// Open the folder in the controlling class object. 
 
hr = pFolderACLs->HrOpen(lpSession, lpMDB, cbentryid, lpentryid); 
 
if (FAILED(hr)) 
goto cleanup; 
 
    // Give the user access to the programmer interface (CIExchangeFolderACLs) 
    // on the controlling CFolderACLs object.     
 
    hr = pFolderACLs->QueryInterface(IID_IExchangeFolderACLs, 
 (LPVOID FAR *)lppFolderACLs); 
    // Ref count now 2. 
 
    if (FAILED(hr)) 
        goto cleanup; 
 
    ASSERT_READ_PTR_OR_NULL(*lppFolderACLs, sizeof(LPFOLDERACLS), 
                             "Bad lppFolderACLs."); 
 
cleanup: 
 
    // Release our copy of the CFolderACLs object.   
 
    ULRELEASE(pFolderACLs);// Ref count now 1. 
 
    RETURN(hr); 
}