阅读:1798回复:4
《undocument windows nt》配套源码undocnt.h中的宏MYDRIVERENTRY里面的##是什么意思?
《undocument windows nt》配套源码undocnt.h中的宏MYDRIVERENTRY里面的##是什么意思?我只知道运算符##是把两个记号连接在一起,但在这段代码中“##DeviceID”和“ntStatus=##DriverSpecificInit”如何解释?谢谢!!
#define MYDRIVERENTRY(DriverName, DeviceID, DriverSpecificInit) \ PDEVICE_OBJECT deviceObject = NULL; \ NTSTATUS ntStatus; \ WCHAR deviceNameBuffer[] = L"\\Device\\"##DriverName; \ UNICODE_STRING deviceNameUnicodeString; \ WCHAR deviceLinkBuffer[] = L"\\DosDevices\\"##DriverName; \ UNICODE_STRING deviceLinkUnicodeString; \ \ RtlInitUnicodeString (&deviceNameUnicodeString, deviceNameBuffer); \ ntStatus = IoCreateDevice (DriverObject, \ 0, \ &deviceNameUnicodeString, \ ##DeviceID, \ 0, \ FALSE, \ &deviceObject \ ); \ \ if (NT_SUCCESS(ntStatus)) { \ RtlInitUnicodeString (&deviceLinkUnicodeString, deviceLinkBuffer);\ ntStatus = IoCreateSymbolicLink (&deviceLinkUnicodeString, \ &deviceNameUnicodeString);\ if (!NT_SUCCESS(ntStatus)) {\ IoDeleteDevice (deviceObject); \ return ntStatus; \ } \ \ ntStatus=##DriverSpecificInit; \ \ if (!NT_SUCCESS(ntStatus)) {\ IoDeleteDevice (deviceObject); \ IoDeleteSymbolicLink(&deviceLinkUnicodeString); \ return ntStatus; \ } \ \ \ DriverObject->MajorFunction[IRP_MJ_CREATE] = \ DriverObject->MajorFunction[IRP_MJ_CLOSE] = \ DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DriverDispatch; \ DriverObject->DriverUnload = DriverUnload; \ return STATUS_SUCCESS; \ } else { \ return ntStatus; \ }; |
|
沙发#
发布于:2004-10-29 00:02
查msnd啊....
##这个东西是用来连接两个符号的... |
|
板凳#
发布于:2004-10-29 08:08
对
|
|
地板#
发布于:2004-11-01 09:24
对 "undocument windows nt"这本书有没有电子版阿? :) |
|
|
地下室#
发布于:2004-11-02 08:49
本网站的“下载中心”的“参考书籍”中就有,你去看看吧。
|
|