Delphi程序,已知机器码是:558BEC 要求反转为: EC8B55
试题分析:
已知机器码是:558BEC
要求反转为: EC8B55
//第1次 总长度-1-0
//第2次 总长度-1-2
//第3次 总长度-1-2-2
{
所以:
用了下面的自定义
uses
StrUtils;
function cal(n: integer): integer;
begin
result := 2 * n;
end;
再弹框测试得到中间值是否正确,不断修改程序达到预期
}
//使用右面这个函数来截取: MidStr(字符串,开始位置,长度数量)
完整实现代码如下:
unit Unit3; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm3 = class(TForm) Button1: TButton; Edit1: TEdit; Edit2: TEdit; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form3: TForm3; implementation {$R *.dfm} uses StrUtils; function cal(n: integer): integer; begin result := 2 * n; end; procedure TForm3.Button1Click(Sender: TObject); var b: Integer; A1: string; begin for b := 0 to ((Length(Edit1.Text)) div 2) do begin if b = ((Length(Edit1.Text)) div 2) then break; ShowMessage(IntToStr(cal(b))); ShowMessage(MidStr(Edit1.Text, Length(Edit1.Text) - 1 - cal(b), 2)); A1 := MidStr(Edit1.Text, Length(Edit1.Text) - 1 - cal(b), 2); Edit2.Text := Edit2.Text + A1; end; end; procedure TForm3.Button2Click(Sender: TObject); begin ShowMessage(MidStr(Edit1.Text, Length(Edit1.Text) - 1, 2)); ShowMessage(MidStr(Edit1.Text, Length(Edit1.Text) - 1 - 2, 2)); ShowMessage(MidStr(Edit1.Text, Length(Edit1.Text) - 1 - 2 - 2, 2)); end;
采用EnigmaVirtualBox制作单文件便携版只是兴趣爱好,在WES7环境中制作,不保证全系统下正常,随缘随心随性。
温馨提醒建议在SandBoxie中测试https://www.lanzous.com/iatkifc