Einzelnen Beitrag anzeigen

Benutzerbild von implementation
implementation

Registriert seit: 5. Mai 2008
940 Beiträge
 
FreePascal / Lazarus
 
#4

AW: Conversion from Cpp to Delphi

  Alt 27. Dez 2011, 16:39
Code:
int PEFILE::GetPESectionIndex(char* SectionName){
       int j;
       int n=image_nt_headers->FileHeader.NumberOfSections;
       for(j=0;j<n;j++){
          if(!strcmp((const char*)image_section_header[j]->Name,SectionName)) return j;
       }
       return -1;
    }
I'll try it:
Delphi-Quellcode:
function TPEFile.GetPESectionIndex(SectionName: PChar): Integer;
var j,n: Integer;
begin
  n := image_nt_headers.FileHeader.NumberOfSections;
  for j := 0 to n-1 do
    if StrLIComp(PChar(image_section_header[j].Name),SectionName)=0 then
    begin
      Result := j;
      exit;
    end;
  Result := -1;
end;
  Mit Zitat antworten Zitat