Beispiel #1
0
BOOL CXuser32App::InitInstance()
{
	CWaitCursor pCursor;
	
#ifndef _DEBUG
	if ( SetFirstInstance() == FALSE ) return FALSE;
#endif
	
	Enable3dControls();
	SetRegistryKey( gcszCopyright );
	
	AfxOleInit();
	AfxEnableControlContainer();
	
	WSADATA wsaData;
	WSAStartup( 0x0101, &wsaData );
	
	CString xUserId, xPassword;
	CheckUsage( xUserId, xPassword, m_bTestor );
	
	CConnectDlg pConnect;
	if ( pConnect.DoModal(xUserId, xPassword) != IDOK ) return FALSE;
	//if ( pConnect.DoModal() != IDOK ) return FALSE;
	
	CSplashDlg* dlgSplash = new CSplashDlg;
	dlgSplash->Topmost();
	
	dlgSplash->Step( _T("注册表") );
		Settings.Load();
		Skin.Apply();
		
	dlgSplash->Step( _T("GUI") );
		m_pMainWnd = new CMainWnd();
		CoolMenu.EnableHook();
#if 0
		CString strCaption;
		strCaption.LoadString( AFX_IDS_APP_TITLE );
		m_pMainWnd->SetWindowText( (LPCTSTR)strCaption );
#else
		m_pMainWnd->SetWindowText( _T("96031城市总机") );
#endif
		dlgSplash->Topmost();
		m_pMainWnd->ShowWindow( SW_SHOW );
		m_pMainWnd->UpdateWindow();
		
	dlgSplash->Step( _T("连接") );
		m_pMainWnd->SendMessage( WM_COMMAND, ID_TAB_CONNECT );
		
	dlgSplash->Hide();
	
	pCursor.Restore();
	
	return m_bInitialized = TRUE;
}
Beispiel #2
0
BOOL CXphoneApp::InitInstance()
{
	CWaitCursor pCursor;
	
	if ( ! SetFirstInstance() ) return FALSE;
	
	CString xUserId, xPassword;
	if ( ! CheckUsage( xUserId, xPassword ) ) return FALSE;

	Enable3dControls();

	SetRegistryKey( gcszCopyright );
	GetVersionNumber();

	AfxOleInit();
	AfxEnableControlContainer();
	
	CSplashDlg* dlgSplash = new CSplashDlg;
		dlgSplash->Topmost();
	
	dlgSplash->Step( _T("Winsock") );
		WSADATA wsaData;
		if ( WSAStartup( 0x0101, &wsaData ) ) return FALSE;

	dlgSplash->Step( _T("注册表") );
		Settings.Load();
		Skin.Apply();
	
	dlgSplash->Step( _T("GUI") );
		m_pMainWnd = new CConnectDlg;
		CoolMenu.EnableHook();
		
		dlgSplash->Topmost();
		m_pMainWnd->ShowWindow( SW_SHOWNORMAL );
//		m_pMainWnd->BringWindowToTop();
		
	dlgSplash->Step( _T("连接") );
		m_pMainWnd->SendMessage( WM_COMMAND, ID_NETWORK_CONNECT );
		
	dlgSplash->Hide();
	
	pCursor.Restore();
	
	return m_bInitialized = TRUE;
}
Beispiel #3
0
int       _TreePutRecord(void *dbid, int nid, struct descriptor *descriptor_ptr, int utility_update)
{
  PINO_DATABASE *dblist = (PINO_DATABASE *)dbid;
  NID       *nid_ptr = (NID *)&nid;
  int       status;
  int       open_status;
  TREE_INFO *info_ptr;
  int       nidx;
  unsigned int old_record_length;
  static int saved_uic = 0;
  int       id = 0;
  int       length = 0;
  int       shot_open;
  compress_utility = utility_update == 2;
#if !defined(HAVE_WINDOWS_H) && !defined(HAVE_VXWORKS_H)
  if (!saved_uic)
    saved_uic = (getgid() << 16) | getuid();
#endif
  if (!(IS_OPEN(dblist)))
    return TreeNOT_OPEN;
  if (dblist->open_readonly)
    return TreeREADONLY;
  if (dblist->remote)
    return PutRecordRemote(dblist,nid,descriptor_ptr,utility_update);
  shot_open = (dblist->shotid != -1);
  nid_to_tree_nidx(dblist, nid_ptr, info_ptr, nidx);
  if (info_ptr)
  {
    int       stv;
    NCI       local_nci;
    status = TreeCallHook(PutData,info_ptr,nid);
    if (status && !(status & 1))
      return status;
    if (info_ptr->reopen)
      TreeCloseFiles(info_ptr);
    if (info_ptr->data_file ? (!info_ptr->data_file->open_for_write) : 1)
      open_status = TreeOpenDatafileW(info_ptr, &stv, 0);
    else
      open_status = 1;
    status = TreeGetNciLw(info_ptr, nidx, &local_nci);
    if (status & 1)
    {
      if (utility_update)
      {
	length = local_nci.length = 0;
	local_nci.DATA_INFO.DATA_LOCATION.record_length = 0;
      }
      else
      {
        unsigned int m1;
        unsigned int m2 = 10000000;
        _int64 addin = LONG_LONG_CONSTANT(0x7c95674beb4000);
        _int64 zero = 0;
        _int64 temp = 0;
        bitassign(dblist->setup_info, local_nci.flags, NciM_SETUP_INFORMATION);
	local_nci.owner_identifier = saved_uic;
	/* VMS time = unixtime * 10,000,000 + 0x7c95674beb4000q */
#ifndef HAVE_VXWORKS_H
        tzset();
#endif

#ifdef USE_TM_GMTOFF      
    /* this is a suggestion to change all code 
       for this as timezone is depricated unix
       annother alternative is to use gettimeofday */
       { struct tm *tm;
         time_t t;
         t = time(NULL);
         tm = localtime(&t);
         m1 = (unsigned int)t + tm->tm_gmtoff;
       }
#else
        m1 = (unsigned int)time(NULL) - timezone + daylight * 3600;
#endif
	LibEmul(&m1,&m2,&zero,&temp);
        local_nci.time_inserted = temp + addin;
      }
      if (!(open_status & 1))
      {
	local_nci.DATA_INFO.ERROR_INFO.stv = stv;
        bitassign_c(1,local_nci.flags2,NciM_ERROR_ON_PUT);
	local_nci.DATA_INFO.ERROR_INFO.error_status = open_status;
	length = local_nci.length = 0;
	TreePutNci(info_ptr, nidx, &local_nci, 1);
	return open_status;
      }
      else
      {
	NCI      *nci = info_ptr->data_file->asy_nci->nci;
	*nci = local_nci;
	if (!utility_update)
	{
	  old_record_length = (nci->flags2 & NciM_DATA_IN_ATT_BLOCK) ? 0 : 
                        nci->DATA_INFO.DATA_LOCATION.record_length;
	  if ((nci->flags & NciM_WRITE_ONCE) && nci->length)
	    status = TreeNOOVERWRITE;
	  if ((status & 1) && (shot_open && (nci->flags & NciM_NO_WRITE_SHOT)))
	    status = TreeNOWRITESHOT;
	  if ((status & 1) && (!shot_open && (nci->flags & NciM_NO_WRITE_MODEL)))
	    status = TreeNOWRITEMODEL;
	}
	if (status & 1)
	{
          unsigned char tree = (unsigned char)nid_ptr->tree;
          int compressible;
          int data_in_altbuf;
          nid_reference = 0;
          path_reference = 0;
	  status = MdsSerializeDscOutZ(descriptor_ptr, info_ptr->data_file->data,FixupNid,&tree,FixupPath,0,
            (compress_utility || (nci->flags & NciM_COMPRESS_ON_PUT)) && !(nci->flags & NciM_DO_NOT_COMPRESS),
            &compressible,&nci->length,&nci->DATA_INFO.DATA_LOCATION.record_length,&nci->dtype,&nci->class,
            sizeof(nci->DATA_INFO.DATA_IN_RECORD.data),nci->DATA_INFO.DATA_IN_RECORD.data,&data_in_altbuf);
          bitassign(path_reference,nci->flags,NciM_PATH_REFERENCE);
          bitassign(nid_reference,nci->flags,NciM_NID_REFERENCE);
          bitassign(compressible,nci->flags,NciM_COMPRESSIBLE);
          bitassign_c(data_in_altbuf,nci->flags2,NciM_DATA_IN_ATT_BLOCK);
        }
	if ((status & 1) && nci->length && (!utility_update))
	  status = CheckUsage(dblist, nid_ptr, nci);
	if (status & 1)
	{
	  if (nci->flags2 & NciM_DATA_IN_ATT_BLOCK)
	  {
	    bitassign_c(0,nci->flags2,NciM_ERROR_ON_PUT);
	    status = TreePutNci(info_ptr, nidx, nci, 1);
	  }
	  else
	  {
	    if ((nci->DATA_INFO.DATA_LOCATION.record_length != old_record_length) ||
		(nci->DATA_INFO.DATA_LOCATION.record_length >= DATAF_C_MAX_RECORD_SIZE) ||
		utility_update ||
		(nci->flags2 & NciM_ERROR_ON_PUT))
	      status = PutDatafile(info_ptr, nidx, nci, info_ptr->data_file->data);
	    else
	      status = UpdateDatafile(info_ptr, nidx, nci, info_ptr->data_file->data);
	  }
	}
      }
    }
  }