Пример #1
1
void CLog::ErrLogMsg( EErrorMsg_Type eType, const TString& strMsg, const TString& ErrInfo )
{

    // 日志文件获得
    const SOpenFile* pOpenFlil = GetLogFile( eErrLog );
    if ( pOpenFlil == NULL )
    {
        // bad, 日志文件获得失败
        return;
    }

    // 输出
    static const int BUF_SIZE = 256;
    TCHAR szCharBuf[BUF_SIZE];

    _stprintf_s( szCharBuf, BUF_SIZE, _T("%s  Type: %d; Msg: %s")
                , ErrInfo.c_str(), eType, strMsg.c_str() );

    if ( WriteFile( pOpenFlil->pFile, szCharBuf ) == false )
    {
        // bad, 日志写入失败
        return;
    }
}
Пример #2
0
void CLog::LogToFile( const S_LogMsg& logMsg )
{
    // 日志信息格式化, 统一添加一些格式化的信息(如日期)
    const TString& strLogMsg = FormMsg( logMsg.strMsg );

    // 类型判断
    if ( logMsg.eType <= eERROR_MSG_TYPE_START || logMsg.eType >= eErrLog )
    {
        // bad, 日志类型不合法
        ErrLogMsg( logMsg.eType, strLogMsg, _T("Err Log Type") );
        return;
    }

    // 日志文件获得
    const SOpenFile* pOpenFlil = GetLogFile( logMsg.eType );
    if ( pOpenFlil == NULL )
    {
        // bad, 日志文件获得失败
        ErrLogMsg( logMsg.eType, strLogMsg, _T("Cannot open logFile") );
        return;
    }

    // 输出
    if ( WriteFile( pOpenFlil->pFile, strLogMsg ) == false )
    {
        // bad, 日志写入失败
        ErrLogMsg( logMsg.eType, strLogMsg, _T("Write logFile failed!") );
        return;
    }
}
Пример #3
0
void LogDebug(const char *fmt, ...)
{
  va_list ap;
  va_start(ap,fmt);

  char buffer[1000];
  int tmp;
  va_start(ap,fmt);
  tmp=vsprintf(buffer, fmt, ap);
  va_end(ap);
  SYSTEMTIME systemTime;
  GetLocalTime(&systemTime);

  TCHAR filename[1024];
  GetLogFile(filename);
  FILE* fp = fopen(filename,"a+");

  if (fp!=NULL)
  {
    fprintf(fp,"%02.2d-%02.2d-%04.4d %02.2d:%02.2d:%02.2d.%03.3d [%x]%s\n",
      systemTime.wDay, systemTime.wMonth, systemTime.wYear,
      systemTime.wHour,systemTime.wMinute,systemTime.wSecond,
      systemTime.wMilliseconds,
      GetCurrentThreadId(),
      buffer);
    fclose(fp);
  }
  char buf[1000];
  sprintf(buf,"%02.2d-%02.2d-%04.4d %02.2d:%02.2d:%02.2d %s\n",
    systemTime.wDay, systemTime.wMonth, systemTime.wYear,
    systemTime.wHour,systemTime.wMinute,systemTime.wSecond,
    buffer);
  ::OutputDebugString(buf);
};
Пример #4
0
/******************************************************************************
 * Function Name: DumpLogMessage
 *
 * Inputs       : eLogFile, uTabLength, pszFormat
 * Outputs      : -
 * Returns      : -
 * Globals Used : -
 *
 * Description  : Writes a message to a log file.
 *****************************************************************************/
IMG_INTERNAL IMG_VOID DumpLogMessage(LogFile eLogFile, IMG_UINT32 uTabLength, const IMG_CHAR *pszFormat, ...)
{
	va_list vaArgs;
	IMG_UINT32 i;
	static IMG_BOOL bTabLengthErrorReported = IMG_FALSE;

	FILE *LogFile = GetLogFile(eLogFile);

	if (LogFile)
	{
		IMG_CHAR acScratchBuffer[DEBUG_SCRATCH_BUFFER_SIZE];

		if ((uTabLength > (DEBUG_SCRATCH_BUFFER_SIZE / 2)) && !bTabLengthErrorReported)
		{
			DEBUG_MESSAGE(("DumpLogMessage: Tab length too long (%d)(LOGFILE = %08X)!\n(Will not report any further errors of this type)\n",
						 uTabLength,
						 eLogFile));
			uTabLength = DEBUG_SCRATCH_BUFFER_SIZE / 2;
			bTabLengthErrorReported = IMG_TRUE;
		}

		va_start (vaArgs, pszFormat);

		vsnprintf (acScratchBuffer, DEBUG_SCRATCH_BUFFER_SIZE, pszFormat, vaArgs);
		
		for (i = 0; i < uTabLength; i++)
		{
			fprintf(LogFile, " ");
		}
		
		fprintf(LogFile, "%s", acScratchBuffer);
		
		va_end (vaArgs);
	}
}
Пример #5
0
void LogDebug(const wchar_t *fmt, ...)
{
//#ifdef DEBUG
	va_list ap;
	va_start(ap,fmt);

	va_start(ap,fmt);
	vswprintf_s(logbufferw, fmt, ap);
	va_end(ap); 

	wchar_t fileName[MAX_PATH];
	GetLogFile(fileName);
	FILE* fp = _wfopen(fileName,L"a+, ccs=UTF-8");
	if (fp!=NULL)
	{
	SYSTEMTIME systemTime;
	GetLocalTime(&systemTime);
		fwprintf(fp,L"%02.2d-%02.2d-%04.4d %02.2d:%02.2d:%02.2d.%02.2d %s\n",
			systemTime.wDay, systemTime.wMonth, systemTime.wYear,
			systemTime.wHour,systemTime.wMinute,systemTime.wSecond,systemTime.wMilliseconds,
			logbufferw);
		fclose(fp);
		//::OutputDebugStringW(logbufferw);::OutputDebugStringW(L"\n");
	}
//#endif
};
Пример #6
0
//
// Constructor
//
CDVBSub::CDVBSub( LPUNKNOWN pUnk, HRESULT *phr, CCritSec *pLock ) :
  CBaseFilter( NAME("MediaPortal DVBSub2"), pUnk, &m_Lock, CLSID_DVBSub2 ),
  m_pSubtitlePin( NULL ),
  m_pSubDecoder( NULL ),
  m_pSubtitleObserver( NULL ),
  m_pUpdateTimeoutObserver( NULL ),
  m_pResetObserver( NULL ),
  m_pIMediaSeeking( NULL ),
  m_bSeekingDone( true ),
  m_startTimestamp( -1 ),
  m_CurrentSeekPosition( 0 ),
  m_prevSubtitleTimestamp( 0 ),
  m_bBasePcrSet( false )
{
  TCHAR filename[1024];
  GetLogFile(filename);
  ::DeleteFile(filename);

  LogDebug("-------------- MediaPortal DVBSub2.ax version 1.3.3 ----------------");
  
  // Create subtitle decoder
  m_pSubDecoder = new CDVBSubDecoder();

  if( m_pSubDecoder == NULL )
  {
    if( phr )
    {
      *phr = E_OUTOFMEMORY;
    }
    return;
  }

  // Create subtitle input pin
  m_pSubtitlePin = new CSubtitleInputPin( this,
                         GetOwner(),
                         this,
                         &m_Lock,
                         &m_ReceiveLock,
                         m_pSubDecoder,
                         phr );

  if ( m_pSubtitlePin == NULL )
  {
    if( phr )
    {
      *phr = E_OUTOFMEMORY;
    }
    return;
  }

  if( m_pSubDecoder )
  {
    m_pSubDecoder->SetObserver( this );
  }
  else
  {
    LogDebug("No DVB subtitle decoder available!");
  }
}
Пример #7
0
static int TEST_printf(const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	int res = vfprintf(GetLogFile(), fmt, ap);
	va_end(ap);
	return res;
}
Пример #8
0
/******************************************************************************
 * Function Name: CloseLogFile
 *
 * Inputs       : -
 * Outputs      : -
 * Returns      : -
 * Globals Used : -
 *
 * Description  : 
 *****************************************************************************/
