Solved

Windows VXD and IRQ Handling

Posted on 1997-05-17
1
260 Views
Last Modified: 2013-12-03
I need the esqueleton of a Windows VxD. I also need to trap any IRQ (IRQ 7) and read from I/O 300h when IRQ occurs. I 'm programing in Delphi now but the code can be in C++ or any other languaje.
0
Comment
Question by:i9423342
1 Comment
 
LVL 2

Accepted Solution

by:
amartin030297 earned 100 total points
ID: 1397423
First of all-- I assume you have the DDK (or VToolsD [www.vireo.com]) so you can build VxD's..


VPICD_HWInt_THUNK fakeInt_Thunk;            // Thunk for interrupt handler
VPICD_VirtInt_THUNK fakeVMThunk;
VPICD_MaskChange_THUNK fakeVMMaskThunk;
void __stdcall fakeVMMask(VMHANDLE hVM, IRQHANDLE hIRQ, int isBeingMasked);
BOOL __stdcall fake_HWInt_HANDLER(VMHANDLE hVM, IRQHANDLE hIRQ);

void releaseIRQVirtualization(unsigned long irq)
{
    irq &= 0xf;
    if (hIRQ[irq])
    {
        dprintf("VxD Releasing Virtual IRQ: %d (0x%x)", irq,irq);
        VPICD_Force_Default_Behavior(hIRQ[irq]);
        hIRQ[irq]=NULL;
    }
}

void __stdcall fakeVMMask(VMHANDLE hVM, IRQHANDLE hIRQ, int isBeingMasked)
{
    VPICD_Clear_Int_Request(hVM, hIRQ);
    VPICD_Virtual_EOI(hIRQ, hVM);

    if (isBeingMasked)
    {
       
    }
    return;
}


BOOL __stdcall fake_HWInt_HANDLER(VMHANDLE hVM, IRQHANDLE hIRQ)
{
    ;...do  your phys_eoi here... I left this part out
    return TRUE;
}


BOOL requestIRQVirtualization(unsigned long irq)
{
    irq &= 0xf;
    if (hIRQ[irq])
    {
        return TRUE;
    }
    VPICD_IRQ_Descriptor vps;
    memset(&vps,0,sizeof (VPICD_IRQ_Descriptor));
    vps.VID_IRQ_Number=irq;
    vps.VID_IRET_Time_Out=0;//1000;
    vps.VID_Options=VPICD_OPT_CAN_SHARE;
    vps.VID_Hw_Int_Proc=(DWORD)VPICD_Thunk_HWInt(fake_HWInt_HANDLER, &fakeInt_Thunk);
    vps.VID_Mask_Change_Proc=(DWORD)VPICD_Thunk_MaskChange(fakeVMMask, &fakeVMMaskThunk);
    hIRQ[irq]=VPICD_Virtualize_IRQ(&vps);
    if (!hIRQ[irq])
    {
        return FALSE;
    }
    return TRUE;
}

Let me know if you need more help...

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Fox Pro commands 15 50
Visual Studio 2015 locks debug executable 9 217
Problem to packaging 1 99
Microsoft C++ code failing in executable that worked 9 112
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question