From: "Paul G. Tobey [eMVP]" p space tobey no spam AT no instrument no spam DOT on
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:OF2qq2w5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
> 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" <nxpavesi(a)tin.it> wrote in message
> news:u6V9I0w5GHA.4608(a)TK2MSFTNGP03.phx.gbl...
>> 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
>> news:ug3LUIv5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>>> 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" <nxpavesi(a)tin.it> wrote in message
>>> news:%23hrHKnu5GHA.4644(a)TK2MSFTNGP04.phx.gbl...
>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>> news:%23f4dIit5GHA.4476(a)TK2MSFTNGP04.phx.gbl...
>>>>> 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/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfStartWatchDogTimer.asp
>>>>>
>>>>> Cheers
>>>>> Daniel
>>>>> --
>>>>> http://www.danielmoth.com/Blog/
>>>>>
>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>> news:eM7Dfls5GHA.1200(a)TK2MSFTNGP02.phx.gbl...
>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>> news:%23RKx%23%23f5GHA.5072(a)TK2MSFTNGP05.phx.gbl...
>>>>>>>> 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/
>>>>>>>
>>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>>> news:%23BMBi7e5GHA.668(a)TK2MSFTNGP02.phx.gbl...
>>>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>>>> news:O9qanbL5GHA.4536(a)TK2MSFTNGP06.phx.gbl...
>>>>>>>>> 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/
>>>>>>>>>
>>>>>>>>> "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message
>>>>>>>>> news:OlNQ0K84GHA.512(a)TK2MSFTNGP06.phx.gbl...
>>>>>>>>>> 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
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>>>>>> news:O5UWct64GHA.932(a)TK2MSFTNGP04.phx.gbl...
>>>>>>>>>>> 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
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


From: " ctacke/>" on
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:OF2qq2w5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
> 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" <nxpavesi(a)tin.it> wrote in message
> news:u6V9I0w5GHA.4608(a)TK2MSFTNGP03.phx.gbl...
>> 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
>> news:ug3LUIv5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>>> 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" <nxpavesi(a)tin.it> wrote in message
>>> news:%23hrHKnu5GHA.4644(a)TK2MSFTNGP04.phx.gbl...
>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>> news:%23f4dIit5GHA.4476(a)TK2MSFTNGP04.phx.gbl...
>>>>> 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/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfStartWatchDogTimer.asp
>>>>>
>>>>> Cheers
>>>>> Daniel
>>>>> --
>>>>> http://www.danielmoth.com/Blog/
>>>>>
>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>> news:eM7Dfls5GHA.1200(a)TK2MSFTNGP02.phx.gbl...
>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>> news:%23RKx%23%23f5GHA.5072(a)TK2MSFTNGP05.phx.gbl...
>>>>>>>> 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/
>>>>>>>
>>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>>> news:%23BMBi7e5GHA.668(a)TK2MSFTNGP02.phx.gbl...
>>>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>>>> news:O9qanbL5GHA.4536(a)TK2MSFTNGP06.phx.gbl...
>>>>>>>>> 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/
>>>>>>>>>
>>>>>>>>> "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message
>>>>>>>>> news:OlNQ0K84GHA.512(a)TK2MSFTNGP06.phx.gbl...
>>>>>>>>>> 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
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>>>>>> news:O5UWct64GHA.932(a)TK2MSFTNGP04.phx.gbl...
>>>>>>>>>>> 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
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


From: Enrico Pavesi on
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
news:%23CRgUCx5GHA.4276(a)TK2MSFTNGP04.phx.gbl...
> 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:OF2qq2w5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>> 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" <nxpavesi(a)tin.it> wrote in message
>> news:u6V9I0w5GHA.4608(a)TK2MSFTNGP03.phx.gbl...
>>> 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
>>> news:ug3LUIv5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>>>> 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" <nxpavesi(a)tin.it> wrote in message
>>>> news:%23hrHKnu5GHA.4644(a)TK2MSFTNGP04.phx.gbl...
>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>> news:%23f4dIit5GHA.4476(a)TK2MSFTNGP04.phx.gbl...
>>>>>> 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/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfStartWatchDogTimer.asp
>>>>>>
>>>>>> Cheers
>>>>>> Daniel
>>>>>> --
>>>>>> http://www.danielmoth.com/Blog/
>>>>>>
>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>> news:eM7Dfls5GHA.1200(a)TK2MSFTNGP02.phx.gbl...
>>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>>> news:%23RKx%23%23f5GHA.5072(a)TK2MSFTNGP05.phx.gbl...
>>>>>>>>> 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/
>>>>>>>>
>>>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>>>> news:%23BMBi7e5GHA.668(a)TK2MSFTNGP02.phx.gbl...
>>>>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>>>>> news:O9qanbL5GHA.4536(a)TK2MSFTNGP06.phx.gbl...
>>>>>>>>>> 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-de
From: " ctacke/>" on
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" <nxpavesi(a)tin.it> wrote in message
news:OQdmBoI6GHA.4840(a)TK2MSFTNGP06.phx.gbl...
>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
> news:%23CRgUCx5GHA.4276(a)TK2MSFTNGP04.phx.gbl...
>> 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:OF2qq2w5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>>> 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" <nxpavesi(a)tin.it> wrote in message
>>> news:u6V9I0w5GHA.4608(a)TK2MSFTNGP03.phx.gbl...
>>>> 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
>>>> news:ug3LUIv5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>>>>> 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" <nxpavesi(a)tin.it> wrote in message
>>>>> news:%23hrHKnu5GHA.4644(a)TK2MSFTNGP04.phx.gbl...
>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>> news:%23f4dIit5GHA.4476(a)TK2MSFTNGP04.phx.gbl...
>>>>>>> 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/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfStartWatchDogTimer.asp
>>>>>>>
>>>>>>> Cheers
>>>>>>> Daniel
>>>>>>> --
>>>>>>> http://www.danielmoth.com/Blog/
>>>>>>>
>>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>>> news:eM7Dfls5GHA.1200(a)TK2MSFTNGP02.phx.gbl...
>>>>>>>> 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" <dmoth74(a)hotmail.com> ha scritto nel messaggio
>>>>>>>> news:%23RKx%23%23f5GHA.5072(a)TK2MSFTNGP05.phx.gbl...
>>>>>>>>>> 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/
>>>>>>>>>
>>>>>>>>> "Enrico Pavesi" <nxpavesi(a)tin.it> wrote in message
>>>>>>>>> news:%23BMBi7e5GHA.668(a)TK2MSFTNGP02.phx.gbl...
>>>>>>>>>> Thanks..but i wanted, for one time, to reuse a feature instead of
From: Enrico Pavesi on
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);

}




"<ctacke/>" <ctacke[@]opennetcf[dot]com> ha scritto nel messaggio
news:%23ipNZzI6GHA.4500(a)TK2MSFTNGP02.phx.gbl...
> 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" <nxpavesi(a)tin.it> wrote in message
> news:OQdmBoI6GHA.4840(a)TK2MSFTNGP06.phx.gbl...
>>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
>> news:%23CRgUCx5GHA.4276(a)TK2MSFTNGP04.phx.gbl...
>>> 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