Exemplo n.º 1
0
/************************ END OF SPECIFICATIONS ***********************/
static BOOL RegisterUSBD(void)
{
   APIRET      rc=RMRC_SUCCESS;
   UCHAR       ResourceBuf[ 12 ];  
   ADJUNCT     AdjAdaptNum;
   PAHRESOURCE pResourceList = (PAHRESOURCE)ResourceBuf;

   rc=RMCreateDriver( &gDriverStruct, &ghDriver);

   if (rc==RMRC_SUCCESS)
   {
      pResourceList->NumResource = 0;

      gAdapterStruct.HostBusType = AS_HOSTBUS_PCI;
      AdjAdaptNum.pNextAdj       = NULL;
      AdjAdaptNum.AdjLength      = sizeof(ADJUNCT);
      AdjAdaptNum.AdjType        = ADJ_ADAPTER_NUMBER;
      AdjAdaptNum.Adapter_Number = 0;
      gAdapterStruct.pAdjunctList = &AdjAdaptNum;

      rc=RMCreateAdapter(ghDriver, &ghAdapter,  &gAdapterStruct,
                         NULL, pResourceList);
   }

   return (rc==RMRC_SUCCESS);
}
Exemplo n.º 2
0
/**@external ResourceManager
 *  Constructor for RM object.
 * @notes Creates a "driver" node for this device driver, but does not
 *  allocate resources.
 */
ResourceManager::ResourceManager(ULONG pciId)
{
   APIRET rc;
   DRIVERSTRUCT DriverStruct;
   PSEL p;
   PGINFOSEG pGIS = 0;

   /* Warp version level, bus type, machine ID, and much other information is
    * readily available.  Reference the RM ADD sample in the DDK for code.
    *
    * Create a "driver" struct for this driver.  This must ALWAYS be the
    * first true RM call executed, as it attaches the Resource Manager
    * library and performs setup for the other RM calls.
    */
   _fmemset( (PVOID) &DriverStruct, 0, sizeof(DriverStruct) );
   DriverStruct.DrvrName     = (PSZ) "SBLIVE16.SYS";                  /* ### IHV */
   DriverStruct.DrvrDescript = (PSZ) "SoundBlaster Live!";    /* ### IHV */
   DriverStruct.VendorName   = (PSZ) "Creative Labs";             /* ### IHV */
   DriverStruct.MajorVer     = CMVERSION_MAJOR;          //rmbase.h /* ### IHV */
   DriverStruct.MinorVer     = CMVERSION_MINOR;          //rmbase.h /* ### IHV */
   DriverStruct.Date.Year    = 2000;                                /* ### IHV */
   DriverStruct.Date.Month   = 2;                                   /* ### IHV */
   DriverStruct.Date.Day     = 1;                                   /* ### IHV */
   DriverStruct.DrvrType     = DRT_AUDIO;
   DriverStruct.DrvrSubType  = 0;
   DriverStruct.DrvrCallback = NULL;
   rc = RMCreateDriver( &DriverStruct, &_hDriver );
   if( rc == RMRC_SUCCESS )
      _state = rmDriverCreated;
   else {
      _state = rmDriverFailed;
      _hDriver = 0;
   }

   // Build a pointer to the Global Information Segment.
   rc = DevHelp_GetDOSVar( DHGETDOSV_SYSINFOSEG, 0, (PPVOID)&p );
   if (rc) {
      _rmDetection = FALSE;
   }
   else {
      SELECTOROF(pGIS) = *p;
      _rmDetection =
         ( (pGIS->uchMajorVersion > 20) ||
           ((pGIS->uchMajorVersion == 20) && (pGIS->uchMinorVersion > 30)) );
   }
}