MCPcopy Create free account
hub / github.com/aixed/WeChat-Hook / BuildAnimationStructure

Function BuildAnimationStructure

src/wx_send_xml.cpp:410–467  ·  view source on GitHub ↗

===== 动图结构构建 =====

Source from the content-addressed store, hash-verified

408
409 // ===== 动图结构构建 =====
410 void* BuildAnimationStructure(const XmlFields& fields)
411 {
412 void* xmlFieldPtr = Memory::Allocate(0x400);
413 if (!xmlFieldPtr) return nullptr;
414
415 // 分配字符串内存
416 void* md5Ptr = nullptr;
417 void* productidPtr = nullptr;
418
419 if (!fields.md5.empty()) {
420 md5Ptr = Memory::Allocate(fields.md5.length() + 1);
421 Memory::WriteString(md5Ptr, fields.md5);
422 }
423
424 if (!fields.productid.empty()) {
425 std::string utf8ProductId = StringUtils::AnsiToUtf8(fields.productid);
426 productidPtr = Memory::Allocate(utf8ProductId.length() + 1);
427 Memory::WriteString(productidPtr, utf8ProductId);
428 }
429
430 uintptr_t base = reinterpret_cast<uintptr_t>(xmlFieldPtr);
431
432 // 填充字段
433 if (md5Ptr) {
434 Memory::Write<void*>(reinterpret_cast<void*>(base + 0x198), md5Ptr);
435 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x1A8), fields.md5.length());
436 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x1B0), fields.md5.length());
437 }
438
439 Memory::Write<uint32_t>(reinterpret_cast<void*>(base + 0x190), fields.length);
440 Memory::Write<uint32_t>(reinterpret_cast<void*>(base + 0x258), fields.type);
441 Memory::Write<uint32_t>(reinterpret_cast<void*>(base + 0x25C), fields.width);
442 Memory::Write<uint32_t>(reinterpret_cast<void*>(base + 0x260), fields.height);
443
444 if (productidPtr) {
445 Memory::Write<void*>(reinterpret_cast<void*>(base + 0x1B8), productidPtr);
446 size_t productidLen = fields.productid.length();
447 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x1C8), productidLen);
448 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x1D0), productidLen);
449 }
450
451 // 构建链表
452 void* listHead = BuildLinkedList();
453 if (listHead) {
454 Memory::Write<void*>(reinterpret_cast<void*>(base + 0x30), listHead);
455 }
456
457 // 写入虚表指针
458 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x0), g_weixinBase + Offsets::ANIMATION_FIELD_VTABLE);
459 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x8), 0x100000006);
460 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x10), g_weixinBase + Offsets::ANIMATION_FIELD_VTABLE2);
461 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x18), 1);
462 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x20), 0);
463 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x28), 0x3F800000);
464 Memory::Write<uint64_t>(reinterpret_cast<void*>(base + 0x38), 0xA);
465
466 return xmlFieldPtr;
467 }

Callers 1

ForwardXmlMessageFunction · 0.85

Calls 5

AnsiToUtf8Function · 0.85
BuildLinkedListFunction · 0.85
AllocateFunction · 0.70
WriteStringFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected