Operation Manual

ProgrammingChapter 7
198 700 Series Color Mobile Computer User’s Manual
After the CAB File Extraction
Cab f iles that need to cause a warm reset after cab extraction will need to
create the __RESETMEPLEASE__.TXT file in the “\Windows” directory.
The preferred method to create this file is within the DllMain portion of
the SETUP.DLL file. It looks like this:
#include <windows.h>
#include <Tlhelp32.h>
#include <winioctl.h>
#include <ce_setup.h> // in the public SDK dir
#define IOCTL_TERMINAL_RESET CTL_CODE (FILE_DEVICE_UNKNOWN,FILE_ANY_ACCESS,
2050, METHOD_NEITHER)
BOOL APIENTRY DllMain( HANDLE h, DWORD reason, LPVOID lpReserved )
{
return TRUE;
} // DllMain
//************************************************************************
// $DOCBEGIN$
// BOOL IsProcessRunning( TCHAR * pname );
//
// Description: Get process table snapshot, look for pname running.
//
// Arguments: pname - pointer to name of program to look for.
// for example, app.exe.
//
// Returns: TRUE - process is running.
// FALSE - process is not running.
// $DOCEND$
//************************************************************************
BOOL IsProcessRunning( TCHAR * pname )
{
HANDLE hProcList;
PROCESSENTRY32 peProcess;
DWORD thDeviceProcessID;
TCHAR lpname[MAX_PATH];
if ( !pname || !*pname ) return FALSE;
_tcscpy( lpname, pname );
_tcslwr( lpname );
hProcList = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
if ( hProcList == INVALID_HANDLE_VALUE ) {
return FALSE;
} // end if
memset( &peProcess, 0, sizeof(peProcess) );
peProcess.dwSize = sizeof(peProcess);
if ( !Process32First( hProcList, &peProcess)){
CloseToolhelp32Snapshot( hProcList );
return FALSE;
} // end if