⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func.pas

📁 Delphi Driver Development Kit 有了它以后可以用delphi开发驱动程序了。里面有详尽的例子。
💻 PAS
字号:
unit Func;

interface

uses DDDK;

function FuncIsGoodReadPtr(ABuf:Pointer;ASize:Cardinal):Boolean;

implementation

//
// this function checks user buffer for read access 
// returns true if the buffer is ok
//

function FuncIsGoodReadPtr(ABuf:Pointer;ASize:Cardinal):Boolean;
var
 LSum:Cardinal;
 LPC:PCardinal;
 LPB:PByte;
 LI:Integer;
begin
 DbgMsg('func.pas: FuncIsGoodReadPtr(ABuf:0x%.8X;ASize:0x%.8X)',[ABuf,ASize]);

 Result:=True;

 try 
  ProbeForRead(ABuf,ASize,SizeOf(Byte));
  LSum:=0;
  LPC:=ABuf;
  for LI:=1 to ASize div SizeOf(Cardinal) do
  begin
   Inc(LSum,LPC^);
   Inc(LPC);
  end;

  LPB:=Pointer(LPC);

  for LI:=1 to ASize mod SizeOf(Cardinal) do
  begin
   Inc(LSum,LPB^);
   Inc(LPB);
  end;
  if LSum=0 then ;
 except 
  DbgPrint('func.pas: FuncIsGoodReadPtr error: exception occurred',[]);
  Result:=False;
 end;

 DbgMsg('func.pas: FuncIsGoodReadPtr(-):%d',[Result]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -