예제 #1
0
/*
 * ClientRegTree::RegTreeInit()
 *
 * This object is meant to be passed from client to client as the sequential
 * WMT HTTP requests come in.  Therefore, only one client at a time is 
 * accessing it (so no mutex needed), but we must ensure that this object has
 * the context and registry for the current proc.  Thus, it must be init'ed
 * every time a new client picks it up.
 */
HX_RESULT
ClientRegTree::RegTreeInit(Client* pClient, IHXBuffer* pStartTime)
{
    HX_RELEASE(m_pContext);
    HX_RELEASE(m_pRegistry);
    HX_RELEASE(m_pClassFactory);

    m_pProc = pClient->proc;        // don't addref/release
    m_pProc->pc->server_context->
        QueryInterface(IID_IUnknown, (void**) &m_pContext);

    m_pContext->QueryInterface(IID_IHXRegistry, (void**) &m_pRegistry);
    m_pContext->QueryInterface(IID_IHXCommonClassFactory,
                               (void**) &m_pClassFactory);

    // The seqnum (session id) is persistent across calls.
    // Only set up the registry tree once.

    if (!m_ulRegistryConnId)
    {
        m_ulRegistryConnId = m_pProc->pc->server_info->
            IncrementTotalClientCount(m_pProc);

        InitRegistry(pStartTime);
    }

    return HXR_OK;
}
예제 #2
0
//-----------------------------------------------------------------------------
// Initialization, shutdown of a mod.
//-----------------------------------------------------------------------------
bool CEngineAPI::ModInit( const char *pModName, const char *pGameDir )
{
	// Set up the engineparms_t which contains global information about the mod
	host_parms.mod = COM_StringCopy( GetModDirFromPath( pModName ) );
	host_parms.game = COM_StringCopy( pGameDir );

	// By default, restrict server commands in Valve games and don't restrict them in mods.
	cl.m_bRestrictServerCommands = IsValveMod( host_parms.mod );
	cl.m_bRestrictClientCommands = cl.m_bRestrictServerCommands;

	// build the registry path we're going to use for this mod
	InitRegistry( pModName );

	// This sets up the game search path, depends on host_parms
	TRACEINIT( MapReslistGenerator_Init(), MapReslistGenerator_Shutdown() );
#if !defined( _X360 )
	TRACEINIT( DevShotGenerator_Init(), DevShotGenerator_Shutdown() );
#endif

	// Slam cvars based on mod/config.cfg
	Host_ReadPreStartupConfiguration();

	// Create the game window now that we have a search path
	// FIXME: Deal with initial window width + height better
	if ( !videomode || !videomode->CreateGameWindow( g_pMaterialSystemConfig->m_VideoMode.m_Width, g_pMaterialSystemConfig->m_VideoMode.m_Height, g_pMaterialSystemConfig->Windowed() ) )
	{
		return false;
	}

	return true;
}
예제 #3
0
// Normal exe's and standalones
BOOL InitPostTools2()
{
    return (
               SelectAllOp::Init() &&				// Init the SelectAll op
               SelectNoneOp::Init() &&				// Init the SelectNone op
#ifndef EXCLUDE_FROM_XARALX
               PORTNOTE("other","Removed a large amount of initialization")
               XPEEditOp::Init() &&				// Init the XPE Edit operation
               EditSelectionOp::Init() &&			// Init the "Edit Selection" op
               KeyPress::Init() &&					// Init the key press system
#endif
               FileInfo::Init() &&					// Init the document info dialogue

               ArrangeAlignment::Init() &&			// Init the arrange alignment dialogue
               OpAlign::Init() &&					// Init the align op
#ifndef EXCLUDE_FROM_XARALX
               BmpPrefsDlg::Init() &&				// Init the export bitmap options dialog
#endif
               TraceDlg::Init() &&					// Init the trace dialog
#ifndef EXCLUDE_FROM_XARALX
               WebAddressDlg::Init() &&
               PhotoCDDlg::Init() &&				// Init the import PhotoCD options dialog
#endif
               RenderDemoDlg::Init() &&			// Init the Render Demo Dialog
               AppPrefsDlg::Init() &&				// Init the application preference/options dialog
#ifndef EXCLUDE_FROM_XARALX
               TemplateDialog::Init() &&
               DocPrefsDlg::Init() &&				// Init the document preference/options dialog
#endif
               StandardUnit::Init() &&				// create some standard scale units (scunit.h)
               ColourEditDlg::Init() &&			// Init the colour editor dialogue
#ifndef EXCLUDE_FROM_XARALX
               OpConvertToBitmap::Init() &&
#endif
               OpNudge::Init() &&					// Init the nudge ops
               OpCombineShapes::Init() &&			// init the shape combining ops

               OpMenuSelectPathPoints::Init() &&
               OpCreateNodeBitmap::Init() &&

               ColourListComponentClass::Init() && // Init & register the colour list component
               BitmapListComponentClass::Init() && // Init & register the bitmap list component
               UnitListComponentClass::Init()	 && // Init & register the units component
               DocInfoComponentClass::Init()	 && // Init & register the document information component
               WizOpStyleComponentClass::Init() && // Init & register the styles component

               PrintComponentClass::Init()		 && // Init & register the print component
               PrintMarkComponentClass::Init()	 && // Init & register the print marks component
               ViewComponentClass::Init()		 && // Init & register the view component
               FontComponentClass::Init()		 && // Init & register the font component

// Neville 5/8/97 remove Stroking code
#ifdef VECTOR_STROKING
               StrokeComponentClass::Init()	 && // Init & register the stroke component
#endif // VECTOR_STROKING

               BrushComponentClass::Init()      && // Init & register the brush component
               RenderRegion::InitPrefs() &&		// Get the render region prefs from the .INI
               OSRenderRegion::Init() &&			// init GDI preferences
               SimpleCCObject::Init() &&			// Init the Memory tracking preferences
               ClickModifiers::DeclarePrefs() &&
               DocView::DeclarePreferences() &&	// Deals with DocViews preferences
               Document::ReadPrefs() &&			// read in class Document's preferences
               Convert::Init() &&					// Read number of decimal places, decimal point
               // and thousands seperator characters from
               // operating system .
               ColourDragInformation::Init() &&
               ColourPickerDragInformation::Init() &&
               BitmapDragInformation::Init() &&
               PORTNOTE("other","Removed more initialization")
#ifndef EXCLUDE_FROM_XARALX
               InitDiagnosticPrefs() &&			// Get the diagnostic preferences
#endif
               CCamView::ReadViewPrefs() &&
               PrintMonitor::InitPrefs() &&
               PrintProgressDlg::Init() &&

#ifndef EXCLUDE_FROM_XARALX
               BaseBar::DeclarePreferences() &&

               TransOperation::DeclarePrefs() &&
#endif
               AttributeManager::InitDefaults() &&
               PORTNOTE("other","Removed yet more initialization")
#ifndef EXCLUDE_FROM_XARALX
               ControlHelper::Init() &&
               DialogControlHelper::Init() &&
               FontFactory::Init() &&

               // The next three inits must be performed in this order
#endif
               Unit::Init() &&						// init the unit class and default units
               DocUnitList::Init() &&				// Init the doc unit list system
               DimScale::Init()  &&					// Init the dimension scaling system
               OpToolSelect::Init() &&				// Register Tool Selection operation


               PORTNOTE("other","Removed even more initialization")
#ifndef EXCLUDE_FROM_XARALX
               // Must always be initialised after all the tools have been
               ToolBarOp::Init() &&				// Make the bar of tool bitmaps
#endif
               HotKey::Init() &&					// Init hotkey system AFTER the tool op descs have been registered
               PORTNOTE("other","Removed even more initialization")
#ifndef EXCLUDE_FROM_XARALX
               InitHotKeySystem() &&				// Initialise Hot Key system
               InitButtonBar() &&					// Initialise ButtonBar
#endif
               Progress::Init() &&					// Initialise progress cursor/bar displays

               InternalClipboard::Initialise()	&&	// Create the application's internal clipboard cache
               // (this is a DOCUMENT, so must be left until fairly late)

               InitMenuSystem() &&					// Initialise Menu system (keep very last)
               // (esp. after all Register'ing has been done)

               AttrFillGeometry::Init() &&			// Initialise the fill editing operations

               EPSFilter::InitPrefs() &&			// Initialise default font mappings and
               // EPS export prefs
#ifndef DISABLE_TEXT_RENDERING
               FontCache::Init() &&
#endif
               TunedMemory::Init()	&&				// declare prefs for the memory manager

               OILRuler::Init() &&					// set the ruler widths depending on .ini font settings

#ifndef EXCLUDE_FROM_XARALX
               InitRegistry() &&					// register us with the shell etc
               InitAppState()	&&					// get workspace prefs
#endif
               SelMediaDlg::Init() &&
               TRUE
           );
}
예제 #4
0
BOOL CSTEditorApp::InitInstance()
{
	HRESULT hr;
    COleMessageFilter *pFilter;
	USES_CONVERSION;

#ifdef STEDITOR_DEBUG   
    DebugBreak();
#endif

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}
	hr = ::CoInitializeSecurity (NULL, -1, NULL, NULL,
	                             RPC_C_AUTHN_LEVEL_NONE, 
	                             RPC_C_IMP_LEVEL_IMPERSONATE, 
	                             NULL, EOAC_NONE, NULL);
	assert (SUCCEEDED (hr));    

    pFilter = AfxOleGetMessageFilter ();
    assert (pFilter);
    if (pFilter != NULL)
    {
        pFilter->EnableNotRespondingDialog (FALSE);
        pFilter->EnableBusyDialog (FALSE);
    };

    AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	_Module.Init (ObjectMap, m_hInstance);

	// Change the registry key under which our settings are stored.
	// You should modify this string to be something appropriate
	// such as the name of your company or organization.

	SetRegistryKey (_T("Softing\\4CONTROLV2\\4CONTROL Engineering"));               // keywords are case insensitive
	
	// AUTOFMT 08.08.06 SIS >>
	InitRegistry();
	// AUTOFMT 08.08.06 SIS <<

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	m_pDocTemplate = new CMultiDocTemplate(
		IDR_STTYPE,
		RUNTIME_CLASS(CSTEditorDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CSTEditorView));
	m_pDocTemplate->SetServerInfo(
		IDR_STTYPE_SRVR_EMB, IDR_STTYPE_SRVR_IP,
		RUNTIME_CLASS(CInPlaceFrame));
	AddDocTemplate(m_pDocTemplate);

	// Connect the COleTemplateServer to the document template.
	//  The COleTemplateServer creates new documents on behalf
	//  of requesting OLE containers by using information
	//  specified in the document template.
	m_server.ConnectTemplate(clsid, m_pDocTemplate, FALSE);

	// Register all OLE server factories as running.  This enables the
	//  OLE libraries to create objects from other applications.
	COleTemplateServer::RegisterAll();
		// Note: MDI applications register all server objects without regard
		//  to the /Embedding or /Automation on the command line.

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;
	m_pMainWnd = pMainFrame;

	// Enable drag/drop open
	m_pMainWnd->DragAcceptFiles();

	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);

	// Parse command line for standard shell commands, DDE, file open
	CSTCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Check to see if launched as OLE server
	if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
	{
		// Application was run with /Embedding or /Automation.  Don't show the
		//  main window in this case.
		return TRUE;
	}

	// When a server application is launched stand-alone, it is a good idea
	//  to update the system registry in case it has been damaged.
	m_server.UpdateRegistry(OAT_DOC_OBJECT_SERVER);
	COleObjectFactory::UpdateRegistryAll();

	if (cmdInfo.m_bRegServer)
	{
		TCHAR szModule[_MAX_PATH+10];
		LPOLESTR pszModule;
		HRESULT hr;
		LPTYPELIB pTypeLib;
		USES_CONVERSION;

		::GetModuleFileName (m_hInstance, szModule, _MAX_PATH);
		pszModule = T2OLE (szModule);
		hr = LoadTypeLib (pszModule, &pTypeLib);
		if (SUCCEEDED (hr))
		{
			hr = RegisterTypeLib (pTypeLib, pszModule, NULL);
			pTypeLib->Release ();
		};

		return (FALSE);
	};

    // Prevents ProcessShellCommand from displaying
    // a message box when unregistering.
    if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
    {
        cmdInfo.m_bRunEmbedded = true;
    };

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// The main window has been initialized, so show and update it.
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	return TRUE;
}
예제 #5
0
//-----------------------------------------------------------------------------
// One-time setup, based on the initially selected mod
// FIXME: This should move into the launcher!
//-----------------------------------------------------------------------------
bool CEngineAPI::OnStartup( void *pInstance, const char *pStartupModName )
{
	// This fixes a bug on certain machines where the input will 
	// stop coming in for about 1 second when someone hits a key.
	// (true means to disable priority boost)
	if ( IsPC() )
	{
		SetThreadPriorityBoost( GetCurrentThread(), true ); 
	}

	// FIXME: Turn videomode + game into IAppSystems?

	// Try to create the window
	COM_TimestampedLog( "game->Init" );

	// This has to happen before CreateGameWindow to set up the instance
	// for use by the code that creates the window
	if ( !game->Init( pInstance ) )
	{
		goto onStartupError;
	}

	// Try to create the window
	COM_TimestampedLog( "videomode->Init" );

	// This needs to be after Shader_Init and registry->Init
	// This way mods can have different default video settings
	if ( !videomode->Init( ) )
	{
		goto onStartupShutdownGame;
	}
	
	// We need to access the registry to get various settings (specifically,
	// InitMaterialSystemConfig requires it).
	if ( !InitRegistry( pStartupModName ) )
	{
		goto onStartupShutdownVideoMode;
	}

	materials->ModInit();

	// Setup the material system config record, CreateGameWindow depends on it
	// (when we're running stand-alone)
	InitMaterialSystemConfig( InEditMode() );

#if defined( _X360 )
	XBX_NotifyCreateListener( XNOTIFY_SYSTEM|XNOTIFY_LIVE|XNOTIFY_XMP );
#endif

	ShutdownRegistry();
	return true;

	// Various error conditions
onStartupShutdownVideoMode:
	videomode->Shutdown();

onStartupShutdownGame:
	game->Shutdown();

onStartupError:
	return false;
}