Sixem

.NET Logon Screen Changer/Patcher Class

Aug 3rd, 2013
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.95 KB | None | 0 0
  1. Imports System.IO
  2. Public Class LogonScreen
  3.     'Written By Sixem 03.08.2013
  4.     'This needs admin rights
  5.     Public Shared Title As String = CStr("Logon Screen")
  6.     Public Shared Function Logon_Check()
  7.         Dim LogonOEM As Integer = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", Nothing)
  8.         Return LogonOEM
  9.     End Function
  10.     Public Shared Sub Logon_Patch()
  11.         My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", "1")
  12.         Dim LogonOEM As Integer = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", Nothing)
  13.         If LogonOEM = 1 Then
  14.             MessageBox.Show("Registry Patched!", Title)
  15.         End If
  16.     End Sub
  17.     Public Shared Sub Logon_Unpatch()
  18.         My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", "0")
  19.         Dim LogonOEM As Integer = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", Nothing)
  20.         If LogonOEM = 0 Then
  21.             MessageBox.Show("Registry Unpatched!", Title)
  22.         End If
  23.     End Sub
  24.     Public Shared Sub Logon_Change()
  25.         Dim LogonOEM As Integer = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", Nothing)
  26.         If LogonOEM = 1 Then
  27.             Dim fd As OpenFileDialog = New OpenFileDialog()
  28.             fd.Title = "Choose Image For Background"
  29.             fd.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png"
  30.             fd.InitialDirectory = "C:\"
  31.             fd.FilterIndex = 2
  32.             fd.RestoreDirectory = True
  33.             If fd.ShowDialog() = DialogResult.OK Then
  34.                 Dim File_Handle As New FileInfo(fd.FileName)
  35.                 Dim File_Length As Long = File_Handle.Length
  36.  
  37.                 Dim File_Size_KB As Integer = Math.Round((File_Length / 1024), 0)
  38.  
  39.                 If File_Size_KB > 256 Then
  40.                     MessageBox.Show("That image is too big, it can't be over 256 KB!", Title)
  41.                 Else
  42.                     Dim Background As New Bitmap(fd.FileName)
  43.                     Dim S32 As String = (Environment.GetFolderPath(Environment.SpecialFolder.System)) & "\oobe\Info\backgrounds\"
  44.                     Background.Save(S32 & "backgroundDefault.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
  45.                     MessageBox.Show("Successfully Changed!", Title)
  46.                 End If
  47.             End If
  48.         Else
  49.             MessageBox.Show("Registry needs to be patched first!", Title)
  50.         End If
  51.     End Sub
  52. End Class
Advertisement
Add Comment
Please, Sign In to add comment