Example #1
0
void ThumbnailProviderRegistration::registerThumbnailHandler(std::string const & fileExtension, std::string const & inprocSvrClsid)
{
  std::string fileType = Registry(fileExtension, Registry::OpenMode::Create).readString();
  std::string keyBase = fileExtension;
  if (fileType.size() > 0) {
    keyBase = fileType;
  }
  Registry(keyBase + "\\shellex\\" + thumbnailProviderCLSID_, Registry::OpenMode::Create)
    .writeString("", inprocSvrClsid);
}
Example #2
0
 // Get a layer using a LayerParameter.
 static Layer<Dtype>* CreateLayer(const LayerParameter& param) {
   LOG(INFO) << "Creating layer " << param.name();
   const LayerParameter_LayerType& type = param.type();
   CreatorRegistry& registry = Registry();
   CHECK_EQ(registry.count(type), 1);
   return registry[type](param);
 }
	void PropertyDefinitionBase::checkAndInitRegistry()
	{
		if (ms_registry == NULL)
		{
			ms_registry = mada_new(Registry());
		}
	}
Example #4
0
Engine::Engine(){
	delta = 0.0;
	io = new IOManager();
	settings = new SettingsManager(io);
	keybinds = new KeybindManager(io);
	registry = Registry();
}
Example #5
0
 // Get a solver using a SolverParameter.
 static Solver<Dtype>* CreateSolver(const SolverParameter& param) {
   const string& type = param.type();
   CreatorRegistry& registry = Registry();
   CHECK_EQ(registry.count(type), 1) << "Unknown solver type: " << type
       << " (known types: " << SolverTypeListString() << ")";
   return registry[type](param);
 }
Example #6
0
 // 给定类型,以及函数指针,加入到注册表 
 // Adds a creator.
 static void AddCreator(const string& type, Creator creator) 
 {
     CreatorRegistry& registry = Registry();
     CHECK_EQ(registry.count(type), 0)
     << "Layer type " << type << " already registered.";
     registry[type] = creator;
 }
 // Get a layer using a LayerParameter.
 static shared_ptr<Layer<Dtype> > CreateLayer(const LayerParameter& param) {
   const string& type = param.type();
   CreatorRegistry& registry = Registry();
   CHECK_EQ(registry.count(type), 1) << "Unknown layer type: " << type
       << " (known types: " << LayerTypeListString() << ")";
   return registry[type](param);
 }
Example #8
0
void ThumbnailProviderRegistration::unregisterThumbnailHandler(std::string const & fileExtension)
{
  std::string fileType = Registry(fileExtension).readString();
  if (fileType.size() > 0) {
    removeKeyIfExists(fileExtension + "\\shellex\\" + thumbnailProviderCLSID_);
  }
  removeKeyIfExists(fileType + "\\shellex\\" + thumbnailProviderCLSID_);
}
Example #9
0
void ThumbnailProviderRegistration::registerInprocServer(std::string const & inprocSvrClsid, std::string const & friendlyName, std::string const & absoluteSvrPath)
{
  const std::string keyBase = "CLSID\\" + inprocSvrClsid;
  Registry(keyBase, Registry::OpenMode::Create).writeString("", friendlyName);
  Registry inprocSvr(keyBase + "\\InprocServer32", Registry::OpenMode::Create);
  inprocSvr.writeString("", absoluteSvrPath);
  inprocSvr.writeString("ThreadingModel", "Apartment");
}
Example #10
0
 static vector<string> LayerTypeList() {
   CreatorRegistry& registry = Registry();
   vector<string> layer_types;
   for (typename CreatorRegistry::iterator iter = registry.begin();
        iter != registry.end(); ++iter) {
     layer_types.push_back(iter->first);
   }
   return layer_types;
 }
Example #11
0
bool Registry::keyExists(std::string const &subKey, HKEY root)
{
  try {
    Registry(subKey, Registry::OpenMode::Read, root);
  } catch(std::runtime_error const&) {
    return false;
  }
  return true;
}
Example #12
0
/**
 * DllUnregisterServer - Removes entries from the system registry.
 */
STDAPI DllUnregisterServer(void)
{
    logger->debug(L"BHO::dllexports::DllUnregisterServer");

    // unregister addon
    if (!Registry(HKEY_CLASSES_ROOT, L"CLSID\\" + _AtlModule.moduleCLSID).del()) {
        logger->error(L"BHO::dllexports::DllUnregisterServer failed to delete registry entry");
    }
    if (!Registry(HKEY_LOCAL_MACHINE, 
                  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\"
                  L"Browser Helper Objects\\" + _AtlModule.moduleCLSID).del()) {
        logger->error(L"BHO::dllexports::DllUnregisterServer failed to delete registry entry");
    }

    // elevation policy for Frame-Injection
    if (!Registry(HKEY_LOCAL_MACHINE, 
                  L"Software\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" + 
                  _AtlModule.moduleCLSID).del()) {
        logger->error(L"BHO::dllexports::DllUnregisterServer failed to delete registry entry: "
                      L"elevation policy");
    }


    HRESULT hr = _AtlModule.DllUnregisterServer();
    if (FAILED(hr)) {
        logger->error(L"BHO::dllexports::DllUnregisterServer "
                      L" -> Warning: _AtlModule.DllUnregisterServer failed");
    }

// We install both architectures on x64, so only bring dialog up once!
#ifndef _WIN64
    // Uninstall hooks not officially supported in Forge yet, only
    // trigger for these vendors:
    if (_AtlModule.moduleManifest->name.find(L"Apture") != wstring::npos) {
        try {
            FeedbackDialog dlg(_AtlModule.moduleManifest->author);
            dlg.Show(NULL);
        } catch(...) {}
    }
#endif /* _WIN64 */

    return S_OK;
}
void HospitalizationManagement::initUI()
{
    Registry();
    Pay();
	Charge();
	Discharge();
	InternalPayment();
	Dailyreport();
	Statistics();
}
Example #14
0
 // Get a layer using a LayerParameter.
 static shared_ptr<Layer<Dtype> > CreateLayer(const LayerParameter& param) {
   if (Caffe::root_solver()) {
     LOG(INFO) << "Creating layer " << param.name();
   }
   const string& type = param.type();
   CreatorRegistry& registry = Registry();
   CHECK_EQ(registry.count(type), 1) << "Unknown layer type: " << type
       << " (known types: " << LayerTypeList() << ")";
   return registry[type](param);
 }
Example #15
0
inline
env::env() {
  vars.RegisterEntry<EnvAnonCounterAttr>();
  vars.RegisterEntry<EnvFunctorEntry>();
  vars.RegisterEntry<EnvMainAttr>();

  vars.SetKey<EnvRegistry>("env.root_registry", Registry());
  vars
    .GetValueRef<EnvRegistry>("env.root_registry")
      .SetName("env.root_registry");
}
Example #16
0
void TConfiguration::CleanupRegistry(const UnicodeString & CleanupSubKey)
{
  std::unique_ptr<TRegistryStorage> Registry(new TRegistryStorage(GetRegistryStorageKey()));
  try__finally
  {
    Registry->RecursiveDeleteSubKey(CleanupSubKey);
  }
  __finally
  {
//    delete Registry;
  };
}
Example #17
0
 static string LayerTypeList() {
   CreatorRegistry& registry = Registry();
   string layer_types;
   for (typename CreatorRegistry::iterator iter = registry.begin();
        iter != registry.end(); ++iter) {
     if (iter != registry.begin()) {
       layer_types += ", ";
     }
     layer_types += iter->first;
   }
   return layer_types;
 }
Example #18
0
//-----------------------------------------------------------------------------
// 
//  Function:  InitializeDeviceMediator
//
//  Power management extension initialization routine
//
DWORD
InitializeDeviceMediator(
    HKEY hKey,
    LPCTSTR lpRegistryPath
    )
{    
    DWORD rc = FALSE;
    CRegistryEdit Registry(hKey, lpRegistryPath);
    memset(&s_Device, 0, sizeof(Device_t));

    // Read device parameters
    DWORD dwType = REG_DWORD;
    DWORD dwSize = sizeof(s_Device.priority256);
    if (FALSE == Registry.RegQueryValueEx(PNP_THREAD_PRIORITY,
            &dwType, (BYTE*)&s_Device.priority256, &dwSize))
        {
        s_Device.priority256 = PNP_DEFAULT_THREAD_PRIORITY;
        }            

    // Setup event handle to signal listener thread
    s_Device.hMsgSync = ::CreateEvent(NULL, FALSE, FALSE, NULL);
    if (s_Device.hMsgSync == NULL)
        {
        goto cleanUp;
        }

    // Instantiate Device mediator object
    s_Device.pDeviceMediator = DeviceMediator::CreateDeviceMediator();
    if (s_Device.pDeviceMediator == NULL)
        {
        goto cleanUp;
        }

    // Listener thread
    s_Device.hListenerThread = ::CreateThread(NULL, 0, 
        Device_ListenerThread, NULL, 0, NULL
        );
    
    if (s_Device.hListenerThread == NULL) 
        {
        goto cleanUp;
        }

    // indicate success by returning a reference to global
    //
    rc = TRUE;

cleanUp:
    if (rc == FALSE) UninitializeDeviceMediator((DWORD)&s_Device);
    
    return rc;
}
Example #19
0
void ImageFactory::registerImage(int            type,
                                 NewInstanceFct newInst,
                                 IsThisTypeFct  isType)
{
    unsigned int i = 0;
    for (; i < MAX_IMAGE_FORMATS; ++i) {
        if (registry_[i].imageType_ == ImageType::none) {
            registry_[i] = Registry(type, newInst, isType);
            break;
        }
    }
    if (i == MAX_IMAGE_FORMATS) throw Error(35);
}
Example #20
0
		NetworkMessage* NetworkMessageMaker::ConstructMessage ( int type )
		///////////////////////////////////////////////////////////////////////
		{
			try 
			{
				NetworkMessageMaker* maker = 
					(*Registry().find (type)).second;

				return maker->MakeMessage();
			}
			catch (void*) {}
         
			return NULL;
		}
