Browse Source

* win32/system.pp, win64/system.pp: Moved duplicated declarations of WinAPI functions to sysos.inc (Florian's comment about include ordering is no longer true, wstrings.inc comes after sysos.inc these days).
* Result of GetCurrentProcess and first argument of ReadProcessMemory are THandle, not dword.

git-svn-id: trunk@19726 -

sergei 13 years ago
parent
commit
32094761ef
3 changed files with 14 additions and 41 deletions
  1. 13 0
      rtl/win/sysos.inc
  2. 0 19
      rtl/win32/system.pp
  3. 1 22
      rtl/win64/system.pp

+ 13 - 0
rtl/win/sysos.inc

@@ -211,6 +211,13 @@ threadvar
 
   function Win32GetCurrentThreadId:DWORD;
     stdcall; external KernelDLL name 'GetCurrentThreadId';
+
+  function GetCurrentProcess : THandle;
+    stdcall;external 'kernel32' name 'GetCurrentProcess';
+
+  function ReadProcessMemory(process : THandle;address : pointer;dest : pointer;size : dword;bytesread : pdword) :  longbool;
+    stdcall;external 'kernel32' name 'ReadProcessMemory';
+
 {$endif WINCE}
 
    { module functions }
@@ -267,6 +274,12 @@ threadvar
    function GetConsoleOutputCP : UINT;
      stdcall; external KernelDLL name 'GetConsoleOutputCP';
 
+   function SysAllocStringLen(psz:pointer;len:dword):pointer;
+     stdcall; external 'oleaut32.dll' name 'SysAllocStringLen';
+   procedure SysFreeString(bstr:pointer);
+     stdcall; external 'oleaut32.dll' name 'SysFreeString';
+   function SysReAllocStringLen(var bstr:pointer;psz: pointer;
+     len:dword): Integer; stdcall;external 'oleaut32.dll' name 'SysReAllocStringLen';
 {$endif WINCE}
 
    Procedure Errno2InOutRes;

+ 0 - 19
rtl/win32/system.pp

@@ -126,19 +126,6 @@ var
   EntryInformation : TEntryInformation;
   SysInstance : Longint;public name '_FPC_SysInstance';
 
-{ used by wstrings.inc because wstrings.inc is included before sysos.inc
-  this is put here (FK) }
-
-function SysAllocStringLen(psz:pointer;len:dword):pointer;stdcall;
- external 'oleaut32.dll' name 'SysAllocStringLen';
-
-procedure SysFreeString(bstr:pointer);stdcall;
- external 'oleaut32.dll' name 'SysFreeString';
-
-function SysReAllocStringLen(var bstr:pointer;psz: pointer;
-  len:dword): Integer; stdcall;external 'oleaut32.dll' name 'SysReAllocStringLen';
-
-
 { include system independent routines }
 {$I system.inc}
 
@@ -239,12 +226,6 @@ procedure Exe_entry(const info : TEntryInformation);[public,alias:'_FPC_EXE_Entr
      system_exit;
   end;
 
-function GetCurrentProcess : dword;
- stdcall;external 'kernel32' name 'GetCurrentProcess';
-
-function ReadProcessMemory(process : dword;address : pointer;dest : pointer;size : dword;bytesread : pdword) :  longbool;
- stdcall;external 'kernel32' name 'ReadProcessMemory';
-
 function is_prefetch(p : pointer) : boolean;
   var
     a : array[0..15] of byte;

+ 1 - 22
rtl/win64/system.pp

@@ -118,19 +118,6 @@ implementation
 var
   SysInstance : qword;public;
 
-{ used by wstrings.inc because wstrings.inc is included before sysos.inc
-  this is put here (FK) }
-
-function SysAllocStringLen(psz:pointer;len:dword):pointer;stdcall;
- external 'oleaut32.dll' name 'SysAllocStringLen';
-
-procedure SysFreeString(bstr:pointer);stdcall;
- external 'oleaut32.dll' name 'SysFreeString';
-
-function SysReAllocStringLen(var bstr:pointer;psz: pointer;
-  len:dword): Integer; stdcall;external 'oleaut32.dll' name 'SysReAllocStringLen';
-
-
 { include system independent routines }
 {$I system.inc}
 
@@ -205,8 +192,6 @@ procedure Exe_entry;[public,alias:'_FPC_EXE_Entry'];
      system_exit;
   end;
 
-function GetConsoleMode(hConsoleHandle: THandle; var lpMode: DWORD): Boolean; stdcall; external 'kernel32' name 'GetConsoleMode';
-
 function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntryInformation){$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} : longbool;forward;
 
 
@@ -230,12 +215,6 @@ begin
   DLL_Entry;
 end;
 
-function GetCurrentProcess : dword;
- stdcall;external 'kernel32' name 'GetCurrentProcess';
-
-function ReadProcessMemory(process : dword;address : pointer;dest : pointer;size : dword;bytesread : pdword) :  longbool;
- stdcall;external 'kernel32' name 'ReadProcessMemory';
-
 function is_prefetch(p : pointer) : boolean;
   var
     a : array[0..15] of byte;
@@ -569,7 +548,7 @@ end;
 procedure _FPC_mainCRTStartup;stdcall;public name '_mainCRTStartup';
 begin
   IsConsole:=true;
-  GetConsoleMode(GetStdHandle((Std_Input_Handle)),StartupConsoleMode);
+  GetConsoleMode(GetStdHandle((Std_Input_Handle)),@StartupConsoleMode);
 {$ifdef FPC_USE_TLS_DIRECTORY}
   LinkIn(@_tls_used,@FreePascal_TLS_callback,@FreePascal_end_of_TLS_callback);
 {$endif FPC_USE_TLS_DIRECTORY}