View Single Post
  #2  
Old 11-01-2014, 14:11
altef_4's Avatar
altef_4 altef_4 is offline
Registered User
 
Join Date: Mar 2012
Location: Ukraine
Posts: 361
Thanks: 248
Thanked 1,022 Times in 239 Posts
altef_4 is on a distinguished road
Quote:
Originally Posted by Razor12911 View Post
another update pending don't worry.

I'm afraid not, Credits cannot be removed like y_thelastknight said, and also what riodsa123, this is a freeware software and a lot of people spent their time bringing up this program so it can't be done.

and altef_4, y_thelastknight, logrim, pakrat2k2, sentinelks; I finally did this function to read imported regs. can y'all understand it? it can read strings, dword and binary, I'll have to move on to Multistring and ExpandString Soon.

Can't believe I can do such at my age. I'll kill everyone when I get to varsity.

Code:
var
  X: Integer;
  RegType: String;
  FirstLine: Boolean;
begin
  OpenDialog1.Filter := 'Registry Files (*.reg)|*.reg';
  if OpenDialog1.Execute then
  begin
    if FileExists(OpenDialog1.FileName) then
    begin
      Memo1.Lines.LoadFromFile(OpenDialog1.FileName);  //loading regystry entries
      X := 1;
      FirstLine := True;
      repeat //starting reading a file
        RegType := AnsiLeftStr(AnsiRightStr(Memo1.Lines.Strings[X + 2],
          Length(Memo1.Lines.Strings[X + 2]) -
          Length(ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2], AnsiPos('=',
          Memo1.Lines.Strings[X + 2]) - 1), '"', '')) - 3),
          AnsiPos(':', AnsiRightStr(Memo1.Lines.Strings[X + 2],
          Length(Memo1.Lines.Strings[X + 2]) -
          Length(ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2], AnsiPos('=',
          Memo1.Lines.Strings[X + 2]) - 1), '"', '')) - 3))); //cutting off string line to get resource type as name |dword:,hex:,="string"
        if (RegType = 'dword:') or (RegType = 'hex:') or
          (AnsiPos('"="', Memo1.Lines.Strings[X + 2]) <> 0) or
          (AnsiPos('@="', Memo1.Lines.Strings[X + 2]) <> 0) or
          (AnsiPos('@=dword:', Memo1.Lines.Strings[X + 2]) <> 0) or
          (AnsiPos('@=hex:', Memo1.Lines.Strings[X + 2]) <> 0) then
        begin //if finding res type then run next part
          StringGrid6.RowCount := StringGrid6.RowCount + 1; //adding new row to list
          if FirstLine then
          begin
            FirstLine := False;
            StringGrid6.Cells[0, StringGrid6.RowCount - 1] :=
              ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[2],
              AnsiPos('\', Memo1.Lines.Strings[2]) - 1), '[', '');
            StringGrid6.Cells[1, StringGrid6.RowCount - 1] :=
              ReplaceStr(ReplaceStr(AnsiRightStr(Memo1.Lines.Strings[2],
              Length(Memo1.Lines.Strings[2]) - Length(StringGrid6.Cells[0,
              StringGrid6.RowCount - 1]) - 2), ']', ''), '\Wow6432Node', '');  //preparing StringGrid if this first line
          end
          else
          begin
            if AnsiPos('[H', Memo1.Lines.Strings[X + 1]) <> 0 then //checking if path or key exists
            begin
              StringGrid6.Cells[0, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 1],
                AnsiPos('\', Memo1.Lines.Strings[X + 1]) - 1), '[', '');
              StringGrid6.Cells[1, StringGrid6.RowCount - 1] :=
                ReplaceStr(ReplaceStr(AnsiRightStr(Memo1.Lines.Strings[X + 1],
                Length(Memo1.Lines.Strings[X + 1]) - Length(StringGrid6.Cells[0,
                StringGrid6.RowCount - 1]) - 2), ']', ''), '\Wow6432Node', '');
            end
            else
            begin
              StringGrid6.Cells[0, StringGrid6.RowCount - 1] :=
                StringGrid6.Cells[0, StringGrid6.RowCount - 2];
              StringGrid6.Cells[1, StringGrid6.RowCount - 1] :=
                StringGrid6.Cells[1, StringGrid6.RowCount - 2];
            end;
          end;
          if (AnsiPos('"="', Memo1.Lines.Strings[X + 2]) <> 0) or
            (AnsiPos('@="', Memo1.Lines.Strings[X + 2]) <> 0) then
            StringGrid6.Cells[2, StringGrid6.RowCount - 1] := 'String'; //writing res type to stringgrid
          if (RegType = 'dword:') or
            (AnsiPos('@=dword:', Memo1.Lines.Strings[X + 2]) <> 0) then
            StringGrid6.Cells[2, StringGrid6.RowCount - 1] := 'DWORD';//writing res type to stringgrid
          if (RegType = 'hex:') or
            (AnsiPos('@=hex:', Memo1.Lines.Strings[X + 2]) <> 0) then
            StringGrid6.Cells[2, StringGrid6.RowCount - 1] := 'Binary';//writing res type to stringgrid
          if StringGrid6.Cells[2, StringGrid6.RowCount - 1] = 'String' then
          begin
            if (AnsiPos('"="', Memo1.Lines.Strings[X + 2]) <> 0) then
            begin
              StringGrid6.Cells[3, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2],
                AnsiPos('=', Memo1.Lines.Strings[X + 2]) - 1), '"', '');
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                AnsiLeftStr
                (ReplaceStr(ReplaceStr(AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 4), '\\', '\'), '\"', '"'),
                Length(ReplaceStr(ReplaceStr(AnsiRightStr(Memo1.Lines.Strings[X
                + 2], Length(Memo1.Lines.Strings[X + 2]) -
                Length(StringGrid6.Cells[3, StringGrid6.RowCount - 1]) - 4),
                '\\', '\'), '\"', '"')) - 1);
            end
            else
            begin
              StringGrid6.Cells[3, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2],
                AnsiPos('=', Memo1.Lines.Strings[X + 2]) - 1), '@', '');
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                AnsiLeftStr
                (ReplaceStr(ReplaceStr(AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 3), '\\', '\'), '\"', '"'),
                Length(ReplaceStr(ReplaceStr(AnsiRightStr(Memo1.Lines.Strings[X
                + 2], Length(Memo1.Lines.Strings[X + 2]) -
                Length(StringGrid6.Cells[3, StringGrid6.RowCount - 1]) - 3),
                '\\', '\'), '\"', '"')) - 1);
            end; //preparing and writing values
          end;
          if StringGrid6.Cells[2, StringGrid6.RowCount - 1] = 'DWORD' then
          begin
            if RegType = 'dword:' then
            begin
              StringGrid6.Cells[3, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2],
                AnsiPos('=', Memo1.Lines.Strings[X + 2]) - 1), '"', '');
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                '0x' + AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 9);
            end
            else
            begin
              StringGrid6.Cells[3, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2],
                AnsiPos('=', Memo1.Lines.Strings[X + 2]) - 1), '@', '');
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                '0x' + AnsiLeftStr(AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 8),
                Length(AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 3)) - 1);
            end;
          end;//preparing and writing values
          if StringGrid6.Cells[2, StringGrid6.RowCount - 1] = 'Binary' then
          begin
            if RegType = 'hex:' then
            begin
              StringGrid6.Cells[3, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2],
                AnsiPos('=', Memo1.Lines.Strings[X + 2]) - 1), '"', '');
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 7), ',', ' ');
              repeat
                if AnsiPos('\', Memo1.Lines.Strings[X + 2]) <> 0 then
                begin
                  X := X + 1;
                  StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                    StringGrid6.Cells[4, StringGrid6.RowCount - 1] +
                    ReplaceStr(Memo1.Lines.Strings[X + 2], ',', ' ');
                end;
              until AnsiPos('\', Memo1.Lines.Strings[X + 2]) = 0;
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                ReplaceStr(StringGrid6.Cells[4, StringGrid6.RowCount - 1],
                ' \ ', '');
            end
            else
            begin
              StringGrid6.Cells[3, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(Memo1.Lines.Strings[X + 2],
                AnsiPos('=', Memo1.Lines.Strings[X + 2]) - 1), '@', '');
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                ReplaceStr(AnsiLeftStr(AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 6),
                Length(AnsiRightStr(Memo1.Lines.Strings[X + 2],
                Length(Memo1.Lines.Strings[X + 2]) - Length(StringGrid6.Cells[3,
                StringGrid6.RowCount - 1]) - 3)) - 1), ',', ' ');
              repeat
                if AnsiPos('\', Memo1.Lines.Strings[X + 2]) <> 0 then
                begin
                  X := X + 1;
                  StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                    StringGrid6.Cells[4, StringGrid6.RowCount - 1] +
                    ReplaceStr(Memo1.Lines.Strings[X + 2], ',', ' ');
                end;
              until AnsiPos('\', Memo1.Lines.Strings[X + 2]) = 0;
              StringGrid6.Cells[4, StringGrid6.RowCount - 1] :=
                ReplaceStr(StringGrid6.Cells[4, StringGrid6.RowCount - 1],
                ' \ ', '');
            end;
          end;//preparing and writing values
        end;
        X := X + 1;
        if Memo1.Lines.Strings[X + 2] = '' then
          X := X + 1; //go to next line
      until Memo1.Lines.Strings[X + 2] = ''; //check when to stop
    end;
  end;
 end;
i think that this code can be more compact, but this works fine too
p.s for me, this code it's not very difficult, look at bold text (some steps of reading)
Reply With Quote