zoukankan      html  css  js  c++  java
  • Symbian源代码还原之一,二,三,四,五(转)

    原创  Symbian源代码还原之一——TRect CCoeControl::Rect(void) const 

    收藏

    重要声明:由于Symbian的源代码不是任何人都能得到的,所以这大大限制了我们对Symbian的理解。现在我在业余时间对Symbian框架的模拟器版本代码进行了相应的逆向还原。注意,仅供参考,由于本代码造成的任何问题,均与本人无关!

    TRect CCoeControl::Rect(void) const
    {
     TPoint point;
     TSize  sz;
     if ( OwnsWindow() )
     {
      point.SetXY(0, 0); 
     }
     else
     {
      point = iPosition;
      sz = iSize;
     }
    
     TRect  rect(point, sz);
     return rect;
    }
    
    发表于 @ 2009年08月20日 18:22:00 | 评论( 1 ) 举报收藏

    原创  Symbian源代码还原之二——void CCoeControl::DrawNow(void) const 收藏

        以下是s60 3rd的void CCoeControl::DrawNow(void) const逆向还原,如有错误之处,敬请批评指正:)

    void CCoeControl::DrawNow(void) const
    {
     TRect rect = Rect();
     DrawNow(rect);
    }
    
    void CCoeControl::DrawNow(class TRect const & aRect) const
    {
     if (EFalse == IsReadyToDraw())
     {
      return;
     }
     TBool isBackup = IsBackedUp();
     if (EFalse == isBackup)
     {
      Window()->Invalidate(aRect);
      Window()->BeginRedraw(aRect);
     }
     const CCoeControl* parentCtrl = SearchParent(this);
     if (parentCtrl)
     {
      if (EFalse == parentCtrl->OwnsWindow())
      {
       User::Invariant();
      }
      parentCtrl->ActivateGc();
      MCoeControlBackground ctrlBackgroud = parentCtrl->FindBackground();
      if (ctrlBackgroud)
      {
       CWindowGc& gc = SystemGc();
       ctrlBackgroud->Draw(gc, parentCtrl, aRect);
      }
      parentCtrl->Draw(aRect);
      parentCtrl->DrawComponents(aRect); 
      parentCtrl->DeactivateGc();
      if (EFalse == isBackup)
      {
       Window()->EndRedraw();
      }
      parentCtrl->DrawWindowOwningComponentsNow(aRect); 
     }
     else
     {
      ActivateGc();
      Draw(aRect);
      DrawComponents(aRect);
      DeactivateGc();
      if (EFalse == isBackup)
      {
       Window()->EndRedraw();
      }
      DrawWindowOwningComponentsNow(aRect);
     }
    }
    
    
    
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/sapair/archive/2009/08/24/4477034.aspx

    发表于 @ 2009年08月24日 09:58:00 | 评论( 1 ) 举报收藏

    原创  Symbian源代码还原之三——void CCoeControl::ActivateL(void) 收藏

          ActivateL是个好东西,好多人都想知道其内部实现,可惜苦于没有源代码。现在我把逆向代码贴出来,让大家一饱眼福,呵呵。错误在所难免。

    void CCoeControl::ActivateL(void)
    {
     if (iFlags & 0x80000)  
     {
      User::LeaveNoMemory();
     }
     if (EFalse == IsActivated())  
     {
      iFlags |= 0x10; // set to Activate
      if (OwnsWindow())
      {
       iWin->Activate();
       if (CapturesPointer())
       {
            if (IsReadyToDraw())
           {
            iCoeEnv->WsSession()->PurgePointerEvents();
           }   
    
       }
       if (IsBackedUp())
       {
        DrawNow();
       }
      }
      //RCoeDynamicDataStorage 相关操作,这个类并没有任何资料,所以关于这个类的相关操作,我们无从得知。
     }
     TInt ctrlCounts = CountComponentControls();
     TInt index = 0;
     while (index < ctrlCounts)
     {
      CCoeControl* subCtrlPtr = ComponentControl(index);
      subCtrlPtr->ActivateL();
      index++;
     }
     
     }
    

    发表于 @ 2009年08月24日 10:03:00 | 评论( 0 ) 举报收藏

    原创  Symbian源代码还原之四——const CCoeControl* CCoeControl::SearchParent(const CCoeControl* aParentToFind) 收藏

    const CCoeControl* CCoeControl::SearchParent(const CCoeControl* aParentToFind) 
    {
     if (NULL == aParentToFind)
     {
      return NULL;
     }
     CCoeControl* tmpCtrlPtr = aParentToFind;
     TInt count = 0x64;
     do 
     {
      if (ETrue == tmpCtrlPtr->OwnsWindow())
      {
       return tmpCtrlPtr;
      }
      tmpCtrlPtr = tmpCtrlPtr->Parent();
      count--; 
     } while (count);
     User::Invariant();
     return NULL;
    }

    发表于 @ 2009年08月24日 10:10:00 | 评论( 0 ) 举报收藏

    原创  Symbian源代码还原之五——判断函数 收藏

    int CCoeControl::OwnsWindow(void) const
    {
     return iFlags & 4;
    }
    
    int CCoeControl::IsBackedUp(void) const
    {
     return iFlags & 0x100;
    }
    
    int  CCoeControl::IsActivated(void) const
    {
     return iFlags & 0x10;
    }
    
    int CCoeControl::IsBlank(void) const
    {
     return iFlags & 0x1000;
    }
    
    int CCoeControl::IsBeingDestroyed(void) const
    {
     return iFlags & 0x40000;
    }

    发表于 @ 2009年08月24日 10:12:00 | 评论( 0 ) 举报收藏

  • 相关阅读:
    ubuntu9.10在AMD 双核上的安装
    修改wamp默认安装下MySQL的root账户密码
    IE6 IE7 IE8 火狐浏览器兼容问题
    在windows xp下安装ubuntu9.10
    制作Ubuntu U 盘启动盘在ubuntu12.04中
    使用StackTraceElement封装,打印调试代码!
    String字符串拼接原理剖析
    List中的数据如何根据对象的某一个或多个字段排序引出Comparable和comparator的使用
    String类的split方法
    通过例子看六种异常处理的陋习
  • 原文地址:https://www.cnblogs.com/yaoliang11/p/1894412.html
Copyright © 2011-2022 走看看