Windows XP Password character.

Hi,

Dont know if this is the correct forum, but since I didnt get any answers elsewhere, I'm posting it here as well

The Problem:
On some machines, my password field displays the password character as the "dot" - which is XP standard, and on other machines it dispays small square boxes.

Details:
We have written a win32 application in C++ with, in which we have a password field. Inorder to use the XP style of "bulleted" password chars (instead of
'****') in the password field, we have added a manifest and are using
the commctl32.dll version 6.
As a result the passwords _ARE_ seen as "bullets", but as mentioned above, it is not so on all machines.

All our machines have an identical setup- WinXP SP2, dotnet v1.1.4322.
I also ran the xpspcheck.exe, and it generated identical reports on each of them.
Also using spy we found that ALL the ES_xxx / WS_xxx styles of the PW edit fields were same on all the machines.

I read somewhere that this is a font issue, so I wrote a small utility to get the font of the "Password Edit control" based on its handle. On every machine - whether the PWchar is bullet or box - the font turned out to be MS Sans Serif, which is our standard font.

Then just for testing on the problematic machines, we changed the font to Tahoma, and viola - the bullets appeared.

So one of the option we have, is to change our default editcontrol font
to Tahoma, but I would like that to be the last resort.

Question:
Why do some machines display the "bullet" as PW char even if the font is MS Sans
Serif? and Why do others need the font to be Tahoma to achieve the same?

any ideas?

regards
mqsash

[1804 byte] By [mqsash] at [2008-2-25]
# 1

Hi mqsash!

By default, not all font-characters are installed on the OS. It seems that on some machines, the specified character is not installed for the "MS Sans Serif" font.

The used password char is 0x25CF (unicode):
http://www.fileformat.info/info/unicode/char/25CF/index.htm

You can try if this character is available in the MS Sans Serif Font (for example via HTML):
<html>
<head></head>
<body>

<font face="MS Sans Serif">&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;</font>


<font face="Tahoma">&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;</font>


<font face="Symbol">&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;&#x25cf;</font>


</body>

This should display two lines of dots and one line of ?.

You can also set an alternate password char via "EM_SETPASSWORDCHAR".
Greetings
Jochen

JochenKalmbach at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 2

Hi Jochen

The html output displayed in the browser was just as you said it would be.
Two lines of dots, and one line of ?

It was the same (2 lines of dots and a line of ? ) on the machine where the password chars are displayed as bars.

What else should I check?

regards
mqsash

mqsash at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 3
On that machine, where the symbol is not displayed correctly you can try to execute EM_GETPASSWORDCHAR. This will return the character the TextBox is using.

See: EM_GETPASSWORDCHAR
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_getpasswordchar.asp

Then please post the returned value here... it should be 0x25CF...
Greetings
Jochen

JochenKalmbach at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 4
By the way: Does, for example Outlook Express, displays the correct char in the Account-Password-Properties?
JochenKalmbach at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 5
Dont know about outlook express (havent set it up), but other password fields, like in the RunAs, or even the usual Windows login shows the correct password chars.
mqsash at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 6
Then please verify with EM_GETPASSWORDCHAR that the correct char is set!
JochenKalmbach at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 7
The password char is 0x25cf Sad
BUT over the past couple of hours, I have narrowed down the problem source, but now I'm blocked.

Details:
To use the MS Sans Serif font, we are setting the LOGFONT::lfFaceName to "MS Sans Serif" and calling CreateFontIndirect(..).
Now on the problematic machines using the handle of this font puts the vertical bars in the PWedit control.
If we change the LOGFONT::lfFaceName to "Microsoft Sans Serif" (rest all properties remain same), then we get the dots.

NOTE: On the development mahines, the "MS Sans Serif" works fine.

I thought this might be just a matter of the "MS Sans Serif" font file being different on the two machines. So I checked the registry on both machines, and found that both machines had the exact same entries regarding "MS Sans Serif".
Also both machines referred to a "SSERIFE.FON", which _IS_ available on both machines and is identical.

It certainly looks like the problematic machine has some issues with the "MS Sans Serif" font, any clues what I should be checking next?

regards
mqsash

mqsash at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 8
You shouldn′t specify a hard-coded-name in the LOGFONT structure!
The recommented way is to set the "lfPitchAndFamily" and leave the "lfFaceName" NULL! (In your case set it to DEFAULT_PITCH | FF_SWISS)

Or you enumerate the available fonts with EnumFontFamiliesEx and then pass the correct name!
Greetings
Jochen

