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