[Idea] Programa que monitorea el registro de windows

10/02/2007 - 07:55 por Pietro | Informe spam
Hola, se me ocurrio hacer un programa que monitorea cierta llave del registro
de windows. Lo primero que se me ocurrio fue hacer que cada cierto tiempo se
vea si los valores son iguales al que estaba hace esa X cantidad de tiempo,
si son iguales que siga el bucle, y si en algun momento los valores no son
iguales que entre en accion un evento (lo que haga el eventoo lo vere
despues, no me complica).
Mis preguntas son:
Hacer que cada cierto tiempo consulte el registro y lo compare con los
valores anteriores haría que el programa fuera algo lento y usaria muchos
recursos? Es el mejor metodo para ir comparando? Conviene usar un timer o
simplemente usar un thread y hacerlo dormir por la cantidad de tiempo que
quiera para que vuelva a consultar¿? Me imagino que si es una llave la que
consulto no deberia haber mucho consumo de recursos pero si consulto muchas
llaves imagino que si, estoy en lo correcto?
Eso es todo por ahora, ojalá me puedan aclarar un poco este tema, muchas
gracias.

Preguntas similare

Leer las respuestas

#1 JM
28/02/2007 - 21:00 | Informe spam
lo mejor que se me ocurre es que hagas uso del api de windows
RegNotifyChangeKeyValue

te pego un código obtenido de www.allapi.net escrito en VB 6.0 a lo mejor
si le buscas encuentras algo en c# o lo portas por que hace exactamente lo
que necesitas

'This program shows you how to use the RegNotifyChangeKeyValue-function

'As its name predicts, RegNotifyChangeKeyValue will notify our program

'when the registry changes.

'Follow these steps to test this program:

'1. Start this program

'2. Start Regedit.exe (located in your Windows-directory)

'3. Go to HKEY_CURRENT_USER

'4. Change the value of HKEY_CURRENT_USER

'5. You will see that our program returns from the RegNotifyChangeKeyValue

'WARNING: Playing with the registry can have serious consequences !

' If you don't know what you're doing, I advise you not to delete anything

Const HKEY_CLASSES_ROOT = &H80000000

Const HKEY_CURRENT_USER = &H80000001

Const HKEY_LOCAL_MACHINE = &H80000002

Const REG_NOTIFY_CHANGE_NAME = &H1 ' Create or delete (child)

Const REG_NOTIFY_CHANGE_ATTRIBUTES = &H2

Const REG_NOTIFY_CHANGE_LAST_SET = &H4 ' time stamp

Const REG_NOTIFY_CHANGE_SECURITY = &H8

Const REG_NOTIFY_ALL = (REG_NOTIFY_CHANGE_NAME Or
REG_NOTIFY_CHANGE_ATTRIBUTES Or REG_NOTIFY_CHANGE_LAST_SET Or
REG_NOTIFY_CHANGE_SECURITY)

Private Declare Function RegNotifyChangeKeyValue Lib "advapi32" (ByVal hKey
As Long, ByVal bWatchSubtree As Boolean, ByVal dwNotifyFilter As Long, ByVal
hEvent As Long, ByVal fAsynchronous As Boolean) As Long

Private Sub Form_Load()

'KPD-Team 1999

'URL: http://www.allapi.net/

'E-Mail:

'Create a temporary registry key

SaveSetting "Registry Notification", "Hello", "Testing", "123"

'Call the function .. This will notify us when something changes at
HKEY_CURRENT_USER

RegNotifyChangeKeyValue HKEY_CURRENT_USER, True, REG_NOTIFY_ALL, ByVal 0&,
False

MsgBox "Registry changed"

Unload Me

End Sub



Http://Fox.DesdeGuate.com

"Pietro" escribió en el mensaje
news:
Hola, se me ocurrio hacer un programa que monitorea cierta llave del
registro
de windows. Lo primero que se me ocurrio fue hacer que cada cierto tiempo
se
vea si los valores son iguales al que estaba hace esa X cantidad de
tiempo,
si son iguales que siga el bucle, y si en algun momento los valores no son
iguales que entre en accion un evento (lo que haga el eventoo lo vere
despues, no me complica).
Mis preguntas son:
Hacer que cada cierto tiempo consulte el registro y lo compare con los
valores anteriores haría que el programa fuera algo lento y usaria muchos
recursos? Es el mejor metodo para ir comparando? Conviene usar un timer o
simplemente usar un thread y hacerlo dormir por la cantidad de tiempo que
quiera para que vuelva a consultar¿? Me imagino que si es una llave la que
consulto no deberia haber mucho consumo de recursos pero si consulto
muchas
llaves imagino que si, estoy en lo correcto?
Eso es todo por ahora, ojalá me puedan aclarar un poco este tema, muchas
gracias.
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida