Windows用户态是否提供链表操作的C语言官方API?
关于Windows用户态链表API的疑问
我找到了LIST_ENTRY,但该结构属于内核模式驱动参考,显然无法在用户态正常使用。
以下是我的测试代码:
#include <windows.h> #include <stdio.h> int main() { LIST_ENTRY message_list; InitializeListHead(&message_list); if (!IsListEmpty(&message_list)) { puts("Not expected"); return -1; } puts("Hello World"); return 0; }
我的CMake配置如下:
cmake_minimum_required (VERSION 2.8) project (CMakeHelloWorld) add_executable (CMakeHelloWorld main.c) target_link_libraries(CMakeHelloWorld ntdll kernel32)
编译时出现链接错误:
main.obj : error LNK2019: unresolved external symbol InitializeListHead referenced in function main [C:\test\build\CMakeHelloWorld.vcxproj] main.obj : error LNK2019: unresolved external symbol IsListEmpty referenced in function main [C:\test\build\CMakeHelloWorld.vcxproj] C:\test\build\Debug\CMakeHelloWorld.exe : fatal error LNK1120: 2 unresolved externals [C:\test\build\CMakeHelloWorld.vcxproj]
我本可以自行实现链表API,但觉得Windows没有提供用户态链表API这件事很奇怪。
内容的提问来源于stack exchange,提问作者OlivierM
相关产品推荐
相关产品推荐

