RETVAL StartRemoteThread(HANDLE hRemoteProc, LPTHREAD_START_ROUTINE dwEntryPoint){ RETVAL rv; // must be cleaned up HANDLE hRemoteThread = NULL; // inject the thread hRemoteThread = CreateRemoteThread(hRemoteProc, NULL, 0, dwEntryPoint, (void *) CTRL_BREAK_EVENT, CREATE_SUSPENDED, NULL); if (hRemoteThread == NULL) { _HandleLastError(rv, __T("CreateRemoteThread")); } // wake up the thread if (ResumeThread(hRemoteThread) == (DWORD) -1) { _HandleLastError(rv, __T("ResumeThread")) } // wait for the thread to finish if (WaitForSingleObject(hRemoteThread, INFINITE) != WAIT_OBJECT_0) { _HandleLastError(rv, __T("WaitForSingleObject")); } // find out what happened if (!GetExitCodeThread(hRemoteThread, (LPDWORD) &rv)) { _HandleLastError(rv, __T("GetExitCodeThread")); } if (rv == STATUS_CONTROL_C_EXIT) { _tprintf(__T("Target process was killed.\n")); rv = EXIT_OK; goto error; } if (rv != EXIT_OK) { _HandleError(rv, __T("(remote function)")); //if (ERROR_INVALID_HANDLE==rv) { // printf("Are you sure this is a console application?\n"); //} } error: if (hRemoteThread != NULL) { if (!CloseHandle(hRemoteThread)) { RETVAL rv2 = GetLastError(); _TeardownIfError(rv, rv2, __T("CloseHandle")); } } return rv; }
LPVOID getCtrlRoutine() { LPVOID ctrlRoutine; // CtrlRoutine --> MyHandle --> getCtrlRoutine // set the CaptureStackBackTrace's first param to 2 to ingore the MyHandler and getCtrlRoutine calls. // should disable complier optimization on Release version. USHORT count = CaptureStackBackTrace((ULONG) 2, (ULONG) 1, &ctrlRoutine, NULL); if (count != 1) { _tprintf(__T("CaptureStackBackTrace error\n")); goto error; } HANDLE hProcess = GetCurrentProcess(); if (!SymInitialize(hProcess, NULL, TRUE)) { RETVAL rv; _HandleLastError(rv, __T("SymInitialize")); } ULONG64 buffer[(sizeof(SYMBOL_INFO) + MAX_SYM_NAME*sizeof(TCHAR) + sizeof(ULONG64)-1)/sizeof(ULONG64)]; PSYMBOL_INFO pSymbol = (PSYMBOL_INFO) buffer; pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO); pSymbol->MaxNameLen = MAX_SYM_NAME; LPVOID funcCtrlRoutine = NULL; DWORD64 dwDisplacement = 0; if(!SymFromAddr(hProcess, (DWORD64) ctrlRoutine, &dwDisplacement, pSymbol)) { RETVAL rv; _HandleLastError(rv, __T("SymFromAddr")); } funcCtrlRoutine = reinterpret_cast<LPVOID>(pSymbol->Address); SymCleanup(hProcess); return funcCtrlRoutine; error: return NULL; }
//--------------------------------------------------------------------------- void File_Rkau::FileHeader_Parse() { //Parsing Ztring version; int32u SampleRate, source_bytes; int8u Channels, BitsPerSample, Quality, Flags; bool joint_stereo, streaming, vrq_lossy_mode; Skip_Local(3, "Signature"); Get_Local (1, version, "Version"); Get_L4 (source_bytes, "SourceBytes"); Get_L4 (SampleRate, "SampleRate"); Get_L1 (Channels, "Channels"); Get_L1 (BitsPerSample, "BitsPerSample"); Get_L1 (Quality, "Quality"); Get_L1 (Flags, "Flags"); Get_Flags (Flags, 0, joint_stereo, "JointStereo"); Get_Flags (Flags, 1, streaming, "Streaming"); Get_Flags (Flags, 2, vrq_lossy_mode, "VRQLossyMode"); FILLING_BEGIN(); if (SampleRate==0) return; Duration=(((int64u)source_bytes*1000)/4)/SampleRate; if (Duration==0) return; UncompressedSize=Channels*(BitsPerSample/8); if (UncompressedSize==0) return; //Filling data File__Tags_Helper::Accept("RKAU"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "RK Audio"); Fill(Stream_Audio, 0, Audio_Codec, "Rkau"); Fill(Stream_Audio, 0, Audio_Encoded_Library, __T("1.0") + version); Fill(Stream_Audio, 0, Audio_Compression_Mode, (Quality==0)?"Lossless":"Lossy"); Fill(Stream_Audio, 0, Audio_BitDepth, BitsPerSample); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); FILLING_END(); //No more needed data File__Tags_Helper::Finish("RKAU"); }
//--------------------------------------------------------------------------- File_Vp8::File_Vp8() :File__Analyze() { //Configuration ParserName=__T("VP8"); #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE IsRawStream=true; #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:4; }
//--------------------------------------------------------------------------- void GUI_Main::OnMenu_File_Open_Directory(wxCommandEvent& WXUNUSED(event)) { //User interaction wxDirDialog* Dialog=new wxDirDialog(this, __T("Choose a directory")); if (Dialog->ShowModal()!=wxID_OK) return; wxString DirName=Dialog->GetPath(); delete Dialog; //Configuring C->Menu_File_Open_Files_Begin(); C->Menu_File_Open_Files_Continue(String(DirName.c_str())); //Showing View->GUI_Refresh(); }
/** ini_getbool() * \param Section the name of the section to search for * \param Key the name of the entry to find the value of * \param DefValue default value in the event of a failed read; it should * zero (0) or one (1). * \param Buffer a pointer to the buffer to copy into * \param BufferSize the maximum number of characters to copy * \param Filename the name and full path of the .ini file to read from * A true boolean is found if one of the following is matched: - A string starting with 'y' - A string starting with 'Y' - A string starting with 't' - A string starting with 'T' - A string starting with '1' A false boolean is found if one of the following is matched: - A string starting with 'n' - A string starting with 'N' - A string starting with 'f' - A string starting with 'F' - A string starting with '0' * * \return the true/false flag as interpreted at Key */ int ini_getbool(const TCHAR *Section, const TCHAR *Key, int DefValue, const TCHAR *Filename) { TCHAR buff[2]; int ret; ini_gets(Section, Key, __T(""), buff, sizearray(buff), Filename); buff[0] = toupper(buff[0]); if (buff[0]=='Y' || buff[0]=='1' || buff[0]=='T') ret = 1; else if (buff[0]=='N' || buff[0]=='0' || buff[0]=='F') ret = 0; else ret = DefValue; return(ret); }
/** ini_gets() * \param Section the name of the section to search for * \param Key the name of the entry to find the value of * \param DefValue default string in the event of a failed read * \param Buffer a pointer to the buffer to copy into * \param BufferSize the maximum number of characters to copy * \param Filename the name and full path of the .ini file to read from * * \return the number of characters copied into the supplied buffer */ int ini_gets(const TCHAR *Section, const TCHAR *Key, const TCHAR *DefValue, TCHAR *Buffer, int BufferSize, const TCHAR *Filename) { INI_FILETYPE fp; int ok = 0; if (Buffer == NULL || BufferSize <= 0 || Key == NULL) return 0; if (ini_openread(Filename, &fp)) { ok = getkeystring(&fp, Section, Key, -1, -1, Buffer, BufferSize, NULL); (void)ini_close(&fp); } /* if */ if (!ok) save_strncpy(Buffer, (DefValue != NULL) ? DefValue : __T(""), BufferSize, QUOTE_NONE); return (int)_tcslen(Buffer); }
/** ini_getbool() * \param Section the name of the section to search for * \param Key the name of the entry to find the value of * \param DefValue default value in the event of a failed read; it should * zero (0) or one (1). * \param Buffer a pointer to the buffer to copy into * \param BufferSize the maximum number of characters to copy * \param Filename the name and full path of the .ini file to read from * * A true boolean is found if one of the following is matched: * - A string starting with 'y' or 'Y' * - A string starting with 't' or 'T' * - A string starting with '1' * * A false boolean is found if one of the following is matched: * - A string starting with 'n' or 'N' * - A string starting with 'f' or 'F' * - A string starting with '0' * * \return the true/false flag as interpreted at Key */ int ini_getbool(const TCHAR *Section, const TCHAR *Key, int DefValue, const TCHAR *Filename) { TCHAR LocalBuffer[2]; int ret; ini_gets(Section, Key, __T(""), LocalBuffer, sizearray(LocalBuffer), Filename); LocalBuffer[0] = (TCHAR)toupper(LocalBuffer[0]); if (LocalBuffer[0] == 'Y' || LocalBuffer[0] == '1' || LocalBuffer[0] == 'T') ret = 1; else if (LocalBuffer[0] == 'N' || LocalBuffer[0] == '0' || LocalBuffer[0] == 'F') ret = 0; else ret = DefValue; return(ret); }
static BOOL InitWindowClass(HINSTANCE hinst) { static BOOL initok=FALSE; if (!initok) { WNDCLASS wc; memset(&wc,0,sizeof wc); wc.style=CS_GLOBALCLASS; wc.lpfnWndProc=(WNDPROC)ConsoleFunc; wc.hInstance=hinst; wc.hCursor=LoadCursor(NULL, IDC_ARROW); wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1); wc.lpszClassName=__T("TermWin:Console"); initok=RegisterClass(&wc); } /* if */ return initok; }
CString extract_postcode(const CString& address) { // searches throw address for a UK postcode and returns the result, // the expression used is by Phil A. on www.regxlib.com: boost::tregex r(__T("^(([A-Z]{1,2}[0-9]{1,2})|([A-Z]{1,2}[0-9][A-Z]))\\s?([0-9][A-Z]{2})$")); boost::tmatch what; if(boost::regex_search(address, what, r)) { // extract $0 as a CString: return CString(what[0].first, what.length()); } else { throw std::runtime_error("No postcode found"); } }
//--------------------------------------------------------------------------- File_Pcm::File_Pcm() { //Configuration ParserName=__T("PCM"); #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE IsRawStream=true; PTS_DTS_Needed=true; //In Frame_Count_Valid=2; BitDepth=0; Channels=0; SamplingRate=0; }
int createconsole(int argc, char *argv[]) { if (win != NULL) return 1; if (app != NULL) /* delete existing partial data structures */ deleteconsole(); lines = malloc(NUM_LINES*NUM_COLUMNS*sizeof(TCHAR)); if (lines == NULL) return 0; memset(lines, __T(' '), NUM_LINES * NUM_COLUMNS); app = new_app(argc, argv); if (app == NULL) { deleteconsole(); return 0; } /* if */ font = new_font(app, "unifont", PLAIN | PORTABLE_FONT, 16); if (font == NULL) { deleteconsole(); return 0; } /* if */ win = new_window(app, rect(0,0, NUM_COLUMNS*font_width(font,"x",1), NUM_LINES*font_height(font)), "Pawn console", TITLEBAR|CLOSEBOX|MAXIMIZE|MINIMIZE|CENTRED); on_window_redraw(win, window_redraw); on_window_close (win, window_close); on_window_key_down(win, window_key_action); /* normal keys (including CR) */ show_window(win); /* handle any pending events */ while (do_event(app)) /* nothing */; csrx = 0; csry = 0; autowrap = 0; attrib = 0x07; return 1; }
//--------------------------------------------------------------------------- void File_Pcx::Read_Buffer_Continue() { //Parsing int16u XMin, YMin, XMax, YMax, HorDPI, VertDPI, BytesPerLine, PaletteType, HScrSize, VScrSize; int8u Manufacturer, Version, EncodingScheme, BitsPerPixel, ColorPlanes; Get_L1 (Manufacturer, "Manufacturer"); Get_L1 (Version, "Version"); // 0,2,3,4,5 Get_L1 (EncodingScheme, "EncodingScheme"); // RLE=1 Get_L1 (BitsPerPixel, "Bits Per Pixel"); // 1,4,8,24 Get_L2 (XMin, "Left margin of image"); Get_L2 (YMin, "Upper margin of image"); Get_L2 (XMax, "Right margin of image"); Get_L2 (YMax, "Lower margin of image"); Get_L2 (HorDPI, "Horizontal Resolution"); Get_L2 (VertDPI, "Vertical Resolution"); Skip_XX(48, "Palette"); Skip_L1( "Reserved"); Get_L1 (ColorPlanes, "ColorPlanes"); Get_L2 (BytesPerLine, "BytesPerLine"); Get_L2 (PaletteType, "PaletteType"); Get_L2 (HScrSize, "Horizontal Screen Size"); Get_L2 (VScrSize, "Vertical Screen Size"); Skip_XX(56, "Filler"); FILLING_BEGIN(); //Integrity tests if (XMax<=XMin || YMax<=YMin || BytesPerLine<XMax-XMin) { Reject("PCX"); return; } Accept("PCX"); Stream_Prepare(Stream_Image); Fill(Stream_Image, 0, Image_Format, "PCX"); Fill(Stream_Image, 0, Image_Format_Version, Pcx_VersionInfo(Version)); Fill(Stream_Image, 0, Image_Width, XMax-XMin); Fill(Stream_Image, 0, Image_Height, YMax-YMin); Fill(Stream_Image, 0, Image_BitDepth, BitsPerPixel); Fill(Stream_Image, 0, "DPI", Ztring::ToZtring(VertDPI) + __T(" x ") + Ztring::ToZtring(HorDPI)); Finish("PCX"); FILLING_END(); }
DWORD WINAPI ReadCommandLine(LPTSTR szParcLine, int & argc, LPTSTR* &argv) { DWORD dwCurLigne,dwCurCol; BOOL fInQuote = FALSE; //DWORD nNb; dwCurLigne = 1; dwCurCol = 0; DWORD dwCurLigAllocated=0x10; LPTSTR lpszOldArgv=*argv; // exe name argv = (LPTSTR*)malloc(sizeof(LPTSTR)*3); *argv = (LPTSTR )malloc((_tcslen(lpszOldArgv)+10)*sizeof(_TCHAR)); _tcscpy(*argv,lpszOldArgv); *(argv+1) = (LPTSTR)malloc((dwCurLigAllocated+10)*sizeof(_TCHAR)); *(argv+2) = NULL; **(argv+1) = __T('\0'); while ( ((*szParcLine) != __T('\0')) && ((*szParcLine) != __T('\r')) && ((*szParcLine) != __T('\n')) ) { _TCHAR c = (*szParcLine); if ( c == __T('"') ) fInQuote = ! fInQuote; else if ( (c == __T(' ')) && (!fInQuote) ) { // && (dwCurLigne+1 < MAXPARAM)) argv = (LPTSTR*)realloc(argv,sizeof(LPTSTR)*(dwCurLigne+0x10)); dwCurLigne++; dwCurLigAllocated = 0x10; *(argv+dwCurLigne) = (LPTSTR)malloc((dwCurLigAllocated+10)*sizeof(_TCHAR)); *(argv+dwCurLigne+1) = NULL; dwCurCol = 0; } else { LPTSTR lpszCurLigne; if ( dwCurCol >= dwCurLigAllocated ) { dwCurLigAllocated += 0x20; *(argv+dwCurLigne) = (LPTSTR)realloc(*(argv+dwCurLigne),(dwCurLigAllocated+10)*sizeof(_TCHAR)); } lpszCurLigne = *(argv+dwCurLigne); *(lpszCurLigne+dwCurCol) = c; dwCurCol++; *(lpszCurLigne+dwCurCol) = __T('\0'); } szParcLine++; } if ( dwCurCol > 0 ) dwCurLigne++; argc = (int)dwCurLigne; return dwCurLigne; }
//----------------------------------------------------------------------------- // 加入一行 void C_StringList::AddLineEx(IN const TCHAR *szInput, ...) { nstring szTemp; if(szInput && _tcslen(szInput) > 0) { va_list valist; va_start(valist, szInput); setprintf(szTemp, szInput, &valist); va_end(valist); } else szTemp = __T(""); AddLine(szTemp.c_str()); }
//--------------------------------------------------------------------------- String Policy::import_schema(const std::string& filename) { Schematron s; xmlSetGenericErrorFunc(&s, &s.manage_generic_error); xmlDocPtr doc = xmlParseFile(filename.c_str()); if (!doc) { // maybe put the errors from s.errors return String(__T("The schema cannot be parsed")); } String ret = import_schema_from_doc(filename, doc); xmlFreeDoc(doc); saved = true; return ret; }
LPCTSTR CVersionInfo::QueryValueString(LPCTSTR pszVerInfo) const { _ASSERTE(pszVerInfo && *pszVerInfo); _ASSERTE(m_pVerInfo); LPTSTR pszBuf = 0; UINT nBufSize = 0; TCHAR szQuery[128]; wsprintf(szQuery, __T("\\StringFileInfo\\%s\\%s"), m_szTrans, pszVerInfo); if( VerQueryValue(m_pVerInfo, szQuery, (void**)&pszBuf, &nBufSize) ) { return pszBuf; } return 0; }
//--------------------------------------------------------------------------- void File_Ibi::InformData() { Element_Name("InformData"); //Parsing Ztring InformData_FromFile; Get_UTF8 (Element_Size, InformData_FromFile, "Data"); //Filling #if MEDIAINFO_IBIUSAGE if (Config->Ibi_UseIbiInfoIfAvailable_Get()) { ZtringListList Fields(InformData_FromFile); for (size_t Pos=0; Pos<Fields.size(); Pos++) { if (Pos==0 || Fields[Pos].size()<2) { if (Pos) Pos++; if (Pos>Fields.size() || Fields[Pos].size()<1) break; //End or problem if (Fields[Pos][0]==__T("General")) ; //Nothing to do else if (Fields[Pos][0]==__T("Video")) Stream_Prepare(Stream_Video); else if (Fields[Pos][0]==__T("Audio")) Stream_Prepare(Stream_Audio); else if (Fields[Pos][0]==__T("Text")) Stream_Prepare(Stream_Text); else if (Fields[Pos][0]==__T("Other")) Stream_Prepare(Stream_Other); else if (Fields[Pos][0]==__T("Image")) Stream_Prepare(Stream_Image); else if (Fields[Pos][0]==__T("Menu")) Stream_Prepare(Stream_Menu); else break; //Problem Pos++; } Fill(StreamKind_Last, StreamPos_Last, Fields[Pos][0].To_UTF8().c_str(), Fields[Pos][1], true); if (Info_Options<Fields[Pos].size()) (*Stream_More)[StreamKind_Last][StreamPos_Last](Fields[Pos][0].To_UTF8().c_str(), Info_Options)=Fields[Pos][Info_Options]; } } #endif //MEDIAINFO_IBIUSAGE }
//----------------------------------------------------------------------------- // 存檔 bool C_StringList::Save(IN const nstring &szFilePath, IN bool bAppend, IN bool bAutoWrap, IN unsigned long ulPos, IN unsigned long ulLines) { if(szFilePath.empty()) return C_NOutput::Instance().Error(ERRORNSTD, __T("file empty")); if(ulPos >= m_StringList.size()) return C_NOutput::Instance().Error(ERRORNSTD, __T("pos error(") + szFilePath + __T(")")); std::vector<nstring> DirList; std::list<nstring>::iterator ItorS = GetItor(m_StringList, ulPos); // 開始位置 std::list<nstring>::iterator ItorE = GetItor(m_StringList, ulPos + ulLines); // 結束位置 std::list<nstring>::iterator Itor = ItorS; std::string szTemp; // 取得目錄列表 FindPathDir(szFilePath, DirList, true); // 建立目錄 for(unsigned long ulCount = 0, iMax = DirList.size() - 1; ulCount < iMax; ++ulCount) _tmkdir(DirList[ulCount].c_str()); // 開啟檔案 FILE *f = NULL; if(_tfopen_s(&f, szFilePath.c_str(), bAppend ? __T("a+b") : __T("w+b")) != 0) return C_NOutput::Instance().Error(ERRORNSTD, __T("open file failed(") + szFilePath + __T(")")); if(f == NULL) return C_NOutput::Instance().Error(ERRORNSTD, __T("open file failed(") + szFilePath + __T(")")); while(Itor != ItorE) { // 取得要存檔的字串 szTemp = C_NString(*Itor).c_str(); // 添加換行字元 szTemp += bAutoWrap ? "\n" : ""; // 存檔 fwrite(szTemp.c_str(), szTemp.size(), 1, f); ++Itor; }//while // 關檔 fclose(f); return true; }
//--------------------------------------------------------------------------- void File_Caf::FileHeader_Parse() { //Parsing int16u FileVersion; Skip_C4( "FileType"); Get_B2 (FileVersion, "FileVersion"); Skip_B2( "FileFlags"); FILLING_BEGIN(); Accept(); Fill(Stream_General, 0, General_Format, "CAF"); Fill(Stream_General, 0, General_Format_Version, __T("Version ")+Ztring::ToZtring(FileVersion)); Stream_Prepare(Stream_Audio); if (FileVersion!=1) Finish(); //Version 0 or 2+ are not supported FILLING_END(); }
//--------------------------------------------------------------------------- File_DtvccTransport::File_DtvccTransport() :File__Analyze() { //Configuration ParserName=__T("DTVCC Transport"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_DtvccTransport; StreamIDs_Width[0]=1; #endif //MEDIAINFO_EVENTS PTS_DTS_Needed=true; //In Format=Format_Unknown; AspectRatio=0; //Temp Streams.resize(3); //CEA-608 Field 1, CEA-608 Field 2, CEA-708 Channel }
//----------------------------------------------------------------------------- // 啟動客戶端 bool C_XClient::Start(IN bool bAuto, IN unsigned long ulInterval) { C_ThreadLock ccLock(&m_csCommon); if(m_ccAPI.Initialize() == false) return C_NOutput::Instance().Error(ERRORNSTD, __T("initialize api failed")); if(m_ccKernal.IOCP() != INVALID_HANDLE_VALUE) return C_NOutput::Instance().Error(ERRORNSTD, __T("already start")); if(m_ccThreadMgr.Size() > 0) return C_NOutput::Instance().Error(ERRORNSTD, __T("already start")); HANDLE hIOCP; unsigned long ulThreads = m_ccAPI.WorkThreads(); // 取得工作執行緒數量 // 建立IOCompletionPort if(m_ccAPI.CreateIOCompletionPort(ulThreads, hIOCP) == false) return C_NOutput::Instance().Error(ERRORNSTD, __T("create iocp failed")); // 設定執行緒參數 m_ccThreadMgr.SetParam(XSOCKET_TPARAM_CLIENT, reinterpret_cast<long>(this)); m_ccThreadMgr.SetParam(XSOCKET_TPARAM_THREAD, static_cast<long>(ENUM_XThread_Sleep)); // 這裡故意讓執行緒進入休眠, 等到最後再恢復正常模式 // 建立客戶端IOCP執行緒 for(unsigned long ulCount = 0; ulCount < ulThreads; ++ulCount) { if(m_ccThreadMgr.Create(XThreadClientIOCP) == false) { m_ccAPI.ReleaseIOCompletionPort(hIOCP); return C_NOutput::Instance().Error(ERRORNSTD, __T("create thread failed")); }//if }//for // 建立客戶端處理執行緒 if(m_ccThreadMgr.Create(XThreadClientProc) == false) { m_ccAPI.ReleaseIOCompletionPort(hIOCP); return C_NOutput::Instance().Error(ERRORNSTD, __T("create thread failed")); }//if m_ccKernal.IOCP(hIOCP); m_ccKernal.Interval(ulInterval); m_ccKernal.Auto(bAuto); m_ccThreadMgr.SetParam(XSOCKET_TPARAM_THREAD, static_cast<long>(ENUM_XThread_Normal)); // 執行緒恢復正常模式 return true; }
//--------------------------------------------------------------------------- GUI_Main_Text::GUI_Main_Text(Core* _C, wxWindow* parent) : wxTextCtrl(parent, -1, __T(""), wxPoint(0, 0), wxSize(parent->GetClientSize().GetWidth()-0, parent->GetClientSize().GetHeight()-0), wxTE_READONLY|wxTE_MULTILINE|wxTE_RICH|wxTE_RICH2), GUI_Main_Common_Core(_C) { wxFont Font; Font.SetFamily(wxFONTFAMILY_MODERN); wxTextAttr Attr; Attr.SetFont(Font); //Attr.SetFontSize(8); SetDefaultStyle(Attr); //Drag and Drop #if wxUSE_DRAG_AND_DROP && defined(__WXMAC__) SetDropTarget(new FileDrop(C)); #endif //wxUSE_DRAG_AND_DROP //Update GUI_Refresh(); }
//--------------------------------------------------------------------------- File_Cdp::File_Cdp() :File__Analyze() { //Config PTS_DTS_Needed=true; //Temp ParserName=__T("CDP"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Cdp; StreamIDs_Width[0]=1; #endif //MEDIAINFO_EVENTS Streams.resize(3); //CEA-608 Field 1, CEA-608 Field 2, CEA-708 Channel Streams_Count=0; //In WithAppleHeader=false; AspectRatio=0; }
/* bool: argvalue(index=0, const option[]="", &value=cellmin) * returns true if the option was found and false otherwise */ static cell AMX_NATIVE_CALL n_argvalue(AMX *amx, const cell *params) { const TCHAR *option, *key; int length; cell *cptr; amx_StrParam(amx, params[2], key); cptr = amx_Address(amx, params[3]); option = matcharg(key, (int)params[1], &length); if (option == NULL) return 0; /* check whether we must write the value of the option at all */ if (length > 0 && (_istdigit(*option) || *option == __T('-'))) *cptr = _tcstol(option, NULL, 10); return 1; }
//----------------------------------------------------------------------------- // ±NHRESULT¿ù»~¥N½XÂà´«¬°¦r¦ê nstring HRESULTtoString(IN HRESULT hr) { nstring szResult; LPTSTR pTemp; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, nullptr, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&pTemp, 0, nullptr); if(pTemp) { pTemp[_tcslen(pTemp) - 2] = 0; szResult = pTemp; LocalFree(pTemp); } else szResult = nsoutf(__T("Unknow(0x{x08})")) << hr; return szResult; }
//--------------------------------------------------------------------------- void File_DcpPkl::Streams_Finish() { if (Config->File_IsReferenced_Get() || ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); // Detection of IMF CPL bool IsImf=false; for (size_t StreamKind=Stream_General+1; StreamKind<Stream_Max; StreamKind++) for (size_t StreamPos=0; StreamPos<Count_Get((stream_t)StreamKind); StreamPos++) if (Retrieve((stream_t)StreamKind, StreamPos, "MuxingMode").find(__T("IMF CPL"))==0) IsImf=true; if (IsImf) { Fill(Stream_General, 0, General_Format, "IMF PKL", Unlimited, true, true); Clear(Stream_General, 0, General_Format_Version); } }
/* bool: argstr(index=0, const option[]="", value[]="", maxlength=sizeof value, bool:pack=false) * returns true if the option was found and false otherwise */ static cell AMX_NATIVE_CALL n_argstr(AMX *amx, const cell *params) { const TCHAR *option, *key; int length, max; TCHAR *str; cell *cptr; max = (int)params[4]; if (max <= 0) return 0; amx_StrParam(amx, params[2], key); amx_GetAddr(amx, params[3], &cptr); if (cptr == NULL) { amx_RaiseError(amx, AMX_ERR_NATIVE); return 0; } /* if */ option = matcharg(key, (int)params[1], &length); if (option == NULL) return 0; /* option not found */ /* check whether we must write the value of the option at all; in case the * size is one cell and that cell is already zero, we do not write anything * back */ assert(params[4] > 0); if (params[4] > 1 || *cptr != 0) { if (params[5]) max *= sizeof(cell); if (max > length + 1) max = length + 1; str = (TCHAR *)alloca(max*sizeof(TCHAR)); if (str == NULL) { amx_RaiseError(amx, AMX_ERR_NATIVE); return 0; } /* if */ memcpy(str, option, (max - 1) * sizeof(TCHAR)); str[max - 1] = __T('\0'); amx_SetString(cptr, (char*)str, (int)params[5], sizeof(TCHAR)>1, max); } /* if */ return 1; }
BOOL WINAPI MyHandler(DWORD dwCtrlType) { // test //__asm { int 3 }; if (dwCtrlType != CTRL_BREAK_EVENT) { return FALSE; } //printf("Received ctrl-break event\n"); if (g_dwCtrlRoutineAddr == NULL) { // read the stack base address from the TEB g_dwCtrlRoutineAddr = (LPTHREAD_START_ROUTINE) getCtrlRoutine(); // notify that we now have the address if (!SetEvent(g_hAddrFoundEvent)) { _tprintf(__T("SetEvent failed with 0x08X.\n"), GetLastError()); } } return TRUE; }
//--------------------------------------------------------------------------- void File_Ibi::Ebml_DocType() { Element_Name("DocType"); //Parsing Ztring Data; Get_Local(Element_Size, Data, "Data"); Element_Info1(Data); //Filling FILLING_BEGIN(); if (Data==__T("MediaInfo Index")) Accept("Ibi"); else { Reject("Ibi"); return; } FILLING_END(); }