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 ... 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 [812] 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 ... 1254
8111  Sistemas Operativos / Windows / Re: Windows no reconoce el icono asociado a un programa concreto. Cambia pdf por doc en: 23 Octubre 2013, 13:39 pm
@helejagy

Puedes modificar el icono asignado, desde el registro.

En el valor por defecto (default) de la clave:
Código:
HKEY_CLASSES_ROOT\.pdf

Pondrá algo como "pdf file", o "word pdf file" o algo parecido, yo no uso el Word así que la asociación para mi es distinta, me pone un programa distinto.

Bueno, imaginemos que el valor por defecto es "SumatraPDF", pues entonces solo tienes que buscar la clave "SumatraPDF" en la raíz HKEY_CLASSES_ROOT y modificar la ruta del icono del valor "Defaulticon":

Código:
HKEY_CLASSES_ROOT\sumatraPDF\DefaultIcon

Saludos
8112  Programación / Programación General / Re: Folder Size, porque no funciona en Win 7 ? en: 23 Octubre 2013, 11:31 am
@Pédrin-2

La única solución es usar programas de terceros, o pasar el mouse por encima de cada carpeta de forma manual, asi que tu mismo, no busques más donde no hay.

http://superuser.com/questions/490378/does-windows-8-explorer-have-a-foldersize-column-or-restore-the-column-handler

Tanto les cuesta a los de Windows poner algo tan util como ver el tamaño de las carpetas?

Para que Windows (o cualquier programa/shell-extension) pueda conocer el tamaño de una carpeta primero debe procesar todos los archivos de dicha carpeta incluyendo subdirectorios y todos los archivos de dichos subdirectorios que contenga la susodicha carpeta, para sumar el tamaño total de cada archivo.

Si Microsoft ha implementado esa caracteristica al pasar el mouse por una carpeta, pero no ha integrado este atributo en las columnas del Explorer debe ser por algo, no porque no sepan hacerlo (...).

Y una razón muy simple podría ser esta:

¿Ves factible que una shell extension trabaje sin pausa procesando todos los archivos de cada carpeta y de todas sus subcarpetas para mostrate el maldito tamaño de las carpeta, consumiendo así una tasa innecesaria de lectura del HDD y un desgaste de vida del mismo cuando navegas por una carpeta?.

Eso séria un punto muy en contra para el rendimiento del SO/HDD, y no me quiero ni imaginar dicha shell extensión (folder-size) o programas similares de terceros cuando intentas mostrar el tamaño de la carpeta Windows/WinSXS, tanta lectura de archivos constante solo apra mostrar el tamaño, en fín... creo que no vale la pena malgastar así el disco duro y estamos mejor sin extensiones de ese tipo.

Saludos!
8113  Programación / .NET (C#, VB.NET, ASP) / Re: [Duda] Registro con password. en: 23 Octubre 2013, 06:25 am
Hola

1. No te recomiendo usar Shell, dispones de la Class Process para personalizar los parámetros de un nuevo proceso y ejeuctarlo.

2.

Código
  1. ReadOnly DefaultPass As String = "Pudin"
  2. Private UserPass As String = "pudin"
  3.  
  4. If String.Compare(UserPass, DefaultPass, True) = 0 Then
  5.      MsgBox("Contraseña correcta")
  6. End If

3.

Código
  1.    #Region " Get CPU ID "
  2.  
  3.       ' [ Get CPU ID ]
  4.       '
  5.       '// By Elektro H@cker
  6.       '
  7.       ' INSTRUCTIONS:
  8.       ' 1. Add a reference to "System.Management"
  9.       '
  10.       ' Examples :
  11.       ' Dim ProcID As String = Get_CPU_ID()
  12.       ' MsgBox(Get_CPU_ID())
  13.  
  14.    Private Function Get_CPU_ID() As String
  15.  
  16.        Dim wmi As Management.ManagementObjectSearcher = _
  17.            New Management.ManagementObjectSearcher("select * from Win32_Processor")
  18.  
  19.        Dim val As String = wmi.Get(0)("ProcessorID")
  20.  
  21.        wmi.Dispose()
  22.  
  23.        Return val.ToString
  24.  
  25.    End Function
  26.  
  27.    #End Region

Código
  1.    #Region " Get Motherboard ID "
  2.  
  3.       ' [ Get Motherboard ID ]
  4.       '
  5.       '// By Elektro H@cker
  6.       '
  7.       ' INSTRUCTIONS:
  8.       ' 1. Add a reference to "System.Management"
  9.       '
  10.       ' Examples :
  11.       ' Dim MotherID As String = Get_Motherboard_ID()
  12.       ' MsgBox(Get_Motherboard_ID())
  13.  
  14.    Private Function Get_Motherboard_ID() As String
  15.  
  16.        Dim wmi As Management.ManagementObjectSearcher = _
  17.            New Management.ManagementObjectSearcher("select * from Win32_BaseBoard")
  18.  
  19.        Dim val As String = wmi.Get(0)("SerialNumber")
  20.  
  21.        wmi.Dispose()
  22.  
  23.        Return val
  24.  
  25.    End Function
  26.  
  27.    #End Region

Saludos!
8114  Programación / .NET (C#, VB.NET, ASP) / Re: [WPF][ESP] Manual - +350 pgs. en: 23 Octubre 2013, 05:54 am
Añadido a los temas interesantes,
Gracias por compartir.
8115  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 22 Octubre 2013, 19:23 pm
Otra función simple, que devuelve las medidas de la fuente de texto:

Código
  1. #Region " Get Text Measure "
  2.  
  3.    ' [ Get Text Measure ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' MsgBox(Get_Text_Measure("Hello World!", New Font(New FontFamily("Lucida Console"), 12)).Width)  ' Result: 127
  10.    ' MsgBox(Get_Text_Measure("Hello World!", New Font(New FontFamily("Lucida Console"), 12)).Height) ' Result: 16
  11.  
  12.    Private Function Get_Text_Measure(ByVal text As String, ByVal font As Font) As SizeF
  13.        Return TextRenderer.MeasureText(text, font)
  14.    End Function
  15.  
  16. #End Region





Esta función obtiene el texto de una ventana, pasándole como parámetro el handle de dicha ventana:

Código
  1. #Region " Get Window Text "
  2.  
  3.    ' [ Get Window Text ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' Dim str as String = Get_Window_Text(hwnd)
  9.  
  10.    <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True, CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
  11.    Private Shared Function GetWindowText(ByVal hwnd As IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
  12.    End Function
  13.  
  14.    <System.Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True, CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
  15.    Private Shared Function GetWindowTextLength(ByVal hwnd As IntPtr) As Integer
  16.    End Function
  17.  
  18.    Public Function Get_Window_Text(ByVal hWnd As IntPtr) As String
  19.  
  20.        If hWnd = IntPtr.Zero Then : Return Nothing
  21.  
  22.        Else
  23.  
  24.            Dim length As Integer = GetWindowTextLength(hWnd)
  25.  
  26.            If length = 0 Then
  27.                Return Nothing
  28.            End If
  29.  
  30.            Dim sb As New System.Text.StringBuilder("", length)
  31.  
  32.            GetWindowText(hWnd, sb, sb.Capacity + 1)
  33.            Return sb.ToString()
  34.  
  35.        End If
  36.  
  37.    End Function
  38.  
  39. #End Region
8116  Programación / .NET (C#, VB.NET, ASP) / Re: [Duda] Registro con password. en: 22 Octubre 2013, 19:02 pm
Este "ayudante" de operaciones de registro lo escribí hace bastante tiempo, el código necesita un repaso para simplificar un poco más el código, pero se puede usar perféctamente, ahi puedes ver ejemplos para crear claves y obtener el valor.

Saludos

Código
  1. #Region " RegEdit "
  2.  
  3. ' [ RegEdit Functions ]
  4. '
  5. ' // By Elektro H@cker
  6. '
  7. ' Examples :
  8. '
  9. ' -----------
  10. ' Create Key:
  11. ' -----------
  12. ' RegEdit.Create_Key("HKCU\Software\MyProgram")                        ' Creates "HKCU\Software\MyProgram"
  13. ' RegEdit.Create_Key("HKEY_CURRENT_USER\Software\MyProgram\Settings\") ' Creates "HKCU\Software\MyProgram\Settings"
  14. '
  15. ' -----------
  16. ' Delete Key:
  17. ' -----------
  18. ' RegEdit.Delete_Key("HKLM\Software\7-zip")                ' Deletes the "7-zip" tree including subkeys
  19. ' RegEdit.Delete_Key("HKEY_LOCAL_MACHINE\Software\7-zip\") ' Deletes the "7-zip" tree including subkeys
  20. '
  21. ' -------------
  22. ' Delete Value:
  23. ' -------------
  24. ' RegEdit.Delete_Value("HKCU\Software\7-Zip", "Lang")               ' Deletes "Lang" Value
  25. ' RegEdit.Delete_Value("HKEY_CURRENT_USER\Software\7-Zip\", "Lang") ' Deletes "Lang" Value
  26. '
  27. ' ----------
  28. ' Get Value:
  29. ' ----------
  30. ' Dim Data As String = RegEdit.Get_Value("HKCU\Software\MyProgram", "Value name"))
  31. ' Dim Data As String = RegEdit.Get_Value("HKEY_CURRENT_USER\Software\MyProgram", "Value name"))
  32. '
  33. ' ----------
  34. ' Set Value:
  35. ' ----------
  36. ' RegEdit.Set_Value("HKCU\Software\MyProgram", "Value name", "Data", Microsoft.Win32.RegistryValueKind.String)               ' Create/Replace "Value Name" with "Data" as string data
  37. ' RegEdit.Set_Value("HKEY_CURRENT_USER\Software\MyProgram\", "Value name", "Data", Microsoft.Win32.RegistryValueKind.String) ' Create/Replace "Value Name" with "Data" as string data
  38. '
  39. ' -----------
  40. ' Export Key:
  41. ' -----------
  42. ' RegEdit.Export_Key("HKLM", "C:\HKLM.reg")                  ' Export entire "HKEY_LOCAL_MACHINE" Tree to "C:\HKLM.reg" file.
  43. ' RegEdit.Export_Key("HKLM\Software\7-zip\", "C:\7-zip.reg") ' Export entire "7-zip" Tree to "C:\7-zip.reg" file.
  44. '
  45. ' ------------
  46. ' Import File:
  47. ' ------------
  48. ' RegEdit.Import_RegFile("C:\Registry_File.reg") ' Install a registry file.
  49. '
  50. ' ------------
  51. ' Jump To Key:
  52. ' ------------
  53. ' RegEdit.Jump_To_Key("HKLM")                               ' Opens Regedit at "HKEY_LOCAL_MACHINE" Root.
  54. ' RegEdit.Jump_To_Key("HKEY_LOCAL_MACHINE\Software\7-zip\") ' Opens Regedit at "HKEY_LOCAL_MACHINE\Software\7-zip" tree.
  55. '
  56. ' -----------
  57. ' Exist Key?:
  58. ' -----------
  59. ' MsgBox(RegEdit.Exist_Key("HKCU\software") ' Checks if "Software" Key exist.
  60.  
  61. ' -------------
  62. ' Exist Value?:
  63. ' -------------
  64. ' MsgBox(RegEdit.Exist_Value("HKLM\software\7-zip", "Path") ' Checks if "Path" value exist.
  65. '
  66. ' ------------
  67. ' Exist Data?:
  68. ' ------------
  69. ' MsgBox(RegEdit.Exist_Data("HKLM\software\7-zip", "Path") ' Checks if "Path" value have empty data.
  70. '
  71. ' ---------
  72. ' Copy Key:
  73. ' ---------
  74. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", "HKLM", "Software", "7-zip")          ' Copies "HKCU\Software\7-Zip" to "HKLM\Software\7-Zip"
  75. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", Nothing, "Software", "7-zip")         ' Copies "HKCU\Software\7-Zip" to "HKCU\Software\7-Zip"
  76. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", "HKLM", "Software", Nothing)          ' Copies "HKCU\Software\7-Zip" to "HKLM\Software\"
  77. ' RegEdit.Copy_Key("HKCU", "Software", "7-Zip", "HKLM", Nothing, Nothing)             ' Copies "HKCU\Software\7-Zip" to "HKLM\"
  78. ' RegEdit.Copy_Key("HKCU", "\Software\", "\7-Zip\", "HKLM", "\Software\", "\7-zip\")  ' Copies "HKCU\Software\7-Zip" to "HKLM\Software\7-Zip"
  79. '
  80. ' -----------
  81. ' Copy Value:
  82. ' -----------
  83. ' RegEdit.Copy_Value("HKLM\software\7-zip", "path", "HKLM\software\7-zip", "path_backup") ' Copies "Path" value with their data to "HKLM\software\7-zip" "path_backup".
  84. '
  85. ' -------------------
  86. ' Set_UserAccess_Key:
  87. ' -------------------
  88. ' RegEdit.Set_UserAccess_Key("HKCU\Software\7-Zip", {RegEdit.RegUserAccess.Administrators_Full_Access})
  89. ' RegEdit.Set_UserAccess_Key("HKEY_CURRENT_USER\Software\7-Zip", {RegEdit.RegUserAccess.Administrators_Full_Access, RegEdit.RegUserAccess.Creator_Full_Access, RegEdit.RegUserAccess.System_Full_Access})
  90.  
  91. #Region " RegEdit Class "
  92.  
  93. Public Class RegEdit
  94.  
  95.    Private Shared RootKey As Microsoft.Win32.RegistryKey = Nothing
  96.    Private Shared KeyPath As String = String.Empty
  97.  
  98.    ''' <summary>
  99.    ''' Create a new registry key.
  100.    ''' </summary>
  101.    Public Shared Function Create_Key(ByVal RegKey As String) As Boolean
  102.  
  103.        RootKey = Get_Root_Key(RegKey)
  104.        KeyPath = Get_Key_Path(RegKey)
  105.  
  106.        Try
  107.            RootKey.CreateSubKey(KeyPath)
  108.            RootKey.Dispose()
  109.            Return True
  110.        Catch ex As Exception
  111.            ' MsgBox(ex.Message)
  112.            ' Throw New Exception(ex.Message)
  113.            Return False
  114.        End Try
  115.  
  116.    End Function
  117.  
  118.    ''' <summary>
  119.    ''' Delete a registry key.
  120.    ''' </summary>
  121.    Public Shared Function Delete_Key(ByVal RegKey As String) As Boolean
  122.  
  123.        RootKey = Get_Root_Key(RegKey)
  124.        KeyPath = Get_Key_Path(RegKey)
  125.  
  126.        Try
  127.            RootKey.DeleteSubKeyTree(KeyPath)
  128.            RootKey.Dispose()
  129.            Return True
  130.        Catch ex As Exception
  131.            ' MsgBox(ex.Message)
  132.            ' Throw New Exception(ex.Message)
  133.            Return False
  134.        End Try
  135.  
  136.    End Function
  137.  
  138.    ''' <summary>
  139.    ''' Delete a registry key.
  140.    ''' </summary>
  141.    Public Shared Function Delete_Value(ByVal RegKey As String, ByVal RegValue As String) As Boolean
  142.  
  143.        RootKey = Get_Root_Key(RegKey)
  144.        KeyPath = Get_Key_Path(RegKey)
  145.  
  146.        Try
  147.            RootKey.OpenSubKey(KeyPath, True).DeleteValue(RegValue)
  148.            RootKey.Dispose()
  149.            Return True
  150.        Catch ex As Exception
  151.            ' MsgBox(ex.Message)
  152.            ' Throw New Exception(ex.Message)
  153.            Return False
  154.        End Try
  155.  
  156.    End Function
  157.  
  158.    ''' <summary>
  159.    ''' Get the data of a registry value.
  160.    ''' </summary>
  161.    Public Shared Function Get_Value(ByVal RegKey As String, ByVal RegValue As String) As String
  162.  
  163.        RootKey = Get_Root_Key(RegKey)
  164.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  165.        RootKey.Dispose()
  166.  
  167.        Try
  168.            Return My.Computer.Registry.GetValue(KeyPath, RegValue, Nothing)
  169.        Catch ex As Exception
  170.            ' MsgBox(ex.Message)
  171.            ' Throw New Exception(ex.Message)
  172.            Return False
  173.        End Try
  174.    End Function
  175.  
  176.    ''' <summary>
  177.    ''' Set the data of a registry value.
  178.    ''' If the Key or value don't exist it will be created automatically.
  179.    ''' </summary>
  180.    Public Shared Function Set_Value(ByVal RegKey As String, _
  181.                                     ByVal RegValue As String, _
  182.                                     ByVal RegData As String, _
  183.                                     ByVal RegDataType As Microsoft.Win32.RegistryValueKind) As Boolean
  184.  
  185.        RootKey = Get_Root_Key(RegKey)
  186.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  187.  
  188.        Try
  189.            If RegDataType = Microsoft.Win32.RegistryValueKind.Binary Then
  190.                My.Computer.Registry.SetValue(KeyPath, RegValue, System.Text.Encoding.ASCII.GetBytes(RegData), Microsoft.Win32.RegistryValueKind.Binary)
  191.                RootKey.Dispose()
  192.            Else
  193.                My.Computer.Registry.SetValue(KeyPath, RegValue, RegData, RegDataType)
  194.                RootKey.Dispose()
  195.            End If
  196.            Return True
  197.        Catch ex As Exception
  198.            ' MsgBox(ex.Message)
  199.            ' Throw New Exception(ex.Message)
  200.            Return False
  201.        End Try
  202.  
  203.    End Function
  204.  
  205.    ''' <summary>
  206.    ''' Export a registry key (including sub-keys) to a file.
  207.    ''' </summary>
  208.    Public Shared Function Export_Key(ByVal RegKey As String, ByVal OutputFile As String) As Boolean
  209.        Dim RootKey As String = Get_Root_Key(RegKey).ToString
  210.        Dim KeyPath As String = RootKey & "\" & Get_Key_Path(RegKey)
  211.        If KeyPath.EndsWith("\") Then KeyPath = KeyPath.Substring(0, KeyPath.Length - 1)
  212.  
  213.        Try
  214.            Dim Regedit As New Process()
  215.            Dim Regedit_Info As New ProcessStartInfo()
  216.  
  217.            Regedit_Info.FileName = "Reg.exe"
  218.            Regedit_Info.Arguments = "Export " & """" & KeyPath & """" & " " & """" & OutputFile & """" & " /y"
  219.            Regedit_Info.CreateNoWindow = True
  220.            Regedit_Info.WindowStyle = ProcessWindowStyle.Hidden
  221.            Regedit_Info.UseShellExecute = False
  222.            Regedit.StartInfo = Regedit_Info
  223.            Regedit.Start()
  224.            Regedit.WaitForExit()
  225.  
  226.            If Regedit.ExitCode <> 0 Then
  227.                Regedit.Dispose()
  228.                Return False
  229.            Else
  230.                Regedit.Dispose()
  231.                Return True
  232.            End If
  233.  
  234.        Catch ex As Exception
  235.            ' MsgBox(ex.Message)
  236.            ' Throw New Exception(ex.Message)
  237.            Return False
  238.        End Try
  239.  
  240.    End Function
  241.  
  242.    ''' <summary>
  243.    ''' Import a registry file.
  244.    ''' </summary>
  245.    Public Shared Function Import_RegFile(ByVal RegFile As String) As Boolean
  246.  
  247.        If IO.File.Exists(RegFile) Then
  248.  
  249.            Try
  250.                Dim Regedit As New Process()
  251.                Dim Regedit_Info As New ProcessStartInfo()
  252.  
  253.                Regedit_Info.FileName = "Reg.exe"
  254.                Regedit_Info.Arguments = "Import " & """" & RegFile & """"
  255.                Regedit_Info.CreateNoWindow = True
  256.                Regedit_Info.WindowStyle = ProcessWindowStyle.Hidden
  257.                Regedit_Info.UseShellExecute = False
  258.                Regedit.StartInfo = Regedit_Info
  259.                Regedit.Start()
  260.                Regedit.WaitForExit()
  261.  
  262.                If Regedit.ExitCode <> 0 Then
  263.                    Regedit.Dispose()
  264.                    Return False
  265.                Else
  266.                    Regedit.Dispose()
  267.                    Return True
  268.                End If
  269.  
  270.            Catch ex As Exception
  271.                ' MsgBox(ex.Message)
  272.                ' Throw New Exception(ex.Message)
  273.                Return False
  274.            End Try
  275.  
  276.        Else
  277.            ' MsgBox("File don't exist")
  278.            Return False
  279.  
  280.        End If
  281.  
  282.    End Function
  283.  
  284.    ''' <summary>
  285.    ''' Open Regedit at specific key.
  286.    ''' </summary>
  287.    Public Shared Function Jump_To_Key(ByVal RegKey As String) As Boolean
  288.  
  289.        RootKey = Get_Root_Key(RegKey)
  290.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  291.        If KeyPath.EndsWith("\") Then KeyPath = KeyPath.Substring(0, KeyPath.Length - 1)
  292.  
  293.        Try
  294.            Set_Value("HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit", "LastKey", "" & KeyPath & "", Microsoft.Win32.RegistryValueKind.String)
  295.            RootKey.Dispose()
  296.            Process.Start("Regedit.exe")
  297.            Return True
  298.        Catch ex As Exception
  299.            ' MsgBox(ex.Message)
  300.            ' Throw New Exception(ex.Message)
  301.            Return False
  302.        End Try
  303.  
  304.    End Function
  305.  
  306.    ''' <summary>
  307.    ''' Checks if a Key exist.
  308.    ''' </summary>
  309.    Public Shared Function Exist_Key(ByVal RegKey As String) As Boolean
  310.  
  311.        RootKey = Get_Root_Key(RegKey)
  312.        KeyPath = Get_Key_Path(RegKey)
  313.  
  314.        If RootKey Is Nothing OrElse KeyPath Is Nothing Then Return False
  315.  
  316.        If RootKey.OpenSubKey(KeyPath, False) Is Nothing Then
  317.            RootKey.Dispose()
  318.            Return False
  319.        Else
  320.            RootKey.Dispose()
  321.            Return True
  322.        End If
  323.  
  324.    End Function
  325.  
  326.    ''' <summary>
  327.    ''' Checks if a value exist.
  328.    ''' </summary>
  329.    Public Shared Function Exist_Value(ByVal RegKey As String, ByVal RegValue As String) As Boolean
  330.  
  331.        RootKey = Get_Root_Key(RegKey)
  332.        KeyPath = Get_Key_Path(RegKey)
  333.  
  334.        Try
  335.            If RootKey.OpenSubKey(KeyPath, False).GetValue(RegValue) = String.Empty Then
  336.                RootKey.Dispose()
  337.                Return False
  338.            Else
  339.                RootKey.Dispose()
  340.                Return True
  341.            End If
  342.        Catch ex As Exception
  343.            ' MsgBox(ex.Message)
  344.            ' Throw New Exception(ex.Message)
  345.            Return False
  346.        End Try
  347.  
  348.    End Function
  349.  
  350.    ''' <summary>
  351.    ''' Check if a value have empty data.
  352.    ''' </summary>
  353.    Public Shared Function Exist_Data(ByVal RegKey As String, ByVal RegValue As String) As Boolean
  354.  
  355.        RootKey = Get_Root_Key(RegKey)
  356.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  357.  
  358.        Try
  359.            If My.Computer.Registry.GetValue(KeyPath, RegValue, Nothing) = Nothing Then
  360.                RootKey.Dispose()
  361.                Return False
  362.            Else
  363.                RootKey.Dispose()
  364.                Return True
  365.            End If
  366.        Catch ex As Exception
  367.            ' MsgBox(ex.Message)
  368.            ' Throw New Exception(ex.Message)
  369.            Return False
  370.        End Try
  371.  
  372.    End Function
  373.  
  374.    ''' <summary>
  375.    ''' Copy a key tree to another location of the registry.
  376.    ''' </summary>
  377.    Public Shared Function Copy_Key(ByVal OldRootKey As String, _
  378.                        ByVal OldPath As String, _
  379.                        ByVal OldName As String, _
  380.                        ByVal NewRootKey As String, _
  381.                        ByVal NewPath As String, _
  382.                        ByVal NewName As String) As Boolean
  383.  
  384.        If OldPath Is Nothing Then OldPath = ""
  385.        If NewRootKey Is Nothing Then NewRootKey = OldRootKey
  386.        If NewPath Is Nothing Then NewPath = ""
  387.        If NewName Is Nothing Then NewName = ""
  388.  
  389.        If OldRootKey.EndsWith("\") Then OldRootKey = OldRootKey.Substring(0, OldRootKey.Length - 1)
  390.        If NewRootKey.EndsWith("\") Then NewRootKey = NewRootKey.Substring(0, NewRootKey.Length - 1)
  391.  
  392.        If OldPath.StartsWith("\") Then OldPath = OldPath.Substring(1, OldPath.Length - 1)
  393.        If OldPath.EndsWith("\") Then OldPath = OldPath.Substring(0, OldPath.Length - 1)
  394.        If NewPath.StartsWith("\") Then NewPath = NewPath.Substring(1, NewPath.Length - 1)
  395.        If NewPath.EndsWith("\") Then NewPath = NewPath.Substring(0, NewPath.Length - 1)
  396.  
  397.        If OldName.StartsWith("\") Then OldName = OldName.Substring(1, OldName.Length - 1)
  398.        If OldName.EndsWith("\") Then OldName = OldName.Substring(0, OldName.Length - 1)
  399.        If NewName.StartsWith("\") Then NewName = NewName.Substring(1, NewName.Length - 1)
  400.        If NewName.EndsWith("\") Then NewName = NewName.Substring(0, NewName.Length - 1)
  401.  
  402.        Dim OrigRootKey As Microsoft.Win32.RegistryKey = Get_Root_Key(OldRootKey)
  403.        Dim DestRootKey As Microsoft.Win32.RegistryKey = Get_Root_Key(NewRootKey)
  404.  
  405.        Dim oldkey As Microsoft.Win32.RegistryKey = OrigRootKey.OpenSubKey(OldPath + "\" + OldName, True)
  406.        Dim newkey As Microsoft.Win32.RegistryKey = DestRootKey.OpenSubKey(NewPath, True).CreateSubKey(NewName)
  407.        Reg_Copy_SubKeys(oldkey, newkey)
  408.        Return True
  409.  
  410.    End Function
  411.    Private Shared Sub Reg_Copy_SubKeys(OrigKey As Microsoft.Win32.RegistryKey, DestKey As Microsoft.Win32.RegistryKey)
  412.  
  413.        Dim ValueNames As String() = OrigKey.GetValueNames()
  414.        Dim SubKeyNames As String() = OrigKey.GetSubKeyNames()
  415.  
  416.        For i As Integer = 0 To ValueNames.Length - 1
  417.            Application.DoEvents()
  418.            DestKey.SetValue(ValueNames(i), OrigKey.GetValue(ValueNames(i)))
  419.        Next
  420.  
  421.        For i As Integer = 0 To SubKeyNames.Length - 1
  422.            Application.DoEvents()
  423.            Reg_Copy_SubKeys(OrigKey.OpenSubKey(SubKeyNames(i), True), DestKey.CreateSubKey(SubKeyNames(i)))
  424.        Next
  425.  
  426.    End Sub
  427.  
  428.    ''' <summary>
  429.    ''' Copy a value with their data to another location of the registry.
  430.    ''' If the Key don't exist it will be created automatically.
  431.    ''' </summary>
  432.    Public Shared Function Copy_Value(ByVal RegKey As String, ByVal RegValue As String, _
  433.                                      ByVal NewRegKey As String, ByVal NewRegValue As String) As Boolean
  434.  
  435.        Dim OldRootKey As String = Get_Root_Key(RegKey).ToString
  436.        Dim OldKeyPath As String = OldRootKey & "\" & Get_Key_Path(RegKey)
  437.  
  438.        Dim NewRootKey As String = Get_Root_Key(NewRegKey).ToString
  439.        Dim NewKeyPath As String = NewRootKey & "\" & Get_Key_Path(NewRegKey)
  440.  
  441.        Dim RegData = Get_Value(OldKeyPath, RegValue)
  442.  
  443.        Try
  444.            Set_Value(NewKeyPath, NewRegValue, RegData, Microsoft.Win32.RegistryValueKind.Unknown)
  445.            Return True
  446.        Catch ex As Exception
  447.            ' MsgBox(ex.Message)
  448.            ' Throw New Exception(ex.Message)
  449.            Return False
  450.        End Try
  451.  
  452.    End Function
  453.  
  454.    ''' <summary>
  455.    ''' Valid User identifiers for Regini.exe command.
  456.    ''' </summary>
  457.    Public Enum RegUserAccess As Short
  458.        Administrators_Full_Access = 1
  459.        Administrators_Read_Access = 2
  460.        Administrators_Read_and_Write_Access = 3
  461.        Administrators_Read_Write_and_Delete_Access4
  462.        Administrators_Read_Write_and_Execute_Access = 20
  463.        Creator_Full_Access = 5
  464.        Creator_Read_and_Write_Access = 6
  465.        Interactive_User_Full_Access = 21
  466.        Interactive_User_Read_and_Write_Access = 22
  467.        Interactive_User_Read_Write_and_Delete_Access = 23
  468.        Power_Users_Full_Access = 11
  469.        Power_Users_Read_and_Write_Access = 12
  470.        Power_Users_Read_Write_and_Delete_Access = 13
  471.        System_Full_Access = 17
  472.        System_Operators_Full_Access = 14
  473.        System_Operators_Read_and_Write_Access = 15
  474.        System_Operators_Read_Write_and_Delete_Access = 16
  475.        System_Read_Access = 19
  476.        System_Read_and_Write_Access = 18
  477.        World_Full_Access = 7
  478.        World_Read_Access = 8
  479.        World_Read_and_Write_Access = 9
  480.        World_Read_Write_and_Delete_Access = 10
  481.    End Enum
  482.  
  483.    ''' <summary>
  484.    ''' Modify the User permissions of a registry key.
  485.    ''' </summary>
  486.    Public Shared Function Set_UserAccess_Key(ByVal RegKey As String, ByVal RegUserAccess() As RegUserAccess) As Boolean
  487.  
  488.        Dim PermissionString As String = String.Empty
  489.        RootKey = Get_Root_Key(RegKey)
  490.  
  491.        KeyPath = RootKey.ToString & "\" & Get_Key_Path(RegKey)
  492.        If KeyPath.EndsWith("\") Then KeyPath = KeyPath.Substring(0, KeyPath.Length - 1)
  493.  
  494.        For Each user In RegUserAccess
  495.            ' Application.DoEvents()
  496.            PermissionString += " " & user
  497.        Next
  498.  
  499.        PermissionString = "[" & PermissionString & "]"
  500.        PermissionString = PermissionString.Replace("[ ", "[")
  501.  
  502.        Try
  503.  
  504.            Using TextFile As New IO.StreamWriter(System.IO.Path.GetTempPath() & "Regini.ini", False, System.Text.Encoding.Default)
  505.                TextFile.WriteLine("""" & KeyPath & """" & " " & PermissionString)
  506.            End Using
  507.  
  508.            Dim Regini As New Process()
  509.            Dim Regini_Info As New ProcessStartInfo()
  510.  
  511.            Regini_Info.FileName = "Regini.exe"
  512.            Regini_Info.Arguments = """" & System.IO.Path.GetTempPath() & "Regini.ini" & """"
  513.            Regini_Info.CreateNoWindow = True
  514.            Regini_Info.WindowStyle = ProcessWindowStyle.Hidden
  515.            Regini_Info.UseShellExecute = False
  516.            Regini.StartInfo = Regini_Info
  517.            Regini.Start()
  518.            Regini.WaitForExit()
  519.  
  520.            If Regini.ExitCode <> 0 Then
  521.                RootKey.Dispose()
  522.                Regini.Dispose()
  523.                Return False
  524.            Else
  525.                RootKey.Dispose()
  526.                Regini.Dispose()
  527.                Return True
  528.            End If
  529.  
  530.        Catch ex As Exception
  531.            ' MsgBox(ex.Message)
  532.            ' Throw New Exception(ex.Message)
  533.            Return False
  534.        End Try
  535.  
  536.    End Function
  537.  
  538.    ' Returns the RootKey formatted
  539.    Private Shared Function Get_Root_Key(ByVal RegKey As String) As Microsoft.Win32.RegistryKey
  540.        Select Case RegKey.ToUpper.Split("\").First
  541.            Case "HKCR", "HKEY_CLASSES_ROOT" : Return Microsoft.Win32.Registry.ClassesRoot
  542.            Case "HKCC", "HKEY_CURRENT_CONFIG" : Return Microsoft.Win32.Registry.CurrentConfig
  543.            Case "HKCU", "HKEY_CURRENT_USER" : Return Microsoft.Win32.Registry.CurrentUser
  544.            Case "HKLM", "HKEY_LOCAL_MACHINE" : Return Microsoft.Win32.Registry.LocalMachine
  545.            Case "HKEY_PERFORMANCE_DATA" : Return Microsoft.Win32.Registry.PerformanceData
  546.            Case Else : Return Nothing
  547.        End Select
  548.    End Function
  549.  
  550.    ' Returns the KeyPath formatted
  551.    Private Shared Function Get_Key_Path(ByVal RegKey As String) As String
  552.  
  553.        If RegKey Is Nothing Then Return Nothing
  554.  
  555.        Dim Path As String = String.Empty
  556.        For i As Integer = 1 To RegKey.Split("\").Length - 1
  557.            ' Application.DoEvents()
  558.            Path &= RegKey.Split("\")(i) & "\"
  559.        Next
  560.  
  561.        If Not Path.Contains("\") Then Path = Path & "\"
  562.        Path = Path.Substring(0, Path.LastIndexOf("\"))
  563.  
  564.        Return Path
  565.  
  566.    End Function
  567.  
  568. End Class
  569.  
  570. #End Region
  571.  
  572. #End Region
8117  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 22 Octubre 2013, 16:13 pm
Unas sencillas funciones para convertir pluma/brocha a color, y viceversa.

Código
  1. #Region " Color To Pen "
  2.  
  3.    ' [ Color To Pen ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Color_To_Pen(Color.Red).Color.Name) ' Result: Red
  9.  
  10.    Private Function Color_To_Pen(ByVal color As Color) As Pen
  11.  
  12.        Dim _pen As Pen = Nothing
  13.  
  14.        Try
  15.            _pen = New Pen(color)
  16.            Return _pen
  17.  
  18.        Catch ex As Exception
  19.            Throw New Exception(ex.Message)
  20.            Return Nothing
  21.  
  22.        Finally
  23.            If _pen IsNot Nothing Then _pen.Dispose()
  24.  
  25.        End Try
  26.  
  27.    End Function
  28.  
  29. #End Region

Código
  1. #Region " Color To SolidBrush "
  2.  
  3.    ' [ Color To SolidBrush ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Color_To_SolidBrush(Color.Red).Color.Name) ' Result: Red
  9.  
  10.    Private Function Color_To_SolidBrush(ByVal color As Color) As SolidBrush
  11.  
  12.        Dim _brush As SolidBrush = Nothing
  13.  
  14.        Try
  15.            _brush = New SolidBrush(color)
  16.            Return _brush
  17.  
  18.        Catch ex As Exception
  19.            Throw New Exception(ex.Message)
  20.            Return Nothing
  21.  
  22.        Finally
  23.            If _brush IsNot Nothing Then _brush.Dispose()
  24.  
  25.        End Try
  26.  
  27.    End Function
  28.  
  29. #End Region

Código
  1. #Region " Pen To Color "
  2.  
  3.    ' [ Pen To Color ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Pen_To_Color(New Pen(Color.Red)).Name) ' Result: Red
  9.  
  10.    Private Function Pen_To_Color(ByVal pen As Pen) As Color
  11.        Return pen.Color
  12.    End Function
  13.  
  14. #End Region

Código
  1. #Region " SolidBrush To Color "
  2.  
  3.    ' [ SolidBrush To Color ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(SolidBrush_To_Color(New SolidBrush(Color.Red)).Name) ' Result: Red
  9.  
  10.    Private Function SolidBrush_To_Color(ByVal brush As SolidBrush) As Color
  11.        Return brush.Color
  12.    End Function
  13.  
  14. #End Region





Y otra sencilla función para parsear un valor de una enumeración:

Código
  1.    #Region " Enum Parser "
  2.  
  3.       ' [ Enum Parser ]
  4.       '
  5.       ' // By Elektro H@cker
  6.       '
  7.       ' Examples :
  8.       '
  9.       ' MsgBox(Enum_Parser(Of Keys)(65).ToString) ' Result: A
  10.       ' MsgBox(Enum_Parser(Of Keys)("A").ToString) ' Result: A
  11.       ' TextBox1.BackColor = Color.FromKnownColor(Enum_Parser(Of KnownColor)("Red"))
  12.  
  13.    Private Function Enum_Parser(Of T)(Value As Object) As T
  14.  
  15.        Try
  16.            Return [Enum].Parse(GetType(T), Value, True)
  17.  
  18.        Catch ex As ArgumentException
  19.            Throw New Exception("Enum value not found")
  20.  
  21.        Catch ex As Exception
  22.            Throw New Exception(String.Format("{0}: {1}}", _
  23.                                ex.Message, ex.StackTrace))
  24.  
  25.        End Try
  26.  
  27.    End Function
  28.  
  29.    #End Region
8118  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Ataque al foro? en: 22 Octubre 2013, 16:11 pm
Ahora ya vuelve a funcionar (http), por lo menos a mi...
8119  Programación / .NET (C#, VB.NET, ASP) / Re: Proyecto GamesRec 8 meses despues [Dev version,prox Alpha1] en: 22 Octubre 2013, 16:05 pm
He crackeado algunos programas hechos con .NET. Entre ellos, uno cifrado con Crypto

Perdón si meto la pata pero no te habrás confundido con el "SmartAssembly" (que también es de los mejores) en lugar del "Crypto"?

Lo comento porque hasta donde yo sé el SAE no tiene plugin para deofuscar un ensamblado de Crypto, o al menos no disponen de dicho plugin en la página oficial, pero de todas formas no he intentado deofuscar un exe del Crypto en el SAE.

PD: Si dispones de dicho plugin o sabes de alguna página donde lo hosteen estaría muy bien que compartas esa información.

Un saludo!
8120  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Ataque al foro? en: 22 Octubre 2013, 15:52 pm
Para dejar constancia, yo accedo desde España (Valencia), y uso ONO.

El resto de páginas me funcionan perféctamente menos el foro de EHN  :-(

Se puede decir que la página ya lleva medio dia tirando a duras penas, es insoportable, creo que hasta la noche ya no volveré a conectarme para ver si se ha resuelto el problema.

Saludos!
Páginas: 1 ... 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 [812] 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 ... 1254
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines