Monitoring a Driver

Windows specific forum
cbailey
User
User
Posts: 65
Joined: Sat Jun 04, 2005 4:05 am

Monitoring a Driver

Post by cbailey »

I've got an old crappy VoiceMail system that connects to a Windows machine. The Windows machine keeps losing 'sync' with the hardware. When this happens, the drivers for it in device manager show yellow exclamation marks. Usually, unplugging and plugging the hardware fixes things, but I want to find an automated way. I found that if I go into device manager, and disable the 'USB Hub' for the device, and then reenable it, it fixes things. So, I want to write a program that monitors the status of the driver, and disables and reenables it when it fails. Problem is, I don't have a clue how to do it, or even if it's possible.

Is there a way to monitor, and disable/enable drivers from within Purebasic?
BLiTZ
New User
New User
Posts: 1
Joined: Mon Aug 28, 2006 2:57 pm

Post by BLiTZ »

MS has devcon.exe command-line tool, that can do what you need ...

http://support.microsoft.com/?kbid=311272

Probably you just need to wrap it around with some kind of script (cmd, wsh etc ...).
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

Post by bingo »

:D

Code: Select all

OpenLibrary(1,"setupapi.dll") 
*F1 = GetFunction(1, "CM_Locate_DevNodeA") 
*F2 = GetFunction(1, "CM_Disable_DevNode") 
*F3 = GetFunction(1, "CM_Enable_DevNode")

;look in registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
;to find Identifiers for PCI/USB ... Devices
id.s = "ACPI\PNP0400\5&18d3520b&0" ;sample lpt1

Debug CallFunctionFast(*F1,@devhandle,@id,0) 
Debug CallFunctionFast(*F2,devhandle,0) ;disable device
;Debug CallFunctionFast(*F3,devhandle,0) ;enable device
CloseLibrary(1)
should work in 98 ... 2000 . testet on xp and vista !
["1:0>1"]
Post Reply