Example #21
0
//---------------------------------------------------------------------------
//This function reads file names of recent used files from the registry
void __fastcall TRecent::ReadFromRegistry(void)
{
  if(ComponentState.Contains(csDesigning))//If design time
    return;//don't load registry

  FileList.clear();//Make sure there are no files in list
  if(FRegistryKey.IsEmpty())//If no registry key set
    return;//Don't read data from registry

  std::auto_ptr<TRegistry> Registry(new TRegistry());
  if(Registry->OpenKeyReadOnly(FRegistryKey))
    for(unsigned I = 1; I <= FMaxFiles; I++)//Loop through all values in registry
      if(Registry->ValueExists("Recent" + String(I)))
        FileList.push_back(std::pair<String,TActionClientItem*>(Registry->ReadString("Recent" + String(I)), NULL));//Add file name to list
}
Example #22
0
namespace Exiv2 {

    ImageFactory::Registry ImageFactory::registry_[] = {
        Registry(ImageType::jpeg, newJpegInstance, isJpegType),
        Registry(ImageType::exv,  newExvInstance,  isExvType),
        Registry(ImageType::cr2,  newCr2Instance,  isCr2Type),
        Registry(ImageType::crw,  newCrwInstance,  isCrwType),
        Registry(ImageType::mrw,  newMrwInstance,  isMrwType),
        Registry(ImageType::tiff, newTiffInstance, isTiffType),
#ifdef EXV_HAVE_LIBZ
        Registry(ImageType::png,  newPngInstance,  isPngType)
#endif // EXV_HAVE_LIBZ
    };

}                                       // namespace Exiv2
Example #23
0
//---------------------------------------------------------------------------
//This function saves file names to the registry
void __fastcall TRecent::SaveToRegistry(void)
{
  if(ComponentState.Contains(csDesigning))//If design time
    return;//don't write to registry

  if(FRegistryKey.IsEmpty())//If no registry key choosen
    return;//Don't save data

  std::auto_ptr<TRegistry> Registry(new TRegistry);
  if(Registry->OpenKey(FRegistryKey, true))
  {
    //Open key;Create key if not found
    for(unsigned I = 0; I < FileList.size(); I++)//Loop through recent files in list
      Registry->WriteString("Recent" + String(I+1), FileList[I].first);//Write file name to registry

    for(unsigned I = FileList.size(); Registry->ValueExists("Recent" + String(I+1)); I++)//Loop through until no more fake values
      Registry->DeleteValue("Recent"+String(I+1));//Delete file name
  }
}
Example #24
0
    // Get a layer using a LayerParameter.
    // 3-2给定层的类型,创建层
    static shared_ptr<Layer<Dtype> > CreateLayer(const LayerParameter& param) 
    {  
    
        if (Caffe::root_solver()) 
        {  
            LOG(INFO) << "Creating layer " << param.name();  
        }  
        
        // 从参数中获得类型字符串  
        const string& type = param.type();  
        
        // 获得注册表指针  
        CreatorRegistry& registry = Registry(); 
        
        // 测试是否查找到给定type的Creator  
        CHECK_EQ(registry.count(type), 1) << "Unknown layer type: " << type  
        << " (known types: " << LayerTypeListString() << ")";  

        // 这里大概就直接new了一个新的layer类。DataLayer,ConvolutionLayer,...
        // 调用对应的层的Creator函数  
        return registry[type](param);  
    }  
Example #25
0
		NetworkMessageMaker::NetworkMessageMaker( int type )
		///////////////////////////////////////////////////////////////////////
		{
			Registry().insert (std::make_pair(type, this));
		}
