Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C++
Reference
Libraries Reference
ATL
Classes
Methods
 CAtlServiceModuleT::InitializeSecur...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
ATL Library Reference 
CAtlServiceModuleT::InitializeSecurity 

Provides the default security settings for the service.

HRESULT InitializeSecurity( ) throw( );

Returns S_OK on success, or an error HRESULT on failure.

In Visual Studio .NET 2003, this method is not implemented in the base class. The Visual Studio project wizard includes this method in the generated code, but a compilation error will occur if a project created in an earlier version of Visual C++ is compiled using ATL 7.1. Any class that derives from CAtlServiceModuleT must implement this method in the derived class. The method has to call CoInitializeSecurity and provide the appropriate security settings for the service.

Use PKT-level authentication, impersonation level of RPC_C_IMP_LEVEL_IDENTIFY and an appropriate non-null security descriptor in the call to CoInitializeSecurity.

For wizard-generated nonattributed service projects, this would be in

class CXXXModule : public CAtlServiceModuleT< CXXXModule, IDS_SERVICENAME > // XXX is the Project Name
{
public :
   DECLARE_LIBID(...)
   DECLARE_REGISTRY_APPID_RESOURCEID(...)
   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;
   }
};

For attributed service projects, this would be in

[module(service, ...)] // Comment out any ; after the ]
class CXXXModule // XXX is the Project Name
{
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;
   }
};
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker