- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
size_t __stdcall ZAsmView::addrSet(DIS const *pDis, unsigned __int64 Va, wchar_t * buf, size_t cb, unsigned __int64 * displacement)
{
FORMATDATA* pf = (FORMATDATA*)pDis->PvClient();
size_t fixupLen = pf->fixupLen;
pf->fixupLen = 0;
*displacement = 0;
BOOL f = TRUE;
PVOID _Va = (PVOID)Va;
ZDbgDoc* pDoc = pf->pDoc;
__loop:
if (PCSTR Name = pDoc->getNameByVa((PVOID)Va))
{
char cc[256];
PCSTR fName = unDNameEx(cc, Name, sizeof(cc), UNDNAME_NAME_ONLY);
int len = _snwprintf(buf, cb, L"%S(%p)", fName, Va);
if (len < 0)
{
buf[len = (DWORD)cb - 1] = 0;
}
else
{
buf[0] |= 0x4000, buf[len - 3 - 2*sizeof(PVOID)] |= 0x8000;
}
return len;
}
if (f && 2*sizeof(PVOID)+2<cb)
{
switch (pDis->Trmta())
{
case DIS::a_jmp_u_2:
case DIS::a_jmp_u_5:
case DIS::a_jmp_c_2:
case DIS::a_jmp_c_6:
_snwprintf(buf, cb, L"%p %c", (PVOID)Va, Va > pf->pLI->Va ? 0x2193 : 0x2191);
buf[0] |= 0x4000, buf[2*sizeof(PVOID)-1] |= 0x8000;
return 2*sizeof(PVOID)+2;
}
}
if (fixupLen)
{
if (0 <= pDoc->Read((PVOID)Va, &Va, sizeof(PVOID)))
{
fixupLen = 0, f = FALSE;
goto __loop;
}
}
if (2*sizeof(PVOID)+2<cb && pDoc->getDllByVaNoRef(_Va))
{
_snwprintf(buf, cb, L"%p", _Va);
buf[0] |= 0x4000, buf[2*sizeof(PVOID)-1] |= 0x8000;
return 2*sizeof(PVOID);
}
return 0;
}