Ignore:
Timestamp:
Sep 15, 2000, 3:25:50 PM (25 years ago)
Author:
sandervl
Message:

open + init aspirout during dll load

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wnaspi32/winaspi32.cpp

    r4260 r4265  
    1 /* $Id: winaspi32.cpp,v 1.8 2000-09-14 19:09:17 sandervl Exp $ */
     1/* $Id: winaspi32.cpp,v 1.9 2000-09-15 13:25:50 sandervl Exp $ */
    22/*
    33 * WNASPI routines
     
    2828//#include "callback.h"
    2929
     30#ifdef DEBUG
     31#define DEBUG_BUFFER
     32#endif
     33
    3034DEFAULT_DEBUG_CHANNEL(aspi)
    3135ODINDEBUGCHANNEL(WNASPI32)
     
    8084  cdb = &prb->CDBByte[0];
    8185  cmd = prb->CDBByte[0];
    82   if (TRACE_ON(aspi))
    83   {
    84       DPRINTF("CDB buffer[");
     86#ifdef DEBUG_BUFFER
     87      dprintfNoEOL(("CDB buffer["));
    8588      for (i = 0; i < prb->SRB_CDBLen; i++) {
    86           if (i != 0) DPRINTF(",");
    87           DPRINTF("%02x", *cdb++);
    88       }
    89       DPRINTF("]\n");
    90   }
     89          if (i != 0) dprintfNoEOL((",0x%02x", *cdb++));
     90          else        dprintfNoEOL(("0x%02x", *cdb++));
     91      }
     92      dprintfNoEOL(("]\n"));
     93#endif
    9194}
    9295
     
    178181              lpPRB->SRB_BufPointer,
    179182              lpPRB->SRB_BufLen);
     183
     184#ifdef DEBUG_BUFFER
     185      char *cdb = (char *)lpPRB->SRB_BufPointer;
     186      dprintfNoEOL(("Write SRB buffer["));
     187      for (int i = 0; i < lpPRB->SRB_BufLen; i++) {
     188          if (i != 0) dprintfNoEOL((",0x%02x", *cdb++));
     189          else        dprintfNoEOL(("0x%02x", *cdb++));
     190      }
     191      dprintfNoEOL(("]\n"));
     192#endif
    180193    }
    181194  }
     
    195208                  aspi->buffer,
    196209                  lpPRB->SRB_BufLen);
     210#ifdef DEBUG_BUFFER
     211      char *cdb = (char *)lpPRB->SRB_BufPointer;
     212      dprintfNoEOL(("Read SRB buffer["));
     213      for (int i = 0; i < lpPRB->SRB_BufLen; i++) {
     214          if (i != 0) dprintfNoEOL((",0x%02x", *cdb++));
     215          else        dprintfNoEOL(("0x%02x", *cdb++));
     216      }
     217      dprintfNoEOL(("]\n"));
     218#endif
     219
    197220        }
    198221      }
     
    251274{
    252275  LONG rc;
    253   scsiObj *aspi;
    254   ULONG hmtxDriver;
    255276  BYTE bNumDrv;
    256277  HKEY hkeyDrvInfo;
     
    263284  bNumDrv = 0;
    264285
    265   aspi = new scsiObj();
    266 
    267   if( fGainDrvAccess( FALSE, &hmtxDriver) ) // Do nonblocking call for info
    268   {
    269 
    270     if(aspi->init(65535)==TRUE)
    271     {
    272 
     286  if(aspi->access(FALSE)) //'non-blocking' call
     287  {
    273288        bNumDrv = aspi->getNumHosts();
    274289        brc = SS_COMP;
     
    287302          RegCloseKey( hkeyDrvInfo);
    288303        }
    289         aspi->close();
    290     }
    291     else
    292       brc = SS_FAILED_INIT;
    293 
    294     fReleaseDrvAccess( hmtxDriver);
     304        aspi->release();
    295305  }
    296306  else
     
    324334    }
    325335  }
    326   delete aspi;
    327336
    328337  return ((brc << 8) | bNumDrv); /* FIXME: get # of host adapters installed */
     
    337346    ULONG ulParam, ulReturn;
    338347    BYTE  bRC;
    339     scsiObj *aspi;
    340     ULONG hmtxDriver;
    341348    LONG rc;
    342349
     
    357364    }
    358365
    359     aspi = new scsiObj();
    360 
    361366    dwRC = SS_ERR;
    362367
    363     if( fGainDrvAccess( TRUE, &hmtxDriver) ) // Block if a SRB is pending
    364     {
    365       if(aspi->init(65535)==TRUE)
    366       {
     368    if(aspi->access(TRUE)) // Block if a SRB is pending
     369    {
    367370        switch (lpSRB->common.SRB_Cmd)
    368371        {
     
    414417             break;
    415418
    416           } // end switch (lpSRB->common.SRB_Cmd)
    417 
    418       }
    419       else
    420       {
    421         dwRC = bRC;
    422       }
    423 
    424       fReleaseDrvAccess( hmtxDriver);
    425       aspi->close();
     419        } // end switch (lpSRB->common.SRB_Cmd)
     420
     421        aspi->release();
    426422    }
    427423    else
    428424    {
    429       dwRC = SS_NO_ASPI;
    430     }
    431     delete aspi;
     425        dwRC = SS_NO_ASPI;
     426    }
    432427
    433428    return dwRC;
Note: See TracChangeset for help on using the changeset viewer.