Exemplo n.º 1
0
Arquivo: set.c Projeto: justid/Zoolu
BOOL CheckReg(char* reg_code)
{
	char mix_code[9] = {0, 0, 0, 0, 0, 0, 0, 0, '\0'} ;
	char final_code[9] = {0, 0, 0, 0, 0, 0, 0, 0, '\0'} ;
	BYTE step ;
	
	
	for (step = 0 ; step < 8 ; ++step)
		mix_code[step] = m_id[7 - step] ^ (0x6E + step * 2) ;
	sprintf(final_code, "%02X%02X%02X%02X", mix_code[0],  mix_code[3],  mix_code[5],  mix_code[6]) ;
	if ( strcmp(reg_code, final_code) == 0) 
		return TRUE ;
	else {
		DebugS("可免费使用\n无功能限制 ") ;
		//Warning("注册码错误!",2);
		memset(regstr,'\0', 8);  
		Input_Regcode() ; 
		if ( strcmp(regstr, final_code) == 0) {
			Warning("注册成功!",2);
			return TRUE ;
		}
		else	DebugS("+Q群106061748\n获取注册支持 ") ;
		return FALSE ;
	}
}
Exemplo n.º 2
0
void TCPConnectionPair::onPeerDataReceived(net::Socket&,
                                           const MutableBuffer& buffer,
                                           const net::Address& peerAddress)
{
    TraceS(this) << "Peer => Client: " << buffer.size() << endl;
    // assert(pkt.buffer.position() == 0);
    // if (pkt.buffer.available() < 300)
    //    TraceS(this) << "Peer => Client: " << pkt.buffer << endl;
    // auto socket = reinterpret_cast<net::Socket*>(sender);
    // char* buf = bufferCast<char*>(buf);

    // Buffer& buf = pkt.buffer;
    const char* buf = bufferCast<const char*>(buffer);
    std::size_t len = buffer.size();
    if (client) {

        allocation.updateUsage(len);
        if (allocation.deleted())
            return;

        // assert(buf.position() == 0);
        client->send(buf, len);
    }

    // Flash policy requests
    // TODO: Handle elsewhere? Bloody flash...
    else if (len == 23 && (strcmp(buf, "<policy-file-request/>") == 0)) {
        TraceS(this) << "Handle flash policy" << endl;
        std::string policy(
            "<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from "
            "domain=\"*\" to-ports=\"*\" /></cross-domain-policy>");
        // assert(peer->get() == pkt.info->socket);
        peer->send(policy.c_str(), policy.length() + 1);
        peer->close();
    }

    // Buffer early media
    // TODO: Make buffer size server option
    else {
        std::size_t maxSize =
            allocation.server().options().earlyMediaBufferSize;
        DebugS(this) << "Buffering early data: " << len << endl;
        //#ifdef _DEBUG
        //        DebugS(this) << "Printing early data: " << std::string(buf,
        //        len) << endl;
        //#endif
        if (len > maxSize)
            WarnL << "Dropping early media: Oversize packet: " << len << endl;
        if (earlyPeerData.size() > maxSize)
            WarnL << "Dropping early media: Buffer at capacity >= " << maxSize
                  << endl;

        // earlyPeerData.append(static_cast<const char*>(pkt.data()), len);
        earlyPeerData.insert(earlyPeerData.end(), buf, buf + len);
    }
}
Exemplo n.º 3
0
Arquivo: set.c Projeto: justid/Zoolu
int WriteINI(int file_ptr,int pos,char* Write,BYTE delay,BOOL init)
{
	int bytesfree ;

	if  (init ==  TRUE) {
		filesize = Bfile_GetFileSize(file_ptr) ;
		if (filesize < 0){
			DebugS("获取文件大小\n失败! ") ;
			return -1 ;
		}
	
		write_ptr = malloc( filesize ) ;
		if (write_ptr == NULL){
			DebugS("内存分配失败! ") ;
			return -1 ;
		}
		//Reopen and read the whole file
		file_ptr = Reopen(file_ptr) ;
		Bfile_ReadFile(file_ptr,write_ptr,filesize,-1) ;

		//Delete the file
		Bfile_CloseFile(file_ptr) ;
		//9750下无法使用Bfile_GetMediaFree,获取的闪存剩余字节总为0
		Bfile_DeleteFile(configfile) ;
	}
	
	
	memodify(write_ptr, pos, Write) ;


	if (delay == NOW) {
		//Recreate the file
		if (Bfile_CreateFile(configfile, filesize) < 0) {
			DebugS("创建文件失败\n请重新上传 ") ;
			return -1 ;
		}
		file_ptr = Reopen(file_ptr) ;
		Bfile_WriteFile(file_ptr,write_ptr,filesize) ;
		if (write_ptr != NULL) free(write_ptr) ;
	}
	return Reopen(file_ptr) ;
}
Transaction::Transaction(const net::Socket::Ptr& socket, 
                         const net::Address& peerAddress,
                         long timeout, 
                         int retries, 
                         uv::Loop* loop) : 
    net::Transaction<Message>(socket, peerAddress, timeout, retries, loop) 
{
    DebugS(this) << "Create" << std::endl;

    // Register STUN message creation strategy
    net::Transaction<Message>::factory.registerPacketType<stun::Message>(0);
}
void Transaction::onResponse()
{
    DebugS(this) << "On response" << std::endl;    

    _response.setMethod(_request.methodType());
    _response.setClass(Message::SuccessResponse);
    if (_response.get<stun::ErrorCode>())
        _response.setClass(Message::ErrorResponse);
    else if (_response.methodType() == Message::SendIndication ||
        _response.methodType() == Message::DataIndication)
        _response.setClass(Message::Indication);

    net::Transaction<Message>::onResponse();
}
Exemplo n.º 6
0
APIRET APIENTRY thStartProg (CHAR *szProgName)
   {
   RESULTCODES  rcProgResult;
   ULONG        ul;

   while( ulShellID = ulExecProg( szProgName ) )
      {
      DosWaitChild( DCWA_PROCESSTREE,                // action code
                    DCWW_WAIT,                       // wait option
                    &rcProgResult,                   // return codes
                    &ul,                             // return process ID
                    ulShellID);                      // process ID
      DebugS (1, "DosWaitChild returned");
      }

   return 0;
   }
Exemplo n.º 7
0
Arquivo: set.c Projeto: justid/Zoolu
int InitConfig()
{
# ifdef RELEASE
FONTCHARACTER indexfile[] = { '\\','\\','f','l','s','0','\\','I','N','D','E','X','.','d','a','t' ,'\0'} ;
# else
FONTCHARACTER indexfile[] = { '\\','\\','c','r','d','0','\\','I','N','D','E','X','.','d','a','t' ,'\0'} ;
# endif
	int indexf_ptr = -1 ;
	int confile_ptr = -1 ;
	unsigned int prog = 0 ;
	int error_code = 0 ;
	double ini_version ;
	unsigned int ini_fpos ;
	
	
	//Get_MID() ;CheckReg("ABCDEF");
	confile_ptr = Bfile_OpenFile(configfile, _OPENMODE_READWRITE) ;
	if (confile_ptr < 0) {
		Warning("无配置文件 ", 3) ;
		return -1 ;
	} else {
		// DO NOTHING NOW
	}

	

	fpos = 0 ;
	stateT = 0 ;
	stateK = 0 ;
	stateV = 0 ;
	
	
	while (error_code == 0  && getline(confile_ptr) ) {
		prog = parse((char*)Linebuffer) ;
		switch (prog){
		case PROG_VER:
			ini_version = statebox.value ;
			ini_fpos = fpos ;
			break ;
		case PROG_SN:
			Get_MID() ;
			strcpy(regstr,statebox.str) ;
			if (CheckReg(regstr) == TRUE)  {
				if (strcmp(regstr,statebox.str) != 0 ){
					//定位到数值位置并写入 
					sprintf(Linebuffer,"SN = %s\r\n",regstr) ;
					confile_ptr = WriteINI(confile_ptr,fpos,Linebuffer,NOW,TRUE) ;	
					if (confile_ptr < 0 )  error_code = -1 ;
				}
			}
			break ;
		case PROG_X1:
			total_set.stat_point.x = statebox.value ;
			total_set.fpos.x1 = fpos ;
			break ;
		case PROG_Y1:
			total_set.stat_point.y = statebox.value ; 
			total_set.fpos.y1 = fpos ;
			break ;
		case PROG_H1:
			total_set.stat_point.z = statebox.value ; 
			total_set.fpos.h1 = fpos ;
			break ;
		case PROG_X2:
			total_set.bak_point.x = statebox.value ; 
			total_set.fpos.x2 = fpos ;
			break ;
		case PROG_Y2:
			total_set.bak_point.y = statebox.value ; 
			total_set.fpos.y2 = fpos ;
			break ;
		case PROG_H2:
			total_set.bak_point.z = statebox.value ; 
			total_set.fpos.h2 = fpos ;
			break ;
		case PROG_STH:
			total_set.station_ht = statebox.value ; 
		        total_set.fpos.sth = fpos ;
			break ;
		case PROG_PRH:
			total_set.prism_ht = statebox.value ; 
			total_set.fpos.prh = fpos ;
			break ;
		case PROG_STAKED:
			allset.stake_d = statebox.value ; 
			allset.fpos.sk = fpos ;
			break ;
		case PROG_WDMAX:
			allset.width_max = statebox.value ; 
			allset.fpos.wd = fpos ;
			break ;
		case PROG_XLTYPE:
			allset.xl_type = statebox.value ; 
			allset.fpos.xl = fpos ;
			break; 
		case PROG_PJMODE:
			allset.pj_mode = statebox.value ; 
			allset.fpos.pj = fpos ;
			break ;
		case PROG_CUPQ:	//平曲
			if (strcmp(statebox.str,"PQ1") == 0)  dbset.current_pq = dbset.pq1 ;
			else if (strcmp(statebox.str,"PQ2") == 0) dbset.current_pq = dbset.pq2 ;
			else if (strcmp(statebox.str,"PQ3") == 0) dbset.current_pq = dbset.pq3 ;
			else if (strcmp(statebox.str,"PQ4") == 0) dbset.current_pq = dbset.pq4 ;
			else if (strcmp(statebox.str,"PQ5") == 0) dbset.current_pq = dbset.pq5 ;
			else if (strcmp(statebox.str,"EMP") == 0) dbset.current_pq = NULL ;
			else error_code = -1 ;
			
			dbset.fpos.cupq = fpos ;
			break ;
		case PROG_PQ1:
			strcpy(dbset.pq1,statebox.str) ;
			dbset.fpos.pq1 = fpos ;
			break ;
		case PROG_PQ2:
			strcpy(dbset.pq2,statebox.str) ;
			dbset.fpos.pq2 = fpos ;
			break ;
		case PROG_PQ3:
			strcpy(dbset.pq3,statebox.str) ;
			dbset.fpos.pq3 = fpos ;
			break ;
		case PROG_PQ4:
			strcpy(dbset.pq4,statebox.str) ;
			dbset.fpos.pq4 = fpos ;
			break ;
		case PROG_PQ5:
			strcpy(dbset.pq5,statebox.str) ;
			dbset.fpos.pq5 = fpos ;
			break ;
		case PROG_CUSQ:	//竖曲
			if (strcmp(statebox.str,"SQ1") == 0)  dbset.current_sq = dbset.sq1 ;
			else if (strcmp(statebox.str,"SQ2") == 0) dbset.current_sq = dbset.sq2 ;
			else if (strcmp(statebox.str,"SQ3") == 0) dbset.current_sq = dbset.sq3 ;
			else if (strcmp(statebox.str,"SQ4") == 0) dbset.current_sq = dbset.sq4 ;
			else if (strcmp(statebox.str,"SQ5") == 0) dbset.current_sq = dbset.sq5 ;
			else if (strcmp(statebox.str,"EMP") == 0) dbset.current_sq = NULL ;
			else error_code = -1 ;
			
			dbset.s_fpos.cusq = fpos ;
			break ;
		case PROG_SQ1:
			strcpy(dbset.sq1,statebox.str) ;
			dbset.s_fpos.sq1 = fpos ;
			break ;
		case PROG_SQ2:
			strcpy(dbset.sq2,statebox.str) ;
			dbset.s_fpos.sq2 = fpos ;
			break ;
		case PROG_SQ3:
			strcpy(dbset.sq3,statebox.str) ;
			dbset.s_fpos.sq3 = fpos ;
			break ;
		case PROG_SQ4:
			strcpy(dbset.sq4,statebox.str) ;
			dbset.s_fpos.sq4 = fpos ;
			break ;
		case PROG_SQ5:
			strcpy(dbset.sq5,statebox.str) ;
			dbset.s_fpos.sq5 = fpos ;
			break ;
		case PROG_CUPLD:
			if (strncmp(statebox.str,"\\\\",2) == 0) {
				CharToFont(statebox.str,pld_FileName) ;
				pld_flag = TRUE ;
				//从索引文件中获取数据行数 
				indexf_ptr = Bfile_OpenFile(indexfile, _OPENMODE_READ_SHARE) ;
				ptlist_count = Bfile_GetFileSize(indexf_ptr) /  sizeof(DWORD) ;
				Bfile_CloseFile(indexf_ptr) ;
				
				//从路径中提取文件名 
				GetNamefromStr(name,statebox.str) ;
				
				//DebugS("%s",statebox.str) ;
			} else pld_flag = FALSE ;
			dbset.pld_pos = fpos ;
			break ;			
		case PROG_CUYS:	//线元法
			if (strcmp(statebox.str,"YS1") == 0)  dbset.current_ys = dbset.ys1 ;
			else if (strcmp(statebox.str,"YS2") == 0)  dbset.current_ys = dbset.ys2 ;
			else if (strcmp(statebox.str,"YS3") == 0)  dbset.current_ys = dbset.ys3 ;
			else if (strcmp(statebox.str,"YS4") == 0)  dbset.current_ys = dbset.ys4 ;
			else if (strcmp(statebox.str,"YS5") == 0)  dbset.current_ys = dbset.ys5 ;
			else if (strcmp(statebox.str,"YS6") == 0)  dbset.current_ys = dbset.ys6 ;
			else if (strcmp(statebox.str,"YS7") == 0)  dbset.current_ys = dbset.ys7 ;
			else if (strcmp(statebox.str,"YS8") == 0)  dbset.current_ys = dbset.ys8 ;
			else if (strcmp(statebox.str,"EMP") == 0) dbset.current_ys = NULL ;
			else error_code = -1 ;
			
			dbset.ys_fpos.cuys = fpos ;
			break ;
		case PROG_YS1:
			strcpy(dbset.ys1,statebox.str) ;
			dbset.ys_fpos.ys1 = fpos ;
			break ;
		case PROG_YS2:
			strcpy(dbset.ys2,statebox.str) ;
			dbset.ys_fpos.ys2 = fpos ;
			break ;
		case PROG_YS3:
			strcpy(dbset.ys3,statebox.str) ;
			dbset.ys_fpos.ys3 = fpos ;
			break ;
		case PROG_YS4:
			strcpy(dbset.ys4,statebox.str) ;
			dbset.ys_fpos.ys4 = fpos ;
			break ;
		case PROG_YS5:
			strcpy(dbset.ys5,statebox.str) ;
			dbset.ys_fpos.ys5 = fpos ;
			break ;
		case PROG_YS6:
			strcpy(dbset.ys6,statebox.str) ;
			dbset.ys_fpos.ys6 = fpos ;
			break ;
		case PROG_YS7:
			strcpy(dbset.ys7,statebox.str) ;
			dbset.ys_fpos.ys7 = fpos ;
			break ;
		case PROG_YS8:
			strcpy(dbset.ys8,statebox.str) ;
			dbset.ys_fpos.ys8 = fpos ;
			break ;
		case PROG_CUHP:
			if (strcmp(statebox.str,"EMP") == 0)  ;
			else strcpy(dbset.current_hp,statebox.str) ;
			dbset.hp_pos = fpos ;
			break ;
		case PROG_CUSD:
			if (strcmp(statebox.str,"SD1") == 0)  dbset.current_sd = dbset.sd1 ;
			else if (strcmp(statebox.str,"SD2") == 0)  dbset.current_sd = dbset.sd2 ;
			else if (strcmp(statebox.str,"SD3") == 0)  dbset.current_sd = dbset.sd3 ;
			else if (strcmp(statebox.str,"SD4") == 0)  dbset.current_sd = dbset.sd4 ;
			else if (strcmp(statebox.str,"SD5") == 0)  dbset.current_sd = dbset.sd5 ;
			else if (strcmp(statebox.str,"SD6") == 0)  dbset.current_sd = dbset.sd6 ;
			else if (strcmp(statebox.str,"SD7") == 0)  dbset.current_sd = dbset.sd7 ;
			else if (strcmp(statebox.str,"SD8") == 0)  dbset.current_sd = dbset.sd8 ;
			else if (strcmp(statebox.str,"EMP") == 0) dbset.current_sd = NULL ;
			else error_code = -1 ;
			dbset.sd_fpos.cusd = fpos ;
			break ;
		case PROG_SD1:
			strcpy(dbset.sd1,statebox.str) ;
			dbset.sd_fpos.sd1 = fpos ;
			break ;
		case PROG_SD2:
			strcpy(dbset.sd2,statebox.str) ;
			dbset.sd_fpos.sd2 = fpos ;
			break ;
		case PROG_SD3:
			strcpy(dbset.sd3,statebox.str) ;
			dbset.sd_fpos.sd3 = fpos ;
			break ;
		case PROG_SD4:
			strcpy(dbset.sd4,statebox.str) ;
			dbset.sd_fpos.sd4 = fpos ;
			break ;
		case PROG_SD5:
			strcpy(dbset.sd5,statebox.str) ;
			dbset.sd_fpos.sd5 = fpos ;
			break ;
		case PROG_SD6:
			strcpy(dbset.sd6,statebox.str) ;
			dbset.sd_fpos.sd6 = fpos ;
			break ;
		case PROG_SD7:
			strcpy(dbset.sd7,statebox.str) ;
			dbset.sd_fpos.sd7 = fpos ;
			break ;
		case PROG_SD8:
			strcpy(dbset.sd8,statebox.str) ;
			dbset.sd_fpos.sd8 = fpos ;
			break ;
		case PROG_ERR:
			break ;
		default:
			break ;
		}		
		fpos += strlen(Linebuffer);
	}
	if (ini_version == 1.11) {
		Warning("当前ver1.11",2) ;
		DebugS("按EXE确认升级\nini配置文件 ") ;
		if ( upgradeINI(1.11,confile_ptr,ini_fpos) == TRUE ) Warning("升级成功!",2) ;
		else Warning("升级失败!",2) ;
		error_code = -1 ;		//不管升级成功还是失败 均返回程序开始
	}
	else if (ini_version == 1.13) {
		Warning("当前ver1.13",2) ;
		DebugS("按EXE确认升级\nini配置文件 ") ;
		if ( upgradeINI(1.13,confile_ptr,ini_fpos) == TRUE ) Warning("升级成功!",2) ;
		else Warning("升级失败!",2) ;
		error_code = -1 ;		//不管升级成功还是失败 均返回程序开始
	}
	else if (ini_version == 1.17){
		Warning("当前ver1.17",2) ;
		DebugS("按EXE确认升级\nini配置文件 ") ;
		if ( upgradeINI(1.17,confile_ptr,ini_fpos) == TRUE ) Warning("升级成功!",2) ;
		else Warning("升级失败!",2) ;
		error_code = -1 ;		//不管升级成功还是失败 均返回程序开始
	}
	else if (ini_version == 1.171) {
		Warning("当前ver1.171",2) ; 
		DebugS("按EXE确认升级\nini配置文件 ") ;
		if ( upgradeINI(1.171,confile_ptr,ini_fpos) == TRUE ) Warning("升级成功!",2) ;
		else Warning("升级失败!",2) ;
		error_code = -1 ;		//不管升级成功还是失败 均返回程序开始
	}
	else if (ini_version == 1.172) {
		Warning("当前ver1.172",2) ; 
		DebugS("按EXE确认升级\nini配置文件 ") ;
		if ( upgradeINI(1.172,confile_ptr,ini_fpos) == TRUE ) Warning("升级成功!",2) ;
		else Warning("升级失败!",2) ;
		error_code = -1 ;		//不管升级成功还是失败 均返回程序开始
	}
	else if (ini_version == 1.19) ;//Warning("当前ver1.19",2) ; 
	else Warning("ini版本错误 ",2) ;
	
	Bfile_CloseFile(confile_ptr) ;
	
	return  error_code;
}
Exemplo n.º 8
0
int main (int argc, char *argv[])
   {
   APIRET       rc;
   PCHAR        pcEnv;
   PRFPROFILE   prfProfile;

#ifdef DEBUG
   ulDebugMask = 0xFFFFFFFF;
#endif /* DEBUG */

   hab = WinInitialize(0);
   hmq = WinCreateMsgQueue(hab, 0);
   DebugS (1, "PM Interface initialized");

   /* Shared Memory organisieren */
   if (rc = DosGetNamedSharedMem ((PPVOID) &pShareInitOS2,
                                  SHARE_INITOS2,
                                  PAG_READ | PAG_WRITE))
      {
      if (rc = DosAllocSharedMem( (PPVOID) &pShareInitOS2,    // Pointer to shared mem
                                  SHARE_INITOS2,              // Name
                                  CCHSHARE_INITOS2,           // Size of shared mem
                                  PAG_COMMIT | PAG_READ | PAG_WRITE)) // Flags
         return(1);
      else
         {
         /* Shared Memory initialisieren */

         memset (pShareInitOS2, '\0', CCHSHARE_INITOS2);

         pShareInitOS2->pszRegFile       = (PCHAR) pShareInitOS2 +
                                          sizeof(*pShareInitOS2);
         strcpy (pShareInitOS2->pszRegFile,
                 DosScanEnv (ENV_SYSTEM_INI, &pcEnv) ? "" : pcEnv);
         pShareInitOS2->pszRootUserIni   = pShareInitOS2->pszRegFile +
                                          strlen(pShareInitOS2->pszRegFile) + 1;
         pShareInitOS2->pszRootSystemIni = pShareInitOS2->pszRootUserIni + 1;
         pShareInitOS2->pszUserIni       = pShareInitOS2->pszRootSystemIni + 1;
         pShareInitOS2->pszSystemIni     = pShareInitOS2->pszUserIni   + CCHMAXPATH;
         pShareInitOS2->pszEnvironment   = pShareInitOS2->pszSystemIni + CCHMAXPATH;
         }
      }
   DebugS (1, "Shared Memory initialized");

   /* Semaphoren organisieren */
   rc = DosOpenEventSem (HEV_SAMMY, &hevSammy);

   if( rc )
      rc = DosCreateEventSem( HEV_SAMMY,   // Name
                              &hevSammy,   // Pointer to sem
                              0,           // Not used with named sems
                              FALSE);      // Initial state (FALSE = SET)

   else        /* Sammy ist bereits installiert */
      {
      pShareInitOS2->pszEnvironment[0] = '\0';
      pShareInitOS2->pszEnvironment[1] = '\0';
      pShareInitOS2->pszSystemIni[0]   = '\0';
      pShareInitOS2->pszUserIni[0]     = '\0';
      DosPostEventSem(hevSammy);
      goto Exit;
      }

   if( rc )
      {
      intSammyRetCode = rc;
      goto Exit;
      }

   rc = DosOpenEventSem (HEV_PRFRESETLOCK, &hevPrfResetLock);

   if( rc )
      rc = DosCreateEventSem( HEV_PRFRESETLOCK, // Name
                              &hevPrfResetLock, // Pointer to sem
                              0,                // Not used with named sems
                              TRUE);            // Initial state (TRUE = POSTED)

   if( rc )
      {
      intSammyRetCode = rc;
      goto Exit;
      }
   DebugS (1, "Semaphores initialized");

   ChangeWPS(pShareInitOS2->pszUserIni, pShareInitOS2->pszSystemIni);

   /* Hintergrundloop starten, das Shell mit aktueller Env. startet */

   DosCreateThread (&tid1,
                    (PFNTHREAD) thStartProg,
                    (ULONG) ((argc > 1) ? argv[1] : ""),
                    0,
                    THREADSTACK);
   DebugS (1, "Background loop started");

   /* Hintergrundloop starten, das jeweils nach L�schen einer Semaphore */
   /* einen prfReset initiiert                      */
   DosCreateThread (&tid2,
                    (PFNTHREAD) thSwitch,
                    (ULONG) 0,
                    0,
                    THREADSTACK);

   while (WinGetMsg (hab, &qmsg, 0, 0, 0))
      WinDispatchMsg (hab, &qmsg);

   if (intSammyRetCode)
      {
      DosKillThread (tid1);
      DosKillThread (tid2);

      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=NO");
      WinPostMsg(WinQueryWindow(HWND_DESKTOP, QW_BOTTOM), WM_CLOSE, 0, 0);

      WinAlarm (HWND_DESKTOP, WA_ERROR);

      prfProfile.pszSysName  = (DosScanEnv (ENV_SYSTEM_INI, &pcEnv) ? "" : pcEnv);
      prfProfile.pszUserName = (DosScanEnv (ENV_USER_INI, &pcEnv) ? "" : pcEnv);

      prfProfile.cchUserName = strlen(prfProfile.pszUserName);
      prfProfile.cchSysName  = strlen(prfProfile.pszSysName);

      DosSleep (1000);
      DosKillProcess( DKP_PROCESSTREE, ulShellID );

      if ( !PrfReset(hab, &prfProfile))
         WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "OPEN=ICON;WORKAREA=YES");
      }
Exit:
   WinDestroyMsgQueue(hmq);
   WinTerminate(hab);

   DebugS (1, "Application terminated");

   return intSammyRetCode;
   }
Exemplo n.º 9
0
BOOL ChangeWPS(PCHAR pszUserIni, PCHAR pszSystemIni)
   {
   PCHAR        pcEnv;
   PRFPROFILE   prfProfile;
   BOOL         bSuccess;

   if (*pszSystemIni == '\0')
      prfProfile.pszSysName = pShareInitOS2->pszRootSystemIni;
   else
      prfProfile.pszSysName = pszSystemIni;

   if (*prfProfile.pszSysName == '\0')
      prfProfile.pszSysName = (DosScanEnv (ENV_SYSTEM_INI, &pcEnv) ? "" : pcEnv);

   if (*pszUserIni == '\0')
      {
      prfProfile.pszUserName = pShareInitOS2->pszRootUserIni;
      pShareInitOS2->ulFlag  = pShareInitOS2->ulFlag_Root; // ulFlag f�r Rootdesktop
      }
   else
      prfProfile.pszUserName = pszUserIni;

   if (*prfProfile.pszUserName == '\0')
      prfProfile.pszUserName = (DosScanEnv (ENV_USER_INI, &pcEnv) ? "" : pcEnv);

   prfProfile.cchUserName = strlen(prfProfile.pszUserName);
   prfProfile.cchSysName  = strlen(prfProfile.pszSysName);

   if (ulOldFlag & CLOSEAPPL)
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=YES");
   else
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "WORKAREA=NO");

   WinPostMsg(WinQueryWindow(HWND_DESKTOP, QW_BOTTOM), WM_CLOSE, 0, 0);
   DebugS (1, "HWND_DESKTOP closed");

   if( hevPrfResetLock )
      {
      DosWaitEventSem (hevPrfResetLock, SEM_INDEFINITE_WAIT);
      DosSleep(1000);
      DebugS (1, "hevPrfResetLock released");
      }
   else
      DosSleep(20000);

   bSuccess = PrfReset(hab, &prfProfile);
   DebugULd (1, "PrfReset", "return", bSuccess);

/*
 *  Beim Umschalten auf den Root, egal ob von Sammy oder von WPSamF ausgel�st,
 *  wird die Shell vom PrfReset nicht geschlossen.
 *  Solange die Ursache nicht bekannt ist, bleibt nichts anderes �brig,
 *  als an dieser Stelle symptomatisch vorzugehen und die Shell abzuschie�en.
 */
   if (*pszUserIni == '\0')
      {
      DosSuspendThread (tid1);
      DosKillProcess( DKP_PROCESSTREE, ulShellID );   // sog. Budnik'scher Arschtritt
      DebugS (1, "Shell killed");
      DosResumeThread (tid1);
      }

   if( !bSuccess )
      {
      WinSetObjectData(WinQueryObject("<WP_DESKTOP>"), "OPEN=ICON;WORKAREA=YES");
      DebugS (1, "Desktop set to <WP_DESKTOP>");
      intSammyRetCode = 250;
      WinPostQueueMsg (hmq, WM_QUIT, 0L, 0L);
      }
   else
      ulOldFlag = pShareInitOS2->ulFlag;

   return( bSuccess );
   }
Exemplo n.º 10
0
ULONG ulExecProg (CHAR *szProgName)
   {
   ULONG        ulBootDrive;
   ULONG        ulAppType;
   CHAR         szCmdName[CCHMAXPATH];
   CHAR         szLine[CCHMAXPATH];
   PSZ          pszScanEnv;
   RESULTCODES  rcTermination;
   APIRET       rcFailure = 0;
   PCHAR        pszEnvironment;

/*
 *  Diese Routine versucht eine Shell zu starten.
 */

   pszEnvironment = MakeEnv (pShareInitOS2->pszEnvironment);

   if ( !(rcFailure = ScanEnv(ENV_SAMWORKPLACE, &pszScanEnv, pszEnvironment)) )
      {
      rcFailure = DosQueryAppType(pszScanEnv, &ulAppType);

      if ( !rcFailure )
         if ( ( (ulAppType & 7) == FAPPTYP_NOTSPEC) ||
              ( (ulAppType & 7) == FAPPTYP_WINDOWAPI) )
            rcFailure = DosExecPgm (szLine,           /* Object name buffer */
                                 sizeof(szLine),      /* Length of object name buffer */
                                 EXEC_ASYNCRESULT,    /* Execution flags */
                                 "",                  /* Argument string */
                                 pszEnvironment,       /* Environment */
                                 &rcTermination,      /* Termination codes */
                                 pszScanEnv);         /* Program file name */
         else
            rcFailure = 1;
      }

   if (rcFailure)
      {
      WinAlarm (HWND_DESKTOP, WA_ERROR);
      DebugS (1, "DosExecPgm <1> failed");
      }

   if (rcFailure)
      {
      rcFailure = DosExecPgm (szLine,              /* Object name buffer */
                              sizeof(szLine),      /* Length of object name buffer */
                              EXEC_ASYNCRESULT,    /* Execution flags */
                              "",                  /* Argument string */
                              pszEnvironment,       /* Environment */
                              &rcTermination,      /* Termination codes */
                              szProgName);         /* Program file name */
      }

   if (rcFailure)
      {
      if (!(rcFailure = DosScanEnv (ENV_SAMWORKPLACE, &pszScanEnv)))
         rcFailure = DosExecPgm (szLine,        /* Object name buffer */
                           sizeof(szLine),      /* Length of object name buffer */
                           EXEC_ASYNCRESULT,    /* Execution flags */
                           "",                  /* Argument string */
                           pszEnvironment,       /* Environment */
                           &rcTermination,      /* Termination codes */
                           pszScanEnv);         /* Program file name */
      }

   if (rcFailure)
      {
      DebugS (1, "DosExecPgm <2> failed");
      DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ULONG));

      memset (szCmdName, '\0', sizeof(szCmdName));
      szCmdName[0] = (CHAR) (ulBootDrive - 1) + 'A';
      strcpy (szCmdName+1, ":\\OS2\\PMSHELL.EXE");

      rcFailure = DosExecPgm (szLine,           /* Object name buffer */
                           sizeof(szLine),      /* Length of object name buffer */
                           EXEC_ASYNCRESULT,    /* Execution flags */
                           "",                  /* Argument string */
                           pszEnvironment,       /* Environment */
                           &rcTermination,      /* Termination codes */
                           szCmdName);          /* Program file name */
      }

/* Falls Shell nicht gestartet werden konnte, wird cmd.exe aufgerufen */

   if (rcFailure)
      {
      DebugS (1, "DosExecPgm <3> failed");
      if (!(rcFailure = DosScanEnv ("COMSPEC", &pszScanEnv)))
         rcFailure = DosExecPgm (szLine,        /* Object name buffer */
                           sizeof(szLine),      /* Length of object name buffer */
                           EXEC_ASYNCRESULT,    /* Execution flags */
                           "/K",                /* Argument string */
                           pszEnvironment,       /* Environment */
                           &rcTermination,      /* Termination codes */
                           pszScanEnv);         /* Program file name */
      }

   if (rcFailure)
      {
      DebugS (1, "DosExecPgm <4> failed");
      DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ULONG));

      memset (szCmdName, '\0', sizeof(szCmdName));
      szCmdName[0] = (CHAR) (ulBootDrive - 1) + 'A';
      strcpy (szCmdName+1, ":\\OS2\\CMD.EXE");

      rcFailure = DosExecPgm (szLine,        /* Object name buffer */
                        sizeof(szLine),      /* Length of object name buffer */
                        EXEC_ASYNCRESULT,    /* Execution flags */
                        "/K",                /* Argument string */
                        pszEnvironment,       /* Environment */
                        &rcTermination,      /* Termination codes */
                        szCmdName);          /* Program file name */
      }

   DosFreeMem(pszEnvironment);

   if (rcFailure)
      {
      intSammyRetCode = rcFailure;
      WinPostQueueMsg (hmq, WM_CLOSE, 0L, 0L);
      DebugS (1, "DosExecPgm <5> failed");
      }

   return (rcFailure ? 0 : rcTermination.codeTerminate);
   }
 void onRelayConnectionClosed(TCPClient& client, const net::TCPSocket::Ptr& socket, const net::Address& peerAddr)
 {
     DebugS(this) << "Connection Closed" << endl;
 }
 void onTimer(TCPClient& client)
 {
     DebugS(this) << "onTimer" << endl;
 }
 void onClientStateChange(turn::Client& client, turn::ClientState& state, const turn::ClientState&)
 {
     DebugS(this) << "State change: " << state.toString() << endl;
 }
 void onServerAllocationRemoved(Server* server, IAllocation* alloc)
 {
     DebugS(this) << "Allocation removed" << endl;
 }
Exemplo n.º 15
0
StreamingOptions::StreamingOptions(MediaServer* server, av::VideoCapture::Ptr videoCapture, av::AudioCapture::Ptr audioCapture) :
    server(server), videoCapture(videoCapture), audioCapture(audioCapture)
{
    DebugS(this) << "Destroy" << endl;
}
 void onServerAllocationCreated(Server* server, IAllocation* alloc)
 {
     DebugS(this) << "Allocation created" << endl;
 }
 void onAllocationPermissionsCreated(turn::Client& client, const turn::PermissionList& permissions)
 {
     DebugS(this) << "Permissions Created" << endl;
 }
 void onRelayConnectionDataReceived(turn::Client& client, const char* data, std::size_t size, const net::Address& peerAddr)
 {
     DebugS(this) << "Received Data: " << std::string(data, size) <<  ": " << peerAddr << endl;
 }
Exemplo n.º 19
0
Arquivo: set.c Projeto: justid/Zoolu
int upgradeINI(double version, int file_ptr, int pos)
{
void* rebuff_ptr = NULL;
void* buff_prev = NULL;
void* buff_next = NULL;

int size ;
int bytesfree ;
char* Addto ;
BYTE insert_flag = FALSE ;
char Addto113[] = "Current_PLD = \\;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r\n\r\n" ;
char Addto117[] = "Current_YS = EMP ;\r\nYS1 =  XYF ;\r\nYS2 = BBBB ;\r\nYS3 = CCCC ;\r\nYS4 = DDDD ;\r\nYS5 = EEEE ;\r\nYS6 = FFFF ;\r\nYS7 = GGGG ;\r\nYS8 = HHHH ;\r\n\r\n" ;
char Addto1171[] = "XLTYPE =     1.000 ;\r\nPJMODE =     1.000 ;\r\n" ;
char Addto1172[] = "Current_HP =  EMP ;" ;
char Addto119[] = "\r\n\r\nCurrent_SD = EMP ;\r\nSD1 = AAAA ;\r\nSD2 = BBBB ;\r\nSD3 = CCCC ;\r\nSD4 = DDDD ;\r\nSD5 = EEEE ;\r\nSD6 = FFFF ;\r\nSD7 = GGGG ;\r\nSD8 = HHHH ;" ;

Warning("升级中..",2) ;
file_ptr = Reopen(file_ptr) ;

if (version == 1.11){
	Addto = Addto113 ;
	WriteINI(file_ptr, pos, "Version =     1.130 ;",NOW,TRUE) ;
} else if (version == 1.13){
	Addto = Addto117 ;
	WriteINI(file_ptr, pos, "Version =     1.170 ;",NOW,TRUE) ;	
} else if (version == 1.17){
	Addto = Addto1171 ;
	WriteINI(file_ptr, pos, "Version =     1.171 ;",NOW,TRUE) ;
	insert_flag = TRUE ;	
} else if (version == 1.171){
	Addto = Addto1172 ;
	WriteINI(file_ptr, pos, "Version =     1.172 ;",NOW,TRUE) ;
} else if (version == 1.172){
	Addto = Addto119 ;
	WriteINI(file_ptr, pos, "Version =     1.190 ;",NOW,TRUE) ;
} else {
	Warning("错误的版本号!",2) ;
	return FALSE ;
}

//增加ini文件大小
size = Bfile_GetFileSize(file_ptr) ;
rebuff_ptr = calloc( size+ strlen(Addto),sizeof(char)) ;
if (insert_flag == TRUE){
		buff_prev = calloc( allset.fpos.sk,sizeof(char)) ;	
		buff_next = calloc( size-allset.fpos.sk,sizeof(char)) ;
		if (buff_prev == NULL || buff_next == NULL){
			if (rebuff_ptr != NULL) free(rebuff_ptr) ;
			DebugS("申请内存失败!") ;
			return FALSE ;
		}
}
else if (rebuff_ptr == NULL){
	DebugS("申请内存失败!") ;
	return FALSE ;
}
if (insert_flag == TRUE){
	Bfile_ReadFile(file_ptr,buff_prev,allset.fpos.sk ,-1) ;	//读取前半部分
	Bfile_ReadFile(file_ptr,buff_next,size-allset.fpos.sk ,-1) ;	//读取后半部分	
}
else Bfile_ReadFile(file_ptr,rebuff_ptr,size ,-1) ;

Bfile_CloseFile(file_ptr) ;
Bfile_DeleteFile(configfile) ;


if (Bfile_CreateFile(configfile, size+strlen(Addto)) < 0) {
	if (rebuff_ptr != NULL)	free(rebuff_ptr) ;
	if (buff_prev != NULL)	free(buff_prev) ;
	if (buff_next != NULL)	free(buff_next) ;
	DebugS("创建文件失败\n请重新上传 ") ;
	return FALSE ;
}
file_ptr = Reopen(file_ptr) ;
if (insert_flag == TRUE) {
	strncat(rebuff_ptr,buff_prev,strlen(buff_prev)) ;		//拼接
	strncat(rebuff_ptr,Addto,strlen(Addto)) ;	
	strncat(rebuff_ptr,buff_next,strlen(buff_next)) ;		
}
else strncat(rebuff_ptr,Addto,strlen(Addto)) ;
Bfile_WriteFile(file_ptr,rebuff_ptr,size+strlen(Addto)) ;
		
if (rebuff_ptr != NULL)	free(rebuff_ptr) ;
if (buff_prev != NULL)	free(buff_prev) ;
if (buff_next != NULL)	free(buff_next) ;

Bfile_CloseFile(file_ptr) ;

return TRUE ;	
}
Exemplo n.º 20
0
Transaction::~Transaction() 
{
    DebugS(this) << "Destroy" << std::endl;    
}
Exemplo n.º 21
0
StreamingOptions::~StreamingOptions()
{
    DebugS(this) << "Destroy" << endl;
}
 void onRelayConnectionCreated(TCPClient& client, const net::TCPSocket::Ptr& socket, const net::Address& peerAddr) //std::uint32_t connectionID,
 {
     DebugS(this) << "Relay Connection Created: " << peerAddr << endl;
 }
Exemplo n.º 23
0
int Suidao_DM(void)
{
	int display = 0;
	double sd_pj = 0.0 ;	/*	测点与中线的距离	*/
	double sd_gc = 0.0 ;	/*	测点与设计线的高差	*/
	unsigned int key = 0 ;
	unsigned int back_key ;
	BYTE exit_flag = FALSE;
	BYTE xyrow = 0 ;
	int shuaxin = TRUE;		/*	刷新	*/

	while (exit_flag != TRUE)  {
		
		switch(key) {
 		case KEY_CTRL_F1:	default: 
 			if (key == KEY_CTRL_F1)	shuaxin == TRUE;
			if (shuaxin){
				Bdisp_AllClr_DDVRAM() ; 
				Print_zh("隧道断面 ", 0, 1, VERT_REV) ;
				PrintIcon (0,"Home",0);
				PrintIcon (1,"Set",0);
				PrintIcon (2,"SQX",0);
				PrintIcon (3,"DM",0);
				(R_L > 0) ? PrintIcon (4,"YOU",0) : PrintIcon (4,"ZUO",1);
				PrintIcon (5,"Help",0);
				shuaxin = FALSE;
			}
			back_key = key ;
			Bdisp_AreaClr_DDVRAM(&clear_area) ;
			Print_zh("X坐标 ", 20, 6, 0) ;
			Print_zh("Y坐标 ", 20, 22, 0) ;
			Print_zh("Z坐标 ", 20, 38, 0) ;
			
			
			 if (xyrow > 2) {
			 		if (!sd_flag)	{
						Warning("未载入断面 ",2);
						//exit_flag = TRUE ;	//强制退出以解决卡在载入数据界面的问题 fix by 龙之冰点
						xyrow = 0; /*	把焦点设置在TOP		*/
						key = KEY_CTRL_F4;
					break ;
				}
 				xyrow = 0 ;
 				x = sd_x ;
 				y = sd_y ;
 				SaveDisp(SAVEDISP_PAGE2) ;
 				if (InputStake(FS_NOPOPUP) == FSOK){
 					number = fs_zh ;
 					if (!GC_JS(number)) break ;
 					RestoreDisp(SAVEDISP_PAGE2) ;
				 	Bdisp_AreaClr_DDVRAM(&clear_area) ;
				 	
				 	sd_gc = sd_z -  DesignGC;
					 				 	
				 	if (!yanxin(fs_pj, sd_gc)){
				 		Warning("断面计算失败 ",2);
				 		key == KEY_CTRL_F1; 
	 					break ;
	 				}
					Print_zh("桩号K ", 20, 0, 0) ;
					Print_zh("偏距D ", 20, 13, 0) ;
					Print_zh("高差H ", 20, 26, 0) ;
					if (sd_cqw < 0)	Print_zh("欠挖W ", 20, 39, 0) ;
					else			Print_zh("超挖T ", 20, 39, 0) ;
					Print_C(120, 4, CA = fs_zh, 3) ;
					Print_C(120, 17, CA = fs_pj, 3) ;
					Print_C(120, 30, CA = sd_gc, 3) ;
					Print_C(120, 43, CA = sd_cqw, 3) ;
					key = 0 ;
					while(key != KEY_CTRL_EXE && key != KEY_CTRL_EXIT)	GetKey(&key) ;
					key = KEY_CTRL_F1 ;
					break ;
				 }
 				RestoreDisp(SAVEDISP_PAGE2) ;
 			}
			Print_C(112, 10, CA = sd_x, 3) ;
			Print_C(112, 26, CA = sd_y, 3) ;
			Print_C(112, 42, CA = sd_z, 3) ;
			key = InputVal(59, 8+xyrow*16) ;
			switch (xyrow) {	
				case 0:   sd_x = number ? number : sd_x ; break ; 
				case 1:   sd_y = number ? number : sd_y; break ; 
				case 2:   sd_z = number ? number : sd_z; break ; 
				default:  break ;
			}
			if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) xyrow = 0 ;
			break ;
		case KEY_CTRL_F2:
			back_key = key ;
			Bdisp_AreaClr_DDVRAM(&clear_area) ;
			Print_zh("修正H ", 20, 6, 0) ;
			Print_zh("修正D ", 20, 22, 0) ;
			Print_zh("修正R ", 20, 38, 0) ;
			if (xyrow > 2) { 	/* 返回上一个菜单  */
				key = KEY_CTRL_F1 ; 
				xyrow = 0 ; 
				break ;
			 }
			Print_C(112, 10, CA = sd_h, 3) ;
			Print_C(112, 26, CA = sd_d, 3) ;
			Print_C(112, 42, CA = sd_r, 3) ;
			key = InputValP(59, 8+xyrow*16) ;
			switch (xyrow) {	
				case 0:   sd_h = number ? number : sd_h ; break ; 
				case 1:   sd_d = number ? number : sd_d ;break ; 
				case 2:   sd_r = number ? number : sd_r ; break ; 
				default:  break ;
			}
			if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) xyrow = 0 ;
			break ;

		case KEY_CTRL_F3:
			SaveDisp(SAVEDISP_PAGE2) ;

			if (sqx_flag == TRUE)	 {
				if ( InputSQstake() == TRUE) {
					if (InputSQpj() == TRUE) {	/* 输入偏距	*/
						DesignGC = Cut_3(DesignGC) ;
						PopUpWin(3);
						locatestr(12,22) ;
						printf("高程:%.3f",DesignGC ) ;
						GetKey(&key);
					}
				}		
			}
			else  DebugS("未载入竖曲线 ") ;
			key =  back_key ;
			RestoreDisp(SAVEDISP_PAGE2) ;
			break ;
			
		case KEY_CTRL_F4:
			sd_flag = load_SD_data(sd_flag) ;
			key =  KEY_CTRL_F1 ;
			shuaxin = TRUE;
			break ;
			
		case KEY_CTRL_F5:
			if (R_L == -1){
				R_L = 1; 
				Warning("应用在右幅 ",2);
			}	
			else{
				R_L = -1;
				Warning("应用在左幅 ",2);
			}
			key =  KEY_CTRL_F1 ;
			shuaxin = TRUE;
			break ;
			
			case KEY_CTRL_F6:
			Bdisp_AllClr_DDVRAM() ;
			Print_zh("Home=刷新页面 ", 1, 2, 0) ;
			Print_zh("Set =断面数据修正 ", 1, 16, 0) ;
			Print_zh("SQX =竖曲线高程 ", 1, 30, 0) ;
			Print_zh("DM  =选择断面文件 ", 1, 44, 0) ;
			GetKey(&key);
			Bdisp_AllClr_DDVRAM() ;
			Print_zh("ZUO =应用在左幅 ", 1, 2, 0) ;
			Print_zh("YOU =应用在右幅 ", 1, 16, 0) ;
			Print_zh("修正H=改变圆心高差 ", 1, 30, 0) ;
			Print_zh("     (+上移 -下移)", 1, 44, 0) ;
			GetKey(&key);
			Bdisp_AllClr_DDVRAM() ;
			Print_zh("修正D=改变圆心偏距 ", 1, 2, 0) ;
			Print_zh("     (+右移 -左移) ", 1, 16, 0) ;
			Print_zh("修正R=改变设计半径 ", 1, 30, 0) ;
			Print_zh("     (+变长 -变短)", 1, 44, 0) ;
			GetKey(&key);
			key =  KEY_CTRL_F1 ;
			shuaxin = TRUE;
			break ;

		case KEY_CTRL_UP:  
			if (xyrow > 0)  --xyrow ;  
			key = back_key ;
			break ;
		case KEY_CTRL_DOWN: 
		case KEY_CTRL_EXE:
			++xyrow ; 
			key = back_key ;
			break ;
		case KEY_CTRL_DEL:
			key = back_key ;
			break ;
		case KEY_CTRL_EXIT :
			exit_flag = TRUE ;	
			break ;
		}
	}
	return ;
}
Exemplo n.º 24
0
void TCPSocket::onError(const scy::Error& error) 
{        
    DebugS(this) << "Error: " << error.message << endl;
    onSocketError(error);
    close(); // close on error
}