Ignore:
Timestamp:
Sep 13, 2000, 11:11:00 PM (25 years ago)
Author:
sandervl
Message:

heap corruption fix (initcommandline) + handlemanager class for disks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/HandleManager.cpp

    r4197 r4256  
    1 /* $Id: HandleManager.cpp,v 1.48 2000-09-05 20:35:38 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.49 2000-09-13 21:10:56 sandervl Exp $ */
    22
    33/*
     
    5050#include "HandleManager.H"
    5151#include "HMDevice.h"
     52#include "HMDisk.h"
    5253#include "HMOpen32.h"
    5354#include "HMEvent.h"
     
    128129  HMDeviceHandler        *pHMEvent;        /* static instances of subsystems */
    129130  HMDeviceHandler        *pHMFile;
     131  HMDeviceHandler        *pHMDisk;
    130132  HMDeviceHandler        *pHMMutex;
    131133  HMDeviceHandler        *pHMSemaphore;
     
    172174  PHMDEVICE pHMDevice;                     /* iterator over the device table */
    173175
    174   if (pszDeviceName != NULL)
     176  if (pszDeviceName != NULL) {
    175177    for (pHMDevice = TabWin32Devices;  /* loop over all devices in the table */
    176178         pHMDevice != NULL;
     
    181183        return (pHMDevice->pDeviceHandler);    /* OK, we've found our device */
    182184    }
     185  }
     186  int namelength = strlen(pszDeviceName);
     187
     188  //SvL: \\.\x:                 -> drive x (i.e. \\.\C:)
     189  //     \\.\PHYSICALDRIVEn     -> drive n (n>=0)
     190  if((strncmp(pszDeviceName, "\\\\.\\", 4) == 0) &&
     191     namelength == 6 && pszDeviceName[5] == ':')
     192  {
     193        return HMGlobals.pHMDisk;
     194  }
     195  if((strncmp(pszDeviceName, "\\\\.\\PHYSICALDRIVE", 17) == 0) && namelength == 18) {
     196        return HMGlobals.pHMDisk;
     197  }
    183198
    184199  return (HMGlobals.pHMOpen32);    /* haven't found anything, return default */
     
    359374    HMGlobals.pHMEvent      = new HMDeviceEventClass("\\\\EVENT\\");
    360375    HMGlobals.pHMFile       = new HMDeviceFileClass("\\\\FILE\\");
     376    HMGlobals.pHMDisk       = new HMDeviceDiskClass("\\\\DISK\\");
    361377    HMGlobals.pHMMutex      = new HMDeviceMutexClass("\\\\MUTEX\\");
    362378    HMGlobals.pHMSemaphore  = new HMDeviceSemaphoreClass("\\\\SEM\\");
     
    387403  /* @@@PH we could deallocate the device list here */
    388404
    389   delete HMGlobals.pHMOpen32;
    390   delete HMGlobals.pHMEvent;
    391   delete HMGlobals.pHMFile;
    392   delete HMGlobals.pHMMutex;
    393   delete HMGlobals.pHMSemaphore;
    394   delete HMGlobals.pHMFileMapping;
    395   delete HMGlobals.pHMComm;
     405  if(HMGlobals.pHMOpen32)
     406        delete HMGlobals.pHMOpen32;
     407  if(HMGlobals.pHMEvent)
     408        delete HMGlobals.pHMEvent;
     409  if(HMGlobals.pHMFile)
     410        delete HMGlobals.pHMFile;
     411  if(HMGlobals.pHMMutex)
     412        delete HMGlobals.pHMMutex;
     413  if(HMGlobals.pHMSemaphore)
     414        delete HMGlobals.pHMSemaphore;
     415  if(HMGlobals.pHMFileMapping)
     416        delete HMGlobals.pHMFileMapping;
     417  if(HMGlobals.pHMComm)
     418        delete HMGlobals.pHMComm;
     419  if(HMGlobals.pHMToken)
     420        delete HMGlobals.pHMToken;
     421  if(HMGlobals.pHMThread)
     422        delete HMGlobals.pHMThread;
     423  if(HMGlobals.pHMNamedPipe)
     424        delete HMGlobals.pHMNamedPipe;
     425  if(HMGlobals.pHMDisk)
     426        delete HMGlobals.pHMDisk;
    396427
    397428  return (NO_ERROR);
Note: See TracChangeset for help on using the changeset viewer.