亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dcunits.pas

?? SrcDecompiler is about creating a Delphi program decompiler. The program is written for Delphi 4 or
?? PAS
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
unit dcUnits;

interface

uses
  Classes, PEFile, Procs, dcDecomps, dcDFMs, MethodLists;

type
  { TUnit }

  TUnits = class;

  TUnitType = (utNormal, utSystem, utProgram);

  TUnit = class(TCollectionItem)
  private
    FAddress: PChar;
    FSize: Integer;
    FAInit: TProc;
    FFInit: TProc;
    FName: string;
    FUnitType: TUnitType;
    FDFM: TdcDFM;
    FPEFileClass: TPEFile;

    FDecompItems: TList;
    FImplUnits: TList;
    FIntfUnits: TList;
    FUnitSrc: TStrings;
    FImportedUnit: Boolean;

    FComments: TStrings;

    procedure SetName(Value: string);
    function GetImplUnitCount: Integer;
    function GetImplUnit(Index: Integer): TUnit;
    function GetIntfUnitCount: Integer;
    function GetIntfUnit(Index: Integer): TUnit;
    procedure SetAInit(AInit: TProc);
  public
    constructor Create(Collection: TCollection); override;
    destructor Destroy; override;
    function FindProcByName(Name: string): TProc;
    function FindClassByName(Name: string): TClassInfo;
    procedure InsertImplUnit(Index: Integer; AUnit: TUnit);
    procedure AddImplUnit(AUnit: TUnit);
    procedure InsertIntfUnit(Index: Integer; AUnit: TUnit);
    procedure AddIntfUnit(AUnit: TUnit);
    procedure GenUnitSrc;
    procedure DeterIntfImpl;

    property Address: PChar read FAddress write FAddress;
    property Size: Integer read FSize write FSize;
    property Init: TProc read FAInit write SetAInit;
    property FInit: TProc read FFInit write FFInit;
    property Name: string read FName write SetName;
    property UnitSrc: TStrings read FUnitSrc;
    property UnitType: TUnitType read FUnitType;
    property DFM: TdcDFM read FDFM write FDFM;
    property PEFileClass: TPEFile read FPEFileClass;

    property DecompItems: TList read FDecompItems;
    property ImplUnitCount: Integer read GetImplUnitCount;
    property ImplUnits[Index: Integer]: TUnit read GetImplUnit;
    property IntfUnitCount: Integer read GetIntfUnitCount;
    property IntfUnits[Index: Integer]: TUnit read GetIntfUnit;
    property ImportedUnit: Boolean read FImportedUnit;

    property Comments: TStrings read FComments;
  end;

  { TUnits }

  TUnits = class(TCollection)
  private
    FPEFileClass: TPEFile;
    FSysInitUnit: TUnit;
    FSystemUnit: TUnit;
    FProgramUnit: TUnit;
    FFirstNormalUnit: TUnit;
    
    FOnAssignUnits: TmlneMethodList;
    function GetItem(Index: Integer): TUnit;
    procedure SetItem(Index: Integer; Value: TUnit);
  public
    constructor Create(PEFileClass: TPEFile); reintroduce; overload;
    destructor Destroy; override;
    function FindInUnitUsingFInit(Address: PChar): TUnit;
    function FindInUnit(Address: PChar): TUnit;
    function FindByName(const Name: string): Integer;
    procedure GenerateReqUnits;
    procedure GenerateNames;
    procedure GenUnitSrcs;
    procedure DeterIntfImpls;
    procedure AssignUnits;
    procedure LoadInitFInit;

    property Items[Index: Integer]: TUnit read GetItem write SetItem; default;

    property OnAssignUnits: TmlneMethodList read FOnAssignUnits;
    property PEFileClass: TPEFile read FPEFileClass;
    property SysInitUnit: TUnit read FSysInitUnit;
    property SystemUnit: TUnit read FSystemUnit;
    property ProgramUnit: TUnit read FProgramUnit;
    property FirstNormalUnit: TUnit read FFirstNormalUnit;
  end;

implementation

uses
  {$IFOPT D+} dcDebug, {$ENDIF}
  SysUtils, PEFileClass, Vars, TypInfo, dcNTInfoTypes, dcThrVar, dcTypeIntf,
  DisAsm;

{ TUnit }

constructor TUnit.Create(Collection: TCollection);
begin
  inherited Create(Collection);
  FDecompItems := TList.Create;
  FImplUnits := TList.Create;
  FIntfUnits := TList.Create;
  FUnitSrc := TStringList.Create;
  FPEFileClass := (Collection as TUnits).FPEFileClass;
  FComments := TStringList.Create;
end;

destructor TUnit.Destroy;
begin
  FComments.Free;
  FUnitSrc.Free;
  FIntfUnits.Free;
  FImplUnits.Free;
  FDecompItems.Free;
  inherited Destroy;
end;

procedure TUnit.SetName(Value: string);
var
  I: Integer;
resourcestring
  SUnitNameAlreadyExists = 'Unit named %s already exists.';
  SUnitAlreadyHasAName = 'Cann''t change that name to %s, because it is already set to %s.';
begin
  if AnsiCompareText(Value, FName) = 0 then Exit;

  if FName <> '' then
    raise EDecompilerError.CreateFmt(SUnitAlreadyHasAName, [FName, Value]);

  for I := 0 to TPEFileClass(PEFileClass).Units.Count -1 do
    if TPEFileClass(PEFileClass).Units[I].Name = Value then
      raise EDecompilerError.CreateFmt(SUnitNameAlreadyExists, [Value]);

  FName := Value;
end;

function TUnit.GetImplUnitCount: Integer;
begin
  Result := FImplUnits.Count;
end;

procedure TUnit.InsertImplUnit(Index: Integer; AUnit: TUnit);
var
  I: Integer;
begin
  // exit when the unit is not in one list already, or it is a system unit.
  if (FIntfUnits.IndexOf(AUnit) <> -1) or
     (AUnit.Index < 2) or
     (AUnit = Self) then
    exit;
  I := FImplUnits.IndexOf(AUnit);
  if I = -1 then
    FImplUnits.Insert(Index, AUnit)
  else
    if I >= Index then
      FImplUnits.Move(I, Index)
    else
      FImplUnits.Move(I, Index -1);
end;

procedure TUnit.AddImplUnit(AUnit: TUnit);
begin
  InsertImplUnit(ImplUnitCount, AUnit);
end;

function TUnit.GetImplUnit(Index: Integer): TUnit;
begin
  Result := TUnit(FImplUnits[Index]);
end;

function TUnit.GetIntfUnitCount: Integer;
begin
  Result := FIntfUnits.Count;
end;

procedure TUnit.InsertIntfUnit(Index: Integer; AUnit: TUnit);
var
  I: integer;
begin
  // exit when the unit is not in the list already, or it is a system unit.
  if (AUnit.Index < 2) or (AUnit = Self) then
    exit;
  // If this is the program unit only add it to the impl unit.
  if UnitType = utProgram then
  begin
    AddImplUnit(AUnit);
    Exit;
  end;
  // If the unit is in the Impl Unit list remove it from there
  FImplUnits.Remove(AUnit);
  I := FIntfUnits.IndexOf(AUnit);
  if I = -1 then
    FIntfUnits.Insert(Index, AUnit)
  else
    if I >= Index then
      FIntfUnits.Move(I, Index)
    else
      FIntfUnits.Move(I, Index -1);
end;

procedure TUnit.AddIntfUnit(AUnit: TUnit);
begin
  InsertIntfUnit(IntfUnitCount, AUnit);
end;

function TUnit.GetIntfUnit(Index: Integer): TUnit;
begin
  Result := TUnit(FIntfUnits[Index]);
end;

procedure TUnit.SetAInit(AInit: TProc);
begin
  if AInit.Address[0] = #$FF then
    FImportedUnit := True;
  FAInit := AInit;
end;

function TUnit.FindProcByName(Name: string): TProc;
var
  I: Integer;
begin
  for I := 0 to FDecompItems.Count -1 do
  begin
    Result := TProc(FDecompItems[I]);
    if (TDecompItem(Result) is TProc) and (Result.Name = Name) then
      exit;
  end;
  Result := nil;
end;

function TUnit.FindClassByName(Name: string): TClassInfo;
var
  I: Integer;
begin
  for I := 0 to FDecompItems.Count -1 do
  begin
    Result := TClassInfo(FDecompItems[I]);
    if (TDecompItem(Result) is TClassInfo) and (Result.AClass.ClassName = Name) then
      exit;
  end;
  Result := nil;
end;

function DecompItemSortBssBeforeData(Item1, Item2: Pointer): Integer;
begin
  Result := TDecompItem(Item1).Address - TDecompItem(Item2).Address;
  // if both decomp items are vars and one is in the BSS section and the other not,
  // put the one in the bss section before the other.
  if (TDecompItem(Item1) is TVar) and (TDecompItem(Item2) is TVar) then
  begin
    if (TDecompItem(Item1).Address >= TVar(Item1).PEFileClass.BSS) and
       (TDecompItem(Item2).Address < TVar(Item1).PEFileClass.BSS) then
      Result := -1;
    if (TDecompItem(Item1).Address < TVar(Item1).PEFileClass.BSS) and
       (TDecompItem(Item2).Address >= TVar(Item1).PEFileClass.BSS) then
      Result := 1;
  end;
end;

procedure TUnit.GenUnitSrc;
type
  TSectionType = (stConst, stType, stVar, stProc, stLabel, stResourceString, stThreadVar);
var
  SectionType: TSectionType;
  Vars: TStringList;
  Consts: TStringList;

  procedure SetSectionType(ASectionType: TSectionType);
  const
    SectionTypeDecl: array[TSectionType] of string = ('const', 'type',
      'var', '', 'label', 'resourcestring', 'threadvar');
  var
    I: Integer;
  begin
    if ASectionType = SectionType then exit;
    // Add the vars if they exits.
    if Vars.Count > 0 then
    begin
      if SectionType <> stVar then
        UnitSrc.Add('var');
      for I := 0 to Vars.Count -1 do
        UnitSrc.Add(Vars[I]);
      Vars.Clear;
      SectionType := stVar;
    end;
    // Add the Consts if thet exits.
    if Consts.Count > 0 then
    begin
      if SectionType <> stConst then
        UnitSrc.Add('const');
      for I := 0 to Consts.Count -1 do
        UnitSrc.Add(Consts[I]);
      Consts.Clear;
      SectionType := stConst;
    end;
    if ASectionType = SectionType then exit;
    UnitSrc.Add(SectionTypeDecl[ASectionType]);
    SectionType := ASectionType;
  end;

  procedure AddComments(Strings: TStrings);
  begin
    if Strings.Count <> 0 then
    begin
      UnitSrc.Add('{');
      UnitSrc.AddStrings(Strings);
      UnitSrc.Add('}');
    end;
  end;

const
  BeginUnit = 'unit %s;' + #13#10#13#10 + 'interface';
  BeginProgram: array[TProjectType] of string = ('program %s;', 'library ^s;', 'package %s;');
  UsesClause = #13#10'uses';
  ContainsClause = #13#10'contains';
  ImplUnit = #13#10'implementation';
  EndUnit = #13#10'end.';
  DFMInclude = '{$R *.DFM}'#13#10;
var
  I, J, K, L, M: Integer;
  Changed: Boolean;
  Str: string;