Example #26
0
void ThumbnailProviderRegistration::unregisterInprocServer(std::string const & inprocSvrClsid)
{
  Registry("CLSID").deleteKeyRecursive(inprocSvrClsid);
}
Example #27
0
void ThumbnailProviderRegistration::removeKeyIfExists(std::string const & key) {
  if (Registry::keyExists(key)) {
    Registry().deleteKeyRecursive(key);
  }
}
Example #28
0
/**
 * DllRegisterServer - Adds entries to the system registry.
 */
STDAPI DllRegisterServer(void)
{
    logger->debug(L"BHO::dllexports::DllRegisterServer");

    // CLSID's
    wstring clsid = _AtlModule.moduleCLSID;
    wstring typelib  = L"{A6F64DB8-F0DF-4C25-95FA-1FD20AC302E4}"; // only changes between SDK versions 

	wstring elevation32 = L"{D007D90B-423F-40A5-BE43-05BC2ABCA970}"; // arb GUID
	wstring elevation64 = L"{D007D90B-423F-40A5-BE43-05BC2ABCA971}"; // arb GUID + 1

    wstring CLSID_Shell_ToolbarExtExec = L"{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}";
    wstring CLSID_NativeBackground = L"{7F2FA86A-181A-4F8F-B853-51F897A91227}";
    wstring uuid = _AtlModule.moduleManifest->uuid;

    wstring hkcr, hklm_bho, hklm_button, hklm_elevation;

    /** CLSID registration
      %MODULE% = Z:\platform.master.hg\ie\build\Win32\Debug\forge32.dll
      HKEY_CLASSES_ROOT\CLSID\clsid = ${name}
      HKEY_CLASSES_ROOT\CLSID\clsid\TypeLib = typelib
      HKEY_CLASSES_ROOT\CLSID\clsid\Version = ${version}
      HKEY_CLASSES_ROOT\CLSID\clsid\InprocServer32 = %MODULE% 
      HKEY_CLASSES_ROOT\CLSID\clsid\InProcServer32\ThreadingModel = Apartment
    */
    logger->debug(L"BHO::dllexports::DllRegisterServer registering CLSID");
    hkcr =  L"CLSID\\" + clsid;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr).create()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr, L"", _AtlModule.moduleManifest->name).set()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr + L"\\TypeLib").create()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr + L"\\TypeLib", L"", typelib).set()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr + L"\\Version").create()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr + L"\\Version", L"", _AtlModule.moduleManifest->version).set()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr + L"\\InProcServer32").create()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr + L"\\InProcServer32", L"",  _AtlModule.moduleExec.wstring()).set()) goto error;
    if (!Registry(HKEY_CLASSES_ROOT, hkcr + L"\\InProcServer32", L"ThreadingModel", L"Apartment").set()) goto error;

    /** BHO registration
      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\
             Browser Helper Objects\clsid = '${name} BHO'
    */
    logger->debug(L"BHO::dllexports::DllRegisterServer registering BHO");
    hklm_bho = 
        L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\"
        L"Browser Helper Objects\\" + clsid;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_bho).create()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_bho, L"", _AtlModule.moduleManifest->name + L" BHO").set()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_bho, L"NoExplorer", L"1").set()) goto error; // TODO support ints -> d '1'

    /** elevation policy for Frame-Injection
      HKLM\Software\Microsoft\Internet Explorer\Low Rights\ElevationPolicy = elevation[32|64]
      HKLM\Software\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\elevation\AppPath = %MODULEPATH%
      HKLM\Software\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\elevation\AppName = forge64.exe
      HKLM\Software\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\elevation\Policy  = d '3'
    */
    hklm_elevation = 
        L"Software\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" + elevation32;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation).create()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation, L"AppPath", _AtlModule.modulePath.wstring()).set()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation, L"AppName", L"forge32.exe").set()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation, L"Policy", (DWORD)3).set()) goto error;
    hklm_elevation = 
        L"Software\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\" + elevation64;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation).create()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation, L"AppPath", _AtlModule.modulePath.wstring()).set()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation, L"AppName", L"forge64.exe").set()) goto error;
    if (!Registry(HKEY_LOCAL_MACHINE, hklm_elevation, L"Policy", (DWORD)3).set()) goto error;
    
    // default initilization
    logger->debug(L"BHO::dllexports::DllRegisterServer default initialization");
    HRESULT hr = _AtlModule.DllRegisterServer();
    if (FAILED(hr)) {
        logger->debug(L"BHO::dllexports::DllRegisterServer "
                      L" -> Warning: _AtlModule.DllRegisterServer failed");
    }

    logger->debug(L"BHO::dllexports::DllRegisterServer complete");

    return S_OK;

 error:
    logger->debug(L"BHO::dllexports::DllRegisterServer failed to register addon");
    return E_FAIL;
}