Facebook
From Sweet Crane, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 1410
  1. diff -u B25Decoder/BonProject/BcasCardReader.cpp B1Decoder/BonProject/BcasCardReader.cpp
  2. --- B25Decoder/BonProject/BcasCardReader.cpp    Fri Sep 25 05:59:12 2009
  3. +++ B1Decoder/BonProject/BcasCardReader.cpp     Mon Mar 30 17:49:33 2015
  4. @@ -150,7 +150,7 @@
  5.  
  6.  const BYTE * CBcasCardReader::GetKsFromEcm(const BYTE *pEcmData, const DWORD dwEcmSize)
  7.  {
  8. -       static const BYTE abyEcmReceiveCmd[] = {0x90U, 0x34U, 0x00U, 0x00U};
  9. +       static const BYTE abyEcmReceiveCmd[] = {0x80U, 0x34U, 0x00U, 0x00U};
  10.  
  11.         // 「ECM Receive Command」を処理する
  12.         if(!m_hBcasCard){
  13. @@ -179,19 +179,41 @@
  14.         // コマンド送信
  15.         if(!TransmitCommand(m_hBcasCard, SendData, sizeof(abyEcmReceiveCmd) + dwEcmSize + 2UL, RecvData, sizeof(RecvData), &dwRecvSize)){
  16.                 ::ZeroMemory(&m_EcmStatus, sizeof(m_EcmStatus));
  17. -               m_dwEcmError = EC_TRANSMIT_ERROR;
  18. +               m_dwEcmError = EC_NO_ERROR;//EC_TRANSMIT_ERROR;
  19.                 return NULL;
  20.                 }
  21.  
  22.         // サイズチェック
  23. -       if(dwRecvSize != 25UL){
  24. +       if(dwRecvSize != 22UL){
  25.                 ::ZeroMemory(&m_EcmStatus, sizeof(m_EcmStatus));
  26. -               m_dwEcmError = EC_TRANSMIT_ERROR;
  27. +               m_dwEcmError = EC_NO_ERROR;//EC_TRANSMIT_ERROR;
  28.                 return NULL;
  29.                 }
  30.  
  31. +       else {
  32.         // レスポンス解析
  33. -       ::CopyMemory(m_EcmStatus.KsData, &RecvData[6], sizeof(m_EcmStatus.KsData));
  34. +               ::CopyMemory(m_EcmStatus.KsData, &RecvData[0], sizeof(m_EcmStatus.KsData));
  35. +               m_dwEcmError = EC_NO_ERROR;
  36. +               return m_EcmStatus.KsData;
  37. +               }
  38. +
  39. +       //const static uint8_t ffff[16] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
  40. +/*             memcpy(dst->scramble_key, prv->rbuf, 16);
  41. +               switch ( load_be_uint16(prv->rbuf+18) ) {
  42. +               case 0xc001 :
  43. +                       dst->return_code = 0x0800 ;
  44. +                       break ;
  45. +               case 0xc000 :
  46. +                       dst->return_code = 0xa901 ;
  47. +                       break ;
  48. +       // 他にどんなコードがあるか不明なのでとりあえずff..ffかどうかでチェック
  49. +       default :
  50. +               if ( !memcmp( dst->scramble_key, ffff, 16 ) ) {
  51. +                       dst->return_code = 0xa902 ;
  52. +               }
  53. +               else {
  54. +                       //dst->return_code = 0x0800 ;
  55. +               }
  56.  
  57.         // リターンコード解析
  58.         switch(((WORD)RecvData[4] << 8) | (WORD)RecvData[5]){
  59. @@ -210,7 +232,7 @@
  60.                 default :
  61.                         m_dwEcmError = EC_NOT_CONTRACTED;
  62.                         return NULL;
  63. -               }
  64. +               }*/
  65.  }
  66.  
  67.  const DWORD CBcasCardReader::GetEcmError(void)
  68. @@ -221,7 +243,7 @@
  69.  
  70.  const bool CBcasCardReader::SendEmmSection(const BYTE *pEmmData, const DWORD dwEmmSize)
  71.  {
  72. -       static const BYTE abyEmmReceiveCmd[] = {0x90U, 0x36U, 0x00U, 0x00U};
  73. +       static const BYTE abyEmmReceiveCmd[] = {0x80U, 0x36U, 0x00U, 0x00U};
  74.  
  75.         // 「EMM Receive Command」を処理する
  76.         if(!m_hBcasCard)return false;
  77. @@ -249,7 +271,7 @@
  78.        
  79.         // リターンコード解析
  80.         switch(((WORD)RecvData[4] << 8) | (WORD)RecvData[5]){
  81. -               case 0x2100U :  // 正常終了
  82. +               case 0x9000U :  // 正常終了
  83.                         return true;
  84.  
  85.                 case 0xA102U :  // 非運用(運用外プロトコル番号)
  86. @@ -281,7 +303,7 @@
  87.         if(dwRecvSize != 20UL)return 0U;               
  88.  
  89.         // リターンコード解析
  90. -       if((((WORD)RecvData[4] << 8) | (WORD)RecvData[5]) != 0x2100U)return 0U;
  91. +       if((((WORD)RecvData[4] << 8) | (WORD)RecvData[5]) != 0x9000U)return 0U;
  92.  
  93.         // レスポンス解析
  94.         const WORD wInfoNum = (WORD)RecvData[7] + 1U;
  95. @@ -300,7 +322,7 @@
  96.                 if(dwRecvSize != 20UL)return 0U;               
  97.  
  98.                 // リターンコード解析
  99. -               if((((WORD)RecvData[4] << 8) | (WORD)RecvData[5]) != 0x2100U)return 0U;
  100. +               if((((WORD)RecvData[4] << 8) | (WORD)RecvData[5]) != 0x9000U)return 0U;
  101.                
  102.                 // レスポンス解析
  103.                 TsTime.ClearTime();
  104. @@ -387,7 +409,7 @@
  105.  
  106.  const bool CBcasCardReader::InitialSetting(const SCARDHANDLE hBcasCard)
  107.  {
  108. -       static const BYTE abyInitSettingCmd[] = {0x90U, 0x30U, 0x00U, 0x00U, 0x00U};
  109. +       static const BYTE abyInitSettingCmd[] = {0x80U, 0x5EU, 0x00U, 0x00U, 0x00U};
  110.  
  111.         // 「Initial Setting Conditions Command」を処理する
  112.         if(!hBcasCard)return false;
  113. @@ -401,12 +423,12 @@
  114.         if(!TransmitCommand(hBcasCard, abyInitSettingCmd, sizeof(abyInitSettingCmd), RecvData, sizeof(RecvData), &dwRecvSize))return false;
  115.  
  116.         // 受信サイズチェック
  117. -       if(dwRecvSize < 57UL)return false;             
  118. +       if(dwRecvSize < 46UL)return false;              //dw
  119.  
  120.         // レスポンス解析
  121. -       ::CopyMemory(m_BcasCardInfo.BcasCardID, &RecvData[8],   6UL);   // +8   Card ID
  122. -       ::CopyMemory(m_BcasCardInfo.SystemKey,  &RecvData[16], 32UL);   // +16  Descrambling system key
  123. -       ::CopyMemory(m_BcasCardInfo.InitialCbc, &RecvData[48],  8UL);   // +48  Descrambler CBC initial value
  124. +       ::CopyMemory(m_BcasCardInfo.BcasCardID, &RecvData[2],   6UL);   // +2   Card ID
  125. +       ::CopyMemory(m_BcasCardInfo.SystemKey,  &RecvData[8], 32UL);    // +8   Descrambling system key
  126. +       ::CopyMemory(m_BcasCardInfo.InitialCbc, &RecvData[8],  8UL);    // +8   Descrambler CBC initial value
  127.  
  128.         // ECMステータス初期化
  129.         ::ZeroMemory(&m_EcmStatus, sizeof(m_EcmStatus));
  130. diff -u B25Decoder/BonProject/TsDescrambler.cpp B1Decoder/BonProject/TsDescrambler.cpp
  131. --- B25Decoder/BonProject/TsDescrambler.cpp     Sat Feb 14 22:11:26 2009
  132. +++ B1Decoder/BonProject/TsDescrambler.cpp      Mon Mar 30 17:48:16 2015
  133. @@ -317,6 +317,7 @@
  134.  
  135.         const WORD wEmmPID = pCaMethodDesc->GetCaPID();
  136.         if(wEmmPID >= TS_INVALID_PID)return;
  137. +       if(wEmmPID == 0x0000)return;
  138.  
  139.         // EMMプロセッサをPIDマップに追加
  140.         m_TsInputMap.MapPid(wEmmPID, dynamic_cast<ITsPidMapTarget *>(CEmmProcessor::CreateInstance(dynamic_cast<ITsDescrambler *>(this))));
  141. @@ -329,7 +330,30 @@
  142.         if(!pDescBlock)return;
  143.        
  144.         const ICaMethodDesc * const pCaMethodDesc = dynamic_cast<const ICaMethodDesc *>(pDescBlock->GetDescByTag(ICaMethodDesc::DESC_TAG));
  145. -       if(!pCaMethodDesc)return;
  146. +       if(!pCaMethodDesc)
  147. +       {
  148. +               //696: If no CA Pids are found in the PMT also check ES for CA Pids!
  149. +               for (DWORD dwPos = 0UL, dwCount = 0UL; dwPos < pPmtTable->GetEsNum(); dwPos++){
  150. +                       const ICaMethodDesc * const ESpCaMethodDesc = dynamic_cast<const ICaMethodDesc *>(pPmtTable->GetEsDesc(dwPos)->GetDescByTag(ICaMethodDesc::DESC_TAG));
  151. +                       if (ESpCaMethodDesc)
  152. +                       {
  153. +                               const WORD wEcmPID = ESpCaMethodDesc->GetCaPID();
  154. +                               if (wEcmPID < TS_INVALID_PID)
  155. +                               {
  156. +                                       // 既存のECMプロセッサを確認
  157. +                                       if (!m_TsInputMap.GetMapTarget(wEcmPID)){
  158. +                                               // ECMプロセッサをPIDマップに追加
  159. +                                               m_TsInputMap.MapPid(wEcmPID, dynamic_cast<ITsPidMapTarget *>(CEcmProcessor::CreateInstance(dynamic_cast<ITsDescrambler *>(this))));
  160. +                                       }
  161. +                                       // ESプロセッサをPIDマップに追加
  162. +                                       if (!m_TsOutputMap.GetMapTarget(pPmtTable->GetEsPID(dwPos))){
  163. +                                               m_TsOutputMap.MapPid(pPmtTable->GetEsPID(dwPos), dynamic_cast<ITsPidMapTarget *>(CEsProcessor::CreateInstance(m_TsInputMap.GetMapTarget(wEcmPID))));
  164. +                                       }
  165. +                               }
  166. +                       }
  167. +               }
  168. +               return;
  169. +       }
  170.  
  171.         const WORD wEcmPID = pCaMethodDesc->GetCaPID();
  172.         if(wEcmPID >= TS_INVALID_PID)return;
  173.  

Replies to B25Decoder.dll to B1 diff rss

Title Name Language When
Re: B25Decoder.dll to B1 diff Torrid Partdridge text 1 Year ago.
Re: B25Decoder.dll to B1 diff Reliable Iguana text 1 Year ago.
Re: B25Decoder.dll to B1 diff Round Stork text 2 Years ago.
Re: B25Decoder.dll to B1 diff Harmless Lizard text 2 Years ago.
Re: B25Decoder.dll to B1 diff Ungracious Cockroach text 2 Years ago.
Re: B25Decoder.dll to B1 diff Perl Mosquito text 2 Years ago.
Re: B25Decoder.dll to B1 diff Mature Lizard text 3 Years ago.