コード例 #1
0
ファイル: Registry.cpp プロジェクト: sd-eblana/bawx
int CreateRegKeyStructure(HKEY hKey, const char *sPath)
{
    char sDir[MAX_PATH];

    int iNameSz = (int)strlen(sPath);
	int iCount = 0;
	int iPos = 0;

    for(iPos = 0; iPos < iNameSz; iPos++)
    {
        if(sPath[iPos] == '\\' || sPath[iPos] == '/')
        {
            sDir[iPos] = '\0';
			if(CreateRegistryKey(hKey, sDir))
			{
				iCount++;
			}
        }

        sDir[iPos] = sPath[iPos];
    }

     sDir[iPos] = '\0';
     if(CreateRegistryKey(hKey, sDir))
	 {
		 iCount++;
	 }

	 return iCount;
}
コード例 #2
0
ファイル: lregistry.cpp プロジェクト: identity0815/os45
// Checks HKCU\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue first, then
// HKLM\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue, after that it takes the default
// Always returns true.
bool LRegistry::ReadSettingsBool(LPCTSTR szSubkey, LPCTSTR szValue, 
                                 bool *pbEntry, bool bDefault, 
                                 bool bReadHKLM /*=false*/)
{
   TCHAR szKey[512];
   CreateRegistryKey(szSubkey, szKey);
   bool success = false;
   if (!bReadHKLM)
      success = ReadBoolRegistryEntry(HKEY_CURRENT_USER, szKey, szValue, pbEntry);
   if (!success)
      success = ReadBoolRegistryEntry(HKEY_LOCAL_MACHINE, szKey, szValue, pbEntry);
   if (!success)
   {
      *pbEntry = bDefault;
      success = true;
   }

   return success;
}
コード例 #3
0
ファイル: lregistry.cpp プロジェクト: identity0815/os45
// Checks HKCU\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue first, then
// HKLM\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue, after that it takes the default
// Always returns true.
bool LRegistry::ReadSettingsDword(LPCTSTR szSubkey, LPCTSTR szValue, 
                                  DWORD *pdwEntry, DWORD dwDefault, 
                                  bool bReadHKLM /*=false*/)
{
   TCHAR szKey[512];
   CreateRegistryKey(szSubkey, szKey);
   bool success = false;
   if (!bReadHKLM)
      success = ReadDwordRegistryEntry(HKEY_CURRENT_USER, szKey, szValue, pdwEntry);
   if (!success)
      success = ReadDwordRegistryEntry(HKEY_LOCAL_MACHINE, szKey, szValue, pdwEntry);
   if (!success)
   {
      *pdwEntry = dwDefault;
      success = true;
   }

   return success;
}
コード例 #4
0
ファイル: lregistry.cpp プロジェクト: identity0815/os45
// Checks HKCU\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue first, then
// HKLM\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue. If that fails, too,
// false is returned, otherwise true.
bool LRegistry::ReadSettingsBinary(LPCTSTR szSubkey, LPCTSTR szValue, 
                                   char *pData, DWORD *pdwSize, 
                                   bool bReadHKLM /*=false*/)
{
   TCHAR szKey[512];
   CreateRegistryKey(szSubkey, szKey);

   DWORD dwBackup = *pdwSize;
   bool success = false;
   if (!bReadHKLM)
      success = ReadBinaryRegistryEntry(HKEY_CURRENT_USER, szKey, szValue, pData, pdwSize);
   if (!success)
   {
      *pdwSize = dwBackup;
      success = ReadBinaryRegistryEntry(HKEY_LOCAL_MACHINE, szKey, szValue, pData, pdwSize);
   }

   return success;
}
コード例 #5
0
ファイル: lregistry.cpp プロジェクト: identity0815/os45
// Writes to HKCU\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>: szValue
bool LRegistry::WriteSettingsString(LPCTSTR szSubkey, LPCTSTR szValue, 
                                    const _TCHAR *tszString, bool bForAll)
{
   TCHAR szKey[512];
   CreateRegistryKey(szSubkey, szKey);

   bool success = false;
   if (bForAll)
   {
      success = WriteStringRegistryEntry(HKEY_LOCAL_MACHINE, szKey, szValue, tszString);
      if (success)
         DeleteRegistryValue(HKEY_CURRENT_USER, szKey, szValue);
   }

   if (!success)
   {
      success = WriteStringRegistryEntry(HKEY_CURRENT_USER, szKey, szValue, tszString);
   }
   return success;
}
コード例 #6
0
ファイル: lregistry.cpp プロジェクト: identity0815/os45
// Writes to HKCU\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>: szValue
bool LRegistry::WriteSettingsDword(LPCTSTR szSubkey, LPCTSTR szValue, 
                                   DWORD dwEntry, bool bForAll)
{
   TCHAR szKey[512];
   CreateRegistryKey(szSubkey, szKey);

   bool success = false;
   if (bForAll)
   {
      success = WriteDwordRegistryEntry(HKEY_LOCAL_MACHINE, szKey, szValue, dwEntry);
      if (success)
         DeleteRegistryValue(HKEY_CURRENT_USER, szKey, szValue);
   }

   if (!success)
   {
      success = WriteDwordRegistryEntry(HKEY_CURRENT_USER, szKey, szValue, dwEntry);
   }

   return success;
}
コード例 #7
0
ファイル: lregistry.cpp プロジェクト: identity0815/os45
// Writes to HKCU\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>: szValue
bool LRegistry::WriteSettingsBinary(LPCTSTR szSubkey, LPCTSTR szValue, 
                                    const char *pData, DWORD dwSize, bool bForAll)
{
   TCHAR szKey[512];
   CreateRegistryKey(szSubkey, szKey);

   bool success = false;
   if (bForAll)
   {
      success = WriteBinaryRegistryEntry(HKEY_LOCAL_MACHINE, szKey, szValue, pData, dwSize);
      if (success)
         DeleteRegistryValue(HKEY_CURRENT_USER, szKey, szValue);
   }

   if (!success)
   {
      success = WriteBinaryRegistryEntry(HKEY_CURRENT_USER, szKey, szValue, pData, dwSize);
   }

   return success;
}
コード例 #8
0
ファイル: wmv9.cpp プロジェクト: betaking/LAVFilters
// ILAVDecoder
STDMETHODIMP CDecWMV9::Init()
{
  DbgLog((LOG_TRACE, 10, L"CDecWMV9::Init(): Trying to open WMV9 DMO decoder"));
  HRESULT hr = S_OK;

  // Disable deinterlacing setting in the registry
  // Apparently required on XP
  CreateRegistryKey(HKEY_CURRENT_USER, L"Software\\Microsoft\\Scrunch");
  CRegistry reg = CRegistry(HKEY_CURRENT_USER, L"Software\\Microsoft\\Scrunch", hr);
  if (SUCCEEDED(hr)) {
    reg.ReadDWORD(L"Deinterlace.old", hr);
    if (FAILED(hr)) {
      DWORD dwValue = reg.ReadDWORD(L"Deinterlace", hr);
      if (FAILED(hr))
        dwValue = 0;
      reg.WriteDWORD(L"Deinterlace.old", dwValue);
      reg.WriteDWORD(L"Deinterlace", 0);
    }
  }

  hr = CoCreateInstance(CLSID_CWMVDecMediaObject, NULL, CLSCTX_INPROC_SERVER, IID_IMediaObject, (void **)&m_pDMO);
  if (FAILED(hr)) {
    DbgLog((LOG_TRACE, 10, L"-> Failed to create DMO object"));
    return hr;
  }

  // Force decoder deinterlacing to off
  IPropertyBag *pProp = NULL;
  hr = m_pDMO->QueryInterface(&pProp);
  if (SUCCEEDED(hr)) {
    VARIANT var = {0};
    var.vt = VT_BOOL;
    var.boolVal = FALSE;
    pProp->Write(g_wszWMVCDecoderDeinterlacing, &var);
    SafeRelease(&pProp);
  }

  return S_OK;
}
コード例 #9
0
ファイル: lregistry.cpp プロジェクト: identity0815/os45
// Checks HKCU\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue first, then
// HKLM\\SOFTWARE\\imc AG\\LECTURNITY\\<szSubkey>:szValue, after that it takes the default
// Always returns true.
bool LRegistry::ReadSettingsString(LPCTSTR szSubkey, LPCTSTR szValue, 
                                   _TCHAR *tszString, DWORD *pdwSize, const _TCHAR *tszDefault, 
                                   bool bReadHKLM /*=false*/)
{
   TCHAR szKey[512];
   CreateRegistryKey(szSubkey, szKey);
   DWORD dwBackup = *pdwSize;
   bool success = false;
   if (!bReadHKLM)
      success = ReadStringRegistryEntry(HKEY_CURRENT_USER, szKey, szValue, tszString, pdwSize);
   if (!success)
   {
      *pdwSize = dwBackup;
      success = ReadStringRegistryEntry(HKEY_LOCAL_MACHINE, szKey, szValue, tszString, pdwSize);
   }

   if (!success && tszDefault != NULL)
   {
      _tcscpy(tszString, tszDefault);
      success = true;
   }

   return success;
}
コード例 #10
0
ファイル: install.cpp プロジェクト: 8tab/qemu
/* Register this dll as a VSS provider */
STDAPI DllRegisterServer(void)
{
    COMInitializer initializer;
    COMPointer<IVssAdmin> pVssAdmin;
    HRESULT hr = E_FAIL;
    char dllPath[MAX_PATH];
    char key[256];

    if (!g_hinstDll) {
        errmsg_dialog(hr, "Module instance is not available");
        goto out;
    }

    /* Add this module to registery */

    sprintf(key, "CLSID\\%s", g_szClsid);
    if (!CreateRegistryKey(key, NULL, g_szClsid)) {
        goto out;
    }

    if (!GetModuleFileName(g_hinstDll, dllPath, sizeof(dllPath))) {
        errmsg_dialog(GetLastError(), "GetModuleFileName failed");
        goto out;
    }

    sprintf(key, "CLSID\\%s\\InprocServer32", g_szClsid);
    if (!CreateRegistryKey(key, NULL, dllPath)) {
        goto out;
    }

    if (!CreateRegistryKey(key, "ThreadingModel", "Apartment")) {
        goto out;
    }

    sprintf(key, "CLSID\\%s\\ProgID", g_szClsid);
    if (!CreateRegistryKey(key, NULL, g_szProgid)) {
        goto out;
    }

    if (!CreateRegistryKey(g_szProgid, NULL, QGA_PROVIDER_NAME)) {
        goto out;
    }

    sprintf(key, "%s\\CLSID", g_szProgid);
    if (!CreateRegistryKey(key, NULL, g_szClsid)) {
        goto out;
    }

    hr = CoCreateInstance(CLSID_VSSCoordinator, NULL, CLSCTX_ALL,
                          IID_IVssAdmin, (void **)pVssAdmin.replace());
    if (FAILED(hr)) {
        errmsg_dialog(hr, "CoCreateInstance(VSSCoordinator) failed");
        goto out;
    }

    hr = pVssAdmin->RegisterProvider(g_gProviderId, CLSID_QGAVSSProvider,
                                     const_cast<WCHAR*>(QGA_PROVIDER_LNAME),
                                     VSS_PROV_SOFTWARE,
                                     const_cast<WCHAR*>(QGA_PROVIDER_VERSION),
                                     g_gProviderVersion);
    if (FAILED(hr)) {
        errmsg_dialog(hr, "RegisterProvider failed");
    }

out:
    if (FAILED(hr)) {
        DllUnregisterServer();
    }

    return hr;
}