Dear all,
I create a dll to init GPIO27 interrupt and install a IST in wince. The
IST is to capture the falling edge of GPIO27 in wince.

The following is the DLL program
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID
lpReserved )
{
......
switch( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
RETAILMSG (1, (TEXT(" DLL_PROCESS_ATTACH \r\n")));

//Init GPIO, GPIO27 interrupt, IST subroutine are put here

break;

case DLL_THREAD_ATTACH:
RETAILMSG (1, (TEXT(" DLL_THREAD_ATTACH \r\n")));
break;
case DLL_THREAD_DETACH:
RETAILMSG (1, (TEXT("DLL_THREAD_DETACH \r\n")));
break;
case DLL_PROCESS_DETACH:
RETAILMSG (1, (TEXT(" DLL_PROCESS_DETACH \r\n"))); break;

}//END OF SWITCH

return TRUE;

}

Also in the registry, I modify as below
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\GPIO27INT\]
"Dll"="GPIO27INT.dll"

During boot time, the DLL loaded. Also "DLL_PROCESS_ATTACH" was got. The
interrupt and IST installed properly. Since there are clock pulse on GPIO27
pin already, the IST was operating. However after "DLL_PROCESS_DETACH", the
IST doesnot work.

Are there anything wrong? Thanks for your reply.

Re: Init IST by a DLL during boot time by Steve

Steve
Tue May 16 22:01:35 CDT 2006

You failed to comprehend the need for specific entry points in the DLL for
it to be considered a valid driver that loads from the registry keys you
identified. You should not set up the IST in DllMain but instead defer that
to the xxx_Init() export. Look up the documentation for implementing a
stream driver.

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com



Re: Init IST by a DLL during boot time by HKAnson

HKAnson
Wed Jun 14 21:49:02 CDT 2006

Dear Steve,
Thanks for your reply. I tried to study the stream driver. During boot
time, the DLL loaded. Also enter xxx_Init() of my stream driver. In this
xxx_Init(), I tried to setup a timeout thread. However, the thread didn't
work. During initialization, there is no error message. Are there anything
wrong? Thanks for your reply.
There is my timeout thread subroutine.

BOOL SetupTimeoutThread()
{
g_hevInterruptTimeout=CreateEvent(NULL, FALSE, FALSE, NULL);
if(g_hevInterruptTimeout==NULL)
{RETAILMSG (1, (TEXT(" Inside SetupTimeoutThread CreateEvent error!\r\n")));
return FALSE;
}

g_htISTTimeout=CreateThread(NULL,0,
(LPTHREAD_START_ROUTINE)TimeoutThread,
NULL,CREATE_SUSPENDED,&gdwThreadIDTimeout);
if(g_htISTTimeout==NULL)
{
RETAILMSG (1, (TEXT(" Inside SetupTimeoutThread Createthread error!\r\n")));
return FALSE;
}

if(!CeSetThreadPriority(g_htISTTimeout,10))
{
RETAILMSG (1, (TEXT(" Inside SetupTimeoutThread Thread Priority
error!\r\n")));
return FALSE;
}

ResumeThread(g_htISTTimeout);
return TRUE;
}

void TimeoutThread()
{

while(1)
{
if (WaitForSingleObject(g_hevInterruptTimeout, 200) == WAIT_TIMEOUT)
{
RETAILMSG (1, (TEXT(" Inside TimeoutThread!\r\n")));
gbyTimeoutFlag=1;
}
}

}

"Steve Maillet (eMVP)" wrote:

> You failed to comprehend the need for specific entry points in the DLL for
> it to be considered a valid driver that loads from the registry keys you
> identified. You should not set up the IST in DllMain but instead defer that
> to the xxx_Init() export. Look up the documentation for implementing a
> stream driver.
>
> --
> Steve Maillet
> EmbeddedFusion
> www.EmbeddedFusion.com
> smaillet at EmbeddedFusion dot com
>
>
>

Re: Init IST by a DLL during boot time by Zhongwei

Zhongwei
Thu Jun 15 08:35:44 CDT 2006

Why do you think the thread didn't work? Because you don't see retailmsg "
Inside TimeoutThread!\r\n", no retailmsg at all?

Wherenever you have a
if ( )
{
RETAILMSG
}

Chang it to
if( )
{
RETAILMSG
}
else
RETAILMSG

Print return value of WaitForSingleObject and add one more RETAILMSG at the
beginning of TimeoutThread, then you will sure know how it went.

--
Zhongwei Wang
Applied Data Systems
www.applieddata.net


"HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
news:FFF02965-FFD9-4397-A665-8873F5DB369D@microsoft.com...



Re: Init IST by a DLL during boot time by HKAnson

HKAnson
Sun Jun 18 20:49:01 CDT 2006

Dear Mr. Wang,
I tried to modify the code as followings. There are still no retailmsg in
the TimeoutThread.

There are the retailmsg, during boot time.
TEST DLL: INSIDE TES_Init
DLL: Inside SetupTimeoutThread ResumeThread=1.
TEST DLL: EXIT TES_Init

all these retailmsg are of BOOL SetupTimeoutThread(), instead of
TimeoutThread. Do you any idea? Thanks for your help.


void TimeoutThread()
{
DWORD dwTemp;
RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread before while(1)!\r\n")));
while(1) {
dwTemp=WaitForSingleObject(g_hevInterruptTimeout, 200) ==WAIT_TIMEOUT;
if (dwTemp == WAIT_TIMEOUT){
RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread!\r\n")));
gbyTimeoutFlag=1;
}
else
{
RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread else of
WaitForSingleObject ! \r\n")));
}

RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread Value of WaitForSingleObject
=%x,!\r\n"), dwTemp));
}
}




"Zhongwei Wang" wrote:

> Why do you think the thread didn't work? Because you don't see retailmsg "
> Inside TimeoutThread!\r\n", no retailmsg at all?
>
> Wherenever you have a
> if ( )
> {
> RETAILMSG
> }
>
> Chang it to
> if( )
> {
> RETAILMSG
> }
> else
> RETAILMSG
>
> Print return value of WaitForSingleObject and add one more RETAILMSG at the
> beginning of TimeoutThread, then you will sure know how it went.
>
> --
> Zhongwei Wang
> Applied Data Systems
> www.applieddata.net
>
>
> "HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
> news:FFF02965-FFD9-4397-A665-8873F5DB369D@microsoft.com...
>
>
>

Re: Init IST by a DLL during boot time by bluesphere

bluesphere
Mon Jun 19 02:34:42 CDT 2006

Try the right Thread Procedure

DWORD WINAPI TimeoutThread(LPVOID lpParameter);

instead of

void TimeoutThread();


"HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
news:43EB460D-04FF-44E2-BAC7-1FBA69B02BF8@microsoft.com...
> Dear Mr. Wang,
> I tried to modify the code as followings. There are still no retailmsg
in
> the TimeoutThread.
>
> There are the retailmsg, during boot time.
> TEST DLL: INSIDE TES_Init
> DLL: Inside SetupTimeoutThread ResumeThread=1.
> TEST DLL: EXIT TES_Init
>
> all these retailmsg are of BOOL SetupTimeoutThread(), instead of
> TimeoutThread. Do you any idea? Thanks for your help.
>
>
> void TimeoutThread()
> {
> DWORD dwTemp;
> RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread before
while(1)!\r\n")));
> while(1) {
> dwTemp=WaitForSingleObject(g_hevInterruptTimeout, 200) ==WAIT_TIMEOUT;
> if (dwTemp == WAIT_TIMEOUT){
> RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread!\r\n")));
> gbyTimeoutFlag=1;
> }
> else
> {
> RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread else of
> WaitForSingleObject ! \r\n")));
> }
>
> RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread Value of
WaitForSingleObject
> =%x,!\r\n"), dwTemp));
> }
> }
>
>
>
>
> "Zhongwei Wang" wrote:
>
> > Why do you think the thread didn't work? Because you don't see
retailmsg "
> > Inside TimeoutThread!\r\n", no retailmsg at all?
> >
> > Wherenever you have a
> > if ( )
> > {
> > RETAILMSG
> > }
> >
> > Chang it to
> > if( )
> > {
> > RETAILMSG
> > }
> > else
> > RETAILMSG
> >
> > Print return value of WaitForSingleObject and add one more RETAILMSG at
the
> > beginning of TimeoutThread, then you will sure know how it went.
> >
> > --
> > Zhongwei Wang
> > Applied Data Systems
> > www.applieddata.net
> >
> >
> > "HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
> > news:FFF02965-FFD9-4397-A665-8873F5DB369D@microsoft.com...
> >
> >
> >



Re: Init IST by a DLL during boot time by HKAnson

HKAnson
Thu Jun 22 20:27:01 CDT 2006

Dear Bluesphere,
I modified my code and did sysgen again but it didn't work. Is there any
problem on setting thread procedure? Thanks for your reply.

"bluesphere" wrote:

> Try the right Thread Procedure
>
> DWORD WINAPI TimeoutThread(LPVOID lpParameter);
>
> instead of
>
> void TimeoutThread();
>
>
> "HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
> news:43EB460D-04FF-44E2-BAC7-1FBA69B02BF8@microsoft.com...
> > Dear Mr. Wang,
> > I tried to modify the code as followings. There are still no retailmsg
> in
> > the TimeoutThread.
> >
> > There are the retailmsg, during boot time.
> > TEST DLL: INSIDE TES_Init
> > DLL: Inside SetupTimeoutThread ResumeThread=1.
> > TEST DLL: EXIT TES_Init
> >
> > all these retailmsg are of BOOL SetupTimeoutThread(), instead of
> > TimeoutThread. Do you any idea? Thanks for your help.
> >
> >
> > void TimeoutThread()
> > {
> > DWORD dwTemp;
> > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread before
> while(1)!\r\n")));
> > while(1) {
> > dwTemp=WaitForSingleObject(g_hevInterruptTimeout, 200) ==WAIT_TIMEOUT;
> > if (dwTemp == WAIT_TIMEOUT){
> > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread!\r\n")));
> > gbyTimeoutFlag=1;
> > }
> > else
> > {
> > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread else of
> > WaitForSingleObject ! \r\n")));
> > }
> >
> > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread Value of
> WaitForSingleObject
> > =%x,!\r\n"), dwTemp));
> > }
> > }
> >
> >
> >
> >
> > "Zhongwei Wang" wrote:
> >
> > > Why do you think the thread didn't work? Because you don't see
> retailmsg "
> > > Inside TimeoutThread!\r\n", no retailmsg at all?
> > >
> > > Wherenever you have a
> > > if ( )
> > > {
> > > RETAILMSG
> > > }
> > >
> > > Chang it to
> > > if( )
> > > {
> > > RETAILMSG
> > > }
> > > else
> > > RETAILMSG
> > >
> > > Print return value of WaitForSingleObject and add one more RETAILMSG at
> the
> > > beginning of TimeoutThread, then you will sure know how it went.
> > >
> > > --
> > > Zhongwei Wang
> > > Applied Data Systems
> > > www.applieddata.net
> > >
> > >
> > > "HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
> > > news:FFF02965-FFD9-4397-A665-8873F5DB369D@microsoft.com...
> > >
> > >
> > >
>
>
>

Re: Init IST by a DLL during boot time by bluesphere

bluesphere
Fri Jun 23 03:09:30 CDT 2006

As a test, try to (manually) load your driver after the system has done the
boot.
Also check the return value of ResumeThread


"HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
news:A8A4D995-A528-4DF7-9BCF-671ADDD80782@microsoft.com...
> Dear Bluesphere,
> I modified my code and did sysgen again but it didn't work. Is there
any
> problem on setting thread procedure? Thanks for your reply.
>
> "bluesphere" wrote:
>
> > Try the right Thread Procedure
> >
> > DWORD WINAPI TimeoutThread(LPVOID lpParameter);
> >
> > instead of
> >
> > void TimeoutThread();
> >
> >
> > "HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
> > news:43EB460D-04FF-44E2-BAC7-1FBA69B02BF8@microsoft.com...
> > > Dear Mr. Wang,
> > > I tried to modify the code as followings. There are still no
retailmsg
> > in
> > > the TimeoutThread.
> > >
> > > There are the retailmsg, during boot time.
> > > TEST DLL: INSIDE TES_Init
> > > DLL: Inside SetupTimeoutThread ResumeThread=1.
> > > TEST DLL: EXIT TES_Init
> > >
> > > all these retailmsg are of BOOL SetupTimeoutThread(), instead of
> > > TimeoutThread. Do you any idea? Thanks for your help.
> > >
> > >
> > > void TimeoutThread()
> > > {
> > > DWORD dwTemp;
> > > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread before
> > while(1)!\r\n")));
> > > while(1) {
> > > dwTemp=WaitForSingleObject(g_hevInterruptTimeout, 200)
==WAIT_TIMEOUT;
> > > if (dwTemp == WAIT_TIMEOUT){
> > > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread!\r\n")));
> > > gbyTimeoutFlag=1;
> > > }
> > > else
> > > {
> > > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread else of
> > > WaitForSingleObject ! \r\n")));
> > > }
> > >
> > > RETAILMSG (1, (TEXT("DLL: Inside TimeoutThread Value of
> > WaitForSingleObject
> > > =%x,!\r\n"), dwTemp));
> > > }
> > > }
> > >
> > >
> > >
> > >
> > > "Zhongwei Wang" wrote:
> > >
> > > > Why do you think the thread didn't work? Because you don't see
> > retailmsg "
> > > > Inside TimeoutThread!\r\n", no retailmsg at all?
> > > >
> > > > Wherenever you have a
> > > > if ( )
> > > > {
> > > > RETAILMSG
> > > > }
> > > >
> > > > Chang it to
> > > > if( )
> > > > {
> > > > RETAILMSG
> > > > }
> > > > else
> > > > RETAILMSG
> > > >
> > > > Print return value of WaitForSingleObject and add one more RETAILMSG
at
> > the
> > > > beginning of TimeoutThread, then you will sure know how it went.
> > > >
> > > > --
> > > > Zhongwei Wang
> > > > Applied Data Systems
> > > > www.applieddata.net
> > > >
> > > >
> > > > "HKAnson" <HKAnson@discussions.microsoft.com> wrote in message
> > > > news:FFF02965-FFD9-4397-A665-8873F5DB369D@microsoft.com...
> > > >
> > > >
> > > >
> >
> >
> >