Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 21st, 2003, 11:13 AM
esposito esposito is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 20 esposito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to decrypt password asterisks

Hello, I need help. I am developing a piece of software which, among other things, should contain a function which allows you to decrypt the asterisks used to hide passwords. It should be able to unmask all the passwords visible on the screen.

In order to get this, I placed the following code in a module:

'---START OF VB CODE---
Option Explicit

Public Declare Function EnumChildWindows Lib "User32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function EnumWindows Lib "User32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Public Declare Function ShowWindow Lib "User32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Public Const EM_GETPASSWORDCHAR = &HD2
Public Const EM_SETPASSWORDCHAR = &HCC
Public Const EM_SETMODIFY = &HB9
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5

Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
EnumChildWindows hwnd, AddressOf EnumWindowsProc2, 1
EnumWindowsProc = True
End Function

Public Function EnumWindowsProc2(ByVal hwnd As Long, ByVal lParam As Long) As Long
If SendMessage(hwnd, EM_GETPASSWORDCHAR, 0, 1) Then
UpdateWindow hwnd
End If
EnumWindowsProc2 = True
End Function

Public Sub UpdateWindow(hwnd As Long)
SendMessage hwnd, EM_SETPASSWORDCHAR, 0, 1
SendMessage hwnd, EM_SETMODIFY, True, 1
ShowWindow hwnd, SW_HIDE
ShowWindow hwnd, SW_SHOW
End Sub

Public Function UnmaskPasswords()
EnumWindows AddressOf EnumWindowsProc, 1
End Function
'---END OF VB CODE---

This function seems to work perfectly when used under Windows 95, 98 and Me. To unmask all the asterisks on the screen, just call UnmaskPasswords.

The problem arises when you run the software containing the function above under Windows XP, where the characters used to conceal the passwords are not asterisks but round-shaped bullets. In that case, calling the UnmaskPasswords function produces no results.

Does anybody know how to make the code work with both the asterisks and the bullets?

Thanks in advance.

Pasquale Esposito
Perugia, Italy
http://www.toprete.com/software

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How to decrypt password asterisks


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway