home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Mother of All Windows Books
/
CD-MOM.iso
/
cd_mom
/
newsletr
/
vbz
/
vbz1-3
/
sspw_vb.bas
< prev
next >
Wrap
BASIC Source File
|
1993-06-18
|
2KB
|
76 lines
DefInt A-Z
Global IniPassWord$
Global EnteredCorrectPassword
Declare Sub SetSysModalWindow Lib "User" (ByVal hWnd)
Declare Function FindWindow Lib "User" (Class As Any, Capt As Any)
Sub EncryptString (Source$)
Dim Strg As String
StrgLg = Len(Source$)
If StrgLg = 0 Then Exit Sub
Strg = UCase$(Source$)
'First go forwards
For StrgPt = 0 To StrgLg - 1
TheByte = Asc(Mid$(Strg, StrgPt + 1, 1))
EXor StrgLg, TheByte
If StrgPt = 0 Then
EXor &H2A, TheByte 'Xor first byte with constant
Else
EXor StrgPt, TheByte 'Xor with position
EXor Asc(Mid$(Strg, StrgPt, 1)), TheByte 'Xor with prev char
End If
Mid$(Strg, StrgPt + 1, 1) = Chr$(TheByte)
Next
If StrgLg = 1 Then Exit Sub
'Now go backwards if length > 1
For StrgPt = StrgLg - 1 To 0 Step -1
TheByte = Asc(Mid$(Strg, StrgPt + 1, 1))
EXor StrgLg, TheByte
If StrgPt = StrgLg - 1 Then
EXor &H2A, TheByte
Else
EXor StrgPt, TheByte
EXor Asc(Mid$(Strg, StrgPt + 2, 1)), TheByte
End If
Mid$(Strg, StrgPt + 1, 1) = Chr$(TheByte)
Next
Source$ = Strg
End Sub
Sub EXor (X1, X2)
Temp = (X2 Xor X1)
Select Case Temp
Case &H0 To &H20, &H7F To &H90, &H93 To &H9F, &H3D, &H5B, &H5D
Case Else
X2 = Temp
End Select
End Sub
Function GetSSPassWord ()
Ok = DoEvents()
EnteredCorrectPassword = False
IniPassWord$ = GetIniString$("control.ini", "ScreenSaver", "Password", "")
If Len(IniPassWord$) And FindWindow(ByVal 0&, ByVal "Desktop") = 0 Then
Load frmGetPW
DialogBox frmGetPW
SetSysModalWindow frmGetPW.hWnd
frmGetPW.Show 1
Else
EnteredCorrectPassword = True
End If
GetSSPassWord = EnteredCorrectPassword
TimeToGo = False
End Function
Sub SetSSPassWord ()
Load frmSetPW
DialogBox frmSetPW
frmSetPW.Show 1
End Sub