コード例 #1
0
STDAPI DllUnregisterServer()
{
	unregisterFactory( CLSID_MackieControlXT );
	unregisterFactory( CLSID_MackieControlXTPropPage );
	unregisterFactory( CLSID_MackieControlMaster );
	unregisterFactory( CLSID_MackieControlMasterPropPage );
	unregisterFactory( CLSID_MackieControlC4 );
	unregisterFactory( CLSID_MackieControlC4PropPage );

	// Remove the CLSID from HKEY_CLASSES_ROOT\CakewalkControlSurfaces
	char szCLSID[ 128 ];
	char szKey[ 256 ];

	CLSIDToString( CLSID_MackieControlXT, szCLSID, sizeof szCLSID );
	strlcpy( szKey, "CakewalkControlSurfaces\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );
	recursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );

	CLSIDToString( CLSID_MackieControlMaster, szCLSID, sizeof szCLSID );
	strlcpy( szKey, "CakewalkControlSurfaces\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );
	recursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );

	CLSIDToString( CLSID_MackieControlC4, szCLSID, sizeof szCLSID );
	strlcpy( szKey, "CakewalkControlSurfaces\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );
	recursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );

	return S_OK;
}
コード例 #2
0
STDAPI DllRegisterServer()
{
	registerFactory( CLSID_MackieControlXT, s_szMackieControlXTFriendlyName );
	registerFactory( CLSID_MackieControlXTPropPage, s_szMackieControlXTFriendlyNamePropPage );
	registerFactory( CLSID_MackieControlMaster, s_szMackieControlMasterFriendlyName );
	registerFactory( CLSID_MackieControlMasterPropPage, s_szMackieControlMasterFriendlyNamePropPage );
	registerFactory( CLSID_MackieControlC4, s_szMackieControlC4FriendlyName );
	registerFactory( CLSID_MackieControlC4PropPage, s_szMackieControlC4FriendlyNamePropPage );

	// Add the CLSID to HKEY_CLASSES_ROOT\CakewalkControlSurfaces
	char szCLSID[ 128 ];
	char szKey[ 256 ];

	CLSIDToString( CLSID_MackieControlXT, szCLSID, sizeof szCLSID );
	strlcpy( szKey, "CakewalkControlSurfaces\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, NULL, "Description", s_szMackieControlXTFriendlyName );
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, NULL, "HelpFilePath", "" );

	CLSIDToString( CLSID_MackieControlMaster, szCLSID, sizeof szCLSID );
	strlcpy( szKey, "CakewalkControlSurfaces\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, NULL, "Description", s_szMackieControlMasterFriendlyName );
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, NULL, "HelpFilePath", "" );
		
	CLSIDToString( CLSID_MackieControlC4, szCLSID, sizeof szCLSID );
	strlcpy( szKey, "CakewalkControlSurfaces\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, NULL, "Description", s_szMackieControlC4FriendlyName );
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, NULL, "HelpFilePath", "" );

	return S_OK;
}
コード例 #3
0
    bool InsertGuidLookup(int i, CListCtrl* pListCtrl)
    {
        if(i<0) return false;

        if(i<KnownGuidCount)
        {
            int nIndex = pListCtrl->InsertItem(pListCtrl->GetItemCount(), KnownGuidList[i].name);
            if(nIndex == -1) return false;

            CString		clsid_str;
		    CLSIDToString(KnownGuidList[i].guid, clsid_str);
            pListCtrl->SetItemText(nIndex, 1, clsid_str);
            pListCtrl->SetItemText(nIndex, 2, _T(""));
            pListCtrl->SetItemText(nIndex, 3, _T(""));

            CStringArray* arrData = new CStringArray();
            arrData->Add(KnownGuidList[i].name);
            arrData->Add(clsid_str);
            arrData->Add(_T(""));
            arrData->Add(_T(""));
            pListCtrl->SetItemData(nIndex, (DWORD_PTR)arrData);

            return true;
        }

        return CInterfaceScanner::InsertInterfaceLookup(i-KnownGuidCount, pListCtrl);
    }
