我为我们无法控制的第 3 方 DLL 定义了以下函数:
const
DLL = 'Qarapea.dll';
function QARapid_Open(IniFile: shortstring; Section: shortstring): integer; stdcall; external DLL;
procedure QARapid_EndSearch(); stdcall; external DLL;
function QARapid_Count: integer; stdcall; external DLL;
function QARapid_Search(vs: shortstring): integer; stdcall; external DLL;
function QARapid_FormatAddr(ItemNumber: integer; Buffer: PAnsiChar; BufferSize: integer): integer; stdcall; external DLL;
procedure QARapid_Close; stdcall; external DLL;
我通过以下方式调用函数:
procedure TFormMain.ButtonStaticLookupClick(Sender: TObject);
var
Res: integer;
ACode: shortstring;
IniFile, Section: shortstring;
begin
try
ACode := PrepareCode(EditCode.Text);
IniFile := ExtractFilePath(ParamStr(0)) + 'DllIni.ini';
Section := 'Default';
QARapid_Open(IniFile, Section);
try
Res := QARapid_Search(ACode);
Res := QARapid_Count;
finally
QARapid_Close;
end;
Except on E: Exception do
MessageDlg(E.Message, mtError, [mbOK], 0);
end;
end;
在我调用该函数之前,一切似乎都很好QARapid_Count
,当我收到以下错误时:
QAS.exe 出现错误消息:0x0012eff4 处的特权指令。进程停止。使用 step 或 run 继续。
我不知道从哪里开始寻找故障,因为 CPU 调试窗口已打开。
怎样才能追查到底出了什么问题?