Re: Validating a Function Address



"Thorsten Albers" <albersRE@xxxxxxxxxxxxxxxxxxx> wrote in message
news:01c71d90$9ea29620$214bf8d9@xxxxxxxxxxx
What, if the function to call resides in a DLL, and this DLL in the
meantime has been unloaded willingly or due to a crash? With every code
pointer one should at least check with IsBadCodePtr() if the memory at the
given address is executable. Of course, there are lots of other
possibilities for a GPF, but if we can exclude one, why not do it?

I think you're going too far with checks and will get odd side effects.
You'd need to check it every time you called the function pointer so will
get a reduction in performance. If you do happen to find a bad pointer then
your app will start to malfunction anyway which might cause other odd side
effects. Extra testing would be required to check for these side effects as
they might cause loss of data. The general thinking I believe is if you get
something as serious as an invalid function pointer then your app should
terminate as something is seriously wrong and continuing might cause a loss
of data.

Michael


.



Relevant Pages

  • Re: IOCP critical sections and mutexes
    ... mismatch and invalid 'this' pointer). ... instance) and I get pretty much the same crash. ... I mush have done something stupid in my main thread app. ... If I use a mutex instead it works fine. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Trouble with malloc().
    ... >> I am having trouble with malloc() again for a PC app I am developing. ... This is the only warning or error I get. ... not-necessarily-compatible pointer type. ...
    (comp.lang.c)
  • Re: Pointer to Document in MDI application - Problem
    ... Even if you have kept a copy of the pointer to the document in m_pDoc, ... The secret lies in the CDocument member, ... > In my MDI application, a default document is created when the app. ... If I open then close a saved document, ...
    (microsoft.public.vc.mfc)
  • Re: Send key stroke command from one pc to another on the network
    ... someone out there can suggest a pointer for me. ... to get to the PC and either click the mouse or hit the space bar. ... First of all, I think there is an app running on PC 'A', right? ... Application on PC 'B' will now be changed to have a TCP client. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: GUI vs: CLI (was: Shell command in VB6)
    ... > Suppose you have a maximized app. ... > pointer doesn't move any further, and then click the mouse, do you ... Maybe it's a learning curve issue. ... But I'll make a mental note to ask the next few typical users I ...
    (comp.programming)

Loading