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

8 Years
Discussion Span
Last Post by William Hemsworth

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.


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


Redirect to: %LOCALAPPDATA%\VirtualStore

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

Any hope?



The issue is still there

The folder is redirected by virctualtion techinic


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


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?

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.