CreateWatchDogTimer in CF

E

Enrico Pavesi

I'm inetersted in using CreateWatchDogTimer from a CF application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
G

Guest

That is 100% depenedent on the hardward. CE 5.0 did add a standard
KernelIoControl for it, but it's up to the OEM to decide if it is
implemented or not. If it is implemented, and it is done in
KernelIoControl, then you simply need to P/Invoke that single API.
 
E

Enrico Pavesi

Thanks..but i wanted, for one time, to reuse a feature instead of
reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have this api....

is there smething ready in your knowledge?

Thx
 
D

Daniel Moth

is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality OOB,
implementing it yourself as suggested by my blog entry seems to be the only
choice... good luck!

Cheers
Daniel
 
E

Enrico Pavesi

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular procedure?

Thanks
 
E

Enrico Pavesi

Yes but when you describe the implementation:1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go wrong
in the OS), our unit resets.
any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int dwParam,
int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer' in a
PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks
 
G

Guest

That's because it's not an exported function of coredll.dll. It's an inline
in pkfuncs.h (line 1028 to be exact) that makes a KernelIoControl call
passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Enrico Pavesi said:
Yes but when you describe the implementation:1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go wrong
in the OS), our unit resets.
any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int dwParam,
int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer' in a
PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks
 
E

Enrico Pavesi

Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a KernelIoControl
call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Enrico Pavesi said:
Yes but when you describe the implementation:1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.
any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int dwParam,
int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer' in a
PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


Daniel Moth said:
What makes you think I've used it? The blog post describes a "roll your
own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality OOB,
implementing it yourself as suggested by my blog entry seems to be the
only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead of
reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have this
api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog approach
independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a standard
KernelIoControl for it, but it's up to the OEM to decide if it is
implemented or not. If it is implemented, and it is done in
KernelIoControl, then you simply need to P/Invoke that single API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
P

Paul G. Tobey [eMVP]

