Beispiel #1
0
__declspec(dllexport) int WINAPI xlAutoOpen(void)
{
	static XLOPER xDLL;
	Excel4(xlGetName, &xDLL, 0);

	// Clear out and existing function names and reset function count
	g_functionCount = 0;
	g_serverCount = 0;

	// Check for providers key (a list of section names with server settings)
	char* providers = iniparser_getstring(g_ini, FS_PROVIDERS, NULL);

	if(providers) {
		// Grab the list of providers and register each
		ParseProviders(providers);
		for(int i = 0; i < g_serverCount; i++) {
			RegisterServer(&xDLL, i);
		}
	} else {
		// Backwards compatible - just the one under the main section
		g_serverCount = 1;
		g_serverSections[0] = NULL;
		RegisterServer(&xDLL, 0);
	}

	// Free the XLL filename
	Excel4(xlFree, 0, 1, (LPXLOPER) &xDLL);

	// OK
	return 1;
}
Beispiel #2
0
	STDAPI DllRegisterServer(void) {
		WCHAR path[MAX_PATH];
		GetModuleFileName(g_hMod, path, MAX_PATH);
		RegisterServer(CLSID_Book, L"BookLib.Book", 1);
		RegisterServer(CLSID_Chapter, L"BookLib.Chapter", 1);
		RegisterServer(CLSID_Section, L"BookLib.Section", 1);
		ITypeLib* typeLib = nullptr;
		auto hr = LoadTypeLib(path, &typeLib);
		if (hr != S_OK) {
			return hr;
		}
		hr = RegisterTypeLib(typeLib, path, NULL);
		return hr;
	}
Beispiel #3
0
STDAPI DllUnregisterServer()
{
  RegisterComCat(CLSID_WorkraveDeskBand, CATID_DeskBand, FALSE);
  RegisterServer(CLSID_WorkraveDeskBand, TEXT("Workrave"), FALSE);
  ClearDeskBandCache();
  return S_OK;
}
Beispiel #4
0
extern "C" HRESULT __stdcall DllRegisterServer()
{
  //DebugBreak();
  TCHAR dllPath[MAX_PATH];
  GetModuleFileName(ghInstance, dllPath, MAX_PATH);
  return RegisterServer(dllPath, CLSID_acdk_lang_Object, _T("ACDK COM interface"), _T("Acdk.Object"), _T("Acdk.AcdkObject.1"), NULL);
}
Beispiel #5
0
void CRegisterControlsDlg::OnRegister()
{
   POSITION posPathName;
   CString strPathName;
   int nResult;

   CFileDialog dlg( TRUE, _T( "dll" ), NULL, OFN_HIDEREADONLY|
	  OFN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT, _T(
	  "ActiveX Controls|*.dll;*.ocx;*.ax||" ) );

   nResult = (int)dlg.DoModal();
   if( nResult != IDOK )
   {
	  return;
   }

   CWaitCursor wait;

   posPathName = dlg.GetStartPosition();
   while( posPathName != NULL )
   {
	  strPathName = dlg.GetNextPathName( posPathName );
	  RegisterServer( strPathName );
   }

   RefreshRegisteredControls();
}
	void CLogSocket::SetServiceName(const std::string &sName)
	{
		m_sServiceName = sName;
		if (!m_ClientSocket.IsConnected())
			m_ClientSocket.Open();
		RegisterServer();
	}
Beispiel #7
0
  void DirectoryServer::ProcessRegisterServer(INetPacket* thePacket)
  {
    // The application ID to register this server under
    typeAppID anAppID;

    // The server info structure to build
    typeServerInfo anServerInfo;

    // The server address information as an integer
    Uint32 anServerAddress;

    // Retrieve the application ID from the RegisterServer message
    *thePacket >> anAppID;

    // Retrieve the address, port, client info, version and id
    *thePacket >> anServerAddress;
    *thePacket >> anServerInfo.port;
    *thePacket >> anServerInfo.maxClients;
    *thePacket >> anServerInfo.activeClients;
    *thePacket >> anServerInfo.version.mMajor;
    *thePacket >> anServerInfo.version.mMinor;
    *thePacket >> anServerInfo.version.mPatchBuild;
    *thePacket >> anServerInfo.alias;

    // Now convert the integer address into an sf::IPAddress
#if (SFML_VERSION_MAJOR < 2)
    anServerInfo.address = anServerAddress;
#else
    anServerInfo.address = sf::IpAddress(anServerAddress);
#endif

    // Now attempt to register this server
    RegisterServer(anAppID, anServerInfo);
  }
Beispiel #8
0
	/*!
		install service		-i 
		uninstall service	-u 
		run as service		-runas service
		run as session		-runas session -parent n
		check and install	-c
		run hook			-runas hook -parent n
	*/
	bool ParseCommandLine(LPCTSTR lpCmdLine, HRESULT* pnRetCode) throw()
	{
		if (!CAtlServiceModuleT< CWinRobotHostModule, IDS_SERVICENAME >::ParseCommandLine(lpCmdLine, pnRetCode))
			return false;

		TCHAR szTokens[] = _T("-/");
		*pnRetCode = S_OK;

		LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
		while (lpszToken != NULL)
		{
			if (WordCmpI(lpszToken, _T("I"))==0) // install
			{
				*pnRetCode = RegisterAppId(true);
				if (SUCCEEDED(*pnRetCode))
					*pnRetCode = RegisterServer(TRUE);
				return false;
			}
			else if (WordCmpI(lpszToken, _T("U"))==0)// uninstall
			{
				*pnRetCode = UnregisterServer(TRUE);
				if (SUCCEEDED(*pnRetCode))
					*pnRetCode = UnregisterAppId();
				return false;
			}
			else if (WordCmpI(lpszToken, _T("runas"))==0)
			{
				lpszToken = FindOneOf(lpszToken, _T(" "));
				if (WordCmpI(lpszToken, _T("service")) == 0) // run as service
				{
					return true;
				}
				else if(WordCmpI(lpszToken, _T("session")) == 0) // run as session
				{
					lpszToken = FindOneOf(lpszToken, _T("-/"));
					if(WordCmpI(lpszToken, _T("parent")) == 0)
					{
						lpszToken = FindOneOf(lpszToken, _T(" "));
						CSessionHost host(_tcstoul(lpszToken,0,10));
						host.Run();
						host.WaitThreadEnd();
					}
				}
				else if(WordCmpI(lpszToken, _T("hook")) == 0) // run as session
				{
					lpszToken = FindOneOf(lpszToken, _T("-/"));
					if(WordCmpI(lpszToken, _T("parent")) == 0)
					{
						lpszToken = FindOneOf(lpszToken, _T(" "));
						CHookHost host(_tcstoul(lpszToken,0,10));
						host.Run();
					}
				}
				return false;
			}
			lpszToken = FindOneOf(lpszToken, szTokens);
		}
		return true;
	}
Beispiel #9
0
int CWorldCrossserver::FromRpcCall(CPluto& u)
{
	//printf("CWorldLogin::from_rpc_call\n");

	pluto_msgid_t msg_id = u.GetMsgId();
	if(!CSCheckClientRpc(u))
	{
		LogWarning("from_rpc_call", "invalid rpcall error.unknown msgid:%d\n", msg_id);
		return -1;
	}

	u.Decode();
	int nRet = ERR_RPC_UNKNOWN_MSGID;
	switch(msg_id)
	{
		//case MSGID_CROSSSERVER_ON_CROSS_REQ:
		//{
		//    nRet = OnCrossReq(u);
		//    break;
		//}
		case MSGID_CROSSSERVER_RPC:
			{
				nRet = OnCrossServerRpc(u);
				break;
			}
		case MSGID_CROSSSERVER_REGISTER_SERVER:
			{
				nRet = RegisterServer(u);
				break;
			}
		case MSGID_CROSSSERVER_CLIENT_RESP_PROXY:
			{
				nRet = OnCrossClientResp(u);
				break;
			}
		case MSGID_CROSSSERVER_CLIENT_BC_PROXY:
			{
				nRet = OnCrossClientBroadcast(u);
				break;
			}
		case MSGID_CROSSSERVER_CHECK_MD5:
			{
				nRet = CheckMd5(u);
				break;
			}
		default:
			{
				LogWarning("CWorldCrossserver::from_rpc_call", "unknown msgid:%d\n", msg_id);
				break;
			}
	}

	if(nRet != 0)
	{
		LogWarning("from_rpc_call", "rpc error.msg_id=%d;ret=%d\n", msg_id, nRet);
	}

	return 0;
}
Beispiel #10
0
STDAPI DllRegisterServer()
{
    DllUnregisterServer();

    // Register CLSID_NET_PROFILER object.
    if(FAILED(RegisterServer(CLSID_NET_PROFILER, TEXT("Hook Net"))))
        return SELFREG_E_CLASS;

    return S_OK;
}
Beispiel #11
0
//
// Server registration
//
STDAPI DllRegisterServer()
{
	HRESULT hr = RegisterServer(g_hInstance, 
	                      CLSID_CoCOMServerOptional,
	                      g_szFriendlyNameOptional,
	                      g_szVerIndProgIDOptional,
	                      g_szProgIDOptional,
						  LIBID_AutoHotkey) ;
	hr= RegisterServer(g_hInstance, 
	                      CLSID_CoCOMServer,
	                      g_szFriendlyName,
	                      g_szVerIndProgID,
	                      g_szProgID,
						  LIBID_AutoHotkey) ;
	if (SUCCEEDED(hr))
	{
		RegisterTypeLib( g_hInstance, NULL);
	}
	return hr;
}
	void CLogSocket::OnSocketConnect(void* Sender)
	{
		if ("" == m_sServiceName)
		{
			if (m_bListView)
				RegisterServerEx();
			else
				RegisterServer();
		}
		SendWaitMsg();
	}
Beispiel #13
0
/*****************************************************************************
 * DllRegisterServer()
 *****************************************************************************
 */
STDAPI 
DllRegisterServer
(   void
)
{
	_DbgPrintF(DEBUGLVL_VERBOSE,("[DllRegisterServer]"));

	HRESULT hr = RegisterServer(NULL);

	return hr;
}
STDAPI DllRegisterServer()
{
    // Register the deskband object.
    HRESULT hr = RegisterServer();
    if (SUCCEEDED(hr))
    {
        // Register the component category for the deskband object.
        //hr = RegisterComCat(); // It's does not need to be in the sheel toobars menu.
    }

    return SUCCEEDED(hr) ? S_OK : SELFREG_E_CLASS;
}
void AGameSession::OnAutoLoginComplete(int32 LocalUserNum, bool bWasSuccessful, const FString& Error)
{
	UWorld* World = GetWorld();
	if (UOnlineEngineInterface::Get()->IsLoggedIn(World, LocalUserNum))
	{
		RegisterServer();
	}
	else
	{
		RegisterServerFailed();
	}
}
Beispiel #16
0
STDAPI DllRegisterServer()
{
  //Register the desk band object.
  if (!RegisterServer(CLSID_WorkraveDeskBand, TEXT("Workrave"), TRUE))
    return SELFREG_E_CLASS;

//Register the component categories for the desk band object.
  if (!RegisterComCat(CLSID_WorkraveDeskBand, CATID_DeskBand, TRUE))
    return SELFREG_E_CLASS;

  ClearDeskBandCache();

  return S_OK;
}
Beispiel #17
0
//
// Server registration
//
STDAPI DllRegisterServer()
{
	const HMODULE hModule = ::GetModuleHandle(nullptr);

	HRESULT hr = RegisterServer(hModule,
		CLSID_GitWCRev,
		L"GitWCRev Server Object",
		L"GitWCRev.object",
		L"GitWCRev.object.1",
		LIBID_LibGitWCRev) ;
	if (SUCCEEDED(hr))
		RegisterTypeLib(hModule, nullptr);
	return hr;
}
Beispiel #18
0
void 
CRakMasterServer::ProcessInboundPackets()
{
	RakNet::Packet* pRnPacket = m_pRnPeer->Receive();


	while (pRnPacket != null)
	{
		switch (pRnPacket->data[0])
		{
		case ID_ADVERTISE_SYSTEM:
			RegisterServer(pRnPacket->systemAddress, pRnPacket->guid, pRnPacket->data, pRnPacket->length);
			break;

        case ID_REMOTE_NEW_INCOMING_CONNECTION:
        case ID_NEW_INCOMING_CONNECTION:
            {
                HandlePlayerConnect(pRnPacket->systemAddress, pRnPacket->guid);
				std::cout << "Player Connected. Sending server list..." << std::endl;
            }
            break;

		case ID_REMOTE_CONNECTION_LOST: // Fall through
		case ID_CONNECTION_LOST:
		case ID_REMOTE_DISCONNECTION_NOTIFICATION: // Fall through
		case ID_DISCONNECTION_NOTIFICATION:
			{
				std::cout << "Player disconnected." << std::endl;
			}
			break;

		default:
			LOG_MESSAGE("Unknown message with identifier %i has arrived.\n", pRnPacket->data[0]);
			break;
		}


		m_pRnPeer->DeallocatePacket(pRnPacket);
		pRnPacket = m_pRnPeer->Receive();
	}
}
Beispiel #19
0
void CRegisterControlsDlg::OnReregister()
{
   CWaitCursor wait;

   UINT nSelectedItems;
   int iItem;
   CString strPath;

   iItem = -1;
   nSelectedItems = m_lvRegisteredControls.GetSelectedCount();
   while( nSelectedItems > 0 )
   {
	  iItem = m_lvRegisteredControls.GetNextItem( iItem, LVNI_SELECTED );
	  ASSERT( iItem != -1 );
	  strPath = m_lvRegisteredControls.GetItemText( iItem, 1 );
	  RegisterServer( strPath );
	  nSelectedItems--;
   }

   RefreshRegisteredControls();
}
Beispiel #20
0
/*****************************************************************************
 * DllInstall()
 *****************************************************************************
 */
STDAPI 
DllInstall
(
	IN		BOOL	Install,
	IN		LPCWSTR	CmdLine
)
{
	_DbgPrintF(DEBUGLVL_VERBOSE,("[DllInstall]"));

	HRESULT hr = S_OK;

	_DbgPrintF(DEBUGLVL_VERBOSE,("[DllInstall] - Install : %d, CmdLine : %ws", Install, CmdLine));

	if (CmdLine)
	{
		PWCHAR DevicePathW = wcsstr(CmdLine, L"/DevPath");

		if (DevicePathW)
		{
			DevicePathW += wcslen(L"/DevPath")+1;

			TCHAR SymbolicLink[MAX_PATH];

			_stprintf(SymbolicLink, "%ws", DevicePathW);

			_DbgPrintF(DEBUGLVL_BLAB,("[DllInstall] - SymbolicLink : %s", SymbolicLink));

			if (Install)
			{
				hr = RegisterServer(SymbolicLink);
			}
			else
			{
				hr = UnregisterServer(SymbolicLink);
			}
		}
	}

	return hr;
}
Beispiel #21
0
//---------------------------------------------------------------------------
// DllRegisterServer
//---------------------------------------------------------------------------
STDAPI DllRegisterServer() {
  return (RegisterServer(CLSID_ShellExtension, szShellExtensionTitle) ? S_OK : E_FAIL);
}
Beispiel #22
0
IDCOffer_clp Binder_MuxedOffer(DomainMgr_st *dm_st, dcb_ro_t *rop, 
			       dcb_rw_t *rwp , Type_Any *server)
{
    PerDomain_st  *bst =  ROP_TO_PDS(rop);
    Client_t      *bcl = (Client_t *)&(rwp->binder_rw);
    _generic_cl   *client_ops;
    Server_t      *new_server; 
    Client_t      *new_client; 
    IDCOffer_cl   *offer; 
    IDCStubs_Info  NOCLOBBER stubinfo;
#define TC_STRING_LEN (2*sizeof(Type_Code))
    char      tname[TC_STRING_LEN+1];

    TRY	{
	Context_clp   stub_ctxt = NAME_FIND (IDC_CONTEXT, Context_clp);
	TRC(eprintf ("Binder_MuxedOffer: got stub context.\n"));

	sprintf(tname, "%Q", server->type);
	TRC(eprintf ("Binder_MuxedOffer: looking for '%s'.\n", tname));

	stubinfo = NAME_LOOKUP (tname, stub_ctxt, IDCStubs_Info);
    } CATCH_ALL {
	
	eprintf("Binder_MuxedOffer: failed to find stub info!\n");
	RERAISE;
    }
    ENDTRY;

    /* Sort out the client side first */
    new_client = Heap$Calloc(Pvs(heap), 1, sizeof(Client_t));
    offer      = Heap$Calloc(Pvs(heap), 1, sizeof(IDCOffer_cl));
    
    client_ops = ((_generic_cl *)(stubinfo->surr.val))->op;

    CL_INIT(new_client->client_cl,   client_ops,             new_client);
    CL_INIT(new_client->binding_cl, &BinderClientBinding_op, new_client);
    
    ANY_INITC(&new_client->cs.srgt, server->type, 
	      (pointerval_t)&new_client->client_cl);
    new_client->cs.binding = &new_client->binding_cl;
    new_client->cs.marshal = dm_st->shmidc;
    
    new_client->conn      = bcl->conn;
    
    if(stubinfo->clnt) {
	/* Let the stubs set up any required run-time state */
	IDCClientStubs$InitState(stubinfo->clnt, &new_client->cs);
    }

    /* Now sort out the server side */
    new_server = Heap$Calloc(Pvs(heap), 1, sizeof(Server_t));
    
    new_server->ss.service = (addr_t)(pointerval_t)server->val;
    new_server->ss.binding = &new_server->binding_cl;
    new_server->ss.marshal = dm_st->shmidc;
    
    CL_INIT(new_server->cntrl_cl, stubinfo->stub->op, new_server);
    CL_INIT(new_server->binding_cl, &ShmServerBinding_op, new_server);
    
    new_server->conn  = &bst->sconn;
    
    /* Hijack offer field for PerDomain_st */
    new_server->offer = (Offer_t *)bst;

    new_client->offer = (Offer_t *)RegisterServer(&bst->mux, 
						  &new_server->cntrl_cl);
    if(new_client->offer == (Offer_t *)-1) {
	eprintf("Binder_MuxedOffer: adding new server to mux svr failed!\n");
	ntsc_halt();
    }

    
    /* We use our special binder offer ops, as for the binder binding. 
       Note that this means we cannot use ObjectTbl$Import() to deal 
       with this offer - we must call IDCOffer$Bind ourselves. */
    CLP_INIT(offer, &offer_ops, new_client);

    return offer; 
}
Beispiel #23
0
PerDomain_st *Binder_InitDomain(DomainMgr_st *dm_st, 
				dcb_ro_t *rop, dcb_rw_t *rwp,
				StretchAllocator_clp salloc)
{
    Client_t	*bcl;
    Server_t    *bsv;
    PerDomain_st  *bst;
    IDCStubs_Info stubinfo;
  
    /* Allocate bsv, bcl and bst */
    bst = ROP_TO_PDS(rop);
    memset(bst, 0, sizeof(*bst));
    bsv = &bst->s;
    bcl = (Client_t *)&(rwp->binder_rw);
    
    TRC (eprintf("Binder_NewDomain: state at %x\n", bst));

#if 0
    /* Block until the boot domains are ready */
/* XXX XXX see comment in DomainMgr.c about Intel and ARM */

    TRC(eprintf("Dom ID = %qx, boot_regs = %qx\n", rop->id, 
		EC_READ(dm_st->boot_regs)));

#ifdef SRCIT
#undef DOM_USER
#define DOM_USER DOM_SERIAL
#endif
#ifndef __ALPHA__
    EC_AWAIT (dm_st->boot_regs,
	      ((rop->id < DOM_USER) ? rop->id : DOM_USER)&0xffffffff);
#else
    EC_AWAIT (dm_st->boot_regs,
	      (rop->id < DOM_USER) ? rop->id : DOM_USER);
#endif
#endif /* 0 */
    
    /* Create IDC buffers for the new domain's channel to the binder */
    bst->args    = STR_NEW_SALLOC(dm_st->sysalloc, FRAME_SIZE);
    bst->results = STR_NEW_SALLOC(dm_st->sysalloc, FRAME_SIZE);
    
    /* Map the stretches. */
    SALLOC_SETPROT(dm_st->sysalloc, bst->results, rop->pdid, 
		   SET_ELEM(Stretch_Right_Read) );
    SALLOC_SETPROT(dm_st->sysalloc, bst->args, rop->pdid, 
		   SET_ELEM(Stretch_Right_Read)|
		   SET_ELEM(Stretch_Right_Write));

    /*
     * Next, initialise as much of the Client structure as we can at
     * this stage, given that we're in the Binder's domain and the
     * client won't have a threads package anyway. The rest of this
     * state will be initialised when the client domain calls Bind on 
     * the Binder offer.  Compare with lib/nemesis/IDC/ShmTransport.c:
     * notice that we have to init the state to what the methods in
     * Shm[Client|Server]Binding_op are expecting.
     */


    stubinfo = NAME_FIND (IDC_CONTEXT">Binder", IDCStubs_Info);
    
    TRC(eprintf("Binder_NewDomain: creating Binder client IDC state.\n"));
    {
	Binder_clp client_cl = 
	    NARROW ((Type_Any *)(&stubinfo->surr), Binder_clp);

	CL_INIT(bcl->client_cl,  (addr_t) client_cl->op,  bcl);
	CL_INIT(bcl->binding_cl, &BinderClientBinding_op, bcl);
    }
    ANY_INIT (&bcl->cs.srgt, Binder_clp, &bcl->client_cl);
    bcl->cs.binding = &bcl->binding_cl;
    bcl->cs.marshal = dm_st->shmidc;

    /* The client ShmConnection_t immediately follows the Client_t 
       (aka bcl) in the binder_rw. */
    bcl->conn      = (ShmConnection_t *)(bcl+1);

    if(stubinfo->clnt) {
	/* Let the stubs set up any required run-time state */
	IDCClientStubs$InitState(stubinfo->clnt, &bcl->cs);
    }

    /* Now setup the client side ShmConnection */

    /* XXX Leave mu_init to user */

    /* Transmit buffer rec */
    bcl->conn->txbuf.base  = STR_RANGE(bst->args, &bcl->conn->txsize);
    bcl->conn->txbuf.ptr   = bcl->conn->txbuf.base;
    bcl->conn->txbuf.space = bcl->conn->txsize;
    bcl->conn->txbuf.heap  = NULL;
    
    /* Receive buffer rec */
    bcl->conn->rxbuf.base  = STR_RANGE(bst->results, &bcl->conn->rxsize);
    bcl->conn->rxbuf.ptr   = bcl->conn->rxbuf.base;
    bcl->conn->rxbuf.space = bcl->conn->rxsize;
    bcl->conn->rxbuf.heap  = NULL;
    
    /* Event counts will be filled in by the domain */
    bcl->conn->evs.tx	  = NULL_EVENT;
    bcl->conn->evs.rx     = NULL_EVENT;
    
    /* We can call the new domain's VP interface to get end-points */
    bcl->conn->eps.tx	  = VP$AllocChannel (&rop->vp_cl);
    bcl->conn->eps.rx	  = VP$AllocChannel (&rop->vp_cl);
  
    bcl->conn->call       = 0;

    bcl->conn->dom        = dm_st->dm_dom->id;
    /* XXX SMH: for some reason we don't know our own pdom. Hoho. */
    bcl->conn->pdid       = NULL_PDID;

    /* bcl->offer is not used normally; in BINDER_MUX it is inited below */

    /*
     * Initialise the server idc state.
     */

    /* First we setup the server connection state */
    MU_INIT (&bst->sconn.mu); /* XXX - unused; entry SYNC on server */
  
    bst->sconn.txbuf      = bcl->conn->rxbuf;
    bst->sconn.txsize     = bst->sconn.txbuf.space;
    
    bst->sconn.rxbuf      = bcl->conn->txbuf;
    bst->sconn.rxbuf.heap = Pvs(heap); /* XXX */
    bst->sconn.rxsize     = bst->sconn.rxbuf.space;
  
    bst->sconn.call	  = 0;
    
    bst->sconn.eps.tx	  = Events$AllocChannel(Pvs(evs));
    bst->sconn.eps.rx	  = Events$AllocChannel(Pvs(evs));
    
    bst->sconn.evs.tx     = EC_NEW();
    bst->sconn.evs.rx     = NULL_EVENT; /* we use "Entry" synch. on server */

    bst->sconn.dom        = rop->id;
    bst->sconn.pdid       = rop->pdid; 


#ifdef CONFIG_BINDER_MUX
    /* Initialise the (de)muxing server. */
    TRC(eprintf("Binder_NewDomain: creating Binder MuxIDC server state.\n"));

    CL_INIT (bst->mux.cntrl_cl, &MuxStubs_ms, &bst->mux);
    CL_INIT (bst->mux.cntrl_cl, &MuxStubs_ms, &bst->mux);

    /* We use the connection state we setup above */
    bst->mux.conn = &bst->sconn;
    bst->mux.ss.service = NULL; /* There's no specific service */
    bst->mux.ss.binding = &bsv->binding_cl;
    
#endif
    TRC(eprintf("Binder_NewDomain: creating Binder IDC server state.\n"));
    bsv->ss.service = &bst->binder;
    bsv->ss.binding = &bsv->binding_cl;
    bsv->ss.marshal = dm_st->shmidc;


    CL_INIT (bsv->cntrl_cl,    stubinfo->stub->op,  bsv);
    CL_INIT (bsv->binding_cl, &ShmServerBinding_op, bsv);
    
    /* We use (or share!) the connection state we setup above */
    bsv->conn = &bst->sconn;

    /* Hijack offer field for PerDomain_st */
    bsv->offer            = (Offer_t *) bst;
    

    /* XXX PRB Moved this before the Plumber_Connect since otherwise
       Events$Attach does an ntsc_send causing the new domain to be woken
       up! */
    Events$Attach (Pvs(evs), bsv->conn->evs.tx, 
		   bsv->conn->eps.tx,  Channel_EPType_TX);
    
    /* Connect the event channels */
    Plumber$Connect (Plumber, dm_st->dm_dom, rop, 
		     bsv->conn->eps.tx, 
		     bcl->conn->eps.rx);
    Plumber$Connect (Plumber, rop, dm_st->dm_dom, 
		     bcl->conn->eps.tx, 
		     bsv->conn->eps.rx);

#ifdef CONFIG_BINDER_MUX
    /* Register the binder server with the demuxing server */
    bcl->offer = (Offer_t *)RegisterServer(&bst->mux, &bsv->cntrl_cl);
    
    if(bcl->offer == (Offer_t *)-1) {
	eprintf("Binder_NewDomain: addition of binder to mux svr failed!\n");
	ntsc_halt();
    }

#endif

    /* Initialise the rest of the per-domain state */
    TRC(eprintf("Binder_NewDomain: creating Binder per-domain state.\n"));
    bst->rop      = rop;
    bst->rwp      = rwp;
    bst->dm_st    = dm_st;

    /* refCount starts at 1, to allow for the following references to
       the rop/rwp to be held (update as necessary):
       
       1: the server binding (possibly muxed)
       
       */
       
    bst->refCount = 1;
    bst->callback = NULL;
    CL_INIT (bst->binder, &binder_ops, bst);

    /* The offer closure is a special hand crafted one */
    CL_INIT (bst->offer_cl, &offer_ops, bcl);

    rop->binder_offer = &bst->offer_cl;
    
#define panic(format, args...) \
do { eprintf(format, ## args); ntsc_halt(); } while(0)

    TRC(eprintf("Binder_NewDomain: registering entry.\n"));
    TRY {
#ifdef CONFIG_BINDER_MUX
	Entry$Bind (Pvs(entry), bst->mux.conn->eps.rx, &(bst->mux.cntrl_cl));
#else
	Entry$Bind (Pvs(entry), bsv->conn->eps.rx, &bsv->cntrl_cl );
#endif
    } CATCH_Entry$TooManyChannels() {
	eprintf("Too many channels registering Binder\n");
    } ENDTRY;

    TRC(eprintf("Binder_NewDomain: done.\n"));
    return bst;
}
Beispiel #24
0
HRESULT __stdcall RegisterCompent
	(LPCWSTR path, const GUID& guid,
	LPCWSTR prog_id, LPCWSTR desc, LPCWSTR ver)
{
	return RegisterServer(guid, path, prog_id, desc, ver);
}
Beispiel #25
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                       HINSTANCE /*hPrevInstance*/,
                       LPTSTR    lpCmdLine,
                       int       /*nCmdShow*/)
{
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

    // TODO: 여기에 코드를 입력합니다.
    g_idMainThread = ::GetCurrentThreadId();

    // 전역 문자열을 초기화합니다.
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);

    if (FAILED(::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) {
        ::MessageBox(NULL, L"COM 초기화 에러.", NULL, MB_ICONERROR|MB_OK);
        return 0;
    }

    //HRESULT hr = ::CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_CONNECT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
    //_ASSERT(SUCCEEDED(hr));

    if (lpCmdLine && ((_wcsicmp(lpCmdLine, L"-Embedding") == 0) || (_wcsicmp(lpCmdLine, L"/Embedding") == 0)
                      || (_wcsicmp(lpCmdLine, L"- Embedding") == 0) || (_wcsicmp(lpCmdLine, L"/ Embedding") == 0))) {

        // ROT 등록
        RegisterClassObject();
    } else {
        if (lpCmdLine && ((_wcsicmp(lpCmdLine, L"-RegServer") == 0) || (_wcsicmp(lpCmdLine, L"/RegServer") == 0)
                          || (_wcsicmp(lpCmdLine, L"- RegServer") == 0) || (_wcsicmp(lpCmdLine, L"/ RegServer") == 0))) {
            RegisterServer();
            return 0;
        } else if (lpCmdLine &&((_wcsicmp(lpCmdLine, L"-UnregServer") == 0) || (_wcsicmp(lpCmdLine, L"/UnregServer") == 0)
                                || (_wcsicmp(lpCmdLine, L"- UnregServer") == 0) || (_wcsicmp(lpCmdLine, L"/ UnregServer") == 0))) {
            UnregisterServer();
            return 0;
        } else {
            switch (::MessageBox(NULL, L"HbgServ 컴포넌트를 등록할까요?\n\n- 예(등록)\n- 아니오(등록 해제)", NULL, MB_ICONQUESTION|MB_YESNOCANCEL)) {
            case IDYES:
                RegisterServer();
                return 0;
                break;
            case IDNO:
                UnregisterServer();
                return 0;
                break;
            case IDCANCEL:
                return 0;
                break;
            }
        }
    }

    // 기본 메시지 루프입니다.
    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // ROT 해제
    RevokeClassObject();

    ::CoUninitialize();

    return (int) msg.wParam;
}
Beispiel #26
0
/*
  Scan the command line, extract arguments and init variables
*/
int scan_cmdline(int argc, char **argv)
{
	int cnt;
	char *p;
	char msg[80];

	int import = 0;
	char *rom = NULL;
	char *tib = NULL;
	char *sav = NULL;
	char *fn = NULL;

	//for(cnt = 0; cnt < argc; cnt++)
	//	fprintf(stdout, "%i: [%s]\n", cnt, argv[cnt]);
  
	/* Parses list of arguments */
	for(cnt=1; cnt<argc; cnt++) 
	{
		p = argv[cnt];

#ifdef __WIN32__
		if(!stricmp(p, "/RegServer") || !stricmp(p, "-RegServer")
		   || !stricmp(p, "--RegServer")) {
			char *p;
			ITypeLib *tlb;
			char szModule[512];
			wchar_t tlbname[512];
			HMODULE hModule = GetModuleHandle(NULL);
			DWORD dwResult = GetModuleFileName(hModule, szModule, sizeof(szModule));

			if (!dwResult) exit(1);
			p = szModule + strlen(szModule) - 4;

			if (stricmp(p,".exe")) exit(1);
			strcpy(++p,"tlb");
			mbstowcs(tlbname, szModule, strlen(szModule)+1);

			if (RegisterServer(&CLSID_TiEmuOLE,
			                   "TiEmu OLE Interface",
			                   "TiEmu.TiEmuOLE",
			                   "TiEmu.TiEmuOLE.1", NULL)
			    || LoadTypeLib(tlbname, &tlb))
				exit(1);
			else {
				if (RegisterTypeLib(tlb, tlbname, NULL)) {
					tlb->lpVtbl->Release(tlb);
					exit(1);
				} else {
					tlb->lpVtbl->Release(tlb);
					fprintf(stdout, "TiEmu OLE Interface successfully registered.");
					exit(0);
				}
			}
		}

		if(!stricmp(p, "/UnregServer") || !stricmp(p, "-UnregServer")
		   || !stricmp(p, "--UnregServer")) {
			if (UnregisterServer(&CLSID_TiEmuOLE, "TiEmu.TiEmuOLE",
			                     "TiEmu.TiEmuOLE.1")
			    || UnRegisterTypeLib(&LIBID_TiEmuOLELib, 1, 0, 0,
			                         SYS_WIN32))
				exit(1);
			else {
				fprintf(stdout, "TiEmu OLE Interface successfully unregistered.");
				exit(0);
			}
		}
		if(!stricmp(p, "/Embedding") || !stricmp(p, "-Embedding")
		   || !stricmp(p, "--Embedding")) {
			// VB runs it with this option.
			continue;
		}
#endif

		if(*p == '-') 
		{
			// a long option (like --help)
			p++;
		} else 
		{
			fn = g_strdup(p);
			// a filename
			//g_free(params.rom_file);
			//params.rom_file = g_strdup(p);
		}
		strcpy(msg, p);

		if(strexact(msg, "-import")) 
			import = !0;

		if(strstr(msg, "rom="))
			rom = g_strdup(msg + 4);

		if(strstr(msg, "tib="))
			tib = g_strdup(msg + 4);

		if(strstr(msg, "sav=")) 
			sav = g_strdup(msg + 4);

		if(strstr(msg, "send="))
			file_to_send = g_strdup(msg + 5);
	      
		if(strexact(msg, "-help") || strexact(msg, "h")) 
			help();

		if(strexact(msg, "-version") || strexact(msg, "v")) 
			exit(0);
	}

	/* */
	if(fn && ti68k_is_a_rom_file(fn))
		rom = fn;
	else if(fn && ti68k_is_a_tib_file(fn))
		tib = fn;
	else if(fn && ti68k_is_a_sav_file(fn))
		sav = fn;

	/* And process them */
	if(rom && ti68k_is_a_rom_file(rom))
	{
		gchar *dstname;

		int err = ti68k_convert_rom_to_image(rom, inst_paths.img_dir, &dstname);
		if(err) 
		{
			tiemu_err(err, NULL);
			exit(-1);
		}

		if(import)
			exit(0);

		g_free(params.rom_file);
		params.rom_file = dstname;
		g_free(params.sav_file);
		params.sav_file = g_strdup("");
	}

	if(tib && ti68k_is_a_tib_file(tib))
	{
		gchar *dstname;

		int err = ti68k_convert_tib_to_image(tib, inst_paths.img_dir, &dstname, -1);
		if(err) 
		{
			tiemu_err(err, NULL);
			exit(-1);
		}

		if(import)
			exit(0);

		g_free(params.rom_file);
		params.rom_file = dstname;
		g_free(params.sav_file);
		params.sav_file = g_strdup("");
	 }

	if(sav && !fn)						// for compatibility
	{
		g_free(params.sav_file);
		params.sav_file = g_strdup(sav);
	}

	if(sav && ti68k_is_a_sav_file(sav) && fn)
	{
		gchar *rf, *tf;

		ti68k_state_parse(sav, &rf, &tf);
		
		if(!ti68k_is_a_img_file(rf))
			return 0;

		g_free(params.rom_file);
		params.rom_file = rf;

        g_free(params.tib_file);
		params.tib_file = tf;

		g_free(params.sav_file);
		params.sav_file = g_strdup(sav);
	}

	return 0;
}
Beispiel #27
0
BOOL CSVCBoxTestApp::InitInstance()
{
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	EnableTaskbarInteraction(FALSE);

	// AfxInitRichEdit2() is required to use RichEdit control	
	// AfxInitRichEdit2();

	// 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
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));


	//get exe path
	TCHAR lpszDrive[255], lpszPath[1024], lpszTemp[255];
	_wsplitpath(m_pszHelpFilePath, lpszDrive, lpszPath, lpszTemp, lpszTemp);

	g_szEXEPath = lpszDrive;
	g_szEXEPath += lpszPath;

	SetCurrentDirectory(g_szEXEPath);

#ifdef DEBUG
	auto iErrorCode = RegisterServer(g_szEXEPath + _T("SVCBoxD.ocx"));
#else
	auto iErrorCode = RegisterServer(g_szEXEPath + _T("SVCBox.ocx"));
#endif

	if (iErrorCode)
	{
		CString sz;
		sz.Format(_T("×¢²áʧ°Ü£¬´íÎóÂë %d"), iErrorCode);
		AfxMessageBox(sz);
	}

	// To create the main window, this code creates a new frame window
	// object and then sets it as the application's main window object
	CMainFrame* pFrame = new CMainFrame;
	if (!pFrame)
		return FALSE;
	m_pMainWnd = pFrame;
	// create and load the frame with its resources
	pFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
		NULL);


	// The one and only window has been initialized, so show and update it
	pFrame->ShowWindow(SW_SHOW);
	pFrame->UpdateWindow();
	// call DragAcceptFiles only if there's a suffix
	//  In an SDI app, this should occur after ProcessShellCommand
	return TRUE;
}
Beispiel #28
0
static void MasterServer_OnChange(void)
{
	UnregisterServer();
	RegisterServer();
}
Beispiel #29
0
static void ServerName_OnChange(void)
{
	UnregisterServer();
	RegisterServer();
}
Beispiel #30
0
BOOL CFdmApp::InitInstance()
{
	g_crashReporter.reset (new vmsAppCrashReporter (
		g_appVersion.getVersion ()->m_tstrProductName,
		L"",
		g_appVersion.getVersion ()->m_tstrFileVersion,
		L"freedownloadmanager.org", L"/dump.php"));

	bool bContinue = true;
	if (g_crashReporter->CheckIfSubmitDumpIsRequestedByCommandLine (bContinue))
	{
		if (!bContinue)
			return FALSE;
	}

	g_crashReporter->InitializeCrashCatcher ();

	AfxEnableControlContainer ();

	{
		_configthreadlocale (_DISABLE_PER_THREAD_LOCALE);
		tstringstream tss;
		tss << _T (".") << GetACP ();
		_tsetlocale(LC_ALL, tss.str ().c_str ());
		_configthreadlocale (_ENABLE_PER_THREAD_LOCALE);
	}

	
	SetRegistryKey (IDS_COMPANY);

	CheckRegistry ();

	fsIECatchMgr::CleanIEPluginKey ();

	
	CString strPath = GetProfileString (_T(""), _T("Path"), _T(""));
	BOOL bNeedLocalRegister = FALSE;
	if (strPath == _T(""))
	{
		CRegKey key;
		if (ERROR_SUCCESS == key.Open (HKEY_CURRENT_USER, _T("Software\\FreeDownloadManager.ORG\\Free Download Manager"), KEY_WRITE))
			vmsSHCopyKey (HKEY_LOCAL_MACHINE, _T("Software\\FreeDownloadManager.ORG\\Free Download Manager"), key);
		strPath = GetProfileString (_T(""), _T("Path"), _T(""));
		bNeedLocalRegister = strPath != "";
	}

	if (GetFileAttributes (strPath + _T("\\fdm.exe")) == DWORD (-1))
	{
		strPath = _T("");
		bNeedLocalRegister = false;
	}

	
	
	if (strPath == _T("") || FALSE == SetCurrentDirectory (strPath))
		_dwAppState |= APPSTATE_PORTABLE_MODE;

	TCHAR tszExeDir [MY_MAX_PATH], tszExeFile [MY_MAX_PATH];
	GetModuleFileName (NULL, tszExeFile, sizeof (tszExeFile));
	fsGetPath (tszExeFile, tszExeDir);

	if (IS_PORTABLE_MODE)
	{
		strPath = tszExeDir;
		SetCurrentDirectory (strPath);
	}

	m_strAppPath = strPath;
	if (m_strAppPath.IsEmpty () == FALSE)
	{
		if (m_strAppPath [m_strAppPath.GetLength ()-1] != '\\' &&
				m_strAppPath [m_strAppPath.GetLength ()-1] != '/')
			m_strAppPath += '\\';
	}

	if (IS_PORTABLE_MODE == false)
	{
		CString strDataFldr = tszExeDir; strDataFldr += _T("Data");
		
		
		
		if (m_strAppPath.CompareNoCase (tszExeDir) &&
			 DWORD (-1) != GetFileAttributes (strDataFldr))
		{
			
			_dwAppState |= APPSTATE_PORTABLE_MODE;
			_dwAppState |= APPSTATE_PORTABLE_MODE_NOREG;
			m_strAppPath = tszExeDir;
		}
	}

	if (IS_PORTABLE_MODE)
	{
		
		vmsAppSettingsStore* pStgs = _App.get_SettingsStore ();
		CString strStgsFile = m_strAppPath + "Data\\settings.dat";
		fsBuildPathToFile (strStgsFile);
		pStgs->LoadSettingsFromFile (strStgsFile);
		_App.ApplySettingsToMutexes ();
	}

	BOOL bNoLng = FALSE;

	if (FALSE == InitLanguage ())
		bNoLng = TRUE;

	if (_tcscmp (m_lpCmdLine, _T("-suis")) == 0 || 
			_tcscmp (m_lpCmdLine, _T("-euis")) == 0 ||
			_tcscmp (m_lpCmdLine, _T("-duis")) == 0)
	{
		IntegrationSettings ();
		return FALSE;
	}

	if (IS_PORTABLE_MODE)
	{
		
		
		
		TCHAR szTmpFile [MY_MAX_PATH];
		CString str = m_strAppPath; str += _T("Data");
		CreateDirectory (str, NULL);
		if (0 == GetTempFileName (str, _T("fdm"), 0, szTmpFile))
			MessageBox (NULL, LS (L_NOWRITEACCESSTODATAFOLDER), vmsFdmAppMgr::getAppName (), MB_ICONWARNING);
		else
			DeleteFile (szTmpFile);
	}

	_SkinMgr.Initialize ();

	_IECatchMgr.ReadSettings ();
	_NOMgr.Initialize ();
	_IECMM.ReadState ();

	
	HRESULT hRes = OleInitialize (NULL);
	
	if (FAILED(hRes))
		return FALSE;
	
	m_bCOMInited = TRUE;

	const tstring currentVersion = vmsFdmAppMgr::getVersion ()->m_fileVersion.ToString ();
	bool currentVersionFirstRun = currentVersion != _App.RecentVersionRun ();
	if (currentVersionFirstRun)
		_App.RecentVersionRun (currentVersion);

	vmsAppGlobalObjects::Create2 (currentVersionFirstRun);

	fsFDMCmdLineParser cmdline;

	cmdline.Parse (fsFDMCmdLineParser::Elevated);

	if (cmdline.isRunAsElevatedTasksProcessor ())
	{
		RunAsElevatedTasksProcessor (cmdline);
		return FALSE;
	}

	if (cmdline.isNeedExit ())
		return FALSE;

	m_bForceSilentSpecified = cmdline.is_ForceSilentSpecified ();

	if (cmdline.isNeedRegisterServer ())
	{
		onNeedRegisterServer ( false );
		return FALSE;
	}
	else if (cmdline.isNeedRegisterServerUserOnly ())
	{
		onNeedRegisterServer ( true );
		return FALSE;
	}
	else if (cmdline.isNeedUnregisterServer ())
	{
		onNeedUnregisterServer ();
		return FALSE;
	}

	if (vmsWinSecurity::os_supports_elevation () && 
		_tcsncmp (m_lpCmdLine, _T("-nelvcheck"), 10) && _tcsicmp (m_lpCmdLine, _T("-autorun")))
	{
		if (vmsWinSecurity::IsProcessElevated ())
		{
			WCHAR wsz [MAX_PATH] = L"";
			GetModuleFileNameW (NULL, wsz, MAX_PATH);
			std::wstring wstr = L"\"";
			wstr += wsz;
			wstr += L"\" -nelvcheck ";
			wstr += CT2WEX<> (m_lpCmdLine);
			_appMutex.CloseMutex ();
			STARTUPINFOW si = {0}; PROCESS_INFORMATION pi = {0};
			si.cb = sizeof (si);
			if (vmsWinSecurity::RunAsDesktopUser (wsz, (LPWSTR)wstr.c_str (), NULL, si, pi))
				return FALSE;
			_appMutex.Create ();
		}
	}

	cmdline.Parse (fsFDMCmdLineParser::Normal);

	if (CheckFdmStartedAlready (m_bForceSilentSpecified == FALSE))
		return FALSE;

	if (!InitATL())
		return FALSE;

	_App.StartCount (_App.StartCount () + 1);

	
	
	if (IS_PORTABLE_MODE && (_dwAppState & APPSTATE_PORTABLE_MODE_NOREG) == 0)
		Install_RegisterServer ();

	
	
	
	
	vmsFilesToDelete::Process ();

	if (bNeedLocalRegister)
		RegisterServer (FALSE);

	

#ifdef _AFXDLL
	Enable3dControls();			
#else
	Enable3dControlsStatic();	
#endif

	CheckLocked ();

	_UpdateMgr.ReadSettings ();
	
	if (_UpdateMgr.IsStartUpdaterNeeded ())
	{
		if (_UpdateMgr.StartUpdater ())	
			return FALSE;	
		else
			::MessageBox (NULL, LS (L_CANTFINDUPDATER), LS (L_ERR), MB_ICONERROR);
	}

	vmsFlvSniffInjector::o ().Enable (_App.FlvMonitoring_Enable () != FALSE);

	LoadHistory ();

	_Snds.ReadSettings ();

	if (!vmsBtSupport::isBtDllValid ())
	{
		MessageBox (NULL, LS (L_INVALID_BT_MODULE), _T ("Free Download Manager"), MB_ICONERROR);
		return FALSE;
	}

	auto ytdllmgr = std::make_shared <vmsYouTubeParserDllMgr> (
		std::make_shared <vmsAppDataFolder> (L"FreeDownloadManager.ORG", L"Free Download Manager"),
		currentVersionFirstRun);
	vmsYouTubeParserDllMgr::reset (ytdllmgr);

	auto avMerger = std::make_shared<vmsAVMergerFFMPEG>();
	auto avAfterMergeAction = std::make_shared<vmsYouTubeAfterMergeAction>();
	auto avYouTubeMergingMgr = std::make_shared <vmsAVMergingMgr>( avMerger, avAfterMergeAction, 1 );	
	_YouTubeDldsMgr.setYouTubeAVMergingMgr( avYouTubeMergingMgr );

	CMainFrame* pFrame = NULL;
	fsnew1 (pFrame, CMainFrame);
	m_pMainWnd = pFrame;

	
	if (FALSE == pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, 
		NULL, NULL))
	{
		return FALSE;
	}

	
	BOOL bHidden = _tcscmp (m_lpCmdLine, _T ("-autorun")) == 0;

	_App.View_ReadWndPlacement (pFrame, _T("MainFrm"), 
		bHidden ? fsAppSettings::RWPA_FORCE_SWHIDE_AND_KEEP_MINIMIZED_MAXIMIZED_STATE : fsAppSettings::RWPA_NONE);

	if (!bHidden)
	{
		if (_App.Prg_StartMinimized ())
		{
			if (IsWindowVisible (pFrame->m_hWnd))
				pFrame->ShowWindow (SW_MINIMIZE);
		}
		else
		{
			pFrame->UpdateWindow();
			if (pFrame->IsWindowVisible ())
				pFrame->SetForegroundWindow ();
		}
	}

	m_bStarting = FALSE;

	
	hRes = _Module.RegisterClassObjects (CLSCTX_LOCAL_SERVER, 
				REGCLS_MULTIPLEUSE);
	if (FAILED (hRes))
	{
		LPVOID lpMsgBuf;
		FormatMessage( 
				FORMAT_MESSAGE_ALLOCATE_BUFFER | 
				FORMAT_MESSAGE_FROM_SYSTEM | 
				FORMAT_MESSAGE_IGNORE_INSERTS,
				NULL,
				hRes,
				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
				(LPTSTR) &lpMsgBuf,
				0,
				NULL 
				);
			
			
			
			MessageBox( NULL, (LPCTSTR)lpMsgBuf, nullptr, MB_OK | MB_ICONINFORMATION );
			
			LocalFree( lpMsgBuf );
	}
	m_bATLInited2 = SUCCEEDED (hRes);

	return TRUE;
}