The registry api's (regopenkey, regclosekey, regqueryvalueex etc.) will work under nt, but expect some differences in the location the values are stored. Several keynames are different.
To get the username, use the GetUserName API.
Code:
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Command1_Click()
Dim sUserName As String
Dim retVal As Long
Dim lSize As Long
lSize = 255
sUserName = Space(lSize + 1)
retVal = GetUserName(sUserName, lSize)
sUserName = Left(sUserName, lSize)
MsgBox sUserName
End Sub
Forget about the password. There is no way to get this.(unless you are specialised in hacking c2 level security)