[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Windows API, GetUserName is different with a Win2000 domain?

Posted on 2002-05-29
6
Medium Priority
?
576 Views
Last Modified: 2013-12-03
Hi,

I have a piece of software that uses the GetUserName API function to get the user name of the logged in user and then does a case-sensitive match against a field in a database.  When our customer had their NT 4.0 domain this worked fine with both NT and 2000 clients.  The function returned the user name as stored in User Manager, rather than what they typed (as the NT login is NOT case-sensitive).

Since moving to a Windows 2000 domain, the GetUserName function appears to return exactly what they typed, rather than what is entered in User Manager, and the lookup against our database is now failing.

Is this by design, and is there a workaround for it (other than making my software force the name returned to upper or lower case!)

Thanks for any help you can offer,
Neil.
0
Comment
Question by:nplumridge
[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
6 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 7041685
why are you doing a case-sesitive match on data that is case-in-sensitive. nt usernames are not case sensitive so why treat them as though they are.......
0
 

Author Comment

by:nplumridge
ID: 7041720
The name returned by GetUserName with an NT 4.0 doamin matched what was in User Manager, including the case.  With the Windows 2000 domain it just returns whatever you type on the login dialog, with whatever case you type it in.  I might just as well grab the USERNAME environment variable now.

I know I can just make the search case-insensitive, but I would like to know what has changed and why!
0
 
LVL 12

Accepted Solution

by:
pjknibbs earned 400 total points
ID: 7043828
It's impossible to say why this change was made. You have to bear in mind that Windows 2000 is not just a modification to NT 4--it's pretty much a ground-up rewrite (I've seen estimates that put the amount of rewritten and new code at over 80%), so it's entirely possible this works differently because it was written by a different programmer who decided to implement it in a different way.

In any case, I agree with makerp--even if the NT 4 GetUserName() returned a case-sensitive result, the actual check for a valid logon certainly doesn't take the case of the username into account, so there was never any point in doing a case-sensitive comparison in the first place.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

649 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