Programming Establish IIS Site and Virtual Directory (1) (Header)

xiaoxiao2021-03-06  40

// w3svcagent.h: interface for the cw3svcagent class.////

#if! defined (AFX_W3SVCAGENT_H__D10CF1B7_10C9_45DC_95A7_3AAEA1CFE558__included _) # define AFX_W3SVCAGENT_H__D10CF1B7_10C9_45DC_95A7_3AEA1CFE558__included_

#if _MSC_VER> 1000 # prgma overce # endif //_MSC_VER> 1000

#include

const ERRORCODE_CHECKSERVICEERROR = 1; const ERRORCODE_CANNTSTARTSERVICE = 2; const ERRORCODE_NOSERVICE = 3; const ERRORCODE_SUCCESS = 0; class CW3SvcAgent {public: CW3SvcAgent (); virtual ~ CW3SvcAgent (); public: int CheckW3SvcExist (); bool DeleteWebServer (LPCTSTR lpszServerComment); bool CreateWeb Server (LPCTSTSTR LPSZBINDDRESS, LPCTSTSTR LPSZDOMAIN, LPCTSTR LPSZPATHNAME);

bool DeleteVirtualDirectry (LPCTSTR lpszVirtualDirName); bool CreateVirtualDirectry (LPCTSTR lpszVirtualDirName, LPCTSTR lpszDiskPath); bool AddAclToDir (LPTSTR pszDir, LPTSTR pszUserName, DWORD dwAccessRights);

protected: DWORD AddAceToObjectsSecurityDescriptor (LPTSTR pszObjName, // name of object SE_OBJECT_TYPE ObjectType, // type of object LPTSTR pszTrustee, // trustee for new ACE TRUSTEE_FORM TrusteeForm, // format of trustee structure DWORD dwAccessRights, // access mask for new ACE ACCESS_MODE AccessMode, // type of ACE DWORD dwInheritance // inheritance flags for new ACE); // Sample // DWORD dwResult = AddAceToObjectsSecurityDescriptor (// szDirectory [i], // SE_FILE_OBJECT, // szUser, // TRUSTEE_IS_NAME, // dwPermission [i], // Grant_Access, // sub_containers_and_Objects_inherit;};

转载请注明原文地址:https://www.9cbs.com/read-67978.html

New Post(0)