none
Help on legacy driver RRS feed

  • Question

  • Hi,

    I have a legacy driver in whcih i want to implement a SPB call to invoke my contoller driver. Appreciate your help in advance.

    > What are the equivalent functions in the legacy driver for the below functions

    WdfIoTargetCreate

    WdfIoTargetOpen

    Thanks,

    Shravan

    Friday, August 30, 2013 6:38 AM

Answers

  • The driver must be pnp

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, August 30, 2013 3:59 PM
  • ZwCreateFile or IoGetDeviceObjectPointer

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Saturday, August 31, 2013 1:59 PM
  • You can use kmdf in legacy mode write a nt4 style driver. The kmdf APIs are a little bit of a different abstraction than raw wdm. I gave you the answer to the first two, the third is purely a kmdf construct, no wdm equivalent, IoBuildDeviceIoControlRequest for the fourth


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, September 2, 2013 2:52 PM

All replies

  • by legacy do you mean an nt4 style driver that doesn't do pnp? or a retrofit of an existing pnp driver? spb stuff is usually done on a soc, is this for a soc?


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, August 30, 2013 7:44 AM
  • Yes it is.  Already i have a SPB controller driver. I have written a legacy driver in which i want to implement SPBOpen resource, SPBcloseresource, SPBread/Write resource. I have referred the SPB test tool. As it implements WdfIoTargetCreate, WdfIoTargetOpen i want the equivalent to be implemented in the legacy code. It is Nt4 style.
    Friday, August 30, 2013 8:21 AM
  • The driver must be pnp

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, August 30, 2013 3:59 PM
  • Hi, I have below questions.

    what are the equivalent function of WdfIoTargetCreate, WdfIoTargetOpen in legacy driver?

    How can i implement these functions in legacy driver?

    Saturday, August 31, 2013 9:31 AM
  • ZwCreateFile or IoGetDeviceObjectPointer

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Saturday, August 31, 2013 1:59 PM
  • Hi,

    Thanks for the Help. I want the below functions to be implemeted in mycode. Could you please help me in finding the equivalents in Legacy mode.

    1. WdfIoTargetCreate

    2. WdfIoTargetOpen

    3. WDF_MEMORY_DESCRIPTOR_INIT_BUFFER

    4. WdfIoTargetSendIoctlSynchronously

    Monday, September 2, 2013 10:16 AM
  • You can use kmdf in legacy mode write a nt4 style driver. The kmdf APIs are a little bit of a different abstraction than raw wdm. I gave you the answer to the first two, the third is purely a kmdf construct, no wdm equivalent, IoBuildDeviceIoControlRequest for the fourth


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, September 2, 2013 2:52 PM
  • Hi Doron,

    Thanks for the help. Can you jusdt let me know what is the equivalne tof the below function

    OpenSpbResource defined in the below path.

    http://msdn.microsoft.com/en-in/library/windows/hardware/hh451581(v=vs.85).aspx

    Does this function uses Zwcreatefile or anything else?

    Tuesday, September 3, 2013 9:06 AM
  • To add to the above

    Does the function SpbResourceIoControl defined in the below path uses IoBuildDeviceIoControlRequest or anything else?

    http://msdn.microsoft.com/en-us/library/windows/hardware/hh439861(v=vs.85).aspx

    ReadSpbResource

    http://msdn.microsoft.com/en-us/library/windows/hardware/hh439824(v=vs.85).aspx

    WriteSpbResource

    http://msdn.microsoft.com/en-us/library/windows/hardware/hh439925(v=vs.85).aspx

    Please do help for finding the leagcy equivalnet calls for these 4 functions.

    Tuesday, September 3, 2013 9:19 AM
  • I have the below code and the iocalldriver is returning INVALID_DEVICE_REQUEST.Could you please suggest.

    NTSTATUS Read(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
    {
    	LARGE_INTEGER SpbReourceId;
    	WCHAR DeviceNameBuffer[100];
    	NTSTATUS ntStatus = STATUS_SUCCESS;
    	UNICODE_STRING DevicePath;
    	PDEVICE_OBJECT  DeviceObject_1 =NULL;
    	NTSTATUS status= STATUS_SUCCESS, status2= STATUS_SUCCESS;
    	PFILE_OBJECT  FileObject =NULL;
    	SPB_TRANSFER_LIST_AND_ENTRIES(2) seq;
    	SPB_TRANSFER_LIST request;
    	void* Buffer =NULL;
    	void* In_Buffer =NULL;
    	void* Out_Buffer =NULL;
    	U32 Length=128;
    	U8 offset=0;
    	PIO_STATUS_BLOCK ioStatusBlock = NULL; 
    	HANDLE EventHandle = NULL;
    	PKEVENT Event = NULL;
    	PIRP  pIrp= NULL;
    	UNICODE_STRING EventName;
    	LARGE_INTEGER Timeout = {0};
    
    	SpbReourceId.HighPart=0;
    	SpbReourceId.LowPart =0x1;
    
    	 ntStatus = RtlStringCbPrintfW ( & DeviceNameBuffer[0],
                                  sizeof(DeviceNameBuffer),
                                  L"\\DosDevices\\RESOURCE_HUB\\%0*I64x",
                                  (size_t)(sizeof(LARGE_INTEGER) * 2),
                                  SpbReourceId.QuadPart);
    
    	 RtlInitUnicodeString(&DevicePath, DeviceNameBuffer);
    	 status = IoGetDeviceObjectPointer(&DevicePath,FILE_ANY_ACCESS,&FileObject,&DeviceObject_1);
    
    	 SPB_TRANSFER_LIST_INIT(&(request), 2);
    
    	if(status==STATUS_SUCCESS)
    	{
    		seq.List.Transfers[0] = SPB_TRANSFER_LIST_ENTRY_INIT_SIMPLE(
    								   SpbTransferDirectionToDevice,
    								   0,
    								   &offset,
    								   sizeof(offset)
    								   );
    
    				seq.List.Transfers[1] = SPB_TRANSFER_LIST_ENTRY_INIT_SIMPLE(
    								   SpbTransferDirectionFromDevice,
    								   0,
    								   Buffer,
    								   Length
    								   );
    		Timeout.QuadPart = -2*1000*10000;
    		RtlInitUnicodeString(&EventName, L"\\BaseNamedObjects\\AsyncEvent");
    		Event = IoCreateNotificationEvent(&EventName, &EventHandle);
    
    		pIrp = IoBuildSynchronousFsdRequest(IOCTL_SPB_EXECUTE_SEQUENCE,DeviceObject_1,Out_Buffer,128,0,Event,ioStatusBlock);
    				if (!pIrp) {
    					status = STATUS_INSUFFICIENT_RESOURCES;
    					goto end;
    				}
    		
    		status = IoCallDriver(DeviceObject_1, pIrp);
    
    		if (status == STATUS_PENDING) 
    		{
    			KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE,	NULL);
    			status = ioStatusBlock->Status;
    
    			if (NT_SUCCESS(status))
    			{
    				Irp->IoStatus.Information = 128;
    			}
    		}
    
    	}
    
    end:
        Irp->IoStatus.Status = status;
        IoCompleteRequest(Irp, IO_NO_INCREMENT);
    	return status;
    }
    

    Thursday, September 5, 2013 9:59 AM