Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Scheduled Pinned Locked Moved C#
helpperformance
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ASysSolvers
    wrote on last edited by
    #1

    In my application I have hooked the keyboard.Global hooked and in one function im getting a error saying.. “Attempted to read or write protected memory. This is often an indication that other memory is corrupt.” It comes from this code statement, return CallNextHookEx(hookID, nCode, wParam, ref lParam); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, ref KBDLLHOOKSTRUCT lParam); This cause to carshed my application. And Can U explain to overcome this issue.

    L 1 Reply Last reply
    0
    • A ASysSolvers

      In my application I have hooked the keyboard.Global hooked and in one function im getting a error saying.. “Attempted to read or write protected memory. This is often an indication that other memory is corrupt.” It comes from this code statement, return CallNextHookEx(hookID, nCode, wParam, ref lParam); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, ref KBDLLHOOKSTRUCT lParam); This cause to carshed my application. And Can U explain to overcome this issue.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      ASysSolvers wrote:

      This cause to carshed my application. And Can U explain to overcome this issue.

      Yes, you are having a buffer overflow/overrun in your unmanaged code.

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      A 1 Reply Last reply
      0
      • L leppie

        ASysSolvers wrote:

        This cause to carshed my application. And Can U explain to overcome this issue.

        Yes, you are having a buffer overflow/overrun in your unmanaged code.

        xacc.ide - now with TabsToSpaces support
        IronScheme - 1.0 alpha 4a out now (29 May 2008)

        A Offline
        A Offline
        ASysSolvers
        wrote on last edited by
        #3

        Yes it is true. I have a grabber control to play TV stream. it a .ocx control. Can U explain how we design a apllication for that kind of issues.. Thankz

        L 1 Reply Last reply
        0
        • A ASysSolvers

          Yes it is true. I have a grabber control to play TV stream. it a .ocx control. Can U explain how we design a apllication for that kind of issues.. Thankz

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          ASysSolvers wrote:

          Can U explain how we design a apllication for that kind of issues..

          Attach an unmanaged debugger and look for the error. Your structs that you pass to the unmanaged function is probably incorrect/too small/misaligned etc. I cant help you on that.

          xacc.ide - now with TabsToSpaces support
          IronScheme - 1.0 alpha 4a out now (29 May 2008)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups