Changeset 4256 for trunk/src


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

heap corruption fix (initcommandline) + handlemanager class for disks

Location:
trunk/src/kernel32
Files:
2 added
8 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);
  • trunk/src/kernel32/dbglocal.cpp

    r3819 r4256  
    1 /* $Id: dbglocal.cpp,v 1.9 2000-07-12 18:21:41 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.10 2000-09-13 21:10:58 sandervl Exp $ */
    22
    33/*
     
    120120"exceptstackdump",
    121121"hmfile",
    122 "hmnpipe"
     122"hmnpipe",
     123"hmdisk"
    123124};
    124125//******************************************************************************
  • trunk/src/kernel32/dbglocal.h

    r3819 r4256  
    1 /* $Id: dbglocal.h,v 1.9 2000-07-12 18:21:42 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.10 2000-09-13 21:10:58 sandervl Exp $ */
    22
    33/*
     
    120120#define DBG_hmfile         98
    121121#define DBG_hmnpipe        99
    122 #define DBG_MAXFILES       100
     122#define DBG_hmdisk         100
     123#define DBG_MAXFILES       101
    123124
    124125extern USHORT DbgEnabled[DBG_MAXFILES];
  • trunk/src/kernel32/hmfile.cpp

    r4230 r4256  
    1 /* $Id: hmfile.cpp,v 1.20 2000-09-10 21:54:06 sandervl Exp $ */
     1/* $Id: hmfile.cpp,v 1.21 2000-09-13 21:10:59 sandervl Exp $ */
    22
    33/*
     
    4949 * Variables :
    5050 * Result    :
    51  * Remark    :
     51 * Remark    : TODO: \\.\PHYSICALDRIVEx opens physical drive x
    5252 * Status    : NO_ERROR - API succeeded
    5353 *             other    - what is to be set in SetLastError
  • trunk/src/kernel32/initsystem.cpp

    r4230 r4256  
    1 /* $Id: initsystem.cpp,v 1.15 2000-09-10 21:54:06 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.16 2000-09-13 21:10:59 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry, directories & environment)
     
    118118   RegCloseKey(hkey);
    119119
    120    //CurrentVersion\RunOnce
     120   //Software\Microsoft\Windows\CurrentVersion\RunOnce
    121121   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) {
    122122        dprintf(("InitRegistry: Unable to register system information (2)"));
  • trunk/src/kernel32/makefile

    r4224 r4256  
    1 # $Id: makefile,v 1.100 2000-09-08 18:07:50 sandervl Exp $
     1# $Id: makefile,v 1.101 2000-09-13 21:10:59 sandervl Exp $
    22
    33#
     
    127127$(OBJDIR)\hmthread.obj \
    128128$(OBJDIR)\hmnpipe.obj \
     129$(OBJDIR)\hmdisk.obj \
    129130!ifdef DEBUG
    130131$(OBJDIR)\exceptstackdump.obj \
  • trunk/src/kernel32/oslibdos.cpp

    r4235 r4256  
    1 /* $Id: oslibdos.cpp,v 1.41 2000-09-12 04:27:44 bird Exp $ */
     1/* $Id: oslibdos.cpp,v 1.42 2000-09-13 21:11:00 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    798798#endif
    799799
     800   if(strlen(lpszFile) == 2 && lpszFile[1] == ':') {
     801        //app tries to open physical disk
     802        openMode |= OPEN_FLAGS_DASD;
     803   }
    800804   int retry = 0;
    801805   while(retry < 2)
  • trunk/src/kernel32/wprocess.cpp

    r4250 r4256  
    1 /* $Id: wprocess.cpp,v 1.93 2000-09-12 22:47:58 bird Exp $ */
     1/* $Id: wprocess.cpp,v 1.94 2000-09-13 21:11:00 sandervl Exp $ */
    22
    33/*
     
    11191119            while (*psz2 == ' ')            /* skip blanks after argv[1]. */
    11201120                psz2++;
     1121            pszArg2 = psz2;  //SvL: bugfix -> fixes heap corruption
    11211122        }
    11221123        else
Note: See TracChangeset for help on using the changeset viewer.