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 / C++ / MFC
  4. GHAAAAAAARGH!!! STATUS_ACCESS VIOLATION

GHAAAAAAARGH!!! STATUS_ACCESS VIOLATION

Scheduled Pinned Locked Moved C / C++ / MFC
helpsysadminperformance
2 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.
  • M Offline
    M Offline
    mmica
    wrote on last edited by
    #1

    Hi all, I'm going out of my mind on this problem and would really appreciate some help. I am currently writing an NT service that has two threads running. One thread is at a point where it has to create a network message and send it over a socket. However, when I try to malloc some memory for a buffer I get an NT_STATUS_ACCESS_VIOLATION exception. The code looks simple enough to me: totlen = sizeof(BH_MESSAGE) + msglen; //This evaluates to 306 char* totbuf = (char *) malloc(totlen); Any ideas coz I'm really going :wtf: crazy Regards, Mark

    D 1 Reply Last reply
    0
    • M mmica

      Hi all, I'm going out of my mind on this problem and would really appreciate some help. I am currently writing an NT service that has two threads running. One thread is at a point where it has to create a network message and send it over a socket. However, when I try to malloc some memory for a buffer I get an NT_STATUS_ACCESS_VIOLATION exception. The code looks simple enough to me: totlen = sizeof(BH_MESSAGE) + msglen; //This evaluates to 306 char* totbuf = (char *) malloc(totlen); Any ideas coz I'm really going :wtf: crazy Regards, Mark

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      Probably the heap got corrupted before your malloc call. A buffer overrun is the most common cause, and it's usually a hard thing to find; there are several tools on the market to help debug heap corruption. A simple (and cheap) thing to try is calling _CrtSetDbgFlag with at least the _CRTDBG_CHECK_ALWAYS_DF flag set. Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski

      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