Getting Environment Variables on Windows 2000?!?

Windows specific forum
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Getting Environment Variables on Windows 2000?!?

Post by techjunkie »

Arghhh! :cry:

I have problems with GetEnvironmentVariable_ on Windows 2000. It works ok on XP, but on W2K it generates an error "ModName: ntdll.dll".

I've also tried Droopy's lib, but the same there - works on XP, not on W2K.... :(

Any suggestions?
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

That is really strange.

You've tried restoring/fixing kernel32.dll and ntdll.dll?

ntdll is their native api (not-so-secret advantage) dll is it not? I thought it had to be there.

Although the SDK mentions Win2000 Professional and not Win2000 "non-professional" (is there such a thing?).
GetEnvironmentVariable wrote:Client Requires Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header Declared in Winbase.h; include Windows.h.

Library Link to Kernel32.lib.

DLL Requires Kernel32.dll.
Unicode Implemented as GetEnvironmentStringsW (Unicode) and GetEnvironmentStringsA (ANSI). Note that Unicode support on Windows Me/98/95 requires Microsoft Layer for Unicode.
@}--`--,-- A rose by any other name ..
Straker
Enthusiast
Enthusiast
Posts: 701
Joined: Wed Apr 13, 2005 10:45 pm
Location: Idaho, USA

Post by Straker »

Dare2 wrote:Although the SDK mentions Win2000 Professional and not Win2000 "non-professional" (is there such a thing?).
Yes, Windows 2000 Server. However this should not be a problem on Server. I will test it on a W2k Server box if that is what techjunkie is running.

@techjunkie - Are you running W2K Professional or Server? What service pack and build?
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

:D Solved the problem with the API call "GetEnvironmentVariable_", I used too small buffert. :roll:

but still, Droopy's library functions "GetSpecialFolderLocation" and "GetEnvironmentVariable" doesn't seems to work ok on W2K.

I'm running Microsoft Windows 2000 5.00.2195 SP4 on VMWare as a test environment.

but for now I'll use the API call.

Thanks for your help!
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Post Reply