• C

createfile for mapped units?

Hello ,

I'm able to run suscessfully CreateFile windows function if I try to open a local drive

nv[]="\\\\.\\C:";

hVolume = CreateFile(
         volume_name,    
         GENERIC_READ | GENERIC_WRITE,
         FILE_SHARE_READ | FILE_SHARE_WRITE,
         NULL,    
         OPEN_EXISTING,
         0,    
         NULL);

but I can not do it (I get error) if I try to do the same with a mapped unit (net use z: \\xxxxxxxxxx and after CreateFile for Z:)


Any help ?

Thank you


aguiralAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenData Warehouse Architect / DBACommented:

I've never been fan of "one size fits all" APIs and "CreateFile" certainly falls into this category.

Try the FileCreate() or "FileOpen() APIs.  IIRC, they use a different handle structure than does CreateFile() so you might also have to change the APIs that you're using to access the handle.

Kdo
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmcgOwnerCommented:
Nothing has happened on this question in more than 10 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by Kdo [grade B] (partway on the road to a solution).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.