Browse Source

* change dllparam into PtrInt, this is required for 64 bit systems, patch based on Gennadiy's patch in #21089, resolves #21089

git-svn-id: trunk@20079 -
florian 13 years ago
parent
commit
562932a2c9

+ 4 - 4
rtl/win32/sysinitcyg.pp

@@ -83,12 +83,12 @@ unit sysinitcyg;
       end;
 
 
-    procedure _FPC_DLLMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLMainCRTStartup';
+    procedure _FPC_DLLMainCRTStartup(_hinstance : longint;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLMainCRTStartup';
       begin
         IsConsole:=true;
         sysinstance:=_hinstance;
         dllreason:=_dllreason;
-        dllparam:=_dllparam;
+        dllparam:=PtrInt(_dllparam);
         asm
           subl   $0x8,%esp
           andl   $0xfffffff0,%esp
@@ -97,12 +97,12 @@ unit sysinitcyg;
       end;
 
 
-    procedure _FPC_DLLWinMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLWinMainCRTStartup';
+    procedure _FPC_DLLWinMainCRTStartup(_hinstance : longint;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLWinMainCRTStartup';
       begin
         IsConsole:=false;
         sysinstance:=_hinstance;
         dllreason:=_dllreason;
-        dllparam:=_dllparam;
+        dllparam:=PtrInt(_dllparam);
         asm
           subl   $0x8,%esp
           andl   $0xfffffff0,%esp

+ 4 - 4
rtl/win32/sysinitgprof.pp

@@ -118,12 +118,12 @@ unit sysinitgprof;
       end;
 
 
-    procedure _FPC_DLLMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLMainCRTStartup';
+    procedure _FPC_DLLMainCRTStartup(_hinstance : longint;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLMainCRTStartup';
       begin
         IsConsole:=true;
         sysinstance:=_hinstance;
         dllreason:=_dllreason;
-        dllparam:=_dllparam;
+        dllparam:=PtrInt(_dllparam);
         asm
           subl   $0x8,%esp
           andl   $0xfffffff0,%esp
@@ -132,12 +132,12 @@ unit sysinitgprof;
       end;
 
 
-    procedure _FPC_DLLWinMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLWinMainCRTStartup';
+    procedure _FPC_DLLWinMainCRTStartup(_hinstance : longint;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLWinMainCRTStartup';
       begin
         IsConsole:=false;
         sysinstance:=_hinstance;
         dllreason:=_dllreason;
-        dllparam:=_dllparam;
+        dllparam:=PtrInt(_dllparam);
         asm
           subl   $0x8,%esp
           andl   $0xfffffff0,%esp

+ 4 - 4
rtl/win32/sysinitpas.pp

@@ -50,23 +50,23 @@ unit sysinitpas;
     end;
 
 
-    procedure _FPC_DLLMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLMainCRTStartup';
+    procedure _FPC_DLLMainCRTStartup(_hinstance : longint;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLMainCRTStartup';
     begin
       IsConsole:=true;
       sysinstance:=_hinstance;
       dllreason:=_dllreason;
-      dllparam:=_dllparam;
+      dllparam:=PtrInt(_dllparam);
       SetupEntryInformation;
       DLL_Entry(SysInitEntryInformation);
     end;
 
 
-    procedure _FPC_DLLWinMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLWinMainCRTStartup';
+    procedure _FPC_DLLWinMainCRTStartup(_hinstance : longint;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLWinMainCRTStartup';
     begin
       IsConsole:=false;
       sysinstance:=_hinstance;
       dllreason:=_dllreason;
-      dllparam:=_dllparam;
+      dllparam:=PtrInt(_dllparam);
       SetupEntryInformation;
       DLL_Entry(SysInitEntryInformation);
     end;

+ 3 - 3
rtl/win32/system.pp

@@ -99,14 +99,14 @@ var
   startupinfo : tstartupinfo;
   MainInstance,
   cmdshow     : longint;
-  DLLreason : longint; public name 'operatingsystem_dllreason';
-  DLLparam : longint; public name 'operatingsystem_dllparam';
+  DLLreason : dword; public name 'operatingsystem_dllreason';
+  DLLparam : PtrInt; public name 'operatingsystem_dllparam';
   StartupConsoleMode : DWORD;
 const
   hprevinst: longint=0;
 
 type
-  TDLL_Entry_Hook = procedure (dllparam : longint);
+  TDLL_Entry_Hook = procedure (dllparam : PtrInt);
 
 const
   Dll_Process_Detach_Hook : TDLL_Entry_Hook = nil;

+ 7 - 6
rtl/win64/system.pp

@@ -95,11 +95,12 @@ var
   StartupConsoleMode : dword;
   MainInstance : qword;
   cmdshow     : longint;
-  DLLreason,DLLparam:longint;
+  DLLreason : dword;
+  DLLparam : PtrInt;
 const
   hprevinst: qword=0;
 type
-  TDLL_Entry_Hook = procedure (dllparam : longint);
+  TDLL_Entry_Hook = procedure (dllparam : PtrInt);
 
 const
   Dll_Process_Detach_Hook : TDLL_Entry_Hook = nil;
@@ -196,22 +197,22 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry
 
 
 
-procedure _FPC_DLLMainCRTStartup(_hinstance : qword;_dllreason,_dllparam:longint);stdcall;public name '_DLLMainCRTStartup';
+procedure _FPC_DLLMainCRTStartup(_hinstance : qword;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLMainCRTStartup';
 begin
   IsConsole:=true;
   sysinstance:=_hinstance;
   dllreason:=_dllreason;
-  dllparam:=_dllparam;
+  dllparam:=PtrInt(_dllparam);
   DLL_Entry;
 end;
 
 
-procedure _FPC_DLLWinMainCRTStartup(_hinstance : qword;_dllreason,_dllparam:longint);stdcall;public name '_DLLWinMainCRTStartup';
+procedure _FPC_DLLWinMainCRTStartup(_hinstance : qword;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLWinMainCRTStartup';
 begin
   IsConsole:=false;
   sysinstance:=_hinstance;
   dllreason:=_dllreason;
-  dllparam:=_dllparam;
+  dllparam:=PtrInt(_dllparam);
   DLL_Entry;
 end;
 

+ 1 - 1
tests/test/library/testdll.pp

@@ -65,7 +65,7 @@ begin
 end;
 
 
-procedure MyDllHook(DllParma : longint);
+procedure MyDllHook(DllParma : PtrInt);
 begin
   Writeln('DLL: Thread Detach Hook  called with DLLParam=',DllParam);
   Writeln('DLL: Thread Id is ',GetCurrentThreadId);

+ 1 - 1
tests/test/library/ttdlltest.pp

@@ -62,7 +62,7 @@ var
    s2 : string;
 
 
-   procedure MyMainHook(DllParma : longint);
+   procedure MyMainHook(DllParma : PtrInt);
    begin
      Writeln('Main: Thread Detach Hook  called with DLLParam=',DllParam);
    end;