|
Everybody know that we can call DOS interrupt fuction by using "int" keyword
for example:
mov ah,4
int 1ah
Do you know how to call a interrupt function in VC6 or in a driver?
Appreciate for any suggestions!
|
|
|
|
|
the programs you run are in User Mode( ring-3 applications, you can read more about this in intel processors specifications). They cannot run INT commands( and many others, they are called priviledged op codes, see the reference above).
And if anyway you could do it (I mean if you write a
device driver and call the above INT command), many
INTs don't have the functionality you have
seen before in old days of real-mode OSs like DOS.
|
|
|
|
|
Somebody said to me
that we can use IoConnectInterrupt function
but I don't know how to use this function
My aim is to get the real date of CMOS
At first, I want to call Interrupt 0x1a, function 4. However, this could restart my computer when running to the code
Then I read register 0x32 of CMOS to get the century, such as 19 century of 1999. Here exists a problem. Register 0x32 of CMOS can not be the real century of year. Have you some way to make it to be the real century? Or have you some other way to get the real date?
Appreciate your answer!
|
|
|
|
|
If you want the system time, use GetSystemTime .
You're out of luck, if you want to read the CMOS data, unless you write a device driver. Even then you'll need to read the addresses directly rather than using the BIOS, because Windows has replaced the interrupt handler table.
|
|
|
|
|
if you are using windows 98 or 95 you can call
interrupts, but on xp & 2k no way there from user
mode applications!
that function IoConnectInterrupt is for device
drivers, and does not do what you need.
anyway, you can use some device drivers like ntport
to have direct access to ports, then you can
use direct port access and so you can read CMOS.
( so no need to use the interrupt, but you
have to know how to read CMOS using in/out OPs)
anyway it's a long way. if you have any other
alternatives, I recommend you to review them,
maybe you are going the hard way...
|
|
|
|
|
Hi
Now I can access to CMOS registers by device driver. Only a pity is that the century value is not very right. For the data read from 0x32 register is not the realtime value.
Thanks for your attention!
|
|
|
|
|
I am trying to set a window to process notifications from directoshow like so:
cTrailer.pEvent->SetNotifyWindow((OAHWND) hwndNotify, WM_GRAPHNOTIFY, 0);
But I keep getting the following compile error:
error C2039: 'SetNotifyWindow' : is not a member of 'IMediaEvent'
I am using Visual C++ 6.0 and Direct X SDK 9.0
The strange thing is that in the sample code and the documentation, this is how it is done. What little settings am I missing here?
|
|
|
|
|
It is the IMediaEventEx interface that defines the SetNotifyWindow() method. IMediaEvent does not define it. If you get IMediaEvent try QI-ing for IMediaEventEx.
|
|
|
|
|
Arghhh stupid bug...I had queried it using IMediaEventEx but pEvent was defined as IMediaEvent in my class...stupid, stupid, stupid...thanks for the help.
|
|
|
|
|
I write an ATL control to implement the onunload event of the html.
I set the onunload handle through IHTMLBodyElement. But it did not work.
Source code as follow:
//definition of IDHTMLTest2 in IDL
interface IDHTMLTest2 : IDispatch
{
[id(1), helpstring("method ShowMsg")] HRESULT ShowMsg();
};
//selection of the source code
CComPtrspIE;
m_spClientSite->GetContainer(&spIE);
CComQIPtrspDoc(spIE);
if (spDoc){
CComPtr spElement;
spDoc->get_body(&spElement);
CComQIPtr spBody(spElement);
IDispatch* pShowMsg;
QueryInterface(IID_IDHTMLTest2,(void**)&pShowMsg);
VARIANT v;
v.vt=VT_DISPATCH;
v.pdispVal=pShowMsg;
//this event can't be invoke ,when close the ie-window
spBody->put_onunload(v);
//this invoke works well
((IDHTMLTest2*)pShowMsg)->ShowMsg();
//code below can works well
// v.vt=VT_BSTR;
// v.bstrVal = L"#DA70D6";
// spBody->put_bgColor(v);
}
Thank you for your advanced help.
Regards.
|
|
|
|
|
If I were to decide, this code should work. Some remarks:
1.Shouldn't you write
CComQIPtr<IID_IHTMLBodyElement> spBody(spElement);
Otherwise how does QI know wich interface to query for? Same with spDoc.
2.I would reccomend you to use smart dispatch pointer: IDispatchPtr. This way you don't have the trouble with QI and releasing it.
3.Since
spBody->put_bgColor(v);
((IDHTMLTest2*)pShowMsg)->ShowMsg();
seem to work, the problem should be with "v" or put_onunload.
Maybe 2. will solve the issue? Eventuelly you could try a CComVariant on "v".
4.What if setting with spElement's setAttribute onunload=ExitFunction, additionally inserting the ExitFunction with an alert?
Peter Molnar
|
|
|
|
|
I have tried by your advice. But it sitll not work.
And I set the default method.
[id(0), helpstring("method Prompt")] HRESULT ShowMsg();
The DHTML will invoke the default method with DISPID=0;
It still not work. Have you any source code which can run
smoothly .Could you send me for reference ?
Thank You.
Email: fengrux@hotmail.com
|
|
|
|
|
The last resort I see is to implement 4./
For this you will have to insert another attribute into the body tag with the name onunload.
you have two choices:
<body onunload="alert('This is my onunload message!')">
or
<script language=javascript>
function ExitFunction()
{
alert('This my ExitFunction message');
}
</script>
<body onunload=ExitFunction()>
Your code:
spElement->setAttribute(CComBSTR("onunload"),CComVariant("\"alert('This is my onunload message!')\""),0);
or
spElement->insertAdjacentHTML(CComBSTR("beforeBegin"),CComBSTR("...the entire script tag..."));
spElement->setAttribute(CComBSTR("onunload"),CComVariant("ExitFunction()"),0);
Peter Molnar
|
|
|
|
|
You mean insert code in the HTML ??
My intention is to fire the Event in the ActiveX control .
Thus , web designer without konwing about the Activex can simply using "<object>" tag to deploy the ActiveX.
|
|
|
|
|
Yes, you should definitly insert code into the HTML.
Of course this is not the HTML the user of your ActiveX creates but the HTML your ActiveX "perceives" of the user's HTML code or "thinks" the user wrote.
All this has the aim to fire the onunload event.
You know: the aim justifies the means...
Peter Molnar
|
|
|
|
|
OK I am watching tv like a scout and here is this fellow selling a book on hacking. He went on to show how to over-run a buffer and loading the stack with his code to cause the return to be over written.
Question 1: In dialogs we can force the command line to be read and set upon the stack, and in MDI - SDI they come naturally in InitInstance, should we place code in argv argc to limit the size of the argument.
Question 2: Should we disable or send argv and argc to a function the dump(s) them.
This is a real concern for me if the small man in the TV is right because I have applications written in vc and lcc since 1990 that scream with this flaw.
Please let me know what to do, I need your help on this one, any idea's will be appreicated.
Best Wishes,
ez_way
|
|
|
|
|
any Windows application uses GetCommandLine() API
to receive a pointer to its command line arguments,
or uses a parameter which is passed to its WinMain
function that points to the program command line.
After that,if you have a main function,
C Run-Time Libraries (CRT) formats the
arguments, seperates them, and counts them and then
sends them to your main function using argv and
argc.
if you use MFC, it has some wrappers around this
command line(but you can use __argc & __argv which are globally defined),anyway the
WinApp::m_lpCmdLine contains the raw command line.
Up to here no stack overflow or other flaws exist.
now it depends on your code to how to deal with
these arguments.
if you do something like:
char myparams[100];
strcpy(myparams, AfxGetApp()->m_lpCmdLine);
or even:
printf(AfxGetApp()->m_lpCmdLine);
then you have to review your old codes.
|
|
|
|
|
Yes but you miss the point. I understand how it works but let me explain that if someone overfloes the buffer with their code, that code is placed on the stack (near), when the app returns it will execute their code period. All they have to do is figure out how many bytes to oplace in the overrun.
Best Wishes,
ez_way
|
|
|
|
|
You're both saying the same thing. While it may be possible to break your older applications (only you know the answer to this), the bigger question you have to ask is "Would anyone bother?". If the payoff is small, a "hacker" is not going to bother.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi all:
please give me some information about using GDI+ in MFC model.
When I declare an Image pointer variabe 'myImage' in my XXDoc.h and,
I new an Image in XXDoc.c::OnOpenDocument() like that:
myImage = new Image (L"xxxxfilename", 0);
But I got an error message when compiling
error C2660: Gdiplus::GdiplusBase::operator new: no function declared in 3 parameters.
|
|
|
|
|
It only does that in DEBUG builds, one way around the problem is to use the ::new instead of DEBUG_NEW
myImage = ::new Image(L"xxxxfilename", 0);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I would like to be able to distinguish Network Interface Cards installed on the system and Virtaul Adapters that are software or driver based (i.e. VMWare adapters). Does anybody know of a way to do this? Your help is greatly appreciated.
|
|
|
|
|
Hi,
How do you detect that a view window has been minimized (as by clicking on the view window's minimize button)? Should be an easy one, but none of the view's filtering functions like WindowProc and DefWindowProc seem to handle the WM_SYSCOMMAND messages. Is there a function you can call from the view to determine if it has been minimized or maximized?
Thanks for any help on this.
Terry
|
|
|
|
|
CWnd::IsIconic()
CWnd::IsZoomed()
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
CWnd::IsIconic()
CWnd::IsZoomed()
How are these functions used? I've tried putting the IsIconic function in the view's Idle (On Update)function, "minimize=IsIconic();" and it always returns 0, whether the view is minimized or not. Very frustrating that a simple thing like this is so obscure in MFC.
Terry
|
|
|
|