高手请进!(80分)

  • 主题发起人 主题发起人 ybsnui
  • 开始时间 开始时间
Y

ybsnui

Unregistered / Unconfirmed
GUEST, unregistred user!
请翻译为中文!
Calling WDM Services from Windows 98 VxDs
If you are developing VxDs specifically for Windows 98, you might
occasionally need to call a WDM service from a VxD. The Windows 98 DDK
has some limited support fordo
ing this, although it isn't fully
documented.
In subdirectory lib/i386/free/win98 you'll find library wdmvxd.clb. This
library gives you linkage to most if not all of the WDM entry points
provided with Windows 98. Each of the object files loads registers and
invokes INT 2Eh, which traps to a system dispatcher. Before invoking the
called WDM service, the dispatcher takes care of ensuring that the
stack is set up for structured exception handling, which is supported in
WDM drivers.
The library is set up to look like an import library, even though it
does not result in any imports being generated. If you use DUMPBIN
with the /linkermember switch, you'll see that the entry points are
prefixed with __imp_. This wasdo
ne so that you can use prototypes
directly from wdm.h.
For example, suppose you wanted to call RtlInitUnicodeString from a VxD.
You would need this prototype from wdm.h:
NTSYSAPI
VOID
NTAPI
RtlInitUnicodeString(
PUNICODE_STRING DestinationString,
PCWSTR SourceString
);

In addition, you may need these definitions:
#define NTSYSAPI __declspec(dllimport)
#define NTAPI __stdcall
then
it's simply a matter of having the typedef's and linking against
wdmvxd.clb.
Use wdmvxd.clb only when absolutely necessary, and always with extreme
caution. Because IRQL is largely undefined in VxDs, there are numerous
ways to get into trouble when making these calls.


 
如果你正在开发98环境下的vxds,你可能有时需要在VXDS中调用WDM服务.
98DDK有一些限制在这方面.
但是在lib/i386/free/win98(DDK)目录下你可以找到wdmvxd.clb库.
这个库提供了大部分的98下WDM的服务入口联接.系统的每个服务都是通过2EH号中断来执行.
2Eh被一个系统分配程序所接管 .
(All WDM Service CaLL --->int 2EH.2EH is handle by a dispatcher).
在调用WDM服务前,分配者确定异常stack已经建立,异常stack在WDM驱动中已经支持.
这个库是看起来像一个Import库,即使他根本不建立任何import.
如果你使用DUMPBIN加上linkermember选像(dumpbin /linkermember wdmvxd.clb)
,你将看到这个入口点被标记_imp_.
这个说明你能直接使用这个在WDM.h的原型于Vxd中.
例如,假定你想从vxd中调用RtlInitUnicodeString.
你需要如下原型
NTSYSAPI
VOID
NTAPI
RtlInitUnicodeString(
PUNICODE_STRING DestinationString,
PCWSTR SourceString
);

此外,你还要一些特别的定义.
#define NTSYSAPI __declspec(dllimport)
#define NTAPI __stdcall
这时,将有一个联接问题.调用与wdmvxd.clb的定义不符.
只有在必要的时候才用wdmvxd.clb,可能会有些许多的问题.
因为IRQL并没有在vxds中定义.在调用这些服务时,有许多的可能都导致错误的发生.
-------------------------------------------------------------------------------
要这个有什么用???
快给分.
 
接受答案了.
 

Similar threads

A
回复
0
查看
943
Andreas Hausladen
A
A
回复
0
查看
992
Andreas Hausladen
A
A
回复
0
查看
819
Andreas Hausladen
A
A
回复
0
查看
619
Andreas Hausladen
A
后退
顶部