void LJpegPlain::decodeScan() { // If image attempts to decode beyond the image bounds, strip it. if ((frame.w * frame.cps + offX * mRaw->getCpp()) > mRaw->dim.x * mRaw->getCpp()) skipX = ((frame.w * frame.cps + offX * mRaw->getCpp()) - mRaw->dim.x * mRaw->getCpp()) / frame.cps; if (frame.h + offY > (uint32)mRaw->dim.y) skipY = frame.h + offY - mRaw->dim.y; _RPT1(0,"SlicesW:0x%x,\n",&slicesW); _RPT1(0,"Slices:%d\n",slicesW.size()); if (slicesW.empty()) slicesW.push_back(frame.w*frame.cps); if ( 0 == frame.h || 0 == frame.w) ThrowRDE("LJpegPlain::decodeScan: Image width or height set to zero"); for (uint32 i = 0; i < frame.cps; i++) { if (frame.compInfo[i].superH != 1 || frame.compInfo[i].superV != 1) { if (mRaw->isCFA) ThrowRDE("LJpegDecompressor::decodeScan: Cannot decode subsampled image to CFA data"); if (mRaw->getCpp() != frame.cps) ThrowRDE("LJpegDecompressor::decodeScan: Subsampled component count does not match image."); if (pred == 1) { if (frame.compInfo[0].superH == 2 && frame.compInfo[0].superV == 2 && frame.compInfo[1].superH == 1 && frame.compInfo[1].superV == 1 && frame.compInfo[2].superH == 1 && frame.compInfo[2].superV == 1) { // Something like Cr2 sRaw1, use fast decoder decodeScanLeft4_2_0(); return; } else if (frame.compInfo[0].superH == 2 && frame.compInfo[0].superV == 1 && frame.compInfo[1].superH == 1 && frame.compInfo[1].superV == 1 && frame.compInfo[2].superH == 1 && frame.compInfo[2].superV == 1) { // Something like Cr2 sRaw2, use fast decoder decodeScanLeft4_2_2(); return; } else { decodeScanLeftGeneric(); return; } } else { ThrowRDE("LJpegDecompressor::decodeScan: Unsupported prediction direction."); } } } if (pred == 1) { if (frame.cps == 2) decodeScanLeft2Comps(); else if (frame.cps == 3) decodeScanLeft3Comps(); else if (frame.cps == 4) decodeScanLeft4Comps(); else ThrowRDE("LJpegDecompressor::decodeScan: Unsupported component direction count."); return; } ThrowRDE("LJpegDecompressor::decodeScan: Unsupported prediction direction."); }
mmFilter::~mmFilter() { _RPT1(_CRT_WARN,"Freeing video Sources %d\n",videoSources.size()); for (int i=0; i<videoSources.size(); i++) delete videoSources.at(i); _RPT1(_CRT_WARN,"Freeing audio Sources %d\n",audioSources.size()); for (int i=0; i<audioSources.size(); i++) delete audioSources.at(i); }
/*!*************************************************************************** @fn DrawLineUP @return true or false @brief Draw a single line of text. *****************************************************************************/ bool CPVRTPrint3D::DrawLine(SPVRTPrint3DAPIVertex *pVtx, unsigned int nVertices) { if(!nVertices) return true; _ASSERT((nVertices % 4) == 0); _ASSERT((nVertices/4) < MAX_LETTERS); while(m_nVtxCache + (int)nVertices > m_nVtxCacheMax) { if(m_nVtxCache + nVertices > MAX_CACHED_VTX) { _RPT1(_CRT_WARN, "Print3D: Out of space to cache text! (More than %d vertices!)\n", MAX_CACHED_VTX); return false; } m_nVtxCacheMax = PVRT_MIN(m_nVtxCacheMax * 2, MAX_CACHED_VTX); SPVRTPrint3DAPIVertex* pTmp = (SPVRTPrint3DAPIVertex*)realloc(m_pVtxCache, m_nVtxCacheMax * sizeof(*m_pVtxCache)); _ASSERT(pTmp); if(!pTmp) { free(m_pVtxCache); m_pVtxCache = 0; return false; // Failed to re-allocate data } m_pVtxCache = pTmp; _RPT1(_CRT_WARN, "Print3D: TextCache increased to %d vertices.\n", m_nVtxCacheMax); } memcpy(&m_pVtxCache[m_nVtxCache], pVtx, nVertices * sizeof(*pVtx)); m_nVtxCache += nVertices; return true; }
BOOL CMemDC::OpenMemDC( CDC* pDC, long width,long heigh ) { BOOL bRet = FALSE; try { const UINT nMax = 10240; ASSERT((width > 0) && (heigh > 0) && (heigh < nMax) && (width < nMax)); if(heigh <=0 || width <= 0 || width >= nMax || heigh >= nMax) { ASSERT(FALSE); throw(0); } //CDC *pDC = CDC::FromHandle(::GetDC(GetDesktopWindow())); if (pDC == NULL) { _RPT1(0,"createdc Err=%d", GetLastError()); ASSERT(FALSE); } ASSERT(pDC != NULL); //CreateCompatibleDC(pDC); HDC hdc = ::CreateCompatibleDC(pDC->GetSafeHdc()); if (hdc == NULL) { _RPT1(0,"\n dc == 0,last err =%d",GetLastError()); ASSERT(FALSE); //ASSERT(FALSE); return FALSE; } else { Attach(hdc); } m_bmpWidth = width; m_bmpHeigh = heigh; //m_bitmap.CreateCompatibleBitmap(pDC, m_bmpWidth, m_bmpHeigh); if (m_bitmap.CreateBitmap(m_bmpWidth, m_bmpHeigh, 1,32,0)) { m_pOldBitmap = SelectObject(&m_bitmap); bRet = TRUE; } else { ASSERT(FALSE); bRet = FALSE; } //::ReleaseDC(GetDesktopWindow(), pDC->m_hDC); } catch (...) { ASSERT(FALSE); } return bRet; }
void __cdecl iso_aligned_free(const void *pvData) { ALIGN_BLOCK_HEADER *pBlockHdr; void *pvAlloc; _ASSERT(pvData != NULL); if (pvData != NULL) { pBlockHdr = (ALIGN_BLOCK_HEADER *)((uintptr_t)pvData & ~(sizeof(uintptr_t) - 1)) - 1; _ASSERT(pBlockHdr < pvData); #ifdef _DEBUG if (_iso_check_bytes((unsigned char *)pvData - NO_MANS_LAND_SIZE, s_cNoMansLandFill, NO_MANS_LAND_SIZE)) { // We don't know where (file, linenum) pvData was allocated _RPT1(_CRT_ERROR, "The block at 0x%p was not allocated by _aligned routines, use free()", pvData); return; } #endif #if _USE_ALIGN_SIGN_ if (!_iso_check_bytes(pBlockHdr->Sign, _cAlignSignFill, ALIGN_SIGN_SIZE)) { // We don't know where (file, linenum) pvData was allocated _RPT1(_CRT_ERROR, "Damage before 0x%p which was allocated by aligned routine\n", pvData); } #endif pvAlloc = pBlockHdr->pvAlloc; #ifdef _DEBUG if ((void *)pBlockHdr < pvAlloc) { // We don't know where pvData was allocated _RPT1(_CRT_ERROR, "Damage before 0x%p which was allocated by aligned routine\n", pvData); } #endif #ifdef _ALIGNED_FREE_CLEAR_SIGN // Set pvAlloc's value to NULL pBlockHdr->pvAlloc = NULL; // Set and fill clear sign #if _USE_ALIGN_SIGN_ ::memset(pBlockHdr->Sign, _cClearSignFill, ALIGN_SIGN_SIZE); #endif #endif /* _ALIGNED_FREE_CLEAR_SIGN */ // Free memory block if need ::free(pvAlloc); } }
void TestClass::ClassDumper ( const void * pData ) { TestClass * pClass = (TestClass*)pData ; _RPT1 ( _CRT_WARN , " TestClass::ClassDumper : %s\n" , pClass->m_szData ) ; }
void WarningException::Report() { #ifdef _MSC_VER _RPT1(_CRT_WARN, "Warning : %s\n", m_info); #endif MessageBox(NULL, m_info, "TightVNC info", MB_OK| MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); }
HRESULT CDMODecoder::InternalProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, DMO_OUTPUT_DATA_BUFFER *pOutputBuffers, DWORD *pdwStatus) { BYTE *pInput; BYTE *pOutput; size_t cbOutput; if (m_pInputBuffer == NULL) return S_FALSE; pOutputBuffers->pBuffer->GetBufferAndLength(&pOutput, NULL); m_pInputBuffer->GetBufferAndLength(&pInput, NULL); cbOutput = m_pCodec->DecodeFrame(pOutput, pInput); pOutputBuffers->dwStatus = 0; pOutputBuffers->dwStatus |= DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT; if (m_bInputTimestampValid) { pOutputBuffers->dwStatus |= DMO_OUTPUT_DATA_BUFFERF_TIME; pOutputBuffers->rtTimestamp = m_rtInputTimestamp; } if (m_bInputTimelengthValid) { pOutputBuffers->dwStatus |= DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH; pOutputBuffers->rtTimelength = m_rtInputTimelength; } pOutputBuffers->pBuffer->SetLength((DWORD)cbOutput); _RPT1(_CRT_WARN, "Size = %u\n", (unsigned int)cbOutput); m_pInputBuffer->Release(); m_pInputBuffer = NULL; return S_OK; }
DllExport BOOL SetMMShellHook(HWND hWnd) { // Don't add the hook if the window ID is NULL if (hWnd == NULL) return FALSE; // Don't add a hook if there is already one added if (hNotifyWnd != NULL) return FALSE; // Add the ShellProc hook hShellHook = SetWindowsHookEx( WH_SHELL, // Hook in before msg reaches app (HOOKPROC) ShellProc, // Hook procedure hInstance, // This DLL instance 0L // Hook in to all apps ); // Check that it worked if (hShellHook != NULL) { hNotifyWnd = hWnd; // Save the WinRFB window handle #ifdef _MSC_VER _RPT1(_CRT_WARN, "Notify Window is: %d\n", hWnd); #endif return TRUE; } // The hook failed, so return an error code return FALSE; }
void ErrorException::Report() { #ifdef _MSC_VER _RPT1(_CRT_WARN, "Warning : %s\n", m_info); #endif MessageBox(NULL, m_info, " Ultr@VNC Info", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND | MB_TOPMOST); }
STDMETHODIMP CAVIFileRemote::GetClassID(LPCLSID lpClassID) { _RPT1(0,"%p->CAVIFileRemote::GetClassID()\n", this); *lpClassID = CLSID_CAVIFileRemote; return S_OK; }
/* * LoadRscFiles: Load all the resource files with the given filespec. * Returns True iff any was loaded. */ Bool LoadRscFiles(char *filespec) { HANDLE hFindFile; WIN32_FIND_DATA file_info; char file_load_path[MAX_PATH + FILENAME_MAX], game_path[MAX_PATH]; GetGamePath( game_path ); sprintf(file_load_path,"%s%s\\%s", game_path, resource_dir, filespec); hFindFile = FindFirstFile(file_load_path, &file_info); if (hFindFile == INVALID_HANDLE_VALUE) return False; for(;;) { // Skip directories if (!(file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { /* Add subdirectory name, using file_load_path as temporary */ sprintf(file_load_path, "%s%s\\%s", game_path, resource_dir, file_info.cFileName); _RPT1(_CRT_WARN,"Loading File : %s\n",file_load_path); if (!RscFileLoad(file_load_path, RscAddCallback)) debug(("Can't load resource file %s\n", file_info.cFileName)); } if (FindNextFile(hFindFile, &file_info) == FALSE) break; } FindClose(hFindFile); return True; }
STDMETHODIMP CAVIStreamRemote::QueryInterface(const IID& iid, void **ppv) { _RPT1(0,"%08lx->CAVIStreamRemote::QueryInterface()\n", this); _RPT3(0,"\tGUID: {%08lx-%04x-%04x-", iid.Data1, iid.Data2, iid.Data3); _RPT4(0,"%02x%02x-%02x%02x", iid.Data4[0], iid.Data4[1], iid.Data4[2], iid.Data4[3]); _RPT4(0,"%02x%02x%02x%02x} (", iid.Data4[4], iid.Data4[5], iid.Data4[6], iid.Data4[7]); if (iid == IID_IUnknown) { *ppv = (IUnknown *)this; _RPT0(0,"IUnknown)\n"); } else if (iid == IID_IClassFactory) { *ppv = (IClassFactory *)&iclassfactory; _RPT0(0,"IClassFactory)\n"); } else if (iid == IID_IAVIStream) { *ppv = (IAVIStream *)this; _RPT0(0,"IAVIStream)\n"); } else { _RPT0(0,"unknown)\n"); *ppv = NULL; return ResultFromScode(E_NOINTERFACE); } AddRef(); return NULL; }
STDMETHODIMP CAVIFileRemote::CreateStream(PAVISTREAM *ppStream, AVISTREAMINFOW *psi) { _RPT1(0,"%p->CAVIFileRemote::CreateStream()\n", this); if (pafTunnel) return pafTunnel->CreateStream(ppStream, psi); return AVIERR_READONLY; }
void QuietException::Report() { #ifdef _MSC_VER _RPT1(_CRT_WARN, "경고 : %s\n", m_info); #endif if (m_info != NULL) m_MenuExecutor.ConnectFailed(); }
STDMETHODIMP CAVIFileRemote::WriteData(DWORD fcc, LPVOID lpBuffer, LONG cbBuffer) { _RPT1(0,"%p->CAVIFileRemote::WriteData()\n", this); if (pafTunnel) return pafTunnel->WriteData(fcc, lpBuffer, cbBuffer); return AVIERR_READONLY; }
void WarningException::Report() { #ifdef _MSC_VER _RPT1(_CRT_WARN, "Warning : %s\n", m_info); #endif ShowMessageBox2(m_info,m_error_nr); //MessageBox(NULL, m_info, " UltraVNC Info", MB_OK| MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); }
STDMETHODIMP CAVIFileRemote::DeleteStream(DWORD fccType, LONG lParam) { _RPT1(0,"%p->CAVIFileRemote::DeleteStream()\n", this); if (pafTunnel) return pafTunnel->DeleteStream(fccType, lParam); return AVIERR_READONLY; }
STDMETHODIMP CAVIFileRemote::EndRecord() { _RPT1(0,"%p->CAVIFileRemote::EndRecord()\n", this); if (pafTunnel) return pafTunnel->EndRecord(); return AVIERR_READONLY; }
STDMETHODIMP CAVIFileRemote::ReadData(DWORD fcc, LPVOID lp, LONG *lpcb) { _RPT1(0,"%p->CAVIFileRemote::ReadData()\n", this); if (pafTunnel) return pafTunnel->ReadData(fcc, lp, lpcb); return AVIERR_NODATA; }
// Copy data from the memory bitmap into a buffer void vncDesktop::CopyToBuffer(const rfb::Rect &rect, BYTE *destbuff, UINT destbuffsize) { // Finish drawing anything in this thread // Wish we could do this for the whole system - maybe we should // do something with LockWindowUpdate here. GdiFlush(); // Are we being asked to blit from the DIBsection to itself? if (destbuff == m_DIBbits) { // Yes. Ignore the request! return; } int y_inv; BYTE * destbuffpos; // Calculate the scanline-ordered y position to copy from y_inv = m_scrinfo.framebufferHeight-rect.tl.y-(rect.br.y-rect.tl.y); // Calculate where in the output buffer to put the data destbuffpos = destbuff + (m_bytesPerRow * rect.tl.y); // Set the number of bytes for GetDIBits to actually write // NOTE : GetDIBits pads the destination buffer if biSizeImage < no. of bytes required m_bminfo.bmi.bmiHeader.biSizeImage = (rect.br.y-rect.tl.y) * m_bytesPerRow; // Get the actual bits from the bitmap into the bit buffer // If fast (DIBsection) blits are disabled then use the old GetDIBits technique if (m_DIBbits == NULL) { if (GetDIBits(m_hmemdc, m_membitmap, y_inv, (rect.br.y-rect.tl.y), destbuffpos, &m_bminfo.bmi, DIB_RGB_COLORS) == 0) { _RPT1(_CRT_WARN, "vncDesktop : [1] GetDIBits failed! %d\n", GetLastError()); _RPT3(_CRT_WARN, "vncDesktop : thread = %d, DC = %d, bitmap = %d\n", omni_thread::self(), m_hmemdc, m_membitmap); _RPT2(_CRT_WARN, "vncDesktop : y = %d, height = %d\n", y_inv, (rect.br.y-rect.tl.y)); } } else { // Fast blits are enabled. [I have a sneaking suspicion this will never get used, unless // something weird goes wrong in the code. It's here to keep the function general, though!] int bytesPerPixel = m_scrinfo.format.bitsPerPixel / 8; BYTE *srcbuffpos = (BYTE*)m_DIBbits; srcbuffpos += (m_bytesPerRow * rect.tl.y) + (bytesPerPixel * rect.tl.x); destbuffpos += bytesPerPixel * rect.tl.x; int widthBytes = (rect.br.x-rect.tl.x) * bytesPerPixel; for(int y = rect.tl.y; y < rect.br.y; y++) { memcpy(destbuffpos, srcbuffpos, widthBytes); srcbuffpos += m_bytesPerRow; destbuffpos += m_bytesPerRow; } } }
void ThrowTPE(const char* fmt, ...) { va_list val; va_start(val, fmt); char buf[8192]; vsprintf_s(buf, 8192, fmt, val); va_end(val); _RPT1(0, "EXCEPTION: %s\n", buf); throw TiffParserException(buf); }
void AuthException::Report() { #ifdef _MSC_VER _RPT1(_CRT_WARN, "Warning : %s\n", m_info); #endif printf("AUTHENTICATION FAILURE: %s\n", m_info); MessageBox(NULL, m_info, "TurboVNC authentication info", MB_OK| MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); }
void ErrorException::Report() { #ifdef _MSC_VER _RPT1(_CRT_WARN, "Warning : %s\n", m_info); #endif printf("ERROR: %s\n", m_info); MessageBox(NULL, m_info, "TurboVNC info", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND | MB_TOPMOST); }
void TestClass::ClassValidator ( const void * pData , const void * ) { // Validate the data here. TestClass * pClass = (TestClass*)pData ; _RPT1 ( _CRT_WARN , " TestClass::ClassValidator : %s\n" , pClass->m_szData ) ; }
STDMETHODIMP CAVIFileRemote::Load(LPCOLESTR lpszFileName, DWORD grfMode) { char filename[MAX_PATH]; _RPT1(0,"%p->CAVIFileRemote::Load()\n", this); WideCharToMultiByte(AreFileApisANSI() ? CP_ACP : CP_OEMCP, 0, lpszFileName, -1, filename, sizeof filename, NULL, NULL); return Open(filename, grfMode, lpszFileName); }
void memblockinfo_output_memleak() { if(!Cmdline_show_mem_usage) return; if(TotalRam == 0) return; if(TotalRam < 0) { _RPT1(_CRT_WARN, "TotalRam bad value!",TotalRam); return; } _RPT1(_CRT_WARN, "malloc memory leak of %d\n",TotalRam); // Now if system is compiled register it with the fuller system #ifdef _REPORT_MEM_LEAKS int total = 0; // Find empty slot for(int f = 0; f < MAX_MEM_POINTERS; f++) { if(mem_ptr_list[f].ptr) { _RPT3(_CRT_WARN, "Memory leaks: (%s line %d) of %d bytes\n", mem_ptr_list[f].filename, mem_ptr_list[f].line, mem_ptr_list[f].size); total += mem_ptr_list[f].size; } } Assert(TotalRam == total); #else for(int i = 0; i < MAX_MEM_MODULES; i++) { // Found the first empty entry, fill it if(mem_block_list[i].size > 0) { // Oh... bad code... making assumsions... _RPT2(_CRT_WARN, "Possible memory leaks: %s %d\n", mem_block_list[i].filename, mem_block_list[i].size); } } #endif }
void InsertLogMsg(LPTSTR lpszMsg) { int nCount = AddNewLogMsg(); ListView_SetItemText(g_hLogMsgWnd, nCount, 2, lpszMsg); #ifdef _DEBUG _RPT1(_CRT_WARN, "%s\n", lpszMsg); #endif }
void WarningException::Report() { #ifdef _MSC_VER _RPT1(_CRT_WARN, "경고 : %s\n", m_info); #endif if (m_info != NULL) m_MenuExecutor.ConnectFailed(); //ShowMessageBox2(m_info,m_error_nr); //MessageBox(NULL, m_info, " UltraVNC Info", MB_OK| MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST); }
LRESULT EditorCommandDialog::onCommand(WORD wNotifyCode, WORD wID, HWND hwndCtrl) { switch (wID) { case IDC_EXE_BROWSE: { char filename[MAX_PATH]; OPENFILENAME ofn; Init_OPENFILENAME(&ofn); filename[0] = '\0'; ofn.hwndOwner = m_hWnd; ofn.lpstrFilter = "Program to edit {*.exe}\0*.exe\0\0"; ofn.lpstrFile = filename; ofn.lpstrDefExt = "exe"; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; if (GetOpenFileName(&ofn)) SendMessage(GetDlgItem(m_hWnd, IDC_EXECMD_FORMAT), WM_SETTEXT, 0, (LPARAM)filename); } break; case IDOK: { int len = SendMessage(GetDlgItem(m_hWnd, IDC_EXECMD_FORMAT), WM_GETTEXTLENGTH, 0, 0) + 1; char *pszFmt = new char[len]; if (pszFmt) { if (!GetDlgItemText(m_hWnd, IDC_EXECMD_FORMAT, pszFmt, len)) _RPT1(_CRT_WARN, "Cannot get format\r\n", len); else { _RPT1(_CRT_WARN, "format=%s\r\n", pszFmt); CRegKey regEditCmd; if (regEditCmd.Create(HKEY_CURRENT_USER, REGKEY_BASE) == ERROR_SUCCESS) { regEditCmd.SetValue(pszFmt, REGKEY_EDITCMD); regEditCmd.Close(); } else _RPT0(_CRT_ASSERT, "Cannot create registy key\r\n"); } delete[] pszFmt; } } case IDCANCEL: EndDialog(m_hWnd, 0); return TRUE; } return FALSE; }