这篇教程C++ ATLTRACE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ATLTRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ ATLTRACE函数的具体用法?C++ ATLTRACE怎么用?C++ ATLTRACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ATLTRACE函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: R_export2datasetSEXP R_export2dataset(SEXP path, SEXP dataframe, SEXP shape, SEXP shape_info){ std::wstring dataset_name; tools::copy_to(path, dataset_name); struct _cleanup { typedef std::vector<cols_base*> c_type; std::vector<std::wstring> name; c_type c; ~_cleanup() { for (size_t i = 0, n = c.size(); i < n; i++) delete c[i]; } }cols; shape_extractor extractor; bool isShape = extractor.init(shape, shape_info) == S_OK; tools::getNames(dataframe, cols.name); R_xlen_t nlen = 0; ATLTRACE("dataframe type:%s", Rf_type2char(TYPEOF(dataframe))); if (Rf_isVectorList(dataframe)) { size_t k = tools::size(dataframe); ATLASSERT(cols.name.size() == k); cols.name.resize(k); for (size_t i = 0; i < k; i++) { nlen = std::max(nlen, tools::size(VECTOR_ELT(dataframe, i))); if (cols.name[i].empty()) cols.name[i] = L"data"; } } else { if (Rf_isNull(dataframe)) nlen = extractor.size(); else return showError<false>("unsupported datat type"), R_NilValue; } if (nlen == 0) return showError<false>("nothing to save: 0 length"), R_NilValue; if (isShape && nlen != extractor.size() ) Rf_warning("length of shape != data.frame length"); //return showError<false>("length of shape != data.frame"), R_NilValue; std::unique_ptr<arcobject::cursor> acur(arcobject::create_insert_cursor(dataset_name, extractor.geometry_info())); if (acur.get() == NULL) return showError<true>(), R_NilValue; arcobject::cursor* cur = acur.get(); for (size_t i = 0; i < cols.name.size(); i++) { ATLASSERT(!cols.name[i].empty()); SEXP it = VECTOR_ELT(dataframe, i); bool skip = false; if (isShape)//if(gt == esriGeometryPolygon || gt == esriGeometryLine) { skip = cols.name[i] == L"Shape_Area"; skip = !skip ? cols.name[i] == L"Shape_Length" : true; } if (!skip) { cols_base* item = setup_field(cur, it, cols.name[i]); if (!item) Rf_warning("unsupported data.field column type");//return showError<false>(L"unsupported data.field column type"), R_NilValue; else cols.c.push_back(item); } } if (!cur->begin()) return showError<true>(), R_NilValue; for (R_xlen_t i = 0; i < nlen; i++) { //ATLTRACE("/n"); for (const auto &c : cols.c) { if (c->pos < 0) continue; CComVariant val; c->get(i, val); if (!cur->setValue(c->pos, val)) return showError<true>("insert row value failed"), R_NilValue; } if (isShape) { if (extractor.isPoints()) cur->set_point(extractor.getPoint(i)); else cur->set_shape(extractor.getShape(i)); } if (!cur->next()) return showError<true>("insert row failed"), R_NilValue;//.........这里部分代码省略.........
开发者ID:bobfridley,项目名称:r-bridge,代码行数:101,
示例2: ATLTRACESTDMETHODIMP CBindStatCallback::OnObjectAvailable(REFIID riid, IUnknown *punk){ ATLTRACE(_T("CBindStatCallback::OnObjectAvailable/n")); return E_NOTIMPL;}
开发者ID:js422,项目名称:PERL,代码行数:5,
示例3: Runint Run(LPTSTR /*lpstrCmdLine*/ = NULL, int /*nCmdShow*/ = SW_SHOWDEFAULT){ int nRet = 0; // Return code CErrorReportDlg dlgErrorReport; // Error Report dialog CResendDlg dlgResend; // Resend dialog // Get command line parameters. LPCWSTR szCommandLine = GetCommandLineW(); // Split command line. int argc = 0; LPWSTR* argv = CommandLineToArgvW(szCommandLine, &argc); // Check parameter count. if(argc!=2) return 1; // No arguments passed, exit. if(_tcscmp(argv[1], _T("/terminate"))==0) { // User wants us to find and terminate all instances of CrashSender.exe return CErrorReportSender::TerminateAllCrashSenderProcesses(); } // Extract file mapping name from command line arg. CString sFileMappingName = CString(argv[1]); // Create the sender model that will collect crash report data // and send error report(s). CErrorReportSender* pSender = CErrorReportSender::GetInstance(); // Init the sender object BOOL bInit = pSender->Init(sFileMappingName.GetBuffer(0)); if(!bInit) { // Failed to init return 0; } // Determine what to do next // (either run in GUI more or run in silent mode). if(!pSender->GetCrashInfo()->m_bSilentMode) { // GUI mode. // Create message loop. CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); if(!pSender->GetCrashInfo()->m_bSendRecentReports) { // Create "Error Report" dialog if(dlgErrorReport.Create(NULL) == NULL) { ATLTRACE(_T("Error report dialog creation failed!/n")); return 1; } } else { // Create "Send Error Reports" dialog. if(dlgResend.Create(NULL) == NULL) { ATLTRACE(_T("Resend dialog creation failed!/n")); return 1; } } // Process window messages. nRet = theLoop.Run(); _Module.RemoveMessageLoop(); } else { // Silent (non-GUI mode). // Run the sender and wait until it exits. pSender->Run(); pSender->WaitForCompletion(); // Get return status nRet = pSender->GetStatus(); } // Delete sender object. delete pSender; // Exit. return nRet;}
开发者ID:cpzhang,项目名称:zen,代码行数:86,
示例4: m_envDDEClientTransactionManager::DDEClientTransactionManager(void) : m_env(NULL) , m_idInst(0){ ATLTRACE( _T("DDEClientTransactionManager::DDEClientTransactionManager();/n") );}
开发者ID:shaolang,项目名称:clj-dde,代码行数:6,
示例5: Runint Run(LPTSTR /*lpstrCmdLine*/ = NULL, int /*nCmdShow*/ = SW_SHOWDEFAULT){ LPCWSTR szCommandLine = GetCommandLineW(); int argc = 0; LPWSTR* argv = CommandLineToArgvW(szCommandLine, &argc); // Read the crash info passed by CrashRpt.dll to CrashSender.exe if(argc!=2) return 1; // No arguments passed // Read crash info CString sFileName = CString(argv[1]); int nInit = g_CrashInfo.Init(sFileName); if(nInit!=0) { MessageBox(NULL, _T("Couldn't initialize!"), _T("CrashSender.exe"), MB_ICONERROR); return 1; } if(!g_CrashInfo.m_bSendRecentReports) { // Do the crash info collection work assynchronously g_ErrorReportSender.DoWork(COLLECT_CRASH_INFO); } // Check window mirroring settings CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { SetProcessDefaultLayout(LAYOUT_RTL); } CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); if(!g_CrashInfo.m_bSendRecentReports) { if(dlgErrorReport.Create(NULL) == NULL) { ATLTRACE(_T("Main dialog creation failed!/n")); return 0; } } else { // check if another instance of CrashSender.exe is running ::CreateMutex( NULL, FALSE,_T("Local//43773530-129a-4298-88f2-20eea3e4a59b")); if (::GetLastError() == ERROR_ALREADY_EXISTS) { // Another CrashSender.exe already tries to resend recent reports; exit. return 0; } if(g_CrashInfo.GetReportCount()==0) return 0; // There are no reports for us to send // Check if it is ok to remind user now if(!g_CrashInfo.IsRemindNowOK()) return 0; if(dlgResend.Create(NULL) == NULL) { ATLTRACE(_T("Resend dialog creation failed!/n")); return 0; } } int nRet = theLoop.Run(); // Wait until the worker thread is exited g_ErrorReportSender.WaitForCompletion(); nRet = g_ErrorReportSender.GetGlobalStatus(); _Module.RemoveMessageLoop(); return nRet;}
开发者ID:doo,项目名称:CrashRpt,代码行数:78,
示例6: lockbool CPathWatcher::AddPath(const CTGitPath& path){ AutoLocker lock(m_critSec); for (int i=0; i<watchedPaths.GetCount(); ++i) { if (watchedPaths[i].IsAncestorOf(path)) return false; // already watched (recursively) } // now check if with the new path we might have a new root CTGitPath newroot; for (int i=0; i<watchedPaths.GetCount(); ++i) { const CString& watched = watchedPaths[i].GetWinPathString(); const CString& sPath = path.GetWinPathString(); int minlen = min(sPath.GetLength(), watched.GetLength()); int len = 0; for (len = 0; len < minlen; ++len) { if (watched.GetAt(len) != sPath.GetAt(len)) { if ((len > 1)&&(len < minlen)) { if (sPath.GetAt(len)=='//') { newroot = CTGitPath(sPath.Left(len)); } else if (watched.GetAt(len)=='//') { newroot = CTGitPath(watched.Left(len)); } } break; } } if (len == minlen) { if (sPath.GetLength() == minlen) { if (watched.GetLength() > minlen) { if (watched.GetAt(len)=='//') { newroot = path; } else if (sPath.GetLength() == 3 && sPath[1] == ':') { newroot = path; } } } else { if (sPath.GetLength() > minlen) { if (sPath.GetAt(len)=='//') { newroot = CTGitPath(watched); } else if (watched.GetLength() == 3 && watched[1] == ':') { newroot = CTGitPath(watched); } } } } } if (!newroot.IsEmpty()) { ATLTRACE(_T("add path to watch %s/n"), newroot.GetWinPath()); watchedPaths.AddPath(newroot); watchedPaths.RemoveChildren(); m_hCompPort.CloseHandle(); return true; } ATLTRACE(_T("add path to watch %s/n"), path.GetWinPath()); watchedPaths.AddPath(path); m_hCompPort.CloseHandle(); return true;}
开发者ID:murank,项目名称:TortoiseGitMod,代码行数:80,
示例7: _TDWORD __stdcall CInjection::Initialize(LPVOID lpParameter ){ USES_CONVERSION; HMODULE hInstance = (HMODULE)lpParameter; // get the current directory CString strCurrentDir = CUtility::GetCurrentDirectory(); // dbghelp.dll { CString strDbgHelpDll; strDbgHelpDll.Format( _T("%s%s"), strCurrentDir, DBG_HELP_DLL); HMODULE hModule = ::LoadLibrary(strDbgHelpDll); if( hModule == NULL || !CPdbHelper::Initialize(hModule) ) { s_nStatus = Status_Error_DbgHelpNotFound; SetEvent( s_hEvent ); return FALSE; } } // find the JIT module g_hJitModule = GetModuleHandleA("clrjit.dll"); if( !g_hJitModule ) g_hJitModule = GetModuleHandleA("mscorjit.dll"); if( g_hJitModule == NULL ) { s_nStatus = Status_Error_JITNotFound; SetEvent( s_hEvent ); return FALSE; } // find the CLR module g_hClrModule = GetModuleHandleA("clr.dll"); if( !g_hClrModule ) g_hClrModule = GetModuleHandleA("mscorwks.dll"); if( g_hClrModule == NULL || !DetermineDotNetVersion() ) { s_nStatus = Status_Error_CLRNotFound; SetEvent( s_hEvent ); return FALSE; } // try to quick load the symbol address base on the binary hash if( !CSymbolAddressCache::TryCache() ) { // get the pdb directory CString strDestPath(strCurrentDir); { strDestPath.AppendFormat( _T("PDB_symbols//") ); ::CreateDirectory(strDestPath, NULL); } // copy the JIT dll { TCHAR tszFilename[MAX_PATH] = {0}; GetModuleFileName( g_hJitModule, tszFilename, MAX_PATH); ::CopyFile( tszFilename, strDestPath + CUtility::GetFileName(tszFilename), FALSE); } // copy the CLR dll { TCHAR tszFilename[MAX_PATH] = {0}; GetModuleFileName( g_hClrModule, tszFilename, MAX_PATH); ::CopyFile( tszFilename, strDestPath + CUtility::GetFileName(tszFilename), FALSE); } // Set Environment Variable { CString strVariable; strVariable.Format( _T("symsrv*symsrv.dll*%s*http://msdl.microsoft.com/download/symbols"), strDestPath); SetEnvironmentVariable( _T("_NT_SYMBOL_PATH"), strVariable.GetBuffer()); strVariable.ReleaseBuffer(); } if( !SearchMethodAddresses(T2W(strDestPath.GetBuffer())) ) { // download the pdb // symchk.exe /if "C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorjit.dll" /s srv*G:/HookDotNet*http://msdl.microsoft.com/download/symbols CString strCmd; strCmd.Format( _T("/"%s%s/" /if /"%s*.dll/" /s symsrv*symsrv.dll*%s*http://msdl.microsoft.com/download/symbols") , strCurrentDir , SYMCHK_EXE , strDestPath , strDestPath ); ATLTRACE( _T("/n%s"), strCmd); STARTUPINFO si = { sizeof(si) }; si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; PROCESS_INFORMATION pi = {0}; BOOL bRet = CreateProcess( NULL , strCmd.GetBuffer() , NULL , NULL , FALSE//.........这里部分代码省略.........
开发者ID:Evit15,项目名称:-NET-Modify-IL-Code-during-Run-time,代码行数:101,
示例8: pGetModuleVerFileInfoVOID CAboutDialog::OnCheckUpdate(UINT /* wNotifyCode */, int /* wID */, HWND /* hWndCtl */){ NDUPDATE_SYSTEM_INFO sysInfo = {0}; NDUPDATE_UPDATE_INFO_V2 updateInfo = {0}; sysInfo.dwLanguageSet = 0; sysInfo.dwPlatform = NDAS_PLATFORM_WIN2K; sysInfo.dwVendor = 0; VS_FIXEDFILEINFO vffi = {0}; BOOL fSuccess = pGetModuleVerFileInfo(vffi); if (!fSuccess) { // // This is a fallback // ATLASSERT(FALSE); sysInfo.ProductVersion.wMajor = 3; sysInfo.ProductVersion.wMinor = 10; sysInfo.ProductVersion.wBuild = 0; sysInfo.ProductVersion.wPrivate = 0; } else { sysInfo.ProductVersion.wMajor = HIWORD(vffi.dwProductVersionMS); sysInfo.ProductVersion.wMinor = LOWORD(vffi.dwProductVersionMS); sysInfo.ProductVersion.wBuild = HIWORD(vffi.dwProductVersionLS); sysInfo.ProductVersion.wPrivate = LOWORD(vffi.dwProductVersionLS); } TCHAR szUpdateBaseURL[NDUPDATE_MAX_URL] = {0}; fSuccess = pGetAppConfigValue( _T("UpdateURL"), szUpdateBaseURL, NDUPDATE_MAX_URL); if (!fSuccess) { HRESULT hr = ::StringCchCopy( szUpdateBaseURL, NDUPDATE_MAX_URL, _T("http://updates.ximeta.com/update/")); ATLASSERT(SUCCEEDED(hr)); } AutoHModule hUpdateDLL = ::LoadLibrary(_T("ndupdate.dll")); if (NULL == (HMODULE)hUpdateDLL) { return; } typedef BOOL (WINAPI* NDUPDATE_NdasUpdateDoUpdate)(HWND, LPCTSTR, PNDUPDATE_SYSTEM_INFO); NDUPDATE_NdasUpdateDoUpdate pfnDoUpdate = (NDUPDATE_NdasUpdateDoUpdate) ::GetProcAddress(hUpdateDLL, "NdasUpdateDoUpdate"); LCID lcid = ::GetThreadLocale(); fSuccess = ::SetThreadLocale(MAKELCID(_CurrentUILangID,SORT_DEFAULT)); ATLASSERT(fSuccess); fSuccess = pfnDoUpdate(m_hWnd, szUpdateBaseURL, &sysInfo); if (!fSuccess) { ATLTRACE(_T("Update function failed: %08X"), ::GetLastError()); } fSuccess = ::SetThreadLocale(lcid); ATLASSERT(fSuccess);}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:63,
示例9: whilevoid CPathWatcher::WorkerThread(){ DWORD numBytes; CDirWatchInfo * pdi = NULL; LPOVERLAPPED lpOverlapped; WCHAR buf[MAX_PATH*4] = {0}; while (m_bRunning) { if (watchedPaths.GetCount()) { if (!GetQueuedCompletionStatus(m_hCompPort, &numBytes, (PULONG_PTR) &pdi, &lpOverlapped, INFINITE)) { // Error retrieving changes // Clear the list of watched objects and recreate that list if (!m_bRunning) return; { AutoLocker lock(m_critSec); ClearInfoMap(); } DWORD lasterr = GetLastError(); if ((m_hCompPort)&&(lasterr!=ERROR_SUCCESS)&&(lasterr!=ERROR_INVALID_HANDLE)) { m_hCompPort.CloseHandle(); } // Since we pass m_hCompPort to CreateIoCompletionPort, we // have to set this to NULL to have that API create a new // handle. m_hCompPort = NULL; for (int i=0; i<watchedPaths.GetCount(); ++i) { CAutoFile hDir = CreateFile(watchedPaths[i].GetWinPath(), FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, //security attributes OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | //required privileges: SE_BACKUP_NAME and SE_RESTORE_NAME. FILE_FLAG_OVERLAPPED, NULL); if (!hDir) { // this could happen if a watched folder has been removed/renamed m_hCompPort.CloseHandle(); AutoLocker lock(m_critSec); watchedPaths.RemovePath(watchedPaths[i]); i--; if (i<0) i=0; break; } CDirWatchInfo * pDirInfo = new CDirWatchInfo(hDir, watchedPaths[i]); hDir.Detach(); // the new CDirWatchInfo object owns the handle now m_hCompPort = CreateIoCompletionPort(pDirInfo->m_hDir, m_hCompPort, (ULONG_PTR)pDirInfo, 0); if (m_hCompPort == NULL) { AutoLocker lock(m_critSec); ClearInfoMap(); delete pDirInfo; pDirInfo = NULL; watchedPaths.RemovePath(watchedPaths[i]); i--; if (i<0) i=0; break; } if (!ReadDirectoryChangesW(pDirInfo->m_hDir, pDirInfo->m_Buffer, READ_DIR_CHANGE_BUFFER_SIZE, TRUE, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE, &numBytes,// not used &pDirInfo->m_Overlapped, NULL)) //no completion routine! { AutoLocker lock(m_critSec); ClearInfoMap(); delete pDirInfo; pDirInfo = NULL; watchedPaths.RemovePath(watchedPaths[i]); i--; if (i<0) i=0; break; } AutoLocker lock(m_critSec); watchInfoMap[pDirInfo->m_hDir] = pDirInfo; ATLTRACE(_T("watching path %s/n"), pDirInfo->m_DirName.GetWinPath()); } } else { if (!m_bRunning) return; // NOTE: the longer this code takes to execute until ReadDirectoryChangesW // is called again, the higher the chance that we miss some // changes in the file system! if (pdi) { if (numBytes == 0) { goto continuewatching;//.........这里部分代码省略.........
开发者ID:murank,项目名称:TortoiseGitMod,代码行数:101,
示例10: WaitForMultipleObjectsvoid CShellUpdater::WorkerThread(){ HANDLE hWaitHandles[2]; hWaitHandles[0] = m_hTerminationEvent; hWaitHandles[1] = m_hWakeEvent; for(;;) { DWORD waitResult = WaitForMultipleObjects(_countof(hWaitHandles), hWaitHandles, FALSE, INFINITE); // exit event/working loop if the first event (m_hTerminationEvent) // has been signaled or if one of the events has been abandoned // (i.e. ~CShellUpdater() is being executed) if(waitResult == WAIT_OBJECT_0 || waitResult == WAIT_ABANDONED_0 || waitResult == WAIT_ABANDONED_0+1) { // Termination event break; } // wait some time before we notify the shell Sleep(50); for(;;) { CTGitPath workingPath; if (!m_bRunning) return; Sleep(0); { AutoLocker lock(m_critSec); if(m_pathsToUpdate.empty()) { // Nothing left to do break; } if(m_bItemsAddedSinceLastUpdate) { m_pathsToUpdate.erase(std::unique(m_pathsToUpdate.begin(), m_pathsToUpdate.end(), &CTGitPath::PredLeftEquivalentToRight), m_pathsToUpdate.end()); m_bItemsAddedSinceLastUpdate = false; } workingPath = m_pathsToUpdate.front(); m_pathsToUpdate.pop_front(); } if (workingPath.IsEmpty()) continue; ATLTRACE(_T("Update notifications for: %s/n"), workingPath.GetWinPath()); if (workingPath.IsDirectory()) { // check if the path is monitored by the watcher. If it isn't, then we have to invalidate the cache // for that path and add it to the watcher. if (!CGitStatusCache::Instance().IsPathWatched(workingPath)) { if (workingPath.HasAdminDir()) CGitStatusCache::Instance().AddPathToWatch(workingPath); } // first send a notification about a sub folder change, so explorer doesn't discard // the folder notification. Since we only know for sure that the subversion admin // dir is present, we send a notification for that folder. CString admindir = workingPath.GetWinPathString() + _T("//") + g_GitAdminDir.GetAdminDirName(); if(::PathFileExists(admindir)) SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, (LPCTSTR)admindir, NULL); SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, workingPath.GetWinPath(), NULL); // Sending an UPDATEDIR notification somehow overwrites/deletes the UPDATEITEM message. And without // that message, the folder overlays in the current view don't get updated without hitting F5. // Drawback is, without UPDATEDIR, the left tree view isn't always updated... SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH | SHCNF_FLUSHNOWAIT, workingPath.GetWinPath(), NULL); } else SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, workingPath.GetWinPath(), NULL); } } _endthread();}
开发者ID:chengn,项目名称:TortoiseGit,代码行数:75,
示例11: SetupInternetConnectionbool SetupInternetConnection(LPCTSTR url){ int iNetwork; HRESULT hResult = E_FAIL; DWORD dwStatus; // cleanup the old connection if(NULL != hConnection) { hResult=ConnMgrConnectionStatus(hConnection,&dwStatus); if( SUCCEEDED(hResult) ) { ATLTRACE(L"Internet connection exist, use it/n"); if( dwStatus & CONNMGR_STATUS_CONNECTED ) return true; } ConnMgrReleaseConnection(hConnection, FALSE); ATLTRACE(L"Internet connection droped, open new one/n"); hConnection = NULL; } // get the right network to connect to iNetwork = 0; //CONNMGR_DESTINATION_INFO DestInfo; GUID pguid; if( FAILED( ConnMgrMapURL(url, &pguid, NULL) ) ) return false; //while( SUCCEEDED(ConnMgrEnumDestinations(iNetwork++, &DestInfo))) { ATLTRACE(L"Try establish Internet connection /n"); // actually try to establish the connection CONNMGR_CONNECTIONINFO ConnInfo; ZeroMemory(&ConnInfo, sizeof(ConnInfo)); ConnInfo.cbSize = sizeof(ConnInfo); ConnInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET; ConnInfo.dwPriority = CONNMGR_PRIORITY_HIPRIBKGND;//CONNMGR_PRIORITY_USERBACKGROUND;#if ( _WIN32_WCE >= 0x500 ) ConnInfo.dwFlags = CONNMGR_FLAG_NO_ERROR_MSGS;#endif ConnInfo.guidDestNet = pguid; hResult = ConnMgrEstablishConnection(&ConnInfo, &hConnection); // check to see if the attempt failed int count = 0; while(SUCCEEDED(hResult) && count++ < 60 ) { ATLTRACE(L"Wait for connect (%d)./n",count); DWORD dwResult = WaitForSingleObject( hConnection, 1000); if (dwResult == (WAIT_OBJECT_0)) { hResult=ConnMgrConnectionStatus(hConnection,&dwStatus); if( SUCCEEDED(hResult) ) { if( dwStatus & CONNMGR_STATUS_CONNECTED ) { ATLTRACE(L"Connected/n"); return true; } if( dwStatus & CONNMGR_STATUS_WAITINGCONNECTION ) { continue; } break; } } } } ATLTRACE(L"Failed to connect/n"); return false;}
开发者ID:DoktahWorm,项目名称:rhodes,代码行数:74,
示例12: ClearResultCachevoid ClearResultCache(){ ATLTRACE(_T("Result cache before clearing(size=%u)/r/n"), ResultCache.Size()); ResultCache.Clear();}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:5,
示例13: remote_datachar* remote_data(LPWSTR verb, char* url, char* body, size_t body_size, bool bGetHeaders, bool bGetRawData = false, bool bCheckSession = false, DWORD* pdwDataSize = NULL) { char *cstr = NULL; char *session = NULL; std::string data = ""; //CAtlStringA data; char sBuf[1024]; DWORD dwBytesRead = 0; LPWSTR urlw; HINTERNET hInet, hConnection, hRequest; LPTSTR pszFunction = NULL; if ( url==NULL || strlen(url)==0 ) return NULL; urlw = wce_mbtowc(url); hInet = hConnection = hRequest = NULL; do { // Don't make a connection attempt if there is no session session = get_db_session(load_source_url()); if ( bCheckSession && !session && !strstr(url, "clientcreate") ) { break; } if (session) free(session); if( !SetupInternetConnection(urlw) ) { break; } hInet = InternetOpen(_T("rhodes-wm"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, NULL ); if ( !hInet ) { pszFunction = L"InternetOpen"; break; } DWORD lpdwBufferLength = sizeof(sBuf)/sizeof(wchar_t); if ( !InternetCanonicalizeUrl(urlw, (LPWSTR)sBuf, &lpdwBufferLength, 0) ) { pszFunction = L"InternetCanonicalizeUrl"; break; } ATLTRACE(L"Connecting to url: %s/n",(LPWSTR)sBuf); URL_COMPONENTS uri; alloc_url_components(&uri,url); if( !InternetCrackUrl((LPWSTR)sBuf,lpdwBufferLength,0,&uri) ) { pszFunction = L"InternetCrackUrl"; free_url_components(&uri); break; } hConnection = InternetConnect( hInet, uri.lpszHostName, uri.nPort, _T("anonymous"), NULL, INTERNET_SERVICE_HTTP, 0, 0 ); if ( !hConnection ) { pszFunction = L"InternetConnect"; free_url_components(&uri); break; } wsprintf((LPWSTR)sBuf,L"%s%s",uri.lpszUrlPath,uri.lpszExtraInfo); hRequest = HttpOpenRequest( hConnection, verb, (LPWSTR)sBuf, NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_NO_CACHE_WRITE, NULL ); if ( !hRequest ) { pszFunction = L"HttpOpenRequest"; free_url_components(&uri); break; } free_url_components(&uri); //Send data if ( HttpSendRequest( hRequest, NULL, 0, body, body_size) ) { wchar_t res[10]; DWORD dwLen = 10; DWORD nIndex = 0; bool bOk = false; if( HttpQueryInfo(hRequest,HTTP_QUERY_STATUS_CODE,res,&dwLen,&nIndex) ){ if ( wcscmp(res,L"200") == 0 ) bOk = true; else { bOk = false; // If we're unauthorized, delete any cookies that might have been // stored so we don't reuse them later if ( wcscmp(res,L"401") == 0 ) delete_winmo_session(load_source_url()); } } if ( bOk ){ if ( bGetHeaders ){ DWORD dwSize = 0; HttpQueryInfo(hRequest, HTTP_QUERY_RAW_HEADERS, NULL, &dwSize, NULL); if( dwSize != 0 ) { cstr = new char [dwSize+1]; // Call HttpQueryInfo again to get the headers. bOk = (bool) HttpQueryInfoA(hRequest, HTTP_QUERY_RAW_HEADERS, (LPVOID) cstr, &dwSize, NULL); }//.........这里部分代码省略.........
开发者ID:DoktahWorm,项目名称:rhodes,代码行数:101,
示例14: ATLTRACESTDMETHODIMP CXMLHttpRequest::send(VARIANT varBody){ ATLTRACE(_T("CXMLHttpRequest::send/n")); if (V_VT(&varBody) != VT_BSTR && V_VT(&varBody) != VT_DISPATCH && V_VT(&varBody) != (VT_ARRAY | VT_VARIANT) && V_VT(&varBody) != (VT_ARRAY | VT_UI1) && V_VT(&varBody) != VT_UNKNOWN) return E_INVALIDARG; // do not start another thread if there is another active if (NULL != m_hThread) { DWORD exitCode = 0; BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); if (!rc || STILL_ACTIVE == exitCode) return E_PENDING; ::CloseHandle(m_hThread); m_hThread = NULL; } HRESULT hr = S_OK; m_bSuccess = true; m_bAbort = false; delete [] m_pBody; m_pBody = NULL; m_lBodyLength = 0; delete [] m_pResponseBody; m_pResponseBody = NULL; m_lResponseBodyLength = 0; m_dwStatus = 0; m_StatusText = _T(""); m_ResponseHeaders = _T(""); if (V_VT(&varBody) == VT_BSTR) { _bstr_t body = V_BSTR(&varBody); m_lBodyLength = body.length() + 1; m_pBody = new BYTE[m_lBodyLength]; memset(m_pBody,0,m_lBodyLength); memcpy(m_pBody,static_cast<char*> (body),body.length()); } else if (V_VT(&varBody) == VT_UNKNOWN) { CComQIPtr<IStream,&IID_IStream> pS(V_UNKNOWN(&varBody)); if (!pS) return E_INVALIDARG; CComBSTR b; hr = b.ReadFromStream(pS); if (S_OK != hr) return hr; _bstr_t body = b; m_lBodyLength = body.length() + 1; m_pBody = new BYTE[m_lBodyLength]; memset(m_pBody,0,m_lBodyLength); memcpy(m_pBody,static_cast<char*> (body),body.length()); } else if (V_VT(&varBody) == VT_DISPATCH) { CComQIPtr<IXMLDOMDocument,&IID_IXMLDOMDocument> pDoc(V_DISPATCH(&varBody)); if (!pDoc) return E_INVALIDARG; BSTR b = NULL; hr = pDoc->get_xml(&b); if (S_OK != hr) return hr; _bstr_t body = b; ::SysFreeString(b); m_lBodyLength = body.length() + 1; m_pBody = new BYTE[m_lBodyLength]; memset(m_pBody,0,m_lBodyLength); memcpy(m_pBody,static_cast<char*> (body),body.length()); } else if (V_VT(&varBody) == (VT_ARRAY | VT_VARIANT)) { SAFEARRAY *pArray = reinterpret_cast<SAFEARRAY *> (varBody.byref); if (NULL == pArray) return E_INVALIDARG; long lLBoundVar = 0; long lUBoundVar = 0; UINT dims = ::SafeArrayGetDim(pArray); if (dims == 0) return E_INVALIDARG; hr = ::SafeArrayGetLBound(pArray, dims, &lLBoundVar); if (S_OK != hr) return hr; hr = ::SafeArrayGetUBound(pArray, dims, &lUBoundVar); if (S_OK != hr) return hr; if (lUBoundVar >= lLBoundVar) { VARIANT *pIndex = NULL; hr = ::SafeArrayAccessData(pArray, reinterpret_cast<void **> (&pIndex)); if (S_OK != hr)//.........这里部分代码省略.........
开发者ID:syoutetu,项目名称:ColladaViewer_VC8,代码行数:101,
示例15: ATLTRACEDDEClientTransactionManager::~DDEClientTransactionManager(void){ ATLTRACE( _T("DDEClientTransactionManager::~DDEClientTransactionManager();/n") );}
开发者ID:shaolang,项目名称:clj-dde,代码行数:4,
示例16: SecureZeroMemoryvoid CFolderCrawler::WorkerThread(){ HANDLE hWaitHandles[2]; hWaitHandles[0] = m_hTerminationEvent; hWaitHandles[1] = m_hWakeEvent; CTGitPath workingPath; bool bFirstRunAfterWakeup = false; DWORD currentTicks = 0; // Quick check if we're on Vista OSVERSIONINFOEX inf; SecureZeroMemory(&inf, sizeof(OSVERSIONINFOEX)); inf.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); GetVersionEx((OSVERSIONINFO *)&inf); WORD fullver = MAKEWORD(inf.dwMinorVersion, inf.dwMajorVersion); for(;;) { bool bRecursive = !!(DWORD)CRegStdDWORD(_T("Software//TortoiseGit//RecursiveOverlay"), TRUE); if (fullver >= 0x0600) { SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_END); } DWORD waitResult = WaitForMultipleObjects(_countof(hWaitHandles), hWaitHandles, FALSE, INFINITE); // exit event/working loop if the first event (m_hTerminationEvent) // has been signaled or if one of the events has been abandoned // (i.e. ~CFolderCrawler() is being executed) if(m_bRun == false || waitResult == WAIT_OBJECT_0 || waitResult == WAIT_ABANDONED_0 || waitResult == WAIT_ABANDONED_0+1) { // Termination event break; } if (fullver >= 0x0600) { SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN); } // If we get here, we've been woken up by something being added to the queue. // However, it's important that we don't do our crawling while // the shell is still asking for items bFirstRunAfterWakeup = true; for(;;) { if (!m_bRun) break; // Any locks today? if (CGitStatusCache::Instance().m_bClearMemory) { CGitStatusCache::Instance().WaitToWrite(); CGitStatusCache::Instance().ClearCache(); CGitStatusCache::Instance().Done(); CGitStatusCache::Instance().m_bClearMemory = false; } if(m_lCrawlInhibitSet > 0) { // We're in crawl hold-off ATLTRACE("Crawl hold-off/n"); Sleep(50); continue; } if (bFirstRunAfterWakeup) { Sleep(20); ATLTRACE("Crawl bFirstRunAfterWakeup/n"); bFirstRunAfterWakeup = false; continue; } if ((m_blockReleasesAt < GetTickCount())&&(!m_blockedPath.IsEmpty())) { ATLTRACE(_T("Crawl stop blocking path %s/n"), m_blockedPath.GetWinPath()); m_blockedPath.Reset(); } if ((m_foldersToUpdate.empty())&&(m_pathsToUpdate.empty())) { // Nothing left to do break; } currentTicks = GetTickCount(); if (!m_pathsToUpdate.empty()) { { AutoLocker lock(m_critSec); m_bPathsAddedSinceLastCrawl = false; workingPath = m_pathsToUpdate.front(); //m_pathsToUpdateUnique.erase (workingPath); m_pathsToUpdate.pop_front(); if ((DWORD(workingPath.GetCustomData()) >= currentTicks) || ((!m_blockedPath.IsEmpty())&&(m_blockedPath.IsAncestorOf(workingPath)))) { // move the path to the end of the list //m_pathsToUpdateUnique.insert (workingPath); m_pathsToUpdate.push_back(workingPath); if (m_pathsToUpdate.size() < 3) Sleep(50);//.........这里部分代码省略.........
开发者ID:andmedsantana,项目名称:TortoiseGit,代码行数:101,
示例17: CreateFilebool CCacheDlg::EnsurePipeOpen(){ if(m_hPipe != INVALID_HANDLE_VALUE) { return true; } m_hPipe = CreateFile( GetCachePipeName(), // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe FILE_FLAG_OVERLAPPED, // default attributes NULL); // no template file if (m_hPipe == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PIPE_BUSY) { // TSVNCache is running but is busy connecting a different client. // Do not give up immediately but wait for a few milliseconds until // the server has created the next pipe instance if (WaitNamedPipe(GetCachePipeName(), 50)) { m_hPipe = CreateFile( GetCachePipeName(), // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe FILE_FLAG_OVERLAPPED, // default attributes NULL); // no template file } } if (m_hPipe != INVALID_HANDLE_VALUE) { // The pipe connected; change to message-read mode. DWORD dwMode; dwMode = PIPE_READMODE_MESSAGE; if(!SetNamedPipeHandleState( m_hPipe, // pipe handle &dwMode, // new pipe mode NULL, // don't set maximum bytes NULL)) // don't set maximum time { ATLTRACE("SetNamedPipeHandleState failed"); CloseHandle(m_hPipe); m_hPipe = INVALID_HANDLE_VALUE; return false; } // create an unnamed (=local) manual reset event for use in the overlapped structure m_hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (m_hEvent) return true; ATLTRACE("CreateEvent failed"); ClosePipe(); return false; } return false;}
开发者ID:chengn,项目名称:TortoiseGit,代码行数:65,
示例18: memsetbool CCacheDlg::GetStatusFromRemoteCache(const CTGitPath& Path, bool bRecursive){ if(!EnsurePipeOpen()) { STARTUPINFO startup; PROCESS_INFORMATION process; memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); memset(&process, 0, sizeof(process)); CString sCachePath = _T("TGitCache.exe"); if (CreateProcess(sCachePath.GetBuffer(sCachePath.GetLength()+1), _T(""), NULL, NULL, FALSE, 0, 0, 0, &startup, &process)==0) { // It's not appropriate to do a message box here, because there may be hundreds of calls sCachePath.ReleaseBuffer(); ATLTRACE("Failed to start cache/n"); return false; } sCachePath.ReleaseBuffer(); // Wait for the cache to open long endTime = (long)GetTickCount()+1000; while(!EnsurePipeOpen()) { if(((long)GetTickCount() - endTime) > 0) { return false; } } } DWORD nBytesRead; TGITCacheRequest request; request.flags = TGITCACHE_FLAGS_NONOTIFICATIONS; if(bRecursive) { request.flags |= TGITCACHE_FLAGS_RECUSIVE_STATUS; } wcsncpy(request.path, Path.GetWinPath(), MAX_PATH); ZeroMemory(&m_Overlapped, sizeof(OVERLAPPED)); m_Overlapped.hEvent = m_hEvent; // Do the transaction in overlapped mode. // That way, if anything happens which might block this call // we still can get out of it. We NEVER MUST BLOCK THE SHELL! // A blocked shell is a very bad user impression, because users // who don't know why it's blocked might find the only solution // to such a problem is a reboot and therefore they might loose // valuable data. // Sure, it would be better to have no situations where the shell // even can get blocked, but the timeout of 5 seconds is long enough // so that users still recognize that something might be wrong and // report back to us so we can investigate further. TGITCacheResponse ReturnedStatus; BOOL fSuccess = TransactNamedPipe(m_hPipe, &request, sizeof(request), &ReturnedStatus, sizeof(ReturnedStatus), &nBytesRead, &m_Overlapped); if (!fSuccess) { if (GetLastError()!=ERROR_IO_PENDING) { ClosePipe(); return false; } // TransactNamedPipe is working in an overlapped operation. // Wait for it to finish DWORD dwWait = WaitForSingleObject(m_hEvent, INFINITE); if (dwWait == WAIT_OBJECT_0) { fSuccess = GetOverlappedResult(m_hPipe, &m_Overlapped, &nBytesRead, FALSE); return TRUE; } else fSuccess = FALSE; } ClosePipe(); return false;}
开发者ID:chengn,项目名称:TortoiseGit,代码行数:83,
示例19: lock//.........这里部分代码省略......... }#if 0 if ((s)&&(status == git_wc_status_normal)&&(s->needslock)&&(s->owner[0]==0)) readonlyoverlay = true; if ((s)&&(s->owner[0]!=0)) lockedoverlay = true;#endif } break; default: case ShellCache::none: { // no cache means we only show a 'versioned' overlay on folders // with an admin directory if (PathIsDirectory(pPath)) { if (g_ShellCache.HasSVNAdminDir(pPath, TRUE)) { status = git_wc_status_normal; } else { status = git_wc_status_none; } } else { status = git_wc_status_none; } } break; } ATLTRACE(_T("Status %d for file %s/n"), status, pwszPath); } g_filepath.clear(); g_filepath = pPath; g_filestatus = status; g_readonlyoverlay = readonlyoverlay; g_lockedoverlay = lockedoverlay; //the priority system of the shell doesn't seem to work as expected (or as I expected): //as it seems that if one handler returns S_OK then that handler is used, no matter //if other handlers would return S_OK too (they're never called on my machine!) //So we return S_OK for ONLY ONE handler! switch (status) { // note: we can show other overlays if due to lack of enough free overlay // slots some of our overlays aren't loaded. But we assume that // at least the 'normal' and 'modified' overlay are available. case git_wc_status_none: return S_FALSE; case git_wc_status_unversioned: if (g_ShellCache.ShowUnversionedOverlay() && g_unversionedovlloaded && (m_State == FileStateUnversionedOverlay)) { g_filepath.clear(); return S_OK; } return S_FALSE; case git_wc_status_ignored: if (g_ShellCache.ShowIgnoredOverlay() && g_ignoredovlloaded && (m_State == FileStateIgnoredOverlay)) { g_filepath.clear(); return S_OK; }
开发者ID:omnibs,项目名称:TortoiseGit,代码行数:67,
注:本文中的ATLTRACE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ATLTRACE2函数代码示例 C++ ATLASSERT函数代码示例 |