How to check if resource exists in
PE and
PE+ executable?. I have solution that result is depended on target Windows platform, because
API require module
handle:
Delphi-Quellcode:
function ResourceEntryExists(const AFileName, AResourceName: string): Boolean;
var
hModule: Cardinal;
pResource: Pointer;
hResource: HRSRC;
hData: Cardinal;
begin
Result := False;
pResource := nil;
hModule := LoadLibraryEx(PChar(AFileName), 0, DONT_RESOLVE_DLL_REFERENCES);
if hModule <> 0 then
try
hResource := FindResource(hModule, PChar(UpperCase(AResourceName)), RT_RCDATA);
hData := LoadResource(hModule, hResource);
if hData <> 0 then
try
pResource := LockResource(hData);
Result := pResource <> nil;
finally
FreeResource(hData);
end;
finally
FreeLibrary(hModule);
end;
end;
I want to have one program version. So how to make it platform independet?