BOOL Control(DWORD Control, LPCTSTR ServiceName, LPCTSTR *Args, INT ArgCount) { SC_HANDLE hSCManager = NULL; SC_HANDLE hSc = NULL; SERVICE_STATUS Status; DWORD dwDesiredAccess = 0; #ifdef SCDBG LPCTSTR *TmpArgs = Args; INT TmpCnt = ArgCount; _tprintf(_T("service to control - %s\n"), ServiceName); _tprintf(_T("command - %lu\n"), Control); _tprintf(_T("Arguments:\n")); while (TmpCnt) { _tprintf(_T(" %s\n"), *TmpArgs); TmpArgs++; TmpCnt--; } _tprintf(_T("\n")); #endif /* SCDBG */ switch (Control) { case SERVICE_CONTROL_STOP: dwDesiredAccess = SERVICE_STOP; break; case SERVICE_CONTROL_PAUSE: dwDesiredAccess = SERVICE_PAUSE_CONTINUE; break; case SERVICE_CONTROL_CONTINUE: dwDesiredAccess = SERVICE_PAUSE_CONTINUE; break; case SERVICE_CONTROL_INTERROGATE: dwDesiredAccess = SERVICE_INTERROGATE; break; case SERVICE_CONTROL_SHUTDOWN: dwDesiredAccess = 0; break; } hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); if (hSCManager != NULL) { hSc = OpenService(hSCManager, ServiceName, dwDesiredAccess); if (hSc != NULL) { if (ControlService(hSc, Control, &Status)) { SERVICE_STATUS_PROCESS StatusEx; /* FIXME: lazy hack ;) */ CopyMemory(&StatusEx, &Status, sizeof(Status)); StatusEx.dwProcessId = 0; StatusEx.dwServiceFlags = 0; PrintService(ServiceName, &StatusEx, FALSE); CloseServiceHandle(hSc); CloseServiceHandle(hSCManager); return TRUE; } } else _tprintf(_T("[SC] OpenService FAILED %lu:\n\n"), GetLastError()); } ReportLastError(); if (hSc) CloseServiceHandle(hSc); if (hSCManager) CloseServiceHandle(hSCManager); return FALSE; }
CGGSearch::CGGSearch(CWnd* pParent /*=NULL*/) : CDialog(CGGSearch::IDD, pParent) , m_guige(_T("")) { }
void CAnnounce::DoDataExchange(CDataExchange* pDX) { CDHtmlDialog::DoDataExchange(pDX); } BOOL CAnnounce::OnInitDialog() { CDHtmlDialog::OnInitDialog(); return TRUE; // 포커스를 컨트롤에 설정하지 않으면 TRUE를 반환합니다. } BEGIN_MESSAGE_MAP(CAnnounce, CDHtmlDialog) END_MESSAGE_MAP() BEGIN_DHTML_EVENT_MAP(CAnnounce) DHTML_EVENT_ONCLICK(_T("ButtonOK"), OnButtonOK) DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel) END_DHTML_EVENT_MAP() // CAnnounce 메시지 처리기입니다. HRESULT CAnnounce::OnButtonOK(IHTMLElement* /*pElement*/) { OnOK(); return S_OK; // 포커스를 컨트롤에 설정하지 않으면 TRUE를 반환합니다. } HRESULT CAnnounce::OnButtonCancel(IHTMLElement* /*pElement*/) {
svn_tristate_t ShellCache::CPathFilter::IsPathAllowed ( LPCTSTR path , TData::const_iterator begin , TData::const_iterator end) const { svn_tristate_t result = svn_tristate_unknown; // handle special cases if (begin == end) return result; size_t maxLength = wcslen (path); if (maxLength == 0) return result; // look for the most specific entry, start at the root size_t pos = 0; do { LPCTSTR backslash = wcschr (path + pos + 1, _T ('\\')); pos = backslash == NULL ? maxLength : backslash - path; std::pair<LPCTSTR, size_t> toFind (path, pos); TData::const_iterator iter = std::lower_bound (begin, end, toFind); // found a relevant entry? if ( (iter != end) && (iter->path.length() == pos) && (_wcsnicmp (iter->path.c_str(), path, pos) == 0)) { // exact match? if (pos == maxLength) return iter->included; // parent match result = iter->subPathIncluded; // done? if (iter->hasSubFolderEntries) begin = iter; else return result; } else { // set a (potentially) closer lower limit if (iter != begin) begin = --iter; } // set a (potentially) closer upper limit end = std::upper_bound (begin, end, toFind); } while ((pos < maxLength) && (begin != end)); // nothing more specific found return result; }
INT32 AI8EPSFilter::EPSHeaderIsOk(ADDR pFileHeader, UINT32 HeaderSize) { UINT32 Lines = 0; TCHAR *Buffer = NULL; // !PS-Adobe line is ok - check creator line... CCMemTextFile HeaderFile ( reinterpret_cast<char *> ( pFileHeader ), HeaderSize ); if( HeaderFile.IsMemFileInited () == FALSE || HeaderFile.InitLexer () == FALSE ) { HeaderFile.close(); return 0; } // Graeme (28/6/00) - Adobe have changed their file format, and so the first line can // now be a %PDF directive. Therefore look for this directive in the first twenty // lines. while ( ( Lines < 100 ) && !HeaderFile.eof () ) { // Get the current line from the file. HeaderFile.GetLineToken(); Buffer = const_cast<TCHAR *> ( HeaderFile.GetTokenBuf () ); // Ensure that it's OK. ERROR2IF(Buffer == 0, 0, "Returned buffer from lex file == 0"); // Increment the line counter. Lines++; if (camStrncmp(Buffer, _T("%!PS-Adobe"), 10) == 0) { // Now find the %%Creator string. while ((Lines < 100) && !HeaderFile.eof()) { HeaderFile.GetLineToken(); Buffer = const_cast<TCHAR *> ( HeaderFile.GetTokenBuf() ); ERROR2IF(Buffer == 0, 0, "Returned buffer from lex file == 0"); Lines++; // Return TRUE if this file was created by Illustrator, or has been exported in // Illustrator format. if (camStrncmp(Buffer, _T("%%Creator: Adobe Illustrator(R) 8"), 33) == 0) { // We definitely want this. HeaderFile.close(); return 10; } // Check to see if it's from Illustrator 9. If you're writing a dedicated AI9 // filter, then you really should remove this code. else if (camStrncmp(Buffer, _T("%%Creator: Adobe Illustrator(R) 9"), 33) == 0) { // We probably want this. Note: I'm returning 9 because a native AI9 // filter would return 10, and if this code is left in, it will be // ignored. HeaderFile.close(); return 9; } if (camStrncmp(Buffer, _T("%%Creator:"), 10) == 0) { // Found the creator line - does it contain the word Illustrator? if (camStrstr( (const TCHAR*)Buffer, _T("Illustrator(R) 8")) != NULL) { HeaderFile.close(); return 10; } // Try to see if it's Illustrator 9. Again, remove this code when you're // writing a dedicated AI9 filter. else if (camStrstr( (const TCHAR*)Buffer, _T("Illustrator(R) 9")) != NULL) { HeaderFile.close(); return 9; } // Not an AI file. else { break; } } // If we find the compression token then stop the search as we don't want to // start looking in the compressed data! if (camStrncmp(Buffer, _T("%%Compression:"), 14)==0) break; } // Remember to close the file before returning. HeaderFile.close(); // Didn't find a suitable Creator line, but the EPS line was ok, so return // that we're interested, but not sure. return 5; } // If we find the compression token then stop the search as we don't want to start // looking in the compressed data! if (camStrncmp(Buffer, _T("%%Compression:"), 14)==0) break; } // Remember to close the file before returning. HeaderFile.close(); // This file type isn't suitable. return 0; }
void CFolderCrawler::WorkerThread() { HANDLE hWaitHandles[2]; hWaitHandles[0] = m_hTerminationEvent; hWaitHandles[1] = m_hWakeEvent; CTGitPath workingPath; bool bFirstRunAfterWakeup = false; DWORD currentTicks = 0; for(;;) { bool bRecursive = !!(DWORD)CRegStdDWORD(_T("Software\\TortoiseGit\\RecursiveOverlay"), TRUE); if (SysInfo::Instance().IsVistaOrLater()) { 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 (SysInfo::Instance().IsVistaOrLater()) { 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(); } CGitStatusCache::Instance().RemoveTimedoutBlocks(); if ((m_foldersToUpdate.size() == 0) && (m_pathsToUpdate.size() == 0)) { // Nothing left to do break; } currentTicks = GetTickCount(); if (m_pathsToUpdate.size()) { { AutoLocker lock(m_critSec); m_bPathsAddedSinceLastCrawl = false; workingPath = m_pathsToUpdate.Pop(); if ((!m_blockedPath.IsEmpty()) && (m_blockedPath.IsAncestorOf(workingPath))) { // move the path to the end of the list m_pathsToUpdate.Push(workingPath); if (m_pathsToUpdate.size() < 3) Sleep(50); continue; } } // don't crawl paths that are excluded if (!CGitStatusCache::Instance().IsPathAllowed(workingPath)) continue; if (!CGitStatusCache::Instance().IsPathGood(workingPath)) continue; // check if the changed path is inside an .git folder CString projectroot; if ((workingPath.HasAdminDir(&projectroot)&&workingPath.IsDirectory()) || workingPath.IsAdminDir()) { // we don't crawl for paths changed in a tmp folder inside an .git folder. // Because we also get notifications for those even if we just ask for the status! // And changes there don't affect the file status at all, so it's safe // to ignore notifications on those paths. if (workingPath.IsAdminDir()) { // TODO: add git specific filters here. is there really any change besides index file in .git // that is relevant for overlays? /*CString lowerpath = workingPath.GetWinPathString(); lowerpath.MakeLower(); if (lowerpath.Find(_T("\\tmp\\"))>0) continue; if (lowerpath.Find(_T("\\tmp")) == (lowerpath.GetLength()-4)) continue; if (lowerpath.Find(_T("\\log"))>0) continue;*/ // Here's a little problem: // the lock file is also created for fetching the status // and not just when committing. // If we could find out why the lock file was changed // we could decide to crawl the folder again or not. // But for now, we have to crawl the parent folder // no matter what. //if (lowerpath.Find(_T("\\lock"))>0) // continue; } else if (!workingPath.Exists()) { CGitStatusCache::Instance().WaitToWrite(); CGitStatusCache::Instance().RemoveCacheForPath(workingPath); CGitStatusCache::Instance().Done(); continue; } do { workingPath = workingPath.GetContainingDirectory(); } while(workingPath.IsAdminDir()); ATLTRACE(_T("Invalidating and refreshing folder: %s\n"), workingPath.GetWinPath()); { AutoLocker print(critSec); _stprintf_s(szCurrentCrawledPath[nCurrentCrawledpathIndex], MAX_CRAWLEDPATHSLEN, _T("Invalidating and refreshing folder: %s"), workingPath.GetWinPath()); nCurrentCrawledpathIndex++; if (nCurrentCrawledpathIndex >= MAX_CRAWLEDPATHS) nCurrentCrawledpathIndex = 0; } InvalidateRect(hWnd, NULL, FALSE); CGitStatusCache::Instance().WaitToRead(); // Invalidate the cache of this folder, to make sure its status is fetched again. CCachedDirectory * pCachedDir = CGitStatusCache::Instance().GetDirectoryCacheEntry(workingPath); if (pCachedDir) { git_wc_status_kind status = pCachedDir->GetCurrentFullStatus(); pCachedDir->Invalidate(); if (workingPath.Exists()) { pCachedDir->RefreshStatus(bRecursive); // if the previous status wasn't normal and now it is, then // send a notification too. // We do this here because GetCurrentFullStatus() doesn't send // notifications for 'normal' status - if it would, we'd get tons // of notifications when crawling a working copy not yet in the cache. if ((status != git_wc_status_normal)&&(pCachedDir->GetCurrentFullStatus() != status)) { CGitStatusCache::Instance().UpdateShell(workingPath); ATLTRACE(_T("shell update in crawler for %s\n"), workingPath.GetWinPath()); } } else { CGitStatusCache::Instance().Done(); CGitStatusCache::Instance().WaitToWrite(); CGitStatusCache::Instance().RemoveCacheForPath(workingPath); } } CGitStatusCache::Instance().Done(); //In case that svn_client_stat() modified a file and we got //a notification about that in the directory watcher, //remove that here again - this is to prevent an endless loop AutoLocker lock(m_critSec); m_pathsToUpdate.erase(workingPath); } else if (workingPath.HasAdminDir()) { if (!workingPath.Exists()) { CGitStatusCache::Instance().WaitToWrite(); CGitStatusCache::Instance().RemoveCacheForPath(workingPath); CGitStatusCache::Instance().Done(); continue; } if (!workingPath.Exists()) continue; ATLTRACE(_T("Updating path: %s\n"), workingPath.GetWinPath()); { AutoLocker print(critSec); _stprintf_s(szCurrentCrawledPath[nCurrentCrawledpathIndex], MAX_CRAWLEDPATHSLEN, _T("Updating path: %s"), workingPath.GetWinPath()); nCurrentCrawledpathIndex++; if (nCurrentCrawledpathIndex >= MAX_CRAWLEDPATHS) nCurrentCrawledpathIndex = 0; } InvalidateRect(hWnd, NULL, FALSE); // HasAdminDir() already checks if the path points to a dir DWORD flags = TGITCACHE_FLAGS_FOLDERISKNOWN; flags |= (workingPath.IsDirectory() ? TGITCACHE_FLAGS_ISFOLDER : 0); flags |= (bRecursive ? TGITCACHE_FLAGS_RECUSIVE_STATUS : 0); CGitStatusCache::Instance().WaitToRead(); // Invalidate the cache of folders manually. The cache of files is invalidated // automatically if the status is asked for it and the file times don't match // anymore, so we don't need to manually invalidate those. if (workingPath.IsDirectory()) { CCachedDirectory * cachedDir = CGitStatusCache::Instance().GetDirectoryCacheEntry(workingPath); if (cachedDir) cachedDir->Invalidate(); } CStatusCacheEntry ce = CGitStatusCache::Instance().GetStatusForPath(workingPath, flags); if (ce.GetEffectiveStatus() > git_wc_status_unversioned) { CGitStatusCache::Instance().UpdateShell(workingPath); ATLTRACE(_T("shell update in folder crawler for %s\n"), workingPath.GetWinPath()); } CGitStatusCache::Instance().Done(); AutoLocker lock(m_critSec); m_pathsToUpdate.erase(workingPath); } else { if (!workingPath.Exists()) { CGitStatusCache::Instance().WaitToWrite(); CGitStatusCache::Instance().RemoveCacheForPath(workingPath); CGitStatusCache::Instance().Done(); } } } else if (m_foldersToUpdate.size()) { { AutoLocker lock(m_critSec); m_bItemsAddedSinceLastCrawl = false; // create a new CTSVNPath object to make sure the cached flags are requested again. // without this, a missing file/folder is still treated as missing even if it is available // now when crawling. workingPath = CTGitPath(m_foldersToUpdate.Pop().GetWinPath()); if ((!m_blockedPath.IsEmpty())&&(m_blockedPath.IsAncestorOf(workingPath))) { // move the path to the end of the list m_foldersToUpdate.Push(workingPath); if (m_foldersToUpdate.size() < 3) Sleep(50); continue; } } if (DWORD(workingPath.GetCustomData()) >= currentTicks) { Sleep(50); continue; } if ((!m_blockedPath.IsEmpty())&&(m_blockedPath.IsAncestorOf(workingPath))) continue; if (!CGitStatusCache::Instance().IsPathAllowed(workingPath)) continue; if (!CGitStatusCache::Instance().IsPathGood(workingPath)) continue; ATLTRACE(_T("Crawling folder: %s\n"), workingPath.GetWinPath()); { AutoLocker print(critSec); _stprintf_s(szCurrentCrawledPath[nCurrentCrawledpathIndex], MAX_CRAWLEDPATHSLEN, _T("Crawling folder: %s"), workingPath.GetWinPath()); nCurrentCrawledpathIndex++; if (nCurrentCrawledpathIndex >= MAX_CRAWLEDPATHS) nCurrentCrawledpathIndex = 0; } InvalidateRect(hWnd, NULL, FALSE); CGitStatusCache::Instance().WaitToRead(); // Now, we need to visit this folder, to make sure that we know its 'most important' status CCachedDirectory * cachedDir = CGitStatusCache::Instance().GetDirectoryCacheEntry(workingPath.GetDirectory()); // 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()) { ATLTRACE(_T("Add watch path %s\n"), workingPath.GetWinPath()); CGitStatusCache::Instance().AddPathToWatch(workingPath); } if (cachedDir) cachedDir->Invalidate(); else { CGitStatusCache::Instance().Done(); CGitStatusCache::Instance().WaitToWrite(); CGitStatusCache::Instance().RemoveCacheForPath(workingPath); } } if (cachedDir) cachedDir->RefreshStatus(bRecursive); #if 0 // While refreshing the status, we could get another crawl request for the same folder. // This can happen if the crawled folder has a lower status than one of the child folders // (recursively). To avoid double crawlings, remove such a crawl request here AutoLocker lock(m_critSec); if (m_bItemsAddedSinceLastCrawl) { m_foldersToUpdate.erase(workingPath); } #endif CGitStatusCache::Instance().Done(); } } } _endthread(); }
bool launcherApplication::Elevate(const StringArray& commandLineArray) { #if defined(JUCE_LINUX) || defined(JUCE_BSD) if (geteuid() == 0) { return true; } String parameters("--user root /usr/bin/env "); const char *var = getenv("DISPLAY"); if (var) { String s("DISPLAY=" + String(var).quoted()); parameters += s + " "; } var = getenv("XAUTHORITY"); if (var) { String s("XAUTHORITY=" + String(var).quoted()); parameters += s + " "; } String launcher(File::getSpecialLocation( File::currentExecutableFile).getFullPathName()); if (launcher.contains(" ")) { launcher = launcher.quoted(); } parameters += String(" ") + launcher; for (int i = 0; i < commandLineArray.size(); i++) { parameters += " "; if (commandLineArray[i].contains(" ")) parameters += commandLineArray[i].quoted(); else parameters += commandLineArray[i]; } File pkexec("/usr/bin/pkexec"); if (pkexec.exists() && pkexec.startAsProcess(parameters)) { quit(); } pkexec = "/usr/local/bin/pkexec"; if (pkexec.exists() && pkexec.startAsProcess(parameters)) { quit(); } #elif defined(JUCE_WINDOWS) BOOL fIsRunAsAdmin = FALSE; DWORD dwError = ERROR_SUCCESS; PSID pAdministratorsGroup = NULL; SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY; if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pAdministratorsGroup)) { dwError = GetLastError(); goto cleanup; } if (!CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin)) { dwError = GetLastError(); goto cleanup; } cleanup: if (pAdministratorsGroup) { FreeSid(pAdministratorsGroup); pAdministratorsGroup = NULL; } if (dwError != ERROR_SUCCESS) { throw dwError; } if (fIsRunAsAdmin) { return true; } TCHAR szPath[MAX_PATH]; if (!GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath))) { dwError = GetLastError(); throw dwError; } String commandLine; for (int i = 0; i < commandLineArray.size(); i++) { if (commandLineArray[i].contains(" ")) { commandLine += String("\"") + commandLineArray[i] + String("\""); } else { commandLine += commandLineArray[i]; } if (i + 1 < commandLineArray.size()) { commandLine += " "; } } SHELLEXECUTEINFO sei = { 0 }; sei.cbSize = sizeof(SHELLEXECUTEINFO); sei.lpVerb = _T("runas"); sei.lpFile = szPath; sei.lpParameters = commandLine.toUTF8(); sei.nShow = SW_NORMAL; if (ShellExecuteEx(&sei)) { _exit(1); } #elif defined(JUCE_MAC) if (geteuid() == 0) { return true; } String launcher(File::getSpecialLocation( File::currentExecutableFile).getFullPathName()); const char * execpath = launcher.toRawUTF8(); char * args[] = { NULL }; OSStatus err; AuthorizationRef ref; AuthorizationFlags flags; flags = kAuthorizationFlagDefaults; err = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, flags, &ref); if ( err != errAuthorizationSuccess ) { quit(); } AuthorizationItem _temp = { kAuthorizationRightExecute, 0, NULL, 0 }; AuthorizationRights rights = { 1, &_temp }; flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights; err = AuthorizationCopyRights(ref, &rights, NULL, flags, NULL); if ( err != errAuthorizationSuccess ) { AuthorizationFree(ref, kAuthorizationFlagDefaults); quit(); } flags = kAuthorizationFlagDefaults; err = AuthorizationExecuteWithPrivileges(ref, execpath, flags, args, NULL); AuthorizationFree(ref, kAuthorizationFlagDefaults); // Probably overkill. if ( err != errAuthorizationSuccess ) { quit(); } #endif // JUCE_MAC return false; }
LRESULT PropPageTextStyles::onImport(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { tstring x = _T(""); if(WinUtil::browseFile(x, m_hWnd, false, x, types, defExt) == IDOK) { SimpleXML xml; xml.fromXML(File(Text::fromT(x), File::READ, File::OPEN).read()); xml.resetCurrentChild(); xml.stepIn(); if(xml.findChild(("Settings"))) { xml.stepIn(); importData("Font", TEXT_FONT); importData("BackgroundColor", BACKGROUND_COLOR); importData("TextColor", TEXT_COLOR); importData("DownloadBarColor", DOWNLOAD_BAR_COLOR); importData("UploadBarColor", UPLOAD_BAR_COLOR); importData("TextGeneralBackColor", TEXT_GENERAL_BACK_COLOR); importData("TextGeneralForeColor", TEXT_GENERAL_FORE_COLOR); importData("TextGeneralBold", TEXT_GENERAL_BOLD); importData("TextGeneralItalic", TEXT_GENERAL_ITALIC); importData("TextMyOwnBackColor", TEXT_MYOWN_BACK_COLOR); importData("TextMyOwnForeColor", TEXT_MYOWN_FORE_COLOR); importData("TextMyOwnBold", TEXT_MYOWN_BOLD); importData("TextMyOwnItalic", TEXT_MYOWN_ITALIC); importData("TextPrivateBackColor", TEXT_PRIVATE_BACK_COLOR); importData("TextPrivateForeColor", TEXT_PRIVATE_FORE_COLOR); importData("TextPrivateBold", TEXT_PRIVATE_BOLD); importData("TextPrivateItalic", TEXT_PRIVATE_ITALIC); importData("TextSystemBackColor", TEXT_SYSTEM_BACK_COLOR); importData("TextSystemForeColor", TEXT_SYSTEM_FORE_COLOR); importData("TextSystemBold", TEXT_SYSTEM_BOLD); importData("TextSystemItalic", TEXT_SYSTEM_ITALIC); importData("TextServerBackColor", TEXT_SERVER_BACK_COLOR); importData("TextServerForeColor", TEXT_SERVER_FORE_COLOR); importData("TextServerBold", TEXT_SERVER_BOLD); importData("TextServerItalic", TEXT_SERVER_ITALIC); importData("TextTimestampBackColor", TEXT_TIMESTAMP_BACK_COLOR); importData("TextTimestampForeColor", TEXT_TIMESTAMP_FORE_COLOR); importData("TextTimestampBold", TEXT_TIMESTAMP_BOLD); importData("TextTimestampItalic", TEXT_TIMESTAMP_ITALIC); importData("TextMyNickBackColor", TEXT_MYNICK_BACK_COLOR); importData("TextMyNickForeColor", TEXT_MYNICK_FORE_COLOR); importData("TextMyNickBold", TEXT_MYNICK_BOLD); importData("TextMyNickItalic", TEXT_MYNICK_ITALIC); importData("TextFavBackColor", TEXT_FAV_BACK_COLOR); importData("TextFavForeColor", TEXT_FAV_FORE_COLOR); importData("TextFavBold", TEXT_FAV_BOLD); importData("TextFavItalic", TEXT_FAV_ITALIC); importData("TextURLBackColor", TEXT_URL_BACK_COLOR); importData("TextURLForeColor", TEXT_URL_FORE_COLOR); importData("TextURLBold", TEXT_URL_BOLD); importData("TextURLItalic", TEXT_URL_ITALIC); importData("BoldAuthorsMess", BOLD_AUTHOR_MESS); importData("ProgressTextDown", PROGRESS_TEXT_COLOR_DOWN); importData("ProgressTextUp", PROGRESS_TEXT_COLOR_UP); importData("ErrorColor", ERROR_COLOR); importData("ProgressOverrideColors", PROGRESS_OVERRIDE_COLORS); importData("MenubarTwoColors", MENUBAR_TWO_COLORS); importData("MenubarLeftColor", MENUBAR_LEFT_COLOR); importData("MenubarRightColor", MENUBAR_RIGHT_COLOR); importData("MenubarBumped", MENUBAR_BUMPED); importData("Progress3DDepth", PROGRESS_3DDEPTH); importData("ProgressOverrideColors2", PROGRESS_OVERRIDE_COLORS2); importData("TextOPBackColor", TEXT_OP_BACK_COLOR); importData("TextOPForeColor", TEXT_OP_FORE_COLOR); importData("TextOPBold", TEXT_OP_BOLD); importData("TextOPItalic", TEXT_OP_ITALIC); importData("SearchAlternateColour", SEARCH_ALTERNATE_COLOUR); importData("ProgressBackColor", PROGRESS_BACK_COLOR); importData("ProgressCompressColor", PROGRESS_COMPRESS_COLOR); importData("ProgressSegmentColor", PROGRESS_SEGMENT_COLOR); importData("ColorDone", COLOR_DONE); importData("ColorDownloaded", COLOR_DOWNLOADED); importData("ColorRunning", COLOR_RUNNING); importData("IgnoredColor", IGNORED_COLOR); importData("FavoriteColor", FAVORITE_COLOR); importData("NormalColour", NORMAL_COLOUR); importData("PasiveColor", PASIVE_COLOR); importData("OpColor", OP_COLOR); importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE); importData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE); } xml.resetCurrentChild(); xml.stepOut(); } SendMessage(WM_DESTROY,0,0); //SettingsManager::getInstance()->save(); PropertiesDlg::needUpdate = true; SendMessage(WM_INITDIALOG,0,0); // RefreshPreview(); return 0; }
void CViewSockTrackerImage::OnDraw(CDC* pDC) { CDocument* pDoc = GetDocument(); // 這邊畫 圖片 ///////////////////////////////////////////////////////////////////// CRect RectImage; GetClientRect( &RectImage ); if(m_pBitmap != NULL && csInfomation == "" ) { CBitmap bmp; if(bmp.Attach(m_pBitmap)) { CString csW = _T(""); BITMAP bmpInfo; bmp.GetBitmap(&bmpInfo); CDC dcMemory; dcMemory.CreateCompatibleDC(pDC); dcMemory.SelectObject(&bmp); pDC->SetStretchBltMode(HALFTONE); pDC->StretchBlt(RectImage.left,RectImage.top,RectImage.Width(),RectImage.Height(),&dcMemory,0,0, bmpInfo.bmWidth,bmpInfo.bmHeight,SRCCOPY); bmp.Detach(); // m_w = bmpInfo.bmWidth; m_h = bmpInfo.bmHeight; } } // // 這邊畫 Pattern ROI ///////////////////////////////////////////////////////////////////// if(m_pBitmap != NULL && csInfomation == "" ) { CRect rect; COLORREF color = RGB(255, 255, 0); m_AlignRectTracker.SetRectColor( color ); m_AlignRectTracker.GetTrueRect(&rect); if( m_bLoadRect ) { m_bLoadRect = false; m_AlignRectTracker.m_rect = m_LoadRect; m_AlignRectTracker.Draw( pDC, m_LoadRect ); } else m_AlignRectTracker.Draw( pDC ); } ///////////////////////////////////////////////////////////////////// if( csInfomation != "" ) { CRect RectText; GetClientRect( &RectText ); int x = 0; int y = 0; x = 20; y = RectText.Height() / 2; pDC->TextOut( x, y, csInfomation ); pDC->TextOut( x, y + 15 , "Image is lost" ); csInfomation = ""; } // m_pBitmap = NULL; }
static VOID MainWndCommand(PMAIN_WND_INFO Info, WORD CmdId, HWND hControl) { UNREFERENCED_PARAMETER(hControl); switch (CmdId) { case IDC_PROP: { HTREEITEM hSelected = TreeView_GetSelection(Info->hTreeView); OpenPropSheet(Info->hTreeView, hSelected); } break; case IDC_REFRESH: { OnRefresh(Info); } break; case IDC_PROGHELP: { DisplayString(_T("Help is not yet implemented\n")); SetFocus(Info->hTreeView); } break; case IDC_EXIT: { PostMessage(Info->hMainWnd, WM_CLOSE, 0, 0); } break; case IDC_ABOUT: { DialogBox(hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), Info->hMainWnd, AboutDialogProc); SetFocus(Info->hTreeView); } break; case IDC_DEVBYTYPE: { Info->Display = DevicesByType; UpdateViewMenu(Info); OnRefresh(Info); } break; case IDC_DEVBYCONN: { Info->Display = DevicesByConnection; UpdateViewMenu(Info); OnRefresh(Info); } break; case IDC_SHOWHIDDEN: { Info->bShowHidden = !Info->bShowHidden; UpdateViewMenu(Info); OnRefresh(Info); } break; } }
void CMediaFormats::UpdateData(bool fSave) { if (fSave) { AfxGetApp()->WriteProfileString(_T("FileFormats"), NULL, NULL); AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspHandler"), m_iRtspHandler); AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), m_fRtspFileExtFirst); } else { RemoveAll(); #define ADDFMT(f) Add(CMediaFormatCategory##f) ADDFMT((_T("avi"), ResStr(IDS_MFMT_AVI), _T("avi"))); ADDFMT((_T("mpeg"), ResStr(IDS_MFMT_MPEG), _T("mpg mpeg mpe m1v m2v mpv2 mp2v pva evo m2p"))); ADDFMT((_T("mpegts"), ResStr(IDS_MFMT_MPEGTS), _T("ts tp trp m2t m2ts mts rec"))); ADDFMT((_T("dvdvideo"), ResStr(IDS_MFMT_DVDVIDEO), _T("vob ifo"))); ADDFMT((_T("mkv"), ResStr(IDS_MFMT_MKV), _T("mkv"))); ADDFMT((_T("webm"), ResStr(IDS_MFMT_WEBM), _T("webm"))); ADDFMT((_T("mp4"), ResStr(IDS_MFMT_MP4), _T("mp4 m4v mp4v mpv4 hdmov"))); ADDFMT((_T("mov"), ResStr(IDS_MFMT_MOV), _T("mov"), false, _T("QuickTime or QT Lite"))); ADDFMT((_T("3gp"), ResStr(IDS_MFMT_3GP), _T("3gp 3gpp 3ga"))); #ifdef _WIN64 ADDFMT((_T("3g2"), ResStr(IDS_MFMT_3G2), _T("3g2 3gp2"))); #else ADDFMT((_T("3g2"), ResStr(IDS_MFMT_3G2), _T("3g2 3gp2"), false, _T("QuickTime or QT Lite"), QuickTime)); #endif ADDFMT((_T("flv"), ResStr(IDS_MFMT_FLV), _T("flv f4v"))); ADDFMT((_T("ogm"), ResStr(IDS_MFMT_OGM), _T("ogm ogv"))); #ifdef _WIN64 ADDFMT((_T("rm"), ResStr(IDS_MFMT_RM), _T("rm ram rpm rmm"))); ADDFMT((_T("rt"), ResStr(IDS_MFMT_RT), _T("rt rp smi smil"))); #else ADDFMT((_T("rm"), ResStr(IDS_MFMT_RM), _T("rm ram rmm"), false, _T("RealPlayer or Real Alternative"), RealMedia)); ADDFMT((_T("rt"), ResStr(IDS_MFMT_RT), _T("rt rp smi smil"), false, _T("RealPlayer or Real Alternative"), RealMedia)); #endif ADDFMT((_T("wmv"), ResStr(IDS_MFMT_WMV), _T("wmv wmp wm asf"))); ADDFMT((_T("bink"), ResStr(IDS_MFMT_BINK), _T("smk bik"), false, _T("smackw32/binkw32.dll in dll path"))); ADDFMT((_T("flic"), ResStr(IDS_MFMT_FLIC), _T("fli flc flic"))); ADDFMT((_T("dsm"), ResStr(IDS_MFMT_DSM), _T("dsm dsv dsa dss"))); ADDFMT((_T("ivf"), ResStr(IDS_MFMT_IVF), _T("ivf"))); ADDFMT((_T("dvd2avi"), ResStr(IDS_MFMT_D2V), _T("d2v"))); ADDFMT((_T("swf"), ResStr(IDS_MFMT_SWF), _T("swf"), false, _T("ShockWave ActiveX control"), ShockWave)); ADDFMT((_T("other"), ResStr(IDS_MFMT_OTHER), _T("divx rmvb amv"))); ADDFMT((_T("ac3dts"), ResStr(IDS_MFMT_AC3), _T("ac3 dts"), true)); ADDFMT((_T("aiff"), ResStr(IDS_MFMT_AIFF), _T("aif aifc aiff"), true)); ADDFMT((_T("alac"), ResStr(IDS_MFMT_ALAC), _T("alac"), true)); ADDFMT((_T("amr"), ResStr(IDS_MFMT_AMR), _T("amr"), true)); ADDFMT((_T("ape"), ResStr(IDS_MFMT_APE), _T("ape apl"), true)); ADDFMT((_T("au"), ResStr(IDS_MFMT_AU), _T("au snd"), true)); ADDFMT((_T("audiocd"), ResStr(IDS_MFMT_CDA), _T("cda"), true)); ADDFMT((_T("flac"), ResStr(IDS_MFMT_FLAC), _T("flac"), true)); #ifdef _WIN64 ADDFMT((_T("m4a"), ResStr(IDS_MFMT_M4A), _T("m4a m4b m4r aac"), true)); #else ADDFMT((_T("m4a"), ResStr(IDS_MFMT_M4A), _T("m4a m4b m4r aac"), true, _T(""), QuickTime)); #endif ADDFMT((_T("midi"), ResStr(IDS_MFMT_MIDI), _T("mid midi rmi"), true)); ADDFMT((_T("mka"), ResStr(IDS_MFMT_MKA), _T("mka"), true)); ADDFMT((_T("mp3"), ResStr(IDS_MFMT_MP3), _T("mp3"), true)); ADDFMT((_T("mpa"), ResStr(IDS_MFMT_MPA), _T("mpa mp2 m1a m2a"), true)); ADDFMT((_T("mpc"), ResStr(IDS_MFMT_MPC), _T("mpc"), true)); ADDFMT((_T("ofr"), ResStr(IDS_MFMT_OFR), _T("ofr ofs"), true)); ADDFMT((_T("ogg"), ResStr(IDS_MFMT_OGG), _T("ogg oga"), true)); ADDFMT((_T("opus"), ResStr(IDS_MFMT_OPUS), _T("opus"), true)); #ifdef _WIN64 ADDFMT((_T("ra"), ResStr(IDS_MFMT_RA), _T("ra"), true)); #else ADDFMT((_T("ra"), ResStr(IDS_MFMT_RA), _T("ra"), true, _T("RealPlayer or Real Alternative"), RealMedia)); #endif ADDFMT((_T("tak"), ResStr(IDS_MFMT_TAK), _T("tak"), true)); ADDFMT((_T("tta"), ResStr(IDS_MFMT_TTA), _T("tta"), true)); ADDFMT((_T("wav"), ResStr(IDS_MFMT_WAV), _T("wav"), true)); ADDFMT((_T("wma"), ResStr(IDS_MFMT_WMA), _T("wma"), true)); ADDFMT((_T("wavpack"), ResStr(IDS_MFMT_WV), _T("wv"), true)); ADDFMT((_T("other_audio"), ResStr(IDS_MFMT_OTHER_AUDIO), _T("aob mlp"), true)); ADDFMT((_T("pls"), ResStr(IDS_MFMT_PLS), _T("asx m3u m3u8 pls wvx wax wmx mpcpl"))); ADDFMT((_T("bdpls"), ResStr(IDS_MFMT_BDPLS), _T("mpls bdmv"))); ADDFMT((_T("rar"), ResStr(IDS_MFMT_RAR), _T("rar"), false, _T("RARFileSource"), DirectShow, false)); #undef ADDFMT m_iRtspHandler = (engine_t)AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspHandler"), (int)RealMedia); m_fRtspFileExtFirst = !!AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), 1); } for (size_t i = 0; i < GetCount(); i++) { GetAt(i).UpdateData(fSave); } }
//---- Includes: -------------------------------------------* #include "stdafx.h" //#include "htmlhelp.h" #include "resource.h" #include "CSC_OnlineErr.h" #include "dlext.h" #include "utilif.h" static CEDL_STAT_DESC StateDescTbl[] = { {CEDL_STAT_STRT,_T("CEDL_STAT_STRT")}, {CEDL_STAT_IDLE,_T("CEDL_STAT_IDLE")}, {CEDL_STAT_ADAPT_2,_T("CEDL_STAT_ADAPT_2")}, {CEDL_STAT_WAIT_CONNECT,_T("CEDL_STAT_WAIT_CONNECT")}, {CEDL_STAT_GETDV,_T("CEDL_STAT_GETDV")}, {CEDL_STAT_ADAPT_1,_T("CEDL_STAT_ADAPT_1")}, {CEDL_STAT_DLCC,_T("CEDL_STAT_DLCC")}, {CEDL_STAT_UPCC,_T("CEDL_STAT_UPCC")}, {CEDL_STAT_DELCC,_T("CEDL_STAT_DELCC")}, {CEDL_STAT_ABORT,_T("CEDL_STAT_ABORT")} }; /* error description table for other error sources than the CEDL. CEDL error messages will be managed with CEDLError.mc. Errors coming from the CSC_Online will be managed with this table. */ static CEDL_ERR_DESC ErrorDescTbl[] = { {E_CSC_TRANSFER_SINGLE_DOWNLOADER_ALLOWED,IDS_CSC_SINGLE_DL_ALLOWED,_T("Only a single download session at the same time allowed to ATCM control")}, {E_CSC_NO_VALID_LICENSE_INFO,IDS_CSC_NO_VALID_LIC,_T("Cannot access license info for CSC_Online server")}, {E_CSC_NO_REMOTE_DLOAD_FOR_BUNDLE_ALLOWED,IDS_CSC_NO_REMOTE_DLOAD_FOR_BUNDLE,_T("This bundled license allows no remote download")},
VOID CreateUsage(VOID) { _tprintf(_T("Creates a service entry in the registry and Service Database.\n") _T("SYNTAX:\n") _T("sc create [service name] [binPath= ] <option1> <option2>...\n") _T("CREATE OPTIONS:\n") _T("NOTE: The option name includes the equal sign.\n") _T(" type= <own|share|interact|kernel|filesys|rec>\n") _T(" (default = own)\n") _T(" start= <boot|system|auto|demand|disabled>\n") _T(" (default = demand)\n") _T(" error= <normal|severe|critical|ignore>\n") _T(" (default = normal)\n") _T(" binPath= <BinaryPathName>\n") _T(" group= <LoadOrderGroup>\n") _T(" tag= <yes|no>\n") _T(" depend= <Dependencies(separated by / (forward slash))>\n") _T(" obj= <AccountName|ObjectName>\n") _T(" (default = LocalSystem)\n") _T(" DisplayName= <display name>\n") _T(" password= <password>\n")); }
VOID ConfigUsage(VOID) { _tprintf(_T("not yet implemented\n")); }
VOID MainUsage(VOID) { INT c; _tprintf(_T("DESCRIPTION:\n") _T("\tSC is a command line program used for communicating with\n") _T("\tthe Service Control Manager and its services.\n") _T("USAGE:\n") _T("\tsc <server> [command] [service name] <option1> <option2>...\n") _T("\tThe optional parameter <server> has the form \"\\ServerName\"\n") _T("\tFurther help on commands can be obtained by typing: \"sc [command]\"\n") _T("\tService Commands:\n") _T("\t query : Queries the status for a service, or\n") _T("\t enumerates the status for types of services.\n") _T("\t queryex : Queries the extended status for a service, or\n") _T("\t enumerates the status for types of services.\n") _T("\t start : Starts a service.\n") _T("\t pause : Sends a PAUSE control request to a service.\n") _T("\t interrogate : Sends a INTERROGATE control request to a service.\n") _T("\t continue : Sends a CONTINUE control request to a service.\n") _T("\t stop : Sends a STOP request to a service.\n") // "\t config : Changes the configuration of a service (persistant).\n" // "\t description : Changes the description of a service.\n" // "\t failure : Changes the actions taken by a service upon failure.\n" // "\t qc : Queries the configuration information for a service.\n" // "\t qdescription : Queries the description for a service.\n" // "\t qfailure : Queries the actions taken by a service upon failure.\n" _T("\t delete : Deletes a service (from the registry).\n") _T("\t create : Creates a service. (adds it to the registry).\n") _T("\t control : Sends a control to a service.\n")); // "\t sdshow : Displays a service's security descriptor.\n") // "\t sdset : Sets a service's security descriptor.\n") // "\t GetDisplayName : Gets the DisplayName for a service.\n") // "\t GetKeyName : Gets the ServiceKeyName for a service.\n") // "\t EnumDepend : Enumerates Service Dependencies.\n") // "\n") // "\tService Name Independant Commands:\n") // "\t boot : (ok | bad) Indicates whether the last boot should\n") // "\t be saved as the last-known-good boot configuration\n") // "\t Lock : Locks the SCM Database\n") // "\t QueryLock : Queries the LockStatus for the SCM Database\n") _tprintf(_T("\nWould you like to see help for the QUERY and QUERYEX commands? [ y | n ]: ")); c = _getch(); // _gettch isn't defined in our tchar.h _tprintf(_T("%c\n"), c); if (tolower(c) == 'y') { _tprintf(_T("QUERY and QUERYEX OPTIONS :\n") _T(" If the query command is followed by a service name, the status\n") _T(" for that service is returned. Further options do not apply in\n") _T(" this case. If the query command is followed by nothing or one of\n") _T(" the options listed below, the services are enumerated.\n") _T(" type= Type of services to enumerate (driver, service, interact, all)\n") _T(" (default = service)\n") _T(" state= State of services to enumerate (inactive, all)\n") _T(" (default = active)\n") /* _T(" bufsize= The size (in bytes) of the enumeration buffer\n") _T(" (default = 4096)\n") _T(" ri= The resume index number at which to begin the enumeration\n") _T(" (default = 0)\n") _T(" group= Service group to enumerate\n") _T(" (default = all groups)\n") */ _T("SYNTAX EXAMPLES\n") _T("sc query - Enumerates status for active services & drivers\n") _T("sc query messenger - Displays status for the messenger service\n") _T("sc queryex messenger - Displays extended status for the messenger service\n") _T("sc query type= driver - Enumerates only active drivers\n") _T("sc query type= service - Enumerates only Win32 services\n") _T("sc query state= all - Enumerates all services & drivers\n") // _T("sc query bufsize= 50 - Enumerates with a 50 byte buffer.\n") // _T("sc query ri= 14 - Enumerates with resume index = 14\n") // _T("sc queryex group= "" - Enumerates active services not in a group\n") _T("sc query type= service type= interact - Enumerates all interactive services\n") _T("sc query type= driver group= NDIS - Enumerates all NDIS drivers\n")); } }
void CProtoSettings::SetMsgFormat(int Flags, TCString Message) { if (Flags & (SMF_TEMPORARY | SMF_PERSONAL) && g_AutoreplyOptPage.GetDBValueCopy(IDC_REPLYDLG_RESETCOUNTERWHENSAMEICON) && GetMsgFormat(Flags & (SMF_TEMPORARY | SMF_PERSONAL)) != (const TCHAR*)Message) ResetSettingsOnStatusChange(szProto); if (Flags & SMF_TEMPORARY) { _ASSERT(!Status || Status == g_ProtoStates[szProto].Status); g_ProtoStates[szProto].TempMsg = (szProto || Message != NULL) ? Message : CProtoSettings(NULL, Status).GetMsgFormat(GMF_LASTORDEFAULT); } if (Flags & SMF_PERSONAL) { // set a "personal" message for a protocol. also it's used to set global status message (hContact = NULL). // if Message == NULL, then we'll use the "default" message - i.e. it's either the global message for szProto != NULL (we delete the per-proto DB setting), or it's just a default message for a given status for szProto == NULL. g_ProtoStates[szProto].TempMsg.Unset(); CString DBSetting(ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS)); if (Message != NULL) db_set_ts(NULL, MOD_NAME, DBSetting, Message); else { if (!szProto) db_set_ts(NULL, MOD_NAME, DBSetting, CProtoSettings(NULL, Status).GetMsgFormat(GMF_LASTORDEFAULT)); // global message can't be NULL; we can use an empty string instead if it's really necessary else db_unset(NULL, MOD_NAME, DBSetting); } } if (Flags & SMF_LAST) { COptPage MsgTreeData(g_MsgTreePage); COptItem_TreeCtrl *TreeCtrl = (COptItem_TreeCtrl*)MsgTreeData.Find(IDV_MSGTREE); TreeCtrl->DBToMem(CString(MOD_NAME)); int RecentGroupID = GetRecentGroupID(Status); if (RecentGroupID == -1) { // we didn't find the group, it also means that we're using per status messages; so we need to create it TreeCtrl->Value.AddElem(CTreeItem(Status ? pcli->pfnGetStatusModeDescription(Status, 0) : MSGTREE_RECENT_OTHERGROUP, g_Messages_RecentRootID, RecentGroupID = TreeCtrl->GenerateID(), TIF_GROUP)); TreeCtrl->SetModified(true); } int i; // try to find an identical message in the same group (to prevent saving multiple identical messages), // or at least if we'll find an identical message somewhere else, then we'll use its title for our new message TCString Title(_T("")); for (i = 0; i < TreeCtrl->Value.GetSize(); i++) { if (!(TreeCtrl->Value[i].Flags & TIF_GROUP) && TreeCtrl->Value[i].User_Str1 == (const TCHAR*)Message) { if (TreeCtrl->Value[i].ParentID == RecentGroupID) { // found it in the same group int GroupOrder = TreeCtrl->IDToOrder(RecentGroupID); TreeCtrl->Value.MoveElem(i, (GroupOrder >= 0) ? (GroupOrder + 1) : 0); // now move it to the top of recent messages list TreeCtrl->SetModified(true); break; // no reason to search for anything else } if (Title.IsEmpty()) // it's not in the same group, but at least we'll use its title Title = TreeCtrl->Value[i].Title; } } if (i == TreeCtrl->Value.GetSize()) { // we didn't find an identical message in the same group, so we'll add our new message here if (Title.IsEmpty()) { // didn't find a title for our message either if (Message.GetLen() > MRM_MAX_GENERATED_TITLE_LEN) Title = Message.Left(MRM_MAX_GENERATED_TITLE_LEN - 3) + _T("..."); else Title = Message; TCHAR *p = Title.GetBuffer(); while (*p) { // remove "garbage" if (!(p = _tcspbrk(p, _T("\r\n\t")))) break; *p++ = ' '; } Title.ReleaseBuffer(); } int GroupOrder = TreeCtrl->IDToOrder(RecentGroupID); TreeCtrl->Value.InsertElem(CTreeItem(Title, RecentGroupID, TreeCtrl->GenerateID(), 0, Message), (GroupOrder >= 0) ? (GroupOrder + 1) : 0); TreeCtrl->SetModified(true); } // now clean up here int MRMNum = 0; int MaxMRMNum = g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RECENTMSGSCOUNT); for (i = 0; i < TreeCtrl->Value.GetSize(); i++) { if (TreeCtrl->Value[i].ParentID == RecentGroupID) { // found a child of our group if (TreeCtrl->Value[i].Flags & TIF_GROUP || ++MRMNum > MaxMRMNum) { // what groups are doing here?! :)) TreeCtrl->Value.RemoveElem(i); TreeCtrl->SetModified(true); i--; } } } // if we're saving recent messages per status, then remove any messages that were left at the recent messages' root if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSMRM)) { for (i = 0; i < TreeCtrl->Value.GetSize(); i++) { if (TreeCtrl->Value[i].ParentID == g_Messages_RecentRootID) { if (!(TreeCtrl->Value[i].Flags & TIF_GROUP)) { TreeCtrl->Value.RemoveElem(i); TreeCtrl->SetModified(true); i--; } } } } TreeCtrl->MemToDB(CString(MOD_NAME)); } }
} } LRESULT PropPageTextStyles::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { m_lsbList.Detach(); m_Preview.Detach(); ctrlTabList.Detach(); cmdResetTab.Detach(); cmdSetTabColor.Detach(); ctrlTabExample.Detach(); return 1; } static const TCHAR types[] = _T("DC++ Theme Files\0*.dctheme;\0DC++ Settings Files\0*.xml;\0All Files\0*.*\0"); static const TCHAR defExt[] = _T(".dctheme"); #define importData(x, y) \ if(xml.findChild(x)) { SettingsManager::getInstance()->set(SettingsManager::y, xml.getChildData());} \ xml.resetCurrentChild(); LRESULT PropPageTextStyles::onImport(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { tstring x = _T(""); if(WinUtil::browseFile(x, m_hWnd, false, x, types, defExt) == IDOK) { SimpleXML xml; xml.fromXML(File(Text::fromT(x), File::READ, File::OPEN).read()); xml.resetCurrentChild(); xml.stepIn(); if(xml.findChild(("Settings"))) { xml.stepIn();
// returns the requested message; sets Order to the order of the message in the message tree, if available; or to -1 otherwise. TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) { TCString Message = NULL; if (pOrder) *pOrder = -1; if (Flags & GMF_TEMPORARY) { _ASSERT(!Status || Status == g_ProtoStates[szProto].Status); if (g_ProtoStates[szProto].TempMsg.IsSet()) { Message = g_ProtoStates[szProto].TempMsg; Flags &= ~GMF_PERSONAL; // don't allow personal message to overwrite our NULL temporary message } } if (Flags & GMF_PERSONAL && Message == NULL) // try getting personal message (it overrides global) Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (TCHAR*)NULL); if (Flags & GMF_PROTOORGLOBAL && Message == NULL) { Message = CProtoSettings().GetMsgFormat(GMF_PERSONAL | (Flags & GMF_TEMPORARY), pOrder); return (Message == NULL) ? _T("") : Message; // global message can't be NULL } if (Flags & GMF_LASTORDEFAULT && Message == NULL) { // try to get the last or default message, depending on current settings COptPage MsgTreeData(g_MsgTreePage); COptItem_TreeCtrl *TreeCtrl = (COptItem_TreeCtrl*)MsgTreeData.Find(IDV_MSGTREE); TreeCtrl->DBToMem(CString(MOD_NAME)); Message = NULL; if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USELASTMSG)) { // if using last message by default... Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (TCHAR*)NULL); // try per-protocol message first if (Message.IsEmpty()) { Message = NULL; // to be sure it's NULL, not "" - as we're checking 'Message == NULL' later int RecentGroupID = GetRecentGroupID(Status); if (RecentGroupID != -1) { for (int i = 0; i < TreeCtrl->Value.GetSize(); i++) { // find first message in the group if (TreeCtrl->Value[i].ParentID == RecentGroupID && !(TreeCtrl->Value[i].Flags & TIF_GROUP)) { Message = TreeCtrl->Value[i].User_Str1; if (pOrder) *pOrder = i; break; } } } } } // else, if using default message by default... if (Message == NULL) { // ...or we didn't succeed retrieving the last message // get default message for this status int DefMsgID = -1; static struct { int DBSetting, Status; } DefMsgDlgItems[] = { IDS_MESSAGEDLG_DEF_ONL, ID_STATUS_ONLINE, IDS_MESSAGEDLG_DEF_AWAY, ID_STATUS_AWAY, IDS_MESSAGEDLG_DEF_NA, ID_STATUS_NA, IDS_MESSAGEDLG_DEF_OCC, ID_STATUS_OCCUPIED, IDS_MESSAGEDLG_DEF_DND, ID_STATUS_DND, IDS_MESSAGEDLG_DEF_FFC, ID_STATUS_FREECHAT, IDS_MESSAGEDLG_DEF_INV, ID_STATUS_INVISIBLE, IDS_MESSAGEDLG_DEF_OTP, ID_STATUS_ONTHEPHONE, IDS_MESSAGEDLG_DEF_OTL, ID_STATUS_OUTTOLUNCH }; for (int i = 0; i < _countof(DefMsgDlgItems); i++) { if (DefMsgDlgItems[i].Status == Status) { DefMsgID = MsgTreeData.GetDBValue(DefMsgDlgItems[i].DBSetting); break; } } if (DefMsgID == -1) DefMsgID = MsgTreeData.GetDBValue(IDS_MESSAGEDLG_DEF_AWAY); // use away message for unknown statuses int Order = TreeCtrl->IDToOrder(DefMsgID); // this will return -1 in any case if something goes wrong if (Order >= 0) Message = TreeCtrl->Value[Order].User_Str1; if (pOrder) *pOrder = Order; } if (Message == NULL) Message = _T(""); // last or default message can't be NULL.. otherwise ICQ won't reply to status message requests and won't notify us of status message requests at all } return Message; }
LRESULT PropPageTextStyles::onExport(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { tstring x = _T(""); if(WinUtil::browseFile(x, m_hWnd, true, x, types, defExt) == IDOK) { SimpleXML xml; xml.addTag("DCPlusPlus"); xml.stepIn(); xml.addTag("Settings"); xml.stepIn(); string type("type"), curType("string"); exportData("Font", TEXT_FONT); curType = "int"; exportData("BackgroundColor", BACKGROUND_COLOR); exportData("TextColor", TEXT_COLOR); exportData("DownloadBarColor", DOWNLOAD_BAR_COLOR); exportData("UploadBarColor", UPLOAD_BAR_COLOR); exportData("TextGeneralBackColor", TEXT_GENERAL_BACK_COLOR); exportData("TextGeneralForeColor", TEXT_GENERAL_FORE_COLOR); exportData("TextGeneralBold", TEXT_GENERAL_BOLD); exportData("TextGeneralItalic", TEXT_GENERAL_ITALIC); exportData("TextMyOwnBackColor", TEXT_MYOWN_BACK_COLOR); exportData("TextMyOwnForeColor", TEXT_MYOWN_FORE_COLOR); exportData("TextMyOwnBold", TEXT_MYOWN_BOLD); exportData("TextMyOwnItalic", TEXT_MYOWN_ITALIC); exportData("TextPrivateBackColor", TEXT_PRIVATE_BACK_COLOR); exportData("TextPrivateForeColor", TEXT_PRIVATE_FORE_COLOR); exportData("TextPrivateBold", TEXT_PRIVATE_BOLD); exportData("TextPrivateItalic", TEXT_PRIVATE_ITALIC); exportData("TextSystemBackColor", TEXT_SYSTEM_BACK_COLOR); exportData("TextSystemForeColor", TEXT_SYSTEM_FORE_COLOR); exportData("TextSystemBold", TEXT_SYSTEM_BOLD); exportData("TextSystemItalic", TEXT_SYSTEM_ITALIC); exportData("TextServerBackColor", TEXT_SERVER_BACK_COLOR); exportData("TextServerForeColor", TEXT_SERVER_FORE_COLOR); exportData("TextServerBold", TEXT_SERVER_BOLD); exportData("TextServerItalic", TEXT_SERVER_ITALIC); exportData("TextTimestampBackColor", TEXT_TIMESTAMP_BACK_COLOR); exportData("TextTimestampForeColor", TEXT_TIMESTAMP_FORE_COLOR); exportData("TextTimestampBold", TEXT_TIMESTAMP_BOLD); exportData("TextTimestampItalic", TEXT_TIMESTAMP_ITALIC); exportData("TextMyNickBackColor", TEXT_MYNICK_BACK_COLOR); exportData("TextMyNickForeColor", TEXT_MYNICK_FORE_COLOR); exportData("TextMyNickBold", TEXT_MYNICK_BOLD); exportData("TextMyNickItalic", TEXT_MYNICK_ITALIC); exportData("TextFavBackColor", TEXT_FAV_BACK_COLOR); exportData("TextFavForeColor", TEXT_FAV_FORE_COLOR); exportData("TextFavBold", TEXT_FAV_BOLD); exportData("TextFavItalic", TEXT_FAV_ITALIC); exportData("TextURLBackColor", TEXT_URL_BACK_COLOR); exportData("TextURLForeColor", TEXT_URL_FORE_COLOR); exportData("TextURLBold", TEXT_URL_BOLD); exportData("TextURLItalic", TEXT_URL_ITALIC); exportData("BoldAuthorsMess", BOLD_AUTHOR_MESS); exportData("ProgressTextDown", PROGRESS_TEXT_COLOR_DOWN); exportData("ProgressTextUp", PROGRESS_TEXT_COLOR_UP); exportData("ErrorColor", ERROR_COLOR); exportData("ProgressOverrideColors", PROGRESS_OVERRIDE_COLORS); exportData("MenubarTwoColors", MENUBAR_TWO_COLORS); exportData("MenubarLeftColor", MENUBAR_LEFT_COLOR); exportData("MenubarRightColor", MENUBAR_RIGHT_COLOR); exportData("MenubarBumped", MENUBAR_BUMPED); exportData("Progress3DDepth", PROGRESS_3DDEPTH); exportData("ProgressOverrideColors2", PROGRESS_OVERRIDE_COLORS2); exportData("TextOPBackColor", TEXT_OP_BACK_COLOR); exportData("TextOPForeColor", TEXT_OP_FORE_COLOR); exportData("TextOPBold", TEXT_OP_BOLD); exportData("TextOPItalic", TEXT_OP_ITALIC); exportData("SearchAlternateColour", SEARCH_ALTERNATE_COLOUR); exportData("ProgressBackColor", PROGRESS_BACK_COLOR); exportData("ProgressCompressColor", PROGRESS_COMPRESS_COLOR); exportData("ProgressSegmentColor", PROGRESS_SEGMENT_COLOR); exportData("ColorDone", COLOR_DONE); exportData("ColorDownloaded", COLOR_DOWNLOADED); exportData("ColorRunning", COLOR_RUNNING); exportData("IgnoredColor", IGNORED_COLOR); exportData("FavoriteColor", FAVORITE_COLOR); exportData("NormalColour", NORMAL_COLOUR); exportData("PasiveColor", PASIVE_COLOR); exportData("OpColor", OP_COLOR); exportData("ProgressbaroDCStyle", PROGRESSBAR_ODC_STYLE); try { File ff(Text::fromT(x) , File::WRITE, File::CREATE | File::TRUNCATE); BufferedOutputStream<false> f(&ff); f.write(SimpleXML::utf8Header); xml.toXML(&f); f.flush(); ff.close(); } catch(const FileException&) { // ... } } return 0; }
// OUT TCHAR* tFullPath : provided pointer have be at least MAX_PATH TCHAR // bShowManualSearchDialogIfNotFound : TRUE to show Dialog Box to select dll when dll not found BOOL CDllFinder::FindDll(TCHAR* ImportingModulePath,TCHAR* tWorkingDirectory,TCHAR* tDllName,OUT TCHAR* tFullPath,BOOL bShowManualSearchDialogIfNotFound) { //The \WINNT\SYSTEM32 directory. //The directory of the executable for the process that is loading the DLL. //The current directory of the process that is loading the DLL. //The \WINNT directory. //A directory listed in the PATH environment variable. TCHAR psz[MAX_PATH]; TCHAR pszDirectory[MAX_PATH]; TCHAR DllName[MAX_PATH]; TCHAR* pstr; // in case full path is already specified if (CDllFinder::DoesFileExists(tDllName)) { _tcscpy(tFullPath,tDllName); return TRUE; } // remove directory if any _tcsncpy(DllName,tDllName,MAX_PATH); DllName[MAX_PATH-1]=0; pstr=_tcsrchr(tDllName,'\\'); if (pstr) _tcscpy(DllName,pstr); // check if file exists in SYSTEM32 path *pszDirectory=0; ::GetSystemDirectory(pszDirectory,MAX_PATH); _tcscpy(psz,pszDirectory); _tcscat(psz,DllName); if (CDllFinder::DoesFileExists(psz)) { _tcscpy(tFullPath,psz); return TRUE; } // check if file exists in WorkingDirectory if (tWorkingDirectory) { // forge full name _tcscpy(psz,tWorkingDirectory); // if directory doesn't ends with '\' add it if (tWorkingDirectory[_tcslen(tWorkingDirectory)-1]!='\\') _tcscat(psz,_T("\\")); _tcscat(psz,DllName); if (CDllFinder::DoesFileExists(psz)) { _tcscpy(tFullPath,psz); return TRUE; } } // check if file exists in Windows directory *pszDirectory=0; GetWindowsDirectory(pszDirectory,MAX_PATH); _tcscpy(psz,pszDirectory); _tcscat(psz,DllName); if (CDllFinder::DoesFileExists(psz)) { _tcscpy(tFullPath,psz); return TRUE; } // check environment path var TCHAR* pszEnvPath; DWORD size=1024; DWORD dwRet; pszEnvPath=new TCHAR[size]; dwRet=GetEnvironmentVariable(_T("Path"),pszEnvPath,size); if (dwRet!=0) { // if buffer is not large enough if (dwRet>size) { // increase buffer size size=dwRet; delete[] pszEnvPath; pszEnvPath=new TCHAR[size]; // query env path again GetEnvironmentVariable(_T("Path"),pszEnvPath,size); } // for each path in pszEnvPath TCHAR* pszPointer; TCHAR* pszPointerDir; pszPointerDir=pszEnvPath; while(pszPointerDir) { pszPointer=_tcschr(pszPointerDir,';'); if (pszPointer) { *pszPointer=0; pszPointer++; } if (*pszPointerDir==0) break; _tcscpy(psz,pszPointerDir); if (pszPointerDir[_tcslen(pszPointerDir)-1]!='\\') _tcscat(psz,_T("\\")); _tcscat(psz,DllName); // check if file exists if (CDllFinder::DoesFileExists(psz)) { _tcscpy(tFullPath,psz); delete[] pszEnvPath; return TRUE; } // point to the next dir pszPointerDir=pszPointer; } } delete[] pszEnvPath; // check for Assembly Identities // looks for "Retrieve the Assembly Identities from a Manifest using C++" article on CodeProject By marc ochsenmeier (www.winitor.net) 20 Jun 2010 if (CDllSideBySideAssembyFinder::FindSideBySideAssemby(ImportingModulePath,tWorkingDirectory,tDllName,tFullPath)) return TRUE; // not found #if (defined(TOOLS_NO_MESSAGEBOX)) UNREFERENCED_PARAMETER(bShowManualSearchDialogIfNotFound); #else if (bShowManualSearchDialogIfNotFound) { TCHAR pszTmp[2*MAX_PATH]; _stprintf(pszTmp,_T("File %s can't be found.\r\nDo you want to search it manually ?"),DllName); if (MessageBox(NULL,pszTmp,_T("Warning"),MB_YESNO|MB_ICONWARNING|MB_TOPMOST)==IDYES) { *psz=0; // open dialog OPENFILENAME ofn; memset(&ofn,0,sizeof (OPENFILENAME)); ofn.lStructSize=sizeof (OPENFILENAME); ofn.hwndOwner=NULL; ofn.hInstance=NULL; ofn.lpstrFilter=_T("exe, ocx, dll, tlb\0*.exe;*.ocx;*.dll;*.tlb\0All\0*.*\0"); ofn.nFilterIndex = 1; ofn.Flags=OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST; ofn.lpstrFile=DllName; ofn.nMaxFile=MAX_PATH; ofn.lpstrTitle=_T("Select dll file"); // get file name if (GetOpenFileName(&ofn)) { _tcscpy(tFullPath,DllName); return TRUE; } } } #endif return FALSE; }
bool CMsSynthRoot::InitBasketDivs(CMsUndByIDCollPtr pUndColl) { Trace(EODCO::enTrLogDebug,__FUNCTION__,_T("Start")); m_vecDivs.clear(); ATLASSERT(m_spSynthRootComp != NULL); if(m_bIsBasket) { if(pUndColl != NULL && m_spSynthRootComp->size() > 0) { CMsUndByIDCollPtr spUndColl(pUndColl); for(CMsUndWeightColl::iterator itSR = m_spSynthRootComp->begin(); itSR != m_spSynthRootComp->end(); itSR++) { const CMsUndWeightPtr& spSRComp = itSR->second; if(spSRComp->m_dWeight > 0.) { const CMsUndPtr spUnd(GetCollectionItem<CMsUndPtr>(spUndColl, spSRComp->m_nUndID)); if(spUnd) { if(enStStock == spUnd->Type()) { const CMsStockPtr spStock(boost::shared_dynamic_cast<EODMS::CMsStock>(spUnd)); ATLASSERT(spStock); if(spStock) { if(spStock->IsValidDivs(spStock->m_bUseCustDivs)) { REGULAR_DIVIDENDS aDiv; spStock->GetRegularDiv(spStock->m_bUseCustDivs, aDiv); aDiv.dAmount *= spSRComp->m_dWeight; m_vecDivs.push_back(aDiv); } } } else if(enStIndex == spUnd->Type()) { const CMsIndexPtr spIndex(boost::shared_dynamic_cast<EODMS::CMsIndex>(spUnd)); ATLASSERT(spIndex); if(spIndex) { if(spIndex->IsBasket()) { const CMsBasketIndexPtr spBasketIndex(boost::shared_dynamic_cast<CMsBasketIndex>(spIndex)); ATLASSERT(spBasketIndex); if(spBasketIndex) { REGULAR_DIVIDENDS aDiv; unsigned long nCount = spBasketIndex->BasketDivsCount(); for(unsigned long i = 0; i < nCount; i++) { spBasketIndex->BasketDiv(i, aDiv); aDiv.dAmount *= spSRComp->m_dWeight; m_vecDivs.push_back(aDiv); } } } } } } } } } else { Trace(EODCO::enTrLogDebug,__FUNCTION__,_T("Completed")); return false; } } Trace(EODCO::enTrLogDebug,__FUNCTION__,_T("Completed")); return true; }
const STRCHAR* STR_get_debugname() { return _T("predconfnucs"); }
* Generic utility functions */ #include "commonheaders.h" #include <string> #define MWF_LOG_BBCODE 1 #define MWF_LOG_TEXTFORMAT 0x2000000 #define MSGDLGFONTCOUNT 22 int Utils::rtf_ctable_size = 0; TRTFColorTable* Utils::rtf_ctable = 0; HANDLE CWarning::hWindowList = 0; static TCHAR *w_bbcodes_begin[] = { _T("[b]"), _T("[i]"), _T("[u]"), _T("[s]"), _T("[color=") }; static TCHAR *w_bbcodes_end[] = { _T("[/b]"), _T("[/i]"), _T("[/u]"), _T("[/s]"), _T("[/color]") }; static TCHAR *formatting_strings_begin[] = { _T("b1 "), _T("i1 "), _T("u1 "), _T("s1 "), _T("c1 ") }; static TCHAR *formatting_strings_end[] = { _T("b0 "), _T("i0 "), _T("u0 "), _T("s0 "), _T("c0 ") }; #define NR_CODES 5 LRESULT TSAPI _dlgReturn(HWND hWnd, LRESULT result) { SetWindowLongPtr(hWnd, DWLP_MSGRESULT, result); return(result); } void* Utils::safeAlloc(const size_t size) {
bool Camera_SSPIAGClass::Connect(const wxString& camId) { // returns true on error CameraDLL = LoadLibrary(TEXT("astroDLLsspiag")); if (CameraDLL == NULL) { wxMessageBox(_T("Cannot load astroDLLsspiag.dll"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_SetDevName = (Q5V_PCHAR)GetProcAddress(CameraDLL,"setDevName"); if (!Q5V_SetDevName) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have setDevName"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_GetFullSizeImage = (Q5V_UPCHAR)GetProcAddress(CameraDLL,"getFullSizeImage"); if (!Q5V_GetFullSizeImage) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have getFullSizeImage"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_RowNoiseReductionMethod = (Q5V_UC)GetProcAddress(CameraDLL,"RowNoiseReductionMethod"); if (!Q5V_RowNoiseReductionMethod) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have RowNoiseReductionMethod"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_BlackCalibration = (Q5V_UC)GetProcAddress(CameraDLL,"BlackCalibration"); if (!Q5V_BlackCalibration) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have BlackCalibration"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_RowNoiseConstant = (Q5V_UC)GetProcAddress(CameraDLL,"RowNoiseConstant"); if (!Q5V_RowNoiseConstant) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have RowNoiseConstant"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_OpenQHY5V = (Q5V_UC_V)GetProcAddress(CameraDLL,"openQHY5V"); if (!Q5V_OpenQHY5V) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have openQHY5V"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_AGC_Enable = (Q5V_INT)GetProcAddress(CameraDLL,"AGC_enable"); if (!Q5V_AGC_Enable) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have AGC_enable"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_AEC_Enable = (Q5V_INT)GetProcAddress(CameraDLL,"AEC_enable"); if (!Q5V_AEC_Enable) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have AEC_enable"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_BitCompanding = (Q5V_INT)GetProcAddress(CameraDLL,"bitCompanding"); if (!Q5V_BitCompanding) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have bitCompanding"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_LongExpMode = (Q5V_INT)GetProcAddress(CameraDLL,"LongExpMode"); if (!Q5V_LongExpMode) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have LongExpMode"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_HighDynamic = (Q5V_INT)GetProcAddress(CameraDLL,"HighDynamic"); if (!Q5V_HighDynamic) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have HighDynamic"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_BlackOffset = (Q5V_INT)GetProcAddress(CameraDLL,"BlackOffset"); if (!Q5V_BlackOffset) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have BlackOffset"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_HighGainBoost = (Q5V_UC)GetProcAddress(CameraDLL,"HighGainBoost"); if (!Q5V_HighGainBoost) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have HighGainBoost"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_SetQHY5VGlobalGain = (Q5V_US)GetProcAddress(CameraDLL,"setQHY5VGlobalGain"); if (!Q5V_SetQHY5VGlobalGain) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have setQHY5VGlobalGain"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_SetTotalShutterWidth = (Q5V_US)GetProcAddress(CameraDLL,"setTotalShutterWidth"); if (!Q5V_SetTotalShutterWidth) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have setTotalShutterWidth"),_("Error"),wxOK | wxICON_ERROR); return true; } /* Q5V_RowNoiseReduction = (Q5V_ROWNR)GetProcAddress(CameraDLL,"RowNoiseReduction"); if (!Q5V_RowNoiseReduction) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have RowNoiseReduction"),_("Error"),wxOK | wxICON_ERROR); return true; }*/ Q5V_ReadMode = (Q5V_RMODE)GetProcAddress(CameraDLL,"ReadMode"); if (!Q5V_ReadMode) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have ReadMode"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_SetLongExpTime = (Q5V_UL)GetProcAddress(CameraDLL,"setLongExpTime"); if (!Q5V_SetLongExpTime) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have setLongExpTime"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_QHY5VInit = (Q5V_V)GetProcAddress(CameraDLL,"QHY5VInit"); if (!Q5V_QHY5VInit) { FreeLibrary(CameraDLL); wxMessageBox(_T("astroDLLsspiag.dll does not have QHY5VInit"),_("Error"),wxOK | wxICON_ERROR); return true; } GenericDLL = LoadLibrary(TEXT("SSPIAGCAM.dll")); if (GenericDLL == NULL) { wxMessageBox(_T("Cannot load SSPIAGCAM.dll"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_SendGuideCommand = (Q5V_GUIDE)GetProcAddress(GenericDLL,"sendGuideCommand"); if (!Q5V_SendGuideCommand) { FreeLibrary(GenericDLL); FreeLibrary(CameraDLL); wxMessageBox(_T("SSPIAGCAM.dll does not have sendGuideCommand"),_("Error"),wxOK | wxICON_ERROR); return true; } Q5V_SetDevName("SSPIA-0"); if (!Q5V_OpenQHY5V()) { wxMessageBox(_T("Failed to open the camera"), _("Error")); return true; } if (RawBuffer) delete [] RawBuffer; RawBuffer = new unsigned char[856*500]; Q5V_QHY5VInit(); Q5V_GetFullSizeImage(RawBuffer); wxMilliSleep(100); Q5V_QHY5VInit(); Q5V_GetFullSizeImage(RawBuffer); Q5V_ReadMode(0,0,1,1); Q5V_GetFullSizeImage(RawBuffer); Q5V_BlackOffset(5); Q5V_GetFullSizeImage(RawBuffer); Q5V_BlackCalibration(0); Q5V_GetFullSizeImage(RawBuffer); Q5V_RowNoiseConstant(10); Q5V_GetFullSizeImage(RawBuffer); Q5V_RowNoiseReductionMethod(1); Q5V_GetFullSizeImage(RawBuffer); // Q5V_HighGainBoost(255); // Q5V_GetFullSizeImage(RawBuffer); Q5V_AEC_Enable(0); Q5V_GetFullSizeImage(RawBuffer); Q5V_AGC_Enable(0); Q5V_GetFullSizeImage(RawBuffer); Q5V_LongExpMode(1); Q5V_GetFullSizeImage(RawBuffer); Q5V_SetQHY5VGlobalGain(60); Q5V_GetFullSizeImage(RawBuffer); Connected = true; return false; }
BOOL ShellCache::IsPathAllowed(LPCTSTR path) { ValidatePathFilter(); Locker lock(m_critSec); svn_tristate_t allowed = pathFilter.IsPathAllowed (path); if (allowed != svn_tristate_unknown) return allowed == svn_tristate_true ? TRUE : FALSE; UINT drivetype = 0; int drivenumber = PathGetDriveNumber(path); if ((drivenumber >=0)&&(drivenumber < 25)) { drivetype = drivetypecache[drivenumber]; if ((drivetype == -1)||((GetTickCount64() - drivetypeticker)>DRIVETYPETIMEOUT)) { if ((DWORD(drivefloppy) == 0)&&((drivenumber == 0)||(drivenumber == 1))) drivetypecache[drivenumber] = DRIVE_REMOVABLE; else { drivetypeticker = GetTickCount64(); TCHAR pathbuf[MAX_PATH + 4] = { 0 }; // MAX_PATH ok here. PathStripToRoot works with partial paths too. wcsncpy_s(pathbuf, path, _countof(pathbuf)-1); PathStripToRoot(pathbuf); PathAddBackslash(pathbuf); CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": GetDriveType for %s, Drive %d\n", pathbuf, drivenumber); drivetype = GetDriveType(pathbuf); drivetypecache[drivenumber] = drivetype; } } } else { TCHAR pathbuf[MAX_PATH + 4] = { 0 }; // MAX_PATH ok here. PathIsUNCServer works with partial paths too. wcsncpy_s(pathbuf, path, _countof(pathbuf)-1); if (PathIsUNCServer(pathbuf)) drivetype = DRIVE_REMOTE; else { PathStripToRoot(pathbuf); PathAddBackslash(pathbuf); if (wcsncmp(pathbuf, drivetypepathcache, MAX_PATH-1)==0) // MAX_PATH ok. drivetype = drivetypecache[26]; else { CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L"GetDriveType for %s\n", pathbuf); drivetype = GetDriveType(pathbuf); drivetypecache[26] = drivetype; wcsncpy_s(drivetypepathcache, pathbuf, MAX_PATH); // MAX_PATH ok. } } } if ((drivetype == DRIVE_REMOVABLE)&&(!IsRemovable())) return FALSE; if ((drivetype == DRIVE_FIXED)&&(!IsFixed())) return FALSE; if (((drivetype == DRIVE_REMOTE)||(drivetype == DRIVE_NO_ROOT_DIR))&&(!IsRemote())) return FALSE; if ((drivetype == DRIVE_CDROM)&&(!IsCDRom())) return FALSE; if ((drivetype == DRIVE_RAMDISK)&&(!IsRAM())) return FALSE; if ((drivetype == DRIVE_UNKNOWN)&&(IsUnknown())) return FALSE; return TRUE; }
CPapersInfoSave4TyDlg::CPapersInfoSave4TyDlg(CWnd* pParent /*=NULL*/) : CDialog(CPapersInfoSave4TyDlg::IDD, pParent) , m_strExamID(_T("")) { }
} nosimpletags: if(clr_added) *clr_added = clr_was_added; return(message.c_str()); } #endif // formatting the titlebar // free() the return value // #if defined(_UNICODE) || defined(UNICODE) static TCHAR *title_variables[] = { _T("%n"), _T("%s"), _T("%u"), _T("%p"), _T("%c"), _T("%x"), _T("%m")}; #define NR_VARS 7 extern "C" int MY_DBGetContactSettingTString(HANDLE hContact, char *szModule, char *szSetting, DBVARIANT *dbv); extern "C" int MY_DBFreeVariant(DBVARIANT *dbv); extern "C" WCHAR *NewTitle(HANDLE hContact, const TCHAR *szFormat, const TCHAR *szNickname, const char *szStatus, const TCHAR *szContainer, const char *szUin, const char *szProto, DWORD idle, UINT codePage, BYTE xStatus, WORD wStatus) { TCHAR *szResult = 0; int length = 0; int i, tempmark = 0; TCHAR szTemp[512]; std::wstring title(szFormat); while(TRUE) {
Replay(Logger *_logger, ProtectedTaskManager &_task_manager) :time_scale(fixed(1)), replay(NULL), logger(_logger), task_manager(_task_manager) { path[0] = _T('\0'); }
//---------------------------------------------------------------------------------- __declspec( dllexport ) const TCHAR* LibDescription() { return _T("OpenES exporter");//GetString(IDS_LIBDESCRIPTION); }
BOOL CTcpFilterApp::InitInstance() { // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // Create the shell manager, in case the dialog contains // any shell tree view or shell list view controls. CShellManager *pShellManager = new CShellManager; // Activate "Windows Native" visual manager for enabling themes in MFC controls CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); CTcpFilterDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } else if (nResponse == -1) { TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n"); TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n"); } // Delete the shell manager created above. if (pShellManager != NULL) { delete pShellManager; } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }