소스 검색

* zero out resource info record

git-svn-id: trunk@1252 -
florian 20 년 전
부모
커밋
6bf8d76140
1개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 9 6
      rtl/inc/elfres32.inc

+ 9 - 6
rtl/inc/elfres32.inc

@@ -81,14 +81,17 @@ begin
   If (ResInfoCount<>0) then
   If (ResInfoCount<>0) then
     begin
     begin
     FPCRuntimeResourceInfoArray:=GetMem(SizeOf(TFPCRuntimeResourceInfo)*ResInfoCount);
     FPCRuntimeResourceInfoArray:=GetMem(SizeOf(TFPCRuntimeResourceInfo)*ResInfoCount);
+    { we must zero out this because name is an ansistring }
+    fillchar(FPCRuntimeResourceInfoArray,0,SizeOf(TFPCRuntimeResourceInfo)*ResInfoCount);
+
     for i:=0 to ResInfoCount-1 do
     for i:=0 to ResInfoCount-1 do
       begin
       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;
     end;
     end;
   InitRes:=true;
   InitRes:=true;