예제 #1
0
void DeleteFolder(CString dir)
{
	if(FileIsDirectory(dir))
	{
		//SHFILEOPSTRUCT   Op;
		//ZeroMemory(&Op,   sizeof(Op));   //删除文件夹
		//Op.hwnd   =   NULL; 
		//Op.wFunc   =   FO_DELETE;
		//Op.pFrom   =   dir;
		//Op.fFlags   =   FOF_ALLOWUNDO   |   FOF_NOCONFIRMATION;     
		//SHFileOperation(&Op);

		CFindFile   tempFind;
		CString   tempFileFind;
		tempFileFind.Format(_T("%s\\*.*"),dir);
		BOOL   IsFinded   =   tempFind.FindFile(tempFileFind);
		while   (IsFinded)
		{
			IsFinded   =   tempFind.FindNextFile();
			if(!tempFind.IsDots())
			{
				if(tempFind.IsDirectory())
					DeleteFolder(tempFind.GetFilePath());
				else
					DeleteFile(tempFind.GetFilePath());
			}
		}
		tempFind.Close();
		RemoveDirectory(dir);
	}
}
예제 #2
0
bool CClientApp::EnumAllFiles(string sFolder)
{
	if ( sFolder.length() == 0 )
		return false;

	bool bRet = false;
	CFindFile fFind;
	string sFindStr = sFolder + "\\*.*";
	BOOL bFind = fFind.FindFile( sFindStr.c_str() );
	while ( bFind )
	{
		bRet = true;

		if ( fFind.IsDirectory() )
		{
			if ( !fFind.IsDots() )
			{
				if ( !EnumAllFiles( fFind.GetFilePath().GetBuffer(0) ) )
				{
					bRet = false;
					break;
				}
			}
		}
		else
		{
			CMediaFile* pMediaFile = new CMediaFile();
			if ( pMediaFile )
			{
				if ( pMediaFile->InitFile( fFind.GetFilePath().GetBuffer(0), fFind.GetFileName().GetBuffer(0) ) )
				{
					pMediaFile->m_sNodeName = "Kevin_Test_Node_Name";
					m_MediaFileMgr.Insert( pMediaFile->m_sFileHash, pMediaFile );
					// 查找到立即发布
					PublishFiles();
				}
				else
				{
					delete pMediaFile;
					CKLog::WriteLog( LOG_TYPE_DEBUG, "%s InitFile Failed.", fFind.GetFilePath() );
					WriteLog( LOG_TYPE_DEBUG, "%s InitFile Failed.", fFind.GetFilePath() );
				}
			}
		}

		bFind = fFind.FindNextFile();
	}
	fFind.Close();

	return bRet;
}
예제 #3
0
//=============================================================================
// 函数名称:	移动覆盖一个指定的目录
// 作者说明:	mushuai
// 修改时间:	2013-03-14
//=============================================================================
int ConvertPath(LPCTSTR srcpath,LPCTSTR targpath)
{
	int iresult = 1;
	CFindFile finder;
	if(finder.FindFile(srcpath))
	{
		CString fileName,filePath;
		do
		{
			fileName=finder.GetFileName();
			filePath = finder.GetFilePath();
			//. ..
			if (finder.IsDots())
			{
				continue;
			}
			//dir
			else if (finder.IsDirectory())
			{
				CString tTargPath = targpath;
				tTargPath +=_T("\\")+fileName;
				ConvertPath(filePath+_T("\\*"),tTargPath);
				RemoveDirectory(filePath);
			}
			else//file
			{
				CString newFilePath = targpath;
				newFilePath +=_T("\\")+fileName;					
				if (!PathFileExists(targpath))
				{
					if(ERROR_SUCCESS != SHCreateDirectoryEx(0,targpath,0))
					{
						return 0;
					}
				}
				BOOL res=MoveFileEx(filePath,newFilePath,MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
				if (!res)
				{
					SetFileAttributes(newFilePath,FILE_ATTRIBUTE_NORMAL);
					if (!DeleteFile(newFilePath))
					{
						MoveFileEx(filePath,newFilePath,MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
					}
				}
			}
		}while (finder.FindNextFile());
	}
	finder.Close();
	return iresult;
}
예제 #4
0
int CPhotoEngine::_PopulateList(LPCTSTR szPath)
{
	const int count = 0;
	BOOL bRes;
	CFindFile ff;
	CString sPattern;
	sPattern.Format(_T("%s\\*.jpg"), szPath);
	for( bRes = ff.FindFile(sPattern); bRes; bRes = ff.FindNextFile() )
	{
		if( ff.IsDirectory() ) continue;
		AddImageFile(ff.GetFilePath(), ff.GetFileName());
	}

	return 0;
}
예제 #5
0
bool UtilPathExpandWild(std::list<CString> &r_outList,const CString &r_inParam)
{
	std::list<CString> tempList;
	if(-1==r_inParam.FindOneOf(_T("*?"))){	//ワイルド展開可能な文字はない
		tempList.push_back(r_inParam);
	}else{
		//ワイルド展開
		CFindFile cFindFile;
		BOOL bContinue=cFindFile.FindFile(r_inParam);
		while(bContinue){
			if(!cFindFile.IsDots()){
				tempList.push_back(cFindFile.GetFilePath());
			}
			bContinue=cFindFile.FindNextFile();
		}
	}
	r_outList=tempList;
	return true;
}
예제 #6
0
//フォルダ内ファイル(ディレクトリは除く)を再帰検索
bool UtilRecursiveEnumFile(LPCTSTR lpszRoot,std::list<CString> &rFileList)
{
	CFindFile cFindFile;
	TCHAR szPath[_MAX_PATH+1];
	_tcsncpy_s(szPath,lpszRoot,_MAX_PATH);
	PathAppend(szPath,_T("*"));

	BOOL bContinue=cFindFile.FindFile(szPath);
	while(bContinue){
		if(!cFindFile.IsDots()){
			if(cFindFile.IsDirectory()){
				UtilRecursiveEnumFile(cFindFile.GetFilePath(),rFileList);
			}else{
				rFileList.push_back(cFindFile.GetFilePath());
			}
		}
		bContinue=cFindFile.FindNextFile();
	}

	return !rFileList.empty();
}
예제 #7
0
void MenuCommand_MakeSendToCommands()
{
	TCHAR szSendTo[_MAX_PATH];
	std::vector<CString> files;
	if(SHGetSpecialFolderPath(NULL,szSendTo,CSIDL_SENDTO,FALSE)){
		PathAddBackslash(szSendTo);
		PathAppend(szSendTo,_T("*.lnk"));
		CFindFile cFind;

		BOOL bFound=cFind.FindFile(szSendTo);
		for(;bFound;bFound=cFind.FindNextFile()){
			if(cFind.IsDots())continue;

			if(!cFind.IsDirectory()){	//サブディレクトリ検索はしない
				files.push_back(cFind.GetFilePath());
			}
		}
	}

	UtilGetShortcutInfo(files,s_SendToCmd);
}
예제 #8
0
//ワイルドカードの展開
bool UtilPathExpandWild(std::list<CString> &r_outList,const std::list<CString> &r_inList)
{
	std::list<CString> tempList;
	std::list<CString>::const_iterator ite=r_inList.begin();
	const std::list<CString>::const_iterator end=r_inList.end();
	for(;ite!=end;++ite){
		if(-1==(*ite).FindOneOf(_T("*?"))){	//ワイルド展開可能な文字はない
			tempList.push_back(*ite);
		}else{
			//ワイルド展開
			CFindFile cFindFile;
			BOOL bContinue=cFindFile.FindFile(*ite);
			while(bContinue){
				if(!cFindFile.IsDots()){
					tempList.push_back(cFindFile.GetFilePath());
				}
				bContinue=cFindFile.FindNextFile();
			}
		}
	}
	r_outList=tempList;
	return true;
}
예제 #9
0
int CCrashInfoReader::Init(LPCTSTR szFileMappingName)
{ 
	// This method unpacks crash information from a shared memory (file-mapping)
	// and inits the internal variables.

	strconv_t strconv;
    CErrorReportInfo eri;

	// Init shared memory
	if(!m_SharedMem.IsInitialized())
	{
		// Init shared memory
		BOOL bInitMem = m_SharedMem.Init(szFileMappingName, TRUE, 0);
		if(!bInitMem)
		{
			m_sErrorMsg = _T("Error initializing shared memory.");
			return 1;
		}
	}

	// Unpack crash description from shared memory
    m_pCrashDesc = (CRASH_DESCRIPTION*)m_SharedMem.CreateView(0, sizeof(CRASH_DESCRIPTION));

    int nUnpack = UnpackCrashDescription(eri);
    if(0!=nUnpack)
    {
		m_sErrorMsg = _T("Error unpacking crash description.");
        return 2;
    }
	
	// Create LOCAL_APP_DATA\UnsentCrashReports folder (if doesn't exist yet).
    BOOL bCreateFolder = Utility::CreateFolder(m_sUnsentCrashReportsFolder);
    if(!bCreateFolder)
        return 3;

	// Save path to INI file storing settings
    m_sINIFile = m_sUnsentCrashReportsFolder + _T("\\~CrashRpt.ini");          

    if(!m_bSendRecentReports) // We should send report immediately
    { 
        CollectMiscCrashInfo(eri);

        eri.m_sErrorReportDirName = m_sUnsentCrashReportsFolder + _T("\\") + eri.m_sCrashGUID;
        Utility::CreateFolder(eri.m_sErrorReportDirName);		

        m_Reports.push_back(eri);
    }  
    else // We should look for pending error reports
    {
        // Unblock the parent process
        CString sEventName;
        sEventName.Format(_T("Local\\CrashRptEvent_%s"), eri.m_sCrashGUID);
        HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, sEventName);
        if(hEvent!=NULL)
            SetEvent(hEvent);

        // Look for pending error reports and add them to the list
        CString sSearchPattern = m_sUnsentCrashReportsFolder + _T("\\*");
        CFindFile find;
        BOOL bFound = find.FindFile(sSearchPattern);
        while(bFound)
        {
            if(find.IsDirectory() && !find.IsDots()) // Process directories only
            {
                CString sErrorReportDirName = m_sUnsentCrashReportsFolder + _T("\\") + 
                    find.GetFileName();
                CString sFileName = sErrorReportDirName + _T("\\crashrpt.xml");
                CErrorReportInfo eri2;
                eri2.m_sErrorReportDirName = sErrorReportDirName;
				// Read crash description XML from the directory
                if(0==ParseCrashDescription(sFileName, TRUE, eri2))
                {          
					// Calculate crash report size
                    eri2.m_uTotalSize = GetUncompressedReportSize(eri2);
					// Add report to the list
                    m_Reports.push_back(eri2);
                }
            }

            bFound = find.FindNextFile();
        }
    }

	// Done
    return 0;
}
예제 #10
0
int CCrashInfoReader::Init(CString sCrashInfoFileName)
{ 
  strconv_t strconv;
  ErrorReportInfo eri;
  
  TiXmlDocument doc;
  bool bOpen = doc.LoadFile(strconv.t2a(sCrashInfoFileName));
  if(!bOpen)
    return 1;

  TiXmlHandle hRoot = doc.FirstChild("CrashRptInternal");
  if(hRoot.ToElement()==NULL)
    return 1;

  {    
    TiXmlHandle hUnsentCrashReportsFolder = hRoot.FirstChild("UnsentCrashReportsFolder");
    if(hUnsentCrashReportsFolder.FirstChild().ToText()!=NULL)
    {      
      const char* szUnsentCrashReportsFolder = hUnsentCrashReportsFolder.FirstChild().ToText()->Value();
      if(szUnsentCrashReportsFolder!=NULL)
      {
        m_sUnsentCrashReportsFolder = strconv.utf82t(szUnsentCrashReportsFolder);
        Utility::CreateFolder(m_sUnsentCrashReportsFolder);
        
        m_sINIFile = m_sUnsentCrashReportsFolder + _T("\\~CrashRpt.ini");        
      }
    }
  }  
  
  {
    TiXmlHandle hReportFolder = hRoot.FirstChild("ReportFolder");
    if(hReportFolder.FirstChild().ToText()!=NULL)
    {
      const char* szReportFolder = hReportFolder.FirstChild().ToText()->Value();
      if(szReportFolder!=NULL)
        eri.m_sErrorReportDirName = strconv.utf82t(szReportFolder);
    }
  }

  {
    m_bQueueEnabled = FALSE;
    TiXmlHandle hQueueEnabled = hRoot.FirstChild("QueueEnabled");
    if(hQueueEnabled.FirstChild().ToText()!=NULL)
    {      
      const char* szQueueEnabled = hQueueEnabled.FirstChild().ToText()->Value();
      if(szQueueEnabled!=NULL)
      {
        m_bQueueEnabled = atoi(szQueueEnabled);        
      }
    }
  }  

  {
    m_bSendRecentReports = FALSE;
    TiXmlHandle hSendRecentReports = hRoot.FirstChild("SendRecentReports");
    if(hSendRecentReports.FirstChild().ToText()!=NULL)
    {      
      const char* szSendRecentReports = hSendRecentReports.FirstChild().ToText()->Value();
      if(szSendRecentReports!=NULL)
      {
        m_bSendRecentReports = atoi(szSendRecentReports);        
      }
    }
  }  


  {
    TiXmlHandle hCrashGUID = hRoot.FirstChild("CrashGUID");
    if(hCrashGUID.FirstChild().ToText()!=NULL)
    {
      const char* szCrashGUID = hCrashGUID.FirstChild().ToText()->Value();
      if(szCrashGUID!=NULL)
        eri.m_sCrashGUID = strconv.utf82t(szCrashGUID);
    }
  }

  {
    TiXmlHandle hAppName = hRoot.FirstChild("AppName");
    if(hAppName.FirstChild().ToText()!=NULL)
    {
      const char* szAppName = hAppName.FirstChild().ToText()->Value();
      if(szAppName!=NULL)
        m_sAppName = strconv.utf82t(szAppName);
    }
  }

  {
    TiXmlHandle hLangFileName = hRoot.FirstChild("LangFileName");
    if(hLangFileName.FirstChild().ToText()!=NULL)
    {
      const char* szLangFileName = hLangFileName.FirstChild().ToText()->Value();
      if(szLangFileName!=NULL)
        m_sLangFileName = strconv.utf82t(szLangFileName);
    }
  }

  {
    TiXmlHandle hDbgHelpPath = hRoot.FirstChild("DbgHelpPath");
    if(hDbgHelpPath.FirstChild().ToText()!=NULL)
    {
      const char* szDbgHelpPath = hDbgHelpPath.FirstChild().ToText()->Value();
      if(szDbgHelpPath!=NULL)
        m_sDbgHelpPath = strconv.utf82t(szDbgHelpPath);
    }
  }

  {
    m_bGenerateMinidump = TRUE;
    TiXmlHandle hGenerateMinidump = hRoot.FirstChild("GenerateMinidump");
    if(hGenerateMinidump.FirstChild().ToText()!=NULL)
    {
      const char* szGenerateMinidump = hGenerateMinidump.FirstChild().ToText()->Value();
      if(szGenerateMinidump!=NULL)
        m_bGenerateMinidump = (MINIDUMP_TYPE)atol(szGenerateMinidump);      
    }    
  }

  {
    TiXmlHandle hMinidumpType = hRoot.FirstChild("MinidumpType");
    if(hMinidumpType.FirstChild().ToText()!=NULL)
    {
      const char* szMinidumpType = hMinidumpType.FirstChild().ToText()->Value();
      if(szMinidumpType!=NULL)
        m_MinidumpType = (MINIDUMP_TYPE)atol(szMinidumpType);
      else
        m_MinidumpType = MiniDumpNormal;
    }
    else
      m_MinidumpType = MiniDumpNormal;
  }

  {
    TiXmlHandle hUrl = hRoot.FirstChild("Url");
    if(hUrl.FirstChild().ToText()!=NULL)
    {
      const char* szUrl = hUrl.FirstChild().ToText()->Value();
      if(szUrl!=NULL)
        m_sUrl = strconv.utf82t(szUrl);
    }
  }

  {
    TiXmlHandle hEmailTo = hRoot.FirstChild("EmailTo");
    if(hEmailTo.FirstChild().ToText()!=NULL)
    {
      const char* szEmailTo = hEmailTo.FirstChild().ToText()->Value();
      if(szEmailTo!=NULL)
        m_sEmailTo = strconv.utf82t(szEmailTo);
    }
  }

  {
    m_nSmtpPort = 25;
    TiXmlHandle hSmtpPort = hRoot.FirstChild("SmtpPort");
    if(hSmtpPort.FirstChild().ToText()!=NULL)
    {
      const char* szSmtpPort = hSmtpPort.FirstChild().ToText()->Value();
      if(szSmtpPort!=NULL)
        m_nSmtpPort = atoi(szSmtpPort);
    }
  }

  {
    TiXmlHandle hEmailSubject = hRoot.FirstChild("EmailSubject");
    if(hEmailSubject.FirstChild().ToText()!=NULL)
    {
      const char* szEmailSubject = hEmailSubject.FirstChild().ToText()->Value();
      if(szEmailSubject!=NULL)
        m_sEmailSubject = strconv.utf82t(szEmailSubject);
    }
  }

  {
    TiXmlHandle hEmailText = hRoot.FirstChild("EmailText");
    if(hEmailText.FirstChild().ToText()!=NULL)
    {
      const char* szEmailText = hEmailText.FirstChild().ToText()->Value();
      if(szEmailText!=NULL)
        m_sEmailText = strconv.utf82t(szEmailText);
    }
  }

  {
    TiXmlHandle hPrivacyPolicyUrl = hRoot.FirstChild("PrivacyPolicyUrl");    
    if(hPrivacyPolicyUrl.FirstChild().ToText()!=NULL)
    {
      const char* szPrivacyPolicyUrl = hPrivacyPolicyUrl.FirstChild().ToText()->Value();
      if(szPrivacyPolicyUrl!=NULL)
        m_sPrivacyPolicyURL = strconv.utf82t(szPrivacyPolicyUrl);
    }
  }

  {
    TiXmlHandle hHttpPriority = hRoot.FirstChild("HttpPriority");
    if(hHttpPriority.FirstChild().ToText()!=NULL)
    {
      const char* szHttpPriority = hHttpPriority.FirstChild().ToText()->Value();
      if(szHttpPriority!=NULL)
        m_uPriorities[CR_HTTP] = atoi(szHttpPriority);
      else
        m_uPriorities[CR_HTTP] = 0;
    }
  }

  {
    TiXmlHandle hSmtpPriority = hRoot.FirstChild("SmtpPriority");
    if(hSmtpPriority.FirstChild().ToText()!=NULL)
    {
      const char* szSmtpPriority = hSmtpPriority.FirstChild().ToText()->Value();
      if(szSmtpPriority!=NULL)
        m_uPriorities[CR_SMTP] = atoi(szSmtpPriority);
      else
        m_uPriorities[CR_SMTP] = 0;
    }
  }

  {
    TiXmlHandle hMapiPriority = hRoot.FirstChild("MapiPriority");
    if(hMapiPriority.FirstChild().ToText()!=NULL)
    {
      const char* szMapiPriority = hMapiPriority.FirstChild().ToText()->Value();
      if(szMapiPriority!=NULL)
        m_uPriorities[CR_SMAPI] = atoi(szMapiPriority);
      else
        m_uPriorities[CR_SMAPI] = 0;
    }
  }

  {
    TiXmlHandle hProcessId = hRoot.FirstChild("ProcessId");
    if(hProcessId.FirstChild().ToText()!=NULL)
    {
      const char* szProcessId = hProcessId.FirstChild().ToText()->Value();
      if(szProcessId!=NULL)
        m_dwProcessId = strtoul(szProcessId, NULL, 10);
      else
        m_dwProcessId = 0;
    }
  }

  {
    TiXmlHandle hThreadId = hRoot.FirstChild("ThreadId");
    if(hThreadId.FirstChild().ToText()!=NULL)
    {
      const char* szThreadId = hThreadId.FirstChild().ToText()->Value();
      if(szThreadId!=NULL)
        m_dwThreadId = strtoul(szThreadId, NULL, 10);
      else 
        m_dwThreadId = 0;
    }
  }

  {
    m_pExInfo = NULL;
    TiXmlHandle hExceptionPointersAddress = hRoot.FirstChild("ExceptionPointersAddress");
    if(hExceptionPointersAddress.FirstChild().ToText()!=NULL)
    {
      const char* szExceptionPointersAddress = hExceptionPointersAddress.FirstChild().ToText()->Value();
      if(szExceptionPointersAddress!=NULL)
        m_pExInfo = (PEXCEPTION_POINTERS)_strtoui64(szExceptionPointersAddress, NULL, 16);     
    }    
  }

  {
    TiXmlHandle hAddScreenshot = hRoot.FirstChild("AddScreenshot");
    if(hAddScreenshot.FirstChild().ToText()!=NULL)
    {
      const char* szAddScreenshot = hAddScreenshot.FirstChild().ToText()->Value();
      if(szAddScreenshot!=NULL)
        m_bAddScreenshot = strtol(szAddScreenshot, NULL, 10);
      else
        m_bAddScreenshot = FALSE;
    }
  }

  {
    m_dwScreenshotFlags = 0;
    TiXmlHandle hScreenshotFlags = hRoot.FirstChild("ScreenshotFlags");
    if(hScreenshotFlags.FirstChild().ToText()!=NULL)
    {
      const char* szScreenshotFlags = hScreenshotFlags.FirstChild().ToText()->Value();
      if(szScreenshotFlags!=NULL)
        m_dwScreenshotFlags = strtoul(szScreenshotFlags, NULL, 10);        
    }
  }

  {
    m_ptCursorPos.SetPoint(0, 0);
    TiXmlHandle hCursorPos = hRoot.FirstChild("CursorPos");
    if(hCursorPos.ToElement()!=NULL)
    {
      const char* szX = hCursorPos.ToElement()->Attribute("x");
      const char* szY = hCursorPos.ToElement()->Attribute("y");
      if(szX && szY)
      {
        m_ptCursorPos.x = atoi(szX);
        m_ptCursorPos.y = atoi(szY);
      }
    }
  }

  {
    m_rcAppWnd.SetRectEmpty();
    TiXmlHandle hAppWndRect = hRoot.FirstChild("AppWindowRect");
    if(hAppWndRect.ToElement()!=NULL)
    {
      const char* szLeft = hAppWndRect.ToElement()->Attribute("left");
      const char* szTop = hAppWndRect.ToElement()->Attribute("top");
      const char* szRight = hAppWndRect.ToElement()->Attribute("right");
      const char* szBottom = hAppWndRect.ToElement()->Attribute("bottom");

      if(szLeft && szTop && szRight && szBottom)
      {
        m_rcAppWnd.left = atoi(szLeft);
        m_rcAppWnd.top = atoi(szTop);
        m_rcAppWnd.right = atoi(szRight);
        m_rcAppWnd.bottom = atoi(szBottom);
      }
    }
  }

  {
    m_bHttpBinaryEncoding = FALSE;    
    TiXmlHandle hHttpBinaryEncoding = hRoot.FirstChild("HttpBinaryEncoding");
    if(hHttpBinaryEncoding.FirstChild().ToText()!=NULL)
    {
      const char* szHttpBinaryEncoding = hHttpBinaryEncoding.FirstChild().ToText()->Value();
      if(szHttpBinaryEncoding!=NULL)
        m_bHttpBinaryEncoding = atoi(szHttpBinaryEncoding);
    }      
  }

  {
    m_bSilentMode = FALSE;    
    TiXmlHandle hSilentMode = hRoot.FirstChild("SilentMode");
    if(hSilentMode.FirstChild().ToText()!=NULL)
    {
      const char* szSilentMode = hSilentMode.FirstChild().ToText()->Value();
      if(szSilentMode!=NULL)
        m_bSilentMode = atoi(szSilentMode);
    }      
  }

  {
    m_bSendErrorReport = FALSE;    
    TiXmlHandle hSendErrorReport = hRoot.FirstChild("SendErrorReport");
    if(hSendErrorReport.FirstChild().ToText()!=NULL)
    {
      const char* szSendErrorReport = hSendErrorReport.FirstChild().ToText()->Value();
      if(szSendErrorReport!=NULL)
        m_bSendErrorReport = atoi(szSendErrorReport);     
    }      
  }

  {
    m_bAppRestart = FALSE;    
    TiXmlHandle hAppRestart = hRoot.FirstChild("AppRestart");
    if(hAppRestart.FirstChild().ToText()!=NULL)
    {
      const char* szAppRestart = hAppRestart.FirstChild().ToText()->Value();
      if(szAppRestart!=NULL)
        m_bAppRestart = atoi(szAppRestart);     
    }      
  }

  {    
    TiXmlHandle hRestartCmdLine = hRoot.FirstChild("RestartCmdLine");
    if(hRestartCmdLine.FirstChild().ToText()!=NULL)
    {
      const char* szRestartCmdLine = hRestartCmdLine.FirstChild().ToText()->Value();
      if(szRestartCmdLine!=NULL)
        m_sRestartCmdLine = strconv.utf82t(szRestartCmdLine);     
    }      
  }

  {    
    TiXmlHandle hSmtpProxyServer = hRoot.FirstChild("SmtpProxyServer");
    if(hSmtpProxyServer.FirstChild().ToText()!=NULL)
    {
      const char* szSmtpProxyServer = hSmtpProxyServer.FirstChild().ToText()->Value();
      if(szSmtpProxyServer!=NULL)
        m_sSmtpProxyServer = strconv.utf82t(szSmtpProxyServer);     
    }      
  }

  {    
    m_nSmtpProxyPort = 25;
    TiXmlHandle hSmtpProxyPort = hRoot.FirstChild("SmtpProxyPort");
    if(hSmtpProxyPort.FirstChild().ToText()!=NULL)
    {
      const char* szSmtpProxyPort = hSmtpProxyPort.FirstChild().ToText()->Value();
      if(szSmtpProxyPort!=NULL)
        m_nSmtpProxyPort = atoi(szSmtpProxyPort);     
    }      
  }

  if(!m_bSendRecentReports)
  {    
    // Get the list of files that should be included to report
    ParseFileList(hRoot, eri);

    // Get some info from crashrpt.xml
    CString sXmlName = eri.m_sErrorReportDirName + _T("\\crashrpt.xml");
    ParseCrashDescription(sXmlName, FALSE, eri);    
    
    m_Reports.push_back(eri);
  }  
  else
  {
    // Look for unsent error reports
    CString sSearchPattern = m_sUnsentCrashReportsFolder + _T("\\*");
    CFindFile find;
    BOOL bFound = find.FindFile(sSearchPattern);
    while(bFound)
    {
      if(find.IsDirectory() && !find.IsDots())
      {
        CString sErrorReportDirName = m_sUnsentCrashReportsFolder + _T("\\") + 
          find.GetFileName();
        CString sFileName = sErrorReportDirName + _T("\\crashrpt.xml");
        ErrorReportInfo eri;
        eri.m_sErrorReportDirName = sErrorReportDirName;
        if(0==ParseCrashDescription(sFileName, TRUE, eri))
        {          
          eri.m_uTotalSize = GetUncompressedReportSize(eri);
          m_Reports.push_back(eri);
        }
      }

      bFound = find.FindNextFile();
    }
  }
  
  return 0;
}
예제 #11
0
	BOOL ShowApplet(HWND hWnd, LONG_PTR /*lData*/, LPCTSTR pstrCommand)
	{
		BOOL bWithFingerMenu = FALSE;
		CString szPath;
		CString szProgramFilesFolder;
		WCHAR szInstallDir[MAX_PATH];
		WCHAR szValue[MAX_PATH];
		ZeroMemory(szValue, sizeof(szValue));
		if (SHGetSpecialFolderPath(NULL, szValue, CSIDL_PROGRAM_FILES, FALSE))
		{
			szProgramFilesFolder.Format(L"%s", szValue);
		}
		if (RegistryGetString(HKEY_LOCAL_MACHINE, L"Software\\FingerMenu", L"InstallDir", szInstallDir, MAX_PATH) == S_OK)
		{
			szPath.Format(L"%s\\FingerMenu.exe", szInstallDir);
		}
		else
		{
			szPath = szProgramFilesFolder + L"\\FingerMenu\\FingerMenu.exe";
		}
		
		CFindFile finder; 
		if (finder.FindFile(szPath))
		{
			bWithFingerMenu = TRUE;
		}



		dlg1.SetTitle(L"Startup");
		dlg1.m_bWithFingerMenu = bWithFingerMenu;
		if (bWithFingerMenu)
		{
			dlg2.SetTitle(L"Menu options");
			dlg3.SetTitle(L"Menu exclusions");
			dlg7.SetTitle(L"Menu wnd exclusions");
		}
		dlg5.SetTitle(L"Msgbox options");
		dlg6.SetTitle(L"Msgbox exclusions");
		dlg8.SetTitle(L"Msgbox wnd exclusions");
		dlg4.SetTitle(L"Skins");
		dlg4.m_bWithFingerMenu = bWithFingerMenu;
		dlgAbout.SetTitle(L"About");

		// about box
		CString strCredits = "\n\n"
			    "\tFingerMenu v1.12\n\n"
				"\tFingerMsgBox v1.01\n\n"
				"\rdeveloped by:\n"
				"Francesco Carlucci\n"
				"<*****@*****.**>\n"
				"\n\n"
				"http://forum.xda-developers.com/\n"
				"                showthread.php?t=459125\n";

		dlgAbout.SetCredits(strCredits);

		CPropertySheet sheet;
		sheet.AddPage(dlg1);
		if (bWithFingerMenu)
		{
			sheet.AddPage(dlg2);
			sheet.AddPage(dlg3);
			sheet.AddPage(dlg7);
		}
		sheet.AddPage(dlg5);
		sheet.AddPage(dlg6);
		sheet.AddPage(dlg8);
		sheet.AddPage(dlg4);
		sheet.AddPage(dlgAbout);
		sheet.SetActivePage(_ttol(pstrCommand));
		if (IDOK == sheet.DoModal(hWnd))
		{
			ReloadConfiguration();
		}

		return TRUE;
	}