Hi All,
I wanted to use the IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION macro that
was defined in usbioctl.h .
However on including the file i was getting teh follwoing build error:
1>errors in directory d:\usb_selective_suspend\code\driver\umselsuspdriver
1>d:\winddk\7600.16385.1\inc\api\usbioctl.h(800) : error C2059: syntax error
: ’
constant’
1>d:\winddk\7600.16385.1\inc\api\usbioctl.h(800) : error C2238: unexpected
token
(s) preceding ‘;’
1>d:\winddk\7600.16385.1\inc\api\usbioctl.h(909) : error C2118: negative
subscri
pt
Compiling - generating code…
Building Library - objchk_wxp_x86\i386\umselsuspdriver.lib
1>link : error LNK1181: cannot open input file
‘d:\usb_selective_suspend\code\dr
iver\umselsuspdriver\objchk_wxp_x86\i386\usbprintiocontrolhandler.obj’
BUILD: Compile errors: not linking
d:\usb_selective_suspend\code\driver\umselsus
pdriver directory
All the errors point to the Microsoft provided api header file.
Would be glad if anyone could help me out.
Thanks
Abdul
On Tue, Jan 11, 2011 at 8:38 AM, Abdul Qader mohammed
wrote:
> All the errors point to the Microsoft provided api header file.
Well no, they point to your source code, which has managed to botch up
a standard include file.
Perhaps you would like to share what your source code in
usbprintiocontrolhandler.c is doing? Is this a driver? An application?
Mark Roddy
Mark,
The code is for a UMDF driver .
bool USBPrintIOControlHandler::SuspendDevice(IOControlContext* context)
{
IWDFIoRequest* suspend_request = NULL;
PUSBBulkController usbBulkController= context->GetBulkController();
IWDFDevice *deviceObject = usbBulkController->GetFxDevice();
IWDFDriver *driver = usbBulkController->GetFxDriver();
HRESULT status = S_OK;
IWDFMemory *memory = NULL;
void* buffer = NULL;
/*First Create a Request*/
status = deviceObject->CreateRequest(NULL, NULL, &suspend_request);
if(FAILED(status) || suspend_request == NULL)
{
OutputDebugString(L"Create Request Failed");
//complete the request with the failure code
context->GetRequest()->Complete(status);
return false;
}
/*Create the Notification Object*/
buffer = new USB_IDLE_CALLBACK_INFO;
buffer->IdleCallback = IdleNotificationCallback;
buffer->IdleContext = NULL; //THis should be our device Extension
/*We need to know if our device is idle. So we submit
IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICAT
ION that will give us the call back*/
IWDFIoTarget *ioTarget;
deviceObject->GetDefaultIoTarget(&ioTarget);
driver->CreateWdfMemory(context->GetOutBuffer(NULL), NULL, NULL, &memory);
if(ioTarget == NULL)
{
OutputDebugString(L"Failed to get Default IOTarget");
}
WDFMEMORY_OFFSET memOffst;
memOffst.BufferOffset = 0;
memOffst.BufferLength = sizeof(USB_IDLE_CALLBACK_INFO);
memory->CopyFromBuffer(0, buffer, sizeof(USB_IDLE_CALLBACK_INFO));
ioTarget->FormatRequestForIoctl(suspend_request,
IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION,
NULL, memory, &memOffst, NULL, NULL);
}
This is the function that I have written.
I am including usbioctl.h as IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION is
defined there.
Thanks
Abdul
On Tue, Jan 11, 2011 at 8:29 PM, Mark Roddy wrote:
> On Tue, Jan 11, 2011 at 8:38 AM, Abdul Qader mohammed
> wrote:
> > All the errors point to the Microsoft provided api header file.
>
> Well no, they point to your source code, which has managed to botch up
> a standard include file.
>
> Perhaps you would like to share what your source code in
> usbprintiocontrolhandler.c is doing? Is this a driver? An application?
>
> Mark Roddy
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Offhand I do not think you can send this IOCTL or include this file
from a umdf driver.
Mark Roddy
On Tue, Jan 11, 2011 at 10:04 AM, Abdul Qader mohammed
wrote:
> FormatRequestForIoctl
Abdul Qader mohammed wrote:
I wanted to use the IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION macro
that was defined in usbioctl.h .
However on including the file i was getting teh follwoing build error:
1>errors in directory d:\usb_selective_suspend\code\driver\umselsuspdriver
1>d:\winddk\7600.16385.1\inc\api\usbioctl.h(800) : error C2059: syntax
error : ’
constant’
1>d:\winddk\7600.16385.1\inc\api\usbioctl.h(800) : error C2238:
unexpected token
(s) preceding ‘;’
1>d:\winddk\7600.16385.1\inc\api\usbioctl.h(909) : error C2118:
negative subscri
pt
Compiling - generating code…
Building Library - objchk_wxp_x86\i386\umselsuspdriver.lib
1>link : error LNK1181: cannot open input file
‘d:\usb_selective_suspend\code\dr
iver\umselsuspdriver\objchk_wxp_x86\i386\usbprintiocontrolhandler.obj’
BUILD: Compile errors: not linking
d:\usb_selective_suspend\code\driver\umselsus
pdriver directory
All the errors point to the Microsoft provided api header file.
Did you do any investigating of this at all? The line its complaining
about is this:
BOOLEAN LowSpeed;
Based on the error, either you have the symbol LowSpeed in a #define
somewhere, or you have not included a file that defines the BOOLEAN type.
However, I believe Mark is completely correct. This is a kernel-only
ioctl. You can’t send it from user mode. The fact that it includes the
address of a callback function should make that clear.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.