I’ve just writted this snippet of code!
Please compile with Microsoft Embedded Visual C++ 4.0 SP4 and run!
//
// TheResetter.cpp : Softreset your Windows Mobile PDA without KernelIOControl
//
#include "stdafx.h"
#include "tlhelp32.h"
#include "Winuser.h"
//
// The soft reset routine without using KernelIOControl
//
void SoftResetPDA ()
{
HANDLE hProcessSnap = NULL;
PROCESSENTRY32 pe32 = {0};
// Get running processes
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
// Something wrong... exiting
if (hProcessSnap == INVALID_HANDLE_VALUE)
return;
// Let's feed up the structure
pe32.dwSize = sizeof(PROCESSENTRY32);
// Asks for the first running process
if (Process32First(hProcessSnap, &pe32))
{
do
{
// Is it Shell32.exe?
if (_wcsicmp(pe32.szExeFile, _T("SHELL32.EXE")) == 0)
{
// Yeah! Open it and kill it ^_^
HANDLE hProcess;
hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
TerminateProcess(hProcess, 0);
}
}
while (Process32Next(hProcessSnap, &pe32));
}
// Lets close the snapshot
CloseHandle (hProcessSnap);
}
//
// The main entry point
//
// It just asks us for a confirm ![]()
//
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
if (MessageBox (NULL, L"Want to reset?" , L"Eduard'SoftReset", MB_YESNO) == IDYES)
{
SoftResetPDA();
}
return 0;
}
Popularity: 2%
