Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
We are developing an windows 8 store device app using C# which will communicate to the device using Win32 API and IOCTL calls in a C dll. We had created a C dll with Create File and some IOCTL calls, imported in C# application. Integration goes well and when Create File function is called, it returns 'ACCESS DENIED ERROR'. We had also tried creating Manifest with requested Execution level to Administrator but still the issue is not solved. I would like to know whether Win32 API & IOCTL calls can be used directly or do I need to use any wrapper calls to make it work?

Thanks in advance.
Posted
Comments
Richard MacCutchan 15-Nov-12 10:05am    
ACCESS DENIED means you are trying to create a file in a directory which does not allow it, based on your access level. The first thing to do is to resolve this issue.
Member 9601527 16-Nov-12 9:02am    
Hi,

For the above said question, I got the ppt from MSFT (refer below link) http://channel9.msdn.com/events/BUILD/BUILD2011/HW-747T
I tried implementing "CreateDeviceAccessInstance" and IDeviceIoControl API for getting the handle and accessing the device but I'm getting E_INVALIDARG for function call to GetResult(). My sequence is as follow
1. ICreateDeviceAccessAsync *pDeviceAccess
2. CreateDeviceAccessInstance (FilePath, GENERIC_READ|GENERIC_WRITE, &pDeviceAccess) - SUCCEEDS
3. pDeviceAccess->Wait(INFINITE) - SUCCEEDS
4. IDeviceIoControl *pDeviceControl
5. pDeviceAccess->GetResult(IID_IDeviceIoControl, (void **)&pDeviceControl) - Fails with E_INVALIDARG error code
Any suggestions would be helpful.

Thanks in Advance.
Member 9601527 19-Nov-12 4:52am    
Hi,
Step 5: Instead of using pDeviceAccess->GetResult(), I had used pDeviceAccess->QueryInterface(). The interface returned is typecasted to DeviceIoControl pointer. Now I don't get E_INVALIDARG. But while issuing the IOCTL as per below, I get E_UNEXPECTED error code.

6. pDeviceControl->DeviceIoControlSync(FSCTL_GET_RETRIEVAL_POINTERS, (UCHAR *) <Pointer to Starting VCN input buffer>, sizeof(STARTING_VCN_INPUT_BUFFER), (UCHAR *) <Pointer to retrieval buffer pointer>, sizeof(retrieval buffer structure), &dwBytesReturned);

Any input would be great.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900