Solved

Windows VXD and IRQ Handling

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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 is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 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

25 Experts available now in Live!

Get 1:1 Help Now