JochenKalmbach at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 9

1 About not speciying the Font name in the lfFaceName....
Actually the "MS Sans Serif" is a user selected value from the standard windows ChooseFont() dialog, which is presented by our applications "options" menu. So we have to use "MS Sans Serif" in this case.

2. I am not sure about enumerating the fonts to get the correct name, hence I am pasting the code snippet below.
Also inorder to eliminate any possible errors in populating the LOGFONT, I called ChooseFont() to select a font, and used the LOGFONT variable that was filled by the ChooseFont()

CODE Snippet.....
ChooseFont(&cf);
EnumFontFamiliesEx(hDc, cf.lpLogFont, (FONTENUMPROC)MyProc, NULL, 0);
hfontPW = CreateFontIndirect(cf.lpLogFont);
SendMessage(hPWEdit, WM_SETFONT,(WPARAM) hfontPW, true);

int
CALLBACK MyProc( ..... )
{
MessageBox( .... (char*)lpelfe->elfFullName......);
gCount++;
///BTW - What should this func do to get the correct name of the font.
}

Selecting "MS Sans Serif" - regular style - size 8 - script western, from the ChooseFont() resulted in calling the FONTENUMPROC 6 times on the "problematic" as well as the "OK" machines.
For each of the 6 calls, the "lpelfe->elfFullName" returned "MS Sans Serif" on both machines.
But as we know, typing anything in the edit caused vertical bars to appear in the edit control on the "problematic" machine, while the dots appeared on the "OK" machine.


what else should we be checking?

regards
mqsash

mqsash at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 10
Hi Jochen....

Have you given up on this issue?
Could you forward this to someone from the development team?

TIA
mqsash

mqsash at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 11
Sorry, I was out of the office for a couple of days...

The problem is: I cannot repro the problem...
If you can repro it, it would be good if you contact MS support.
But I think they need steps to repro the problem. So start with a clean installed machine and the describe when the problem happens...

Sorry
Jochen Kalmbach

JochenKalmbach at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 12

mqsash@discussions.microsoft.com wrote:

cite="mid6ef98aa7-f1ba-47be-8710-8a382a52b8d2@discussions.microsoft.com"

type="cite">I'll do that, but in the meantime, could you just give the

general reasons why / when the edit controls print vertical bars

instead of the actual character that was typed in?

The reason is obvious:

There is some problem with the character mapping with the specified

font on the machine...

Maybe there is some kind of problem in the registry, where the

character mapping is defined if some characters are not in the font

(also called font-substitution).

-- 

Greetings

Jochen
My blog about Win32 and .NET

http://blog.kalmbachnet.de/

MVPUser at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 13
I'll do that, but in the meantime, could you just give the general reasons why / when the edit controls print vertical bars instead of the actual character that was typed in?
mqsash at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 14
Hi Jochen,

Something additional came up.
All machines where "MS Sans serif" can display the "dot" password char have
files for complex script installed. Whereas all machines where "MS Sans serif" CANNOT display the "dot" password char donot have these files.

I checked on a fresh XP SP2 machine (by default the complex scripts were not installed). So typing the password displayed the vertical bars. then I installed the complex script files from the following..........
>"Control Panel"
>>"Regional and Language Options"
>>>"Languages" tab
>>>>"Supplemental language support" group
>>>>>"Install files for complex script and right-to-left languages (including Thai)"

NOTE: I DID NOT check the second - ie "Install files for East Asian languages" option.

and the problem was fixed. This XP machine also started printing dots in the password field.
A check of the fonts directory revealed 105 new fonts were added. Maybe it is one of these 105 fonts that enable the "dot" password char when using the "MS Sans Serif" font.
NOTE: This installation did not affect the sserife.fon file which is the "MS Sans Serif file"

So If I am right then
"Machines running WinXP SP2, with files for complex script and right-to-left languages (including Thai) installed, have the ability to display the password chars as dots (xp style) even if a non-TT font like MS Sans Serif is used. If these complex scripts are not installed then the characters are displayed as vertical bars"

Now that we know this, is this a bug? or what is the workaround?

regards
mqsash

mqsash at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 15
Hi mqsash -

This web forum is indeed for questions and feedback on the Visual Studio 2005 product prereleases. Have you already tried the public newsgroups (http://msdn.microsoft.com/newsgroups)?

Thanks,
April Reagan, Visual C++ Program Management

AprilReagan at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...