简体   繁体   English

Windows:如何从(NDIS)内核驱动程序生成线程?

[英]Windows: how to spawn threads from (NDIS) kernel driver?

Which function is recommended to spawn a new thread within NDIS5/6 context? 建议使用哪个函数在NDIS5 / 6上下文中生成新线程? Looking for something that is guaranteed to work at IRQL=PASSIVE (eg no bsods out of nothing); 寻找可以保证在IRQL = PASSIVE下工作的东西(例如,无中生有) by a quick examination of ndis.h contents, found nothing. 通过快速检查ndis.h内容,什么也没发现。

Also, it is planned to use a newly spawned thread for calling upon NdisFreeMemory* family, will it be causing any problems to free allocated, but unused memory from a different thread? 另外,计划使用新产生的线程来调用NdisFreeMemory*系列,是否会导致从其他线程释放已分配但未使用的内存的任何问题?

Threading is outside the scope of NDIS. 线程不在NDIS的范围内。 If you need to start a new thread, use the standard kernel routines (like PsCreateSystemThread ). 如果需要启动新线程,请使用标准内核例程(例如PsCreateSystemThread )。 Note that usually timers and work items are sufficicent for most miniport needs. 请注意,通常,计时器和工作项足以满足大多数微型端口的需求。 It is unusual for an NDIS miniport to create its own thread, although I suppose there are valid cases where it might be a fair design. NDIS微型端口创建自己的线程是不寻常的,尽管我认为在某些情况下它可能是一个合理的设计。

It is ok to allocate memory on one thread and free it on another. 可以在一个线程上分配内存,然后在另一个线程上释放内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM