From: Vincent Fatica on
What access rights are needed for SetCurrentDirectory() to succeed? I'd like to
know id SetCurrentDirectory will succeed without actually calling it. Thanks.
--
- Vince
From: Alex Blekhman on
On 29-May-10 6:50, Vincent Fatica wrote:
>
> What access rights are needed for SetCurrentDirectory() to succeed? I'd like to
> know id SetCurrentDirectory will succeed without actually calling it. Thanks.

I think that SetCurrentDirectory should always succeed because it
doesn't change the system, but only changes the process itself. MSDN
says that SetCurrentDirectory changes global environment variable in a
calling process. I am not aware of any access rights restriction that
would prevent a process from setting its own env. variables.

I don't know whether SetCurrentDirectory checks if requested directory
actually exists. If yes, then reading a disk would be reasonable access
right to expect from a calling process.

HTH
Alex
From: Vincent Fatica on
On Sat, 29 May 2010 12:26:16 +1000, Alex Blekhman <tkfx(a)yahoo.com> wrote:

|On 29-May-10 6:50, Vincent Fatica wrote:
|>
|> What access rights are needed for SetCurrentDirectory() to succeed? I'd like to
|> know id SetCurrentDirectory will succeed without actually calling it. Thanks.
|
|I think that SetCurrentDirectory should always succeed because it
|doesn't change the system, but only changes the process itself. MSDN
|says that SetCurrentDirectory changes global environment variable in a
|calling process. I am not aware of any access rights restriction that
|would prevent a process from setting its own env. variables.
|
|I don't know whether SetCurrentDirectory checks if requested directory
|actually exists. If yes, then reading a disk would be reasonable access
|right to expect from a calling process.

It fails on "System Volume Information" for example. And it fails when the
target doesn't exist. The current directory is rather important to other Win32
API functions. It's **the** place to look when CreateFile() is given a name
with no path.
--
- Vince
From: Alex Blekhman on
On 29-May-10 14:13, Vincent Fatica wrote:
> It fails on "System Volume Information" for example. And it fails when the
> target doesn't exist.

Good to know. However, "System Volume Information" is a quite special
folder. I couldn't open it even with Administrator rights. Even file
listing is denied.

Alex