C++ :: Hook HW Interrupts In Flat Memory Mode With DOS32/A
Jul 23, 2012
I have a question about how to hook HW interrupt in flat memory mode...
@ about my application...
- application is created by combining Watcom C and DOS32/A.
- application is written for running on DOS mode( not on OS mode )
- with DOS32/A now I can access >1M memory and allocate large memory to use...(running in flat memory mode !!!)
@ current issue...
- I want to write an ISR(interrupt service routine) for one PCI card. Thus I need to "hook" the HW interrupt.
- Ex. the PCI card's interrupt line = 0xE in DOS. That means this device will issue interrupt via 8259's IRQ 14.
But I did not how to achieve my goal to hook this interrupt in flat mode ?
@ resource I found...
- in watcom C's library, there is one sample using _dos_getvect, _dos_setvect, and _chain_intr to hook INT 0x1C...
I tested this code and found OK. But when I apply it to my case: INT76 ( where IRQ 14 is "INT 0x76" <- (14-8) + 0x70 )
then nothing happened...
* I checked HW interrupt is generated but my own ISR did not invoked...
Do I lose something ? or are there any functions I can use to achieve my goal ?
I am working on a program that does something like this,
Void main() { cout<<"H";timedelay(1); cout<<"E";timedelay(1); cout<<"L";timedelay(1); cout<<"L";timedelay(1); cout<<"O";timedelay(1); //timedelay(int a) is a function which gives a delay of 'a' seconds. { .... } }
This code is just for fancy and I would like to squish in some statements which would give the user an option to skip it (by entering any keyboard key),and resume with the rest of the program.
I'm having issues with drawing a flat style dropdown menu in XP.
Here is the custom dropdown menu element:
public class FlattenCombo : ComboBox { private Brush BorderBrush = new SolidBrush(SystemColors.WindowFrame); private Brush ArrowBrush = new SolidBrush(SystemColors.ControlText); private Brush DropButtonBrush = new SolidBrush(SystemColors.Control); public Color HighlightColor { get; set; }
[Code] ....
Here is what it looks like in XP:
And here's what it should look like (this is how it's rendered in Windows Vista/7):
I'm currently working on a program that calculates shipping charges. However I'm stuck, whenever I compile the program the total amount at the end always comes up as my flat rate variable and not the total calculated number.
Is there any way that I can call a function/receive an event whenever an external window (not any of my forms) repaints/draws?
If you create a GDI+ graphics object and give it the HWND of another window that refreshes a lot like a web browser, anything with animated graphics, your draws and the windows draws are out of sync which creates an intense flicker effect.
Googling this issue only brings up results for handling when my own form repaints...
My idea is that I could just redraw my GDI stuff whenever the form redraws, this is indeed possible?
I had created a global hook by SetWindowsHookEx with WH_CALLWNDPROC. It is used to create a new toolbar button in specific window in the specific (3rd party) program (named HOOKEE.exe for example), and it works perfectly fine most of the time. Normally HOOKEE.exe is launched by double clicking the shortcut icon on desktop. But this program could be also launched in another way (provided by the provider of HOOKEE.exe), with this new way, HOOKEE.exe is by conhost.exe (on Windows 7), and then I could see (via ProcessMonitor) my hook is loaded by conhost.exe, but not the process HOOKEE.exe. In my understanding global hook would be loaded by whatever process, I have no idea on the exception, and what conhost.exe does to the HOOKEE.exe.
I need to do it to avoid calling a function of my process from injected code.
So would like to hook this function to check whether the call is from the current module or it is from an external module, then I compare the address of the instruction who did the call with the module address range.
I've been trying for over an hour to think of the logic to find the mode of an array.I left out code for initializing the arrays, but all the values in the array are between 0-9. Check out my code below.
Code:
int mode( int array[], int size ) { int i; int count; int max = 0; int num = 0; int mode;
How do you find a mode in array? This is what i got so far. I put this after i sort the array
for (int index = 0; index < size2; index ++) { //count[mode[index] - 1]++; if (mode[index] == mode[index + 1]) // compare the first to sec array { again++; cout <<"This is number " << again << endl; } }
I've been wondering if there's a function or procedure used to know the current video mode. An example of how this was done in Pascal:
function VideoMode : integer; begin if (lastmode = BW40) or (lastmode = BW80) VideoMode := 40 else VideoMode := 80; end;
I've been told "conio.h" has a lastmode function, but it doesn't seem to be supported in Dev-C++ and Visual Studio C++. Is there a Windows function to know the number of columns in the current video mode?
My code seems to find the mode of the array I input sometimes. Sometimes it gives me the wrong number or multiple numbers. It just all depends on what is number is inputted into the array. I don't know what the problem is. I tried looking online and editing many times and can't find the answer. Maybe I'm overlooking something or doing something wrong. Here's my code.
I get this error when i try to run this code for an inventory in debug mode in VS. But for some reason it works just fine in release mode.
void Push_Back_Item(Item *item){ for(int y = 0; y < InvSizeY; y ++) for(int x = 0; x < InvSizeX; x ++){ auto Iter = ItemList.find(std::make_pair(x,y)); if(Iter != ItemList.end()){ item->SetDead(); // ERROR } } }
This isnt the full code though but it still gives me the same error.
The only thing "item->SetDead()" does is to set a bool to true.
This is the map i get the iterator from std::map<std::pair<int,int>,Item*> ItemList;
This have been bugging me for quite some time now.
I'm currently working with linear VRAM (a buffer with 256KB memory, divided into four 64k planes, so plane 0 at 0x00000, plane 1 at 0x10000, plane 2 at 0x20000, plane 3 at 0x30000). Just add the index of the plane to that for the full address in VRAM.
I'm still wondering how to get a specific pixel from VRAM (x,y coordinate) when doing graphic modes (none color modes work, only the black/white pixels (1-bit) graphic mode works).
how I can get specific pixels from the VGA VRAM (having linear access described above) using Shift Register Interleave mode (VGA modes 4&5), 16-bit planar mode (Most VGA modes) etc.
i've got an assigment that requires me to overload some operators and add some objects together.
I will show the code and explain as good as I can.
void SArray::operator+= (const SArray &obj) { Sphere * tmp_arr; tmp_arr = new Sphere[obj.antalobjekt+this->antalobjekt]; //antalobjekt = //Gets amount of elements in the arrays.
[Code]......
m_arr is the inner array for storing elements, do ask if something is not clear enough. The copy constructor works, so i have not included it.
So I am trying to find the min, max, range, mean, median, and mode. The max number is right but the min isnt. Once that is corrected, i can get range and mean easily. Also, how to get mode and median. I am guessing the values in the arr2 would have to be sorted. This refers to the values in arr2 which are the calculated values in the formula. You can enter -2 and 2 for userMin and userMax.
#include <iostream> #include <iomanip> using namespace std; int main() { cout << fixed << setprecision(1); float userMin;
I am creating a C# windows application which allows it to connect to our devices and communicate with them.
Often we need to customise this application and I have made this easier by defining its appearance and actions within an XML file which gets read in every time the application starts up. This is working really well.
However editing this XML file can be pretty laborious and often requires many cycles to get everything correct again. So I have started to create a graphical editor which allows for the XML to be generated.
The problem I am facing is that I am using the same controls in the final program and the editor so my question is how should I structure the code so that each control knows when it is in "Normal" mode and when it is in "Edit" mode?
I have started using a simple boolean flag to indicate its mode, however this now means that within every function I need to check this flag and run code appropriate to that mode, this seems a bit over the top. Is there a better/standard way this sort of this is done?