Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Attempt to support Linux #39

Open
SpriteOvO opened this issue Jan 19, 2021 · 4 comments
Open

Attempt to support Linux #39

SpriteOvO opened this issue Jan 19, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@SpriteOvO
Copy link
Owner

SpriteOvO commented Jan 19, 2021

Attempt to make the plugin support Linux.

Attempted code changes will be made in linux-experiment branch of this repository.
(This branch has not been created yet)

@tcNmjeD6SpVrpLC
Copy link

@SpriteOvO can you explain how exactly it works? Like via source code links. I mean official telegram desktop client source codes.
Show what exactly is beeing hoked, which variable being replaced, when and how. Can you?

@SpriteOvO
Copy link
Owner Author

@tcNmjeD6SpVrpLC In short, hooking History::destroyMessage, replacing _timeText, and then changing some width.

Compiling a tdesktop yourself and debugging it with .pdb file can help you understand more details.

@tcNmjeD6SpVrpLC
Copy link

tcNmjeD6SpVrpLC commented Jul 20, 2021

@SpriteOvO What about ttl based deletions?
What is the poin of single hook? What exactly do you stop in hook? Call of i->second->destroy();?
Have you tried it with Delete all messages from user in super groups? It usually requires full update of historywidget, is this .dll can handle it as well?

Can you eloborate a little bit more? Like expanded version of explanation? It would help.
I most likely understand part about changing time string to 'deleted'.
But elobarate the hooking part a little bit.

@SpriteOvO
Copy link
Owner Author

@tcNmjeD6SpVrpLC AFAIK, cached message deletion requests from the server always through i->second->destroy().
Changing call i->second->destroy() to call OnDestroyMessage.
In the detour function OnDestroyMessage, the message ptr will be stored and then processed by another thread.
I think you can easily get these answers if you are willing to read the code.

Then I don't quite understand what you mean by "expanded version", do you mean these?

bool IRuntime::InitFixedData()
{
#if defined PLATFORM_X86
// ver < 2.4.0
if (_FileVersion < 2004000) {
return false;
}
// ver >= 2.4.0, ver < 2.4.1
else if (_FileVersion >= 2004000 && _FileVersion < 2004001)
{
_Data.Offset.TimeText = 0x70;
_Data.Offset.TimeWidth = 0x74;
_Data.Offset.MainView = 0x5C;
// _Data.Offset.Media = 0x54;
_Data.Offset.SignedTimeText = 0x14;
// _Data.Offset.HistoryPeer = 0x7C;
}
// ver >= 2.4.1, ver < 2.6.0
else if (_FileVersion >= 2004001 && _FileVersion < 2006000)
{
_Data.Offset.TimeText = 0x70;
_Data.Offset.TimeWidth = 0x74;
_Data.Offset.MainView = 0x5C;
// _Data.Offset.Media = 0x54;
_Data.Offset.SignedTimeText = 0x10; // changed
// _Data.Offset.HistoryPeer = 0x7C; // maybe untested! (I forgot :)
}
// ver >= 2.6.0
else if (_FileVersion >= 2006000)
{
_Data.Offset.TimeText = 0x78; // changed
_Data.Offset.TimeWidth = 0x7C; // changed
_Data.Offset.MainView = 0x60; // changed
// _Data.Offset.Media = 0x5C; // changed
_Data.Offset.SignedTimeText = 0x10;
// _Data.Offset.HistoryPeer = 0x7C; // untested!
}
return true;
#elif defined PLATFORM_X64
_Data.Offset.TimeText = 0xB0;
_Data.Offset.TimeWidth = 0xB8;
_Data.Offset.MainView = 0x98;
_Data.Offset.SignedTimeText = 0x18;
return true;
#else
# error "Unimplemented."
#endif
}

Some updates to the TG will change some of the member offsets, and it would be better if they were searched dynamically so that hard-coded offsets are no longer needed and have better compatibility, but at this stage they are not.

BTW, these discussions are offtopic from this issue, so if you want to discuss more, please create a new issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants