Exemplo n.º 1
0
//
//  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;
}
Exemplo n.º 2
0
/*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;
}
Exemplo n.º 3
0
/*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;
}