コード例 #4
0
BOOL RegisterServer()
{
    DWORD dw;
    HKEY hKey;
    HKEY hSubKey;
    BOOL fRet;
    TCHAR achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN];
    TCHAR achFileName[MAX_PATH];

    if (!CLSIDToString(c_clsidPropertyMonitorTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1))
        return FALSE;
    memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix)-sizeof(TCHAR));

    if (fRet = RegCreateKeyEx(HKEY_CLASSES_ROOT, achIMEKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dw)
            == ERROR_SUCCESS)
    {
        fRet &= RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE *)TEXTSERVICE_DESC, (lstrlen(TEXTSERVICE_DESC)+1)*sizeof(TCHAR))
            == ERROR_SUCCESS;

        if (fRet &= RegCreateKeyEx(hKey, c_szInProcSvr32, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hSubKey, &dw)
            == ERROR_SUCCESS)
        {
            dw = GetModuleFileName(g_hInst, achFileName, ARRAYSIZE(achFileName));

            fRet &= RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (BYTE *)achFileName, (lstrlen(achFileName)+1)*sizeof(TCHAR)) == ERROR_SUCCESS;
            fRet &= RegSetValueEx(hSubKey, c_szModelName, 0, REG_SZ, (BYTE *)TEXTSERVICE_MODEL, (lstrlen(TEXTSERVICE_MODEL)+1)*sizeof(TCHAR)) == ERROR_SUCCESS;
            RegCloseKey(hSubKey);
        }
        RegCloseKey(hKey);
    }

    return fRet;
}
コード例 #5
0
ファイル: shellhlp.cpp プロジェクト: DamianSuess/LiteStep
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// LSActivateActCtxForClsid
// Activates the custom activation context for the specified CLSID
//
HANDLE LSActivateActCtxForClsid(REFCLSID rclsid, PULONG_PTR pulCookie)
{
    HANDLE hContext = INVALID_HANDLE_VALUE;
    TCHAR szCLSID[39] = { 0 };

    //
    // Get the DLL that implements the COM object in question
    //
    if (SUCCEEDED(CLSIDToString(rclsid, szCLSID, COUNTOF(szCLSID))))
    {
        TCHAR szSubkey[MAX_PATH] = { 0 };

        HRESULT hr = StringCchPrintf(szSubkey, COUNTOF(szSubkey),
            _T("CLSID\\%ls\\InProcServer32"), szCLSID);

        if (SUCCEEDED(hr))
        {
            TCHAR szDll[MAX_PATH] = { 0 };
            DWORD cbDll = sizeof(szDll);

            LONG lres = SHGetValue(
                HKEY_CLASSES_ROOT, szSubkey, NULL, NULL, szDll, &cbDll);

            if (lres == ERROR_SUCCESS)
            {
                //
                // Activate the custom manifest (if any) of that DLL
                //
                hContext = LSActivateActCtxForDll(szDll, pulCookie);
            }
        }
    }

    return hContext;
}
コード例 #6
0
	void FilterListCtrl::UpdateList()
	{
		DeleteAllItems();

		CString clsid_str;
		CString guid_search_str(search_str);
		guid_search_str.Replace(_T("0X"), _T(""));
		const TCHAR delimiters[] = _T(" \t-,{}()=/;UL");			// remove commonly used C++ GUID delimiters and match by remaining hex digits
		for (int n=0; n<sizeof(delimiters)/sizeof(delimiters[0]); n++) 
			guid_search_str.Remove(delimiters[n]);

		for (int i=0; i<filters.GetCount(); i++) {
			DSUtil::FilterTemplate	&filter = filters[i];

			if (CString(filter.name).MakeUpper().Find(search_str) < 0) {
				CLSIDToString(filter.clsid, clsid_str);
				clsid_str.Remove(_T('-'));					// remove hex separators generated by CLSIDToString
				if (clsid_str.Find(guid_search_str) < 0) {
					continue;
				}
			}
			const int item = InsertItem(LVIF_PARAM | LVIF_TEXT, 0, filter.name, 0, 0, 0, (LPARAM)&filter);
			SetItemData(item, (DWORD_PTR)&filter);
		}
	}
コード例 #7
0
void UnregisterServer()
{
    TCHAR achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN];

    if (!CLSIDToString(c_clsidPropertyMonitorTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1))
        return;
    memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix)-sizeof(TCHAR));

    RecurseDeleteKey(HKEY_CLASSES_ROOT, achIMEKey);
}
コード例 #8
0
static void unregisterFactory( const CLSID& clsid )
{
	// Get server location.
	char szModule[ _MAX_PATH ];
	::GetModuleFileName( theApp.m_hInstance, szModule, sizeof szModule );

	// Convert the CLSID into a char.
	char szCLSID[ 128 ];
	CLSIDToString( clsid, szCLSID, sizeof szCLSID );

	char szKey[ 64 ];
	strlcpy( szKey, "CLSID\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );

	recursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
}
コード例 #9
0
static void registerFactory( const CLSID& clsid, const char* pcszFriendlyName )
{
	// Get server location.
	char szModule[ _MAX_PATH ];
	::GetModuleFileName( theApp.m_hInstance, szModule, sizeof szModule );

	// Convert the CLSID into a char.
	char szCLSID[ 128 ];
	CLSIDToString( clsid, szCLSID, sizeof szCLSID );

	// Add the CLSID to HKEY_CLASSES_ROOT\CLSID
	char szKey[ 64 ];
	strlcpy( szKey, "CLSID\\", sizeof(szKey) );
	strlcat( szKey, szCLSID, sizeof(szKey) );
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, NULL, NULL, pcszFriendlyName );

	// Add the pathname subkey under the CLSID key.
	setKeyAndValue( HKEY_CLASSES_ROOT, szKey, "InprocServer32", NULL, szModule );
}