convertdoc

int __stdcall Convert2PdfImage(LPCSTR lpMultiByteStr, int a2, char a3)
{
 
  GdiplusStartup(&v40, &v41, 0);
  sub_1000AA50(lpMultiByteStr, &WideCharStr, 260);
  v55 = &off_101B0CFC;
  v56 = 0;
  v57 = GdipLoadImageFromFileICM(&WideCharStr, &v56);
  v66 = 0;
  sub_1001DF00(0, 0, 0, 0);
  v3 = v57;
  LOBYTE(v66) = 1;
  v57 = 0;
  if ( !v3 )
  {
    v62 = 0;
    v4 = GdipImageGetFrameDimensionsCount(v56, &v62);
    if ( v4 )
      v57 = v4;
    v5 = v62;
    v6 = malloc_0(16 * v62);
    v7 = (const GUID *)v6;
    v8 = GdipImageGetFrameDimensionsList(v56, v6, v5);
    if ( v8 )
      v57 = v8;
    StringFromGUID2(v7, &sz, 39);
    v62 = 0;
    v9 = GdipImageGetFrameCount(v56, v7, &v62);
    if ( v9 )
      v57 = v9;
    v47 = v62;
    free((void *)v7);
    v10 = GdipGetImageRawFormat(v56, &rguid);
    if ( v10 )
      v57 = v10;
    StringFromGUID2(&rguid, &v96, 39);
    wprintf(L"The GUID is %s.\n", &v96);
    if ( !sub_10015F40(&rguid, &unk_1029D314) )
      v47 = 1;
    v63 = 0;
    v11 = sub_1000B680(v48) - 1;
    v69 = 0;
    if ( v11 )
    {
      v12 = v11 - 4;
      if ( v12 )
      {
        if ( v12 == 1 )
        {
          sub_1000B920(L"image/gif", &v68);
        }
        else
        {
          v69 = 1;
          sub_1000B920(L"image/jpeg", &v68);
        }
      }
      else
      {
        sub_1000B920(L"image/png", &v68);
      }
    }
    else
    {
      sub_1000B920(L"image/tiff", &v68);
      v63 = 1;
    }
    v70 = 492561589;
    v71 = 1160641098;
    v73 = -337181359;
    v74 = 1;
    v60 = (double *)&v35;
    v46 = 65;
    v72 = -1285694052;
    v75 = 4;
    v76 = &v46;
    v38[1] = 15;
    v38[0] = 0;
    LOBYTE(v66) = 2;
    LOBYTE(v36[0]) = 0;
    sub_10002BA0("W700105-010000-114251-JUTD72-2NKGG2", 0x23u);
    v54 = (int)&v30;
    *(_QWORD *)v34 = 64424509440i64;
    LOBYTE(v66) = 3;
    v31 = 0;
    sub_10002BA0("license", 7u);
    LOBYTE(v66) = 2;
    sub_10021450(
      v30,
      *(void **)&v31,
      v32,
      SLODWORD(v33),
      SHIDWORD(v33),
      (int)v34[0],
      (int)v34[1],
      v35,
      v36[0],
      (int)v36[1],
      v37[0],
      v37[1],
      v38[0],
      v38[1]);
    v60 = (double *)&v35;
    v38[1] = 15;
    v38[0] = 0;
    LOBYTE(v36[0]) = 0;
    sub_10002BA0(Directory, 0);
    *(_QWORD *)v34 = 64424509440i64;
    LOBYTE(v66) = 4;
    v54 = (int)&v30;
    v31 = 0;
    sub_10002BA0(Src, strlen((const char *)Src));
    LOBYTE(v66) = 2;
    if ( sub_1001E150(
           v30,
           *(void **)&v31,
           v32,
           SLODWORD(v33),
           SHIDWORD(v33),
           (int)v34[0],
           (int)v34[1],
           v35,
           v36[0],
           (int)v36[1],
           v37[0],
           v37[1],
           v38[0],
           v38[1]) == -1 )
    {
      sub_1001DCE0(&v64);
      v55 = &off_101B0CFC;
      GdipDisposeImage(v56);
      return 2;
    }
    *(double *)v38 = 9.0;
    v60 = (double *)v34;
    v37[1] = 15;
    v37[0] = 0;
    LOBYTE(v34[1]) = 0;
    sub_10002BA0("compress", 8u);
    sub_10021600((int)v34[0], v34[1], v35, (int)v36[0], (int)v36[1], v37[0], v37[1], *(double *)v38);
    v60 = (double *)&v35;
    v38[1] = 15;
    v38[0] = 0;
    LOBYTE(v36[0]) = 0;
    sub_10002BA0("www.i-enet.com", 0xEu);
    Src = &v30;
    *(_QWORD *)v34 = 64424509440i64;
    LOBYTE(v66) = 5;
    v31 = 0;
    sub_10002BA0("Title", 5u);
    LOBYTE(v66) = 2;
    sub_100212A0(
      v30,
      *(void **)&v31,
      v32,
      SLODWORD(v33),
      SHIDWORD(v33),
      (int)v34[0],
      (int)v34[1],
      v35,
      v36[0],
      (int)v36[1],
      v37[0],
      v37[1],
      v38[0],
      v38[1]);
    pcbBuffer = 512;
    if ( GetUserNameW(&Buffer, &pcbBuffer) )
    {
      sub_1000B5F0(&Buffer, &v91, 256);
      v60 = (double *)&v35;
      sub_100041B0(&v91);
      Src = &v30;
      LOBYTE(v66) = 6;
      sub_100041B0("Author");
      LOBYTE(v66) = 2;
      sub_100212A0(
        v30,
        *(void **)&v31,
        v32,
        SLODWORD(v33),
        SHIDWORD(v33),
        (int)v34[0],
        (int)v34[1],
        v35,
        v36[0],
        (int)v36[1],
        v37[0],
        v37[1],
        v38[0],
        v38[1]);
    }
    v60 = (double *)&v35;
    v38[1] = 15;
    v38[0] = 0;
    LOBYTE(v36[0]) = 0;
    sub_10002BA0("SmartPrinter V4.0", 0x11u);
    Src = &v30;
    *(_QWORD *)v34 = 64424509440i64;
    LOBYTE(v66) = 7;
    v31 = 0;
    sub_10002BA0("Creator", 7u);
    LOBYTE(v66) = 2;
    sub_100212A0(
      v30,
      *(void **)&v31,
      v32,
      SLODWORD(v33),
      SHIDWORD(v33),
      (int)v34[0],
      (int)v34[1],
      v35,
      v36[0],
      (int)v36[1],
      v37[0],
      v37[1],
      v38[0],
      v38[1]);
    v98 = -17;
    v99 = -69;
    v100 = -65;
    memset_0(&v101, 0, 0x7Du);
    sub_1000B5F0(L"times-roman", &v101, 125);
    v60 = (double *)&v35;
    v38[1] = 15;
    v38[0] = 0;
    LOBYTE(v36[0]) = 0;
    sub_10002BA0(Directory, 0);
    Src = &v30;
    *(_QWORD *)v34 = 64424509440i64;
    LOBYTE(v66) = 8;
    v31 = 0;
    sub_10002BA0("winansi", 7u);
    v54 = (int)&v23;
    v29 = 15;
    v28 = 0;
    LOBYTE(v66) = 9;
    v24 = 0;
    sub_10002BA0("Helvetica", 9u);
    LOBYTE(v66) = 2;
    v54 = sub_1001FEE0(
            v23,
            *(void **)&v24,
            v25,
            v26,
            v27,
            v28,
            v29,
            v30,
            *(void **)&v31,
            v32,
            SLODWORD(v33),
            SHIDWORD(v33),
            (int)v34[0],
            (int)v34[1],
            v35,
            v36[0],
            (int)v36[1],
            v37[0],
            v37[1],
            v38[0],
            v38[1]);
    v60 = (double *)20;
    v77 = 1952636038;
    v78 = 24960;
    v79 = 19582;
    v80 = -114;
    v81 = 63;
    v82 = -18;
    v83 = 115;
    v84 = 51;
    v85 = -89;
    v86 = -92;
    v87 = -125;
    v14 = 0;
    while ( 1 )
    {
      Src = v14;
      if ( (unsigned int)v14 >= v47 )
      {
        v59 = (double *)&v35;
        v38[1] = 15;
        v38[0] = 0;
        LOBYTE(v36[0]) = 0;
        sub_10002BA0(Directory, 0);
        sub_1001EEB0(v35, v36[0], (int)v36[1], v37[0], v37[1], v38[0], v38[1]);
        DeleteFileW(&TempFileName);
        sub_1001DCE0(&v64);
        v55 = &off_101B0CFC;
        GdipDisposeImage(v56);
        return 0;
      }
      GetTempPathW(0x104u, &PathName);
      GetTempFileNameW(&PathName, L"Image", 0, &TempFileName);
      sub_1000AA90(&TempFileName, &MultiByteStr, 260);
      v15 = GdipImageSelectActiveFrame(v56, &v77, v14);
      if ( v15 )
        v57 = v15;
      v49 = 0;
      v16 = GdipGetImageWidth(v56, &v49);
      if ( v16 )
        v57 = v16;
      v53 = 0;
      v17 = GdipGetImageHeight(v56, &v53);
      if ( v17 )
        v57 = v17;
      if ( !v63 )
        break;
      v18 = GdipSaveImageToFile(v56, &TempFileName, &v68, v69 == 1 ? (unsigned int)&v69 : 0);
      if ( v18 )
      {
        v57 = v18;
        GetLastError();
        v14 = (char *)Src + 1;
      }
      else
      {
        v62 = (int)&v35;
        v38[1] = 15;
        v38[0] = 0;
        LOBYTE(v36[0]) = 0;
        sub_10002BA0(Directory, 0);
        *(_QWORD *)v34 = 64424509440i64;
        LOBYTE(v66) = 10;
        v51 = &v30;
        v31 = 0;
        sub_10002BA0(&MultiByteStr, strlen(&MultiByteStr));
        v59 = (double *)&v23;
        v29 = 15;
        v28 = 0;
        LOBYTE(v66) = 11;
        v24 = 0;
        sub_10002BA0("auto", 4u);
        LOBYTE(v66) = 2;
        v19 = sub_100200C0(
                v23,
                *(void **)&v24,
                v25,
                v26,
                v27,
                v28,
                v29,
                v30,
                *(void **)&v31,
                v32,
                SLODWORD(v33),
                SHIDWORD(v33),
                (int)v34[0],
                (int)v34[1],
                v35,
                v36[0],
                (int)v36[1],
                v37[0],
                v37[1],
                v38[0],
                v38[1]);
        v62 = v19;
LABEL_36:
        if ( v19 == -1 )
        {
          GetLastError();
          v14 = (char *)Src + 1;
        }
        else
        {
          v59 = (double *)&v35;
          v38[1] = 15;
          v38[0] = 0;
          LOBYTE(v36[0]) = 0;
          sub_10002BA0(Directory, 0);
          sub_1001E300(10.0, 10.0, v35, v36[0], (int)v36[1], v37[0], v37[1], v38[0], v38[1]);
          v59 = (double *)&v35;
          v38[1] = 15;
          v38[0] = 0;
          LOBYTE(v36[0]) = 0;
          sub_10002BA0("adjustpage", 0xAu);
          sub_1001F5D0(v19, 0.0, 0.0, v35, v36[0], (int)v36[1], v37[0], v37[1], v38[0], v38[1]);
          if ( !a3 )
          {
            *(double *)v38 = 0.0;
            v59 = (double *)&v29;
            *(double *)v37 = 1.0;
            v34[0] = (void *)15;
            *(double *)v36 = 1.0;
            HIDWORD(v33) = 0;
            *(double *)&v34[1] = 1.0;
            LOBYTE(v30) = 0;
            sub_10002BA0("rgb", 3u);
            v51 = &v22;
            v28 = 15;
            v27 = 0;
            LOBYTE(v66) = 14;
            LOBYTE(v23) = 0;
            sub_10002BA0("stroke", 6u);
            LOBYTE(v66) = 2;
            sub_10021780(
              v22,
              (void *)v23,
              *(int *)&v24,
              v25,
              v26,
              v27,
              v28,
              v29,
              (void *)v30,
              *(int *)&v31,
              v32,
              SLODWORD(v33),
              SHIDWORD(v33),
              (int)v34[0],
              *(double *)&v34[1],
              *(double *)v36,
              *(double *)v37,
              *(double *)v38);
            *(double *)v38 = 0.0;
            *(double *)v37 = 1.0;
            v59 = (double *)&v29;
            *(double *)v36 = 1.0;
            v34[0] = (void *)15;
            *(double *)&v34[1] = 1.0;
            HIDWORD(v33) = 0;
            LOBYTE(v30) = 0;
            sub_10002BA0("rgb", 3u);
            v51 = &v22;
            v28 = 15;
            v27 = 0;
            LOBYTE(v66) = 15;
            LOBYTE(v23) = 0;
            sub_10002BA0("fill", 4u);
            LOBYTE(v66) = 2;
            sub_10021780(
              v22,
              (void *)v23,
              *(int *)&v24,
              v25,
              v26,
              v27,
              v28,
              v29,
              (void *)v30,
              *(int *)&v31,
              v32,
              SLODWORD(v33),
              SHIDWORD(v33),
              (int)v34[0],
              *(double *)&v34[1],
              *(double *)v36,
              *(double *)v37,
              *(double *)v38);
            v59 = (double *)&v35;
            v38[1] = 15;
            v38[0] = 0;
            LOBYTE(v36[0]) = 0;
            sub_10002BA0("evenodd", 7u);
            v51 = &v30;
            *(_QWORD *)v34 = 64424509440i64;
            LOBYTE(v66) = 16;
            v31 = 0;
            sub_10002BA0("fillrule", 8u);
            LOBYTE(v66) = 2;
            sub_10021450(
              v30,
              *(void **)&v31,
              v32,
              SLODWORD(v33),
              SHIDWORD(v33),
              (int)v34[0],
              (int)v34[1],
              v35,
              v36[0],
              (int)v36[1],
              v37[0],
              v37[1],
              v38[0],
              v38[1]);
            sub_10021D90(3.0);
            sub_10021C30(1);
            sub_10021AD0(0);
            v58 = (double)v49;
            sub_100202A0(v58, 0.0);
            v53 /= 6;
            v50 = (double)v53;
            sub_1001FD70(v58, v50);
            v53 = 2 * v49 / 3;
            v52 = (double)v53;
            sub_1001FD70(v52, v50);
            sub_1001FD70(v52, 0.0);
            sub_1001FD70(v58, 0.0);
            sub_1001F470(&v64);
            sub_1000B7A0(aOImxihExd_amXE, &String);
            sub_1000B5F0(&String, &v97, 256);
            *(double *)v38 = 0.0;
            *(double *)v37 = 0.0;
            *(double *)v36 = 0.0;
            v59 = (double *)&v29;
            *(double *)&v34[1] = 0.0;
            v34[0] = (void *)15;
            HIDWORD(v33) = 0;
            LOBYTE(v30) = 0;
            sub_10002BA0("rgb", 3u);
            v51 = &v22;
            v28 = 15;
            v27 = 0;
            LOBYTE(v66) = 17;
            LOBYTE(v23) = 0;
            sub_10002BA0("fill", 4u);
            LOBYTE(v66) = 2;
            sub_10021780(
              v22,
              (void *)v23,
              *(int *)&v24,
              v25,
              v26,
              v27,
              v28,
              v29,
              (void *)v30,
              *(int *)&v31,
              v32,
              SLODWORD(v33),
              SHIDWORD(v33),
              (int)v34[0],
              *(double *)&v34[1],
              *(double *)v36,
              *(double *)v37,
              *(double *)v38);
            v50 = (double)(signed int)v60;
            sub_10020FE0(v54, v50);
            *(double *)v38 = 10.0;
            *(double *)v37 = 10.0;
            v36[1] = (void *)15;
            v36[0] = 0;
            v59 = &v33;
            BYTE4(v33) = 0;
            sub_10002BA0(&v97, strlen(&v97));
            sub_10022050(
              SLODWORD(v33),
              HIDWORD(v33),
              (int)v34[0],
              (int)v34[1],
              v35,
              (int)v36[0],
              (int)v36[1],
              *(double *)v37,
              *(double *)v38);
            v20 = v50;
            *(double *)v38 = v50;
            v37[1] = v54;
            v37[0] = 15;
            v36[1] = 0;
            v59 = (double *)((char *)&v33 + 4);
            LOBYTE(v34[0]) = 0;
            sub_10002BA0(&v97, strlen(&v97));
            sub_10022350(
              SHIDWORD(v33),
              v34[0],
              (int)v34[1],
              v35,
              (int)v36[0],
              (int)v36[1],
              v37[0],
              v37[1],
              *(double *)v38);
            v21 = (signed int)v20;
            sub_1000B7A0(aEIbixOca, &String);
            if ( lstrlenW(&String) < 10 )
            {
              sub_1001DCE0(&v64);
              v55 = &off_101B0CFC;
              GdipDisposeImage(v56);
              return -1;
            }
            sub_1000B5F0(&String, &v97, 256);
            *(double *)v38 = 0.0;
            v59 = (double *)&v29;
            *(double *)v37 = 1.0;
            *(double *)v36 = 0.0;
            *(double *)&v34[1] = 0.0;
            sub_100041B0("rgb");
            v51 = &v22;
            LOBYTE(v66) = 18;
            sub_100041B0("fill");
            LOBYTE(v66) = 2;
            sub_10021780(
              v22,
              (void *)v23,
              *(int *)&v24,
              v25,
              v26,
              v27,
              v28,
              v29,
              (void *)v30,
              *(int *)&v31,
              v32,
              SLODWORD(v33),
              SHIDWORD(v33),
              (int)v34[0],
              *(double *)&v34[1],
              *(double *)v36,
              *(double *)v37,
              *(double *)v38);
            *(double *)v38 = 10.0;
            v53 = v21 + 15;
            *(double *)v37 = (double)(v21 + 15);
            v59 = &v33;
            sub_100041B0(&v97);
            sub_10022050(
              SLODWORD(v33),
              HIDWORD(v33),
              (int)v34[0],
              (int)v34[1],
              v35,
              (int)v36[0],
              (int)v36[1],
              *(double *)v37,
              *(double *)v38);
            v19 = v62;
          }
          v59 = (double *)&v35;
          v38[1] = 15;
          v38[0] = 0;
          LOBYTE(v36[0]) = 0;
          sub_10002BA0(Directory, 0);
          sub_1001F030(v35, v36[0], (int)v36[1], v37[0], v37[1], v38[0], v38[1]);
          sub_1001E770(v19);
          DeleteFileW(&TempFileName);
          v14 = (char *)Src + 1;
        }
      }
    }
    v59 = (double *)&v35;
    v38[1] = 15;
    v38[0] = 0;
    LOBYTE(v36[0]) = 0;
    sub_10002BA0(Directory, 0);
    *(_QWORD *)v34 = 64424509440i64;
    LOBYTE(v66) = 12;
    v51 = &v30;
    v31 = 0;
    sub_10002BA0(v48, strlen((const char *)v48));
    v62 = (int)&v23;
    v29 = 15;
    v28 = 0;
    LOBYTE(v66) = 13;
    v24 = 0;
    sub_10002BA0("auto", 4u);
    LOBYTE(v66) = 2;
    v62 = sub_100200C0(
            v23,
            *(void **)&v24,
            v25,
            v26,
            v27,
            v28,
            v29,
            v30,
            *(void **)&v31,
            v32,
            SLODWORD(v33),
            SHIDWORD(v33),
            (int)v34[0],
            (int)v34[1],
            v35,
            v36[0],
            (int)v36[1],
            v37[0],
            v37[1],
            v38[0],
            v38[1]);
    v19 = v62;
    goto LABEL_36;
  }
  sub_1001DCE0(&v64);
  v55 = &off_101B0CFC;
  GdipDisposeImage(v56);
  return -9;
}




int __thiscall CConvertAgent::ConvertDoc(CConvertAgent *this, const char *Str, const char *lpFileName)
{
  int v3; // esi@1
  DWORD v4; // ebx@1
  int result; // eax@3
  int v6; // esi@4
  bool v7; // sf@4
  unsigned __int8 v8; // of@4

  v3 = *(_DWORD *)this;
  v4 = GetTickCount();
  if ( v3 )
  {
    if ( GetTickCount() <= v4 + 6000 )
    {
      v6 = sub_10004F70((char *)Str, lpFileName);
      v8 = __OFSUB__(dword_105359E0, 228);
      v7 = dword_105359E0++ - 228 < 0;
      if ( !(v7 ^ v8) )
      {
        v6 = -5;
        MessageBoxA(0, Text, Caption, 0x40u);
      }
      v8 = __OFSUB__(dword_105359E0, 250);
      v7 = dword_105359E0++ - 250 < 0;
      if ( !(v7 ^ v8) )
        v6 = -5;
      result = v6;
    }
    else
    {
      result = -1;
    }
  }
  else
  {
    result = -2;
  }
  return result;
}

int __thiscall sub_10004F70(int this, char *Str, LPCSTR lpFileName)
{
  return sub_1002F8D0(this, Str, lpFileName);
}

int __thiscall sub_1002F8D0(int this, char *Str, LPCSTR lpFileName)
{
  
  GetSystemTime(&SystemTime);
  if ( SystemTime.wYear >= 0x7E0u && (SystemTime.wMonth >= 9u || SystemTime.wYear > 0x7E0u) )
  {
    LOBYTE(v128) = 1;
    std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Tidy(&v116, 1);
    LOBYTE(v128) = 0;
    std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Tidy(&v122, 1);
    v128 = -1;
    std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Tidy(&v114, 1);
    return -15;
  }
   
  
  if ( stricmp(a_docx, v14)
    && stricmp(a_doc, v14)
    && stricmp(a_rtf, v14)
    && stricmp(a_txt, v14)
    && stricmp(a_log, v14)
    && stricmp(a_xml, v14)
    && stricmp(a_shtm, v14)
    && stricmp(a_shtml, v14)
    && stricmp(a_mht, v14) )
  {
   }
LABEL_243:
    v23 = __OFSUB__(dword_10535A54, 2230);
    v21 = dword_10535A54 == 2230;
    v22 = dword_10535A54++ - 2230 < 0;
    if ( (unsigned __int8)(v22 ^ v23) | v21 )
    {
    
    goto LABEL_244;
  }
  GetSystemTime(&v97);
  if ( v97.wYear < 0x7E0u || v97.wMonth < 9u && v97.wYear <= 0x7E0u )
  {
    
    v43 = sub_1000BF2D(&v114, &v122, &v116);
    goto LABEL_242;
  }
  LOBYTE(v128) = 3;
  CPrinterSettings::~CPrinterSettings(&v121);
   ...
  return -15;
}


   else
    {
      v66 = stricmp(::Str, v38);
      v67 = lpMultiByteStr;
      if ( v66 )
      {
        if ( !lpMultiByteStr )
          v67 = (const CHAR *)`std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Nullstr'::`2'::_C;
        v69 = lpString;
        if ( !lpString )
          v69 = (const CHAR *)`std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Nullstr'::`2'::_C;
        v43 = sub_10004CAF(v126 + 68, v69, v67);
      }

int __cdecl sub_10004CAF(int a1, LPCSTR lpString, LPCSTR lpMultiByteStr)
{
  return sub_10025480(a1, lpString, lpMultiByteStr);
}

int __cdecl sub_10025480(int a1, LPCSTR lpString, LPCSTR lpMultiByteStr)
{
  const CHAR *v3; // ebx@1
  __int16 *v4; // eax@2
  int v5; // eax@3
  int v6; // esi@3
  int v7; // eax@3
  void *v8; // esp@3
  int v9; // eax@4
  int v10; // eax@5
  LPCSTR v11; // ebx@7
  void *v12; // eax@7
  const GUID *v13; // esi@7
  int v14; // eax@7
  int v15; // eax@9
  int v16; // eax@11
  int v17; // eax@13
  const char *v18; // ebx@17
  int v19; // eax@17
  int v20; // eax@18
  const CHAR *v21; // esi@24
  int v22; // eax@25
  __int16 *v23; // edi@29
  int v24; // eax@30
  int v25; // esi@30
  int v26; // eax@30
  void *v27; // esp@30
  int v28; // eax@31
  __int16 *v29; // edi@36
  int v30; // eax@37
  int v31; // esi@37
  int v32; // eax@37
  void *v33; // esp@37
  __int16 v35; // [sp+0h] [bp-214h]@3
  OLECHAR sz; // [sp+Ch] [bp-208h]@9
  char Dest; // [sp+5Ch] [bp-1B8h]@35
  OLECHAR v38; // [sp+160h] [bp-B4h]@15
  char v39; // [sp+1B0h] [bp-64h]@13
  GUID rguid; // [sp+1C0h] [bp-54h]@11
  int v41; // [sp+1D0h] [bp-44h]@20
  int v42; // [sp+1E0h] [bp-34h]@24
  __int16 v43; // [sp+1E4h] [bp-30h]@24
  __int16 v44; // [sp+1E6h] [bp-2Eh]@24
  char v45; // [sp+1E8h] [bp-2Ch]@24
  char v46; // [sp+1E9h] [bp-2Bh]@24
  char v47; // [sp+1EAh] [bp-2Ah]@24
  char v48; // [sp+1EBh] [bp-29h]@24
  char v49; // [sp+1ECh] [bp-28h]@24
  char v50; // [sp+1EDh] [bp-27h]@24
  char v51; // [sp+1EEh] [bp-26h]@24
  char v52; // [sp+1EFh] [bp-25h]@24
  int v53; // [sp+1F0h] [bp-24h]@1
  unsigned int v54; // [sp+1F4h] [bp-20h]@11
  int (__stdcall **v55)(char); // [sp+1F8h] [bp-1Ch]@4
  int v56; // [sp+1FCh] [bp-18h]@4
  int v57; // [sp+200h] [bp-14h]@4
  int v58; // [sp+210h] [bp-4h]@4

  v3 = lpString;
  v53 = 0;
  if ( lpString )
  {
    v5 = lstrlenA(lpString);
    v6 = v5 + 1;
    v7 = 2 * (v5 + 1) + 3;
    LOBYTE(v7) = v7 & 0xFC;
    v8 = alloca(v7);
    v35 = 0;
    MultiByteToWideChar(0, 0, v3, -1, (LPWSTR)&v35, v6);
    v4 = &v35;
  }
  else
  {
    v4 = 0;
  }
  v55 = &off_103B00E0;
  v56 = 0;
  v9 = GdipLoadImageFromFileICM(v4, &v56);
  v58 = 0;
  v57 = 0;
  if ( !v9 )
  {
    lpString = 0;
    v10 = GdipImageGetFrameDimensionsCount(v56, &lpString);
    if ( v10 )
      v57 = v10;
    v11 = lpString;
    v12 = malloc(16 * (_DWORD)lpString);
    v13 = (const GUID *)v12;
    v14 = GdipImageGetFrameDimensionsList(v56, v12, v11);
    if ( v14 )
      v57 = v14;
    StringFromGUID2(v13, &sz, 39);
    lpString = 0;
    v15 = GdipImageGetFrameCount(v56, v13, &lpString);
    if ( v15 )
      v57 = v15;
    v54 = (unsigned int)lpString;
    free((void *)v13);
    v16 = GdipGetImageRawFormat(v56, &rguid);
    if ( v16 )
      v57 = v16;
    v17 = GdipGetImageRawFormat(v56, &v39);
    if ( v17 )
      v57 = v17;
    StringFromGUID2(&rguid, &v38, 39);
    wprintf(aTheGuidIsS_, &v38);
    if ( memcmp(&rguid, &unk_103D1180, 0x10u) )
      v54 = 1;
    v18 = lpMultiByteStr;
    v19 = sub_1000AA3D(lpMultiByteStr) - 3;
    if ( v19 )
    {
      v20 = v19 - 1;
      if ( v20 )
      {
        if ( v20 == 1 )
        {
          sub_10007DB0(aImagePng, (int)&v41);
          lpString = a_png;
        }
        else
        {
          sub_10007DB0(aImageGif, (int)&v41);
          lpString = a_gif;
        }
      }
      else
      {
        sub_10007DB0(aImageBmp, (int)&v41);
        lpString = a_bmp;
      }
    }
    else
    {
      sub_10007DB0(aImageJpeg, (int)&v41);
      lpString = a_jpg;
    }
    v21 = 0;
    v42 = 1952636038;
    v43 = 24960;
    v44 = 19582;
    v45 = -114;
    v46 = 63;
    v47 = -18;
    v48 = 115;
    v49 = 51;
    v50 = -89;
    v51 = -92;
    v52 = -125;
    lpMultiByteStr = 0;
    if ( v54 )
    {
      do
      {
        v22 = GdipImageSelectActiveFrame(v56, &v42, v21);
        if ( v22 )
          v57 = v22;
        if ( v21 )
        {
          if ( v21 == (const CHAR *)1 )
            v18[strlen(v18) - 4] = 0;
          sprintf(&Dest, aSDS, v18, v21, lpString);
          if ( &Dest )
          {
            v30 = lstrlenA(&Dest);
            v31 = v30 + 1;
            v32 = 2 * (v30 + 1) + 3;
            LOBYTE(v32) = v32 & 0xFC;
            v33 = alloca(v32);
            v29 = &v35;
            v35 = 0;
            MultiByteToWideChar(0, 0, &Dest, -1, (LPWSTR)&v35, v31);
            v21 = lpMultiByteStr;
          }
          else
          {
            v29 = 0;
          }
          v28 = GdipSaveImageToFile(v56, v29, &v41, 0);
          if ( v28 )
          {
            v57 = v28;
            goto LABEL_41;
          }
        }
        else
        {
          if ( v18 )
          {
            v24 = lstrlenA(v18);
            v25 = v24 + 1;
            v26 = 2 * (v24 + 1) + 3;
            LOBYTE(v26) = v26 & 0xFC;
            v27 = alloca(v26);
            v23 = &v35;
            v35 = 0;
            MultiByteToWideChar(0, 0, v18, -1, (LPWSTR)&v35, v25);
            v21 = lpMultiByteStr;
          }
          else
          {
            v23 = 0;
          }
          v28 = GdipSaveImageToFile(v56, v23, &v41, 0);
          if ( v28 )
          {
            v57 = v28;
            goto LABEL_41;
          }
        }
        v28 = 0;
LABEL_41:
        if ( v28 )
        {
          v53 = -2;
          break;
        }
        ++v21;
        lpMultiByteStr = v21;
      }
      while ( (unsigned int)v21 < v54 );
    }
  }
  v55 = &off_103B00E0;
  GdipDisposeImage(v56);
  return v53;
}







D sub_1000BF2D    proc near               ; CODE XREF: sub_1002F8D0+117Ep
.text:1000BF2D                                         ; sub_10036EF0+92p
.text:1000BF2D                 jmp     sub_10033190


简单(但不严格)地说,std::basic_string<char>就是STL提供的的字符串,即std::string


而std::basic_string<char,std::char_traits<char>,std::allocator<char> >就是std::basic_string<char>的缺省模板参数展开形式。

std::basic_string<char,std::char_traits<char>,std::allocator<char> >::data写成简单的形式就是std::string::data

msvcp80.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >这个函数其实就是字符串的构造函数,可以理解为:std::string::string(const char *)
// overflow flag of subtraction (x-y)
int8 __OFSUB__(int x, int y)
{
    int y2 = y;
    int8 sx = __SETS__(x);
    return (sx ^ __SETS__(y2)) & (sx ^ __SETS__(x-y2));
}

// sign flag
int8 __SETS__(int x)
{
  if ( sizeof(int) == 1 )
    return int8(x) < 0;
  if ( sizeof(int) == 2 )
    return int16(x) < 0;
  if ( sizeof(int) == 4 )
    return int32(x) < 0;
  return int64(x) < 0;
}
signed int __cdecl sub_1002F250(const char *a1)
{
  signed int v1; // ebx@1
  unsigned int v2; // ecx@1
  const char *v3; // esi@2

  v1 = -1;
  v2 = strlen(a1) - 4;
  if ( (signed int)v2 > 1 )
  {
    v3 = &a1[v2];
    if ( !strnicmp(&a1[v2], Str, 4u) )
      return 0;
    if ( !strnicmp(v3, Str1, 4u) || !strnicmp(v3, aTiff, 4u) )
    {
      v1 = 1;
    }
    else
    {
      if ( !strnicmp(v3, a_swf, 4u) )
        return 2;
      if ( !strnicmp(v3, a_jpg, 4u) )
        return 3;
      if ( !strnicmp(v3, a_bmp, 4u) )
        return 4;
      if ( !strnicmp(v3, a_png, 4u) )
        return 5;
      if ( !strnicmp(v3, a_gif, 4u) )
        return 6;
      if ( !strnicmp(v3, a_txt, 4u) )
        return 7;
      if ( !strnicmp(v3, a_emf, 4u) )
        return 8;
    }
  }

signed int __thiscall sub_10033190(void *this, int a2, int a3, int a4)
{
  void *v4; // esi@1
  char v5; // cl@3
  signed int result; // eax@3
  COleDispatchDriver *v7; // ecx@5
  int v8; // eax@7
  int v9; // eax@7
  int v10; // eax@9
  int v11; // eax@9
  COleDispatchDriver *v12; // ecx@11
  int v13; // [sp+0h] [bp-70h]@1
  VARIANTARG v14; // [sp+Ch] [bp-64h]@11
  VARIANTARG v15; // [sp+1Ch] [bp-54h]@7
  VARIANTARG v16; // [sp+2Ch] [bp-44h]@7
  VARIANTARG pvarg; // [sp+3Ch] [bp-34h]@9
  char v18; // [sp+4Ch] [bp-24h]@7
  char v19; // [sp+54h] [bp-1Ch]@9
  void *v20; // [sp+5Ch] [bp-14h]@1
  int *v21; // [sp+60h] [bp-10h]@1
  int v22; // [sp+6Ch] [bp-4h]@1

  v4 = this;
  v21 = &v13;
  v20 = this;
  v22 = 0;
  if ( sub_1000C851() || (sub_100051BE(0), sub_1000CA68(v4)) )
  {
    v7 = (COleDispatchDriver *)*((_DWORD *)v4 + 8);
    if ( v7 )
      sub_10002DEC(v7, 0);
    v8 = sub_10005989(*((COleDispatchDriver **)v4 + 8));
    COleDispatchDriver::COleDispatchDriver(&v18, v8, 1);
    LOBYTE(v22) = 1;
    v15.vt = 0;
    COleVariant::operator=(&v15, a1);
    LOBYTE(v22) = 2;
    v16.vt = 0;
    COleVariant::operator=(&v16, a1);
    LOBYTE(v22) = 3;
    v9 = *(_DWORD *)(a2 + 4);
    if ( !v9 )
      v9 = `std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Nullstr'::`2'::_C;
    pvarg.vt = 0;
    COleVariant::operator=(&pvarg, v9);
    LOBYTE(v22) = 4;
    v10 = sub_10007AE5(
            (COleDispatchDriver *)&v18,
            (int)&pvarg,
            (int)&::pvarg,
            (int)&stru_10535A30,
            (int)&::pvarg,
            (int)&v16,
            (int)&v15,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg,
            (int)&::pvarg);
    COleDispatchDriver::COleDispatchDriver(&v19, v10, 1);
    VariantClear(&pvarg);
    VariantClear(&v16);
    LOBYTE(v22) = 6;
    VariantClear(&v15);
    sub_1000A4BB(*((COleDispatchDriver **)v4 + 8), (int)aMicrosoft_word);
    v11 = *(_DWORD *)(a3 + 4);
    if ( !v11 )
      v11 = `std::basic_string<char,std::char_traits<char>,std::allocator<char>>::_Nullstr'::`2'::_C;
    v14.vt = 0;
    COleVariant::operator=(&v14, v11);
    v12 = (COleDispatchDriver *)*((_DWORD *)v4 + 8);
    LOBYTE(v22) = 9;
    sub_1000E9D5(
      v12,
      (int)&stru_10535A30,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&v14,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&stru_10535A40,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg,
      (int)&::pvarg);
    LOBYTE(v22) = 6;
    VariantClear(&v14);
    sub_10009D4A((COleDispatchDriver *)&v19, (int)&stru_10535A30, (int)&::pvarg, (int)&::pvarg);
    LOBYTE(v22) = 1;
    COleDispatchDriver::ReleaseDispatch((COleDispatchDriver *)&v19);
    LOBYTE(v22) = 0;
    COleDispatchDriver::ReleaseDispatch((COleDispatchDriver *)&v18);
    result = 0;
  }
  else
  {
    std::basic_string<char,std::char_traits<char>,std::allocator<char>>::assign(
      a4,
      aCanNotOpenWord,
      strlen(aCanNotOpenWord));
    v5 = *((_BYTE *)v4 + 378);
    result = -6;
    *((_DWORD *)v4 + 1) = -6;
    *((_BYTE *)v4 + 377) = 1;
    if ( !v5 )
      result = sub_10003030(a2, a3, a4);
  }
  return result;
}



#define DETOURS_HOOK(fn,hmod,name) do{\
    fn##_old = (fn)GetProcAddress(hmod,name);\
    if(fn##_old==0){::MessageBoxA(0,name,0,0); return 0;}\
    DetourAttach(&(PVOID&)fn##_old, fn##_new);\
}while(0);

#define DETOURS_HOOK_HEX(fn,hmod,offset) do{\
    fn##_old = (fn)((DWORD)hmod+(DWORD)offset);\
    if(fn##_old==0){::MessageBoxA(0,"error",0,0); return 0;}\
    DetourAttach(&(PVOID&)fn##_old, fn##_new);\
}while(0);

int  getexepath(char* buffer,int size)
{
    char szModulePath[MAX_PATH];
    if(!GetModuleFileName(NULL, szModulePath, MAX_PATH))        
    {        
        printf("获取模块路径错误\n");        
        return 0;    
    }
    char* ptr;
    ptr = strrchr(szModulePath,'\\');
    if(ptr){
        ptr[0] = 0;
    }
    strcat(szModulePath,"\\");
    
    strcpy(buffer,szModulePath);
    return 1;    
}

void testandcreate(const char* filepath)
{
    //log("testandcreate %s",filepath);
    FILE* fd = fopen(filepath,"r+");
    if(fd==0){
        fd = fopen(filepath,"w");
    }
    if(fd)fclose(fd);
}
int getiniint(int threadid,const char* app,const char* key)
{
    char inipath[MAX_PATH];
    getexepath(inipath,MAX_PATH);
    char threadstring[10];
    sprintf(threadstring,"%d.ini",threadid);
    strcat(inipath,threadstring);
    testandcreate(inipath);
    
    return GetPrivateProfileInt(app,key,0,inipath);
}
void setiniint(int threadid,const char* app,const char* key,int v)
{
    char inipath[MAX_PATH];
    getexepath(inipath,MAX_PATH);
    char threadstring[20];
    sprintf(threadstring,"%d.ini",threadid);
    strcat(inipath,threadstring);
    sprintf(threadstring,"%d",v);
    testandcreate(inipath);
    WritePrivateProfileString(app,key,threadstring,inipath);
}
int __stdcall getlr()
{
    return     getiniint(GetCurrentThreadId(),"lr","lr");
}
void __stdcall setlr(int a)
{
    setiniint(GetCurrentThreadId(),"lr","lr",a);
}
void __stdcall logfuntionenter(const char* functionname,DWORD retaddress)
{  
    //loglowleave(0);
    //AfxMessageBox("enter");
}
void __stdcall logfuntionleave(const char* functionname)
{
    //AfxMessageBox("leave");

}



DWORD retaddress_print_log_T_g = 0;
char*  print_log_T_newfunctionname="print_log_T_new +";
char*  print_log_T_newfunctionnameleave="print_log_T_new -";
typedef void (*print_log_T)(void);
print_log_T  print_log_T_old=0;
__declspec(naked)   void print_log_T_new()
{
    _asm
    {
            call setlr
            pushad
            pushfd
            push eax
            push print_log_T_newfunctionname
            call  logfuntionenter
            popfd
            popad
            call print_log_T_old
            pushad
            pushfd
            push print_log_T_newfunctionname
            call  logfuntionleave
            popfd
            popad
            call getlr
            jmp  eax
    }
}
void loglow(const char*format)
{
    if(format==0)return;
    
    char fname[100];
     
    sprintf(fname,"print_log.txt",GetCurrentThreadId());
    
    FILE* fd = fopen(fname,"wb");
    fprintf(fd,format);
    fclose(fd);
     
}


int setup_convertagent_hook()
{
    print_log_T_old = (print_log_T)((DWORD)sprintf);
    DetourAttach(&(PVOID&)print_log_T_old, print_log_T_new);
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值