XP Autologin
Posted: Wed Sep 13, 2006 9:01 pm
Does anyone have some code that will setup an auto login for xp?
- np
- np
These are both excellent references. Here's what I'm looking to do. IDroopy wrote:http://support.microsoft.com/kb/315231/en-us
That wasn't really a contribution..thefool wrote:i really can't see why you wouldnt be able to do that..
look at the references!
I've done this. But have experienced a major security issue. After I'veDroopy wrote:It's easy with admin rights and purebasic to write to registry. ( write values to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon : DefaultUserName / DefaultPassword / AutoAdminLogon ...
Code: Select all
; KAR Repair Utility
; by (removed)
Declare.s ReadRegKey(OpenKey.l, SubKey.s, ValueName.s)
Declare.l WriteRegKey(OpenKey.l, SubKey.s, KeySet.s, KeyValue.s)
Define.l key1, key2, key3, key4, key5, key6, key7, key8
start.s = InputRequester("KIOSK AUTO-LOGON REPAIR", "Type " + Chr(34) + "yes" + Chr(34) + " to proceed.", "")
If LCase(start) = "yes"
If InitNetwork()
DefaultDomain.s = Hostname()
key1 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "kiosk")
key2 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "")
key3 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomain", DefaultDomain)
key4 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "CachePrimaryDomain", DefaultDomain)
key5 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "1")
key6 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "ForceAutoLogon", "1")
key7 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeCaption", "")
key8 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeText", "")
Else
MessageRequester("HostName Issue ..", "HostName Not Found -- please enter it in the next window.")
DefaultDomain.s = InputRequester("Enter HostName", "i.e. MIAMBKI967391 (don't forget the KI)","")
key1 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "kiosk")
key2 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "")
key3 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomain", DefaultDomain)
key4 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "CachePrimaryDomain", DefaultDomain)
key5 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "1")
key6 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "ForceAutoLogon", "1")
key7 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeCaption", "")
key8 = WriteRegKey(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "LegalNoticeText", "")
EndIf
If key1 And key2 And key3 And key4 And key5 And key6 And key7 And key8
MessageRequester("Success!", "All registry keys were correctly modified.", #MB_ICONINFORMATION)
EndIf
Else
; do nothing
EndIf
MessageRequester("K.A.R. - Kiosk Auto-Logon Repair", "© (removed) International // coded by (removed)")
End
;- Procedures
; read a key from the registry
Procedure.s ReadRegKey(OpenKey.l, SubKey.s, ValueName.s)
hKey.l = 0
KeyValue.s = Space(255)
Datasize.l = 255
If RegOpenKeyEx_(OpenKey, SubKey, 0, #KEY_READ, @hKey)
KeyValue = "Error Opening Key"
Else
If RegQueryValueEx_(hKey, ValueName, 0, 0, @KeyValue, @Datasize)
KeyValue = "Error Reading Key"
Else
KeyValue = Left(KeyValue, Datasize - 1)
EndIf
RegCloseKey_(hKey)
EndIf
ProcedureReturn KeyValue
EndProcedure
;write a key to the registry
Procedure.l WriteRegKey(OpenKey.l, SubKey.s, KeySet.s, KeyValue.s)
hKey.l = 0
If RegCreateKey_(OpenKey, SubKey, @hKey) = 0
Result = 1
Datasize.l = Len(KeyValue)
If RegSetValueEx_(hKey, KeySet, 0, #REG_SZ, @KeyValue, Datasize) = 0
Result = 2
EndIf
RegCloseKey_(hKey)
EndIf
ProcedureReturn Result
EndProcedure