コード例 #1
0
ファイル: Globals.cpp プロジェクト: pbarounis/ActiveBar2
ITypeInfo *GetObjectTypeInfoEx(LCID lcid,REFIID iid)
{
	HRESULT hr;
	ITypeInfo **ppTypeInfo;
	if (iid==IID_IBands)
		ppTypeInfo=&g_bandsTypeLib;
	else if (iid==IID_IChildBands)
		ppTypeInfo=&g_childbandsTypeLib;
	else
		return NULL;

	if ((*ppTypeInfo)==NULL)
	{ //Try to load typelibrary
		ITypeLib *pTypeLib;
        ITypeInfo *pTypeInfoTmp;
        hr = LoadRegTypeLib(LIBID_PROJECT, 2, 0,lcid, &pTypeLib);
		if (FAILED(hr))
		{
			return NULL;
		}
		hr = pTypeLib->GetTypeInfoOfGuid(iid, &pTypeInfoTmp);
        *ppTypeInfo=pTypeInfoTmp;
		pTypeLib->Release();
	}

	if ((*ppTypeInfo)==NULL)
		return NULL;
	(*ppTypeInfo)->AddRef();
	return *ppTypeInfo;
}
コード例 #2
0
ファイル: ole-bridge.cpp プロジェクト: madbrain/ole-bridge
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow) {

    CoInitialize(NULL);
	
#if 0
    // register the type lib
	ITypeLib* pTLib = NULL;
	LoadTypeLibEx(L"AnyEXETypeInfo.tlb", REGKIND_REGISTER, &pTLib);
	pTLib->Release();
#endif

	if(strstr(lpCmdLine, "/Embedding") || strstr(lpCmdLine, "-Embedding")) {
        ComponentClassFactory cf;
		DWORD regID = 0;
		CoRegisterClassObject(CLSID_Component, (IClassFactory*)&cf, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &regID);
		MSG ms;
		while(GetMessage(&ms, 0, 0, 0)) {
			TranslateMessage(&ms);
			DispatchMessage(&ms);
		}
		CoRevokeClassObject(regID);
    }
	CoUninitialize();   
	return 0;
}
コード例 #3
0
//------------------------------------------------------------------------------
// CSimpleThermostatService::InitStdDispatch
//      Creates the standard dispatch object that will be used when IDispatch
//      is requested from this object. The UPnP device object will call this
//      function immediately after instantiation of this object.
//------------------------------------------------------------------------------
HRESULT CSimpleThermostatService::InitStdDispatch()
{
    HRESULT     hr          = S_OK;
    ITypeLib*   pTypeLib    = NULL;

    hr = LoadRegTypeLib(
        LIBID_SimpleThermostatDeviceLib,
        1,
        0,
        LANG_NEUTRAL,
        &pTypeLib
        );

    if( S_OK == hr )
    {
        hr = pTypeLib->GetTypeInfoOfGuid(
            __uuidof(ISimpleThermostat_UPnPService),
            &m_pTypeInfo
            );
        pTypeLib->Release();
    }

    if( S_OK == hr )
    {
        hr = CreateStdDispatch(
            reinterpret_cast<IUnknown*>(this),
            this,
            m_pTypeInfo,
            &m_pUnkStdDispatch
            );
    }

    return hr;
}// CSimpleThermostatService::InitStdDispatch
コード例 #4
0
ファイル: CppComTypeReader.cpp プロジェクト: rojac07/COM
int main(int argc, char* argv[])
{
	// ATL helper macro to convert between ANSI and Unicode strings.
	USES_CONVERSION;
	char oneMoreTime; // ('n' or 'y')
	char pathToComServer[100] = {0}; 

	do
	{
		// Get path to COM server.
		cout << "Please enter path to COM server (or *tlb file)";
		ITypeLib* pTypeLib = NULL;
		cin.ignore(0, '\n');
		cin.get(pathToComServer, 100);
	
		// Load type information for a COM server.
		if(SUCCEEDED(LoadTypeLibEx(A2W(pathToComServer), REGKIND_DEFAULT, &pTypeLib)))
		{
			// Read info about the type lib.
			DumpLibraryStats(pTypeLib);

			// Read info about COM types.
			DumpComTypes(pTypeLib);

			// COM clean up.
			pTypeLib->Release();
		}

		// Want another?
		cout << "Do you want to enter another? (y or n)";
		cin >> oneMoreTime;  
	}while (oneMoreTime != 'n');

	return 0;
}
コード例 #5
0
ファイル: iTunesPlugin.cpp プロジェクト: Crawping/rainmeter
	CiTunesEventHandler()
	{
		m_dwRefCount=0;
		ITypeLib* pITypeLib = nullptr ;
		HRESULT hr = ::LoadRegTypeLib(LIBID_iTunesLib, 1, 5, 0x00, &pITypeLib) ;
		// Get type information for the interface of the object.
		hr = pITypeLib->GetTypeInfoOfGuid(DIID__IiTunesEvents, &m_pITypeInfo) ;
		pITypeLib->Release() ;
	}
コード例 #6
0
ファイル: comreg.cpp プロジェクト: brion/webmdshow
HRESULT ComReg::UnRegisterTypeLibResource(const wchar_t* fullpath)
{
    ITypeLib* pTypeLib;

    HRESULT hr = LoadTypeLib(fullpath, &pTypeLib);
    //Does not register if filename is a full path, which is what we want.

    if (FAILED(hr))
        return hr;

    assert(pTypeLib);

    TLIBATTR* pLibAttr;

    hr = pTypeLib->GetLibAttr(&pLibAttr);

    if (FAILED(hr))
    {
        pTypeLib->Release();
        pTypeLib = 0;

        return hr;
    }

    assert(pLibAttr);
    const TLIBATTR a(*pLibAttr);

    pTypeLib->ReleaseTLibAttr(pLibAttr);

    pTypeLib->Release();
    pTypeLib = 0;

    hr = UnRegisterTypeLib(
            a.guid,
            a.wMajorVerNum,
            a.wMinorVerNum,
            a.lcid,
            a.syskind);

    return hr;
}
コード例 #7
0
// @pymethod |pythoncom|RegisterTypeLib|Adds information about a type library to the system registry.
PyObject *pythoncom_registertypelib(PyObject *self, PyObject *args)
{
	PyObject *obTypeLib, *obPath, *obHelpDir = Py_None;
	// @pyparm <o PyITypeLib>|typelib||The type library being registered.
	// @pyparm string|fullPath||Fully qualified path specification for the type library being registered
	// @pyparm string|helpDir|None|Directory in which the Help file for the library being registered can be found. Can be None.
	// @pyparm int|lcid|LOCALE_USER_DEFAULT|The locale ID to use.
	if (!PyArg_ParseTuple(args, "OO|O:RegisterTypeLib", &obTypeLib, &obPath, &obHelpDir))
		return NULL;

	PyObject *result = NULL;
	BSTR bstrPath = NULL;
	BSTR bstrHelpDir = NULL;
	ITypeLib *pLib = NULL;
	SCODE sc;
	if (!PyWinObject_AsBstr(obPath, &bstrPath, FALSE))
		goto done;
	if (!PyWinObject_AsBstr(obHelpDir, &bstrHelpDir, TRUE))
		goto done;

	if (!PyCom_InterfaceFromPyInstanceOrObject(obTypeLib, IID_ITypeLib, (void **)&pLib, FALSE))
		goto done;

	{ // scope to avoid warning about var decl and goto.
	PY_INTERFACE_PRECALL;
	sc = RegisterTypeLib(pLib, bstrPath, bstrHelpDir);
	PY_INTERFACE_POSTCALL;
	}
	if (FAILED(sc))
		return PyCom_BuildPyException(sc);

	result = Py_None;
	Py_INCREF(result);
done:
	if (bstrPath) SysFreeString(bstrPath);
	if (bstrHelpDir) SysFreeString(bstrHelpDir);
	if (pLib) {
		PY_INTERFACE_PRECALL;
		pLib->Release();
		PY_INTERFACE_POSTCALL;
	}
	return result;
	// @comm This function can be used during application initialization to register the application's type 
	// library correctly. When RegisterTypeLib is called to register a type library, 
	// both the minor and major version numbers are registered in hexadecimal.
	// <nl> In addition to filling in a complete registry entry under the type library key, 
	// RegisterTypeLib adds entries for each of the dispinterfaces and Automation-compatible 
	// interfaces, including dual interfaces. This information is required to create 
	// instances of these interfaces. Coclasses are not registered (that is, 
	// RegisterTypeLib does not write any values to the CLSID key of the coclass). 
}
コード例 #8
0
ファイル: LibraryLocal.cpp プロジェクト: GEO-IASS/nsis
int GetTLBVersion(tstring& filepath, DWORD& high, DWORD & low)
{
#ifdef _WIN32

  int found = 0;

  TCHAR fullpath[1024];
  TCHAR *p;
  if (!GetFullPathName(filepath.c_str(), COUNTOF(fullpath), fullpath, &p))
    return 0;

  ITypeLib* typeLib;
  HRESULT hr;

#ifdef _UNICODE
  hr = LoadTypeLib(fullpath, &typeLib);
#else
  // If built without UNICODE, we still need to convert this string to a Unicode string.
  WCHAR *ole_filename = (WCHAR*) WinWStrDupFromTChar(fullpath);
  if (!ole_filename) return 0;
  hr = LoadTypeLib(ole_filename, &typeLib);
  free(ole_filename);
#endif //~ _UNICODE
  
  if (SUCCEEDED(hr)) {

    TLIBATTR* typelibAttr;
    
    hr = typeLib->GetLibAttr(&typelibAttr);

    if (SUCCEEDED(hr)) {
      
      high = typelibAttr->wMajorVerNum;
      low = typelibAttr->wMinorVerNum;
      
      found = 1;

    }

    typeLib->Release();

  }

  return found;

#else

  return 0;

#endif //~ _WIN32
}
コード例 #9
0
static HRESULT maybeLoadTypeInfo()
{
	if (!m_pTypeInfo)
	{
		ITypeLib* ptl;
		if (SUCCEEDED( LoadRegTypeLib( LIBID_$$Safe_root$$, 1, 0, MAKELCID(0, SORT_DEFAULT), &ptl ) ))
		{
			ptl->GetTypeInfoOfGuid( IID_IControlSurface, &m_pTypeInfo );
			ptl->Release();
		}
		else
			return E_NOTIMPL;
	}
	return NOERROR;
}
コード例 #10
0
ファイル: comreg.cpp プロジェクト: brion/webmdshow
HRESULT ComReg::GetTypeLibAttr(
    const wchar_t* fullpath,
    TLIBATTR& a)
{
    ITypeLib* pTypeLib;

    HRESULT hr = LoadTypeLib(fullpath, &pTypeLib);
    //Does not register if filename is a full path, which is what we want.

    if (FAILED(hr))
        return hr;

    assert(pTypeLib);

    TLIBATTR* pLibAttr;

    hr = pTypeLib->GetLibAttr(&pLibAttr);

    if (FAILED(hr))
    {
        pTypeLib->Release();
        pTypeLib = 0;

        return hr;
    }

    assert(pLibAttr);
    a = *pLibAttr;

    pTypeLib->ReleaseTLibAttr(pLibAttr);

    pTypeLib->Release();
    pTypeLib = 0;

    return S_OK;
}
コード例 #11
0
HRESULT ComRegistration::registerTypeLib( HMODULE hInst )
{
	//get the qualified path of the dll calling this function
	WCHAR modulePath[MAX_PATH];
	GetModuleFileName( hInst, modulePath, MAX_PATH );

	ITypeLib *ptlib;

	HRESULT hr = LoadTypeLib( modulePath, &ptlib );
	if( !SUCCEEDED(hr) ) return hr;

	hr = RegisterTypeLib( ptlib, modulePath, NULL );
	
	ptlib->Release();

	return hr;
}
コード例 #12
0
STDAPI DllRegisterServer()
{
	HRESULT hr = AMovieDllRegisterServer2(TRUE);

	// register type library
	WCHAR achFileName[MAX_PATH];
	GetModuleFileNameW(g_hInst, achFileName, MAX_PATH);
	ITypeLib* pTypeLib;
	LoadTypeLib(achFileName, &pTypeLib);
	if (pTypeLib)
	{
		RegisterTypeLib(pTypeLib, achFileName, NULL);
		pTypeLib->Release();
	}

	return hr;
}
コード例 #13
0
ファイル: jdllcomx.cpp プロジェクト: EdKeith/core
STDMETHODIMP CJServer::GetTypeInfo(UINT itInfo, LCID lcid, ITypeInfo **ppITypeInfo)
{
    HRESULT     hr;
    ITypeLib   *pITypeLib;
    ITypeInfo **ppITI=NULL;

    if (0!=itInfo) return TYPE_E_ELEMENTNOTFOUND;

    if (NULL==ppITypeInfo) return E_POINTER;

    *ppITypeInfo=NULL;
    switch (PRIMARYLANGID(lcid))
    {
        case LANG_NEUTRAL:
        case LANG_ENGLISH:
            ppITI=&m_pITINeutral;
            break;

        default:
            return DISP_E_UNKNOWNLCID;
    }

    //Load a type lib if we don't have the information already.
    if (NULL==*ppITI)
    {
        hr=LoadRegTypeLib(jlibid, atoi(jversion), 0, PRIMARYLANGID(lcid), &pITypeLib);
        if (FAILED(hr)) return hr;

        //Got the type lib, get type info for the interface we want
        hr=pITypeLib->GetTypeInfoOfGuid(jiid, ppITI);
        pITypeLib->Release();
        if (FAILED(hr)) return hr;
	}

	// the type library is still loaded since we have an ITypeInfo from it.
    (*ppITI)->AddRef();
    *ppITypeInfo=*ppITI;
    return NOERROR;
}
コード例 #14
0
//==============================================
int g_RegisterCOM() {
    HRESULT hr;
    ITypeLib* pTypeLib;

    // Register typelib
    hr = LoadTypeLibEx(L"CP_TimeSync.exe", REGKIND_REGISTER, &pTypeLib);
    if( hr != S_OK) {
        return 1;
    }
    pTypeLib->Release();

    // Register server
    hr = g_RegisterServer( "CP_TimeSync.exe",  // application filename, full path is not needed
                           CLSID_CP_TimeSyncClass,          // ClassID GUID
                           "CP_TimeSync",      // Friendly name - shows up in dcomcnfg
                           "CP_TimeSync.Application",   // Version-independent ProgID used in late - binding
                           "CP_TimeSync.Application.1", // ProgID with version
                           NULL);                               // Threading model

    if( hr != S_OK) return 2;
    return 0;

}
コード例 #15
0
ITypeInfo *tCOMUtil::GetCoClassTypeInfo(IDispatch* pdisp, CLSID clsid)
{
  CHECKPARAM(pdisp);

  ITypeInfo* typeinfo = NULL;
  ITypeLib* typelib = NULL;
  HRESULT hr = S_OK;

  {
    unsigned int typeinfocount = 0;

    hr = pdisp->GetTypeInfoCount(&typeinfocount);

    if(FAILED(hr) || typeinfocount == 0)
      return NULL;
  }

  hr = pdisp->GetTypeInfo(0, 0, &typeinfo);

  if(FAILED(hr))
    return NULL;

  {
    unsigned int dumb_index = -1;
    hr = typeinfo->GetContainingTypeLib(&typelib, &dumb_index);
    COM_RELEASE(typeinfo);
  }

  if(FAILED(hr))
    return NULL;

  ITypeInfo* coclasstypeinfo = tCOMUtil::GetCoClassTypeInfo(typelib, clsid);
  typelib->Release();

  return coclasstypeinfo;
}
コード例 #16
0
ファイル: EventSink.cpp プロジェクト: dgraves/iTCH
bool EventSink::create()
{
  // Retrieve the type information for the _IiTiunesEvents base
  // Requesting iTunes COM SDK version 1.12
  VARIANT_BOOL compatible;
  HRESULT result = controller_->itunes_->CheckVersion(1, 12, &compatible);
  if (FAILED(result))
  {
    controller_->comError("Cannot query iTunes COM SDK version");
    return false;
  }

  if (!compatible)
  {
    controller_->comError("iTunes is not compatible with iTunes COM SDK version 1.12 (it is too old)");
    return false;
  }

  ITypeLib *typeLib = NULL ;
  result = ::LoadRegTypeLib(LIBID_iTunesLib, 1, 12, 0, &typeLib);
  if (FAILED(result))
  {
    controller_->comError("Could not load iTunes COM SDK version 1.12");
    return false;
  }

  result = typeLib->GetTypeInfoOfGuid(DIID__IiTunesEvents, &typeInfo_) ;
  typeLib->Release();
  if (FAILED(result))
  {
    controller_->comError("Could not retrieve iTunes COM SDK type info");
    return false;
  }

  return true;
}
コード例 #17
0
STDAPI DllUnregisterServer()
{
	HRESULT hr = AMovieDllRegisterServer2(FALSE);

	// unregister type library
	WCHAR achFileName[MAX_PATH];
	GetModuleFileNameW(g_hInst, achFileName, MAX_PATH);
	ITypeLib* pTypeLib;
	LoadTypeLib(achFileName, &pTypeLib);

	if (pTypeLib)
	{
		TLIBATTR* ptla;
		hr = pTypeLib->GetLibAttr(&ptla);
		if (SUCCEEDED(hr))
		{
			hr = UnRegisterTypeLib(ptla->guid, ptla->wMajorVerNum, ptla->wMinorVerNum, ptla->lcid, ptla->syskind);
			pTypeLib->ReleaseTLibAttr(ptla);
		}
		pTypeLib->Release();
	}

	return hr;
}
コード例 #18
0
ファイル: comreg.cpp プロジェクト: brion/webmdshow
HRESULT ComReg::RegisterTypeLibResource(
    const wchar_t* fullpath_,
    const wchar_t* helpdir_)
{
    ITypeLib* pTypeLib;

    HRESULT hr = LoadTypeLib(fullpath_, &pTypeLib);
    //Does not register if filename is a full path, which is what we want.

    if (FAILED(hr))
        return hr;

    assert(pTypeLib);

    wchar_t* const fullpath = const_cast<wchar_t*>(fullpath_);
    wchar_t* const helpdir = const_cast<wchar_t*>(helpdir_);

    hr = RegisterTypeLib(pTypeLib, fullpath, helpdir);

    pTypeLib->Release();
    pTypeLib = 0;

    return hr;
}
コード例 #19
0
STDMETHODIMP
CBaseDispatch::GetTypeInfo(
  REFIID riid,
  UINT itinfo,
  LCID lcid,
  ITypeInfo ** pptinfo)
{
    CheckPointer(pptinfo,E_POINTER);
    ValidateReadWritePtr(pptinfo,sizeof(ITypeInfo *));
    HRESULT hr;

    *pptinfo = NULL;

    // we only support one type element
    if (0 != itinfo) {
	return TYPE_E_ELEMENTNOTFOUND;
    }

    if (NULL == pptinfo) {
	return E_POINTER;
    }

    // always look for neutral
    if (NULL == m_pti) {

	LPLOADTYPELIB	    lpfnLoadTypeLib;
	LPLOADREGTYPELIB    lpfnLoadRegTypeLib;
	ITypeLib	    *ptlib;
	HINSTANCE	    hInst;

	static const char  szTypeLib[]	  = "LoadTypeLib";
	static const char  szRegTypeLib[] = "LoadRegTypeLib";
	static const WCHAR szControl[]	  = L"control.tlb";

	//
	// Try to get the Ole32Aut.dll module handle.
	//

	hInst = LoadOLEAut32();
	if (hInst == NULL) {
	    DWORD dwError = GetLastError();
	    return AmHresultFromWin32(dwError);
	}
	lpfnLoadRegTypeLib = (LPLOADREGTYPELIB)GetProcAddress(hInst,
							      szRegTypeLib);
	if (lpfnLoadRegTypeLib == NULL) {
	    DWORD dwError = GetLastError();
	    return AmHresultFromWin32(dwError);
	}

	hr = (*lpfnLoadRegTypeLib)(LIBID_QuartzTypeLib, 1, 0, // version 1.0
				   lcid, &ptlib);

	if (FAILED(hr)) {

	    // attempt to load directly - this will fill the
	    // registry in if it finds it

	    lpfnLoadTypeLib = (LPLOADTYPELIB)GetProcAddress(hInst, szTypeLib);
	    if (lpfnLoadTypeLib == NULL) {
		DWORD dwError = GetLastError();
		return AmHresultFromWin32(dwError);
	    }

	    hr = (*lpfnLoadTypeLib)(szControl, &ptlib);
	    if (FAILED(hr)) {
		return hr;
	    }
	}

	hr = ptlib->GetTypeInfoOfGuid(
		    riid,
		    &m_pti);

	ptlib->Release();

	if (FAILED(hr)) {
	    return hr;
	}
    }

    *pptinfo = m_pti;
    m_pti->AddRef();
    return S_OK;
}
コード例 #20
0
ITypeInfo *tCOMUtil::GetDispatchTypeInfo(IDispatch* pdisp)
{
  ITypeInfo* typeinfo = NULL;

  HRESULT hr = pdisp->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &typeinfo);

  if(FAILED(hr))
    return NULL;

  TYPEATTR *ptypeattr = NULL;

  typeinfo->GetTypeAttr(&ptypeattr);

  TYPEKIND typekind = ptypeattr->typekind;

  if(typekind == TKIND_DISPATCH)
  {
    typeinfo->ReleaseTypeAttr(ptypeattr);
    return typeinfo;
  }

  // tries to find another description of the same
  // interface in the typelib with TKIND_DISPATCH

  ITypeLib *ptypelib = NULL;
  unsigned int dumb = 0;
  IID iid = ptypeattr->guid;

  hr = typeinfo->GetContainingTypeLib(&ptypelib, &dumb);

  typeinfo->ReleaseTypeAttr(ptypeattr);

  // if there's no containing type lib, we have to
  // trust this one is the right type info
  if(FAILED(hr))
    return typeinfo;

  // obtem a typeinfo do iid fornecido
  // caso haja uma implementacao dispinterface,
  // esta' e' que sera' retornada (segundo
  // documentacao do ActiveX

  ITypeInfo* typeinfo_guid = NULL;

  hr = ptypelib->GetTypeInfoOfGuid(iid, &typeinfo_guid);

  if(FAILED(hr))
  {
    ptypelib->Release();
    return typeinfo;
  }

  // verifica se e' dispinterface
  TYPEATTR *ptypeattr_iface = NULL;

  hr = typeinfo_guid->GetTypeAttr(&ptypeattr_iface);
  TYPEKIND typekind_iface = ptypeattr_iface->typekind;
  typeinfo_guid->ReleaseTypeAttr(ptypeattr_iface);

  if(typekind_iface == TKIND_DISPATCH)
  {
    // releases original type information
    COM_RELEASE(typeinfo);

    return typeinfo_guid;
  }
  else
  {
    COM_RELEASE(typeinfo_guid);
    
    // returns original type info
    return typeinfo;
  }
}
コード例 #21
0
STDAPI DllRegisterServer(VOID)
#endif
{
   DBIPATH pszDllPath =
   {
      0
   };
   OLECHAR pszDllPathw[DBIMAXPATHLEN+1] =
   {
      0
   };
   HINSTANCE hInst;
   HRESULT rslt = SELFREG_E_CLASS;

   hInst = GetModuleHandle(DBCLIENT_DLL);
   if (hInst)
   {
      ITypeLib *pTypeLib = 0;

      DWORD dw = GetModuleFileName(hInst, pszDllPath, sizeof(pszDllPath)/sizeof(pszDllPath[0]));
      if (dw < 1)
      {
         regError("ERROR: Unable to retrieve module file name");
      }

      MultiByteToWideChar(0, 0, pszDllPath, -1, pszDllPathw, sizeof(pszDllPathw)/sizeof(pszDllPathw[0]));

      rslt = LoadTypeLib(pszDllPathw, &pTypeLib);
      if (!rslt)
      {
         HRESULT hr = RegisterTypeLib(pTypeLib, pszDllPathw, NULL);
         if (hr != S_OK)
         {
            regError("ERROR: RegisterTypeLib returned %lX", hr);
         }
         pTypeLib->Release();
         pTypeLib = 0;
      }
      else
      {
         regError("ERROR: LoadTypeLib returned %lX", rslt);
      }

#ifdef MIDAS_DLL
      // DSBASE
      rslt = Register_IF(pszDllPath, PROGID_MDSBASE, PROGID_MDSBASE_DESC, PROGID_MDSBASE_1, NULL, CLSID_MDSBASE_1,
         TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_MDSBASE_1, PROGID_MDSBASE_DESC_1, NULL, PROGID_MDSBASE, CLSID_MDSBASE_1,
         TRUE);
      // DSCursor
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_MDSCURSOR, PROGID_MDSCURSOR_DESC, PROGID_MDSCURSOR_1, NULL,
         CLSID_MDSCURSOR_1, TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_MDSCURSOR_1, PROGID_MDSCURSOR_DESC_1, NULL, PROGID_MDSCURSOR,
         CLSID_MDSCURSOR_1, TRUE);
      // DSDATAPACKET
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_MDATAPACKETREAD, PROGID_MDATAPACKETREAD_DESC, NULL, NULL,
         CLSID_MDATAPACKETREAD, TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_MDATAPACKETWRITE, PROGID_MDATAPACKETWRITE_DESC, NULL, NULL,
         CLSID_MDATAPACKETWRITE, TRUE);
#else
      // DSBASE
      rslt = Register_IF(pszDllPath, PROGID_DSBASE, PROGID_DSBASE_DESC, PROGID_DSBASE_2, NULL, CLSID_DSBASE_2, TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_DSBASE_1, PROGID_DSBASE_DESC_1, NULL, NULL, CLSID_DSBASE_1, TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_DSBASE_2, PROGID_DSBASE_DESC_2, NULL, PROGID_DSBASE, CLSID_DSBASE_2,
         TRUE);

      // DSCursor
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_DSCURSOR, PROGID_DSCURSOR_DESC, PROGID_DSCURSOR_2, NULL,
         CLSID_DSCURSOR_2, TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_DSCURSOR_1, PROGID_DSCURSOR_DESC_1, NULL, NULL, CLSID_DSCURSOR_1, TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_DSCURSOR_2, PROGID_DSCURSOR_DESC_2, NULL, PROGID_DSCURSOR,
         CLSID_DSCURSOR_2, TRUE);
      // DSDATAPACKET
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_DATAPACKETREAD, PROGID_DATAPACKETREAD_DESC, NULL, NULL,
         CLSID_DATAPACKETREAD, TRUE);
      if (!rslt)
         rslt = Register_IF(pszDllPath, PROGID_DATAPACKETWRITE, PROGID_DATAPACKETWRITE_DESC, NULL, NULL,
         CLSID_DATAPACKETWRITE, TRUE);
