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