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

Recommended Answers

All 8 Replies

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

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

Hope this helps.

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

(%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

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

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

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?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.