Windows XP
(1)
SHGetSpecialFolderPath
(1)
GetWindowsDirectory
(1)
GetSystemDirectory
(1)
Boekelheide
(1)
Providenza
(1)
Directory
(1)
Sizeof
(1)

GetSystemDirectory

Asked By Neil W
19-Nov-09 12:02 PM
I know this is not a kernel question, but not too many groups left where
people are up on winapis.

I am using the function GetSystemDirectory, however in certain circumstances
in Windows XP Pro it is returning a relative path, not the full path to the
system directory!

E.g., sometimes the code below returns "C:\WINDOWS\SYSTEM32" as it should
But sometimes it just returns "SYSTEM32" !!!

char buf[MAX_PATH];
GetSystemDirectory(buf,sizeof(buf))

Is there a bug in this API?  Am I using it the wrong way?  Thanks.

Try SHGetSpecialFolderPath() with CSIDL_SYSTEM.Drew

Drew replied to Neil W
19-Nov-09 12:41 PM
Try SHGetSpecialFolderPath() with CSIDL_SYSTEM.

Drew

Give us a clue - what are the "certain circumstances"?Dave

David Lowndes replied to Neil W
19-Nov-09 01:54 PM
Give us a clue - what are the "certain circumstances"?

Dave

Frankly, I do not believe you.

Tim Roberts replied to Neil W
20-Nov-09 02:16 AM
Frankly, I do not believe you.  GetSystemDirectory **ALWAYS** returns a full
path.  Always has, always will.  Show us your actual code, and we will try to
point out where you are going wrong.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
FWIW, I agree. Show me the money!
Paul Baker [MVP, Windows Desktop Experience] replied to Tim Roberts
02-Dec-09 10:29 AM
FWIW, I agree. Show me the money!

If you are running this on a server with Terminal Services, you will get a
user-specific path.

You may have third party software that is trying to hook into this stuff. A
remote access application perhaps.

Paul
"Paul Baker [MVP, Windows Desktop Experience]"Not quite.
Tim Roberts replied to Paul Baker [MVP, Windows Desktop Experience]
02-Dec-09 11:38 PM
Not quite.  GetWindowsDirectory will return a user-specific path in remote
sessions, but GetSystemDirectory (which he asked about) returns the same
System32 path for everyone.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Yes, sorry!
Paul Baker [MVP, Windows Desktop Experience] replied to Tim Roberts
03-Dec-09 04:53 PM
Yes, sorry!
Post Question To EggHeadCafe