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. Emergence! 0xC0000005: Access Violation again [modified]

Emergence! 0xC0000005: Access Violation again [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugging
6 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.
  • W Offline
    W Offline
    whiteclouds
    wrote on last edited by
    #1

    Hi, thomas! Thanks for your reply. I think I had found the reason. After I delete some variables that aren't be used any more, the exception is missing. But another exception is occur same as this when I use the code following:

    	time\_t	ltime;		// local time
    	struct tm \*gmt;	// Greenwich Mean Time
    	png\_time ttime;	// png format
    	time (&ltime);	// get the local time---EXCEPTION 0xC0000005 OCCUR HERE!
    	gmt = gmtime (&ltime);	// convert to gmt
    	png\_convert\_from\_struct\_tm (&ttime, gmt);  // convert to png format	
                png\_set\_tIME (png\_ptr, info\_ptr, &ttime);
    

    I trace this exception into MFC and I found when a function named _mlock was invoked in the __tzset function, the exception occur. The related code like this:

                \_mlock( \_TIME\_LOCK );
    

    I don't know the reason and hope you or others can give me some suggestion. Thank you! By the way: if the title of this message offend someone, I'm very sorry because this event is an emergency really.:mad: Regards! whiteclouds

    modified on Thursday, January 1, 2009 8:20 PM

    L 1 Reply Last reply
    0
    • W whiteclouds

      Hi, thomas! Thanks for your reply. I think I had found the reason. After I delete some variables that aren't be used any more, the exception is missing. But another exception is occur same as this when I use the code following:

      	time\_t	ltime;		// local time
      	struct tm \*gmt;	// Greenwich Mean Time
      	png\_time ttime;	// png format
      	time (&ltime);	// get the local time---EXCEPTION 0xC0000005 OCCUR HERE!
      	gmt = gmtime (&ltime);	// convert to gmt
      	png\_convert\_from\_struct\_tm (&ttime, gmt);  // convert to png format	
                  png\_set\_tIME (png\_ptr, info\_ptr, &ttime);
      

      I trace this exception into MFC and I found when a function named _mlock was invoked in the __tzset function, the exception occur. The related code like this:

                  \_mlock( \_TIME\_LOCK );
      

      I don't know the reason and hope you or others can give me some suggestion. Thank you! By the way: if the title of this message offend someone, I'm very sorry because this event is an emergency really.:mad: Regards! whiteclouds

      modified on Thursday, January 1, 2009 8:20 PM

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, 0xC0000005 is an access or privilege violation, which means you can't access something; quite often it indicates an invalid pointer, such as NULL. It could also mean you don't have the required privileges to do something. suggestion: look at your source code, and all the variables that appear in the line that fails. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      Love, happiness and fewer bugs for 2009!


      W 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, 0xC0000005 is an access or privilege violation, which means you can't access something; quite often it indicates an invalid pointer, such as NULL. It could also mean you don't have the required privileges to do something. suggestion: look at your source code, and all the variables that appear in the line that fails. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        Love, happiness and fewer bugs for 2009!


        W Offline
        W Offline
        whiteclouds
        wrote on last edited by
        #3

        Hi I can't get your meaning. I check my code again. The address of the variable ltime is valid. All things looks like in order. But the error always occur. :( Help! Regards! whiteclouds

        L 1 Reply Last reply
        0
        • W whiteclouds

          Hi I can't get your meaning. I check my code again. The address of the variable ltime is valid. All things looks like in order. But the error always occur. :( Help! Regards! whiteclouds

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Maybe this is relevant[^]? :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          Love, happiness and fewer bugs for 2009!


          W 1 Reply Last reply
          0
          • L Luc Pattyn

            Maybe this is relevant[^]? :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            Love, happiness and fewer bugs for 2009!


            W Offline
            W Offline
            whiteclouds
            wrote on last edited by
            #5

            I think I had resolved this problem. My solution is to instead the time_t with SYSTEMTIME structure. Then everything looks right. Otherwise I don't know the detail of it. I think maybe this structure was obsoleted. :)

            L 1 Reply Last reply
            0
            • W whiteclouds

              I think I had resolved this problem. My solution is to instead the time_t with SYSTEMTIME structure. Then everything looks right. Otherwise I don't know the detail of it. I think maybe this structure was obsoleted. :)

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Glad you got it working. Thanks for sharing this. :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              Love, happiness and fewer bugs for 2009!


              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