Page 1 of 1
					
				Getting Environment Variables on Windows 2000?!?
				Posted: Wed Nov 09, 2005 2:29 am
				by techjunkie
				Arghhh!  
 
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?
 
			 
			
					
				
				Posted: Wed Nov 09, 2005 3:07 am
				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.
 
			 
			
					
				
				Posted: Wed Nov 09, 2005 5:40 am
				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?
 
			 
			
					
				
				Posted: Wed Nov 09, 2005 12:16 pm
				by techjunkie
				
 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!