<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title>www.ritlabs.com [Topic: Customize linkified URL protocols]</title>
		<link>http://www.ritlabs.com</link>
		<description>New posts in Customize linkified URL protocols of  forum at www.ritlabs.com [www.ritlabs.com]</description>
		<language>en</language>
		<docs>http://backend.userland.com/rss2</docs>
		<lastBuildDateTag>Mon, 18 Jun 2012 05:43:39 +0300</lastBuildDateTag>		<item>
			<title>Customize linkified URL protocols</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic10510/message34683/">Customize linkified URL protocols</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			Here is my solution...<br /><br /><span class="bx-font" style="font-family:Courier">
====code====
<pre>unit TheBatProto;

interface

implementation

uses
&nbsp;&nbsp;Common, Windows, TlHelp32, SysUtils;

procedure PatchMemory(H: THandle);
var
&nbsp;&nbsp;Memory: String;
&nbsp;&nbsp;Buffer: array&#91;0..1023&#93; of Char;
&nbsp;&nbsp;P, C: Cardinal;
const
&nbsp;&nbsp;Replacement: array&#91;1..9&#93; of Char = 'custom://';
&nbsp;&nbsp;Base = $400000; // should be $ 400000 with no space - forum is mangling $ signs
begin
&nbsp;&nbsp;P := 0;
&nbsp;&nbsp;Memory := '';
&nbsp;&nbsp;repeat
&nbsp;&nbsp;&nbsp;&nbsp;if ReadProcessMemory(H, Pointer(Base+P), @Buffer, SizeOf(Buffer), C) and (C = SizeOf(Buffer)) then
&nbsp;&nbsp;&nbsp;&nbsp;begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetLength(Memory, Length(Memory)+SizeOf(Buffer));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Move(Buffer, Memory&#91;1+P&#93;, SizeOf(Buffer));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inc(P, SizeOf(Buffer));
&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Break;
&nbsp;&nbsp;until False;

&nbsp;&nbsp;P := Pos('telnet://', Memory);

&nbsp;&nbsp;if P&#62;0 then
&nbsp;&nbsp;begin
&nbsp;&nbsp;&nbsp;&nbsp;P := Base + P-1;
&nbsp;&nbsp;&nbsp;&nbsp;VirtualProtectEx(H, Pointer(P), SizeOf(Replacement), PAGE_EXECUTE_WRITECOPY, C);
&nbsp;&nbsp;&nbsp;&nbsp;WriteProcessMemory(H, Pointer(P), @Replacement, SizeOf(Replacement), C);
&nbsp;&nbsp;end;
end;

procedure ThreadProc;
var
&nbsp;&nbsp;hSnapshoot: THandle;
&nbsp;&nbsp;pe32: TProcessEntry32;
&nbsp;&nbsp;hProcess: THandle;
&nbsp;&nbsp;S: String;
&nbsp;&nbsp;OldProcessID: Cardinal;
begin
&nbsp;&nbsp;OldProcessID := 0;
&nbsp;&nbsp;repeat
&nbsp;&nbsp;&nbsp;&nbsp;WaitForSingleObject(Mutex, INFINITE);
&nbsp;&nbsp;&nbsp;&nbsp;hSnapshoot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
&nbsp;&nbsp;&nbsp;&nbsp;pe32.dwSize := SizeOf(TProcessEntry32);
&nbsp;&nbsp;&nbsp;&nbsp;if Process32First(hSnapshoot, pe32) then
&nbsp;&nbsp;&nbsp;&nbsp;repeat
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S := LowerCase(PChar(@pe32.szExeFile&#91;0&#93;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (S='thebat.exe') and (pe32.th32ProcessID &#60;&#62; OldProcessID) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OldProcessID := pe32.th32ProcessID;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hProcess := OpenProcess(PROCESS_ALL_ACCESS, false, pe32.th32ProcessID);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if hProcess=0 then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Warning('Can''t open ' + PChar(@pe32.szExeFile&#91;0&#93;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Continue;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PatchMemory(hProcess);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle(hProcess);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end;
&nbsp;&nbsp;&nbsp;&nbsp;until not Process32Next(hSnapshoot, pe32);
&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle(hSnapshoot);
&nbsp;&nbsp;&nbsp;&nbsp;ReleaseMutex(Mutex);
&nbsp;&nbsp;&nbsp;&nbsp;Sl eep(2000);
&nbsp;&nbsp;until False;
end;

initialization
&nbsp;&nbsp;Spawn(@ThreadProc, 'TheBatProto');
end.
</pre>
=============
</span> <br />
			<i>18 June 2012 05:43:39, <a href="http://www.ritlabs.com/en/forums/">Vladimir</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic10510/message34683/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic10510/message34683/</guid>
			<pubDate>Mon, 18 Jun 2012 05:43:39 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
		<item>
			<title>Customize linkified URL protocols</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic10510/message34622/">Customize linkified URL protocols</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			Hi,<br /><br />When viewing or editing plain-text messages, The Bat makes links clickable. Some of the protocols that The Bat recognizes are "http://", "ftp://", and "mailto:".<br /><br />How can I add another protocol to this list? <br />
			<i>22 May 2012 04:12:43, <a href="http://www.ritlabs.com/en/forums/">Vladimir</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic10510/message34622/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic10510/message34622/</guid>
			<pubDate>Tue, 22 May 2012 04:12:43 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
	</channel>
</rss>
