Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GetSystemDirectory

3 views
Skip to first unread message

Neil W

unread,
Nov 19, 2009, 12:02:33 PM11/19/09
to
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.

Drew

unread,
Nov 19, 2009, 12:41:33 PM11/19/09
to
Try SHGetSpecialFolderPath() with CSIDL_SYSTEM.

Drew

"Neil W" <ne...@netlib.com> wrote in message
news:uYgvfoTa...@TK2MSFTNGP05.phx.gbl...

David Lowndes

unread,
Nov 19, 2009, 1:54:18 PM11/19/09
to

>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))

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

Dave

Tim Roberts

unread,
Nov 20, 2009, 2:16:54 AM11/20/09
to

Frankly, I don't believe you. GetSystemDirectory **ALWAYS** returns a full
path. Always has, always will. Show us your actual code, and we'll try to
point out where you're going wrong.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Paul Baker [MVP, Windows Desktop Experience]

unread,
Dec 2, 2009, 10:29:48 AM12/2/09
to
FWIW, I agree. Show me the money!

If you are running this on a server with Terminal Services, you'll 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

"Tim Roberts" <ti...@probo.com> wrote in message
news:mggcg5hbrht5uuuc5...@4ax.com...

Tim Roberts

unread,
Dec 2, 2009, 11:38:04 PM12/2/09
to
"Paul Baker [MVP, Windows Desktop Experience]"

<paulrich...@community.nospam> wrote:
>
>FWIW, I agree. Show me the money!
>
>If you are running this on a server with Terminal Services, you'll get a
>user-specific path.

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.

Paul Baker [MVP, Windows Desktop Experience]

unread,
Dec 3, 2009, 4:53:22 PM12/3/09
to
Yes, sorry!

"Tim Roberts" <ti...@probo.com> wrote in message

news:psfeh55ts83g9oqq1...@4ax.com...

0 new messages