Use windbg to track reason for Attempted to read or write protected memory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MightyPolo
    New Member
    • May 2010
    • 4

    #1

    Use windbg to track reason for Attempted to read or write protected memory

    I have a Class which has intPtr to bitmap data.

    I am greating a Bitmap instance using
    Code:
    new Bitmap(my_width, imageHeader.biHeight, stride, pixelFormat, pixelDataHandle);
    later i flip the bitmap with RotateFlip(Rota teFlipType.Rota teNoneFlipY);

    Now, everything seems to work fine for some time.
    When i ask class for Bitmap it always creates new one which is later disposed.

    I came across a situation when I attempted to read or write protected memory on RotateFlip(Rota teFlipType.Rota teNoneFlipY);.

    I wanted to know what is going on, so i started to dig with windbg.

    But I dont know, how to find which address was used for the new bitmap. And how to find what is holding the peace of memory.

    Interesting is, that the bitmap is created for first time, but when i ask again, i get an error. This is happening rarely.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Sounds like your pointer is going out of scope

    Comment

    • MightyPolo
      New Member
      • May 2010
      • 4

      #3
      Originally posted by Plater
      Sounds like your pointer is going out of scope
      Hi, i guess so, but i would like to know how it happend.
      what i get from exception is
      Code:
      (a50.6cc): Access violation - code c0000005 (first/second chance not available)
      eax=1ade0448 ebx=030b7740 ecx=2407070c edx=0054ff48 esi=000007c4 edi=1ade0448
      eip=70df1d4d esp=0012eeac ebp=0012eedc iopl=0         nv up ei pl nz na po nc
      cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
      gdiplus!_FlipX8bpp+0x13:
      70df1d4d 8a10            mov     dl,byte ptr [eax]          ds:0023:1ade0448=??
      last call in the call stack is gdiPlus!_Flip8b ppX+0x13 but i dont know what are parameters for this function. Google didnt find anything so i dont know how to figure out what went wrong :-(

      Is it possible to get map of GlobaLocks becouse this is what i use for locking (GlobalLock in kernel32.dll) and unlocking memory (GlobalUnlock).

      How can i find what is the scope pointer shuld be in?

      Thanks for any insight.

      Dissasembly and call stack are in attachment.

      Another thing is that iam working strictly with 8bpp bitmaps which i heard that gdi is not very heapy with.
      Attached Files

      Comment

      Working...