: PWstr = PWstr & Chr((“&H" & Chr(CryptographStr(13)) & Chr(CryptographStr(14))) Xor &HA1)
6: PWstr = PWstr & Chr((“&H" & Chr(CryptographStr(11)) & Chr(CryptographStr(12))) Xor &H69)
5: PWstr = PWstr & Chr((“&H" & Chr(CryptographStr(9)) & Chr(CryptographStr(10))) Xor &H67)
4: PWstr = PWstr & Chr((“&H" & Chr(CryptographStr(7)) & Chr(CryptographStr(8))) Xor &H1D)
3: PWstr = PWstr & Chr((“&H" & Chr(CryptographStr(5)) & Chr(CryptographStr(6))) Xor &H76)
2: PWstr = PWstr & Chr((“&H" & Chr(CryptographStr(3)) & Chr(CryptographStr(4))) Xor &HEE)
1: PWstr = PWstr & Chr((“&H" & Chr(CryptographStr(1)) & Chr(CryptographStr(2))) Xor &H48)
For i = i To 1 Step -1 ''所得PWstr的值为密码的倒序列,将其倒置便得出密码。
PassWord = PassWord & Mid(PWstr, i, 1)
Next i
Text1.Text = PassWord ''在文本框内显示密码。
End Sub
2、模块代码:
Option Explicit
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&
Const ERROR_BADKEY = 1010&
Const REG_EXPAND_SZ = 2&
Const REG_BINARY = 3&
Const KEY_QUERY_VALUE = &H1&
Const KEY_ENUMERATE_SUB_KEYS = &H8&
Const KEY_NOTIFY = &H10&
Const READ_CONTROL = &H20000
Const STANDARD_RIGHTS_READ = READ_CONTROL
Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY
Const HKEY_CURRENT_USER = &H80000001
Dim hKey As Long, MainKeyHandle As Long
Dim rtn As Long, lBuffer As Long, sBuffer As String, SubKey As String
Dim lBufferSize As Long
Declare Function RegOpenKeyEx Lib “advapi32.dll" Alias “RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegCloseKey Lib “advapi32.dll" (ByVal hKey As Long) As Long
Declare Function RegQueryValueEx Lib“advapi32.dll" Alias“Reg QueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
Function GetBinaryValue(Entry As String)
MainKeyHandle = HKEY_CURRENT_USER
SubKey = “Control Panel\desktop\"
rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_READ, hKey)
If rtn = ERROR_SUCCESS Then ''如果HKEY_CURRENT_USER\Control Panel\desktop键被成功打开
lBufferSize = 1
rtn = RegQueryValueEx(hKey, Entry, 0, REG_BINARY, 0, lBufferSize) ''读取ScreenSave_Data的值
sBuffer = Space(lBufferSize)
rtn = RegQueryValueEx(hKey, Entry, 0, REG_BINARY, sBuffer, lBufferSize)
If rtn = ERROR_SUCCESS Then ''如果读取ScreenSave_Data的值成功
rtn = RegCloseKey(hKey)
GetBinaryValue = sBuffer ''函数返回ScreenSave_Data的值
Else ''如果读取ScreenSave_Data的值不成功
Call ErrorMsg
End
End If
Else ''如果HKEY_CURRENT_USER\Control Panel\desktop键不能打开
Call ErrorMsg ''调用ErrorMsg()过程
End
End If
End Function
Private Sub ErrorMsg()