Home > Back-end >  For two short C language function is transformed into the DELPHI version
For two short C language function is transformed into the DELPHI version

Time:09-16



LPBYTE FindStockDay (LPBYTE pData, long MaxNum, UINT py, UINT time)
{
LPBYTE p=pData + p y + 0 x18;
For (int I=0; I & lt; Xc00 (0-0 x18)/4; I++)
{
UINT a=* (UINT *) (p + I * 4);
UINT b=a * 0 xc00;
If (a & lt; MaxNum)
{
Int a1=sizeof (TDXL2);
LPBYTE p2=pData + b;
For (int j=0; J & lt; 0 xc00/sizeof (TDXL2); J + +)
{
LPBYTE PTDX=p2 + j * sizeof (TDXL2);
If (* (UINT *) (PTDX)==time)
{
Return PTDX;
}
}
}
}

Return FALSE;
}

PBYTE FindStock (LPBYTE pData, long nFileLen, TCHAR * pCh)
{
If (nFileLen % (signed int) 0 xc00)
{
Return FALSE;
}
Int Num=nFileLen/0 xc00;
For (int I=0; I & lt; Num. I++)
{
LPBYTE p=pData + I * 0 xc00;
If (* (p + 4) (DWORD *)!=0 x1770
| | * (signed int *) (p) & gt;=(signed int) 0 x1770
| | * * (DWORD) (p + 8)! Num=)
{
if (! STRCMP ((char *) (p), pCh))
{
return p;
}
}
}
Return FALSE;
}

CodePudding user response:

Code base can equivalence translation, the type of the Windows in the system LPBYTE and PBYTE is one thing (early age 16, LPBYTE is a 32-bit pointer, PBYTE is 16 pointer), and PBYTE in Delphi, UINT is a 32-bit unsigned integer, TCHAR according to whether the unicode version changes, or WideChar AnsiChar,
  • Related