⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dcthrvar.pas

📁 SrcDecompiler is about creating a Delphi program decompiler. The program is written for Delphi 4 or
💻 PAS
字号:
unit dcThrVar;

interface

uses
  dcDecomps;

type
  { TThreadVar }

  TThreadVar = class(TDecompItem)
  private
    FVarSize: Integer;
  public
    function GetDeclaration: string;
    procedure LoadThreadVar;
    property VarSize: Integer read FVarSize write FVarSize;
  end;

implementation

uses
  PEFile, PEFileClass, TypeInfoUtils, SysUtils, Windows;
  
{ TThreadVar }

function TThreadVar.GetDeclaration: string;
begin
  Result := Format('ThreadVar1: %s;', [GetSizeName(VarSize)]);
end;

procedure TThreadVar.LoadThreadVar;
var
  I: Integer;
const
  SizeOfSysThrVar = 8;
begin
  // Find the TLSObject.
  Address := PEFileClass.EntryPoint;
  Size := 0;
  for I := 0 to High(PEFileClass.Objects) do
    if PEFileClass.Objects[I].ObjectName = '.tls' then
    begin
      VarSize := PEFileClass.Objects[I].VirtualSize - SizeOfSysThrVar;
      // Destroy yourself if there is no threadvar.
      if VarSize = 0 then
        Free;
      exit;
    end;
  Free;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -