Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 15-Nov-12 1:32am
Comments
Richard MacCutchan at 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 at 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 at 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)

  Print Answers RSS
0 OriginalGriff 390
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,260


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100