#endif
   }
   return rslt;
}
コード例 #22
0
ファイル: ctlreg.cpp プロジェクト: Rupan/winscp
BOOL AFXAPI AfxOleUnregisterTypeLib(REFGUID tlid, WORD wVerMajor,
	WORD wVerMinor, LCID lcid)
{
	USES_CONVERSION;

	// Load type library before unregistering it.
	ITypeLib* pTypeLib = NULL;
	if (wVerMajor != 0)
	{
		if (FAILED(LoadRegTypeLib(tlid, wVerMajor, wVerMinor, lcid, &pTypeLib)))
			pTypeLib = NULL;
	}

	// Format typelib guid as a string
	OLECHAR szTypeLibID[GUID_CCH];
	int cchGuid = ::StringFromGUID2(tlid, szTypeLibID, GUID_CCH);

	ASSERT(cchGuid == GUID_CCH);    // Did StringFromGUID2 work?
	if (cchGuid != GUID_CCH)
		return FALSE;

	TCHAR szKeyTypeLib[_MAX_PATH];
	BOOL bSurgical = FALSE;
	LONG error = ERROR_SUCCESS;

	wsprintf(szKeyTypeLib, _T("TYPELIB\\%s"), OLE2CT(szTypeLibID));

	HKEY hKeyTypeLib;
	if (RegOpenKey(HKEY_CLASSES_ROOT, szKeyTypeLib, &hKeyTypeLib) ==
		ERROR_SUCCESS)
	{
		int iKeyVersion = 0;
		HKEY hKeyVersion;
		TCHAR szVersion[_MAX_PATH];

		// Iterate through all installed versions of the control

		while (RegEnumKey(hKeyTypeLib, iKeyVersion, szVersion, _MAX_PATH) ==
			ERROR_SUCCESS)
		{
			hKeyVersion = NULL;
			BOOL bSurgicalVersion = FALSE;

			if (RegOpenKey(hKeyTypeLib, szVersion, &hKeyVersion) !=
				ERROR_SUCCESS)
			{
				++iKeyVersion;
				continue;
			}

			int iKeyLocale = 0;
			HKEY hKeyLocale;
			TCHAR szLocale[_MAX_PATH];

			// Iterate through all registered locales for this version

			while (RegEnumKey(hKeyVersion, iKeyLocale, szLocale, _MAX_PATH) ==
				ERROR_SUCCESS)
			{
				// Don't remove HELPDIR or FLAGS keys.
				if ((lstrcmpi(szLocale, _T("HELPDIR")) == 0) ||
					(lstrcmpi(szLocale, _T("FLAGS")) == 0))
				{
					++iKeyLocale;
					continue;
				}

				hKeyLocale = NULL;

				if (RegOpenKey(hKeyVersion, szLocale, &hKeyLocale) !=
					ERROR_SUCCESS)
				{
					++iKeyLocale;
					continue;
				}

				// Check if a 16-bit key is found when unregistering 32-bit
				HKEY hkey;
				if (RegOpenKey(hKeyLocale, TYPELIBWIN_2, &hkey) ==
					ERROR_SUCCESS)
				{
					RegCloseKey(hkey);

					// Only remove the keys specific to the 32-bit version
					// of control, leaving things intact for 16-bit version.
					error = _AfxRecursiveRegDeleteKey(hKeyLocale, TYPELIBWIN);
					bSurgicalVersion = TRUE;
					RegCloseKey(hKeyLocale);
				}
				else
				{
					// Delete everything for this locale.
					RegCloseKey(hKeyLocale);
					if (_AfxRecursiveRegDeleteKey(hKeyVersion, szLocale) ==
						ERROR_SUCCESS)
					{
						// Start over again, so we don't skip anything.
						iKeyLocale = 0;
						continue;
					}
				}
				++iKeyLocale;
			}
			RegCloseKey(hKeyVersion);

			if (bSurgicalVersion)
			{
				bSurgical = TRUE;
			}
			else
			{
				if (_AfxRecursiveRegDeleteKey(hKeyTypeLib, szVersion) ==
					ERROR_SUCCESS)
				{
					// Start over again, to make sure we don't skip anything.
					iKeyVersion = 0;
					continue;
				}
			}

			++iKeyVersion;
		}
		RegCloseKey(hKeyTypeLib);
	}

	if (!bSurgical)
		error = _AfxRecursiveRegDeleteKey(HKEY_CLASSES_ROOT, szKeyTypeLib);

	if (_AfxRegDeleteKeySucceeded(error))
	{
		// If type library was unregistered successfully, then also unregister
		// interfaces.
		if (pTypeLib != NULL)
		{
			ITypeLib* pDummy = NULL;
			if (FAILED(LoadRegTypeLib(tlid, wVerMajor, wVerMinor, lcid, &pDummy)))
				_AfxUnregisterInterfaces(pTypeLib);
			else
				pDummy->Release();

			pTypeLib->Release();
		}
	}

	return _AfxRegDeleteKeySucceeded(error);
}
コード例 #23
0
STDAPI DllUnregisterServer(VOID)
#endif
{
   HRESULT rslt;

   HINSTANCE hInst;

   hInst = GetModuleHandle(DBCLIENT_DLL);
   if (hInst)
   {
      DBIPATH pszDllPath =
      {
         0
      };
      OLECHAR pszDllPathw[DBIMAXPATHLEN+1] =
      {
         0
      };
      GetModuleFileName(hInst, pszDllPath, sizeof(pszDllPath));
      MultiByteToWideChar(0, 0, pszDllPath, -1, pszDllPathw, sizeof(pszDllPathw)/sizeof(pszDllPathw[0]));

      ITypeLib *pTypeLib = 0; ; // oleauto.h
      rslt = LoadTypeLib(pszDllPathw, &pTypeLib);
      if (!rslt)
      {
         TLIBATTR *pLibAttr = 0; // oaidl.h
         pTypeLib->GetLibAttr(&pLibAttr);
         HRESULT hr = UnRegisterTypeLib(pLibAttr->guid, pLibAttr->wMajorVerNum, pLibAttr->wMinorVerNum, pLibAttr->lcid,
            pLibAttr->syskind);
         if (hr != S_OK)
         {
            regError("ERROR: UnregisterTypeLib returned %lX", hr);
         }

         pTypeLib->ReleaseTLibAttr(pLibAttr);
         pTypeLib->Release();
         pTypeLib = 0;
      }
      else
      {
         regError("ERROR: LoadTypeLib returned %lX", rslt);
      }
   }

#ifdef MIDAS_DLL
   // DSBASE
   rslt = Register_IF(NULL, PROGID_MDSBASE, NULL, PROGID_MDSBASE_1, NULL, CLSID_MDSBASE_1, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_MDSBASE_1, NULL, NULL, NULL, CLSID_MDSBASE_1, FALSE);

   // DSCursor
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_MDSCURSOR, NULL, PROGID_MDSCURSOR_1, NULL, CLSID_MDSCURSOR_1, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_MDSCURSOR_1, NULL, NULL, NULL, CLSID_MDSCURSOR_1, FALSE);

   // DSDATAPACKET
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_MDATAPACKETREAD, NULL, NULL, NULL, CLSID_MDATAPACKETREAD, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_MDATAPACKETWRITE, NULL, NULL, NULL, CLSID_MDATAPACKETWRITE, FALSE);
#else
   // DSBASE
   rslt = Register_IF(NULL, PROGID_DSBASE, NULL, PROGID_DSBASE_2, NULL, CLSID_DSBASE_2, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_DSBASE_1, NULL, NULL, NULL, CLSID_DSBASE_1, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_DSBASE_2, NULL, NULL, NULL, CLSID_DSBASE_2, FALSE);

   // DSCursor
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_DSCURSOR, NULL, PROGID_DSCURSOR_2, NULL, CLSID_DSCURSOR_2, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_DSCURSOR_1, NULL, NULL, NULL, CLSID_DSCURSOR_1, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_DSCURSOR_2, NULL, NULL, NULL, CLSID_DSCURSOR_2, FALSE);

   // DSDATAPACKET
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_DATAPACKETREAD, NULL, NULL, NULL, CLSID_DATAPACKETREAD, FALSE);
   if (!rslt)
      rslt = Register_IF(NULL, PROGID_DATAPACKETWRITE, NULL, NULL, NULL, CLSID_DATAPACKETWRITE, FALSE);
#endif
   return rslt;
}
コード例 #24
0
ファイル: main.cpp プロジェクト: djrobx/vpinballx
   virtual BOOL InitInstance() 
   { 
#ifdef CRASH_HANDLER
      rde::CrashHandler::Init();
#endif

      // disable auto-rotate on tablets
#if (WINVER <= 0x0601)
      SetDisplayAutoRotationPreferences = (pSDARP)GetProcAddress(GetModuleHandle(TEXT("user32.dll")),
         "SetDisplayAutoRotationPreferences");
      if (SetDisplayAutoRotationPreferences)
         SetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE_LANDSCAPE);
#else
      SetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE_LANDSCAPE);
#endif

      g_hinst = theInstance;
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
      hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
      hRes = CoInitialize(NULL);
#endif
      _ASSERTE(SUCCEEDED(hRes));
      _Module.Init(ObjectMap, theInstance, &LIBID_VPinballLib);

      fFile = false;
      fPlay = false;
      fPov = false;
      bRun = true;
      int nRet = 0;
      memset(szTableFileName, 0, _MAX_PATH);
      // Start VP with file dialog open and then also playing that one?
      int stos;
      HRESULT hr = GetRegInt("Editor", "SelectTableOnStart", &stos);
      if (hr != S_OK)
         stos = 1; // The default = on
      if (stos)
      {
         fFile = true;
         fPlay = true;
         fPov = false;
      }

      int nArgs;
      LPSTR *szArglist = CommandLineToArgvA(GetCommandLine(), &nArgs);

      for (int i = 0; i < nArgs; ++i)
      {
         if (lstrcmpi(szArglist[i], _T("-h")) == 0 || lstrcmpi(szArglist[i], _T("/h")) == 0
            || lstrcmpi(szArglist[i], _T("-Help")) == 0 || lstrcmpi(szArglist[i], _T("/Help")) == 0
            || lstrcmpi(szArglist[i], _T("-?")) == 0 || lstrcmpi(szArglist[i], _T("/?")) == 0)
         {
            ShowError("-UnregServer  Unregister VP functions\n-RegServer  Register VP functions\n\n-DisableTrueFullscreen  Force-disable True Fullscreen setting\n\n-Edit [filename]  load file into VP\n-Play [filename]  load and play file\n-Pov [filename]  load, export pov and close");
            bRun = false;
            break;
         }

         if (lstrcmpi(szArglist[i], _T("-UnregServer")) == 0 || lstrcmpi(szArglist[i], _T("/UnregServer")) == 0)
         {
            _Module.UpdateRegistryFromResource(IDR_VPINBALL, FALSE);
            nRet = _Module.UnregisterServer(TRUE);
            bRun = false;
            break;
         }
         if (lstrcmpi(szArglist[i], _T("-RegServer")) == 0 || lstrcmpi(szArglist[i], _T("/RegServer")) == 0)
         {
            _Module.UpdateRegistryFromResource(IDR_VPINBALL, TRUE);
            nRet = _Module.RegisterServer(TRUE);
            bRun = false;
            break;
         }

         disableTrueFullscreen |= (lstrcmpi(szArglist[i], _T("-DisableTrueFullscreen")) == 0 || lstrcmpi(szArglist[i], _T("/DisableTrueFullscreen")) == 0);

         const bool editfile = (lstrcmpi(szArglist[i], _T("-Edit")) == 0 || lstrcmpi(szArglist[i], _T("/Edit")) == 0);
         const bool playfile = (lstrcmpi(szArglist[i], _T("-Play")) == 0 || lstrcmpi(szArglist[i], _T("/Play")) == 0);
		 const bool povfile = (lstrcmpi(szArglist[i], _T("-Pov")) == 0 || lstrcmpi(szArglist[i], _T("/Pov")) == 0);
		 if ((editfile || playfile || povfile) && (i + 1 < nArgs))
         {
            fFile = true;
            fPlay = playfile;
			fPov = povfile;

            // Remove leading - or /
            char* filename;
            if ((szArglist[i + 1][0] == '-') || (szArglist[i + 1][0] == '/'))
               filename = szArglist[i + 1] + 1;
            else
               filename = szArglist[i + 1];

            // Remove " "
            if (filename[0] == '"') {
               strcpy_s(szTableFileName, filename + 1);
               szTableFileName[lstrlen(szTableFileName) - 1] = '\0';
            }
            else
               strcpy_s(szTableFileName, filename);

            // Add current path
            char szLoadDir[MAX_PATH];
            if (szTableFileName[1] != ':') {
               GetCurrentDirectory(MAX_PATH, szLoadDir);
               strcat_s(szLoadDir, "\\");
               strcat_s(szLoadDir, szTableFileName);
               strcpy_s(szTableFileName, szLoadDir);
            }
            else
               // Or set from table path
               if (playfile) {
                  PathFromFilename(szTableFileName, szLoadDir);
                  SetCurrentDirectory(szLoadDir);
               }

            if (playfile || povfile)
               VPinball::SetOpenMinimized();

            break;
         }
      }

      free(szArglist);

      // load and register VP type library for COM integration
      char szFileName[_MAX_PATH];
      if (GetModuleFileName(theInstance, szFileName, _MAX_PATH))
      {
         ITypeLib *ptl = NULL;
         MAKE_WIDEPTR_FROMANSI(wszFileName, szFileName);
         if (SUCCEEDED(LoadTypeLib(wszFileName, &ptl)))
         {
            // first try to register system-wide (if running as admin)
            hr = RegisterTypeLib(ptl, wszFileName, NULL);
            if (!SUCCEEDED(hr))
            {
               // if failed, register only for current user
               hr = RegisterTypeLibForUser(ptl, wszFileName, NULL);
               if (!SUCCEEDED(hr))
                  MessageBox(0, "Could not register type library. Try running Visual Pinball as administrator.", "Error", MB_ICONWARNING);
            }
            ptl->Release();
         }
         else
            MessageBox(0, "Could not load type library.", "Error", MB_ICONSTOP);
      }

      //SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF );
      return TRUE;
   }
コード例 #25
0
ファイル: main.cpp プロジェクト: paulftw/vpinball
extern "C" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpCmdLine*/, int /*nShowCmd*/)
{
#ifdef CRASH_HANDLER
    rde::CrashHandler::Init();
#endif

	// disable auto-rotate on tablets
#if (WINVER <= 0x0601)
    SetDisplayAutoRotationPreferences = (pSDARP) GetProcAddress(GetModuleHandle(TEXT("user32.dll")),
                                                                "SetDisplayAutoRotationPreferences");
    if(SetDisplayAutoRotationPreferences)
        SetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE_LANDSCAPE);
#else
    SetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE_LANDSCAPE);
#endif

	g_hinst = hInstance;
   
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
    HRESULT hRes = CoInitialize(NULL);
#endif
    _ASSERTE(SUCCEEDED(hRes));
    _Module.Init(ObjectMap, hInstance, &LIBID_VPinballLib);

	bool fFile = false;
	bool fPlay = false;
    bool bRun = true;
	TCHAR szTableFileName[_MAX_PATH] = {0};
    int nRet = 0;

    int nArgs;
	LPSTR *szArglist = CommandLineToArgvA(GetCommandLine(), &nArgs);

	for(int i=0; i < nArgs; ++i)
    {
        if (lstrcmpi(szArglist[i], _T("-UnregServer"))==0 || lstrcmpi(szArglist[i], _T("/UnregServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_VPINBALL, FALSE);
            nRet = _Module.UnregisterServer(TRUE);
            bRun = false;
			break;
        }
        if (lstrcmpi(szArglist[i], _T("-RegServer"))==0 || lstrcmpi(szArglist[i], _T("/RegServer"))==0)
        {
            _Module.UpdateRegistryFromResource(IDR_VPINBALL, TRUE);
            nRet = _Module.RegisterServer(TRUE);
            bRun = false;
			break;
        }

		const bool editfile = (lstrcmpi(szArglist[i], _T("-Edit"))==0 || lstrcmpi(szArglist[i], _T("/Edit"))==0);
		const bool playfile = (lstrcmpi(szArglist[i], _T("-Play"))==0 || lstrcmpi(szArglist[i], _T("/Play"))==0);
        if ((editfile || playfile) && (i+1 < nArgs))
        {
			fFile = true;
			fPlay = playfile;

			// Remove leading - or /
			char* filename;
			if((szArglist[i+1][0] == '-') || (szArglist[i+1][0] == '/'))
				filename = szArglist[i+1]+1;
			else
				filename = szArglist[i+1];

			// Remove " "
			if(filename[0] == '"') {
				strcpy_s(szTableFileName,filename+1);
				szTableFileName[lstrlen(szTableFileName)] = '\0';
			}
			else
				strcpy_s(szTableFileName,filename);

			// Add current path
			char szLoadDir[MAX_PATH];
			if(szTableFileName[1] != ':') {
				GetCurrentDirectory(MAX_PATH,szLoadDir);
				strcat_s(szLoadDir,"\\");
				strcat_s(szLoadDir,szTableFileName);
				strcpy_s(szTableFileName,szLoadDir);
			} else
				// Or set from table path
				if(playfile) {
					PathFromFilename(szTableFileName, szLoadDir);
					SetCurrentDirectory(szLoadDir);
				}

			if(playfile)
				VPinball::SetOpenMinimized();

			break;
        }
    }

	free(szArglist);

    // load and register VP type library for COM integration
    char szFileName[_MAX_PATH];
    if (GetModuleFileName(hInstance, szFileName, _MAX_PATH))
    {
        ITypeLib *ptl = NULL;
        MAKE_WIDEPTR_FROMANSI(wszFileName, szFileName);
        if (SUCCEEDED(LoadTypeLib(wszFileName, &ptl)))
        {
            // first try to register system-wide (if running as admin)
            HRESULT hr = RegisterTypeLib(ptl, wszFileName, NULL);
            if (!SUCCEEDED(hr))
            {
                // if failed, register only for current user
                hr = RegisterTypeLibForUser(ptl, wszFileName, NULL);
                if (!SUCCEEDED(hr))
                    MessageBox(0, "Could not register type library. Try running Visual Pinball as administrator.", "Error", MB_ICONWARNING);
            }
            ptl->Release();
        }
        else
            MessageBox(0, "Could not load type library.", "Error", MB_ICONSTOP);
    }

    if (bRun)
    {
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
            REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
        _ASSERTE(SUCCEEDED(hRes));
        hRes = CoResumeClassObjects();
#else
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
            REGCLS_MULTIPLEUSE);
#endif
        _ASSERTE(SUCCEEDED(hRes));

		INITCOMMONCONTROLSEX iccex;
		iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
		iccex.dwICC = ICC_COOL_CLASSES;
		InitCommonControlsEx(&iccex);

        {
            EditableRegistry::RegisterEditable<Bumper>();
            EditableRegistry::RegisterEditable<Decal>();
            EditableRegistry::RegisterEditable<DispReel>();
            EditableRegistry::RegisterEditable<Flasher>();
            EditableRegistry::RegisterEditable<Flipper>();
            EditableRegistry::RegisterEditable<Gate>();
            EditableRegistry::RegisterEditable<Kicker>();
            EditableRegistry::RegisterEditable<Light>();
            EditableRegistry::RegisterEditable<LightSeq>();
            EditableRegistry::RegisterEditable<Plunger>();
            EditableRegistry::RegisterEditable<Primitive>();
            EditableRegistry::RegisterEditable<Ramp>();
            EditableRegistry::RegisterEditable<Rubber>();
            EditableRegistry::RegisterEditable<Spinner>();
            EditableRegistry::RegisterEditable<Surface>();
            EditableRegistry::RegisterEditable<Textbox>();
            EditableRegistry::RegisterEditable<Timer>();
            EditableRegistry::RegisterEditable<Trigger>();
        }

		g_pvp = new VPinball();
		g_pvp->AddRef();
		g_pvp->Init();
		g_haccel = LoadAccelerators(g_hinst,MAKEINTRESOURCE(IDR_VPACCEL));

		if (fFile)
			{
			g_pvp->LoadFileName(szTableFileName);

			if (fPlay)
				g_pvp->DoPlay();
			}

		// VBA APC handles message loop (bastards)
		g_pvp->MainMsgLoop();

		g_pvp->Release();

		DestroyAcceleratorTable(g_haccel);

        _Module.RevokeClassObjects();
        Sleep(dwPause); //wait for any threads to finish
    }

    _Module.Term();
    CoUninitialize();
#ifdef _CRTDBG_MAP_ALLOC
#ifdef DEBUG_XXX  //disable this in perference to DevPartner
	_CrtSetDumpClient(MemLeakAlert);
#endif
	_CrtDumpMemoryLeaks();
#endif
	//SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF );

    return nRet;
}
コード例 #26
0
ファイル: plugins.cpp プロジェクト: Nalatroz/trans3
/*
 * Load a plugin.
 */
IPlugin *loadPlugin(const STRING path)
{
    const STRING file = resolve(path);

    HMODULE mod = LoadLibrary(file.c_str());

    if (!mod)
    {
        messageBox(_T("The file ") + file + _T(" is not a valid dynamically linkable library."));
        return NULL;
    }

    FARPROC pReg = GetProcAddress(mod, _T("DllRegisterServer"));

    if (!pReg)
    {
        FreeLibrary(mod);
        COldPlugin *p = new COldPlugin();
        if (p->load(file))
        {
            p->initialize();
            return p;
        }
        messageBox(_T("The file ") + file + _T(" is not a valid plugin."));
        delete p;
        return NULL;
    }

    FreeLibrary(mod);

    CComPlugin *p = new CComPlugin();
    STRING manifestFile = file + ".x.manifest";

    // Create an "Active Context" to load the DLL into this processes
    // execution address.
    //
    // Normally you would have to register a COM DLL to access it which
    // would require administrative rights, to get around that issue
    // we are using "Registration Free COM".
    ACTCTX actCtx;
    memset((void*)&actCtx, 0, sizeof(ACTCTX));
    actCtx.cbSize = sizeof(ACTCTX);
    actCtx.lpSource = manifestFile.c_str();

    HANDLE hCtx = ::CreateActCtx(&actCtx);

    if (hCtx == INVALID_HANDLE_VALUE)
    {
        messageBox(_T("Failed to load the type library manifest ") + manifestFile + _T("."));
        return NULL;
    }
    else
    {
        ULONG_PTR cookie;

        if (::ActivateActCtx(hCtx, &cookie))
        {
            ITypeLib *pTypeLib = NULL;

            // Because we can't simply cast to 'LPCOLESTR'.
            std::wstring fileWstring = getUnicodeString(file);
            LPCOLESTR fileLibrary = fileWstring.c_str();

            if (FAILED(LoadTypeLib(fileLibrary, &pTypeLib)))
            {
                messageBox(_T("Failed to load the type library of ") + file + _T("."));
                return NULL;
            }

            const int types = pTypeLib->GetTypeInfoCount();

            // Check all the types in the library.
            bool bLoaded = false;
            for (int i = 0; i < types; ++i)
            {
                ITypeInfo *pTypeInfo = NULL;
                pTypeLib->GetTypeInfo(i, &pTypeInfo);

                if (bLoaded = p->load(pTypeInfo))
                {
                    break;
                }
            }

            // Release the type library.
            pTypeLib->Release();

            if (!bLoaded)
            {
                messageBox(_T("A remotable class was not found in ") + file + _T("."));
                delete p;
                return NULL;
            }

            ::DeactivateActCtx(0, cookie);
        }
    }

    p->initialize();

    return p;
}
コード例 #27
0
void CAtmoComRegistry::SaveSettings(ATMO_BOOL force) {
    CAtmoRegistry *reg = new CAtmoRegistry(HKEY_CLASSES_ROOT);
    char buffer[MAX_PATH];
    char exe[MAX_PATH];
//    char tlb[MAX_PATH];
    wchar_t widePath[MAX_PATH];

    GetModuleFileName(GetModuleHandle(NULL),exe,MAX_PATH);

    LPOLESTR aguid = NULL;

    if((reg->RegistryKeyExists("AtmoRemoteControl.1") == ATMO_FALSE) || force) {
        reg->WriteRegistryString("AtmoRemoteControl.1\\",NULL,"AtmoRemoteControl Basic Functions");
        StringFromCLSID(CLSID_AtmoRemoteControl,&aguid);
        reg->WriteRegistryString("AtmoRemoteControl.1\\CLSID\\",NULL,(char *)(_bstr_t)aguid);
        sprintf(buffer,"CLSID\\%s",(char *)(_bstr_t)aguid);
        reg->WriteRegistryString(buffer,NULL,"AtmoRemoteControl Basic Functions");
        sprintf(buffer,"CLSID\\%s\\LocalServer32",(char *)(_bstr_t)aguid);
        reg->WriteRegistryString(buffer,NULL,exe);
        sprintf(buffer,"CLSID\\%s\\ProgID",(char *)(_bstr_t)aguid);
        reg->WriteRegistryString(buffer,NULL,"AtmoRemoteControl.1");
        CoTaskMemFree(aguid);
    }

    if((reg->RegistryKeyExists("AtmoLiveViewControl.1") == ATMO_FALSE) || force) {
        reg->WriteRegistryString("AtmoLiveViewControl.1\\",NULL,"Atmo Live View Control Object");

        StringFromCLSID(CLSID_AtmoLiveViewControl,&aguid);
        reg->WriteRegistryString("AtmoLiveViewControl.1\\CLSID\\",NULL,(char *)(_bstr_t)aguid);

        sprintf(buffer,"CLSID\\%s",(char *)(_bstr_t)aguid);
        reg->WriteRegistryString(buffer,NULL,"Atmo Live View Control Object");

        sprintf(buffer,"CLSID\\%s\\LocalServer32",(char *)(_bstr_t)aguid);
        reg->WriteRegistryString(buffer,NULL,exe);

        sprintf(buffer,"CLSID\\%s\\ProgID",(char *)(_bstr_t)aguid);
        reg->WriteRegistryString(buffer,NULL,"AtmoLiveViewControl.1");

        CoTaskMemFree(aguid);
    }


//IAtmoRemoteControl
    StringFromIID(IID_IAtmoRemoteControl,&aguid);
    sprintf(buffer,"Interface\\%s",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"IAtmoRemoteControl");

    sprintf(buffer,"Interface\\%s\\ProxyStubClsid32",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"{00020424-0000-0000-C000-000000000046}");

    sprintf(buffer,"Interface\\%s\\TypeLib",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"{e01e2041-5afc-11d3-8e80-00805f91cdd9}");
    reg->WriteRegistryString(buffer,"Version","1.0");
    CoTaskMemFree(aguid);


//IAtmoRemoteControl2
    StringFromIID(IID_IAtmoRemoteControl2,&aguid);
    sprintf(buffer,"Interface\\%s",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"IAtmoRemoteControl2");

    sprintf(buffer,"Interface\\%s\\ProxyStubClsid32",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"{00020424-0000-0000-C000-000000000046}");

    sprintf(buffer,"Interface\\%s\\TypeLib",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"{e01e2041-5afc-11d3-8e80-00805f91cdd9}");
    reg->WriteRegistryString(buffer,"Version","1.0");
    CoTaskMemFree(aguid);

//IID_IAtmoLiveViewControl
    StringFromIID(IID_IAtmoLiveViewControl,&aguid);
    sprintf(buffer,"Interface\\%s",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"IAtmoLiveViewControl");

    sprintf(buffer,"Interface\\%s\\ProxyStubClsid32",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"{00020424-0000-0000-C000-000000000046}");

// {e01e2041-5afc-11d3-8e80-00805f91cdd9}
    sprintf(buffer,"Interface\\%s\\TypeLib",(char *)(_bstr_t)aguid);
    reg->WriteRegistryString(buffer,NULL,"{e01e2041-5afc-11d3-8e80-00805f91cdd9}");
    reg->WriteRegistryString(buffer,"Version","1.0");
    CoTaskMemFree(aguid);

    MultiByteToWideChar(CP_ACP, 0, exe, lstrlen(exe) + 1, widePath, MAX_PATH);
    ITypeLib *typeLib = NULL;
    HRESULT res;
    res = LoadTypeLib( widePath, &typeLib);
    if(res != S_OK) 
    {
       char buf[100];
       sprintf(buf, "LoadTypeLib failed. Code: 0x%.8x", res);
       MessageBox(0, buf, "Error" ,0);
    }

/*
 S_OK
 E_OUTOFMEMORY
 E_INVALIDARG
 TYPE_E_IOERROR
 TYPE_E_REGISTRYACCESS --> Vista Problem mit Registry und dem UAC krams!
 TYPE_E_INVALIDSTATE 
*/
    if(typeLib)
    {
       res = RegisterTypeLib(typeLib, widePath, 0);
       if(res == TYPE_E_REGISTRYACCESS)
       {
          HMODULE oleaut32 = GetModuleHandle("Oleaut32.dll");  
          if(oleaut32 != 0)
          {
            OaEnablePerUserTLibRegistrationFn oaEnablePerUserTLibRegistration = (OaEnablePerUserTLibRegistrationFn )GetProcAddress(oleaut32, "OaEnablePerUserTLibRegistration");
            if(oaEnablePerUserTLibRegistration)
            {
               oaEnablePerUserTLibRegistration();
               res = RegisterTypeLib(typeLib, widePath, 0);
            }
          }
       }
       if( res != S_OK ) 
       {
           if(force)
           {
              char buf[100];
              sprintf(buf, "RegisterTypeLib failed. Code: 0x%.8x", res);
              MessageBox(0, buf, "Error" ,0);
           }
       } else {
           if(force)
              MessageBox(0,"COM Server registered Ok!","Info",0);
       }
       typeLib->Release();
    }

    delete reg;
};
コード例 #28
0
ファイル: LibraryLocal.cpp プロジェクト: kichik/nsis-1
int main(int argc, char* argv[])
{

    // Parse the command line

    string cmdline;

    string mode;
    string filename;
    string filepath;

    int filefound = 0;

    if (argc != 4)
        return 1;

    // Get the full path of the local file

    mode = argv[1];
    filename = argv[2];

    char buf[MAX_PATH];
    GetCurrentDirectory(MAX_PATH, buf);
    filepath = buf;

    if ((filename.substr(0, 1).compare("\\") != 0) && (filename.substr(1, 1).compare(":") != 0)) {

        // Path is relative

        if (filepath.substr(filepath.length() - 1, 1).compare("\\") != 0)
            filepath.append("\\");

        filepath.append(filename);

    } else if ((filename.substr(0, 1).compare("\\") == 0) && (filename.substr(1, 1).compare("\\") != 0)) {

        // Path is relative to current root

        if (filepath.substr(1, 1).compare(":") == 0) {

            // Standard path

            filepath = filepath.substr(0, filepath.find('\\'));
            filepath.append(filename);

        } else {

            // UNC path

            filepath = filepath.substr(0, filepath.find('\\', filepath.find('\\', 2) + 1));
            filepath.append(filename);

        }

    } else {

        // Absolute path

        filepath = filename;

    }

    // Validate filename

    WIN32_FIND_DATA wfd;
    HANDLE hFind = FindFirstFile(filepath.c_str(), &wfd);

    if (hFind != INVALID_HANDLE_VALUE)
    {
        filefound = 1;
        FindClose(hFind);
    }

    int versionfound = 0;
    DWORD low = 0, high = 0;

    if (filefound)
    {

        // Get version

        // DLL

        if (mode.compare("D") == 0)
        {

            DWORD versionsize;
            DWORD temp;

            versionsize = GetFileVersionInfoSize((char*)filepath.c_str(), &temp);

            if (versionsize)
            {

                void *buf;
                buf = (void *)GlobalAlloc(GPTR, versionsize);

                if (buf)
                {

                    UINT uLen;
                    VS_FIXEDFILEINFO *pvsf;

                    if (GetFileVersionInfo((char*)filepath.c_str(), 0, versionsize, buf) && VerQueryValue(buf, "\\", (void**)&pvsf,&uLen))
                    {
                        high = pvsf->dwFileVersionMS;
                        low = pvsf->dwFileVersionLS;

                        versionfound = 1;
                    }

                    GlobalFree(buf);

                }

            }

        }

        // TLB

        if (mode.compare("T") == 0)
        {

            wchar_t ole_filename[1024];
            MultiByteToWideChar(CP_ACP, 0, filepath.c_str(), filepath.length() + 1, ole_filename, 1024);

            ITypeLib* typeLib;
            HRESULT hr;

            hr = LoadTypeLib(ole_filename, &typeLib);

            if (SUCCEEDED(hr)) {

                TLIBATTR* typelibAttr;

                hr = typeLib->GetLibAttr(&typelibAttr);

                if (SUCCEEDED(hr)) {

                    high = typelibAttr->wMajorVerNum;
                    low = typelibAttr->wMinorVerNum;

                    versionfound = 1;

                }

                typeLib->Release();

            }

        }

    }

    // Write the version to an NSIS header file

    ofstream header(argv[3], ofstream::out);

    if (header)
    {

        if (!filefound)
        {
            header << "!define LIBRARY_VERSION_FILENOTFOUND" << endl;
        }
        else if (!versionfound)
        {
            header << "!define LIBRARY_VERSION_NONE" << endl;
        }
        else
        {
            header << "!define LIBRARY_VERSION_HIGH " << high << endl;
            header << "!define LIBRARY_VERSION_LOW " << low << endl;
        }

        header.close();

    }

    return 0;

}
コード例 #29
0
ファイル: qaxdump.cpp プロジェクト: CodeDJ/qt5-hidpi
QString qax_generateDocumentation(QAxBase *that)
{
    that->metaObject();

    if (that->isNull())
	return QString();

    ITypeInfo *typeInfo = 0;
    IDispatch *dispatch = 0;
    that->queryInterface(IID_IDispatch, (void**)&dispatch);
    if (dispatch)
	dispatch->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &typeInfo);

    QString docu;
    QTextStream stream(&docu, QIODevice::WriteOnly);

    const QMetaObject *mo = that->metaObject();
    QString coClass  = QLatin1String(mo->classInfo(mo->indexOfClassInfo("CoClass")).value());

    stream << "<h1 align=center>" << coClass << " Reference</h1>" << endl;
    stream << "<p>The " << coClass << " COM object is a " << that->qObject()->metaObject()->className();
    stream << " with the CLSID " <<  that->control() << ".</p>" << endl;

    stream << "<h3>Interfaces</h3>" << endl;
    stream << "<ul>" << endl;
    const char *inter = 0;
    int interCount = 1;
    while ((inter = mo->classInfo(mo->indexOfClassInfo("Interface " + QByteArray::number(interCount))).value())) {
	stream << "<li>" << inter << endl;
	interCount++;
    }
    stream << "</ul>" << endl;

    stream << "<h3>Event Interfaces</h3>" << endl;
    stream << "<ul>" << endl;
    interCount = 1;  
    while ((inter = mo->classInfo(mo->indexOfClassInfo("Event Interface " + QByteArray::number(interCount))).value())) {
	stream << "<li>" << inter << endl;
	interCount++;
    }
    stream << "</ul>" << endl;

    QList<QString> methodDetails, propDetails;

    const int slotCount = mo->methodCount();
    if (slotCount) {
	stream << "<h2>Public Slots:</h2>" << endl;
	stream << "<ul>" << endl;

        int defArgCount = 0;
	for (int islot = mo->methodOffset(); islot < slotCount; ++islot) {
	    const QMetaMethod slot = mo->method(islot);
            if (slot.methodType() != QMetaMethod::Slot)
                continue;

            if (slot.attributes() & QMetaMethod::Cloned) {
                ++defArgCount;
                continue;
            }

	    QByteArray returntype(slot.typeName());
            if (returntype.isEmpty())
                returntype = "void";
            QByteArray prototype = namedPrototype(slot.parameterTypes(), slot.parameterNames(), defArgCount);
            QByteArray signature = slot.methodSignature();
	    QByteArray name = signature.left(signature.indexOf('('));
	    stream << "<li>" << returntype << " <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << endl;
            
            prototype = namedPrototype(slot.parameterTypes(), slot.parameterNames());
	    QString detail = QString::fromLatin1("<h3><a name=") + QString::fromLatin1(name.constData()) + QLatin1String("></a>") +
                             QLatin1String(returntype.constData()) + QLatin1Char(' ') +
                             QLatin1String(name.constData()) + QLatin1Char(' ') +
                             QString::fromLatin1(prototype.constData()) + QLatin1String("<tt> [slot]</tt></h3>\n");
            prototype = namedPrototype(slot.parameterTypes(), QList<QByteArray>());
	    detail += docuFromName(typeInfo, QString::fromLatin1(name.constData()));
	    detail += QLatin1String("<p>Connect a signal to this slot:<pre>\n");
	    detail += QString::fromLatin1("\tQObject::connect(sender, SIGNAL(someSignal") + QString::fromLatin1(prototype.constData()) +
                      QLatin1String("), object, SLOT(") + QString::fromLatin1(name.constData()) +
                      QString::fromLatin1(prototype.constData()) + QLatin1String("));");
	    detail += QLatin1String("</pre>\n");

            if (1) {
                detail += QLatin1String("<p>Or call the function directly:<pre>\n");

                bool hasParams = slot.parameterTypes().count() != 0;
                if (hasParams)
                    detail += QLatin1String("\tQVariantList params = ...\n");
                detail += QLatin1String("\t");
                QByteArray functionToCall = "dynamicCall";
                if (returntype == "IDispatch*" || returntype == "IUnknown*") {
                    functionToCall = "querySubObject";
                    returntype = "QAxObject *";
                }
                if (returntype != "void")
                    detail += QLatin1String(returntype.constData()) + QLatin1String(" result = ");
                detail += QLatin1String("object->") + QLatin1String(functionToCall.constData()) +
                          QLatin1String("(\"" + name + prototype + '\"');
                if (hasParams)
                    detail += QLatin1String(", params");
                detail += QLatin1Char(')');
                if (returntype != "void" && returntype != "QAxObject *" && returntype != "QVariant")
                    detail += QLatin1Char('.') + QLatin1String(toType(returntype));
	        detail += QLatin1String(";</pre>\n");
	    } else {
		detail += QLatin1String("<p>This function has parameters of unsupported types and cannot be called directly.");
	    }

	    methodDetails << detail;
            defArgCount = 0;
	}

	stream << "</ul>" << endl;
    }
    int signalCount = mo->methodCount();
    if (signalCount) {
        ITypeLib *typeLib = 0;
        if (typeInfo) {
            UINT index = 0;
            typeInfo->GetContainingTypeLib(&typeLib, &index);
            typeInfo->Release();
        }
        typeInfo = 0;

	stream << "<h2>Signals:</h2>" << endl;
	stream << "<ul>" << endl;

	for (int isignal = mo->methodOffset(); isignal < signalCount; ++isignal) {
	    const QMetaMethod signal(mo->method(isignal));
            if (signal.methodType() != QMetaMethod::Signal)
                continue;

            QByteArray prototype = namedPrototype(signal.parameterTypes(), signal.parameterNames());
            QByteArray signature = signal.methodSignature();
	    QByteArray name = signature.left(signature.indexOf('('));
	    stream << "<li>void <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << endl;

            QString detail = QLatin1String("<h3><a name=") + QLatin1String(name.constData()) + QLatin1String("></a>void ") +
                             QLatin1String(name.constData()) + QLatin1Char(' ') +
                             QLatin1String(prototype.constData()) + QLatin1String("<tt> [signal]</tt></h3>\n");
            if (typeLib) {
                interCount = 0;
                do {
                    if (typeInfo)
                        typeInfo->Release();
                    typeInfo = 0;
                    typeLib->GetTypeInfo(++interCount, &typeInfo);
                    QString typeLibDocu = docuFromName(typeInfo, QString::fromLatin1(name.constData()));
                    if (!typeLibDocu.isEmpty()) {
                        detail += typeLibDocu;
                        break;
                    }
                } while (typeInfo);
            }
            prototype = namedPrototype(signal.parameterTypes(), QList<QByteArray>());
	    detail += QLatin1String("<p>Connect a slot to this signal:<pre>\n");
	    detail += QLatin1String("\tQObject::connect(object, SIGNAL(") + QString::fromLatin1(name.constData()) +
                      QString::fromLatin1(prototype.constData()) +
                      QLatin1String("), receiver, SLOT(someSlot") + QString::fromLatin1(prototype.constData()) + QLatin1String("));");
	    detail += QLatin1String("</pre>\n");

	    methodDetails << detail;
            if (typeInfo)
                typeInfo->Release();
            typeInfo = 0;
	}
	stream << "</ul>" << endl;

        if (typeLib)
            typeLib->Release();
    }

    const int propCount = mo->propertyCount();
    if (propCount) {
        if (dispatch)
	    dispatch->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &typeInfo);
	stream << "<h2>Properties:</h2>" << endl;
	stream << "<ul>" << endl;

	for (int iprop = 0; iprop < propCount; ++iprop) {
	    const QMetaProperty prop = mo->property(iprop);
	    QByteArray name(prop.name());
	    QByteArray type(prop.typeName());

	    stream << "<li>" << type << " <a href=\"#" << name << "\"><b>" << name << "</b></a>;</li>" << endl;
	    QString detail = QLatin1String("<h3><a name=") + QString::fromLatin1(name.constData()) + QLatin1String("></a>") +
                             QLatin1String(type.constData()) +
		             QLatin1Char(' ') + QLatin1String(name.constData()) + QLatin1String("</h3>\n");
	    detail += docuFromName(typeInfo, QString::fromLatin1(name));
	    QVariant::Type vartype = QVariant::nameToType(type);
	    if (!prop.isReadable())
		continue;

	    if (prop.isEnumType())
		vartype = QVariant::Int;

            if (vartype != QVariant::Invalid) {
		detail += QLatin1String("<p>Read this property's value using QObject::property:<pre>\n");
                if (prop.isEnumType())
		    detail += QLatin1String("\tint val = ");
                else
                    detail += QLatin1Char('\t') + QLatin1String(type.constData()) + QLatin1String(" val = ");
		detail += QLatin1String("object->property(\"") + QLatin1String(name.constData()) +
                          QLatin1String("\").") + QLatin1String(toType(type).constData()) + QLatin1String(";\n");
		detail += QLatin1String("</pre>\n");
	    } else if (type == "IDispatch*" || type == "IUnknown*") {
		detail += QLatin1String("<p>Get the subobject using querySubObject:<pre>\n");
		detail += QLatin1String("\tQAxObject *") + QLatin1String(name.constData()) +
                          QLatin1String(" = object->querySubObject(\"") + QLatin1String(name.constData()) + QLatin1String("\");\n");
		detail += QLatin1String("</pre>\n");
	    } else {
		detail += QLatin1String("<p>This property is of an unsupported type.\n");
	    }
	    if (prop.isWritable()) {
		detail += QLatin1String("Set this property' value using QObject::setProperty:<pre>\n");
                if (prop.isEnumType()) {
                    detail += QLatin1String("\tint newValue = ... // string representation of values also supported\n");
                } else {
		    detail += QLatin1String("\t") + QString::fromLatin1(type.constData()) + QLatin1String(" newValue = ...\n");
                }
		detail += QLatin1String("\tobject->setProperty(\"") + QString::fromLatin1(name) + QLatin1String("\", newValue);\n");
		detail += QLatin1String("</pre>\n");
		detail += QLatin1String("Or using the ");
		QByteArray setterSlot;
                if (isupper(name.at(0))) {
		    setterSlot = "Set" + name;
		} else {
		    QByteArray nameUp = name;
		    nameUp[0] = toupper(nameUp.at(0));
		    setterSlot = "set" + nameUp;
		}
		detail += QLatin1String("<a href=\"#") + QString::fromLatin1(setterSlot) + QLatin1String("\">") +
                          QString::fromLatin1(setterSlot.constData()) + QLatin1String("</a> slot.\n");
	    }
	    if (prop.isEnumType()) {
		detail += QLatin1String("<p>See also <a href=\"#") + QString::fromLatin1(type) +
                QLatin1String("\">") + QString::fromLatin1(type) + QLatin1String("</a>.\n");
	    }

	    propDetails << detail;
	}
	stream << "</ul>" << endl;
    }

    const int enumCount = mo->enumeratorCount();
    if (enumCount) {
	stream << "<hr><h2>Member Type Documentation</h2>" << endl;
	for (int i = 0; i < enumCount; ++i) {
	    const QMetaEnum enumdata = mo->enumerator(i);
	    stream << "<h3><a name=" << enumdata.name() << "></a>" << enumdata.name() << "</h3>" << endl;
	    stream << "<ul>" << endl;
	    for (int e = 0; e < enumdata.keyCount(); ++e) {
		stream << "<li>" << enumdata.key(e) << "\t=" << enumdata.value(e) << "</li>" << endl;
	    }
	    stream << "</ul>" << endl;
	}
    }
    if (methodDetails.count()) {
	stream << "<hr><h2>Member Function Documentation</h2>" << endl;
	for (int i = 0; i < methodDetails.count(); ++i)
	    stream << methodDetails.at(i) << endl;
    }
    if (propDetails.count()) {
	stream << "<hr><h2>Property Documentation</h2>" << endl;
	for (int i = 0; i < propDetails.count(); ++i)
	    stream << propDetails.at(i) << endl;
    }

    if (typeInfo)
        typeInfo->Release();
    if (dispatch)
        dispatch->Release();
    return docu;
}