Lazarus中文社区

 找回密码
 立即注册(注册审核可向QQ群索取)

QQ登录

只需一步,快速开始

Lazarus IDE and 组件 下载地址版权申明
查看: 2550|回复: 0

关于SymFromName的奇怪问题?在线等

[复制链接]

该用户从未签到

发表于 2012-12-9 19:06:27 | 显示全部楼层 |阅读模式
  1. function GetAddressFromSymbol(phd:Thandle;s:string):ptruint;
  2. var
  3.   pi:PSYMBOL_INFO;
  4.   sn:array[0..MAX_SYM_NAME-1] of char;
  5. begin
  6.   sn:=s;

  7.   if not SymInitialize(phd,nil,true) then Exit($00000000);

  8.   SymSetOptions(SymGetOptions or SYMOPT_CASE_INSENSITIVE);

  9.   getmem(pi, (sizeof(SYMBOL_INFO)+MAX_SYM_NAME*sizeof(char)+sizeof(ULONG64)-1)
  10.                 div sizeof(ULONG64) );

  11.   pi^.SizeOfStruct:=sizeof(SYMBOL_INFO);
  12.   pi^.MaxNameLen:= MAX_SYM_NAME;

  13.   if SymFromName(phd,sn,pi)then
  14.   begin
  15.     result:=pi^.Address;
  16.   end else
  17.   begin
  18.     result:=$00000000;
  19.   end;

  20.   MessageBox(0,pchar(SysErrorMessage(GetLastError)),'Last Error',MB_OK);

  21.   freemem(pi);
  22.   SymCleanup(phd);

  23. end;
复制代码
GetLastError总是说我参数错误(‘The parameter is incorrect!’)。实在不知哪里错了。  
回复

使用道具 举报

*滑块验证:

本版积分规则

QQ|手机版|小黑屋|Lazarus中国|Lazarus中文社区 ( 鄂ICP备16006501号-1 )

GMT+8, 2025-5-2 21:35 , Processed in 0.030190 second(s), 10 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表