开发者

Has anyone used RemoteWipe in Windows Mobile?

开发者 https://www.devze.com 2022-12-15 01:06 出处:网络
I just got my Treo and noting the lack of a software reset (the need to use the stylus on the reset button really annoys me), I decided to build my own.

I just got my Treo and noting the lack of a software reset (the need to use the stylus on the reset button really annoys me), I decided to build my own.

The R开发者_如何转开发eset and Suspend part of my little program works like a charm and then I decided to improve a little more and add a Hard Reset feature, which would restore the device to its factory settings.

Searching high and low on the net I found two possible ways. The first one involved calling SetCleanRebootFlag() and then reset the device.

[DllImport("coredll.dll", SetLastError=true)]
public static extern void SetCleanRebootFlag();

[DllImport("coredll.dll", SetLastError=true)]
private static extern int SetSystemPowerState(IntPtr psState, PowerStateFlags flags, uint Options);

[DllImport("coredll.dll", SetLastError=true)]
private static extern bool KernelIoControl(int dwIoControlCode, IntPtr inBuf, int inBufSize, IntPtr outBuf, int outBufSize, ref int bytesReturned);

public static void SoftReset()
{
    if (SetSystemPowerState(IntPtr.Zero, PowerStateFlags.Reset, 0x1000) != 0)
    {
        int bytesReturned = 0;
        if (!KernelIoControl(0x101003c, IntPtr.Zero, 0, IntPtr.Zero, 0, ref bytesReturned))
        {
            throw new Win32Exception(Marshal.GetLastWin32Error());
        }
    }
}

public static void HardReset()
{
    SetCleanRebootFlag();
    SoftReset();
}

The other involved using the ConfigurationManager to process a XML that would perform a "RemoteWipe".

public static void HardReset()
{
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<wap-provisioningdoc>" + 
                    "<characteristic type='RemoteWipe'>" + 
                        "<parm name='doWipe' value='1'/>" +
                    "</characteristic>" +
                "</wap-provisioningdoc>");
    ConfigurationManager.ProcessConfiguration(doc, true);
}

The first method didn't work because after Windows Mobile 5 it ignores the CleanBootFlag; the second method worked... too much.

It corrupted the microSD on the device to the point that it needed to be reformatted in order to be recognized again.

Does anyone had any experience with that?


Edited to add: Unfortunately the answer to my question is exactly like Paul Betts said. To quote MSDN

The RemoteWipe Configuration Service Provider enables mobile operators to remotely wipe a device. RemoteWipe Configuration Service Provider will make the data stored in memory, storage cards, and hard disks difficult to recover if the device is remotely wiped after being lost or stolen.


Isn't this what Remote Wipe is supposed to do?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号