Reversing SetLastError
kernel32!SetLastError(dwErrorCode)
{
if(g_dwLastErrorToBreakOn!=null)
{
if(g_dwLastErrorToBreakOn==dwErrorCode)
{
DbgBreakPoint();
}
}
if(teb.LastErrorValue!=dwErrorCode)
{
teb.LastErrorValue=dwErrorCode;
}
}
kernel32!DbgBreakPoint:
7c87f4cb ff25e810807c jmp dword ptr [kernel32!_imp__DbgBreakPoint (7c8010e8)]
ntdll!DbgBreakPoint:
7c921230 cc int 3