IMG_INTERNAL IMG_VOID CloseLogFile(LogFile eLogFile)
{
	FILE *LogFile = GetLogFile(eLogFile);

	if (LogFile)
	{
		fclose(LogFile);
		LogFile = NULL;
	}
}
Пример #9
0
/******************************************************************************
 * Function Name: CreateLogFile
 *
 * Inputs       : eLogFile
 * Outputs      : -
 * Returns      : 
 * Globals Used : -
 *
 * Description  : 
 *****************************************************************************/
IMG_INTERNAL IMG_BOOL LogFileActive(LogFile eLogFile)
{
	if (!GetLogFile(eLogFile))
	{
		return IMG_FALSE;
	}
	else
	{
		return IMG_TRUE;
	}
}
Пример #10
0
NS_IMETHODIMP
nsMsgFilterList::GetLogURL(nsACString &aLogURL)
{
  nsCOMPtr <nsIFile> file;
  nsresult rv = GetLogFile(getter_AddRefs(file));
  NS_ENSURE_SUCCESS(rv,rv);

  rv = NS_GetURLSpecFromFile(file, aLogURL);
  NS_ENSURE_SUCCESS(rv,rv);

  return !aLogURL.IsEmpty() ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
Пример #11
0
NS_IMETHODIMP nsMsgFilterList::EnsureLogFile()
{
  nsCOMPtr <nsIFile> file;
  nsresult rv = GetLogFile(getter_AddRefs(file));
  NS_ENSURE_SUCCESS(rv,rv);

  bool exists;
  rv = file->Exists(&exists);
  if (NS_SUCCEEDED(rv) && !exists) {
    rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
    NS_ENSURE_SUCCESS(rv,rv);
  }
  return NS_OK;
}
Пример #12
0
//---------------------------------------------------------------------------
bool
Job::UnmonitorLogFile( ReadMultipleUserLogs &condorLogReader,
			ReadMultipleUserLogs &storkLogReader )
{
	debug_printf( DEBUG_DEBUG_2, "Unmonitoring log file <%s> for node %s\n",
				GetLogFile(), GetJobName() );

	if ( !_logIsMonitored ) {
		debug_printf( DEBUG_DEBUG_1, "Warning: log file for node "
					"%s is already unmonitored\n", GetJobName() );
		return true;
	}

	ReadMultipleUserLogs &logReader = (_jobType == TYPE_CONDOR) ?
				condorLogReader : storkLogReader;

	debug_printf( DEBUG_DEBUG_1, "Unmonitoring log file <%s> for node %s\n",
				GetLogFile(), GetJobName() );

	CondorError errstack;
	bool result = logReader.unmonitorLogFile( GetLogFile(), errstack );
	if ( !result ) {
		errstack.pushf( "DAGMan::Job", DAGMAN_ERR_LOG_FILE,
					"ERROR: Unable to unmonitor log " "file for node %s",
					GetJobName() );
		debug_printf( DEBUG_QUIET, "%s\n", errstack.getFullText().c_str() );
		EXCEPT( "Fatal log file monitoring error!\n" );
	}

	if ( result ) {
		delete [] _logFile;
		_logFile = NULL;
		_logIsMonitored = false;
	}

	return result;
}
Пример #13
0
void CLogger::OnChatRoomMsg(ChatRoomMsg_t* pChatRoomMsg)
{
	if(!m_pClientFriends || !m_pGetChatRoomEntry)
		return;

	char szMessage[k_cchFriendChatMsgMax + 1];
	EChatEntryType eEntryType;
	CSteamID chatterID;
	int iMessageSize = m_pGetChatRoomEntry(m_pClientFriends, pChatRoomMsg->m_ulSteamIDChat, pChatRoomMsg->m_iChatID, &chatterID, szMessage, sizeof(szMessage) - 1, &eEntryType);
	szMessage[iMessageSize] = '\0';

	if(iMessageSize)
	{
		if(eEntryType == k_EChatEntryTypeChatMsg)
		{
			wxFFile* pFile = GetLogFile(pChatRoomMsg->m_ulSteamIDChat);
			if(pFile)
			{
				wxString message = m_messageFormat + _T("\n");
				FormatMessage(message, pChatRoomMsg->m_ulSteamIDUser, szMessage);
				pFile->Write(message);
				pFile->Flush();
			}
		}
		else if(eEntryType == k_EChatEntryTypeEmote)
		{
			wxFFile* pFile = GetLogFile(pChatRoomMsg->m_ulSteamIDChat);
			if(pFile)
			{
				wxString message = m_emoteFormat + _T("\n");
				FormatMessage(message, pChatRoomMsg->m_ulSteamIDUser, szMessage);
				pFile->Write(message);
				pFile->Flush();
			}
		}
	}
}
Пример #14
0
int main(int argc, char** argv)
{ 
   SERVICE_TABLE_ENTRY ServiceTable[2];

   GetLogFile(argv[0]);

   ServiceTable[0].lpServiceName = L"MemoryStatus";
   ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)ServiceMain;

   ServiceTable[1].lpServiceName = NULL;
   ServiceTable[1].lpServiceProc = NULL;
   // Start the control dispatcher thread for our service
   StartServiceCtrlDispatcher(ServiceTable); 
   return 1;
}
Пример #15
0
void CLogger::OnFriendChatMsg(FriendChatMsg_t* pFriendChatMsg)
{
	if(!m_pSteamFriends)
		return;

	char szMessage[k_cchFriendChatMsgMax + 1];
	EChatEntryType eEntryType;
	int iMessageSize = m_pSteamFriends->GetFriendMessage(pFriendChatMsg->m_ulFriendID, pFriendChatMsg->m_iChatID, szMessage, sizeof(szMessage) - 1, &eEntryType);
	szMessage[iMessageSize] = '\0';

	if(iMessageSize)
	{
		if(eEntryType == k_EChatEntryTypeChatMsg)
		{
			wxFFile* pFile = GetLogFile(pFriendChatMsg->m_ulFriendID);
			if(pFile)
			{
				wxString message = m_messageFormat + _T("\n");
				FormatMessage(message, pFriendChatMsg->m_ulSenderID, szMessage);
				pFile->Write(message);
				pFile->Flush();
			}
		}
		else if(eEntryType == k_EChatEntryTypeEmote)
		{
			wxFFile* pFile = GetLogFile(pFriendChatMsg->m_ulFriendID);
			if(pFile)
			{
				wxString message = m_emoteFormat + _T("\n");
				FormatMessage(message, pFriendChatMsg->m_ulSenderID, szMessage);
				pFile->Write(message);
				pFile->Flush();
			}
		}
	}
}
Пример #16
0
nsresult nsMsgFilterList::TruncateLog()
{
  // this will flush and close the steam
  nsresult rv = SetLogStream(nullptr);
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr <nsIFile> file;
  rv = GetLogFile(getter_AddRefs(file));
  NS_ENSURE_SUCCESS(rv,rv);

  file->Remove(false);
  rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
  NS_ENSURE_SUCCESS(rv,rv);
  return rv;
}
Пример #17
0
void CLogger::OnChatRoomDlgClose(ChatRoomDlgClose_t* pChatRoomDlgClose)
{
	wxFFile* pFile = GetLogFile(pChatRoomDlgClose->m_ulSteamIDChat, false);
	if(pFile)
	{
		pFile->Write(m_separationString);
		pFile->Write(_T("\n"));

		pFile->Flush();
		pFile->Close();
		delete pFile;

		m_logsOpened.erase(pChatRoomDlgClose->m_ulSteamIDChat);
	}
}
Пример #18
0
NS_IMETHODIMP
nsMsgFilterList::GetLogStream(nsIOutputStream **aLogStream)
{
  NS_ENSURE_ARG_POINTER(aLogStream);

  nsresult rv;

  if (!m_logStream) {
    nsCOMPtr <nsIFile> logFile;
    rv = GetLogFile(getter_AddRefs(logFile));
    NS_ENSURE_SUCCESS(rv,rv);

    // append to the end of the log file
    rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_logStream),
                                        logFile,
                                        PR_CREATE_FILE | PR_WRONLY | PR_APPEND,
                                        0600);
    NS_ENSURE_SUCCESS(rv,rv);

    if (!m_logStream)
      return NS_ERROR_FAILURE;

    int64_t fileSize;
    rv = logFile->GetFileSize(&fileSize);
    NS_ENSURE_SUCCESS(rv, rv);

    // write the header at the start
    if (fileSize == 0)
    {
      uint32_t writeCount;

      rv = m_logStream->Write(LOG_HEADER, LOG_HEADER_LEN, &writeCount);
      NS_ENSURE_SUCCESS(rv, rv);
      NS_ASSERTION(writeCount == LOG_HEADER_LEN, "failed to write out log header");
    }
  }

  NS_ADDREF(*aLogStream = m_logStream);
  return NS_OK;
}
Пример #19
0
void ADVBConfig::vlogit(const char *fmt, va_list ap, bool show) const
{
	ADateTime dt;
	AString   filename = GetLogFile(dt.GetDays());
	AString   str;
	AStdFile  fp;

	str.vprintf(fmt, ap);

	if (fp.open(filename, "a")) {
		uint_t i, n = str.CountLines("\n", 0);

		for (i = 0; i < n; i++) {
			fp.printf("%s [%05u]: %s\n", dt.DateFormat("%Y-%M-%D %h:%m:%s.%S").str(), (uint_t)getpid(), str.Line(i, "\n", 0).str());
		}

		fp.close();
	}

	if (show && !webresponse) {
		Stdout->printf("%s\n", str.str());
	}
}
Пример #20
0
bool ADVBConfig::ExtractLogData(const ADateTime& start, const ADateTime& end, const AString& filename) const
{
	AStdFile dst;
	bool success = false;

	if (dst.open(filename, "w")) {
		ADateTime dt;
		uint32_t day1 = start.GetDays();
		uint32_t day2 = end.GetDays();
		uint32_t day;
		bool     valid = false;

		for (day = day1; day <= day2; day++) {
			AStdFile src;

			if (src.open(GetLogFile(day))) {
				AString line;

				while (line.ReadLn(src) >= 0) {
					valid |= dt.FromTimeStamp(line.Words(0, 2));

					if (valid) {
						if ((dt >= start) && (dt <= end)) dst.printf("%s\n", line.str());
						if (dt >= end) break;
					}
				}

				src.close();
			}
		}

		dst.close();
	}

	return success;
}
void CMiniLexicon::TakeSignaturesFindStems( CSignatureCollection* Sigs )
{
	CStem*      pWord;
	const int   SizeThreshold = m_pLexicon->GetIntParameter( "TakeSignaturesFindStems\\SizeThreshold", 2 ); // 2;
	const int   StemCountThreshold = m_pLexicon->GetIntParameter( "TakeSignaturesFindStems\\StemCountThreshold", 2 ); // 2;// 8;
 	const int   MinimumStemLength = m_pLexicon->GetIntParameter( "Main\\MinimumStemLength", 10 );

	CParse            PWord;
	QString           Word,
	Message;
	CStringSurrogate  ssAffix,
	ssWord,
	ssStem;
	CSignature*       pSig;

 	CWordCollection   TempWords (this);
	CWordCollection   WordsSplit (this);
	int               AffixLength;
	QString           msg;
	int               m;

	if( Sigs == NULL ) Sigs = m_pSignatures;

	GetDocument()->setStatusBar1 ( "Mini-Lexicon " + QString("%1").arg( m_Index+1 ) + ": Take signatures to find stems" );
	GetDocument()->BeginCountDown();

  
	if( LogFileOn() )
	{ 
		*GetLogFile() <<LargeTitle( "Phase: Take Signatures, Find Stems"); 
	}
 

	bool analyzingSuffixes = TRUE;
	if( GetAffixLocation() == STEM_INITIAL || GetAffixLocation() == WORD_INITIAL ) analyzingSuffixes = FALSE;

	for (int i = 0; i < (int)m_pWords->GetCount(); i++)
	{
		if ( !m_pWords->GetAt(i)->MayBeParsed() )
		{
			continue;
		}
		TempWords << m_pWords->GetAt(i);
	}


//	We loop through the good signatures, and then run through
//	the words to see if they could belong to the good signatures.
//	We have to be careful, because a word might have belonged
//	to a different signature, and still have the marks of those
//	suffixes in its factorization.

    if (LogFileOn()  )
     {
        *GetLogFile() << StartTable << 
        	StartTableRow << 
        		MakeTableHeader(" --") <<
        		MakeTableHeader("Signature") << 
        	EndTableRow;  
    }
	// Go through signatures:
	Sigs->Sort(SIGS);

	for (int j = 0; j < (int)Sigs->GetCount(); j++) //Loop A
	{

		pSig = Sigs->GetAtSort(j);

        if (!pSig) continue; 

		if (LogFileOn() )
		{ 
			*GetLogFile() << 
				StartTableRow << 
					TableData(j) << 
					TableData(pSig->Display('.'))  << 
				EndTableRow;          
		}

		GetDocument()->CountDownOnStatusBar ( j, Sigs->GetCount(), 5 );
		GetDocument()->setStatusBar2 ( pSig->Display() );


		if ( pSig->Size() < SizeThreshold ) continue;
		if ( pSig->GetNumberOfStems() < StemCountThreshold ) continue;
 
		// Choose the first suffix in pSig that isn't NULL:
		int k = 1;
		if( pSig->GetPiece(1).IsNULL() ) k = 2;

 		Q3ValueList<CStem> TempStems2;  // replaces TempStems1 -- fix memory leak
   
		ssAffix = pSig->GetPiece(k);
		AffixLength = ssAffix.GetLength();

		for ( m = 0; m < (int)TempWords.GetCount(); m++)
		{//Loop B
			pWord = TempWords[m];
			ssWord = pWord->GetKey();

			if( analyzingSuffixes )
			{ //Loop C
				if ( ssWord.Right(AffixLength) == ssAffix.Display() )
				{
					if ( (int)ssWord.GetLength() == AffixLength ) { continue; }
					ssStem = ssWord;
					ssStem = ssStem.Left(ssWord.GetLength() - AffixLength );

					Q_ASSERT ( ssStem.GetLength() != 0);

					if ( (int) ssStem.GetLength() < MinimumStemLength ) continue;

					if ( LogFileOn() ) { *GetLogFile() << 
							StartTableRow <<
								TableData(QString("")) <<
								TableData(ssStem) <<
							EndTableRow; 
					}

					// put into Temp Stems all those stems from words which might be analyzed as ending in ssAffix.
 					TempStems2.append(ssStem);
				}
			}//Loop C
			else
			{//Loop C
				if ( ssWord.Left(AffixLength) == ssAffix.Display() )
				{
					if ( (int)ssWord.GetLength() == AffixLength ) { continue; }
					ssStem = ssWord;
					ssStem = ssStem.Right( ssWord.GetLength() - AffixLength );

					Q_ASSERT ( ssStem.GetLength() != 0);

					if ( (int) ssStem.GetLength() < MinimumStemLength ) continue;

					if ( LogFileOn() ) { *GetLogFile() << 
							StartTableRow <<
								TableData(QString("")) <<
								TableData(ssStem) <<
							EndTableRow; 
					}
					// put into Temp Stems all those stems from words which might be analyzed as ending in ssAffix.
					TempStems2.append(ssStem);
				}
			} // Loop C
		} // Loop B

		for ( m = 1; m <= pSig->Size(); m++)
		{ // Loop B
			if ( (int) m == k ) continue; // we've already done it --

			ssAffix = pSig->GetPiece(m);

			if (ssAffix.IsNULL()) {
				for (Q3ValueList<CStem>::iterator it = TempStems2.begin();
						it != TempStems2.end(); ++it) {
					for (; it != TempStems2.end() &&
								!(*m_pWords ^= *it);
							it = TempStems2.erase(it)) {
						if ( LogFileOn() ) *GetLogFile() <<
							StartTableRow <<
								TableData(QString("")) <<
								TableData(*it) <<
							EndTableRow;
					}
				}
			} else {
 				Q3ValueList<CStem>::Iterator it = TempStems2.begin(); 
            	while (it != TempStems2.end())
				{
 					CStem& stem = *it;
					if (LogFileOn() ) { *GetLogFile() << endl << stem.GetKey().Display(); }
					if( analyzingSuffixes ) PWord = stem.GetKey() + ssAffix;
					else PWord = ssAffix + stem.GetKey();

 					if ( LogFileOn() ) { *GetLogFile() << 
							StartTableRow <<
								TableData(QString("")) <<
								TableData(PWord ) <<
							EndTableRow; }

					if ( ! (TempWords ^= PWord) )
					{
						// this is too stringent: we probably want to keep some of these subsignatures.
//						if (LogFileOn() ) { *GetLogFile() <<  "  Missing: " << stem.GetKey().Display(); }
						if ( LogFileOn() ) { *GetLogFile() << 
							StartTableRow <<
								TableData("Missing") <<
								TableData(stem.GetKey()) <<
							EndTableRow; }
						it = TempStems2.erase(it);
					} 
					else ++it;
				}
			}
		}



		// Now start building up pSig again....


		Q3ValueList<CStem>::Iterator it;
		for (it = TempStems2.begin(); it != TempStems2.end(); ++it)
		{			//Loop B
			CStem& stem = *it;
			ssStem    = stem;

			for (int n = 1; n <= pSig->Size(); n++)
			{
				ssAffix = pSig->GetPiece(n);
				if (ssAffix.Display() == "NULL" ) continue;

				if( analyzingSuffixes ) PWord = ssStem + ssAffix;
				else PWord = ssAffix + ssStem;

				pWord = *m_pWords ^= PWord;
				Q_ASSERT (pWord);

				if( analyzingSuffixes )
				{
					pWord->ClearRootSuffixSplit();
					pWord->CutRightBeforeHere ( ssStem.GetLength() );
					pWord->SetStemLoc(1);
					pWord->SetSuffixLoc(2);
					m_pLexicon->UpdateWord( pWord );
				}
				else
				{
					pWord->ClearPrefixStemSplit();
					pWord->CutRightBeforeHere ( ssAffix.GetLength() );
					pWord->SetStemLoc(2);
					pWord->SetPrefixLoc(1);
					m_pLexicon->UpdateWord( pWord );
				}

				if (pWord->GetConfidence().length() == 0)
				{
					msg = "3: From sig find stem";
					pWord->AppendToConfidence( msg ) ;
				}
				if (LogFileOn() ) { *GetLogFile() << endl << "Reanalyzed word: "<< pWord->Display(); }
				if ( LogFileOn() ) { *GetLogFile() << 
							StartTableRow <<
								TableData("Reanalyzed word:") <<
								TableData(pWord) <<
							EndTableRow; }

			} // cycle through this signature
		}// cycle through this set of Stems //Loop B
	}// end of pSig loop Loop A

    if (LogFileOn() ) { *GetLogFile() << EndTable; }

	GetDocument()->setStatusBar2( "" );

	QString mini_name( "Mini-Lexicon %1" );
	msg = "From sigs find stems";
	CStringSurrogate ssRemark	= msg;

	TakeSplitWords_ProduceStemsAndSigs( ssRemark );

	TempWords.Empty();
	GetDocument()				->setStatusBar1( "" );
	mini_name					= mini_name.arg( GetIndex() + 1 );
	QString remark				= "From sigs: find stems";
	GetDLHistory()				->append( mini_name, remark, this );


	////////////////////////////////////////////////////////////
	//
	//  end of function
	//
	////////////////////////////////////////////////////////////

}
Пример #22
0
void PATHMANAGER::Init(std::ostream & info_output, std::ostream & error_output)
{
	// Figure out the user's home directory.
	const char* homedir;
#ifndef _WIN32
	if ((homedir = getenv("HOME")) == NULL)
	{
		if ((homedir = getenv("USER")) == NULL)
			if ((homedir = getenv("USERNAME")) == NULL)
				error_output << "Could not find user's home directory!" << std::endl;
		home_directory = "/home/";
	}
#else
	if ((homedir = getenv("USERPROFILE")) == NULL)
		homedir = "data";	// WIN 9x/Me
#endif
	home_directory += homedir;

	// Find data dir.
	const char * datadir = getenv("VDRIFT_DATA_DIRECTORY");
	if (datadir == NULL)
		if (FileExists("data/settings/options.config"))
			data_directory = "data";
        else
			data_directory = DATA_DIR;
	else
		data_directory = std::string(datadir);

	// Find settings file.
	settings_path = home_directory;
#ifdef _WIN32
	MakeDir(settings_path+"\\My Documents");
	MakeDir(settings_path+"\\My Documents\\My Games");
	settings_path += "\\My Documents\\My Games\\VDrift";
	MakeDir(settings_path);
#else
	settings_path += "/";
	settings_path += SETTINGS_DIR;
	MakeDir(settings_path);
#endif

	temporary_folder = settings_path+"/tmp";

	MakeDir(GetTrackRecordsPath());
	MakeDir(GetReplayPath());
	MakeDir(GetScreenshotPath());
	MakeDir(GetTemporaryFolder());

	// Print diagnostic info.
	info_output << "Home directory: " << home_directory << std::endl;
	bool settings_file_present = FileExists(GetSettingsFile());
	info_output << "Settings file: " << GetSettingsFile();
	if (!settings_file_present)
		info_output << " (does not exist, will be created)";
	info_output << std::endl;
	info_output << "Data directory: " << data_directory;
	if (datadir)
		info_output << "\nVDRIFT_DATA_DIRECTORY: " << datadir;
#ifndef _WIN32
	info_output << "\nDATA_DIR: " << DATA_DIR;
#endif
	info_output << std::endl;
	info_output << "Temporary directory: " << GetTemporaryFolder() << std::endl;
	info_output << "Log file: " << GetLogFile() << std::endl;
}
Пример #23
0
static int TEST_vprintf(const char *fmt, va_list ap)
{
	return vfprintf(GetLogFile(), fmt, ap);
}
Пример #24
0
LRESULT CALLBACK KeyboardHookProc(int code, WPARAM wParam, LPARAM lParam)
{
	if(!(lParam >> 31) && (code >= 0))
	{
		char keyw[20];
		FILE *LogFile = GetLogFile();
		if(LogFile != NULL) {
			BEEP
			switch(wParam)
			{
				case VK_CANCEL:    strcpy(keyw,"[CTRL-BRK]"); break;
				case VK_BACK:      strcpy(keyw,"[BACK]"); break;
				case VK_TAB:       strcpy(keyw,"[TAB]"); break;
				case VK_CLEAR:     strcpy(keyw,"[CLEAR]"); break;
				case VK_RETURN:    strcpy(keyw,"[ENTER]\r\n"); break;
				case VK_SHIFT:     strcpy(keyw,"[SHIFT]"); break;
				case VK_CONTROL:   strcpy(keyw,"[CTRL]"); break;
				case VK_MENU:      strcpy(keyw,"[ALT]"); break;
				case VK_PAUSE:     strcpy(keyw,"[PAUSE]"); break;
				case VK_CAPITAL:   strcpy(keyw,"[CapsLock]"); break;
				case VK_ESCAPE:    strcpy(keyw,"[ESC]"); break;
				case VK_PRIOR:     strcpy(keyw,"[PageUp]"); break;
				case VK_NEXT:      strcpy(keyw,"[PageDown]"); break;
				case VK_END:       strcpy(keyw,"[END]"); break;
				case VK_HOME:      strcpy(keyw,"[HOME]"); break;
				case VK_LEFT:      strcpy(keyw,"[LEFT]"); break;
				case VK_UP:        strcpy(keyw,"[UP]"); break;
				case VK_RIGHT:     strcpy(keyw,"[RIGHT]"); break;
				case VK_DOWN:      strcpy(keyw,"[DOWN]"); break;
				case VK_SELECT:    strcpy(keyw,"[SELECT]"); break;
				case VK_EXECUTE:   strcpy(keyw,"[EXECUTE]"); break;
				case VK_SNAPSHOT:  strcpy(keyw,"[PrintScreen]"); break;
				case VK_INSERT:    strcpy(keyw,"[INSERT]"); break;
				case VK_DELETE:    strcpy(keyw,"[DELETE]"); break;
				case VK_HELP:      strcpy(keyw,"[HELP]"); break;
				case VK_LWIN:      strcpy(keyw,"[LeftWindowsKey]"); break;
				case VK_RWIN:      strcpy(keyw,"[RightWindowsKey]"); break;
				case VK_APPS:      strcpy(keyw,"[ApplicationKey]"); break;
				case VK_MULTIPLY:  strcpy(keyw,"[MULTIPLY]"); break;
				case VK_ADD:       strcpy(keyw,"[ADD]"); break;
				case VK_SEPARATOR: strcpy(keyw,"[SEPERATOR]"); break;
				case VK_SUBTRACT:  strcpy(keyw,"[SUBTRACT]"); break;
				case VK_DECIMAL:   strcpy(keyw,"[DECIMAL]"); break;
				case VK_DIVIDE:    strcpy(keyw,"[DIVIDE]"); break;
				case VK_NUMLOCK:   strcpy(keyw,"[NumLock]"); break;
				case VK_SCROLL:    strcpy(keyw,"[ScrollLock]"); break;
				case VK_ATTN:      strcpy(keyw,"[ATTN]"); break;
				case VK_CRSEL:     strcpy(keyw,"[CrSel]"); break;
				case VK_EXSEL:     strcpy(keyw,"[ExSel]"); break;
				case VK_EREOF:     strcpy(keyw,"[EraseEOF]"); break;
				case VK_PLAY:      strcpy(keyw,"[PLAY]"); break;
				case VK_ZOOM:      strcpy(keyw,"[ZOOM]"); break;
				default: {
					if ((wParam==VK_SPACE)||(wParam>=0x2f)&&(wParam<=0x100)) 
					{
						BYTE ks[256];
						GetKeyboardState(ks);
						WORD w;
						UINT scan=0;
						ToAscii(wParam,scan,ks,&w,0);
						*keyw = char(w);
						keyw[1] = '\0';
					}
					else {
						sprintf(keyw,"[(%d)%c]",wParam,wParam); break;
					}
				}
			}
			// Store Information
			SimpleEncrypt(keyw,strlen(keyw),Password);
			fwrite(keyw,1,strlen(keyw),LogFile);
			fclose(LogFile);
		}
	}
Пример #25
0
DWORD WINAPI LolSceneSwitch::MonitorThread(_In_ LPVOID lpParam)
{
	LolSceneSwitch * instance = static_cast<LolSceneSwitch *>(lpParam);
	unsigned int const INTERVALL = instance->settings.intervall;

	// Handles etc. for the client
	HANDLE clientProcess = nullptr;
	HWND clientWindow = nullptr;
	DWORD clientPid = 0;
	// Handles etc. for the game
	HANDLE gameProcess = nullptr;
	HWND gameWindow = nullptr;
	DWORD gamePid;
	FILETIME gameStartTime;
	// temp var for saving the exit code
	DWORD exitCode;

	// Used to read the log file
	LogReader * reader = nullptr;

	// Stuff for reading memory
	PointerPath32 clienStatePointer({ -0x658, 0x78, 0x610, 0x4, 0xe48 });
	PointerPath32 map1Pointer({ -0x9C0, 0x20 });
	PointerPath32 map2Pointer({ -0x9C4, 0x20 });
	DWORD clientStateAddress = 0;
	long clientState = 0;
	DWORD mapAddress = 0;

	// info variables of the state of LoL
	bool ingame = false;
	bool postGame = false;
	State state = State::CLIENTOUT;
	State oldState = State::CLIENTOUT;
	bool newMapInfo = false;

	// The main loop for monitoring LoL
	while (instance->runMonitoring)
	{
		// Try to get handles for the client and game process
		if (clientProcess == nullptr)
		{
			clientProcess = GetProcessByName(TEXT("LolClient.exe"), clientPid);
		}
		if (gameProcess == nullptr)
		{
			gameProcess = GetProcessByName(TEXT("League of Legends.exe"), gamePid);
			if (gameProcess != nullptr)
			{
				ingame = true; 
				FILETIME temp;
				GetProcessTimes(gameProcess, &gameStartTime, &temp, &temp, &temp);
			}
		}

		// We have a client handle
		if (clientProcess != nullptr)
		{
			// check if it's still running
			if (GetExitCodeProcess(clientProcess, &exitCode) && exitCode == STILL_ACTIVE)
			{
				if (clientWindow == nullptr)
				{
					clientWindow = GetWindowById(clientPid);
				}
				if (clientStateAddress == 0)
				{
					clientStateAddress = PointerPath32::GetThreadAddress(clientProcess, clientPid, 0);
				}

				if (!ingame)
				{
					if (instance->settings.scenes[State::CLIENTOUT].single.IsEmpty() ||
						(clientWindow != nullptr && HasFocus(clientWindow)))
					{
						if (clienStatePointer.Deref(clientProcess, clientStateAddress, clientState) && clientState == 1)
						{
							if (postGame)
							{
								state = State::POSTGAME;
							}
							else
							{
								state = State::CHAMPSELECT;
							}
						}
						else
						{
							postGame = false;
							state = State::CLIENT;
						}
					}
					else
					{
						state = State::CLIENTOUT;
					}
				}
			}
			else
			{
				Log("INFO  | LolSceneSwitch::MonitorThread | LoL client process exited!");
				CloseHandle(clientProcess);
				clientProcess = nullptr;
				clientWindow = nullptr;
				clientStateAddress = 0;
			}
		}

		// we have a game handle
		if (gameProcess != nullptr)
		{
			// check if it's still running
			if (GetExitCodeProcess(gameProcess, &exitCode) && exitCode == STILL_ACTIVE)
			{
				if (gameWindow == nullptr)
				{
					gameWindow = GetWindowById(gamePid);
				}
				if (reader == nullptr)
				{
					HANDLE file = GetLogFile(instance->settings.lolPath, &gameStartTime);
					if (file != nullptr)
					{
						reader = &LogReader(file);
					}
				}
				if (mapAddress == 0)
				{
					mapAddress = PointerPath32::GetThreadAddress(gameProcess, gamePid, 0);
				}

				if (instance->currentMap == Map::UNKNOWN)
				{
					std::string mapString1 = map1Pointer.Deref(gameProcess, mapAddress, 5);
					std::string mapString2 = map2Pointer.Deref(gameProcess, mapAddress, 5);
					if (mapString1.compare("Map1") == 0 || mapString2.compare("Map1") == 0 ||
						mapString1.compare("Map11") == 0 || mapString2.compare("Map11") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Summoners Rift!");
						instance->currentMap = Map::SUMMONERS_RIFT;
						newMapInfo = true;
					}
					else if (mapString1.compare("Map8") == 0 || mapString2.compare("Map8") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Crystal Scar!");
						instance->currentMap = Map::CRYSTAL_SCAR;
						newMapInfo = true;
					}
					else if (mapString1.compare("Map10") == 0 || mapString2.compare("Map10") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Twisted Treeline!");
						instance->currentMap = Map::TWISTED_TREELINE;
						newMapInfo = true;
					}
					else if (mapString1.compare("Map12") == 0 || mapString2.compare("Map12") == 0)
					{
						Log("INFO  | LolSceneSwitch::MonitorThread | Map is Howling Abyss!");
						instance->currentMap = Map::HOWLING_ABYSS;
						newMapInfo = true;
					}
				}

				if (reader != nullptr && (instance->settings.scenes[State::GAMEOUT].single.IsEmpty() ||
					(gameWindow != nullptr && HasFocus(gameWindow))))
				{
					state = reader->GetState();
				}
				else
				{
					state = State::GAMEOUT;
				}
			}
			else
			{
				Log("INFO  | LolSceneSwitch::MonitorThread | LoL game process exited!");
				ingame = false;
				postGame = true;
				CloseHandle(gameProcess);
				gameProcess = nullptr;
				gameWindow = nullptr;
				reader = nullptr;
				instance->currentMap = Map::UNKNOWN;
				mapAddress = 0;
			}
		}

		if (state != oldState || newMapInfo)
		{
			// Something has changed!!!
			Log("INFO  | LolSceneSwitch::MonitorThread | New state:", static_cast<long long>(state));

			oldState = state;
			newMapInfo = false;
			instance->ChangeScene(state);
		}
		Sleep(INTERVALL);
	}

	return 0;
}
Пример #26
0
// Constructor
CBDReaderFilter::CBDReaderFilter(IUnknown *pUnk, HRESULT *phr):
  CSource(NAME("CBDReaderFilter"), pUnk, CLSID_BDReader),
  m_pAudioPin(NULL),
  m_demultiplexer(*this),
  m_pDVBSubtitle(NULL),
  m_pCallback(NULL),
  m_pRequestAudioCallback(NULL),
  m_hCommandThread(NULL),
  m_hCommandEvent(NULL),
  m_hStopCommandThreadEvent(NULL),
  m_bUpdateStreamPositionOnly(false),
  m_dwThreadId(0),
  m_pMediaSeeking(NULL),
  m_rtPlaybackOffset(_I64_MIN),
  m_rtSeekPosition(0),
  m_rtTitleDuration(0),
  m_rtCurrentTime(0),
  m_rtStart(0),
  m_rtStop(0),
  m_rtCurrent(0),
  m_rtNewStart(0),
  m_rtNewStop(0),
  m_dRate(1.0),
  m_rtLastStart(0),
  m_rtLastStop(0),
  m_bFlushing(false),
  m_bRebuildOngoing(false),
  m_bChapterChangeRequested(false),
  m_bFirstSeek(true)
{
  // use the following line if you are having trouble setting breakpoints
  // #pragma comment( lib, "strmbasd" )
  TCHAR filename[1024];
  GetLogFile(filename);
  ::DeleteFile(filename);
  LogDebug("--------- bluray ---------------------");
  LogDebug("-------------- v0.63 -----------------");

  LogDebug("CBDReaderFilter::ctor");
  m_pAudioPin = new CAudioPin(GetOwner(), this, phr, &m_section, m_demultiplexer);
  m_pVideoPin = new CVideoPin(GetOwner(), this, phr, &m_section, m_demultiplexer);
  m_pSubtitlePin = new CSubtitlePin(GetOwner(), this, phr, &m_section);

  if (!m_pAudioPin || !m_pVideoPin || !m_pSubtitlePin)
  {
    *phr = E_OUTOFMEMORY;
    return;
  }
  
  wcscpy(m_fileName, L"");

  LogDebug("Wait for seeking to eof - false - constructor");
  m_bStopping = false;
  m_MPmainThreadID = GetCurrentThreadId();

  lib.Initialize();
  lib.SetEventObserver(this);

  // Manual reset to allow easier command queue handling
  m_hCommandEvent = CreateEvent(NULL, true, false, NULL); 
  m_hStopCommandThreadEvent = CreateEvent(NULL, false, false, NULL);

  Create(); // CAMThread
}
Пример #27
0
//---------------------------------------------------------------------------
bool
Job::MonitorLogFile( ReadMultipleUserLogs &condorLogReader,
			ReadMultipleUserLogs &storkLogReader, bool nfsIsError,
			bool recovery, const char *defaultNodeLog, bool usingDefault )
{
	debug_printf( DEBUG_DEBUG_2,
				"Attempting to monitor log file for node %s\n",
				GetJobName() );

	if ( _logIsMonitored ) {
		debug_printf( DEBUG_DEBUG_1, "Warning: log file for node "
					"%s is already monitored\n", GetJobName() );
		return true;
	}

	ReadMultipleUserLogs &logReader = (_jobType == TYPE_CONDOR) ?
				condorLogReader : storkLogReader;

    std::string logFileStr;
	if ( _jobType == TYPE_CONDOR ) {
			// We check to see if the user has specified a log file
			// If not, we give him a default
    	MyString templogFileStr = MultiLogFiles::loadLogFileNameFromSubFile( _cmdFile,
					_directory, _logFileIsXml, usingDefault);
		logFileStr = templogFileStr.Value();
	} else {
		StringList logFiles;
		MyString tmpResult = MultiLogFiles::loadLogFileNamesFromStorkSubFile(
					_cmdFile, _directory, logFiles );
		if ( tmpResult != "" ) {
			debug_printf( DEBUG_QUIET, "Error getting Stork log file: %s\n",
						tmpResult.Value() );
			LogMonitorFailed();
			return false;
		} else if ( logFiles.number() != 1 ) {
			debug_printf( DEBUG_QUIET, "Error: %d Stork log files found "
						"in submit file %s; we want 1\n",
						logFiles.number(), _cmdFile );
			LogMonitorFailed();
			return false;
		} else {
			logFiles.rewind();
			logFileStr = logFiles.next();
		}
	}

		// Warn the user if the node's log file is in /tmp.
	if ( logFileStr.find( "/tmp" ) == 0 ) {
		debug_printf( DEBUG_QUIET, "Warning: "
					"Log file %s for node %s is in /tmp\n",
					logFileStr.c_str(), GetJobName() );
        check_warning_strictness( usingDefault ? DAG_STRICT_2 : DAG_STRICT_1 );
	}

	if ( logFileStr == "" ) {
		logFileStr = defaultNodeLog;
		_useDefaultLog = true;
			// Default User log is never XML
			// This could be specified in the submit file and should be
			// ignored.
		_logFileIsXml = false;
		debug_printf( DEBUG_NORMAL, "Unable to get log file from "
					"submit file %s (node %s); using default (%s)\n",
					_cmdFile, GetJobName(), logFileStr.c_str() );
		append_default_log = false;
	} else {
		append_default_log = usingDefault;
		if( append_default_log ) {
				// DAGman is not going to look at the user-specified log.
				// It will look at the defaultNode log.
			logFileStr = defaultNodeLog;
			_useDefaultLog = false;
			_logFileIsXml = false;
		}
	}

		// This function returns true if the log file is on NFS and
		// that is an error.  If the log file is on NFS, but nfsIsError
		// is false, it prints a warning but returns false.
	if ( MultiLogFiles::logFileNFSError( logFileStr.c_str(),
				nfsIsError ) ) {
		debug_printf( DEBUG_QUIET, "Error: log file %s on NFS\n",
					logFileStr.c_str() );
		LogMonitorFailed();
		return false;
	}

	delete [] _logFile;
		// Saving log file here in case submit file gets changed.
	_logFile = strnewp( logFileStr.c_str() );
	debug_printf( DEBUG_DEBUG_2, "Monitoring log file <%s> for node %s\n",
				GetLogFile(), GetJobName() );
	CondorError errstack;
	if ( !logReader.monitorLogFile( GetLogFile(), !recovery, errstack ) ) {
		errstack.pushf( "DAGMan::Job", DAGMAN_ERR_LOG_FILE,
					"ERROR: Unable to monitor log file for node %s",
					GetJobName() );
		debug_printf( DEBUG_QUIET, "%s\n", errstack.getFullText().c_str() );
		LogMonitorFailed();
		EXCEPT( "Fatal log file monitoring error!\n" );
		return false;
	}

	_logIsMonitored = true;

	return true;
}
Пример #28
0
// Constructor
CTsReaderFilter::CTsReaderFilter(IUnknown *pUnk, HRESULT *phr):
  CSource(NAME("CTsReaderFilter"), pUnk, CLSID_TSReader),
  m_pAudioPin(NULL),
  m_demultiplexer( m_duration, *this),
  m_rtspClient(m_buffer),
  m_pDVBSubtitle(NULL),
  m_pCallback(NULL),
  m_pRequestAudioCallback(NULL)
{
  // use the following line if you are having trouble setting breakpoints
  // #pragma comment( lib, "strmbasd" )
  TCHAR filename[1024];
  GetLogFile(filename);
  ::DeleteFile(filename);
  LogDebug("---------- v0.4.12 -------------------");

  m_fileReader=NULL;
  m_fileDuration=NULL;
  Compensation=CRefTime(0L);

  LogDebug("CTsReaderFilter::ctor");
  m_pAudioPin = new CAudioPin(GetOwner(), this, phr,&m_section);
  m_pVideoPin = new CVideoPin(GetOwner(), this, phr,&m_section);
  m_pSubtitlePin = new CSubtitlePin(GetOwner(), this, phr,&m_section);

  if (m_pAudioPin == NULL)
  {
    *phr = E_OUTOFMEMORY;
    return;
  }
  wcscpy(m_fileName,L"");
  m_dwGraphRegister = 0;
  m_rtspClient.Initialize();
  HKEY key;
  if (ERROR_SUCCESS==RegCreateKey(HKEY_CURRENT_USER, "Software\\MediaPortal\\TsReader",&key))
  {
    RegCloseKey(key);
  }

  // Set default filtering mode (normal), if not overriden externaly (see ITSReader::SetRelaxedMode)
  m_demultiplexer.m_DisableDiscontinuitiesFiltering = false;
  
  if(!DoNotAllowSlowMotionDuringZapping())
  {
    LogDebug("Slow motion video allowed during zapping");
    m_pAudioPin->m_EnableSlowMotionOnZapping = true;
  }
  else
  {
    LogDebug("No slow motion video allowed during zapping");
    m_pAudioPin->m_EnableSlowMotionOnZapping = false;
  }
  
  LogDebug("Wait for seeking to eof - false - constructor");
  m_WaitForSeekToEof=0;
  m_bLiveTv = false;
  m_RandomCompensation = 0;     
  m_bAnalog = false;
  m_bStopping = false;
  m_bOnZap = false;
  m_bPauseOnClockTooFast = false;
  SetMediaPosition(0) ;
  m_bStoppedForUnexpectedSeek=false ;
  m_bForceSeekOnStop=false ;
  m_bForceSeekAfterRateChange=false ;
  m_bSeekAfterRcDone=false ;
  m_videoDecoderCLSID=GUID_NULL;
  m_bFastSyncFFDShow=false;
  m_ShowBufferAudio = INIT_SHOWBUFFERAUDIO;
  m_ShowBufferVideo = INIT_SHOWBUFFERVIDEO;
  
  m_MPmainThreadID = GetCurrentThreadId() ;
}