mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 15:09:14 +02:00
Merged revisions 1248-1250,1252-1253,1257 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk r1248 (florian) + overriding of inithandlers r1249 (florian) + loading of components from resources r1250 (florian) * resources aren't case sensitive * fixed installing of default component loading handler r1252 (florian) * zero out resource info record r1253 (florian) * we should zero out the data instead of the pointer r1257 (florian) * fixed fillchar parameters git-svn-id: branches/fixes_2_0@1258 -
This commit is contained in:
parent
8507617f0b
commit
a31895869c
@ -81,14 +81,17 @@ begin
|
||||
If (ResInfoCount<>0) then
|
||||
begin
|
||||
FPCRuntimeResourceInfoArray:=GetMem(SizeOf(TFPCRuntimeResourceInfo)*ResInfoCount);
|
||||
{ we must zero out this because name is an ansistring }
|
||||
fillchar(FPCRuntimeResourceInfoArray^,SizeOf(TFPCRuntimeResourceInfo)*ResInfoCount,0);
|
||||
|
||||
for i:=0 to ResInfoCount-1 do
|
||||
begin
|
||||
CurrentResource:=pFPCResourceInfo(pointer(FPCResourceSectionLocation^.reshash.ptr+i*sizeof(TFPCResourceInfo)));
|
||||
FPCRuntimeResourceInfoArray[i].reshash:=CurrentResource^.reshash;
|
||||
FPCRuntimeResourceInfoArray[i].restype:=CurrentResource^.restype;
|
||||
FPCRuntimeResourceInfoArray[i].ptr:=pointer(CurrentResource^.ptr)+PtrInt(FPCResourceSectionLocation^.resdata.ptr);
|
||||
FPCRuntimeResourceInfoArray[i].name:=pchar(CurrentResource^.name)+PtrInt(FPCResourceSectionLocation^.ressym.ptr);
|
||||
FPCRuntimeResourceInfoArray[i].size:=CurrentResource^.size;
|
||||
CurrentResource:=pFPCResourceInfo(pointer(FPCResourceSectionLocation^.reshash.ptr+i*sizeof(TFPCResourceInfo)));
|
||||
FPCRuntimeResourceInfoArray[i].reshash:=CurrentResource^.reshash;
|
||||
FPCRuntimeResourceInfoArray[i].restype:=CurrentResource^.restype;
|
||||
FPCRuntimeResourceInfoArray[i].ptr:=pointer(CurrentResource^.ptr)+PtrInt(FPCResourceSectionLocation^.resdata.ptr);
|
||||
FPCRuntimeResourceInfoArray[i].name:=pchar(CurrentResource^.name)+PtrInt(FPCResourceSectionLocation^.ressym.ptr);
|
||||
FPCRuntimeResourceInfoArray[i].size:=CurrentResource^.size;
|
||||
end;
|
||||
end;
|
||||
InitRes:=true;
|
||||
@ -113,12 +116,13 @@ begin
|
||||
Exit;
|
||||
If Not InitRes then
|
||||
InitializeResources;
|
||||
searchhash:=HashELF(ResourceName);
|
||||
n:=strpas(resourcename);
|
||||
{ resources aren't case sensitive }
|
||||
n:=upcase(strpas(resourcename));
|
||||
searchhash:=HashELF(n);
|
||||
I:=0;
|
||||
While (Result=0) and (I<ResInfoCount) do
|
||||
begin
|
||||
if (FPCRuntimeResourceInfoArray[i].reshash=searchhash) and (FPCRuntimeResourceInfoArray[i].name=n) then
|
||||
if (FPCRuntimeResourceInfoArray[i].reshash=searchhash) and (upcase(FPCRuntimeResourceInfoArray[i].name)=n) then
|
||||
result:=i+1;
|
||||
Inc(I);
|
||||
end;
|
||||
|
@ -1,8 +1,32 @@
|
||||
|
||||
type
|
||||
TResourceHandle = Cardinal;
|
||||
HMODULE = Cardinal;
|
||||
HGLOBAL = Cardinal;
|
||||
|
||||
MAKEINTRESOURCE = pchar;
|
||||
|
||||
{$ifndef MSWINDOWS }
|
||||
{ windows has this in the windows unit. It probably would better
|
||||
fit into the classes/sysutils unit but because it is resource
|
||||
related, I put it here (FK)
|
||||
}
|
||||
const
|
||||
RT_CURSOR = MAKEINTRESOURCE(1);
|
||||
RT_BITMAP = MAKEINTRESOURCE(2);
|
||||
RT_ICON = MAKEINTRESOURCE(3);
|
||||
RT_MENU = MAKEINTRESOURCE(4);
|
||||
RT_DIALOG = MAKEINTRESOURCE(5);
|
||||
RT_STRING = MAKEINTRESOURCE(6);
|
||||
RT_FONTDIR = MAKEINTRESOURCE(7);
|
||||
RT_FONT = MAKEINTRESOURCE(8);
|
||||
RT_ACCELERATOR = MAKEINTRESOURCE(9);
|
||||
RT_RCDATA = MAKEINTRESOURCE(10);
|
||||
RT_MESSAGETABLE = MAKEINTRESOURCE(11);
|
||||
RT_GROUP_CURSOR = MAKEINTRESOURCE(12);
|
||||
RT_GROUP_ICON = MAKEINTRESOURCE(13);
|
||||
RT_VERSION = MAKEINTRESOURCE(16);
|
||||
{$endif MSWINDOWS }
|
||||
|
||||
// Win32 API compatible Resource functions
|
||||
Function HINSTANCE : HMODULE;
|
||||
Function FindResource(ModuleHandle: HMODULE; ResourceName, ResourceType: PChar): TResourceHandle;
|
||||
|
Loading…
Reference in New Issue
Block a user