begin
  // Add unit comments.
  AddComments(Comments);
  
  Vars := TStringList.Create;
  try
   Consts := TStringList.Create;
   try
    // Don't generate unit source if this is a system unit.
    if UnitType = utSystem then exit;
    if UnitType <> utProgram then
    begin
      // Start with the unit name and interface.
      UnitSrc.Add(Format(BeginUnit, [Name]));
    end
    else
      // It is the program "unit"
      UnitSrc.Add(Format(BeginProgram[TPEFileClass(FPEFileClass).ProjectType], [Name]));

    // Sort the decompItems (In this following they were also declared).
    DecompItems.Sort(DecompItemSortBssBeforeData);
    // Set all the req items before the items which requires them (possible endless loop).
    repeat
      Changed := False;
      for I := 0 to DecompItems.Count -1 do
      begin
        for J := 0 to TDecompItem(DecompItems[I]).ReqDecompCount -1 do
        begin
          with TDecompItem(DecompItems[I]) do
          begin

            // Don't Move if it is a proc or a type info which doesn't have a
            // type def or a ClassInfo which is requires by TypeInfo.
            if not ((ReqDecomps[J] is TProc) or
                   ((ReqDecomps[J] is TTypeInfoInfo) and
                    (not TTypeInfoInfo(ReqDecomps[J]).HasTypeDef))) then
            begin
              // Move the req item before the other.
              K := Self.DecompItems.IndexOf(ReqDecomps[J]);
              if K > I then
              begin
                // if there is a type and req item is a class, then it must only

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品免费观看视频| 亚洲天堂a在线| 在线观看视频欧美| 国产成人精品在线看| 日韩不卡手机在线v区| 另类欧美日韩国产在线| 亚洲日本韩国一区| 亚洲精品在线免费观看视频| 欧美无乱码久久久免费午夜一区| 国产高清久久久| 日韩精品乱码免费| 亚洲一二三区视频在线观看| 中文字幕av一区二区三区免费看| 欧美不卡视频一区| 欧美日产国产精品| 在线观看av一区| 99re视频精品| 高清不卡在线观看| 国产成人av一区二区三区在线观看| 日韩影院在线观看| 午夜精品久久久久久久99水蜜桃| 亚洲欧洲日产国码二区| 日本一区二区三区四区| 日韩免费高清视频| 欧美一区二区三区日韩| 欧美日韩在线综合| 在线看不卡av| 欧洲生活片亚洲生活在线观看| 成人h动漫精品| 国产成人精品亚洲日本在线桃色 | 国产欧美日韩另类一区| 亚洲精品在线免费观看视频| 精品免费国产一区二区三区四区| 欧美一区午夜视频在线观看| 欧美日韩高清影院| 4438x亚洲最大成人网| 欧美日本一区二区在线观看| 欧美电影一区二区三区| 5566中文字幕一区二区电影| 欧美另类久久久品| 欧美一区二区三区色| 日韩一级视频免费观看在线| 日韩欧美中文一区二区| 欧美xingq一区二区| 久久综合99re88久久爱| 欧美国产日本视频| **欧美大码日韩| 亚洲午夜精品网| 亚洲成人激情自拍| 美女国产一区二区三区| 精品一区二区三区视频| 国产毛片精品一区| av在线不卡电影| 91行情网站电视在线观看高清版| 色国产综合视频| 7777精品伊人久久久大香线蕉| 777a∨成人精品桃花网| 久久一夜天堂av一区二区三区| 久久精品夜色噜噜亚洲aⅴ| 中文字幕日韩av资源站| 亚洲一区二区三区四区在线观看 | 夜夜嗨av一区二区三区中文字幕 | 日韩一卡二卡三卡| 日本一区二区在线不卡| 国产精品一二三区在线| 91老师国产黑色丝袜在线| 欧美男女性生活在线直播观看| 日韩欧美国产综合在线一区二区三区| 精品第一国产综合精品aⅴ| 国产精品大尺度| 亚洲va天堂va国产va久| 国产一区久久久| 91麻豆免费观看| 91精品国产福利| 国产精品萝li| 日韩国产高清在线| 大陆成人av片| 欧美精品 日韩| 亚洲欧洲av在线| 免费看欧美女人艹b| www.日韩大片| 日韩精品一区在线| 亚洲免费看黄网站| 久久电影网电视剧免费观看| 99国产欧美另类久久久精品| 日韩一级高清毛片| 1000部国产精品成人观看| 日产国产欧美视频一区精品| 94色蜜桃网一区二区三区| 欧美一区二区三区公司| 亚洲人精品午夜| 精品影视av免费| 欧美日韩一区二区在线视频| 中文字幕欧美激情| 日韩精品三区四区| 一本色道久久综合亚洲精品按摩| 26uuu国产电影一区二区| 亚洲一区免费观看| 成人精品高清在线| wwwwxxxxx欧美| 日韩中文字幕麻豆| 色菇凉天天综合网| 国产精品久久看| 狠狠色狠狠色综合系列| 7777精品伊人久久久大香线蕉经典版下载 | 欧美激情一区三区| 蜜桃精品视频在线| 欧美影院午夜播放| 亚洲老司机在线| heyzo一本久久综合| 久久综合久久鬼色中文字| 午夜精品久久久久久久99樱桃| 91视频国产资源| 欧美国产日韩精品免费观看| 激情五月婷婷综合| 欧美电影免费观看高清完整版| 亚洲午夜国产一区99re久久| 99在线热播精品免费| 久久精品视频在线看| 久久精品国产久精国产爱| 欧美高清精品3d| 午夜亚洲福利老司机| 欧美午夜片在线看| 亚洲综合激情网| 欧美色大人视频| 亚洲永久免费av| 在线视频国内自拍亚洲视频| 亚洲图片另类小说| 日本一区二区视频在线观看| 国产一区二区三区黄视频| 精品免费日韩av| 紧缚捆绑精品一区二区| 精品久久久久香蕉网| 久久99国产精品尤物| 26uuuu精品一区二区| 国产乱码精品一区二区三区忘忧草| 日韩三级在线观看| 九九九久久久精品| 久久久美女艺术照精彩视频福利播放| 美女mm1313爽爽久久久蜜臀| 日韩午夜精品视频| 精品中文av资源站在线观看| 26uuu久久天堂性欧美| 国产自产v一区二区三区c| 久久久久久一二三区| 成人av电影在线观看| 亚洲伦理在线精品| 欧美日韩国产另类一区| 免费观看在线色综合| 久久这里只精品最新地址| 成人爽a毛片一区二区免费| 成人欧美一区二区三区1314| 在线免费观看成人短视频| 亚洲福利国产精品| 91精品国产一区二区三区蜜臀 | 色婷婷亚洲精品| 亚洲va中文字幕| 精品国产不卡一区二区三区| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 成人动漫在线一区| 亚洲一级二级三级在线免费观看| 欧美精品777| 国产精品一区二区在线观看不卡| 中文字幕av一区二区三区免费看| 色视频一区二区| 日本不卡免费在线视频| 国产欧美一区二区精品性色超碰| 99精品欧美一区二区三区小说 | 国产午夜精品一区二区| 色天使色偷偷av一区二区| 石原莉奈一区二区三区在线观看| 亚洲一区二区美女| www成人在线观看| 色琪琪一区二区三区亚洲区| 日av在线不卡| 中文字幕视频一区| 欧美一级理论性理论a| 成人av在线一区二区三区| 首页国产丝袜综合| 国产精品系列在线| 日韩一区二区三区免费看| av一区二区三区黑人| 青青草精品视频| 1区2区3区欧美| 精品三级av在线| 日本精品裸体写真集在线观看| 麻豆精品视频在线观看视频| ...中文天堂在线一区| 欧美电视剧在线观看完整版| 91偷拍与自偷拍精品| 精品制服美女丁香| 亚洲福利一二三区| 亚洲欧洲成人自拍| 久久久噜噜噜久噜久久综合| 欧美精品1区2区3区| 色综合色狠狠天天综合色| 国产福利一区二区| 久久国内精品自在自线400部| 夜夜嗨av一区二区三区网页| 中文字幕精品一区二区三区精品 |