You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 02:34:51