Legally, no. That's a violation of the license, as I read it, anyway. You
can download the Windows CE 5.0 Evaluation Edition with Platform Builder
from www.microsoft.com/downloads and get it from there (you'll have to read
the license and interpret if using a file received *that* way is OK or not;
hope you're a lawyer).

Paul T.

Enrico Pavesi said:
Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a KernelIoControl
call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Enrico Pavesi said:
Yes but when you describe the implementation:

1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.


any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int
dwParam, int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer' in a
PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


"Daniel Moth" <[email protected]> ha scritto nel messaggio
What makes you think I've used it? The blog post describes a "roll your
own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality
OOB, implementing it yourself as suggested by my blog entry seems to
be the only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead of
reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have this
api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog approach
independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a
standard KernelIoControl for it, but it's up to the OEM to decide
if it is implemented or not. If it is implemented, and it is done
in KernelIoControl, then you simply need to P/Invoke that single
API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
P

Paul G. Tobey [eMVP]

Now that I think about it, using the evaluation edition isn't a problem.
You're just creating managed code wrappers by reading the header; you're not
even using it directly and you're not linking with any libraries... No
problem.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
Legally, no. That's a violation of the license, as I read it, anyway.
You can download the Windows CE 5.0 Evaluation Edition with Platform
Builder from www.microsoft.com/downloads and get it from there (you'll
have to read the license and interpret if using a file received *that* way
is OK or not; hope you're a lawyer).

Paul T.

Enrico Pavesi said:
Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a KernelIoControl
call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Yes but when you describe the implementation:

1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.


any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int
dwParam, int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer' in
a PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


"Daniel Moth" <[email protected]> ha scritto nel messaggio
What makes you think I've used it? The blog post describes a "roll
your own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality
OOB, implementing it yourself as suggested by my blog entry seems to
be the only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead of
reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have
this api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog approach
independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a
standard KernelIoControl for it, but it's up to the OEM to decide
if it is implemented or not. If it is implemented, and it is
done in KernelIoControl, then you simply need to P/Invoke that
single API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
G

Guest

Agreed. The license prohibits anyone posting or sending it to you. Get the
PB eval (I'd recommend ordering instead of downloading the several GB of
data that seem to get corrupted often).

-Chris


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
Legally, no. That's a violation of the license, as I read it, anyway.
You can download the Windows CE 5.0 Evaluation Edition with Platform
Builder from www.microsoft.com/downloads and get it from there (you'll
have to read the license and interpret if using a file received *that* way
is OK or not; hope you're a lawyer).

Paul T.

Enrico Pavesi said:
Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a KernelIoControl
call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Yes but when you describe the implementation:

1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.


any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int
dwParam, int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer' in
a PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


"Daniel Moth" <[email protected]> ha scritto nel messaggio
What makes you think I've used it? The blog post describes a "roll
your own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality
OOB, implementing it yourself as suggested by my blog entry seems to
be the only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead of
reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have
this api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog approach
independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a
standard KernelIoControl for it, but it's up to the OEM to decide
if it is implemented or not. If it is implemented, and it is
done in KernelIoControl, then you simply need to P/Invoke that
single API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
E

Enrico Pavesi

I have the definition, and the result is:

[DllImport("coredll.dll", SetLastError = true)]
public static extern IntPtr KernelLibIoControl(IntPtr hLib, uint
dwIoControlCode, ref WDAPIStruct lpInBuf, uint nInBufSize, IntPtr lpOutBuf,
uint nOutBufSize, IntPtr lpBytesReturned);
[StructLayout(LayoutKind.Sequential)]
public struct WDAPIStruct
{
[MarshalAs(UnmanagedType.AsAny)]
public byte[] watchdog; // name (in create/open) or handle (in other) of the
watchdog
public uint dwPeriod; // watchdog period
public uint dwWait; // wait time before default action taken
public uint dwDfltAction; // default action
public uint dwParam; // param passed to IOCTL_HAL_REBOOT if reset is the
default action
public uint dwFlags; // flags
}
//
//// watchdog APIs
////
public const uint WDAPI_CREATE = 0;
public const uint WDAPI_START = 2;
public const uint IOCTL_KLIB_WDOGAPI = 19; // watchdog timer APIs
public const int KMOD_CORE = 1; //
IntPtr CreateWatchDogTimer (
string pszWatchDogName,
uint dwPeriod,
uint dwWait,
uint dwDfltAction,
uint dwParam,
uint dwFlags)
{
WDAPIStruct wdas = new WDAPIStruct();
wdas.watchdog = Encoding.ASCII.GetBytes(pszWatchDogName);
wdas.dwPeriod = dwPeriod;
wdas.dwWait = dwWait;
wdas.dwDfltAction = dwDfltAction;
wdas.dwParam = dwParam;
wdas.dwFlags = dwFlags;
return (IntPtr)KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref
wdas, (uint)24,IntPtr.Zero, WDAPI_CREATE, IntPtr.Zero);
}

But it Throws a NotAupportedException...
does it means is not there or something wrong in the marshall?

Thanks


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> ha scritto nel messaggio
Now that I think about it, using the evaluation edition isn't a problem.
You're just creating managed code wrappers by reading the header; you're
not even using it directly and you're not linking with any libraries...
No problem.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
Legally, no. That's a violation of the license, as I read it, anyway.
You can download the Windows CE 5.0 Evaluation Edition with Platform
Builder from www.microsoft.com/downloads and get it from there (you'll
have to read the license and interpret if using a file received *that*
way is OK or not; hope you're a lawyer).

Paul T.

Enrico Pavesi said:
Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

"<ctacke/>" <ctacke[@]opennetcf[dot]com> ha scritto nel messaggio
That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a
KernelIoControl call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Yes but when you describe the implementation:

1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.


any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int
dwParam, int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer' in
a PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


"Daniel Moth" <[email protected]> ha scritto nel messaggio
What makes you think I've used it? The blog post describes a "roll
your own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality
OOB, implementing it yourself as suggested by my blog entry seems
to be the only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead of
reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have
this api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog
approach independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a
standard KernelIoControl for it, but it's up to the OEM to
decide if it is implemented or not. If it is implemented, and
it is done in KernelIoControl, then you simply need to P/Invoke
that single API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
G

Guest

It can't marshal an unknown length byte array. It should be an Intptr that
you manually point to something (with a GCHandle perhaps).


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



Enrico Pavesi said:
I have the definition, and the result is:

[DllImport("coredll.dll", SetLastError = true)]
public static extern IntPtr KernelLibIoControl(IntPtr hLib, uint
dwIoControlCode, ref WDAPIStruct lpInBuf, uint nInBufSize, IntPtr
lpOutBuf, uint nOutBufSize, IntPtr lpBytesReturned);
[StructLayout(LayoutKind.Sequential)]
public struct WDAPIStruct
{
[MarshalAs(UnmanagedType.AsAny)]
public byte[] watchdog; // name (in create/open) or handle (in other) of
the watchdog
public uint dwPeriod; // watchdog period
public uint dwWait; // wait time before default action taken
public uint dwDfltAction; // default action
public uint dwParam; // param passed to IOCTL_HAL_REBOOT if reset is the
default action
public uint dwFlags; // flags
}
//
//// watchdog APIs
////
public const uint WDAPI_CREATE = 0;
public const uint WDAPI_START = 2;
public const uint IOCTL_KLIB_WDOGAPI = 19; // watchdog timer APIs
public const int KMOD_CORE = 1; //
IntPtr CreateWatchDogTimer (
string pszWatchDogName,
uint dwPeriod,
uint dwWait,
uint dwDfltAction,
uint dwParam,
uint dwFlags)
{
WDAPIStruct wdas = new WDAPIStruct();
wdas.watchdog = Encoding.ASCII.GetBytes(pszWatchDogName);
wdas.dwPeriod = dwPeriod;
wdas.dwWait = dwWait;
wdas.dwDfltAction = dwDfltAction;
wdas.dwParam = dwParam;
wdas.dwFlags = dwFlags;
return (IntPtr)KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI,
ref wdas, (uint)24,IntPtr.Zero, WDAPI_CREATE, IntPtr.Zero);
}

But it Throws a NotAupportedException...
does it means is not there or something wrong in the marshall?

Thanks


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> ha scritto nel messaggio
Now that I think about it, using the evaluation edition isn't a problem.
You're just creating managed code wrappers by reading the header; you're
not even using it directly and you're not linking with any libraries...
No problem.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
Legally, no. That's a violation of the license, as I read it, anyway.
You can download the Windows CE 5.0 Evaluation Edition with Platform
Builder from www.microsoft.com/downloads and get it from there (you'll
have to read the license and interpret if using a file received *that*
way is OK or not; hope you're a lawyer).

Paul T.

Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

"<ctacke/>" <ctacke[@]opennetcf[dot]com> ha scritto nel messaggio
That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a
KernelIoControl call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Yes but when you describe the implementation:

1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.


any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int
dwParam, int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer'
in a PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


"Daniel Moth" <[email protected]> ha scritto nel messaggio
What makes you think I've used it? The blog post describes a "roll
your own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality
OOB, implementing it yourself as suggested by my blog entry seems
to be the only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead of
reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have
this api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog
approach independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a
standard KernelIoControl for it, but it's up to the OEM to
decide if it is implemented or not. If it is implemented, and
it is done in KernelIoControl, then you simply need to P/Invoke
that single API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
E

Enrico Pavesi

Thanks to all.... this is working for me (if someone need it):

[DllImport("coredll.dll", SetLastError = true)]

public static extern IntPtr KernelLibIoControl(IntPtr hLib, uint
dwIoControlCode, ref WDAPIStruct lpInBuf, uint nInBufSize, IntPtr lpOutBuf,
uint nOutBufSize, IntPtr lpBytesReturned);

[StructLayout(LayoutKind.Sequential)]

public struct WDAPIStruct

{

public IntPtr watchdog; // name (in create/open) or handle (in other) of the
watchdog

public uint dwPeriod; // watchdog period

public uint dwWait; // wait time before default action taken

public uint dwDfltAction; // default action

public uint dwParam; // param passed to IOCTL_HAL_REBOOT if reset is the
default action

public uint dwFlags; // flags

}

//

// watchdog default actions

//

public const uint WDOG_NO_DFLT_ACTION = 0;

public const uint WDOG_KILL_PROCESS = 1;

public const uint WDOG_RESET_DEVICE = 2;

//#define WD_TOTAL_DFLT_ACTION 3

////

//// watchdog APIs

////

public const uint WDAPI_CREATE = 0;

public const uint WDAPI_OPEN = 1;

public const uint WDAPI_START = 2;

public const uint WDAPI_STOP = 3;

public const uint WDAPI_REFRESH = 4;

public const uint IOCTL_KLIB_WDOGAPI = 19; // watchdog timer APIs

public const int KMOD_CORE = 1; //

public static IntPtr CreateWatchDogTimer(

string pszWatchDogName,

uint dwPeriod,

uint dwWait,

uint dwDfltAction,

uint dwParam,

uint dwFlags)

{

WDAPIStruct wdas = new WDAPIStruct();

GCHandle G = GCHandle.Alloc(pszWatchDogName.ToCharArray(),
GCHandleType.Pinned);

// wdas.watchdog = Encoding.ASCII.GetBytes(pszWatchDogName);

wdas.watchdog = G.AddrOfPinnedObject();

wdas.dwPeriod = dwPeriod;

wdas.dwWait = dwWait;

wdas.dwDfltAction = dwDfltAction;

wdas.dwParam = dwParam;

wdas.dwFlags = dwFlags;

return (IntPtr)KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref
wdas, (uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_CREATE, IntPtr.Zero);

}

//_inline HANDLE OpenWatchDogTimer (LPCWSTR pszWatchDogName, DWORD dwFlags)

//{

// WDAPIStruct wdas = { pszWatchDogName, 0, 0, 0, 0, dwFlags };

// return (HANDLE) KernelLibIoControl((HANDLE) KMOD_CORE,
IOCTL_KLIB_WDOGAPI, &wdas, sizeof(wdas),

// NULL, WDAPI_OPEN, NULL);

//}

public static IntPtr StartWatchDogTimer(IntPtr hWatchDog, uint dwFlags)

{

//WDAPIStruct wdas = { hWatchDog, 0, 0, 0, 0, dwFlags };

WDAPIStruct wdas = new WDAPIStruct();

wdas.watchdog = hWatchDog;

wdas.dwPeriod = 0;

wdas.dwWait = 0;

wdas.dwDfltAction = 0;

wdas.dwParam = 0;

wdas.dwFlags = dwFlags;

return KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref wdas,
(uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_START, IntPtr.Zero);

//return KernelLibIoControl((HANDLE)KMOD_CORE, IOCTL_KLIB_WDOGAPI, &wdas,
sizeof(wdas),

// NULL, WDAPI_START, NULL);

}

public static IntPtr StopWatchDogTimer(IntPtr hWatchDog, uint dwFlags)

{

WDAPIStruct wdas = new WDAPIStruct();

wdas.watchdog = hWatchDog;

wdas.dwPeriod = 0;

wdas.dwWait = 0;

wdas.dwDfltAction = 0;

wdas.dwParam = 0;

wdas.dwFlags = dwFlags;

return KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref wdas,
(uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_STOP, IntPtr.Zero);

}

public static IntPtr RefreshWatchDogTimer(IntPtr hWatchDog, uint dwFlags)

{

WDAPIStruct wdas = new WDAPIStruct();

wdas.watchdog = hWatchDog;

wdas.dwPeriod = 0;

wdas.dwWait = 0;

wdas.dwDfltAction = 0;

wdas.dwParam = 0;

wdas.dwFlags = dwFlags;

return KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref wdas,
(uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_REFRESH, IntPtr.Zero);

}




It can't marshal an unknown length byte array. It should be an Intptr
that you manually point to something (with a GCHandle perhaps).


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



Enrico Pavesi said:
I have the definition, and the result is:

[DllImport("coredll.dll", SetLastError = true)]
public static extern IntPtr KernelLibIoControl(IntPtr hLib, uint
dwIoControlCode, ref WDAPIStruct lpInBuf, uint nInBufSize, IntPtr
lpOutBuf, uint nOutBufSize, IntPtr lpBytesReturned);
[StructLayout(LayoutKind.Sequential)]
public struct WDAPIStruct
{
[MarshalAs(UnmanagedType.AsAny)]
public byte[] watchdog; // name (in create/open) or handle (in other) of
the watchdog
public uint dwPeriod; // watchdog period
public uint dwWait; // wait time before default action taken
public uint dwDfltAction; // default action
public uint dwParam; // param passed to IOCTL_HAL_REBOOT if reset is the
default action
public uint dwFlags; // flags
}
//
//// watchdog APIs
////
public const uint WDAPI_CREATE = 0;
public const uint WDAPI_START = 2;
public const uint IOCTL_KLIB_WDOGAPI = 19; // watchdog timer APIs
public const int KMOD_CORE = 1; //
IntPtr CreateWatchDogTimer (
string pszWatchDogName,
uint dwPeriod,
uint dwWait,
uint dwDfltAction,
uint dwParam,
uint dwFlags)
{
WDAPIStruct wdas = new WDAPIStruct();
wdas.watchdog = Encoding.ASCII.GetBytes(pszWatchDogName);
wdas.dwPeriod = dwPeriod;
wdas.dwWait = dwWait;
wdas.dwDfltAction = dwDfltAction;
wdas.dwParam = dwParam;
wdas.dwFlags = dwFlags;
return (IntPtr)KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI,
ref wdas, (uint)24,IntPtr.Zero, WDAPI_CREATE, IntPtr.Zero);
}

But it Throws a NotAupportedException...
does it means is not there or something wrong in the marshall?

Thanks


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> ha scritto nel messaggio
Now that I think about it, using the evaluation edition isn't a problem.
You're just creating managed code wrappers by reading the header; you're
not even using it directly and you're not linking with any libraries...
No problem.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message Legally, no. That's a violation of the license, as I read it, anyway.
You can download the Windows CE 5.0 Evaluation Edition with Platform
Builder from www.microsoft.com/downloads and get it from there (you'll
have to read the license and interpret if using a file received *that*
way is OK or not; hope you're a lawyer).

Paul T.

Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

"<ctacke/>" <ctacke[@]opennetcf[dot]com> ha scritto nel messaggio
That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a
KernelIoControl call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Yes but when you describe the implementation:

1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.


any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int
dwParam, int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer'
in a PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


"Daniel Moth" <[email protected]> ha scritto nel messaggio
What makes you think I've used it? The blog post describes a "roll
your own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality
OOB, implementing it yourself as suggested by my blog entry seems
to be the only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead
of reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have
this api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog
approach independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a
standard KernelIoControl for it, but it's up to the OEM to
decide if it is implemented or not. If it is implemented, and
it is done in KernelIoControl, then you simply need to
P/Invoke that single API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 
J

james.pierce

Hi,

Im looking into this also.

I have a question on the actions that can be taken. I see only 3
actions (listed below)
public const uint WDOG_NO_DFLT_ACTION = 0;

public const uint WDOG_KILL_PROCESS = 1;

public const uint WDOG_RESET_DEVICE = 2;

When I set the action to WDOG_RESET_DEVICE, my device does a cold
reset. I was hoping it would do a warm reset. Is there a way to change
the reset to warm instead of cold or can I create my own default
actions to be taken.

Thanks!!!

---



Enrico said:
Thanks to all.... this is working for me (if someone need it):

[DllImport("coredll.dll", SetLastError = true)]

public static extern IntPtr KernelLibIoControl(IntPtr hLib, uint
dwIoControlCode, ref WDAPIStruct lpInBuf, uint nInBufSize, IntPtr lpOutBuf,
uint nOutBufSize, IntPtr lpBytesReturned);

[StructLayout(LayoutKind.Sequential)]

public struct WDAPIStruct

{

public IntPtr watchdog; // name (in create/open) or handle (in other) of the
watchdog

public uint dwPeriod; // watchdog period

public uint dwWait; // wait time before default action taken

public uint dwDfltAction; // default action

public uint dwParam; // param passed to IOCTL_HAL_REBOOT if reset is the
default action

public uint dwFlags; // flags

}

//

// watchdog default actions

//

public const uint WDOG_NO_DFLT_ACTION = 0;

public const uint WDOG_KILL_PROCESS = 1;

public const uint WDOG_RESET_DEVICE = 2;

//#define WD_TOTAL_DFLT_ACTION 3

////

//// watchdog APIs

////

public const uint WDAPI_CREATE = 0;

public const uint WDAPI_OPEN = 1;

public const uint WDAPI_START = 2;

public const uint WDAPI_STOP = 3;

public const uint WDAPI_REFRESH = 4;

public const uint IOCTL_KLIB_WDOGAPI = 19; // watchdog timer APIs

public const int KMOD_CORE = 1; //

public static IntPtr CreateWatchDogTimer(

string pszWatchDogName,

uint dwPeriod,

uint dwWait,

uint dwDfltAction,

uint dwParam,

uint dwFlags)

{

WDAPIStruct wdas = new WDAPIStruct();

GCHandle G = GCHandle.Alloc(pszWatchDogName.ToCharArray(),
GCHandleType.Pinned);

// wdas.watchdog = Encoding.ASCII.GetBytes(pszWatchDogName);

wdas.watchdog = G.AddrOfPinnedObject();

wdas.dwPeriod = dwPeriod;

wdas.dwWait = dwWait;

wdas.dwDfltAction = dwDfltAction;

wdas.dwParam = dwParam;

wdas.dwFlags = dwFlags;

return (IntPtr)KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref
wdas, (uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_CREATE, IntPtr.Zero);

}

//_inline HANDLE OpenWatchDogTimer (LPCWSTR pszWatchDogName, DWORD dwFlags)

//{

// WDAPIStruct wdas = { pszWatchDogName, 0, 0, 0, 0, dwFlags };

// return (HANDLE) KernelLibIoControl((HANDLE) KMOD_CORE,
IOCTL_KLIB_WDOGAPI, &wdas, sizeof(wdas),

// NULL, WDAPI_OPEN, NULL);

//}

public static IntPtr StartWatchDogTimer(IntPtr hWatchDog, uint dwFlags)

{

//WDAPIStruct wdas = { hWatchDog, 0, 0, 0, 0, dwFlags };

WDAPIStruct wdas = new WDAPIStruct();

wdas.watchdog = hWatchDog;

wdas.dwPeriod = 0;

wdas.dwWait = 0;

wdas.dwDfltAction = 0;

wdas.dwParam = 0;

wdas.dwFlags = dwFlags;

return KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref wdas,
(uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_START, IntPtr.Zero);

//return KernelLibIoControl((HANDLE)KMOD_CORE, IOCTL_KLIB_WDOGAPI, &wdas,
sizeof(wdas),

// NULL, WDAPI_START, NULL);

}

public static IntPtr StopWatchDogTimer(IntPtr hWatchDog, uint dwFlags)

{

WDAPIStruct wdas = new WDAPIStruct();

wdas.watchdog = hWatchDog;

wdas.dwPeriod = 0;

wdas.dwWait = 0;

wdas.dwDfltAction = 0;

wdas.dwParam = 0;

wdas.dwFlags = dwFlags;

return KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref wdas,
(uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_STOP, IntPtr.Zero);

}

public static IntPtr RefreshWatchDogTimer(IntPtr hWatchDog, uint dwFlags)

{

WDAPIStruct wdas = new WDAPIStruct();

wdas.watchdog = hWatchDog;

wdas.dwPeriod = 0;

wdas.dwWait = 0;

wdas.dwDfltAction = 0;

wdas.dwParam = 0;

wdas.dwFlags = dwFlags;

return KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI, ref wdas,
(uint)Marshal.SizeOf(wdas), IntPtr.Zero, WDAPI_REFRESH, IntPtr.Zero);

}




It can't marshal an unknown length byte array. It should be an Intptr
that you manually point to something (with a GCHandle perhaps).


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



Enrico Pavesi said:
I have the definition, and the result is:

[DllImport("coredll.dll", SetLastError = true)]
public static extern IntPtr KernelLibIoControl(IntPtr hLib, uint
dwIoControlCode, ref WDAPIStruct lpInBuf, uint nInBufSize, IntPtr
lpOutBuf, uint nOutBufSize, IntPtr lpBytesReturned);
[StructLayout(LayoutKind.Sequential)]
public struct WDAPIStruct
{
[MarshalAs(UnmanagedType.AsAny)]
public byte[] watchdog; // name (in create/open) or handle (in other) of
the watchdog
public uint dwPeriod; // watchdog period
public uint dwWait; // wait time before default action taken
public uint dwDfltAction; // default action
public uint dwParam; // param passed to IOCTL_HAL_REBOOT if reset is the
default action
public uint dwFlags; // flags
}
//
//// watchdog APIs
////
public const uint WDAPI_CREATE = 0;
public const uint WDAPI_START = 2;
public const uint IOCTL_KLIB_WDOGAPI = 19; // watchdog timer APIs
public const int KMOD_CORE = 1; //
IntPtr CreateWatchDogTimer (
string pszWatchDogName,
uint dwPeriod,
uint dwWait,
uint dwDfltAction,
uint dwParam,
uint dwFlags)
{
WDAPIStruct wdas = new WDAPIStruct();
wdas.watchdog = Encoding.ASCII.GetBytes(pszWatchDogName);
wdas.dwPeriod = dwPeriod;
wdas.dwWait = dwWait;
wdas.dwDfltAction = dwDfltAction;
wdas.dwParam = dwParam;
wdas.dwFlags = dwFlags;
return (IntPtr)KernelLibIoControl((IntPtr)KMOD_CORE, IOCTL_KLIB_WDOGAPI,
ref wdas, (uint)24,IntPtr.Zero, WDAPI_CREATE, IntPtr.Zero);
}

But it Throws a NotAupportedException...
does it means is not there or something wrong in the marshall?

Thanks


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> ha scritto nel messaggio
Now that I think about it, using the evaluation edition isn't a problem.
You're just creating managed code wrappers by reading the header; you're
not even using it directly and you're not linking with any libraries...
No problem.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message Legally, no. That's a violation of the license, as I read it, anyway.
You can download the Windows CE 5.0 Evaluation Edition with Platform
Builder from www.microsoft.com/downloads and get it from there (you'll
have to read the license and interpret if using a file received *that*
way is OK or not; hope you're a lawyer).

Paul T.

Thanks ....
one last thing...can someone send the pkfuncs.h of CE 5.0

Thanks again

"<ctacke/>" <ctacke[@]opennetcf[dot]com> ha scritto nel messaggio
That's because it's not an exported function of coredll.dll. It's an
inline in pkfuncs.h (line 1028 to be exact) that makes a
KernelIoControl call passing in a WDAPIStruct.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--




Yes but when you describe the implementation:

1. The dog itself kicks the hardware watchdog on our unit. So should
anything go wrong with that process (effectively should something go
wrong in the OS), our unit resets.


any way i'have defined the function like this:
[DllImport("coredll.dll")]
public static extern IntPtr CreateWatchDogTimer(string
pszWatchDogName, int dwPeriod, int dwWait, int dwDfltAction, int
dwParam, int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean StartWatchDogTimer(IntPtr
hWatchDog,int dwFlags);
[DllImport("coredll.dll")]
public static extern Boolean RefreshWatchDogTimer(IntPtr
hWatchDog,int dwFlags);

At runtime it says Can't find an Entry Point 'CreateWatchDogTimer'
in a PInvoke DLL 'coredll.dll'.

Does it means is not there?

Thanks


"Daniel Moth" <[email protected]> ha scritto nel messaggio
What makes you think I've used it? The blog post describes a "roll
your own" mechanism that I used on our 4.2 device back then...

Check the documentation for further questions:
http://msdn.microsoft.com/library/d...cecoreos5/html/wce50lrfStartWatchDogTimer.asp

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Do you have to "trust" your application in some way to use
CreateWatchDogTimer ?
I have seen in your blog that you have used it. Some particular
procedure?

Thanks

"Daniel Moth" <[email protected]> ha scritto nel messaggio
is there smething ready in your knowledge?
Sorry, not to my knowledge. Since you can't get the functionality
OOB, implementing it yourself as suggested by my blog entry seems
to be the only choice... good luck!

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Thanks..but i wanted, for one time, to reuse a feature instead
of reimplementing it...
unfortunately the hardware i'm using (Gotive) seems not to have
this api....

is there smething ready in your knowledge?

Thx


"Daniel Moth" <[email protected]> ha scritto nel messaggio
Also, you may want to check out this for generic watchdog
approach independent of WinCE 5.0:
http://www.danielmoth.com/Blog/2004/12/watchdog-design-for-cf-app.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

That is 100% depenedent on the hardward. CE 5.0 did add a
standard KernelIoControl for it, but it's up to the OEM to
decide if it is implemented or not. If it is implemented, and
it is done in KernelIoControl, then you simply need to
P/Invoke that single API.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


I'm inetersted in using CreateWatchDogTimer from a CF
application.

Do someone has the correct PInvoke or class.
Is it present on every WINCE 5.0 device?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top