标识符FilterConnect Communiatport不确定
我有一个小型驱动程序,该驱动程序使用通信端口连接到用户模式。小型内核驱动器很好。不幸的是,用户模式代码存在一些问题。
用户模式代码:
#include <fltUser.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "kernel32.lib")
#pragma comment(lib, "fltlib.lib")
#pragma comment(lib, "fltmgr.lib")
HANDLE port = NULL;
int main() {
printf("Hello there\n");
if (port == NULL) {
if (FilterConnectCommunicationPort(L"\\nmf", 0, NULL, 0, NULL, &port)) {
printf("Connected to Kernel\n");
}
}
return 0;
}
错误列表:
Severity Code Description Project File Line Suppression State
Error (active) E0059 function call is not allowed in a constant expression kernelConnect C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\fltUser.h 94
Error (active) E0059 function call is not allowed in a constant expression kernelConnect C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\fltUserStructures.h 27
Error (active) E0020 identifier "HANDLE" is undefined kernelConnect C:\Users\Abdul\source\repos\kernelConnect\Source.cpp 9
Error (active) E0020 identifier "FilterConnectCommunicationPort" is undefined kernelConnect C:\Users\Abdul\source\repos\kernelConnect\Source.cpp 13
Error C1012 unmatched parenthesis: missing ')' kernelConnect C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\fltUserStructures.h 27
如您所见,有两个错误,我不明白:
- 标识符“ handle”是未定义的kernelconnect
- 标识符“ FilterConnectCommunicationPort”未定义,
我确认确实在FLTUSER HEADER中确实存在FilterConnectConnectCommunicationPort。但是在源代码中,Visual Studio可以找到该函数的定义,而不是声明。
谁能告诉我这里有什么问题?
I have a minifilter driver that use communication ports to connect to user mode. The minifilter kernel driver is fine. The user mode code unfortunately have some issues.
User-mode code:
#include <fltUser.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "kernel32.lib")
#pragma comment(lib, "fltlib.lib")
#pragma comment(lib, "fltmgr.lib")
HANDLE port = NULL;
int main() {
printf("Hello there\n");
if (port == NULL) {
if (FilterConnectCommunicationPort(L"\\nmf", 0, NULL, 0, NULL, &port)) {
printf("Connected to Kernel\n");
}
}
return 0;
}
List of errors:
Severity Code Description Project File Line Suppression State
Error (active) E0059 function call is not allowed in a constant expression kernelConnect C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\fltUser.h 94
Error (active) E0059 function call is not allowed in a constant expression kernelConnect C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\fltUserStructures.h 27
Error (active) E0020 identifier "HANDLE" is undefined kernelConnect C:\Users\Abdul\source\repos\kernelConnect\Source.cpp 9
Error (active) E0020 identifier "FilterConnectCommunicationPort" is undefined kernelConnect C:\Users\Abdul\source\repos\kernelConnect\Source.cpp 13
Error C1012 unmatched parenthesis: missing ')' kernelConnect C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\fltUserStructures.h 27
As you can see, there are two errors, that I don't understand:
- identifier "HANDLE" is undefined kernelConnect
- identifier "FilterConnectCommunicationPort" is undefined
I confirmed that FilterConnectCommunicationPort is indeed in the fltuser header. but in the source code, visual studio could find a definition to the function but not a declaration.
Can anyone tell me what is wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论