?
Solved

Windows VXD and IRQ Handling

Posted on 1997-05-17
1
Medium Priority
?
268 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 200 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

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 …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

719 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