weixin_39817347 2020-11-30 07:35
浏览 0

CreateDIBSection sometimes results in "unknown region" warnings

From timurrrr.com on August 04, 2011 06:54:22

Repro on Win 7 [ flaky :( ]

include

include

pragma comment(lib, "gdi32.lib")

pragma comment(lib, "user32.lib")

int main() { HDC hdc = CreateCompatibleDC(NULL); assert(hdc);

const int WIDTH = 32, HEIGHT = 32, SIZE = WIDTH * HEIGHT * 3; // 32x32 = 1024 = 0x400; 1024x3 = 3072 = 0x0c00.

BITMAPINFOHEADER bi = {0}; bi.biSize = sizeof(bi); bi.biBitCount = 24; bi.biCompression = BI_RGB; bi.biPlanes = 1; bi.biWidth = WIDTH; bi.biHeight = -HEIGHT; // Negative means "top-down DIB". Well, positive height gives the same warning too.

void data = NULL; HBITMAP hbitmap = CreateDIBSection(hdc, (BITMAPINFO)&bi, 0, &data, 0, 0); assert(hbitmap); memset(data, 0, SIZE);

DeleteDC(hdc); DeleteObject(hbitmap);

return 0; }

Sometimes the memset line produces a warning like this in a global.PID.log file: "WARNING: unknown region 0x001b0000-0x001b1000 (size=0x00001000): marking as defined"

With a local patch which prints out unknown region stack trace, I got the following stack: 0x1013a06a drmemorylib.dll!replace_memset drmemory\replace.c:153 0x004010ee test.exe!main test.cpp:25

xref https://code.google.com/p/chromium/issues/detail?id=91505

Original issue: http://code.google.com/p/drmemory/issues/detail?id=539

该提问来源于开源项目:DynamoRIO/drmemory

  • 写回答

6条回答 默认 最新

  • weixin_39817347 2020-11-30 07:35
    关注

    From timurrrr.com on August 04, 2011 06:48:30

    Hmmm, looks like handle_GdiCreateDIBSection is called only for pre-. Is this expected?

    Status: Accepted
    Owner: bruen....com

    评论

报告相同问题?