Re: Issue with GetUserNameExA



After installing the W2K3 administrative tools on your XP client, use the
Users and Computers tool to review the content. You can find the tools
package on any W2K3 CD, or you can download them from the Microsoft web
site.

"Marc" <Marc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:05E1C245-FCB6-4F5C-BBF0-4B4836BBADD5@xxxxxxxxxxxxxxxx
>I am of course relying upon our Network Admin when he tells me that it is
> not. I am not very well versed in that area to make the determination for
> myself. Do you have any ideas as to where I may look to verify whether or
> not it has been setup correctly?
>
> Thanks.
>
> Marc.
>
> "Mark Yudkin" wrote:
>
>> Have you verified that the W2K3 domain's Active Directory hasn't been
>> misconfigured?
>>
>> "Marc" <Marc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:467265B5-7123-4501-8552-6B6ED4827C1A@xxxxxxxxxxxxxxxx
>> >I have a function (see below) that retrieves the currently logged in
>> >Windows
>> > User account (Domain\Username). When executing against a Windows 2000
>> > Domain, it returns exactly what I would expect...Domain\Username.
>> > However,
>> > when I execute the code against/within a Windows Server 2003 Domain,
>> > what
>> > I
>> > have been getting back is Domain\UserFirstName, not the actual Windows
>> > Username. Any ideas on what I may be doing incorrect? Or is there a
>> > change
>> > in the Windows Server 2003 APIs that does not appear to be documented
>> > anywhere?
>> >
>> > Thank you in advance for your assistance.
>> >
>> > Marc.
>> >
>> > Private Declare Function GetUserNameAPI Lib "secur32.dll" Alias
>> > "GetUserNameExA" (ByVal NameFormat As Long, ByVal lpNameBuffer As
>> > String,
>> > nSize As Long) As Long
>> >
>> > Public Function GetWindowsUser() As String
>> > Dim sBuffer As String
>> > Dim lLen As Long
>> >
>> > sBuffer = Space(255 + 1)
>> > lLen = Len(sBuffer)
>> >
>> > If CBool(GetUserNameAPI(2, sBuffer, lLen)) Then
>> > GetWindowsUser = Trim$(Left$(sBuffer, lLen - 1))
>> > Else
>> > GetWindowsUser = ""
>> > End If
>> > End Function
>> >
>>
>>
>>


.



Relevant Pages

  • Re: Folder share with w2k3 and xp - How ? please
    ... --Jonathan Maltz [Microsoft MVP - Windows Server, ... > Recently installed w2k3 server enterprise on my P2-500, patched, ... > 1) Folder sharing problem, I can see shared folder resided on XP, but ... > install it as a generic 'STANDARD 56K' modem, it allows me to d/l at ...
    (microsoft.public.windows.server.networking)
  • Re: W2k3 R2 questions
    ... > From that page, you will see that R2 comes with new features for AD, Disk ... > Microsoft MVP: Windows Server ... Otherwise leave it alone (W2k3 is fine). ... >> most local domain administration. ...
    (microsoft.public.windows.server.general)
  • Re: VB.Net WMI Windows Server 2003
    ... If the code works as expected in XP it should behave correctly in w2k3 also ... I use the Management Base ... > running on a Windows Server 2003 machine I get an error. ... > I am not sure if this problem is specific to running a Windows Service ...
    (microsoft.public.dotnet.languages.vb)
  • Re: VB.Net WMI Windows Server 2003
    ... If the code works as expected in XP it should behave correctly in w2k3 also ... I use the Management Base ... > running on a Windows Server 2003 machine I get an error. ... > I am not sure if this problem is specific to running a Windows Service ...
    (microsoft.public.win32.programmer.wmi)
  • Re: W2k3 R2 questions
    ... >From that page, you will see that R2 comes with new features for AD, Disk ... Microsoft MVP: Windows Server ... Otherwise leave it alone (W2k3 is fine). ... > most local domain administration. ...
    (microsoft.public.windows.server.general)