C++ ACE_REGISTRY_CALL_RETURN类(方法)实例源码

下面列出了C++ ACE_REGISTRY_CALL_RETURN 类(方法)源码代码实例,从而了解它的用法。

作者:1689850    项目:SkyFireEM   
// Insert or update <naming_context> with <name> relative to <this> context
// (String version)
int
ACE_Registry::Naming_Context::bind_context (const ACE_TString &name,
                                            /* const */ Naming_Context &naming_context,
                                            u_long persistence,
                                            u_long security_access,
                                            LPSECURITY_ATTRIBUTES security_attributes)
{
  u_long reason;

  long result = ACE_TEXT_RegCreateKeyEx (this->key_,
                                         name.c_str (),
                                         0,
                                         0,
                                         persistence,
                                         security_access,
                                         security_attributes,
                                         &naming_context.key_,
                                         &reason);
  if (result == ERROR_SUCCESS)
    {
      // Set the correct parent
      naming_context.parent (this->key_);
      // Set the correct name
      naming_context.name (name);
    }

  ACE_REGISTRY_CALL_RETURN (result);
}

作者:1689850    项目:SkyFireEM   
// Find <object> with <name> in <this> context
// (String version)
int
ACE_Registry::Naming_Context::resolve (const ACE_TString &name,
                                       Object &object)
{
  // Get object state
  u_long type;
  void *data = object.data ();
  u_long size = object.size ();

  long result = ACE_TEXT_RegQueryValueEx (this->key_,
                                          name.c_str (),
                                          0,
                                          &type,
                                          (BYTE *)data,
                                          &size);
  if (result == ERROR_SUCCESS)
    {
      // Reset object state
      // No need to set object.data()
      object.type (type);
      object.size (size);
    }

  ACE_REGISTRY_CALL_RETURN (result);
}

作者:Elevi    项目:RG-33   
/* static */
int
ACE_Predefined_Naming_Contexts::connect (ACE_Registry::Naming_Context &naming_context,
                                         HKEY predefined,
                                         const ACE_TCHAR *machine_name)
{
#if defined (ACE_HAS_WINCE)
  return -1;
#else
  long result = -1;

  if (machine_name != 0 && ACE_OS::strcmp (ACE_TEXT ("localhost"), machine_name) == 0)
    machine_name = 0;

  if (predefined == HKEY_LOCAL_MACHINE || predefined == HKEY_USERS)
    result =
      ACE_TEXT_RegConnectRegistry (const_cast<ACE_TCHAR *> (machine_name),
                                   predefined,
                                   &naming_context.key_);
  if (predefined == HKEY_CURRENT_USER || predefined == HKEY_CLASSES_ROOT)
    // Make sure that for these types, the machine is local
    if (machine_name == 0 ||
        ACE_Predefined_Naming_Contexts::is_local_host (machine_name))
      {
        naming_context.key_ = predefined;
        result = 0;
      }
    else
      result = -1;

  ACE_REGISTRY_CALL_RETURN (result);
#endif  // ACE_HAS_WINCE
}

作者:1689850    项目:SkyFireEM   
// Remove naming_context with <name> from <this> context
// (String version)
int
ACE_Registry::Naming_Context::unbind_context (const ACE_TString &name)
{
  long result = ACE_TEXT_RegDeleteKey (this->key_,
                                                       name.c_str ());

  ACE_REGISTRY_CALL_RETURN (result);
}

作者:1689850    项目:SkyFireEM   
// Insert or update <object> with <name> into <this> context
// (String version)
int
ACE_Registry::Naming_Context::bind (const ACE_TString &name,
                                    const Object &object)
{
  long result = ACE_TEXT_RegSetValueEx (this->key_,
                                        name.c_str (),
                                        0,
                                        object.type (),
                                        (const BYTE *) object.data (),
                                        object.size ());
  ACE_REGISTRY_CALL_RETURN (result);
}

作者:1689850    项目:SkyFireEM   
// Find <naming_context> with <name> in <this> context
// (String version)
int
ACE_Registry::Naming_Context::resolve_context (const ACE_TString &name,
                                               Naming_Context &naming_context,
                                               u_long security_access)
{
  long result = ACE_TEXT_RegOpenKeyEx (this->key_,
                                       name.c_str (),
                                       0,
                                       security_access,
                                       &naming_context.key_);
  if (result == ERROR_SUCCESS)
    {
      // set the correct parent
      naming_context.parent (this->key_);
      // set the correct name
      naming_context.name (name);
    }

  ACE_REGISTRY_CALL_RETURN (result);
}

作者:1689850    项目:SkyFireEM   
// Close the handle of the context
int
ACE_Registry::Naming_Context::close (void)
{
  long result = this->key_ ? ::RegCloseKey (this->key_) : ERROR_SUCCESS;
  ACE_REGISTRY_CALL_RETURN (result);
}


问题


面经


文章

微信
公众号

扫码关注公众号