CAtlServiceModuleT::InitializeSecurity
提供服務的預設安全性設定。
HRESULT InitializeSecurity( ) throw( );
傳回值
如果成功則傳回 S_OK 或在失敗的錯誤 HRESULT。
備註
在 Visual Studio .NET 2003.,這個方法會在基底類別不會實作。Visual Studio 專案精靈在產生的程式碼包含這個方法,不過,則會發生編譯錯誤。使用 ATL 7.1,則為,如果在 Visual C++ 舊版建立的專案中編譯。從 CAtlServiceModuleT 任何衍生自類別的類別必須在衍生類別中實作這個方法。
使用 PKT 層級驗證、RPC_C_IMP_LEVEL_IDENTIFY 的模擬等級與適當的非 null 的安全性描述元中對 CoInitializeSecurity。
如需精靈產生的非屬性化專案服務,這
class CNonAttribServiceModule : public CAtlServiceModuleT< CNonAttribServiceModule, IDS_SERVICENAME >
{
public :
DECLARE_LIBID(LIBID_NonAttribServiceLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_NONATTRIBSERVICE, "{29160736-339F-4A1C-ABEF-C320CE103E12}")
HRESULT InitializeSecurity() throw()
{
// TODO : Call CoInitializeSecurity and provide the appropriate security settings for
// your service
// Suggested - PKT Level Authentication,
// Impersonation Level of RPC_C_IMP_LEVEL_IDENTIFY
// and an appropiate Non NULL Security Descriptor.
return S_OK;
}
};
如需使用屬性的服務,這個專案
[ module(SERVICE, uuid = "{D3103322-7B70-4581-8E59-12769BD9A62B}",
name = "AttribService",
helpstring = "AttribService 1.0 Type Library",
resource_name="IDS_SERVICENAME") ]
class CAttribServiceModule
{
public:
HRESULT InitializeSecurity() throw()
{
// TODO : Call CoInitializeSecurity and provide the appropriate security settings for
// your service
// Suggested - PKT Level Authentication,
// Impersonation Level of RPC_C_IMP_LEVEL_IDENTIFY
// and an appropiate Non NULL Security Descriptor.
return S_OK;
}
};
需求
Header: atlbase.h