GetThreadContext无法获取CPU信息 ( 积分: 50 )

  • 主题发起人 主题发起人 全文检索
  • 开始时间 开始时间

全文检索

Unregistered / Unconfirmed
GUEST, unregistred user!
为什么每次获得的数据全是&nbsp;0000000<br><br>procedure&nbsp;TForm1.Button1Click(Sender:&nbsp;TObject);<br>var<br>&nbsp;cont:_CONTEXT;<br>&nbsp;MyFloatSave:_FLOATING_SAVE_AREA;<br>begin<br>if&nbsp;GetThreadContext(GetCurrentThread,cont)=false&nbsp;&nbsp;&nbsp;then&nbsp;&nbsp;exit;<br>memo1.Lines.Clear;<br>memo1.Lines.Add('ContextFlags:'+inttohex(cont.ContextFlags,8));<br>memo1.Lines.Add('Dr0:&nbsp;'+inttohex(cont.Dr0,8));;<br>memo1.Lines.Add('Dr1:&nbsp;'+inttohex(cont.Dr1,8));<br>memo1.Lines.Add('Dr2:&nbsp;'+inttohex(cont.Dr2,8));<br>memo1.Lines.Add('Dr3:&nbsp;'+inttohex(cont.Dr3,8));<br>memo1.Lines.Add('Dr6:&nbsp;'+inttohex(cont.Dr6,8));<br>memo1.Lines.Add('Dr7:&nbsp;'+inttohex(cont.Dr7,8));<br>memo1.Lines.Add('------------cont.FloatSave---------------');<br>MyFloatSave:=cont.FloatSave;<br>memo1.Lines.Add('MyFloatSave.ControlWord:&nbsp;'+inttohex(MyFloatSave.ControlWord,8));<br>memo1.Lines.Add('MyFloatSave.StatusWord:&nbsp;'+inttohex(MyFloatSave.StatusWord,8));<br>memo1.Lines.Add('MyFloatSave.TagWord:&nbsp;'+inttohex(MyFloatSave.TagWord,8));<br>memo1.Lines.Add('MyFloatSave.ErrorOffset:&nbsp;'+inttohex(MyFloatSave.ErrorOffset,8));<br>memo1.Lines.Add('MyFloatSave.ErrorSelector:&nbsp;'+inttohex(MyFloatSave.ErrorSelector,8));<br>memo1.Lines.Add('MyFloatSave.DataOffset:&nbsp;'+inttohex(MyFloatSave.DataOffset,8));<br>memo1.Lines.Add('MyFloatSave.DataSelector:&nbsp;'+inttohex(MyFloatSave.DataSelector,8));<br>memo1.Lines.Add('MyFloatSave.RegisterArea:&nbsp;寄存器区域');<br>memo1.Lines.Add('MyFloatSave.Cr0NpxState:&nbsp;'+inttohex(MyFloatSave.Cr0NpxState,8));<br>memo1.Lines.Add('---------------------------');<br>memo1.Lines.Add('cont.SegGs:&nbsp;'+inttohex(cont.SegGs,8));<br>memo1.Lines.Add('cont.SegFs:&nbsp;'+inttohex(cont.SegFs,8));<br>memo1.Lines.Add('cont.SegEs:&nbsp;'+inttohex(cont.SegEs,8));<br>memo1.Lines.Add('cont.SegDs:&nbsp;'+inttohex(cont.SegDs,8));<br>memo1.Lines.Add('cont.SegCs:&nbsp;'+inttohex(cont.SegCs,8));<br>memo1.Lines.Add('---------------------------');<br><br>memo1.Lines.Add('cont.Edi:&nbsp;'+inttohex(cont.Edi,8));<br>memo1.Lines.Add('cont.Esi:&nbsp;'+inttohex(cont.Esi,8));<br>memo1.Lines.Add('cont.Ebx:&nbsp;'+inttohex(cont.Ebx,8));<br>memo1.Lines.Add('cont.Edx:&nbsp;'+inttohex(cont.Edx,8));<br>memo1.Lines.Add('cont.Ecx:&nbsp;'+inttohex(cont.Ecx,8));<br>memo1.Lines.Add('cont.EAx:&nbsp;'+inttohex(cont.EAx,8));<br>memo1.Lines.Add('cont.Ebp:&nbsp;'+inttohex(&nbsp;cont.Ebp,8));<br>memo1.Lines.Add('cont.Eip:&nbsp;'+inttohex(cont.Eip,8));<br>memo1.Lines.Add('cont.SegCs:&nbsp;'+inttohex(cont.SegCs,8));<br>memo1.Lines.Add('cont.EFlags:&nbsp;'+inttohex(cont.EFlags,8));<br>memo1.Lines.Add('cont.EFlags:&nbsp;'+inttohex(cont.EFlags,8));<br>memo1.Lines.Add('cont.Esp:&nbsp;'+inttohex(cont.Esp,8));<br>memo1.Lines.Add('cont.SegSs:&nbsp;'+inttohex(cont.SegSs,8));<br><br>end;
 
问题已解决&nbsp;要先设置&nbsp;ContextFlags的值.<br><br>进来顶下,给分结贴.
 
留名捡分
 
接受答案了.
 
后退
顶部