Solved

Windows VXD and IRQ Handling

Posted on 1997-05-17
1
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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