Archive: Possible bug in GetServerName macro.


Possible bug in GetServerName macro.
I was trying out the GetServerName macro found here and I think it might be bugged on Windows 98.
It uses the GetComputerNameW to support older operating systems. However, GetComputerNameW is not implemented in 9x/ME and will not work without the support of something like MSLU.

Therefore, I was thinking that the ANSI GetComputerNameA should be used instead of the Unicode GetComputerNameW.

Can anyone confirm that my understanding of this is correct, or am I missing something?

If I am right, would it be appropriate if I updated the wiki appropriately?

Many thanks :)


yeah use the A version


The GetComputerName API call was added in order to provide support for NT4 and not 9x/ME. Besides, the Netapi32 calls used on that Wiki page are not available in 9x/ME ;)
CF


CancerFace:

The function could perhaps be implemented in the following way, to ensure it works on all the systems it used to work on, and works on 9x too.

Currently it is:
sName = GetComputerNameExW // For XP, 2003, etc.
If sName = ""
sName = GetComputerNameW // For NT (4?)

It could be changed to
sName = GetComputerNameExW // For XP, 2003, etc.
If sName = ""
sName = GetComputerNameW // For NT (4?)
If sName = ""
sName = GetComputerNameA // For 9x.

This won't change existing functionality, but will allow 9x machines to use the correct API call (as neither of the 2 previous calls are implemented on 9x machines).

How does that sound?


@banksr0
There is no arguement about what you propose since the macro on the Wiki does not work on 9x/ME machines.

However my point was that the above Wiki page describes user management functions that do not exist in 9x/ME and as such I don't see a point in updating the code on that page.

If you really think that there should be some information on the Wiki about getting the computer name in a 9x/ME system, using API calls, then I suggest to look into this page and add a similar macro/function there.
CF


Ahhhh!!! Sorry - I completely misunderstood you! I see your point and completely agree with it. I hadn't really thought about what the purpose of the page as a whole was, as I wasn't doing any user-management stuff.

Thanks for the pointer - I'll look into the other page :)