Shown below is coding for a simple C++ application that closes Internet Explorer. This application works perfectly in Windows 2000, although when run in a Windows 95/98 environment, two error messages show and the EXE does not run at all.

These error messages are:

- 'The PSAPI.DLL file is linked to missing export NTDLL.DLL:NtAllocateVirtualMemory.'

- '{Directory path where this file is located}\closeexplorer.exe
A device attached to the system is not functioning.'


How can this coding be altered so that this Application can run in Windows 95/98 as well as Windows 2000?
Please can someone help!

================================================== ===========

Code:
// - Coding for the close IE/Netscape instances solution - ///////////////////////////////////////

#include "stdafx.h"
#include "psapi.h"
#pragma comment(lib,"psapi.lib")


char *g_sAppName;
boolean g_bVerbose;


boolean KillProcess( DWORD processID )
{
   char szProcessName[MAX_PATH] = "unknown";

   // Get a handle to the process.

   HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
   PROCESS_VM_READ | PROCESS_TERMINATE,
                                  FALSE, processID );
    boolean retval = false;

   // Get the process name.

   if ( hProcess )   {
       HMODULE hMod;
       DWORD cbNeeded;

       if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), 
            &cbNeeded) ) {
           GetModuleBaseName( hProcess, hMod, szProcessName, 
                              sizeof(szProcessName) );
       }
         // Print the process name and identifier.
//Need to 
// 

         _strlwr(szProcessName);
         if (!strcmp(szProcessName,"explorer.exe") ||
// Copy and paste the following line with anything else that needs killing
//			!strcmp(szProcessName,"netscape.exe") || // change whatever is in the quotes
         !strcmp(szProcessName,"iexplore.exe")) {

              TerminateProcess(hProcess,0);
         }

        CloseHandle( hProcess );
    }
    return retval;
}

int main()
{
   DWORD aProcesses[1024], cbNeeded, cProcesses;
   unsigned int i;

    int killCount=0;

   if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ))
       return 0;    // Get the list of process identifiers.

   // Calculate how many process identifiers were returned.
   cProcesses = cbNeeded / sizeof(DWORD);
   // Print the name and process identifier for each process.
   for ( i = 0; i < cProcesses; i++ )
       if (KillProcess( aProcesses[i] )) 
         {
              killCount++;
         }
    return killCount;
}

//Just add the Netscape module name and you have it!