How to programmatically disable network card
-
I have an application that runs under Win2K Pro and needs to disable the network card temporarily (I need to have as close to real-time response as possible and I don't want the CPU interrupted to deal with network activity). I can ask the user to go to the control panel and disable the network card, but is there a way to do this programmatically? Thanks for any advice.
-
I have an application that runs under Win2K Pro and needs to disable the network card temporarily (I need to have as close to real-time response as possible and I don't want the CPU interrupted to deal with network activity). I can ask the user to go to the control panel and disable the network card, but is there a way to do this programmatically? Thanks for any advice.
hav an idea, u can try it: surely the control panel is setting some entry in the registry to false or something like that, so all u need is try to know that entry. If this ever exists, (hope it does) u can spy it using RegMon tool on the www.sysinternals.com Hope this help Papa Murex Co. while (TRUE) Papa.WillLove ( Bebe ) ;
-
I have an application that runs under Win2K Pro and needs to disable the network card temporarily (I need to have as close to real-time response as possible and I don't want the CPU interrupted to deal with network activity). I can ask the user to go to the control panel and disable the network card, but is there a way to do this programmatically? Thanks for any advice.
While not an answer to your question, have you looked at maybe using CreateProcess() to start your app in REALTIME mode? This will give you the highest possible priority, above nearly everything else, without having to disable other processes or drivers. You could write a little proxy application whose sole job is to launch your actual app by calling CreateProcess() with a creation flag of REALTIME_PRIORITY_CLASS. Just a word of caution, of course... if you do it this way you will have priority above even disk I/O. Like the friendly manual states, if your process runs for more than a very brief interval, you can "cause disk caches not to flush or cause the mouse to be unresponsive." If REALTIME is too much, there are also HIGH_PRIORITY_CLASS and ABOVE_NORMAL_PRIORITY_CLASS (Win2000) flags that are not quite as severe, but still preempt normal apps. Just take a gander at the CreateProcess() docs.
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
-
While not an answer to your question, have you looked at maybe using CreateProcess() to start your app in REALTIME mode? This will give you the highest possible priority, above nearly everything else, without having to disable other processes or drivers. You could write a little proxy application whose sole job is to launch your actual app by calling CreateProcess() with a creation flag of REALTIME_PRIORITY_CLASS. Just a word of caution, of course... if you do it this way you will have priority above even disk I/O. Like the friendly manual states, if your process runs for more than a very brief interval, you can "cause disk caches not to flush or cause the mouse to be unresponsive." If REALTIME is too much, there are also HIGH_PRIORITY_CLASS and ABOVE_NORMAL_PRIORITY_CLASS (Win2000) flags that are not quite as severe, but still preempt normal apps. Just take a gander at the CreateProcess() docs.
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
Thanks for the thought. I have indeed been experimenting with this with some success. However, it's also a good thing to turn off sources of hardware interrupts that I would just as soon avoid. I deal with the disk I/O problem by using a gigabyte of RAM, locking pages in memory, and avoiding any file I/O until the acquisition is complete. Since I only need this priority level for a small portion of my application's running time, I use
SetPriorityClass()
rather thanCreateProcess()
. I am trying to capture 5000 frames per second from a high-speed camera, so I am trying to avoid even an occasional millisecond of latency. I would really like to work with an RTOS, such as QNX, but the frame grabber board I must use only has drivers for Windows. -
I have an application that runs under Win2K Pro and needs to disable the network card temporarily (I need to have as close to real-time response as possible and I don't want the CPU interrupted to deal with network activity). I can ask the user to go to the control panel and disable the network card, but is there a way to do this programmatically? Thanks for any advice.
Just a wild guess, but have you looked at the
CloseClusterNetInterface()
function?
CPUA 0x5041 Sonork 100.11743 Chicken Little "So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies Within you lies the power for good - Use it!
-
Thanks for the thought. I have indeed been experimenting with this with some success. However, it's also a good thing to turn off sources of hardware interrupts that I would just as soon avoid. I deal with the disk I/O problem by using a gigabyte of RAM, locking pages in memory, and avoiding any file I/O until the acquisition is complete. Since I only need this priority level for a small portion of my application's running time, I use
SetPriorityClass()
rather thanCreateProcess()
. I am trying to capture 5000 frames per second from a high-speed camera, so I am trying to avoid even an occasional millisecond of latency. I would really like to work with an RTOS, such as QNX, but the frame grabber board I must use only has drivers for Windows.I did a quick google search and came up with a few things that might help. Someone mentioned that there's a sample in the Windows DDK, under NTDDK\src\general\setup\Enable. Whether that has disable code or not, I'm not sure :) More interestingly, there's an external program named DevCon that might do the trick, and apparently Microsoft gives out the source code in their latest XP DDK: DevCon.exe KB Q311272[^]
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
-
I did a quick google search and came up with a few things that might help. Someone mentioned that there's a sample in the Windows DDK, under NTDDK\src\general\setup\Enable. Whether that has disable code or not, I'm not sure :) More interestingly, there's an external program named DevCon that might do the trick, and apparently Microsoft gives out the source code in their latest XP DDK: DevCon.exe KB Q311272[^]
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
Thanks a million! Those pointers help me with exactly what I need. For the moment, calling DevCon from my application should do just what I need. Sometime later, I can see about incorporating the DDK code into my application's core. Thanks so much for pointing me an answer.
-
Thanks a million! Those pointers help me with exactly what I need. For the moment, calling DevCon from my application should do just what I need. Sometime later, I can see about incorporating the DDK code into my application's core. Thanks so much for pointing me an answer.
Glad to help :)
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein