在内核中捕获异常 [英] Trapping an exception in the kernel

查看:79
本文介绍了在内核中捕获异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用。在一个不起眼的地址0x7c59ba9d看到来自内核的异常。

当在VC ++ 6.0调试器下运行时,每次发生
时我都可以捕获它。如果我想将它捕获到我的程序中并且只是告诉程序只是继续(即没有通过链上的异常)我该怎么做?


我知道如何找出异常的原因是什么?在电话

堆栈中我的程序没有出现。 MSCORWKS(我认为是.NET,应用程序使用的

框架。调用我的DLL)和KERNEL32做的。


非常感谢任何帮助你可以给。

My app. sees an exception from the kernel at an obscure address, 0x7c59ba9d.
When running under the VC++ 6.0 debugger, I can trap this each time it
occurs. If I want to trap it in my program and just tell the program to just
continue (i.e. not pass the exception up the chain) how do I do this?

Any idea how I can find out what the cause of the exception is? In the call
stack my program doesn''t appear. MSCORWKS (which I think is .NET, the
framework used by the app. that calls my DLL) and KERNEL32 do.

Many thanks for any help that you can give.

推荐答案

地址0x7c59ba9d似乎不是内核地址。

这是一个用户模式地址。


您还没有告诉我们这是一个什么样的例外:

一个ACCESS_VIOLATION?

a CLR异常?


平均而言,是继续的方式。这些

行的例外情况。

ExceptionFilter可能与您的情况不符,

,因为您没有提供足够的信息,

如果例外是可持续的,我们甚至不知道。


DWORD ExceptionFilter(LPEXCEPTION_POINTERS ExceptionPointers){

语境* pContext = ExceptionPointers-> ContextRecord;

if(0x7c59ba9d ==(ULONG_PTR)Context-> eip){

返回EXCEPTION_CONTINUE_EXECUTION;

} else {

返回EXCEPTION_CONTINUE_SEARCH。

}

}


函数(){

__try {

//这里的代码

} __except(ExceptionFilter(GetExceptionInformation())){

//没有什么

}

}


-

这个帖子是按原样提供的。没有保证,也没有授予任何权利。

使用任何包含的脚本样本都要遵守
http://www.microsoft.com/info/cpyright.htm

" Andrew Chalk" <交流**** @ XXXmagnacartasoftware.com>在消息中写道

新闻:eA ************** @ TK2MSFTNGP10.phx.gbl ...
The address 0x7c59ba9d does not appear to be a kernel address.
It''s a user mode address.

You have not told us which kind of exception this is:
one ACCESS_VIOLATION ?
a CLR Exception ?

on average, the way to "continue" the exceptio is something along these
lines.
The ExceptionFilter may be incorrect for your case,
since you have not provided enough information,
and we even don''t knonw if the exception is continuable.

DWORD ExceptionFilter(LPEXCEPTION_POINTERS ExceptionPointers){
CONTEXT * pContext = ExceptionPointers->ContextRecord;
if (0x7c59ba9d == (ULONG_PTR)Context->eip){
return EXCEPTION_CONTINUE_EXECUTION;
} else {
return EXCEPTION_CONTINUE_SEARCH.
}
}

Function(){
__try {
// your code here
} __except (ExceptionFilter(GetExceptionInformation())) {
// nothing
}
}

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Andrew Chalk" <ac****@XXXmagnacartasoftware.com> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
我的应用。在一个不起眼的地址看到来自内核的异常,
0x7c59ba9d。当在VC ++ 6.0调试器下运行时,我可以在每次发生时捕获它。如果我想将它捕获到我的程序中,只是告诉程序
只是继续(即不通过链上的异常)我该怎么做?

我知道怎么做找出异常的原因是什么?在
调用堆栈中,我的程序没有出现。 MSCORWKS(我认为是.NET,应用程序使用的
框架,调用我的DLL)和KERNEL32。

非常感谢您提供的任何帮助。
My app. sees an exception from the kernel at an obscure address, 0x7c59ba9d. When running under the VC++ 6.0 debugger, I can trap this each time it
occurs. If I want to trap it in my program and just tell the program to just continue (i.e. not pass the exception up the chain) how do I do this?

Any idea how I can find out what the cause of the exception is? In the call stack my program doesn''t appear. MSCORWKS (which I think is .NET, the
framework used by the app. that calls my DLL) and KERNEL32 do.

Many thanks for any help that you can give.



抱歉。我的草率术语 - 致电KERNEL32。这是电话

堆栈:


KERNEL32! 7c59ba9d()

MSCORWKS! 792206a8()

MSCORWKS! 7922063e()

MSCORWKS! 792205f1()

MSCORWKS! 792205d1()

MSCORWKS! 792a85fc()

MSCORWKS! 792a8ef9()

MSCORWKS! 79248678()

03f21d1e()

056ad957()

055d8422()

0474a865()

0474a5a7()

MSCORWKS! 791ece8a()

MSCORWKS! 791eb8a0()

MSCORWKS! 791f3941()

MSCORWKS! 791f38ff()

MSCORWKS! 792cc5f8()

MSCORWKS! 792cc6be()

KERNEL32! 7c57b382()


从此,它似乎是一个CLR例外。正确吗?


感谢您的其余部分答案。我应该用__try()

块包围什么?我的代码在一个由VB.NET

应用程序加载的ActiveX控件中。


问候,


Andrew

" Ivan Brugiolo [MSFT]" < 4 ****** @ online.microsoft.com>在消息中写道

新闻:Oo ************** @ TK2MSFTNGP11.phx.gbl ...
Sorry. My sloppy terminology -- In a call to KERNEL32. Here is the call
stack:

KERNEL32! 7c59ba9d()
MSCORWKS! 792206a8()
MSCORWKS! 7922063e()
MSCORWKS! 792205f1()
MSCORWKS! 792205d1()
MSCORWKS! 792a85fc()
MSCORWKS! 792a8ef9()
MSCORWKS! 79248678()
03f21d1e()
056ad957()
055d8422()
0474a865()
0474a5a7()
MSCORWKS! 791ece8a()
MSCORWKS! 791eb8a0()
MSCORWKS! 791f3941()
MSCORWKS! 791f38ff()
MSCORWKS! 792cc5f8()
MSCORWKS! 792cc6be()
KERNEL32! 7c57b382()

From this, it appears to be a CLR exception. Correct?

Thanks for the rest of your answer. What should I bracket with the __try()
block? My code is inside an ActiveX control that is loaded by a VB.NET
application.

Regards,

Andrew
"Ivan Brugiolo [MSFT]" <iv******@online.microsoft.com> wrote in message
news:Oo**************@TK2MSFTNGP11.phx.gbl...
地址0x7c59ba9d没有似乎是一个内核地址。
这是一个用户模式地址。

你没有告诉我们这是一个什么样的例外:
一个ACCESS_VIOLATION?
一个CLR例外?

平均而言,继续的方式例外情况就是这些问题。
ExceptionFilter可能不适合您的情况,
因为您没有提供足够的信息,
我们甚至不会知道例外是可持续的。

DWORD ExceptionFilter(LPEXCEPTION_POINTERS ExceptionPointers){
CONTEXT * pContext = ExceptionPointers-> ContextRecord;
if(0x7c59ba9d ==(ULONG_PTR)Context-> eip){
返回EXCEPTION_CONTINUE_EXECUTION;
}否则{
返回EXCEPTION_CONTINUE_SEARCH。
}


功能(){
__try {
//你的代码在这里
} __except(ExceptionFilter(GetExceptionInformation())){
//没什么
}
}
-
此帖子按原样提供。没有保证,并且不授予
权利。使用任何包含的脚本示例均须遵守
http中指定的条款。 ://www.microsoft.com/info/cpyright.htm

" Andrew Chalk" <交流**** @ XXXmagnacartasoftware.com>在消息中写道
新闻:eA ************** @ TK2MSFTNGP10.phx.gbl ...
The address 0x7c59ba9d does not appear to be a kernel address.
It''s a user mode address.

You have not told us which kind of exception this is:
one ACCESS_VIOLATION ?
a CLR Exception ?

on average, the way to "continue" the exceptio is something along these
lines.
The ExceptionFilter may be incorrect for your case,
since you have not provided enough information,
and we even don''t knonw if the exception is continuable.

DWORD ExceptionFilter(LPEXCEPTION_POINTERS ExceptionPointers){
CONTEXT * pContext = ExceptionPointers->ContextRecord;
if (0x7c59ba9d == (ULONG_PTR)Context->eip){
return EXCEPTION_CONTINUE_EXECUTION;
} else {
return EXCEPTION_CONTINUE_SEARCH.
}
}

Function(){
__try {
// your code here
} __except (ExceptionFilter(GetExceptionInformation())) {
// nothing
}
}

--
This posting is provided "AS IS" with no warranties, and confers no rights. Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Andrew Chalk" <ac****@XXXmagnacartasoftware.com> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
我的应用。在一个不起眼的地址看到来自内核的异常,
My app. sees an exception from the kernel at an obscure address,


0x7c59ba9d。


0x7c59ba9d.

当在VC ++ 6.0调试器下运行时,我可以在每次发生时捕获它。如果我想将它捕获到我的程序中并且只是告诉程序
When running under the VC++ 6.0 debugger, I can trap this each time it
occurs. If I want to trap it in my program and just tell the program to


只是

继续(即不通过链上的异常)我该怎么做? br />
我知道如何找出异常的原因是什么?在
continue (i.e. not pass the exception up the chain) how do I do this?

Any idea how I can find out what the cause of the exception is? In the


调用

堆栈中我的程序没有出现。 MSCORWKS(我认为是.NET,应用程序使用的
框架,调用我的DLL)和KERNEL32。

非常感谢您提供的任何帮助。
stack my program doesn''t appear. MSCORWKS (which I think is .NET, the
framework used by the app. that calls my DLL) and KERNEL32 do.

Many thanks for any help that you can give.




如果您可以使用来自
的系统调试器,例如cdb / ntsd / windbg http://www.microsoft.com/whdc/ddk/ de ... t.mspx?gssnb = 1

并报告''〜* kb''命令的输出,这将有助于查看更多

件事。


以下堆栈与

kernel32的调用是等价的(作为教育猜测)!RaiseException。

CLR引发C ++异常,CLR除了和一些原生异常为

好​​,

加上一些故意的访问冲突以实现

System.NullReferenceException。


作为一般建议,你应该在你的VB中添加这个结构。 NET代码,

,因为下面建议的方法在你的情况下看起来不可行。


在这里尝试

''你的代码

赶上E作为例外

''你的清理代码在这里

结束捕获

-

该帖子按原样提供。没有保证,也没有授予任何权利。

使用任何包含的脚本样本都要遵守
http://www.microsoft.com/info/cpyright.htm

" Andrew Chalk" <交流**** @ XXXmagnacartasoftware.com>在消息中写道

news:uz ************** @ TK2MSFTNGP12.phx.gbl ...
If you could use a system debugger like cdb/ntsd/windbg from
http://www.microsoft.com/whdc/ddk/de...t.mspx?gssnb=1
and report the output of the ''~*kb'' command, that would help to see more
things.

The stack below is equvalent (as an educate guess) to a call to
kernel32!RaiseException.
The CLR raises C++ exception, CLR exceptin and some native exception as
well,
plus some intentional Access Violation in order to implement the
System.NullReferenceException.

As a general suggestion, you should add this constructs in your VB.NET code,
since the approach suggested below does not look feasible in you case.

Try
'' your code here
Catch E as Exception
'' your cleanup code here
End Catch
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Andrew Chalk" <ac****@XXXmagnacartasoftware.com> wrote in message
news:uz**************@TK2MSFTNGP12.phx.gbl...
抱歉。我的草率术语 - 致电KERNEL32。这是电话
堆栈:

KERNEL32! 7c59ba9d()
MSCORWKS! 792206a8()
MSCORWKS! 7922063e()
MSCORWKS! 792205f1()
MSCORWKS! 792205d1()
MSCORWKS! 792a85fc()
MSCORWKS! 792a8ef9()
MSCORWKS! 79248678()
03f21d1e()
056ad957()
055d8422()
0474a865()
0474a5a7()
MSCORWKS! 791ece8a()
MSCORWKS! 791eb8a0()
MSCORWKS! 791f3941()
MSCORWKS! 791f38ff()
MSCORWKS! 792cc5f8()
MSCORWKS! 792cc6be()
KERNEL32! 7c57b382()

从这看起来,它似乎是一个CLR例外。正确吗?

感谢您的其余答案。我应该用__try()
块包围什么?我的代码位于一个由VB.NET
应用程序加载的ActiveX控件中。

问候,

Andrew

" Ivan Brugiolo [MSFT]" < 4 ****** @ online.microsoft.com>在消息中写道
新闻:Oo ************** @ TK2MSFTNGP11.phx.gbl ...
Sorry. My sloppy terminology -- In a call to KERNEL32. Here is the call
stack:

KERNEL32! 7c59ba9d()
MSCORWKS! 792206a8()
MSCORWKS! 7922063e()
MSCORWKS! 792205f1()
MSCORWKS! 792205d1()
MSCORWKS! 792a85fc()
MSCORWKS! 792a8ef9()
MSCORWKS! 79248678()
03f21d1e()
056ad957()
055d8422()
0474a865()
0474a5a7()
MSCORWKS! 791ece8a()
MSCORWKS! 791eb8a0()
MSCORWKS! 791f3941()
MSCORWKS! 791f38ff()
MSCORWKS! 792cc5f8()
MSCORWKS! 792cc6be()
KERNEL32! 7c57b382()

From this, it appears to be a CLR exception. Correct?

Thanks for the rest of your answer. What should I bracket with the __try()
block? My code is inside an ActiveX control that is loaded by a VB.NET
application.

Regards,

Andrew
"Ivan Brugiolo [MSFT]" <iv******@online.microsoft.com> wrote in message
news:Oo**************@TK2MSFTNGP11.phx.gbl...
地址0x7c59ba9d似乎不是内核地址。
这是一个用户模式地址。

你没有告诉我们这是一个什么样的例外:
一个ACCESS_VIOLATION?
一个CLR例外?

平均而言,继续的方式例外情况就是这些问题。
ExceptionFilter可能不适合您的情况,
因为您没有提供足够的信息,
我们甚至不会知道例外是可持续的。

DWORD ExceptionFilter(LPEXCEPTION_POINTERS ExceptionPointers){
CONTEXT * pContext = ExceptionPointers-> ContextRecord;
if(0x7c59ba9d ==(ULONG_PTR)Context-> eip){
返回EXCEPTION_CONTINUE_EXECUTION;
}否则{
返回EXCEPTION_CONTINUE_SEARCH。
}


功能(){
__try {
//你的代码在这里
} __except(ExceptionFilter(GetExceptionInformation())){
//没什么
}
}
-
此帖子按原样提供。没有保证,也没有赋予
The address 0x7c59ba9d does not appear to be a kernel address.
It''s a user mode address.

You have not told us which kind of exception this is:
one ACCESS_VIOLATION ?
a CLR Exception ?

on average, the way to "continue" the exceptio is something along these
lines.
The ExceptionFilter may be incorrect for your case,
since you have not provided enough information,
and we even don''t knonw if the exception is continuable.

DWORD ExceptionFilter(LPEXCEPTION_POINTERS ExceptionPointers){
CONTEXT * pContext = ExceptionPointers->ContextRecord;
if (0x7c59ba9d == (ULONG_PTR)Context->eip){
return EXCEPTION_CONTINUE_EXECUTION;
} else {
return EXCEPTION_CONTINUE_SEARCH.
}
}

Function(){
__try {
// your code here
} __except (ExceptionFilter(GetExceptionInformation())) {
// nothing
}
}

--
This posting is provided "AS IS" with no warranties, and confers no


权利。

使用任何包含的脚本样本都要遵守
http://www.microsoft.com/info/cpyright.htm

Andrew Chalk <交流**** @ XXXmagnacartasoftware.com>在消息中写道
新闻:eA ************** @ TK2MSFTNGP10.phx.gbl ...
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Andrew Chalk" <ac****@XXXmagnacartasoftware.com> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
我的应用。在一个不起眼的地址看到来自内核的异常,
My app. sees an exception from the kernel at an obscure address,


0x7c59ba9d。


0x7c59ba9d.

当在VC ++ 6.0调试器下运行时,我可以在每次发生时捕获它。如果我想将它捕获到我的程序中并且只是告诉程序
When running under the VC++ 6.0 debugger, I can trap this each time it
occurs. If I want to trap it in my program and just tell the program


只是

继续(即没有通过链上的异常)我该怎么做? br />
我知道如何找出异常的原因是什么?在
continue (i.e. not pass the exception up the chain) how do I do this?

Any idea how I can find out what the cause of the exception is? In the


调用

堆栈中我的程序没有出现。 MSCORWKS(我认为是.NET,应用程序使用的
框架,调用我的DLL)和KERNEL32。

非常感谢您提供的任何帮助。
stack my program doesn''t appear. MSCORWKS (which I think is .NET, the
framework used by the app. that calls my DLL) and KERNEL32 do.

Many thanks for any help that you can give.





这篇关于在内核中捕获异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