/***************************************************************************** * AddDevice ***************************************************************************** * This function is called by the operating system when the device is added. * All adapter drivers can use this code without change. */ NTSTATUS AddDevice ( IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject ) { PAGED_CODE (); DOUT (DBG_PRINT, ("[AddDevice]")); // disable prefast warning 28152 because // DO_DEVICE_INITIALIZING is cleared in PcAddAdapterDevice #pragma warning(disable:28152) #ifdef XEN NTSTATUS ntStatus = XenInitialize(PhysicalDeviceObject); if (!NT_SUCCESS (ntStatus)) return ntStatus; #endif // // Tell portcls (the class driver) to add the device. // return PcAddAdapterDevice (DriverObject, PhysicalDeviceObject, (PCPFNSTARTDEVICE)StartDevice, MAX_MINIPORTS, 0); }
NTSTATUS PcDevice::Add(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject) { PAGED_CODE(); debug("PcDevice::Add: drvo: %p pdo: %p; next: %p\n",DriverObject,PhysicalDeviceObject,DriverObject->DeviceObject); NTSTATUS ret = PcAddAdapterDevice(DriverObject, PhysicalDeviceObject, PcDevice::Start, MAX_MINIPORTS, sizeof(void *) + PORT_CLASS_DEVICE_EXTENSION_SIZE); PDEVICE_OBJECT FunctionalDeviceObject=DriverObject->DeviceObject; while(FunctionalDeviceObject) { PcDevice **extension = (PcDevice **)((PCHAR)FunctionalDeviceObject->DeviceExtension + PORT_CLASS_DEVICE_EXTENSION_SIZE); if(extension && *extension==NULL) { PcDevice *device = new (NonPagedPool) PcDevice(FunctionalDeviceObject,PhysicalDeviceObject); if(device) { *extension = device; break; } } FunctionalDeviceObject=FunctionalDeviceObject->NextDevice; } return ret; }
_Use_decl_annotations_ NTSTATUS AddDevice ( PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject ) /*++ Routine Description: The Plug & Play subsystem is handing us a brand new PDO, for which we (by means of INF registration) have been asked to provide a driver. We need to determine if we need to be in the driver stack for the device. Create a function device object to attach to the stack Initialize that device object Return status success. All audio adapter drivers can use this code without change. Arguments: DriverObject - pointer to a driver object PhysicalDeviceObject - pointer to a device object created by the underlying bus driver. Return Value: NT status code --*/ { PAGED_CODE(); NTSTATUS ntStatus; ULONG maxObjects; DPF(D_TERSE, ("[AddDevice]")); maxObjects = g_MaxMiniports; // Tell the class driver to add the device. // ntStatus = PcAddAdapterDevice ( DriverObject, PhysicalDeviceObject, PCPFNSTARTDEVICE(StartDevice), maxObjects, 0 ); return ntStatus; }
NTSTATUS AddDevice ( _In_ struct _DRIVER_OBJECT* DriverObject, // Context for the class driver. _In_ struct _DEVICE_OBJECT* PhysicalDeviceObject // Context for the class driver. ) { PAGED_CODE(); _DbgPrintF(DEBUGLVL_VERBOSE, ("AddDevice")); // // Tell the class driver to add the device. // return PcAddAdapterDevice(DriverObject, PhysicalDeviceObject, StartDevice, MAX_MINIPORTS, 0); }
/***************************************************************************** * AddDevice() ***************************************************************************** * This function is called by the operating system when the device is added. * All adapter drivers can use this code without change. */ NTSTATUS AddDevice ( IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject ) { PAGED_CODE(); _DbgPrintF(DEBUGLVL_VERBOSE, ("AddDevice")); // disable prefast warning 28152 because // DO_DEVICE_INITIALIZING is cleared in PcAddAdapterDevice #pragma warning(disable:28152) // // Tell the class driver to add the device. // return PcAddAdapterDevice(DriverObject,PhysicalDeviceObject,StartDevice,MAX_MINIPORTS,0); }
//============================================================================= extern "C" NTSTATUS AddDevice( IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject ) /* Routine Description: The Plug & Play subsystem is handing us a brand new PDO, for which we (by means of INF registration) have been asked to provide a driver. We need to determine if we need to be in the driver stack for the device. Create a function device object to attach to the stack Initialize that device object Return status success. All audio adapter drivers can use this code without change. Set MAX_MINIPORTS depending on the number of miniports that the driver uses. Arguments: DriverObject - pointer to a driver object PhysicalDeviceObject - pointer to a device object created by the underlying bus driver. Return Value: NT status code. */ { PAGED_CODE(); NTSTATUS ntStatus; DPF(D_TERSE, ("[AddDevice]")); // Tell the class driver to add the device. ntStatus = PcAddAdapterDevice( DriverObject, PhysicalDeviceObject, PCPFNSTARTDEVICE(StartDevice), MAX_MINIPORTS, 0 ); return ntStatus; } // AddDevice
/***************************************************************************** * AddDevice() ***************************************************************************** * This function is called by the operating system when the device is added. * All adapter drivers can use this code without change. */ NTSTATUS AddDevice ( IN PVOID Context1, // Context for the class driver. IN PVOID Context2 // Context for the class driver. ) { PAGED_CODE(); _DbgPrintF(DEBUGLVL_VERBOSE, ("AddDevice")); // disable prefast warning 28152 because // DO_DEVICE_INITIALIZING is cleared in PcAddAdapterDevice #pragma warning(disable:28152) // // Tell the class driver to add the device. // return PcAddAdapterDevice((PDRIVER_OBJECT)Context1, (PDEVICE_OBJECT)Context2, StartDevice, MAX_MINIPORTS, 0); }