Solved

Windows VXD and IRQ Handling

Posted on 1997-05-17
1
252 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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.  …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now