Good evening,
was wondering how can I read data record from a text file,
if they want to read data from a text:

(Offset : $4C8259; MemDump :($A1, $38, $BD, $4C, $00, $8B, $00, $8B, $4D, $FC, $BA, $C0, $82, $4C, $00, $E8, $1F, $F1, $FF, $FF, $33, $DB, $E8, $F8, $BE, $F3, $FF, $33, $C0, $5A, $59, $59); cName : ''),
(Offset : $4C8259; MemDump :($7C, $23, $8B, $45, $FC, $80, $38, $C1, $75, $1B, $8B, $45, $FC, $80, $78, $02, $F3, $75, $12, $8B, $45, $FC, $80, $78, $03, $00, $75, $09, $8B, $45, $FC, $80); cName : ''),
(offset : $401254; MemDump :($68, $14, $D2, $41, $00, $E8, $F0, $FF, $FF, $FF, $00, $00, $00, $00, $00, $00, $30, $00, $00, $00, $40, $00, $00, $00, $00, $00, $00, $00, $8E, $F0, $24, $23); cName : 'Hack All Mu Minimized')

in the case thereby:

const
ProcessesDumps: array[0..Count -1] of TCheatList =
(
TXT CODE
};

code completion:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, tlhelp32, StdCtrls, Buttons;

const
Count = 3; // Cheat count

type
 TMemDump = array[0..31] of Byte;

 TCheatList  = record
 Offset  : Cardinal;
 MemDump : TMemDump;
 cName   : String;
end;

const
 ProcessesDumps: array[0..Count -1] of TCheatList =
  (
    (Offset : $4C8259; MemDump :($A1, $38, $BD, $4C, $00, $8B, $00, $8B, $4D, $FC, $BA, $C0, $82, $4C, $00, $E8, $1F, $F1, $FF, $FF, $33, $DB, $E8, $F8, $BE, $F3, $FF, $33, $C0, $5A, $59, $59); cName : ''),
    (Offset : $4C8259; MemDump :($7C, $23, $8B, $45, $FC, $80, $38, $C1, $75, $1B, $8B, $45, $FC, $80, $78, $02, $F3, $75, $12, $8B, $45, $FC, $80, $78, $03, $00, $75, $09, $8B, $45, $FC, $80); cName : ''),
    (offset : $401254; MemDump :($68, $14, $D2, $41, $00, $E8, $F0, $FF, $FF, $FF, $00, $00, $00, $00, $00, $00, $30, $00, $00, $00, $40, $00, $00, $00, $00, $00, $00, $00, $8E, $F0, $24, $23); cName : 'Hack All Mu Minimized')
  );

type
  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ Funções }

function ScanProcessMemory(hProcess: THandle):Boolean;
var
    I: Integer;
    aTmpBuffer: TMemDump;
    aBytesRead: DWORD;
begin
    for I := 0 to count do
    begin
        aBytesRead := 0;
        ReadProcessMemory(hProcess, Pointer(ProcessesDumps[i].Offset),@aTmpBuffer, SizeOf(aTmpBuffer), aBytesRead);
        if CompareMem(@aTmpBuffer,@ProcessesDumps[i].MemDump,32) then
        begin
            ShowMessage('Encontrado o hack '+ProcessesDumps[i].cName+' em seu sistema');
            ExitProcess(0);
            //TerminateProcess(OpenProcess(PROCESS_TERMINATE, 0, hProcess),0);
        end;
    end;
    Result := False;
end;

procedure SystemProcessesScan;
var
    hProcessSnap, hProcess: THandle;
    pe32: PROCESSENTRY32;
begin
    hProcessSnap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    if hProcessSnap <> INVALID_HANDLE_VALUE then
    begin
        pe32.dwSize := SizeOf(PROCESSENTRY32);
        if Process32First(hProcessSnap, pe32) then
        begin
            repeat
                hProcess := OpenProcess(PROCESS_ALL_ACCESS, FALSE,pe32.th32ProcessID);
                if not (hProcess = 0) then
                begin
                 ScanProcessMemory(hProcess);
                end;
            until not Process32Next(hProcessSnap, pe32);
        end;
        CloseHandle(hProcessSnap);
    end;
end;

{ Funções }

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  SystemProcessesScan;
end;

end.

thanks.

Help please

procedure TForm1.btnPopulateClick(Sender: TObject);
var
  rowData                     : TStringList;
  s                           : string;
  tf                          : TextFile;
  lsTemp                      : string;   // Temporary scratch pad variable
//  transactionDate             : string;    // Column B of downloaded spreadshe+et
  transactionDate             : variant;    // Column B of downloaded spreadsheet
  transDate                   : variant;   // date for CB line
  transactionAmount           : Currency; // Column D of downloaded spreadsheet
  transactionDescription      : String;   // Column F of downloaded spreadsheet
  transactionDocument         : String;   // Column C of downloaded spreadsheet
  transactionAccount          : Integer;   // Column H of downloaded spreadsheet
//  curYear, curMonth, curDay   : word;
  curDay                      : String;
  intDay                      : variant;
  liYear, liMonth, liDay      : Integer;
  i                           : Integer;
  myFileName                  : String;

Begin
  DM.DefineLedgTots;
    rowData := TStringList.Create;
    try
    // Assign the downloaded csv filename below
    // NB : The downloaded standard bank file FIRST HAD THE TOP THREE LINES MANUALLY DELETED in Excel,
    //      as well as the last line, because these lines mean nothing to the import - then the CSV file was
    //      saved before running this import

//    Assignfile(tf,'download.csv');      // FILENAME of downloaded and "panelbeated" CSV file - ONLY the actual transactions
//    Assignfile(tf,'C:\Program Files\StdAccounting\download.csv');

    myFileName := 'C:\h\StdAcc\' + Trim(DM.tblUsrTfrPNo.AsString) + '\download.csv';
//    myFileName := 'C:\h\StdAcc\' + Trim(IntToStr(UsrTfrPNo.AsInteger)) + '\download.csv';

    Assignfile(tf, myFileName);
//    Assignfile(tf,'C:\h\StdAcc\50\download.csv');

                                        // must remain in the file before running this - you need to first remove the superfluous
                                        // lines in the CSV file (top 3 lines and last line) and also the last 2 columns (G & H) via Excel
                                        // and save the file again, BEFORE running this code to do the import...
                                        // In the sample file provided "download.csv" this has already been done for you, but for future
                                        // downloads, you will need to manually do this yourself

                                        // Also, in future, you can possibly go to column C in the spreadsheet and use that to allocate
                                        // account numbers to post to (much easier and quicker to do that in Excel than via accounting software),
                                        // but you will have to modify the code below to read in column C to read that in and use, using
                                        // the same principles and similar code as below

    // Open the downloaded csv file as a text file
    Reset(tf);

    // Process each line of the downloaded csv file as a record
    while not Eof(tf) do
    begin
      // Read the next line in to a string
      ReadLn(tf, s);

      // Break up the line (each column is delimmited with a comma, being a CSV file)
      rowData.CommaText := s;

      // ProcessLine
      // rowData now contains a separate item for the value of each column for the row of the
      // spreadsheet we are currently dealing with
      // In other words, rowData[0] will be column A of the spreadsheet
      //                 rowData[1] will be column B of the spreadsheet
      //                    and so on.

      // Remember also, each column represented in rowData is a STRING - you will need convert the relevant
      // columns to other data types as appropriate.  For Standard Bank's download, this is done for the various
      // columns below:

      // Column A just seems to contain "PROV" indicating "Provisional", so we just ignore that column and forget about rowData[0]

      // Column B contains the date of the transaction, but it's a string, so we need to pull that out and put it
      // into the transactionDate variable by encoding a new date:
      // -- TRANSACTION DATE ---------------------------------------------------
      lsTemp := Trim(rowData[1]);
      // All 6 characters for full date
      // First 4 characters contain the year, so let's get that first
      liYear := StrToInt(System.Copy(lsTemp, 1, 4));
      // Next 2 characters are the month...
      liMonth := StrToInt(System.Copy(lsTemp, 5,2));
      // Next 2 characters are the day...
      liDay := StrToInt(System.Copy(lsTemp, 7, 2));
      curDay := (System.Copy(lsTemp, 7, 2));
//      transactionDate := EncodeDate(liDay,liMonth,liYear);

      transactionDate := EncodeDate(liYear,liMonth,liDay);
//      curDay := liDay;
      // showmessage(DateToStr(transactionDate));         // You can unremark this if you want to see what it's importing and interpreting for the date

      // Column D contains the amount of the transaction
      // -- AMOUNT -------------------------------------------------------------
      lsTemp := Trim(rowData[3]);                         // NB 3 is the AMOUNT column because column A is 0 - rowData is "zero based" [ie first element starts at 0 and not 1]
       transactionAmount := StrToCurr(lsTemp);
      // showmessage(CurrToStr(transactionAmount));       // You can unremark this if you want to see what it's importing and interpreting for the amount

//      transactionAccount:= Trim(rowData[7]);               // NB 7 is the Account column.

      // Column E & F contains the descriptions
      // -- DESCRIPTION --------------------------------------------------------

      transactionDocument := Trim(rowData[2]);

      // The descriptions are a bit tricky so they don't go into the rowData very nicely
      transactionDescription := '';                       // First reset from last row...
    for i := 4 to rowData.Count - 1 do
      begin
        lsTemp := Trim(rowData[i]);
        transactionDescription := transactionDescription + lsTemp + ' ';
      end;

//      lsTemp := Trim(rowData[5]);
//      transactionDescription := lsTemp;

//      transactionAccount := StrToInt(lsTemp);

      // showmessage(transactionDescription);           // You can unremark this if you want to see what it's importing and interpreting for the first description

      // =======================================================================
      // FROM THIS POINT, you can now utilise the variables:
      //
      //             transactionDate        : Transaction date
      //             transactionAmount      : Value of transaction
      //             transactionDescription : Description
      //
      // At this point now, you can open and process/post to your cashbooks, general
      // ledger etc in your paradox tables.
      // It will hit this point for each line on the bank statement.....

      {
        Open Paradox table...
        Post this transaction
        Close Paradox table..
        etc etc
      }
      with DM.qryLedgTots do
      begin
        if DM.qryLedgTots.state in dsEditModes then
        else
          DM.qryLedgTots.edit;
        DM.qryLedgTots.APPEND;
        DM.qryLedgTotsCBDate.Value := transactionDate;
        DM.qryLedgTotsDY.Value := CurDay;
        DM.qryLedgTotsDoc.Value := transactionDocument;
        DM.qryLedgTotsLName.Value := transactionDescription;
        DM.qryLedgTotsDays28.Value := transactionAmount;
        DM.qryLedgTotsPNo.Value := DM.tblusrTfrPNo.value;
        DM.qryLedgTots.Post;
      end;
    DM.qryLedgTots.Next;
    end;
//    if DM.qryLedgTots.UpdatesPending then
//      DM.qryLedgTots.ApplyUpdates;
    CloseFile(tf);
  finally
    rowData.Free;
  end;
end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.