I'm trying to write a test that checks for data overruns using VirtualAlloc and VirtualProtect and I think I may have found a bug. Here is the problem:
DWORD dwPageSize; BYTE * twoPages, temp; DWORD flOldProtect; twoPages = VirtualAlloc(NULL, 2 * dwPageSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); res = VirtualProtect(twoPages + dwPageSize, dwPageSize, PAGE_NOACCESS, &flOldProtect); temp = twoPages[dwPageSize + 1]; // should cause exception but doesn't in wine twoPages[dwPageSize + 1] = 0; // does cause exception
I would like to write a test to check the exception handling but I don't know how to do a __try and __except in C.
Any ideas?