virtual joystick devices RRS feed

  • Question

  • Hello all.
    I want to create a virtual joystick device like Vjoy.(don't want to use dll,etc..)

    So I just started to learn how to write a driver:

    NTSTATUS DriverEntry( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath )
    NtStatus = STATUS_SUCCESS;
    uiIndex = 0;
    pDeviceObject = NULL;
     DbgPrint("[DRIVER] DriverEntry Called!");

    NtStatus =RtlUnicodeStringInit(&usDriverName, L"\\Device\\Example0");
    NtStatus =RtlUnicodeStringInit(&usDosDeviceName, L"\\DosDevice\\ExampleDevice0");
    NtStatus =IoCreateDevice (pDriverObject,0, &usDriverName,FILE_DEVICE_CONTROLLER,0,FALSE, &pDeviceObject);  

        if(NtStatus == STATUS_SUCCESS)
        DbgPrint("[DRIVER] IoCreateDevice sucess!");
            for(uiIndex = 0; uiIndex < IRP_MJ_MAXIMUM_FUNCTION; uiIndex++){
         pDriverObject->MajorFunction[uiIndex] = Example_UnSupportedFunction;
    if(NtStatus != STATUS_SUCCESS){
    DbgPrint("[DRIVER] Example_UnSupportedFunction failed!");
    return NtStatus;}

    pDriverObject->MajorFunction[IRP_MJ_CLOSE]             = Example_Close;
    pDriverObject->MajorFunction[IRP_MJ_CREATE]            = Example_Create;
    pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL]    = Example_IoControl;
    pDriverObject->MajorFunction[IRP_MJ_READ]              = Example_Read;
    pDriverObject->MajorFunction[IRP_MJ_WRITE]             = USE_WRITE_FUNCTION;
            pDeviceObject->Flags |= IO_TYPE;
            pDeviceObject->Flags &= (~DO_DEVICE_INITIALIZING);
            IoCreateSymbolicLink(&usDosDeviceName, &usDriverName);
                DbgPrint("[DRIVER]ALL OK");
    return NtStatus;

    The code works,I can see messages in DebugView.But I'm stuck,looked all over internet to see what to do next.
    If someone has infos about "faking",tell windows there new usb(joystick) device.I will thank them warmly.

    I'm on Window7 - visual studio 2008 -WinDDK 7600.16385.1

    Tuesday, November 18, 2014 12:07 PM


All replies