From: Neil W on
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.





From: Drew on
Try SHGetSpecialFolderPath() with CSIDL_SYSTEM.

Drew

"Neil W" <neilw(a)netlib.com> wrote in message
news:uYgvfoTaKHA.4924(a)TK2MSFTNGP05.phx.gbl...
>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.
>
>
>
>
>


From: David Lowndes on

>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
From: Tim Roberts on

"Neil W" <neilw(a)netlib.com> wrote:
>
>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?

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, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: Paul Baker [MVP, Windows Desktop Experience] on
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" <timr(a)probo.com> wrote in message
news:mggcg5hbrht5uuuc5lfmteuoen7i54eua8(a)4ax.com...
> "Neil W" <neilw(a)netlib.com> wrote:
>>
>>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?
>
> 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, timr(a)probo.com
> Providenza & Boekelheide, Inc.