瀏覽代碼

* patch by Sven Barth: Add CeRapiInvoke to rapi.pp, resolves #15170

git-svn-id: trunk@14482 -
florian 15 年之前
父節點
當前提交
20995bb01b

+ 1 - 0
.gitattributes

@@ -5654,6 +5654,7 @@ packages/winceunits/src/pm.pp svneol=native#text/plain
 packages/winceunits/src/power.pp svneol=native#text/plain
 packages/winceunits/src/power.pp svneol=native#text/plain
 packages/winceunits/src/projects.pp svneol=native#text/plain
 packages/winceunits/src/projects.pp svneol=native#text/plain
 packages/winceunits/src/rapi.pp svneol=native#text/plain
 packages/winceunits/src/rapi.pp svneol=native#text/plain
+packages/winceunits/src/rapitypes.pp svneol=native#text/plain
 packages/winceunits/src/ras.pp svneol=native#text/plain
 packages/winceunits/src/ras.pp svneol=native#text/plain
 packages/winceunits/src/raserror.pp svneol=native#text/plain
 packages/winceunits/src/raserror.pp svneol=native#text/plain
 packages/winceunits/src/ril.pp svneol=native#text/plain
 packages/winceunits/src/ril.pp svneol=native#text/plain

+ 4 - 4
packages/winceunits/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/12/10]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/12/26]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -268,7 +268,7 @@ override PACKAGE_NAME=winceunits
 override PACKAGE_VERSION=2.5.1
 override PACKAGE_VERSION=2.5.1
 WINDIR=../winunits-base/src
 WINDIR=../winunits-base/src
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=rapi cesync
+override TARGET_UNITS+=rapi cesync rapitypes
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
 override TARGET_UNITS+=comobj buildwinceunits
 override TARGET_UNITS+=comobj buildwinceunits
@@ -277,10 +277,10 @@ ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_UNITS+=comobj buildwinceunits
 override TARGET_UNITS+=comobj buildwinceunits
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects wap tsp extapi imm activex ole2 comconst
+override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects wap tsp extapi imm activex ole2 comconst rapitypes
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects wap tsp extapi imm activex ole2 comconst
+override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror sip projects wap tsp extapi imm activex ole2 comconst rapitypes
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_RSTS+=comconst
 override TARGET_RSTS+=comconst

+ 2 - 2
packages/winceunits/Makefile.fpc

@@ -13,9 +13,9 @@ implicitunits_wince=aygshell commctrl commdlg iphlpapi notify oleauto power shel
                     sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled \
                     sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth keybd nled \
                     phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror \
                     phone connmgr devload devmgmt mmreg mmsystem msacm wininet ras raserror \
                     sip projects wap tsp extapi imm \
                     sip projects wap tsp extapi imm \
-                    activex ole2 comconst
+                    activex ole2 comconst rapitypes
 
 
-units_win32=rapi cesync
+units_win32=rapi cesync rapitypes
 
 
 rsts=comconst
 rsts=comconst
 
 

+ 1 - 1
packages/winceunits/src/buildwinceunits.pp

@@ -25,7 +25,7 @@ uses
   gpsapi,todaycmn,windbase,cesync,gx,winioctl,msgqueue,pm,service,htmlctrl,
   gpsapi,todaycmn,windbase,cesync,gx,winioctl,msgqueue,pm,service,htmlctrl,
   sipapi, cpl, bt_api, bt_sdp, bthapi, bthutil, pimstore, ril, sms, ws2bth,
   sipapi, cpl, bt_api, bt_sdp, bthapi, bthutil, pimstore, ril, sms, ws2bth,
   keybd, nled, phone, connmgr, devload, devmgmt, mmreg, mmsystem, msacm,
   keybd, nled, phone, connmgr, devload, devmgmt, mmreg, mmsystem, msacm,
-  wininet, ras, raserror, sip, projects, wap, tsp, extapi, imm;
+  wininet, ras, raserror, sip, projects, wap, tsp, extapi, imm, rapitypes;
 
 
 implementation
 implementation
 
 

+ 22 - 1
packages/winceunits/src/rapi.pp

@@ -8,7 +8,7 @@ UNIT RAPI;
 
 
 INTERFACE
 INTERFACE
 
 
-uses Windows;
+uses Windows, RAPITypes;
 
 
 const
 const
   FAF_ATTRIBUTES = $00000001;
   FAF_ATTRIBUTES = $00000001;
@@ -343,6 +343,8 @@ type
   TCeFindAllFiles = function(Path: PWideChar; Attr: DWORD; var Count: DWord;
   TCeFindAllFiles = function(Path: PWideChar; Attr: DWORD; var Count: DWord;
     var FindData: PCe_Find_Data_array): BOOL stdcall;
     var FindData: PCe_Find_Data_array): BOOL stdcall;
   TRapiFreeBuffer = procedure(p: Pointer) stdcall;
   TRapiFreeBuffer = procedure(p: Pointer) stdcall;
+  TCeRapiInvoke = function (pDllPath: LPCWSTR; pFunctionName: LPCWSTR; cbInput: DWord; pInput: PByte;
+    pcbOutput: PDWord; ppOutput: PPByte; ppIRAPIStream: PIRAPIStream; dwReserved: DWord): HResult; stdcall;
 
 
 function CeRapiInit: LongInt;
 function CeRapiInit: LongInt;
 function CeRapiInitEx(var RInit: TRapiInit) : LongInt;
 function CeRapiInitEx(var RInit: TRapiInit) : LongInt;
@@ -435,6 +437,8 @@ function CeGetSystemPowerStatusEx(pStatus: PSYSTEM_POWER_STATUS_EX; fUpdate: BOO
 function DesktopToDevice(DesktopLocation, TableList: String; Sync: BOOL; Overwrite: Integer; DeviceLocation: String): Longint;
 function DesktopToDevice(DesktopLocation, TableList: String; Sync: BOOL; Overwrite: Integer; DeviceLocation: String): Longint;
 //added 01/19/2003 - Octavio Hernandez
 //added 01/19/2003 - Octavio Hernandez
 function DeviceToDesktop(DesktopLocation, TableList: String; Sync: BOOL; Overwrite: Integer; DeviceLocation: String): Longint;
 function DeviceToDesktop(DesktopLocation, TableList: String; Sync: BOOL; Overwrite: Integer; DeviceLocation: String): Longint;
+function CeRapiInvoke(pDllPath: LPCWSTR; pFunctionName: LPCWSTR; cbInput: DWord; pInput: PByte;
+  pcbOutput: PDWord; ppOutput: PPByte; ppIRAPIStream: PIRAPIStream; dwReserved: DWord): HResult;
 
 
 IMPLEMENTATION
 IMPLEMENTATION
 
 
@@ -506,6 +510,7 @@ var
   mDesktopToDevice: TDesktopToDevice;
   mDesktopToDevice: TDesktopToDevice;
   //added 01/19/2003 - Octavio Hernandez
   //added 01/19/2003 - Octavio Hernandez
   mDeviceToDesktop: TDeviceToDesktop;
   mDeviceToDesktop: TDeviceToDesktop;
+  mCeRapiInvoke: TCeRapiInvoke;
 
 
   RapiModule, AdoCEModule: THandle;
   RapiModule, AdoCEModule: THandle;
 
 
@@ -588,6 +593,7 @@ begin
     @mCeGetClassName:= GetProcAddress(RapiModule, 'CeGetClassName');
     @mCeGetClassName:= GetProcAddress(RapiModule, 'CeGetClassName');
     @mCeGlobalMemoryStatus:= GetProcAddress(RapiModule, 'CeGlobalMemoryStatus');
     @mCeGlobalMemoryStatus:= GetProcAddress(RapiModule, 'CeGlobalMemoryStatus');
     @mCeGetSystemPowerStatusEx:= GetProcAddress(RapiModule, 'CeGetSystemPowerStatusEx');
     @mCeGetSystemPowerStatusEx:= GetProcAddress(RapiModule, 'CeGetSystemPowerStatusEx');
+    @mCeRapiInvoke:= GetProcAddress(RapiModule, 'CeRapiInvoke');
   end
   end
   else
   else
     Result := False;
     Result := False;
@@ -1493,6 +1499,21 @@ begin
     Result := $FFFF;
     Result := $FFFF;
 end;
 end;
 
 
+function CeRapiInvoke(pDllPath: LPCWSTR; pFunctionName: LPCWSTR;
+  cbInput: DWord; pInput: PByte; pcbOutput: PDWord; ppOutput: PPByte;
+  ppIRAPIStream: PIRAPIStream; dwReserved: DWord): HResult;
+begin
+  if not RapiLoaded then begin
+    Result := $FFFF;
+    Exit;
+  end;
+
+  if @mCeRapiInvoke <> nil then
+    Result := mCeRapiInvoke(pDllPath, pFunctionName, cbInput, pInput, pcbOutput, ppOutput, ppIRAPIStream, dwReserved)
+  else
+    Result := $FFFF;
+end;
+
 INITIALIZATION
 INITIALIZATION
   RapiModule := 0;
   RapiModule := 0;
   AdoCEModule := 0;
   AdoCEModule := 0;

+ 42 - 0
packages/winceunits/src/rapitypes.pp

@@ -0,0 +1,42 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2009 Sven Barth.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ ********************************************************************** }
+
+{
+  Types from rapitypes.h, others are directly in rapi.pp, but this unit is used
+  from Win32 and WinCE.
+}
+unit RAPITypes;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  types;
+
+type
+  RAPISTREAMFLAG = (
+    STREAM_TIMEOUT_READ
+  );
+  TRapiStreamFlag = RAPISTREAMFLAG;
+
+  IRAPIStream = interface(IStream)
+    function SetRapiStat(Flag: RAPISTREAMFLAG; dwValue: DWord): HResult; stdcall;
+    function GetRapiStat(Flag: RAPISTREAMFLAG; pdwValue: PDWord): HResult; stdcall;
+  end;
+  PIRAPIStream = ^IRAPIStream;
+
+implementation
+
+end.
+