?
Solved

API to get the screen saver password?

Posted on 1998-10-01
3
Medium Priority
?
207 Views
Last Modified: 2010-04-30
Is there an API to retrieve the password of the screen saver?

Pls show how..
thanks
0
Comment
Question by:fury
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
waty earned 200 total points
ID: 1437766
No, but here are some functions to verify if the given password is correct.

' #VBIDEUtils#************************************************************
' * Programmer Name  : Waty Thierry
' * Web Site         : www.geocities.com/ResearchTriangle/6311/
' * E-Mail           : waty.thierry@usa.net
' * Date             : 1/10/98
' * Time             : 10:05
' * Module Name      : Password_Module
' * Module Filename  : Password.bas
' **********************************************************************
' * Comments         : Change/Verify the logon password
' *
' *
' **********************************************************************

Option Explicit

' *** Get the O/S Version
Private Declare Function GetVersionEx& Lib "kernel32" Alias "GetVersionExA" (lpStruct As OsVersionInfo)
Private OsVers As OsVersionInfo
Private Type OsVersionInfo
   dwVersionInfoSize As Long
   dwMajorVersion As Long
   dwMinorVersion As Long
   dwBuildNumber As Long
   dwPlatform As Long
   szCSDVersion As String * 128
End Type
Private CurrOS As String

' *** NT password setup info
Private Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long
Private Declare Function NetGetDCName Lib "NETAPI32.DLL" (ServerName As Byte, DomainName As Byte, DCName As Long) As Long
Private Declare Function PtrToStr Lib "kernel32" Alias "lstrcpyW" (RetVal As Byte, ByVal Ptr As Long) As Long
Private Declare Function NetAPIBufferFree Lib "NETAPI32.DLL" Alias "NetApiBufferFree" (ByVal Ptr As Long) As Long

' *** Password stuff
Private Declare Function PwdChangePassword& Lib "mpr" Alias "PwdChangePasswordA" (ByVal lpcRegkeyname$, ByVal hWnd&, ByVal uiReserved1&, ByVal uiReserved2&)
Private Declare Function WNetVerifyPassword Lib "mpr.dll" Alias "WNetVerifyPasswordA" (ByVal lpszPassword As String, ByRef pfMatch As Long) As Long
Private Declare Function NetUserChangePassword Lib "NETAPI32.DLL" (DomainName As Byte, Username As Byte, OldPassword As Byte, NewPassword As Byte) As Long

Public Sub Change_ScreenSaverPassword95(frm As Form)
   
   Dim pwlong As Long
   If GetVersion32() <> "95" Then
      Exit Sub
   End If
   pwlong = PwdChangePassword("SCRSAVE", frm.hWnd, 0, 0)
   
End Sub

Public Sub Change_LogonPassword95(frm As Form)
   
   Dim pwlong As Long
   If GetVersion32() <> "95" Then
      MsgBox "Can't do this call on " & CurrOS
      Exit Sub
   End If
   pwlong = PwdChangePassword(vbNullString, frm.hWnd, 0, 0)
   
End Sub

Public Function GetVersion32() As String
   ' Call to get the 32 Bit O/S ID. Returned values are either "95" or "NT" or "Unknown"
   ' Example - MyString = GetVersion32
   '
   
   OsVers.dwVersionInfoSize = 148&
   GetVersionEx OsVers
   If OsVers.dwPlatform = 1& Then
      GetVersion32 = "95"
   ElseIf OsVers.dwPlatform = 2& Then
      GetVersion32 = "NT"
   Else
      GetVersion32 = "Unknown"
   End If
   
End Function

Public Function Verify_LogonPassword95(sPWD As String) As Boolean
   
   Dim pwlong, Res As Long
   If CurrOS <> "95" Then
      MsgBox "Can't do this call on " & CurrOS
      Exit Function
   End If
   
   ' *** User must type current password in text box for this to work
   pwlong = WNetVerifyPassword(sPWD, Res)
   If Res <> 0 Then
      Verify_LogonPassword95 = True
   Else
      Verify_LogonPassword95 = False
   End If

End Function

Private Sub Change_LogonPasswordNT(sOldPWD As String, sNewPWD As String)
   
   Dim pwlong, Res As Long
   Dim DC, User, S1 As String
   Dim bPDCName() As Byte
   Dim bUserName() As Byte
   Dim bOldPW() As Byte
   Dim bNewPW() As Byte
   
   If CurrOS <> "NT" Then
      MsgBox "Can't do this call on " & CurrOS
      Exit Sub
   End If
   
   ' *** Get the primary domain controller name
   DC = GetPrimaryDCName("", "")
   DC = Left(DC, (InStr(1, DC, Chr(0), vbBinaryCompare) - 1))
   
   ' *** Get the current user name
   S1 = Space(512)
   WNetGetUser vbNullString, S1, Len(S1)
   User = Left(S1, (InStr(1, S1, Chr(0), vbBinaryCompare) - 1))
   
   bPDCName = DC & vbNullChar
   bUserName = User & vbNullChar
   bOldPW = sOldPWD & vbNullChar
   bNewPW = sNewPWD & vbNullChar
   pwlong = NetUserChangePassword(bPDCName(0), bUserName(0), bOldPW(0), bNewPW(0))

End Sub

Private Function GetPrimaryDCName(ByVal MName As String, ByVal DName As String) As String
   
   Dim DCName As String, DCNPtr As Long
   Dim DNArray() As Byte
   Dim MNArray() As Byte
   Dim DCNArray(100) As Byte
   Dim Result As Long
   MNArray = MName & vbNullChar
   DNArray = DName & vbNullChar
   Result = NetGetDCName(MNArray(0), DNArray(0), DCNPtr)
   If Result <> 0 Then
      MsgBox "Error: " & Result
      Exit Function
   End If
   Result = PtrToStr(DCNArray(0), DCNPtr)
   Result = NetAPIBufferFree(DCNPtr)
   DCName = DCNArray()
   GetPrimaryDCName = DCName
   
End Function

0
 

Author Comment

by:fury
ID: 1437767
Long answer...thanks...but I just want to know the password....
so that if users forget the password of my screensaver.......I can remind them...actually..the boss requested that...
0
 
LVL 14

Expert Comment

by:waty
ID: 1437768
The password of a screen saver es basically the same as the Logon password of Windows (except if you have written the
SSaver and stored the pwd).

If the use has lost his password, he needs to change the pwd of windows.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question