int GuiMessageBox(HWND hConEmuWndRoot, LPCWSTR asText, LPCWSTR asTitle, int anBtns) { int nResult = 0; if (hConEmuWndRoot) { HWND hConWnd = myGetConsoleWindow(); CESERVER_REQ *pIn = (CESERVER_REQ*)malloc(sizeof(*pIn)); ExecutePrepareCmd(pIn, CECMD_ASSERT, sizeof(CESERVER_REQ_HDR)+sizeof(MyAssertInfo)); pIn->AssertInfo.nBtns = anBtns; _wcscpyn_c(pIn->AssertInfo.szTitle, countof(pIn->AssertInfo.szTitle), asTitle, countof(pIn->AssertInfo.szTitle)); //-V501 _wcscpyn_c(pIn->AssertInfo.szDebugInfo, countof(pIn->AssertInfo.szDebugInfo), asText, countof(pIn->AssertInfo.szDebugInfo)); //-V501 wchar_t szGuiPipeName[128]; msprintf(szGuiPipeName, countof(szGuiPipeName), CEGUIPIPENAME, L".", LODWORD(hConEmuWndRoot)); CESERVER_REQ* pOut = ExecuteCmd(szGuiPipeName, pIn, 1000, hConWnd); free(pIn); if (pOut) { if (pOut->hdr.cbSize > sizeof(CESERVER_REQ_HDR)) { nResult = pOut->dwData[0]; } ExecuteFreeResult(pOut); } } else { //_ASSERTE(hConEmuWndRoot!=NULL); // Избежать статической линковки к user32 HMODULE hUser32 = GetModuleHandle(L"User32.dll"); if (hUser32 == NULL) hUser32 = LoadLibrary(L"User32.dll"); typedef int (WINAPI* MessageBoxW_T)(HWND, LPCWSTR, LPCWSTR, UINT); MessageBoxW_T _MessageBoxW = hUser32 ? (MessageBoxW_T)GetProcAddress(hUser32, "MessageBoxW") : NULL; if (_MessageBoxW) { nResult = _MessageBoxW(NULL, asText, asTitle, MB_SYSTEMMODAL|anBtns); } else { #ifdef _DEBUG _CrtDbgBreak(); #endif } } return nResult; }
void getWindowInfo(HWND ahWnd, wchar_t (&rsInfo)[1024], bool bProcessName /*= false*/, LPDWORD pnPID /*= NULL*/) { DWORD nPID = 0; if (!ahWnd) { wcscpy_c(rsInfo, L"<NULL>"); } else if (!IsWindow(ahWnd)) { msprintf(rsInfo, countof(rsInfo), L"0x%08X: Invalid window handle", LODWORD(ahWnd)); } else { wchar_t szClass[256], szTitle[512]; wchar_t szProc[120] = L""; if (!GetClassName(ahWnd, szClass, 256)) wcscpy_c(szClass, L"<GetClassName failed>"); if (!GetWindowText(ahWnd, szTitle, 512)) szTitle[0] = 0; if (bProcessName || pnPID) { if (GetWindowThreadProcessId(ahWnd, &nPID)) { PROCESSENTRY32 pi = {}; if (bProcessName && GetProcessInfo(nPID, &pi)) { pi.szExeFile[100] = 0; msprintf(szProc, countof(szProc), L" - %s [%u]", pi.szExeFile, nPID); } } } msprintf(rsInfo, countof(rsInfo), L"0x%08X: %s - '%s'%s", LODWORD(ahWnd), szClass, szTitle, szProc); } if (pnPID) *pnPID = nPID; }
void __cdecl xf_free ( void * _Memory #ifdef TRACK_MEMORY_ALLOCATIONS , LPCSTR lpszFileName, int nLine #endif ) { if (!ghHeap || !_Memory) { //_ASSERTE(ghHeap && _Memory); #ifdef _DEBUG _CrtDbgBreak(); #endif return; } #ifdef TRACK_MEMORY_ALLOCATIONS xf_mem_block* p = ((xf_mem_block*)_Memory)-1; if (p->bBlockUsed == TRUE) { int nCCcmp = memcmp(((LPBYTE)_Memory)+p->nBlockSize, "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC", 8); _ASSERTE(nCCcmp == 0); memset(_Memory, 0xFD, p->nBlockSize); } else { _ASSERTE(p->bBlockUsed == TRUE); } p->bBlockUsed = FALSE; msprintf(p->sCreatedFrom, countof(p->sCreatedFrom), "-- %s:%i", _PointToName(lpszFileName), nLine); _Memory = (void*)p; #endif #ifdef _DEBUG size_t _Size1 = HeapSize(ghHeap, 0, _Memory); _ASSERTE(_Size1 > 0); #endif HeapFree(ghHeap, 0, _Memory); #ifdef FORCE_HEAP_CHECK xf_dump_chk(); #endif //#ifdef _DEBUG //SIZE_T _Size2 = HeapSize(ghHeap, 0, _Memory); //if (_Size1 == _Size2) { // _ASSERTE(_Size1 != _Size2); //} //#endif }
// hConEmuWnd - HWND с отрисовкой! void SetConEmuEnvVar(HWND hConEmuWnd) { if (hConEmuWnd) { // Установить переменную среды с дескриптором окна wchar_t szVar[16]; msprintf(szVar, countof(szVar), L"0x%08X", (DWORD)hConEmuWnd); //-V205 SetEnvironmentVariable(ENV_CONEMUHWND_VAR_W, szVar); } else { SetEnvironmentVariable(ENV_CONEMUHWND_VAR_W, NULL); } }
// Выполнить в ConEmuHk CESERVER_REQ* ExecuteHkCmd(DWORD dwHkPID, CESERVER_REQ* pIn, HWND hOwner) { wchar_t szPipeName[128]; if (!dwHkPID) return NULL; DWORD nLastErr = GetLastError(); //_wsprintf(szPipeName, SKIPLEN(countof(szPipeName)) CESERVERPIPENAME, L".", (DWORD)dwSrvPID); msprintf(szPipeName, countof(szPipeName), CEHOOKSPIPENAME, L".", (DWORD)dwHkPID); CESERVER_REQ* lpRet = ExecuteCmd(szPipeName, pIn, 1000, hOwner); SetLastError(nLastErr); // Чтобы не мешать процессу своими возможными ошибками общения с пайпом return lpRet; }
void SetConEmuEnvHWND(LPCWSTR pszVarName, HWND hWnd) { if (hWnd) { // Установить переменную среды с дескриптором окна wchar_t szVar[16]; msprintf(szVar, countof(szVar), L"0x%08X", (DWORD)(DWORD_PTR)hWnd); //-V205 SetEnvironmentVariable(pszVarName, szVar); } else { SetEnvironmentVariable(pszVarName, NULL); } }
HANDLE WINAPI OnOpenFileMappingW(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName) { //typedef HANDLE (WINAPI* OnOpenFileMappingW_t)(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName); ORIGINAL_KRNL(OpenFileMappingW); HANDLE hRc = FALSE; extern BOOL gbTrueColorServerRequested; if (ghConEmuWndDC && lpName && *lpName && !gbTrueColorServerRequested) { /** * Share name to search for * Two replacements: * %d sizeof(AnnotationInfo) - compatibility/versioning field. * %d console window handle */ wchar_t szTrueColorMap[64]; // #define L"Console_annotationInfo_%x_%x" msprintf(szTrueColorMap, countof(szTrueColorMap), AnnotationShareName, (DWORD)sizeof(AnnotationInfo), ghConEmuWndDC); // При попытке открыть мэппинг для TrueColor - перейти в режим локального сервера if (lstrcmpi(lpName, szTrueColorMap) == 0) { RequestLocalServerParm Parm = {(DWORD)sizeof(Parm), slsf_RequestTrueColor|slsf_GetCursorEvent}; if (RequestLocalServer(&Parm) == 0) { if (Parm.pAnnotation) { gpAnnotationHeader = Parm.pAnnotation; hRc = (HANDLE)Parm.pAnnotation; goto wrap; } else { WARNING("Перенести обработку AnnotationShareName в хуки"); } if (ghConsoleCursorChanged && (ghConsoleCursorChanged != Parm.hCursorChangeEvent)) CloseHandle(ghConsoleCursorChanged); ghConsoleCursorChanged = Parm.hCursorChangeEvent; gfnSrvLogString = Parm.fSrvLogString; } } } hRc = F(OpenFileMappingW)(dwDesiredAccess, bInheritHandle, lpName); wrap: return hRc; }
// Выполнить в ConEmuC CESERVER_REQ* ExecuteSrvCmd(DWORD dwSrvPID, CESERVER_REQ* pIn, HWND hOwner, BOOL bAsyncNoResult, DWORD nTimeout /*= 0*/) { wchar_t szPipeName[128]; if (!dwSrvPID) return NULL; DWORD nLastErr = GetLastError(); //_wsprintf(szPipeName, SKIPLEN(countof(szPipeName)) CESERVERPIPENAME, L".", (DWORD)dwSrvPID); msprintf(szPipeName, countof(szPipeName), CESERVERPIPENAME, L".", (DWORD)dwSrvPID); CESERVER_REQ* lpRet = ExecuteCmd(szPipeName, pIn, nTimeout, hOwner, bAsyncNoResult, dwSrvPID); _ASSERTE(pIn->hdr.bAsync == bAsyncNoResult); SetLastError(nLastErr); // Чтобы не мешать процессу своими возможными ошибками общения с пайпом return lpRet; }
int WINAPI UnMountVirtualHive(LPCWSTR asXPMountName, wchar_t* pszErrInfo, int cchErrInfoMax) { int lRc = -1; CBackupPrivileges se; HMODULE hAdvapi32 = LoadLibrary(L"advapi32.dll"); if (!hAdvapi32) { if (pszErrInfo && cchErrInfoMax) msprintf(pszErrInfo, cchErrInfoMax, L"LoadLibrary(advapi32.dll) failed, code=0x%08X!\n", GetLastError()); lRc = -2; goto wrap; } if (!se.BackupPrivilegesAcuire(TRUE)) { if (pszErrInfo && cchErrInfoMax) msprintf(pszErrInfo, cchErrInfoMax, L"Aquiring SE_BACKUP_NAME/SE_RESTORE_NAME failed, code=0x%08X!\nYou must be Administrator or Backup operator", GetLastError()); goto wrap; } if ((lRc = RegUnLoadKey(HKEY_USERS, asXPMountName)) != 0) { if (pszErrInfo && cchErrInfoMax) msprintf(pszErrInfo, cchErrInfoMax, L"RegUnLoadKey failed, code=0x%08X!", (DWORD)lRc); } wrap: if (hAdvapi32) FreeLibrary(hAdvapi32); // Decrease counter return lRc; }
eOSState cMenuSetupSubMenu::Help() { const char* ItemText = Get(Current())->Text(); eOSState state = osContinue; if(Current() < (int) helpTexts.size()) { char* title = NULL; msprintf(&title, "%s - %s", tr("Button$Help"), ItemText); if (strchr(title, ':')) *strchr(title, ':') = 0; state = AddSubMenu(new cMenuText(title, helpTexts[Current()])); free(title); } return state; }
int CDefTermHk::DisplayLastError(LPCWSTR asLabel, DWORD dwError/*=0*/, DWORD dwMsgFlags/*=0*/, LPCWSTR asTitle/*=NULL*/, HWND hParent/*=NULL*/) { if (dwError) { wchar_t szInfo[64]; msprintf(szInfo, countof(szInfo), L", ErrCode=x%X(%i)", dwError, (int)dwError); CEStr lsMsg = lstrmerge(asLabel, szInfo); LogHookingStatus(lsMsg); } else { LogHookingStatus(asLabel); } return 0; }
void SetConEmuEnvVar(HWND hConEmuWnd) { SetConEmuEnvHWND(ENV_CONEMUHWND_VAR_W, hConEmuWnd); if (hConEmuWnd) { DWORD nPID = 0; GetWindowThreadProcessId(hConEmuWnd, &nPID); wchar_t szVar[16]; msprintf(szVar, countof(szVar), L"%u", nPID); SetEnvironmentVariable(ENV_CONEMUPID_VAR_W, szVar); } else { SetEnvironmentVariable(ENV_CONEMUPID_VAR_W, NULL); } }
/************************************************************************* * This function writes out the partition vector **************************************************************************/ void WritePermutation(char *fname, idxtype *iperm, idxtype n) { FILE *fpout; idxtype i; char filename[256]; msprintf(filename,"%s.iperm",fname); fpout = gk_fopen(filename, "w", __func__); for (i=0; i<n; i++) fprintf(fpout, "%" PRIIDX "\n", iperm[i]); gk_fclose(fpout); }
/************************************************************************* * This function writes out the partition vector **************************************************************************/ void WritePartition(char *fname, idxtype *part, idxtype n, idxtype nparts) { FILE *fpout; idxtype i; char filename[256]; msprintf(filename,"%s.part.%D",fname, nparts); fpout = gk_fopen(filename, "w", __func__); for (i=0; i<n; i++) fprintf(fpout,"%" PRIIDX "\n", part[i]); gk_fclose(fpout); }
MSectionLock::~MSectionLock() { _ASSERTEX((mb_Locked==FALSE || mb_Locked==TRUE) && (mb_Exclusive==FALSE || mb_Exclusive==TRUE)); if (mb_Locked) { DWORD nCurTID = GetCurrentThreadId(); Unlock(); #ifdef _DEBUG wchar_t szDbg[80]; msprintf(szDbg, countof(szDbg), L"::~MSectionLock, TID=%u\n", nCurTID); DebugString(szDbg); #endif UNREFERENCED_PARAMETER(nCurTID); } }
void SetConEmuWorkEnvVar(HMODULE hConEmuCD) { wchar_t szPath[MAX_PATH*2] = L""; GetCurrentDirectory(countof(szPath), szPath); SetEnvironmentVariable(ENV_CONEMUWORKDIR_VAR_W, szPath); wchar_t szDrive[MAX_PATH]; SetEnvironmentVariable(ENV_CONEMUWORKDRIVE_VAR_W, GetDrive(szPath, szDrive, countof(szDrive))); GetModuleFileName(hConEmuCD, szPath, countof(szPath)); SetEnvironmentVariable(ENV_CONEMUDRIVE_VAR_W, GetDrive(szPath, szDrive, countof(szDrive))); // Same as gpConEmu->ms_ConEmuBuild wchar_t szVer4[8] = L""; lstrcpyn(szVer4, WSTRING(MVV_4a), countof(szVer4)); msprintf(szDrive, countof(szDrive), L"%02u%02u%02u%s%s", (MVV_1%100), MVV_2, MVV_3, szVer4[0]&&szVer4[1]?L"-":L"", szVer4); SetEnvironmentVariable(ENV_CONEMU_BUILD_W, szDrive); }
void main() { r_ein(1); CHAR = C_HAR; a_char = &achar[0]; b_char = &bchar[0]; bild_char = &bildchar[0]; c_char = &cchar[0]; d_char = &dchar[0]; datei_char = &dateichar[0]; e_char = &echar[0]; f_char = &fchar[0]; z_char = &zchar[0]; bild_char = &bildchar[0]; /* */ /* DEMO-PROGRAMM : Wandlung von GFA-BASIC-Quelltext nach 'C' */ /* */ /* Aufbau: */ /* 1. Stringbehandlung */ /* 2. Schleifen */ /* 3. Filehandling */ /* 4. Grafik */ /* */ /* �-1989: O. VINZENT und PROF. DR. H.-J. PATT, Universit�t des Saarlandes, */ /* Fachbereich Physik, Geb.8, D-6600 Saarbr�cken, Tel. 0681/302-3773 */ /* GFA-Systemtechnik GmbH, Heerdter Sandberg 30, D-4000 D�sseldorf 11 */ /* */ if((zeit_doub_f = (double *)calloc((size_t)(10+1),(size_t)sizeof(double ))) == 0L) f_ehler(0); else SPEICHER[SP++] = (char *)zeit_doub_f; msprintf(z_char," <<< Taste >>> "); chdrive( 0); p_intro(); p_schleifen(); p_benchmarks(); p_f_iles(); p_grafik(); deftext( 1,17,0,32); text( 288,75,-1,"ENDE"); text( 208,150,-1,"DEMO: B_NACH_C"); pause( 100); printf("\33E"); r_aus(0); }
BOOL WINAPI OnSetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode) { //typedef BOOL (WINAPI* OnSetConsoleMode_t)(HANDLE hConsoleHandle, DWORD dwMode); ORIGINAL_KRNL(SetConsoleMode); BOOL lbRc = FALSE; #if 0 if (!(dwMode & ENABLE_PROCESSED_OUTPUT)) { _ASSERTEX((dwMode & ENABLE_PROCESSED_OUTPUT)==ENABLE_PROCESSED_OUTPUT); } #endif if (gbIsVimProcess) { if ((dwMode & (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)) != (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)) { if (HandleKeeper::IsOutputHandle(hConsoleHandle)) { dwMode |= ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT; } else { dwMode |= ENABLE_WINDOW_INPUT; } } } #ifdef _DEBUG if ((gnExeFlags & (caf_Cygwin1|caf_Msys1|caf_Msys2)) && (dwMode & ENABLE_PROCESSED_INPUT) && !HandleKeeper::IsOutputHandle(hConsoleHandle)) { //_ASSERTE(!(dwMode & ENABLE_PROCESSED_INPUT)); wchar_t szLog[120]; msprintf(szLog, countof(szLog), L"\r\n\033[31;40m{PID:%u} Process is enabling ENABLE_PROCESSED_INPUT\033[m\r\n", GetCurrentProcessId()); //WriteProcessed2(szLog, lstrlen(szLog), NULL, wps_Error); szLog[0] = 0; } #endif lbRc = F(SetConsoleMode)(hConsoleHandle, dwMode); return lbRc; }
void cMenuSwitchTimerItem::Set() { if (!SwitchTimers.Exists(switchTimer) || !switchTimer || !event) return; time_t startTime = switchTimer->startTime; char *buffer = NULL; char datebuf[32]; struct tm tm_r; tm *tm = localtime_r(&startTime, &tm_r); strftime(datebuf, sizeof(datebuf), "%d.%m", tm); cChannel* channel = Channels.GetByChannelID(switchTimer->channelID,true,true); msprintf(&buffer, "%s\t%d\t%s\t%s\t%d\'\t%s~%s", switchTimer->mode==1?"":">", channel?channel->Number():-1, datebuf, TIMESTRING(startTime), switchTimer->switchMinsBefore, event->Title()?event->Title():"", event->ShortText()?event->ShortText():""); SetText(buffer, false); }
BOOL WINAPI OnTrackPopupMenuEx(HMENU hmenu, UINT fuFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm) { //typedef BOOL (WINAPI* OnTrackPopupMenuEx_t)(HMENU hmenu, UINT fuFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm); ORIGINAL_EX(TrackPopupMenuEx); #if defined(_DEBUG) wchar_t szMsg[128]; msprintf(szMsg, countof(szMsg), L"TrackPopupMenuEx(hwnd=0x%08X)\n", LODWORD(hWnd)); DebugString(szMsg); #endif // Far's EMenu popup fix FixPopupMenuHWnd(hWnd, x, y); BOOL lbRc = FALSE; if (F(TrackPopupMenuEx) != NULL) lbRc = F(TrackPopupMenuEx)(hmenu, fuFlags, x, y, hWnd, lptpm); return lbRc; }
// nPID = 0 when hooking is done (remove status bar notification) // sName is executable name or window class name bool CDefaultTerminal::NotifyHookingStatus(DWORD nPID, LPCWSTR sName) { wchar_t szInfo[200] = L""; if (nPID) { msprintf(szInfo, countof(szInfo), L"DefTerm setup: PID=%u", nPID); if (sName && *sName) { wcscat_c(szInfo, L", "); int nLen = lstrlen(szInfo); lstrcpyn(szInfo+nLen, sName, countof(szInfo)-nLen); } } gpConEmu->mp_Status->SetStatus(szInfo); // descendant must return true if status bar was changed return true; }
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI OnSetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter) { //typedef LPTOP_LEVEL_EXCEPTION_FILTER(WINAPI* OnSetUnhandledExceptionFilter_t)(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter); ORIGINAL_KRNL(SetUnhandledExceptionFilter); LPTOP_LEVEL_EXCEPTION_FILTER lpRc = F(SetUnhandledExceptionFilter)(lpTopLevelExceptionFilter); #ifdef _DEBUG DWORD dwErr = GetLastError(); wchar_t szDbgInfo[100]; msprintf(szDbgInfo, countof(szDbgInfo), L"SetUnhandledExceptionFilter(" WIN3264TEST(L"0x%08X",L"0x%08X%08X") L")=" WIN3264TEST(L"0x%08X",L"0x%08X%08X") L", code=%u\n", WIN3264WSPRINT(lpTopLevelExceptionFilter), WIN3264WSPRINT(lpRc), dwErr); DebugString(szDbgInfo); SetLastError(dwErr); #endif return lpRc; }
BOOL WINAPI OnVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect) { //typedef BOOL(WINAPI* OnVirtualProtect_t)(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect); ORIGINAL_KRNL(VirtualProtect); BOOL bResult = FALSE; if (F(VirtualProtect)) bResult = F(VirtualProtect)(lpAddress, dwSize, flNewProtect, lpflOldProtect); #ifdef _DEBUG DWORD dwErr = GetLastError(); wchar_t szDbgInfo[100]; msprintf(szDbgInfo, countof(szDbgInfo), L"VirtualProtect(" WIN3264TEST(L"0x%08X",L"0x%08X%08X") L"," WIN3264TEST(L"0x%08X",L"0x%08X%08X") L",%u,%u)=%u, code=%u\n", WIN3264WSPRINT(lpAddress), WIN3264WSPRINT(dwSize), flNewProtect, lpflOldProtect ? *lpflOldProtect : 0, bResult, dwErr); DebugString(szDbgInfo); SetLastError(dwErr); #endif return bResult; }
void * __cdecl xf_malloc ( size_t _Size #ifdef TRACK_MEMORY_ALLOCATIONS , LPCSTR lpszFileName, int nLine #endif ) { _ASSERTE(ghHeap); _ASSERTE(_Size>0); #ifdef TRACK_MEMORY_ALLOCATIONS #ifdef FORCE_HEAP_CHECK xf_dump_chk(); #endif size_t nTotalSize = _Size+sizeof(xf_mem_block)+8; xf_mem_block* p = (xf_mem_block*)HeapAlloc(ghHeap, 0, nTotalSize); if (p) { p->bBlockUsed = TRUE; p->nBlockSize = _Size; msprintf(p->sCreatedFrom, countof(p->sCreatedFrom), "%s:%i", _PointToName(lpszFileName), nLine); #ifdef _DEBUG if (_Size > 0) memset(p+1, 0xFD, _Size); #endif memset(((LPBYTE)(p+1))+_Size, 0xCC, 8); } else { _ASSERTE(p!=NULL); } return p?(p+1):p; #else void* p = HeapAlloc(ghHeap, 0, _Size); return p; #endif }
void _DEBUGSTR(LPCWSTR s) { MCHKHEAP; CHEKCDBGMODLABEL; SYSTEMTIME st; GetLocalTime(&st); wchar_t szDEBUGSTRTime[1040]; msprintf(szDEBUGSTRTime, countof(szDEBUGSTRTime), L"%u:%02u:%02u.%03u(%s.%u.%u) ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, gszDbgModLabel, GetCurrentProcessId(), GetCurrentThreadId()); LPCWSTR psz = s; int nSLen = lstrlen(psz); if (nSLen < 999) { wcscat_c(szDEBUGSTRTime, s); if (nSLen && psz[nSLen-1]!=L'\n') wcscat_c(szDEBUGSTRTime, L"\n"); OutputDebugString(szDEBUGSTRTime); } else { OutputDebugString(szDEBUGSTRTime); OutputDebugString(psz); if (nSLen && psz[nSLen-1]!=L'\n') OutputDebugString(L"\n"); } }
// Выполнить в GUI (в CRealConsole) CESERVER_REQ* ExecuteGuiCmd(HWND hConWnd, CESERVER_REQ* pIn, HWND hOwner) { wchar_t szGuiPipeName[128]; if (!hConWnd) return NULL; DWORD nLastErr = GetLastError(); //_wsprintf(szGuiPipeName, SKIPLEN(countof(szGuiPipeName)) CEGUIPIPENAME, L".", (DWORD)hConWnd); msprintf(szGuiPipeName, countof(szGuiPipeName), CEGUIPIPENAME, L".", (DWORD)hConWnd); //-V205 #ifdef _DEBUG DWORD nStartTick = GetTickCount(); #endif CESERVER_REQ* lpRet = ExecuteCmd(szGuiPipeName, pIn, 1000, hOwner); #ifdef _DEBUG DWORD nEndTick = GetTickCount(); DWORD nDelta = nEndTick - nStartTick; if (nDelta >= EXECUTE_CMD_WARN_TIMEOUT) { if (!IsDebuggerPresent()) { if (lpRet) { _ASSERTE(nDelta <= EXECUTE_CMD_WARN_TIMEOUT || lpRet->hdr.IsDebugging || (pIn->hdr.nCmd == CECMD_CMDSTARTSTOP && nDelta <= EXECUTE_CMD_WARN_TIMEOUT2)); } else { _ASSERTE(nDelta <= EXECUTE_CMD_TIMEOUT_SRV_ABSENT); } } } #endif SetLastError(nLastErr); // Чтобы не мешать процессу своими возможными ошибками общения с пайпом return lpRet; }
BOOL WINAPI OnTrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, int nReserved, HWND hWnd, CONST RECT * prcRect) { //typedef BOOL (WINAPI* OnTrackPopupMenu_t)(HMENU hMenu, UINT uFlags, int x, int y, int nReserved, HWND hWnd, CONST RECT * prcRect); ORIGINAL_EX(TrackPopupMenu); #if defined(_DEBUG) wchar_t szMsg[128]; msprintf(szMsg, countof(szMsg), L"TrackPopupMenu(hwnd=0x%08X)\n", LODWORD(hWnd)); DebugString(szMsg); #endif // Far's EMenu popup fix FixPopupMenuHWnd(hWnd, x, y); BOOL lbRc = FALSE; if (F(TrackPopupMenu) != NULL) { hInTrackPopupMenu = hWnd; lbRc = F(TrackPopupMenu)(hMenu, uFlags, x, y, nReserved, hWnd, prcRect); hInTrackPopupMenu = NULL; } return lbRc; }
void cSearchTimerThread::ModifyManualTimer(const cEvent* event, const cTimer* timer, int bstart, int bstop) { LogFile.Log(1,"modified manual timer %d for '%s~%s' (%s - %s)", timer->Index()+1, event->Title(), event->ShortText()?event->ShortText():"", GETDATESTRING(event), GETTIMESTRING(event)); time_t start = event->StartTime() - bstart; time_t stop = event->EndTime() + bstop; struct tm tm_r_start; struct tm tm_r_stop; localtime_r(&start, &tm_r_start); localtime_r(&stop, &tm_r_stop); char daybuffer[DAYBUFFERSIZE]; char startbuffer[DAYBUFFERSIZE]; char stopbuffer[DAYBUFFERSIZE]; strftime(daybuffer, DAYBUFFERSIZE, "%Y-%m-%d", &tm_r_start); strftime(startbuffer, DAYBUFFERSIZE, "%H%M", &tm_r_start); strftime(stopbuffer, DAYBUFFERSIZE, "%H%M", &tm_r_stop); char* cmdbuf = NULL; msprintf(&cmdbuf, "MODT %d %d:%d:%s:%s:%s:%d:%d:%s:%s", timer->Index()+1, timer->Flags(), timer->Channel()->Number(), daybuffer, startbuffer, stopbuffer, timer->Priority(), timer->Lifetime(), timer->File(), timer->Aux()); if (EPGSearchConfig.sendMailOnSearchtimers) mailNotifier.AddModTimerNotification(event->EventID(), event->ChannelID()); cTimerThread timerThread; timerThread.Init(cmdbuf); free(cmdbuf); }
const char *cPendingNotification::ToText(void) const { char* tmpFormatted = formatted!=""?strdup(formatted.c_str()):NULL; if (tmpFormatted) strreplace(tmpFormatted, '\n', '|'); if (buffer) free(buffer); buffer = NULL; cChannel *channel = Channels.GetByChannelID(channelID, true, true); if (!channel) LogFile.Log(3,"invalid channel in pending notifications!"); msprintf(&buffer, "N %d %u %d %d %ld\nC %s\n%s%s%sn", type, eventID, timerMod, searchID, start, channel?CHANNELSTRING(channel):"", tmpFormatted?"F ":"",tmpFormatted?tmpFormatted:"", tmpFormatted?"\n":""); if (tmpFormatted) free(tmpFormatted); return buffer; }
void p_intro(void) { print_at(1,2); printf("\n"); printf(" %cp<<< ES IST SOWEIT !!! %c B_NACH_C %c IST DA !!! >>>%cq\n",*chr(27),*chr(42),*chr(42),*chr(27)); print_at(8,5); printf("%cp<<< DAS TRANSFORMATIONSPROGRAMM 'GFA-BASIC-KONVERTER-NACH-C' >>>%cq\n",*chr(27),*chr(27)); print_at(1,8); printf("\n"); printf(" Mit Hilfe dieses Programms k�nnen folgende Aufgaben optimal gel�st werden :\n"); printf("\n"); printf(" 1. Entwicklung eines Programms im kompfortablen GFA-BASIC,\n"); printf(" 2. Austesten des Programms in einem Interpreter (Turn-Around-Zeit !),\n"); printf(" 3. Programmtransformation in die weltweit verbreitete Computersprache 'C',\n"); printf(" 4. Portierung auf unterschiedlichste Rechner und Betriebssysteme,\n"); printf(" 5. Programmierung auf einem ATARI und Anwendung auf einer UNIX-Workstation,\n"); printf(" 6. M�gliche Steigerung der Geschwindigkeiten durch deren C-Compiler.\n"); print_at(3,20); printf("�-1989: O. VINZENT und PROF. DR. H.-J. PATT, Universit�t des Saarlandes,\n"); print_at(11,21); printf("Fachbereich Physik, Geb.8, D-6600 Saarbr�cken, Tel. 0681/302-3773\n"); print_at(11,22); printf("GFA-Systemtechnik GmbH, Heerdter Sandberg 30, D-4000 D�sseldorf 11\n"); p_s_top(); printf("\33E"); msprintf(a_char," DEMO-PROGRAMM F�R 'B_NACH_C.PRG' "); msprintf(b_char,"B_NACH_C WANDELT GFA-BASIC IM ASCII-FORMAT IN EINEN C-QUELLTEXT"); msprintf(c_char,"Ein GFA-BASIC-Listing wird nach 'C' gewandelt und ist "); msprintf(d_char,"sofort compilierbar !"); msprintf(e_char,"%s%s",c_char,d_char); msprintf(f_char,"%s",right(a_char,16)); print_at(24,2); printf("%cp%s%cq\n",*chr(27),a_char,*chr(27)); print_at(9,4); printf("%s\n",b_char); print_at(3,6); printf("%s\n",e_char); print_at(33,8); printf("%cp%s%cq\n",*chr(27),f_char,*chr(27)); print_at(26,10); printf("transformiert GFA-BASIC nach C\n"); }