Kmd
Kmd

Reputation: 335

How change out for GetSystemDirectory?

Sorry for my very bad english.

How to reassign the folder "windows\system32" for only my application to GetSystemDirectory return my path. I tried to play with SHSetFolderPath

SHSetFolderPathA (CSIDL_SYSTEM, NULL, 0, "c:\\WINDOWS\\system33");

but I get error 0x80070057 (bad args).

How do this? Is it possible?

Upvotes: 1

Views: 600

Answers (1)

David Heffernan
David Heffernan

Reputation: 612964

It fails because it is something that cannot be done.

The documentation states that this error code is returned if:

  • The csidl value is not valid.
  • The csidl value does not refer to a virtual folder.
  • The csidl value does not refer to a system folder.
  • The csidl value refers to a folder that cannot be renamed or moved.
  • The dwFlags value is not 0 (zero).
  • The pszPath value is NULL.
  • The string pointed to by pszPath value is an empty string ("") of length zero.

I have highlighted the item that is pertinent to your question.

This function exists to allow you to renamed things like the "My Documents" folder. It doesn't make sense to rename the system directory.

Clearly you have a problem that needs to be solved but this is not the problem. Perhaps if you expanded on the problem we could help with it.

Upvotes: 1

Related Questions