void myFunction(LPCTSTR pStr, int ncbNumCharsInStr)
{
__try
{
//Do work with 'pStr'
}
__except(1)
{
//Catch all
//But here I need to log `pStr` into event log
//For that I don't want to raise another exception
//if memory block of size `ncbNumCharsInStr` * sizeof(TCHAR)
//pointed by 'pStr' is unreadable.
if(memory_readable(pStr, ncbNumCharsInStr * sizeof(TCHAR)))
{
Log(L"Failed processing: %s", pStr);
}
else
{
Log(L"String at 0x%X, %d chars long is unreadable!", pStr, ncbNumCharsInStr);
}
}
}
Мне нужно следующее для обработчика исключений в коде C ++. Скажите, у меня есть следующий кодовый блок: < /p>
[code]void myFunction(LPCTSTR pStr, int ncbNumCharsInStr) { __try { //Do work with 'pStr'
} __except(1) { //Catch all
//But here I need to log `pStr` into event log //For that I don't want to raise another exception //if memory block of size `ncbNumCharsInStr` * sizeof(TCHAR) //pointed by 'pStr' is unreadable. if(memory_readable(pStr, ncbNumCharsInStr * sizeof(TCHAR))) { Log(L"Failed processing: %s", pStr); } else { Log(L"String at 0x%X, %d chars long is unreadable!", pStr, ncbNumCharsInStr); } } } [/code]