void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, std::list<LPCWSTR> chkbytes, ...) { std::wstring null = CStringFromGUID(GUID_NULL); std::wstring majortype = CStringFromGUID(MEDIATYPE_Stream); std::wstring subtype = CStringFromGUID(subtype2); int i = 0; std::list<LPCWSTR>::iterator it; for(it = chkbytes.begin(); it != chkbytes.end(); ++it) { WCHAR idx[10] = {0}; swprintf_s(idx, _T("%d"), i); SetRegKeyValue(_T("Media Type\\") + majortype, subtype, idx, *it); i++; } SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("Source Filter"), CStringFromGUID(clsid)); DeleteRegKey(_T("Media Type\\") + null, subtype); va_list extensions; va_start(extensions, chkbytes); LPCWSTR ext = NULL; while (ext = va_arg(extensions, LPCWSTR)) { DeleteRegKey(_T("Media Type\\Extensions"), ext); } va_end(extensions); }
STDAPI DllRegisterServer() { SetRegKeyValue(_T("udp"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CLibraryReader))); SetRegKeyValue(_T("tévé"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CLibraryReader))); return AMovieDllRegisterServer2(TRUE); }
STDAPI DllRegisterServer() { SetRegKeyValue( _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"), _T("0"), _T("0,12,,445644564944454F2D565453")); // "DVDVIDEO-VTS" SetRegKeyValue( _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"), _T("Source Filter"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}")); return AMovieDllRegisterServer2(TRUE); }
STDAPI DllRegisterServer() { SetRegKeyValue( _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"), _T("0"), _T("0,4,,52494646,8,4,,43444441")); // "RIFFxxxxCDDA" SetRegKeyValue( _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"), _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}")); SetRegKeyValue( _T("Media Type\\Extensions"), _T(".cda"), _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}")); return AMovieDllRegisterServer2(TRUE); }
// // Function: DllRegisterServer // // Summary: The standard exported function that can be called to command // this DLL server to register itself in the system registry. // // Args: // // Returns: HRESULT // NOERROR // *********************************************************************************************** STDAPI DllRegisterServer() { TCHAR tchszCLSID[128+1]; TCHAR tchszModulePath[MAX_PATH]; // // Obtain the path to this module's executable file for later use. GetModuleFileName(theApp.m_hInstance, tchszModulePath, sizeof(tchszModulePath)/sizeof(TCHAR)); // // Create some base key strings. lstrcpy(tchszCLSID, TEXT("CLSID\\")); lstrcat(tchszCLSID, cstrCLSID_IMPxEXPxASSISTANCT); // // Create ProgID keys. if (!SetRegKeyValue(TEXT("IngresImportExport.1"), NULL, TEXT("IngresImportExport - Import/Export Assistant"))) return E_FAIL; if (!SetRegKeyValue(TEXT("IngresImportExport.1"), TEXT("CLSID"), cstrCLSID_IMPxEXPxASSISTANCT)) return E_FAIL; // // Create VersionIndependentProgID keys. if (!SetRegKeyValue(TEXT("IngresImportExport"), NULL, TEXT("IngresImportExport - Import/Export Assistant"))) return E_FAIL; if (!SetRegKeyValue(TEXT("IngresImportExport"), TEXT("CurVer"), TEXT("IngresImportExport.1"))) return E_FAIL; if (!SetRegKeyValue(TEXT("IngresImportExport"), TEXT("CLSID"), cstrCLSID_IMPxEXPxASSISTANCT)) return E_FAIL; // // Create entries under CLSID. if (!SetRegKeyValue(tchszCLSID, NULL, TEXT("IngresImportExport - Import/Export Assistant"))) return E_FAIL; if (!SetRegKeyValue(tchszCLSID, TEXT("ProgID"), TEXT("IngresImportExport.1"))) return E_FAIL; if (!SetRegKeyValue(tchszCLSID, TEXT("VersionIndependentProgID"), TEXT("IngresImportExport"))) return E_FAIL; if (!SetRegKeyValue(tchszCLSID, TEXT("NotInsertable"), NULL)) return E_FAIL; if (!SetRegKeyValue(tchszCLSID, TEXT("InprocServer32"), tchszModulePath)) return E_FAIL; if (!AddRegNamedValue(tchszCLSID, TEXT("InprocServer32"), TEXT("ThreadingModel"), TEXT("Both"))) return E_FAIL; return NOERROR; }
void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, LPCWSTR chkbytes, ...) { std::wstring null = CStringFromGUID(GUID_NULL); std::wstring majortype = CStringFromGUID(MEDIATYPE_Stream); std::wstring subtype = CStringFromGUID(subtype2); SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("0"), chkbytes); SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("Source Filter"), CStringFromGUID(clsid)); DeleteRegKey(_T("Media Type\\") + null, subtype); va_list extensions; va_start(extensions, chkbytes); LPCWSTR ext = NULL; while (ext = va_arg(extensions, LPCWSTR)) { DeleteRegKey(_T("Media Type\\Extensions"), ext); } va_end(extensions); }
STDAPI DllRegisterServer() { SetRegKeyValue( _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"), _T("0"), _T("4,2,,11AF")); SetRegKeyValue( _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"), _T("1"), _T("4,2,,12AF")); SetRegKeyValue( _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"), _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}")); SetRegKeyValue( _T("Media Type\\Extensions"), _T(".fli"), _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}")); SetRegKeyValue( _T("Media Type\\Extensions"), _T(".flc"), _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}")); return AMovieDllRegisterServer2(TRUE); }
/*F+F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F Function: DllRegisterServer Summary: The standard exported function that can be called to command this DLL server to register itself in the system registry. Args: void. Returns: HRESULT NOERROR F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F-F*/ STDAPI DllRegisterServer(void) { HRESULT hr = NOERROR; TCHAR szID[GUID_SIZE+1]; TCHAR szCLSID[GUID_SIZE+1]; TCHAR szModulePath[MAX_PATH]; // Obtain the path to this module's executable file for later use. GetModuleFileName( g_pServer->m_hDllInst, szModulePath, sizeof(szModulePath)/sizeof(TCHAR)); /*------------------------------------------------------------------------- Create registry entries for the DllBall Component. -------------------------------------------------------------------------*/ // Create some base key strings. StringFromGUID2(CLSID_Ball, szID, GUID_SIZE); hr = StringCbCopy(szCLSID, sizeof(szCLSID), TEXT("CLSID\\")); assert(hr == S_OK); hr = StringCbCat(szCLSID, sizeof(szCLSID), szID); assert(hr == S_OK); // Create ProgID keys. SetRegKeyValue( TEXT("DllBall1.0"), NULL, TEXT("DllBall Component - FRESERVE Code Sample")); SetRegKeyValue( TEXT("DllBall1.0"), TEXT("CLSID"), szID); // Create VersionIndependentProgID keys. SetRegKeyValue( TEXT("DllBall"), NULL, TEXT("DllBall Component - FRESERVE Code Sample")); SetRegKeyValue( TEXT("DllBall"), TEXT("CurVer"), TEXT("DllBall1.0")); SetRegKeyValue( TEXT("DllBall"), TEXT("CLSID"), szID); // Create entries under CLSID. SetRegKeyValue( szCLSID, NULL, TEXT("DllBall Component - FRESERVE Code Sample")); SetRegKeyValue( szCLSID, TEXT("ProgID"), TEXT("DllBall1.0")); SetRegKeyValue( szCLSID, TEXT("VersionIndependentProgID"), TEXT("DllBall")); SetRegKeyValue( szCLSID, TEXT("NotInsertable"), NULL); SetRegKeyValue( szCLSID, TEXT("InprocServer32"), szModulePath); AddRegNamedValue( szCLSID, TEXT("InprocServer32"), TEXT("ThreadingModel"), TEXT("Free")); return hr; }
bool SetRegKeyValue(std::wstring szKey, std::wstring szSubkey, std::wstring szValue) { return SetRegKeyValue(szKey, szSubkey, _T(""), szValue); }
void RegisterProtocolSourceFilter(const CLSID& clsid, LPCWSTR protocol) { SetRegKeyValue(protocol, _T(""), _T("Source Filter"), CStringFromGUID(clsid)); }
/*F+F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F+++F Function: DllRegisterServer Summary: The standard exported function that can be called to command this DLL server to register itself in the system registry. Args: void. Returns: HRESULT NOERROR F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F---F-F*/ STDAPI DllRegisterServer(void) { HRESULT hr = NOERROR; TCHAR szID[GUID_SIZE+1]; TCHAR szCLSID[GUID_SIZE+32]; TCHAR szModulePath[MAX_PATH]; // Obtain the path to this module's executable file for later use. GetModuleFileName(g_hDllInst,szModulePath,sizeof(szModulePath)/sizeof(TCHAR)); // Create registry entries for the DllSndBall Component. // Create some base key strings. StringFromGUID2(CLSID_DBTHREAD_DLL, szID, GUID_SIZE); lstrcpy(szCLSID, TEXT("CLSID\\")); lstrcat(szCLSID, szID); // Create ProgID keys. SetRegKeyValue( TEXT("CTS.Thread.1"), NULL, TEXT("CTS Thread DLL by slowboat, eSofnet")); SetRegKeyValue( TEXT("CTS.CLSID_DBTHREAD_DLL.1"), TEXT("CLSID"), szID); // Create VersionIndependentProgID keys. SetRegKeyValue( TEXT("CTS.CLSID_DBTHREAD_DLL"), NULL, TEXT("DB Thread DLL by slowboat, eSofnet")); SetRegKeyValue( TEXT("CTS.CLSID_DBTHREAD_DLL.1"), TEXT("CurVer"), TEXT("CTS.CLSID_DBTHREAD_DLL.1")); SetRegKeyValue( TEXT("CTS.CLSID_DBTHREAD_DLL.1"), TEXT("CLSID"), szID); // Create entries under CLSID. SetRegKeyValue( szCLSID, NULL, TEXT("DB Thread DLL by slowboat, eSofnet")); SetRegKeyValue( szCLSID, TEXT("ProgID"), TEXT("CTS.CLSID_DBTHREAD_DLL.1")); SetRegKeyValue( szCLSID, TEXT("VersionIndependentProgID"), TEXT("CTS.CLSID_DBTHREAD_DLL.1")); SetRegKeyValue( szCLSID, TEXT("NotInsertable"), NULL); SetRegKeyValue( szCLSID, TEXT("InprocServer32"), szModulePath); AddRegNamedValue( szCLSID, TEXT("InprocServer32"), TEXT("ThreadingModel"), TEXT("Apartment")); return hr; }