-
October 8th, 2015, 10:21 AM
#1
Windows CE restart every 24 hours
Hello,
I want to restart my Windows CE Controller every 24 hours because my Webserver applications has run out of memory and a restart will fix the problem.
I read that I have to put an EXE file for it in the Windows Startup folder. Which code I need to generate the EXE File.
Or are there any other solutions?
Thanks
Bye
-
October 8th, 2015, 11:05 AM
#2
Re: Windows CE restart every 24 hours
What version is CE is it?
Do you have the ability to "remote run" an application on the device? Or even put new files on the device?
gg
-
October 9th, 2015, 01:24 AM
#3
Re: Windows CE restart every 24 hours
The version is Windows Embedded Compact 7.
I only have the option to make a remote via network with the program CERHOST.EXE
gg
-
October 9th, 2015, 08:58 AM
#4
Re: Windows CE restart every 24 hours
gg is my signature
x86 or ARM? Do have an IDE to compile programs for your target?
gg
-
October 9th, 2015, 09:12 AM
#5
Re: Windows CE restart every 24 hours
I want to restart my Windows CE Controller every 24 hours because my Webserver applications has run out of memory
Isn't the real question why it keeps running out of memory? Is there a memory leak somewhere?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
October 9th, 2015, 09:50 AM
#6
Re: Windows CE restart every 24 hours
Originally Posted by 2kaud
Isn't the real question why it keeps running out of memory? Is there a memory leak somewhere?
That's what I was thinking. Regardless, restarting the program should be sufficient.
-
October 9th, 2015, 11:30 AM
#7
Re: Windows CE restart every 24 hours
May we ask if it is a homegrown solution or is it a commercially available product with a memory leak?
ahoodin
To keep the plot moving, that's why.
-
October 9th, 2015, 11:53 AM
#8
Re: Windows CE restart every 24 hours
Can you restart the webservice application?
-
October 12th, 2015, 02:26 AM
#9
Re: Windows CE restart every 24 hours
It's ARM and donÄt have an IDE yet.
Yes thats the right question but I checked it and it looks like the windows CE network connection. If there comes many network terminations (which is normal in WLAN networks) the webserver applications runs out of memory.
So the easiest way to fix the problem is to restart the controller every day at 00:00 am because the error comes every two days.
-
October 12th, 2015, 11:07 AM
#10
Re: Windows CE restart every 24 hours
The easiest solution is probably to get a wall socket timer: http://www.amazon.com/s/?ie=UTF8&key...l_6wo46poof5_b
There is no standard support for a programmatic "reboot" in CE. You would need that support in a "board SDK" provided by the OEM. (I forgot that's what I've been using on CE, but using ExitWindowsEx() for everything else...)
gg
-
October 12th, 2015, 11:36 AM
#11
Re: Windows CE restart every 24 hours
ahoodin
To keep the plot moving, that's why.
-
October 12th, 2015, 12:03 PM
#12
Re: Windows CE restart every 24 hours
Good find. Looks like SetSystemPowerState(NULL, POWER_STATE_RESET, 0) is the standard way to "reboot" in CE.
gg
-
October 13th, 2015, 01:12 AM
#13
Re: Windows CE restart every 24 hours
Thanks!
What do you think about it:
Code:
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <Pm.h>
int _tmain(int argc, _TCHAR* argv[])
{
SYSTEMTIME tSysTime;
GetSystemTime(&tSysTime);
if (tSysTime.wYear!= 2005)
{
int delay = 1000 *60 * 60 * 48;// 48 Hrs
Sleep(delay);
//windows Mobile
//ExitWindowsEx(2,0);
//windows CE
return (int)SetSystemPowerState(NULL, POWER_STATE_RESET, 0);
}
return 0;
}
Can I easly compile it with Dev-C++?
-
October 13th, 2015, 01:44 AM
#14
Re: Windows CE restart every 24 hours
or like this:
Code:
[DllImport("coredll.dll")]
private static extern bool KernelIoControl(Int32 IoControlCode, IntPtr InputBuffer, Int32 InputBufferSize, byte[] OutputBuffer, Int32 OutputBufferSize, ref Int32 BytesReturned);
private const uint FILE_DEVICE_HAL = 0x00000101;
private const uint METHOD_BUFFERED = 0;
private const uint FILE_ANY_ACCESS = 0;
private static uint CTL_CODE(uint DeviceType, uint Function, uint Method, uint Access)
{
return ((DeviceType << 16) | (Access << 14) | (Function << 2) | Method);
}
public static void softReset()
{
byte[] OutputBuffer = new byte[256];
Int32 OutputBufferSize, BytesReturned;
OutputBufferSize = OutputBuffer.Length;
BytesReturned = 0;
Int32 IOCTL_HAL_REBOOT = (Int32)CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS);
KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, OutputBuffer, OutputBufferSize, ref BytesReturned);
}
http://stackoverflow.com/questions/1...-with-emdk-2-6
Last edited by Dennis2015; October 13th, 2015 at 01:47 AM.
-
October 13th, 2015, 09:50 AM
#15
Re: Windows CE restart every 24 hours
For C++, you'll need a "board sdk" from the OEM. It will integrate with VS 2008 or higher. This will allow you to build targets for that device.
For .NET I have no idea.
gg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|