Prechádzať zdrojové kódy

Change WideString initialization to work correctly with indirect main information as well

rtl/inc/systemh.inc & rtl/java/jsystemh_types.inc:
  - TEntryInformation: remove WideInitTables
rtl/win/sysosh.inc:
  + TEntyrInformationOS: add WideInitTables
rtl/win/syswin.inc:
  * adjust WStrInitTablesTable, so that it is now a pointer and can be used both with direct and indirect main entry
  * InitWin32Widestrings: WStrInitTablesTable is now a pointer
rtl/win32/sysinit.inc:
  * WideInitTables has moved to the OS specific part of the entry information
rtl/win32/system.pp:
  * OsSetupEntryinformation: setup WStrInitTablesTable

git-svn-id: trunk@33571 -
svenbarth 9 rokov pred
rodič
commit
788393c298

+ 0 - 3
rtl/inc/systemh.inc

@@ -606,9 +606,6 @@ type
     ThreadvarTablesTable : Pointer;
     ResourceStringTables : Pointer;
     ResStrInitTables : Pointer;
-    {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
-    WideInitTables : Pointer;
-    {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
     ResLocation : Pointer;
     PascalMain : Procedure;
     valgrind_used : boolean;

+ 0 - 3
rtl/java/jsystemh_types.inc

@@ -542,9 +542,6 @@ type
     ThreadvarTablesTable : Pointer;
     ResourceStringTables : Pointer;
     ResStrInitTables : Pointer;
-    {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
-    WideInitTables : Pointer;
-    {$endif FPC_WIDESTRING_EQUAL_UNICODESTRING}
     ResLocation : Pointer;
     PascalMain : Procedure;
     valgrind_used : boolean;

+ 1 - 0
rtl/win/sysosh.inc

@@ -55,6 +55,7 @@ type
     asm_exit : Procedure;stdcall;
     TlsKeyAddr : PDWord;
     SysInstance: PLongInt;
+    WideInitTables : Pointer;
   end;
 {$endif Win32}
 

+ 8 - 5
rtl/win/syswin.inc

@@ -659,10 +659,13 @@ type
     tables : packed array [1..32767] of PWStrInitEntry;
   end;
 
-{$if not(defined(VER2_2) or defined(VER2_4))}
 var
-  WStrInitTablesTable: TWStrInitTablesTable; external name 'FPC_WIDEINITTABLES';
-{$endif}
+{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}
+  WStrInitTablesTable: PWStrInitTablesTable;
+{$else FPC_HAS_INDIRECT_MAIN_INFORMATION}
+  WStrInitTablesTableVar: TWStrInitTablesTable; external name 'FPC_WIDEINITTABLES';
+  WStrInitTablesTable: PWStrInitTablesTable = @WStrInitTablesTableVar;
+{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION}
 
 function GetACP:UINT; stdcall; external 'kernel32' name 'GetACP';
 function GetConsoleCP:UINT; stdcall; external 'kernel32' name 'GetConsoleCP';
@@ -686,9 +689,9 @@ procedure InitWin32Widestrings;
   begin
 {$if not(defined(VER2_2) or defined(VER2_4))}
     { assign initial values to global Widestring typed consts }
-    for i:=1 to WStrInitTablesTable.count do
+    for i:=1 to WStrInitTablesTable^.count do
       begin
-        ptable:=WStrInitTablesTable.tables[i];
+        ptable:=WStrInitTablesTable^.tables[i];
         while Assigned(ptable^.addr) do
           begin
             fpc_widestr_assign(ptable^.addr^, ptable^.data);

+ 2 - 2
rtl/win32/sysinit.inc

@@ -60,7 +60,6 @@
 {$else FPC_HAS_RESSTRINITS}
         ResStrInitTables : nil;
 {$endif FPC_HAS_RESSTRINITS}
-        WideInitTables : @WideInitTables;
         ResLocation : nil;
         PascalMain : @PascalMain;
         valgrind_used : false;
@@ -68,6 +67,7 @@
           asm_exit : @asm_exit;
           TlsKeyAddr : @TlsKeyVar;
           SysInstance : @SysInstance;
+          WideInitTables: @WideInitTables;
           );
         );
 
@@ -79,10 +79,10 @@
         EntryInformation.ThreadvarTablesTable:=@ThreadvarTablesTable;
         EntryInformation.ResourceStringTables:=@ResourceStringTables;
         EntryInformation.ResStrInitTables:=@ResStrInitTables;
-        EntryInformation.WideInitTables:=@WideInitTables;
         EntryInformation.OS.asm_exit:=@asm_exit;
         EntryInformation.OS.TlsKeyAddr:=@TlsKeyVar;
         EntryInformation.OS.SysInstance:=@SysInstance;
+        EntryInformation.OS.WideInitTables:=@WideInitTables;
         EntryInformation.PascalMain:=@PascalMain;}
         SysInitEntryInformation.valgrind_used:=valgrind_used;
       end;

+ 1 - 0
rtl/win32/system.pp

@@ -137,6 +137,7 @@ procedure OsSetupEntryInformation(const info: TEntryInformation);
 begin
   TlsKey := info.OS.TlsKeyAddr;
   FPCSysInstance := info.OS.SysInstance;
+  WStrInitTablesTable := info.OS.WideInitTables;
 end;
 
 {*****************************************************************************