954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Vista Program files c++ code issue

in VC++ 2005

I tried to create directory using CreateDirectory(_T("c:\program files\Testing"))

But it is not created in c:\program files\

it is created in loged in Users appdata folder how can i overide this senario in vista

(windows folder and System directory)

please give any link or information

veeran
Newbie Poster
4 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

You have to use double backwards slash, try changing it to this.

CreateDirectory(_T("c:\\program files\\Testing"))

Hope this helps.

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

That function requires twol parameters
CreateDirectory(_T("c:\\program files\\Testing", 0));

That worked for me on Vista Home. You most likely failed to correct the error(s) and warning(s) produced by your compiler. Always treat warnings like errors in your code because most of the time they are indeed errors.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

hi williamhemswort,

thanks for the replay
but issue is not you spcified.

my CreateDirectory call is completed success fully

CreateDirectory(_T("c:\\program files\\Testing"))

the folder is created in the below stated location

C:\Users\logdinUser\AppData\Local\VirtualStore\Program Files\Testing

The folder is redirected by virctualtion techinic

(%SYSTEMROOT%, %PROGRAMDATA%,%PROGRAMFILES%\(Subdirectories)

Redirect to: %LOCALAPPDATA%\VirtualStore

I want to bypass this process and folder should be created in c:\program files\Testing


Any hope?

thanks

veeran
Newbie Poster
4 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

>>my CreateDirectory call is completed success fully
Doubtful. See my previous post.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

The issue is still there

The folder is redirected by virctualtion techinic

(%SYSTEMROOT%, %PROGRAMDATA%,%PROGRAMFILES%\(Subdirectories)

Redirect to: %LOCALAPPDATA%\VirtualStore

above stated new vista feature is bothering me (Vista Ultimate)


bResult = CreateDirectory(_T("c:\\program files\\Testing"), NULL);

dwError = GetLastErrorCode();


if (bResult == FALSE)
{
dwError = GetLastErrorCode();

}

Here bResult is TRUE so code is success full AND dwError IS zero

the folder is created in the below stated location

"C:\Users\logdin-User\AppData\Local\VirtualStore\Program Files\Testing"

C:\Users\Veeran\AppData\Local\VirtualStore\Program Files\Testing

but when you look for folder using Explorer you wont find any folder in
c:\Program Files\Testing. But in Explorer you can see a new tab named "Compatiblity Files" click this tab you will see the testing folder just created .

if create a file using CreateFile API c:\Program Files\Testing\Applog.txt also will be created in the path "C:\Users\Veeran\AppData\Local\VirtualStore\Program Files\Testing\Applog.txt"

GetFileAttributes( _T("c:\\Program Files\\Testing\\Applog.txt" ) ); will also succeed
but the path it look for is "C:\Users\Veeran\AppData\Local\VirtualStore\Program Files\Testing\Applog.txt"

This becuase of new Vista virctualtion techinic.

Can we bypass this virctualtion path and get orginal path

veeran
Newbie Poster
4 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

I Want Bypass the vista virctualtion feature

UAC References

http://msdn.microsoft.com/en-us/library/bb756883.aspx

any Hope?

veeran
Newbie Poster
4 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

You're using Ultima -- so maybe that's why it works on my Vista Home but not on your Vista Ultima. If that's the case, then I can't help you.

Are you running as an Administrator?

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Im using Vista Ultimate, and it works fine on my computer :P

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You