Re: XXX_Init only being called once
- From: "Thomas Magma" <somewhere@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 14 Nov 2005 16:49:41 -0800
Ya this is a tough one. I am currently working in Visual Studio 2005. We are
an IHV and according to Microsoft, only OEM's (like Dell) have access to PB
Mobile 5.0.
One thing I have noticed in WM 5.0 is that when a driver (that is not
signed) is loaded for the first time, a pop-up window says Publisher:
Unknown continue? YES or NO. This only happens the first time a driver is
loaded. Our driver is currently not signed. Do you think this could have
anything to do with why our XXX_Init only gets called the first time our
card is plugged in?
Thomas
"David Liao (MS)" <davli@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23RgKxjX6FHA.2676@xxxxxxxxxxxxxxxxxxxxxxx
> It looks like you have hard time to figure out why without debug version
> of image.
> If you do have debug version of PCMCIA.dll, debug message will tell you
> why if turn on the debug zone on PCMCIA.DLL and PCC_SERV.DLL.
>
> David Liao
> "Thomas Magma" <somewhere@xxxxxxxxxxxxxxxxxx> wrote in message
> news:OfKwW1U6FHA.2036@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi David,
>>
>> My stream interface driver has been stripped right back to try to solve
>> this problem. It currently is not doing anything but satisfying the
>> minimum requirements. It is based on Doug Boling's Gendriver.dll out of
>> his Programming Windows CE 3rd edition.
>>
>> Here is a detailed step by step of what is occurring:
>>
>> Here are my registry key settings for our card located under
>> Drivers\PCMCIA:
>> Prefix "GEN"
>> Dll "myDriver.dll"
>> Order 0
>> Index 1
>> FriendlyName "Welcome"
>>
>> I plug my card in the first time.
>> Only GEN_Init is called.
>>
>> DWORD GEN_Init (DWORD dwContext, LPCVOID lpvBusContext) {
>> PDRVCONTEXT pDrv;
>> pDrv = (PDRVCONTEXT)LocalAlloc (LPTR, sizeof (DRVCONTEXT));
>> memset ((PBYTE) pDrv, 0, sizeof (DRVCONTEXT));
>> pDrv->dwSize = sizeof (DRVCONTEXT);
>> return (DWORD)pDrv;
>> }
>>
>> GEN_Init returns a dword value of 230880
>>
>> There are two new active keys in the registry PCMCIA and myDriver.
>>
>> PCMCIA active key:
>> Hnd 4731952
>> Sckt 2490369
>> InterfaceType 1
>> BusParent 224592
>>
>> myDriver active key:
>> Hnd 4735072
>> Name "GEN1:"
>> Sckt 2490369
>> InterfaceType 8
>>
>> I then unplug my card for the first time.
>> Only GEN_Deinit is called.
>>
>> BOOL GEN_Deinit (DWORD dwContext) {
>> PDRVCONTEXT pDrv = (PDRVCONTEXT) dwContext;
>> if (pDrv && (pDrv->dwSize == sizeof (DRVCONTEXT))) {
>> LocalFree ((PBYTE)pDrv);
>> }
>> return TRUE;
>> }
>>
>> The dword value of 230880 is passed into GEN_Deinit.
>>
>> Both PCMCIA and myDriver active keys disappear.
>> pcmcia.dll and myDriver.dll modules appear to be unloaded from device.exe
>>
>> Card is inserted for the second time.
>>
>> No entry points are called in my driver.
>> Only pcmcia.dll module is running under device.exe
>> Only the PCMCIA active key is present.
>>
>> PCMCIA active key:
>> Hnd 4752128
>> Sckt 2490370
>> InterfaceType 1
>> BusParent 224592
>>
>> Now, no matter how many times I plug the card in and out none of the
>> entry points are called in my driver and
>> myDriver.dll is locked and I get a sharing violation if I try to delete
>> it or copy over it. Until I do a hard reset and load everything again.
>>
>> CF memory cards and other type cards still work fine.
>>
>> I'm not sure if the hardware supports multiple instances at this point.
>> How do I find that out?
>>
>> Thanks for all your help, hope you can see the flaw in this step by
>> step.
>>
>> Thomas
>>
>>
>> "David Liao (MS)" <davli@xxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:eFZkVcC6FHA.3592@xxxxxxxxxxxxxxxxxxxxxxx
>>> IST means Interrupt Service Thread. It is function that you passed in by
>>> calling CardRequestISR (I think).
>>> According you description, it looks like it couldn't load your PCMCIA
>>> client driver sucessfully for second time.
>>> What you thought is correct, This is probably caused by some application
>>> still using this driver stream interface even when this driver is
>>> deactivated. I think it only could be caused by your PCMCIA client
>>> driver blocks on stream interface IO Control, Read or Write call. All
>>> Driver's IO call is synchronous call in Windows CE, I believe PB requirs
>>> all drivers have to unblock all blocking IO during XXX_Deinit or
>>> XXX_PreDeinit.
>>> When you remove the PCMCIA hardware, the pcc_serv.dll calls
>>> DeactivateDevice on pcmcia.dll that calls DeactivateDevice on you PCMCIA
>>> client driver. DeactiveDevice first calls either XXX_Deinit or
>>> XXX_PreDeinit. The DLL only be unloaded when reference count to driver's
>>> interface to zero. So, If you have blocking IO, the reference count to
>>> driver's interface will never reach to zero. So, the DLL is never
>>> unloaded (Even the XXX_Deinit is called). So, if you insert second time
>>> and if your driver is using same driver index ( specified in registry),
>>> The driver loading may fails because the old stream interfaces is not
>>> released.
>>> Secound possibilty is your client driver return fail on XXX_Init at
>>> secound time because the previous instance has blocking IO on its
>>> interface or unintialized driver's global variable.
>>>
>>> Let me ask you more detail information.
>>> When you insert your card secound time, does XXX_Init call for secound
>>> time?
>>> After remove your PCMCIA card, does any other type of PCMCIA card
>>> continue to work(like CF card, Bluetooth card)?
>>> Does your PCMCIA client driver support multiple same hardware?
>>>
>>> David Liao.
>>>
>>> "Thomas Magma" <somewhere@xxxxxxxxxxxxxxxxxx> wrote in message
>>> news:%23jZBVHm5FHA.724@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Hi David,
>>>>
>>>> I am using the Dell Axim X51 with Mobile 5.0. And yes I am using the
>>>> old PCMCIA client model, but I have been playing around a bit with the
>>>> new Bus-Agnostic implementation.
>>>>
>>>> pcc_serv.dll is always running under Device.exe, but when I plug my
>>>> card in (the first time) pcmcia.dll and mydriver.dll then get loaded
>>>> under Device.exe. Then I unplug my card and pcmcia.dll and mydriver.dll
>>>> disappear. That is the way it should be, I think. But when I plug my
>>>> card in a second time only pcmcia.dll gets loaded and not mydriver.dll.
>>>> It's like mydriver.dll is being locked by another application. I can't
>>>> even go into \windows\ and delete or write over mydriver.dll. I get a
>>>> pop-up window that says "sharing violation". I have to do a hard reset.
>>>>
>>>> The Device Manager loaded it fine, why isn't it unloading it?
>>>>
>>>> What does "PCMCIA driver's IST " mean?
>>>>
>>>> Thomas
>>>>
>>>> "David Liao (MS)" <davli@xxxxxxxxxxxxxxxxxxxx> wrote in message
>>>> news:erXTjrZ5FHA.884@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> Which platform are you using to testing your PCMCIA driver ?
>>>>> You obviously are using old PCMCIA client driver model which is loaded
>>>>> by PCMCIA.DLL. Is this correct?
>>>>>
>>>>> I think usually smart phone turn on security feature and PDA turns off
>>>>> security feature.
>>>>>
>>>>> Can you tell me whether you can find pcc_serv.dll in the system used
>>>>> for testing? If this device is using new PC Card Controller driver, it
>>>>> should have pcc_serv.dll in the system. Otherwise, it is old PCMCIA
>>>>> controller driver.
>>>>>
>>>>> I think the PCMCIA driver's IST is blocked somehow. It can't unload
>>>>> your driver for some reason.
>>>>>
>>>>> David Liao
>>>>>
>>>>> "Thomas Magma" <somewhere@xxxxxxxxxxxxxxxxxx> wrote in message
>>>>> news:OufYjZN5FHA.2552@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>> Steve,
>>>>>>
>>>>>> The previous was ignored thanks.
>>>>>>
>>>>>> I've looked at several peoples PCMCIA stream type interface code,
>>>>>> including my own which I had functioning just fine on WM2002 and
>>>>>> WM2003. The problem is with WM2005 and the fact it's not calling
>>>>>> XXX_Init each insertion of the card. Only the first time after a PDA
>>>>>> hard reset. It is like it's holding on the driver somehow yet not
>>>>>> showing it as being loaded in Process Viewer. The reason I think this
>>>>>> is because after I insert the card the first time and remove it, I
>>>>>> can't go in through Active Sync and erase my driver. A pop-up says
>>>>>> there is a sharing violation no matter if the card is in or out.
>>>>>> Something is holding on to it. It this something to do with
>>>>>> Persistence Storage? Perhaps a security feature due the fact my
>>>>>> driver is not signed and the OS only want to display the Unknown
>>>>>> Manufacture pop-up window once, not each time the driver is loaded
>>>>>> when a card is inserted?
>>>>>>
>>>>>> Any ideas?
>>>>>>
>>>>>> Thomas
>>>>>>
>>>>>>
>>>>>> "Steve Maillet (eMVP)" <nospam1@xxxxxxxxxxxxxxxxxxxxxxx> wrote in
>>>>>> message news:%23T8i1uM5FHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>>> "You must know that XXX_Init only be called once when system load.
>>>>>>> You need
>>>>>>> change your design."
>>>>>>> Ignore that! For PCMCIA client drivers and any other PNP driver
>>>>>>> loaded and unloaded when the device is inserted/removed that is not
>>>>>>> true.
>>>>>>> You are correct in assuming the Init function should be called on
>>>>>>> each insert. Well, sort of, there is a PNPunload delay registry
>>>>>>> value that leaves things loaded for a period of time to allow you to
>>>>>>> re-insert the same card after accidentally popping it out without
>>>>>>> unloading or invalidating it. Rapid remove/insert cycles cause a
>>>>>>> problem for that.
>>>>>>>
>>>>>>> --
>>>>>>> Steve Maillet
>>>>>>> EmbeddedFusion
>>>>>>> www.EmbeddedFusion.com
>>>>>>> smaillet at EmbeddedFusion dot com
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- Follow-Ups:
- Re: XXX_Init only being called once
- From: David Liao \(MS\)
- Re: XXX_Init only being called once
- References:
- Re: XXX_Init only being called once
- From: Andy Shi
- Re: XXX_Init only being called once
- From: Steve Maillet \(eMVP\)
- Re: XXX_Init only being called once
- From: Thomas Magma
- Re: XXX_Init only being called once
- From: David Liao \(MS\)
- Re: XXX_Init only being called once
- From: Thomas Magma
- Re: XXX_Init only being called once
- From: David Liao \(MS\)
- Re: XXX_Init only being called once
- From: Thomas Magma
- Re: XXX_Init only being called once
- From: David Liao \(MS\)
- Re: XXX_Init only being called once
- Prev by Date: Re: XXX_Init only being called once
- Next by Date: Re: Redboot load WinCE kernel fail?? (need help)
- Previous by thread: Re: XXX_Init only being called once
- Next by thread: Re: XXX_Init only being called once
- Index(es):
Relevant Pages
|