Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: Karcrack en 12 Agosto 2010, 23:55 pm



Título: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Karcrack en 12 Agosto 2010, 23:55 pm
Código
  1. 'KERNEL32
  2. Private Declare Function CreateSemaphoreW Lib "KERNEL32" (ByVal lpSemaphoreAttributes As Long, ByVal lInitialCount As Long, ByVal lMaximumCount As Long, ByVal lpName As Long) As Long
  3.  
  4. '---------------------------------------------------------------------------------------
  5. ' Procedure : DisableMsConfig
  6. ' Author    : Karcrack
  7. ' Date      : 12/08/2010
  8. '---------------------------------------------------------------------------------------
  9. '
  10. Public Function DisableMsConfig() As Boolean
  11.    Call CreateSemaphoreW(0, 0, 1, StrPtr("MSConfigRunning"))
  12.    DisableMsConfig = (Err.LastDllError = 0)
  13. End Function

Bien cortito y funcional, ejecuta el codigo e intenta abrir el msconfig.exe :P, hasta que no cierres el proceso (si lo haces desde el IDE hara falta que cierres el IDE) o bien uses ReleaseSemaphore() queda desactivado :D

Ale, a divertirse! :P


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Mi4night en 13 Agosto 2010, 00:23 am
Hey great stuff karcrack like usually!

One question what does CreateSemaphoreW  ectually do?


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: aaronduran2 en 13 Agosto 2010, 09:45 am
Testeado en W7 Ultimate, funciona perfectamente ;-)

Como siempre códigos geniales ;)


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Karcrack en 13 Agosto 2010, 21:58 pm
Hey great stuff karcrack like usually!

One question what does CreateSemaphoreW  ectually do?
Works like CreateMutex moreover...


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Miseryk en 15 Agosto 2010, 05:17 am
Código
  1. 'KERNEL32
  2. Private Declare Function CreateSemaphoreW Lib "KERNEL32" (ByVal lpSemaphoreAttributes As Long, ByVal lInitialCount As Long, ByVal lMaximumCount As Long, ByVal lpName As Long) As Long
  3.  
  4. '---------------------------------------------------------------------------------------
  5. ' Procedure : DisableMsConfig
  6. ' Author    : Karcrack
  7. ' Date      : 12/08/2010
  8. '---------------------------------------------------------------------------------------
  9. '
  10. Public Function DisableMsConfig() As Boolean
  11.    Call CreateSemaphoreW(0, 0, 1, StrPtr("MSConfigRunning"))
  12.    DisableMsConfig = (Err.LastDllError = 0)
  13. End Function

Bien cortito y funcional, ejecuta el codigo e intenta abrir el msconfig.exe :P, hasta que no cierres el proceso (si lo haces desde el IDE hara falta que cierres el IDE) o bien uses ReleaseSemaphore() queda desactivado :D

Ale, a divertirse! :P

Como implemento el ReleaseSemaphore()?, lo puse sin parametros y no pasa nada, tengo que cerrar el proyecto.


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Karcrack en 15 Agosto 2010, 12:42 pm
Tienes que almacenar el valor que devuelve CreateSemaphore() y mas tarde pasarselo a ReleaseMutex()


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Miseryk en 15 Agosto 2010, 13:31 pm
Código
  1. Option Explicit
  2.  
  3. 'KERNEL32
  4. Private Declare Function CreateSemaphoreW Lib "kernel32" (ByVal lpSemaphoreAttributes As Long, ByVal lInitialCount As Long, ByVal lMaximumCount As Long, ByVal lpName As Long) As Long
  5. Private Declare Function ReleaseMutex Lib "kernel32" (ByVal hMutex As Long) As Long
  6.  
  7. Dim Mutex As Long
  8.  
  9. '---------------------------------------------------------------------------------------
  10. ' Procedure : DisableMsConfig
  11. ' Author    : Karcrack
  12. ' Date      : 12/08/2010
  13. '---------------------------------------------------------------------------------------
  14. '
  15. Public Function DisableMsConfig() As Boolean
  16. Mutex = CreateSemaphoreW(0, 0, 1, StrPtr("MSConfigRunning"))
  17. DisableMsConfig = (Err.LastDllError = 0)
  18. End Function
  19.  
  20. Private Sub Command1_Click()
  21. Call ReleaseMutex(Mutex)
  22. End Sub
  23.  
  24. Private Sub Form_Load()
  25. Call DisableMsConfig
  26. End Sub
  27.  
  28.  

Lo hice asi, pero no funciona :(, estoy haciendo algo mal? :(


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: wh0! en 15 Agosto 2010, 17:06 pm
Minimalista!  :laugh:
jajaja, Todo un capo.  ;-)


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Karcrack en 15 Agosto 2010, 22:48 pm
Perdon, me equivoque al escribir, la funcion es ReleaseSemaphore() , de todas formas hay que hacerlo con CloseHandle() :xD:xD :xD :xD

Aqui tienes un codigo:
Código
  1. Option Explicit
  2.  
  3. 'KERNEL32
  4. Private Declare Function CreateSemaphoreW Lib "KERNEL32" (ByVal lpSemaphoreAttributes As Long, ByVal lInitialCount As Long, ByVal lMaximumCount As Long, ByVal lpName As Long) As Long
  5. Private Declare Function CloseHandle Lib "KERNEL32" (ByVal hObject As Long) As Long
  6.  
  7. Public Static Function DisableMsConfig(Optional ByVal bReEnable As Boolean = False) As Boolean
  8.    Dim hSem        As Long
  9.  
  10.    If bReEnable = True And hSem <> 0 Then
  11.        DisableMsConfig = (CloseHandle(hSem) <> 0)
  12.    Else
  13.        hSem = CreateSemaphoreW(0, 0, 1, StrPtr("MSConfigRunning"))
  14.        DisableMsConfig = (Err.LastDllError = 0)
  15.    End If
  16. End Function
  17.  
  18. Private Sub Form_Load()
  19.    Call DisableMsConfig(False)
  20.    MsgBox "Cuando le des a Aceptar se reactivara MsConfig.exe"
  21.    Call DisableMsConfig(True)
  22.    End
  23. End Sub


Título: Re: [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe
Publicado por: Miseryk en 16 Agosto 2010, 07:49 am
Wow, genial, muchas gracias, ah, también lo había probado con ReleaseSemaphore(), :D  ;-) ;-)