IRP_MJ_CREATE is called twice with one createfile call from application

  • Thread starter Thread starter zyx
  • Start date Start date
Z

zyx

Hi,
I have a usb driver.I am trying to open it and close the file in my
application.I call createfile and closefile only once in my
application.but in my driver IRP_MJ_CREATE and IRP_MJ_CLOSE are called
twice.It sounds very different to me.Is there any scenario that
IRP_MJ_CREATE is called automatically without my application calling
createfile.why is it calling twice??????

This is my log

00000000 0.00000000 MYDRIVER - Entering DriverEntry: DriverObject
82D18030
00000001 0.00000531 MYDRIVER - Running under 2000
00000002 0.00021148 MYDRIVER - NEW Entering AddDevice: DriverObject
82D18030, pdo 826CBBA8 (Max Dev Count 5)
00000003 0.00023774 MYDRIVER - IoCreateDevice returned - 0
00000004 0.00024277 MYDRIVER - Successfully created 0 device object.
00000005 0.00027015 MYDRIVER - status of IoCreateSymbolicLink - 0
00000006 0.00035675 MYDRIVER - PNP Request
(IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
00000007 0.00041681 MYDRIVER - PNP Request
(IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
00000008 0.00042659 MYDRIVER - PNP Request (IRP_MN_START_DEVICE)
00000009 0.00061823 MYDRIVER-KEWAIT:103
00000010 0.00881146 MYDRIVER-status SendAwaitUrb:0
00000011 0.00881732 MYDRIVER-status SendAwaitUrb:0
00000012 0.00885811 MYDRIVER-KEWAIT:103
00000013 0.01478121 MYDRIVER-status SendAwaitUrb:0
00000014 0.01478540 MYDRIVER-status SendAwaitUrb:0
00000015 0.01481278 MYDRIVER-KEWAIT:103
00000016 0.02277859 MYDRIVER-status SendAwaitUrb:0
00000017 0.02278278 MYDRIVER-status SendAwaitUrb:0
00000018 0.02278949 MYDRIVER - Configuring device from BRCM
00000019 0.02281631 MYDRIVER-KEWAIT:103
00000020 0.03277679 MYDRIVER-status SendAwaitUrb:0
00000021 0.03278098 MYDRIVER-status SendAwaitUrb:0
00000022 0.03278601 MYDRIVER - Product is BRCM2037
00000023 0.03281199 MYDRIVER-KEWAIT:103
00000024 0.04477552 MYDRIVER-status SendAwaitUrb:0
00000025 0.04477971 MYDRIVER-status SendAwaitUrb:0
00000026 0.04478530 MYDRIVER - Serial number is 524444414442
00000027 0.04480709 MYDRIVER-KEWAIT:103
00000028 0.05177474 MYDRIVER-status SendAwaitUrb:0
00000029 0.05177893 MYDRIVER-status SendAwaitUrb:0
00000030 0.05180183 MYDRIVER-KEWAIT:103
00000031 0.06877326 MYDRIVER-status SendAwaitUrb:0
00000032 0.06877773 MYDRIVER-status SendAwaitUrb:0
00000033 0.06878360 MYDRIVER - BLUETOOTH Configuration Descriptor:
00000034 0.06878752 MYDRIVER - --------------------------
00000035 0.06879170 MYDRIVER - bLength 9
00000036 0.06879590 MYDRIVER - bDescriptorType 0x2
00000037 0.06880037 MYDRIVER - wTotalLength 0x37
00000038 0.06880455 MYDRIVER - bNumInterfaces 0x2
00000039 0.06880874 MYDRIVER - iConfiguration 0x0
00000040 0.06881294 MYDRIVER - bConfigurationValue 0x1
00000041 0.06881741 MYDRIVER - bmAttributes 0xc0
00000042 0.06882159 MYDRIVER - MaxPower 0x32
00000043 0.06882606 MYDRIVER - BLUETOOTH Interface Descriptor:
00000044 0.06882998 MYDRIVER - --------------------------
00000045 0.06883389 MYDRIVER - bLength 9
00000046 0.06883808 MYDRIVER - bDescriptorType 0x4
00000047 0.06884227 MYDRIVER - bInterfaceNumber 0x0
00000048 0.06884646 MYDRIVER - bAlternateSetting 0x0
00000049 0.06885065 MYDRIVER - bNumEndpoints 0x3
00000050 0.06885484 MYDRIVER - bInterfaceClass 0xe0
00000051 0.06885903 MYDRIVER - bInterfaceSubClass 0x1
00000052 0.06886322 MYDRIVER - bInterfaceProtocol 0x1
00000053 0.06886713 MYDRIVER - iInterface 0x0
00000054 0.06887133 MYDRIVER - interfaceindex0x1
00000055 0.06887551 MYDRIVER - BLUETOOTH Interface Descriptor:
00000056 0.06887943 MYDRIVER - --------------------------
00000057 0.06888334 MYDRIVER - bLength 9
00000058 0.06888752 MYDRIVER - bDescriptorType 0x4
00000059 0.06889172 MYDRIVER - bInterfaceNumber 0x1
00000060 0.06889591 MYDRIVER - bAlternateSetting 0x0
00000061 0.06890010 MYDRIVER - bNumEndpoints 0x0
00000062 0.06890429 MYDRIVER - bInterfaceClass 0xfe
00000063 0.06890848 MYDRIVER - bInterfaceSubClass 0x1
00000064 0.06891267 MYDRIVER - bInterfaceProtocol 0x1
00000065 0.06891658 MYDRIVER - iInterface 0x1
00000066 0.06892077 MYDRIVER - interfaceindex0x2
00000067 0.16381468 MYDRIVER-status SendAwaitUrb:0
00000068 0.16382138 MYDRIVER-status SendAwaitUrb:0
00000069 0.16382697 MYDRIVER - In StartInterruptUrb
00000070 0.16383144 MYDRIVER - interrupt polling is set to pending
00000071 0.16383535 MYDRIVER - Device not busy
00000072 0.16383982 MYDRIVER - After lock is acquired
00000073 0.16399543 MYDRIVER - To WORKING from STOPPED
00000074 0.16417757 MYDRIVER - PNP Request (IRP_MN_QUERY_CAPABILITIES)
00000075 0.16422534 MYDRIVER - PNP Request
(IRP_MN_QUERY_PNP_DEVICE_STATE)
00000076 0.16423596 MYDRIVER - PNP Request
(IRP_MN_QUERY_DEVICE_RELATIONS)
00000077 3.51514268 MYDRIVER - IRP_MJ_CREATE
00000078 3.51514983 MYDRIVER - In StartInterruptUrb
00000079 3.51515436 MYDRIVER - interrupt polling is already pending
00000080 3.51515865 MYDRIVER - Unable to start Interrupt URB; Device
busy
00000081 3.51516318 MYDRIVER - Unable to start Interrupt URB; Device
busy
00000082 3.51517487 MYDRIVER - IRP_MJ_CLEANUP
00000083 3.51518250 MYDRIVER-status :0
00000084 3.51518774 MYDRIVER - IRP_MJ_CLOSE
00000085 3.51519203 MYDRIVER- Inside stopInterruptUrb
00000086 3.51524067 MYDRIVER - Inside stopBulkinUrb
00000087 3.51526356 MYDRIVER - No queue elements for freeing.
00000088 3.51533651 MYDRIVER - IRP_MJ_CREATE
00000089 3.51534057 MYDRIVER - In StartInterruptUrb
00000090 3.51534486 MYDRIVER - interrupt polling is already pending
00000091 3.51534939 MYDRIVER - Unable to start Interrupt URB; Device
busy
00000092 3.51535368 MYDRIVER - Unable to start Interrupt URB; Device
busy
00000093 3.51911402 MYDRIVER - servicing OnInterrupt
00000094 3.51912379 MYDRIVER - Interrupt polling IRP 82912868 failed -
C0000120 (USBD status C0010000)
00000095 3.51914978 MYDRIVER - Bulkin polling IRP 828D0978 failed -
C0000120 (USBD status C0010000)
00000096 3.56396532 MYDRIVER - IRP_MJ_CLEANUP
00000097 3.56397510 MYDRIVER-status :0
00000098 3.56398082 MYDRIVER - IRP_MJ_CLOSE
00000099 3.56398582 MYDRIVER - No queue elements for freeing.
00000100 7.91411686 MYDRIVER - PNP Request
(IRP_MN_QUERY_DEVICE_RELATIONS)
00000101 7.91412926 MYDRIVER - PNP Request
(IRP_MN_QUERY_DEVICE_RELATIONS)
00000102 7.91414309 MYDRIVER - PNP Request (IRP_MN_SURPRISE_REMOVAL)
00000103 7.91414976 MYDRIVER - Inside stopdevice 1
00000104 7.91415691 MYDRIVER - Config descriptor 8290BDF0
00000105 7.91416121 MYDRIVER - To SURPRISEREMOVED from WORKING
00000106 7.92438555 MYDRIVER - PNP Request (IRP_MN_REMOVE_DEVICE)
00000107 7.92439508 MYDRIVER -HandleRemoveDevice oktouch 0
00000108 7.92439938 MYDRIVER - Inside stopdevice 0
00000109 7.92440510 MYDRIVER - To REMOVED from SURPRISEREMOVED
00000110 7.92445374 MYDRIVER - Inside DeleteInterruptUrb
00000111 7.92445850 MYDRIVER - Inside DeleteBulkinUrb
00000112 7.92451429 MYDRIVER - Entering DriverUnload: DriverObject
82D18030
00000113 7.92451954 MYDRIVER - Leaving DriverUnload: DriverObject
82D18030
00000000 0.00000000 MYDRIVER - Entering DriverEntry: DriverObject
82D18030

thanks in advance
 
what is the callstack for each call? Put a breakpoint on your IRP_MJ_CREATE
dispatch routine and then run the "kb" command. Then on the second hit on
the breakpoint, run kb again and compare the stacks.

What class is your device installed under? Is it enabling any device
interfaces? If so, is it a custom GUID or a system defined GUID? Any one of
these could lead to another component finding your device and trying to open
it.

d
 
Back
Top