![]()
Use VC8 (Visual Studio 2005) to create project is more easy than VC6(VC98), but however we may not CoInitialize ATL service as well. It always happen failed since you use your API to CoInitialize this service. But it iswork if you use VC6 to create the ATL service. The root cause is the sercurity issue as follow:
http://msdn2.microsoft.com/en-us/library/xe2dxx5c(VS.80).aspx
class CATL_SERVERModule : public CAtlServiceModuleT< CATL_SERVERModule, IDS_SERVICENAME > { public : DECLARE_LIBID(LIBID_ATL_SERVERLib) DECLARE_REGISTRY_APPID_RESOURCEID(IDR_ATL_SERVER, "{C08654FF-A0F1-4CFD-8A09-93D4768BCF14}") 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; } };
The problem is VC8 move the the security implement the base-class and you at-least implement one security check in this section of code. The easy way to implement it is copy code from VC6 as follow:
// 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.
// This provides a NULL DACL which will allow access to everyone.
CSecurityDescriptor sd;
sd.InitializeFromThreadToken();
hr = CoInitializeSecurity(sd, -1, NULL, NULL,
RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
return S_OK;
Powered by Zoundry