当前位置: 首页 > 工具软件 > SCZ > 使用案例 >

解析 SCZ 字符串

蒋弘致
2023-12-01

解析 SCZ 字符串

 

 

直接就定义成:

typedef WCHAR *PSCZ;

就是说,PSCZ 就是保存了WCHAR *的首地址。

真正的 SCZ 字符串有两部分组成:第一部分是字符串的长度,第二部分是字符串本身,字符串以空结尾。

 

 

//----- (1008EBD7)--------------------------------------------------------
int __fastcall SczAlloc(int *a1,unsigned int a2)
{
  v2 =a1;
  v3 =a2;
  if (!a1 )
    CbsUtil_Assert((int)"base\\cbs\\util\\cbsstr.cpp", 21, (int)"pscz");
  v4 =0;
  v8 =0;
  if (v3 > 0x3FFFFFFF)
  {
    v4 =-2147317563;
    CBSWdsLog(0x4000000, -2147317563, 1, "string sizetoo big");
    return v4;
  }
  if
(!*v2 )
    goto LABEL_5;
  v4 =SczSize(*v2,&v8);
  if (v4 < 0)
  {
    CBSWdsLog(0x4000000, v4, 1, "Failed to get size of existing string");
    return v4;
  }
  if
(v8 < v3 )
  {
    operator delete
((void *)(*v2 - 4));
    *v2= 0;
LABEL_5:
    v5 =(unsigned int *)operatornew(2 * v3 +4);
    if (v5 )
    {
      *
v5= v3;
      v6 =v5 + 1;
      *v2= (int)v6;
      *v6= 0;
    }
    else
    {

      v4 =-2147024882;
      CBSWdsLog(0x4000000, -2147024882, 1, "Failed to allocate string");
    }
    return
v4;
  }
  if
(v8 )
    *(_WORD *)*v2 = 0;
  if (!*v2 )
    goto LABEL_5;
  return v4;
}

 

//----- (000000018001064C)----------------------------------------------------
__int64 __fastcall SczAlloc(__int64 *a1,unsigned __int64 a2)
{

  v2 =a2;
  v3 =a1;
  if (!a1 )
    CbsUtil_Assert((__int64)"base\\cbs\\util\\cbsstr.cpp", 21i64, (__int64)"pscz");
  v11 =0i64;
  v4 =0;
  if (v2 > 0x3FFFFFFF)
  {
    v4 =-2147317563;
    v5 ="string sizetoo big";
LABEL_15:
    v7 =v4;
    goto LABEL_16;
  }
  if
(!*v3 )
  {
LABEL_13:
    v8 =(unsigned __int64 *)operatornew(2 * v2 +8);
    if (v8 )
    {
      *
v8= v2;
      v9 =v8 + 1;
      *v3= (__int64)v9;
      *v9= 0;
      return (unsigned int)v4;
    }
    v4 =-2147024882;
    v5 ="Failed to allocate string";
    goto LABEL_15;
  }
  v6 =SczSize(*v3,&v11);
  v4 =v6;
  if (v6 < 0)
  {
    v5 ="Failed to get size of existing string";
    v7 =v6;
LABEL_16:
    CBSWdsLog(0x4000000u,v7, (size_t *)1, v5);
    return (unsigned int)v4;
  }
  if
(v2 > 0)
  {
    operator delete
((void *)(*v3 - 8));
    *v3= 0i64;
    goto LABEL_13;
  }
  if
(v11 )
    *(_WORD *)*v3 = 0;
  if (!*v3 )
    goto LABEL_13;
  return (unsignedint)v4;
}

 

//----- (1008C877)--------------------------------------------------------
int __fastcall SczSize(int a1, _DWORD *a2)
{

  v2 =a1;
  v3 =a2;
  if (!a1 )
    CbsUtil_Assert((int)"base\\cbs\\util\\cbsstr.cpp", 639, (int)"sz");
  if (!v3 )
    CbsUtil_Assert((int)"base\\cbs\\util\\cbsstr.cpp", 640, (int)"pcch");
  *v3= *(_DWORD *)(v2 - 4);
  return 0;
}

 

//----- (00000001800117C8)----------------------------------------------------
__int64 __fastcall SczSize(__int64 a1, _QWORD *a2)
{

  v2 =a2;
  v3 =a1;
  if (!a1 )
    CbsUtil_Assert((__int64)"base\\cbs\\util\\cbsstr.cpp", 639i64, (__int64)"sz");
  if (!v2 )
    CbsUtil_Assert((__int64)"base\\cbs\\util\\cbsstr.cpp", 640i64, (__int64)"pcch");
  *v2= *(_QWORD *)(v3 - 8);
  return 0i64;
}

 

 类似资料: