Loading ...
Sorry, an error occurred while loading the content.

30001Re: win32 libcall() crash not found

Expand Messages
  • Bruce Mellows
    Oct 7, 2002
      This is the code to protect a function from a GPF.


      - The critical part of the work *MUST* be done in assembler - so I
      decided that it might be best if it was ALL in assembler - so it can be
      in one place (the actual exception handler could have been done in less
      than ten lines of C).

      - The assembler used is nasm - I could re-write it in masm if that was

      - The (example) mk.bat assumes a correct environment to run both the
      nasm assembler and the bcc32 compiler.

      - There is a void pointer in the prototype for the protected function -
      obviously this can be replaced with a single safely typed parameter -
      the assembler just passes one (32bit) parameter along from caller to callee.


      - Check out www.godevtool.com if you want to know more (I spoke to the
      author of this site, and he said that is was OK to disseminate this
      knowledge, but would appreciate the web site being mentioned - and here
      it is).



      Walter Briscoe wrote:

      >In article <200210031806.g93I6qu02401@...> of Thu, 3 Oct 2002
      >20:06:52 in , Bram Moolenaar <Bram@...> writes
      >>Walter Briscoe wrote:
      >>>I shall look at:
      >>>>9 When using libcall() for a function that returns an invalid
      >>>>pointer, Vim
      >>>> crashes. Check for a bad pointer with isBadReadPtr() doesn't appear to
      >>>> work well.
      >>>Steve Oualline's book does not mention libcall. I see it is mentioned in
      >>>version5.txt as a contribution from Negri. Perhaps Vince can get me up
      >>>to speed with a demonstration of the feature. It must be useful as it
      >>>was originally implemented only in Win32 and is now also done in UNIX.
      >>It would be good if you can fix this. I did an attempt once, but
      >>couldn't find a way to avoid a crash. Best is if any use of libcall()
      >>detects that a pointer is not valid and gives an error message instead
      >>of crashing.
      >Thanks to Vince Negri for a DLL. I did manage to produce a crash in that
      >DLL when I miscalled a function. I did not manage to crash vim itself.
      >It may be reasonable to use Bruce Mellows protection against a GPF in a
      >dll. Can you please email me a copy, Bruce? For reasons I have not
      >diagnosed, let &ts=libcall... sets &ts to '8'.
    • Show all 15 messages in this topic