summaryrefslogtreecommitdiff
path: root/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirandaNGHistoryToDB/HistoryToDBUpdater')
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Global.pas1583
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dpr32
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dproj197
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.manifest21
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.mes163
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.otaresbin0 -> 96 bytes
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.resbin0 -> 146856 bytes
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater_Icon.icobin0 -> 144763 bytes
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.dfm530
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.pas1497
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/NTNative.pas210
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/jedi.inc1430
-rw-r--r--plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/readme-dev.txt38
13 files changed, 5701 insertions, 0 deletions
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Global.pas b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Global.pas
new file mode 100644
index 0000000000..6747ee346d
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Global.pas
@@ -0,0 +1,1583 @@
+{ ################################################################################ }
+{ # # }
+{ # Обновление и установка набора программ IM-History - HistoryToDBUpdater v1.0 # }
+{ # # }
+{ # License: GPLv3 # }
+{ # # }
+{ # Author: Grigorev Michael (icq: 161867489, email: sleuthhound@gmail.com) # }
+{ # # }
+{ ################################################################################ }
+
+unit Global;
+
+{$I jedi.inc}
+
+interface
+
+uses
+ Windows, Forms, Classes, SysUtils, IniFiles, DCPcrypt2, DCPblockciphers, DCPsha1,
+ DCPdes, DCPmd5, TypInfo, Messages, XMLIntf, XMLDoc, StrUtils, Types, TLHELP32, PsAPI, NTNative;
+
+type
+ TWinVersion = (wvUnknown,wv95,wv98,wvME,wvNT3,wvNT4,wvW2K,wvXP,wv2003,wvVista,wv7,wv2008,wv8);
+ TCopyDataType = (cdtString = 0, cdtImage = 1, cdtRecord = 2);
+ TDelim = set of Char;
+ TArrayOfString = Array of String;
+ TArrayOfCardinal = Array of Cardinal;
+ TProcessInfo = packed record
+ ProcessName: String;
+ PID: DWord;
+ ProcessFullCmd: String;
+ ProcessPath: String;
+ ProcessParamCmd: String;
+ end;
+ TProcessInfoArray = Array of TProcessInfo;
+
+const
+ ProgramsName = 'HistoryToDBUpdater';
+ ProgramsVer : WideString = '2.5.0.0';
+ DefaultDBAddres = 'db01.im-history.ru';
+ DefaultDBName = 'imhistory';
+ ININame = 'HistoryToDB.ini';
+ ErrLogName = 'HistoryToDBUpdaterErr.log';
+ DebugLogName = 'HistoryToDBUpdaterDebug.log';
+ // Начальная дата (01/01/1970) Unix Timestamp для функций конвертации
+ UnixStartDate: TDateTime = 25569.0;
+ // Ключь для расшифровки параметра DBPasswd из конфига
+ EncryptKey = 'jsU6s2msoxghsKsn7';
+ // Для мультиязыковой поддержки
+ WM_LANGUAGECHANGED = WM_USER + 1;
+ dirLangs = 'langs\';
+ dirSQLUpdate = 'update\';
+ defaultLangFile = 'English.xml';
+ // End
+ WM_MSGBOX = WM_USER + 2;
+ uURL = 'http://im-history.ru/update/get.php?file=HistoryToDB-Update';
+ {$IFDEF WIN32}
+ PlatformType = 'x86';
+ {$ELSE}
+ PlatformType = 'x64';
+ {$ENDIF}
+var
+ WriteErrLog: Boolean;
+ EnableDebug, AlphaBlendEnable: Boolean;
+ MaxErrLogSize, AlphaBlendEnableValue: Integer;
+ DBType, DefaultLanguage, IMClientType: String;
+ PluginPath, ProfilePath: WideString;
+ Global_MainForm_Showing, Global_AboutForm_Showing: Boolean;
+ Global_IMProcessPID: DWORD;
+ // Прокси
+ IMUseProxy, IMProxyAuth: Boolean;
+ IMProxyAddress, IMProxyPort, IMProxyUser, IMProxyUserPagsswd: String;
+ DBUserName, MyAccount: String;
+ IMClientPlatformType: String;
+ UpdateServer: String;
+ // Шифрование
+ Cipher: TDCP_3des;
+ Digest: Array[0..19] of Byte;
+ Hash: TDCP_sha1;
+ // Для мультиязыковой поддержки
+ CoreLanguage: String;
+ MainFormHandle: HWND;
+ AboutFormHandle: HWND;
+ LangDoc: IXMLDocument;
+
+function BoolToIntStr(Bool: Boolean): String;
+function IsNumber(const S: String): Boolean;
+function DateTimeToUnix(ConvDate: TDateTime): Longint;
+function UnixToDateTime(USec: Longint): TDateTime;
+function PrepareString(const Source : PWideChar) : AnsiString;
+function EncryptStr(const Str: String): String;
+function DecryptStr(const Str: String): String;
+function EncryptMD5(Str: String): String;
+function MatchStrings(source, pattern: String): Boolean;
+function ExtractFileNameEx(FileName: String; ShowExtension: Boolean): String;
+function ReadCustomINI(INIPath, CustomSection, CustomParams, DefaultParamsStr: String): String;
+function GetSystemDefaultUILanguage: UINT; stdcall; external kernel32 name 'GetSystemDefaultUILanguage';
+function GetSysLang: AnsiString;
+function Tok(Sep: String; var S: String): String;
+function GetMyFileSize(const Path: String): Integer;
+function SearchMainWindow(MainWindowName: pWideChar): Boolean;
+function StrContactProtoToInt(Proto: AnsiString): Integer;
+function IsProcessRun(ProcessName: String): Boolean; overload;
+function IsProcessRun(ProcessName, WinCaption: String): Boolean; overload;
+function GetProcessID(ExeFileName: String): Cardinal;
+//function GetProcessIDMulti(ExeFileName: String): TArrayOfString;
+function GetProcessIDMulti2(ExeFileName: String): TArrayOfCardinal;
+function GetThreadsOfProcess(APID: Cardinal): TIntegerDynArray;
+function KillTask(ExeFileName: String): Integer; overload;
+function KillTask(ExeFileName, WinCaption: String): Integer; overload;
+function ProcessTerminate(dwPID: Cardinal): Boolean;
+function ProcCloseEnum(hwnd: THandle; data: Pointer):BOOL;stdcall;
+function ProcQuitEnum(hwnd: THandle; data: Pointer):BOOL;stdcall;
+function GetProcessFileName(PID: DWord; FullPath: Boolean=True): String;
+function GetProcessCmdLine(dwProcessId : DWORD): String;
+function SetProcessDebugPrivelege: Boolean;
+function EndProcess(IMClientExeName: String; EndType: Integer; EndProcess: Boolean): TProcessInfoArray;
+function GetUserTempPath: WideString;
+//function ProcGetCaptionForHandleEnum(hwnd: THandle; data: Pointer):BOOL;stdcall;
+function EnumThreadWndProc(hwnd: HWND; lParam: LPARAM): BOOL; stdcall;
+function StringToParts(sString:String; tdDelim:TDelim): TArrayOfString;
+function ExtractWord(const AString: string; const ADelimiter: Char; const ANumber: integer): string;
+procedure EncryptInit;
+procedure EncryptFree;
+procedure WriteInLog(LogPath: String; TextString: String; LogType: Integer);
+procedure LoadINI(INIPath: String; NotSettingsForm: Boolean);
+procedure WriteCustomINI(INIPath, CustomSection, CustomParams, ParamsStr: String);
+procedure MakeTransp(winHWND: HWND);
+procedure OnSendMessageToAllComponent(Msg: String);
+procedure IMDelay(Value: Cardinal);
+procedure OnSendMessageToOneComponent(WinName, Msg: String);
+function DetectWinVersion: TWinVersion;
+function DetectWinVersionStr: String;
+// Для мультиязыковой поддержки
+procedure MsgDie(Caption, Msg: WideString);
+procedure MsgInf(Caption, Msg: WideString);
+function GetLangStr(StrID: String): WideString;
+
+implementation
+
+function BoolToIntStr(Bool: Boolean): String;
+begin
+ if Bool then
+ Result := '1'
+ else
+ Result := '0'
+end;
+
+function IsNumber(const S: string): Boolean;
+begin
+ Result := True;
+ try
+ StrToInt(S);
+ except
+ Result := False;
+ end;
+end;
+
+// Функция конвертации DateTime в Unix Timestamp
+function DateTimeToUnix(ConvDate: TDateTime): Longint;
+begin
+ Result := Round((ConvDate - UnixStartDate) * 86400);
+end;
+
+// Функция конвертации Unix Timestamp в DateTime
+function UnixToDateTime(USec: Longint): TDateTime;
+begin
+ Result := (Usec / 86400) + UnixStartDate;
+end;
+
+// Функция для экранирования спецсимволов в строке
+function PrepareString(const Source : PWideChar) : AnsiString;
+var
+ SLen,i : Cardinal;
+ WSTmp : WideString;
+ WChar : WideChar;
+begin
+ Result := '';
+ SLen := Length(WideString(Source));
+ if (SLen>0) then
+ begin
+ for i:=1 to SLen do
+ begin
+ WChar:=WideString(Source)[i];
+ case WChar of
+ #$09 :{tab} WSTmp:=WSTmp+'\t';
+ #$0A :{line feed} WSTmp:=WSTmp+'\n';
+ #$0D :{carriage return} WSTmp:=WSTmp+'\r';
+ #$27 :{single quote mark aka apostrophe?} WSTmp:=WSTmp+WChar+WChar;
+ #$22, {double quote mark aka inch sign?}
+ #$5C, {backslash itself}
+ #$60 :{another single quote mark} WSTmp:=WSTmp+'\'+WChar;
+ else WSTmp := WSTmp + WChar;
+ end;
+ end;
+ Result := AnsiString(WSTmp);
+ end;
+end;
+
+// Инициируем криптование
+procedure EncryptInit;
+begin
+ Hash:= TDCP_sha1.Create(nil);
+ try
+ Hash.Init;
+ Hash.UpdateStr(EncryptKey);
+ Hash.Final(Digest);
+ finally
+ Hash.Free;
+ end;
+ Cipher := TDCP_3des.Create(nil);
+ Cipher.Init(Digest,Sizeof(Digest)*8,nil);
+end;
+
+// Освобождаем ресурсы
+procedure EncryptFree;
+begin
+ if Assigned(Cipher) then
+ begin
+ Cipher.Burn;
+ Cipher.Free;
+ end;
+end;
+
+// Зашифровываем строку
+function EncryptStr(const Str: String): String;
+begin
+ Result := '';
+ if Str <> '' then
+ begin
+ Cipher.Reset;
+ Result := Cipher.EncryptString(Str);
+ end;
+end;
+
+// Расшифровываем строку
+function DecryptStr(const Str: String): String;
+begin
+ Result := '';
+ if Str <> '' then
+ begin
+ Cipher.Reset;
+ Result := Cipher.DecryptString(Str);;
+ end;
+end;
+
+// Подсчет MD5 строки
+function EncryptMD5(Str: String): String;
+var
+ Hash: TDCP_md5;
+ Digest: Array[0..15] of Byte;
+ I: Integer;
+ P: String;
+begin
+ if Str <> '' then
+ begin
+ Hash:= TDCP_md5.Create(nil);
+ try
+ Hash.HashSize := 128;
+ Hash.Init;
+ Hash.UpdateStr(Str);
+ Hash.Final(Digest);
+ P := '';
+ for I:= 0 to 15 do
+ P:= P + IntToHex(Digest[I], 2);
+ finally
+ Hash.Free;
+ end;
+ Result := P;
+ end
+ else
+ Result := 'MD5';
+end;
+
+// LogType = 0 - ошибки добавляются в файл ErrLogName
+// LogType = 1 - сообщения добавляются в файл DebugLogName
+procedure WriteInLog(LogPath: String; TextString: String; LogType: Integer);
+var
+ Path: WideString;
+ TF: TextFile;
+begin
+ if LogType = 0 then
+ begin
+ Path := LogPath + ErrLogName;
+ if (GetMyFileSize(Path) > MaxErrLogSize*1024) then
+ DeleteFile(Path);
+ end
+ else
+ Path := LogPath + DebugLogName;
+ {$I-}
+ try
+ Assign(TF,Path);
+ if FileExists(Path) then
+ Append(TF)
+ else
+ Rewrite(TF);
+ Writeln(TF,TextString);
+ CloseFile(TF);
+ except
+ on e :
+ Exception do
+ begin
+ CloseFile(TF);
+ Exit;
+ end;
+ end;
+ {$I+}
+end;
+
+// Загружаем настройки
+procedure LoadINI(INIPath: String; NotSettingsForm: Boolean);
+var
+ Path: WideString;
+ Temp: String;
+ INI: TIniFile;
+begin
+ // Проверяем наличие каталога
+ if not DirectoryExists(INIPath) then
+ CreateDir(INIPath);
+ Path := INIPath + ININame;
+ if FileExists(Path) then
+ begin
+ INI := TIniFile.Create(Path);
+ try
+ DBType := INI.ReadString('Main', 'DBType', 'Unknown');
+ DBUserName := INI.ReadString('Main', 'DBUserName', 'username');
+ DefaultLanguage := INI.ReadString('Main', 'DefaultLanguage', 'English');
+ IMClientType := INI.ReadString('Main', 'IMClientType', 'Unknown');
+ MyAccount := INI.ReadString('Main', 'MyAccount', DBUserName);
+
+ Temp := INI.ReadString('Main', 'WriteErrLog', '0');
+ if Temp = '1' then WriteErrLog := True
+ else WriteErrLog := False;
+
+ MaxErrLogSize := INI.ReadInteger('Main', 'MaxErrLogSize', 20);
+
+ Temp := INI.ReadString('Main', 'EnableDebug', '0');
+ if Temp = '1' then EnableDebug := True
+ else EnableDebug := False;
+
+ Temp := INI.ReadString('Main', 'AlphaBlend', '0');
+ if Temp = '1' then AlphaBlendEnable := True
+ else AlphaBlendEnable := False;
+ AlphaBlendEnableValue := INI.ReadInteger('Main', 'AlphaBlendValue', 255);
+
+ Temp := INI.ReadString('Proxy', 'UseProxy', '0');
+ if Temp = '1' then IMUseProxy := True
+ else IMUseProxy := False;
+
+ IMProxyAddress := INI.ReadString('Proxy', 'ProxyAddress', '127.0.0.1');
+ IMProxyPort := INI.ReadString('Proxy', 'ProxyPort', '3128');
+
+ Temp := INI.ReadString('Proxy', 'ProxyAuth', '0');
+ if Temp = '1' then IMProxyAuth := True
+ else IMProxyAuth := False;
+
+ IMProxyUser := INI.ReadString('Proxy', 'ProxyUser', '');
+ IMProxyUserPagsswd := INI.ReadString('Proxy', 'ProxyUserPasswd', '');
+ if IMProxyUserPagsswd <> '' then
+ IMProxyUserPagsswd := DecryptStr(IMProxyUserPagsswd);
+
+ IMClientPlatformType := INI.ReadString('Main', 'IMClientPlatformType', PlatformType);
+ UpdateServer := INI.ReadString('Updater', 'UpdateServer', uURL);
+ finally
+ INI.Free;
+ end;
+ end
+ else
+ begin
+ INI := TIniFile.Create(path);
+ try
+ // Значения по-умолчанию
+ DBType := 'Unknown';
+ DefaultLanguage := 'English';
+ IMClientType := 'Unknown';
+ WriteErrLog := True;
+ MaxErrLogSize := 20;
+ EnableDebug := False;
+ AlphaBlendEnable := False;
+ AlphaBlendEnableValue := 255;
+ IMUseProxy := False;
+ IMProxyAddress := '127.0.0.1';
+ IMProxyPort := '3128';
+ IMProxyAuth := False;
+ IMProxyUser := '';
+ IMProxyUserPagsswd := '';
+ // Сохраняем настройки
+ INI.WriteString('Main', 'DBType', DBType);
+ INI.WriteString('Main', 'DefaultLanguage', DefaultLanguage);
+ INI.WriteString('Main', 'IMClientType', IMClientType);
+ INI.WriteString('Main', 'WriteErrLog', BoolToIntStr(WriteErrLog));
+ INI.WriteInteger('Main', 'MaxErrLogSize', MaxErrLogSize);
+ INI.WriteString('Main', 'EnableDebug', BoolToIntStr(EnableDebug));
+ INI.WriteString('Main', 'AlphaBlend', BoolToIntStr(AlphaBlendEnable));
+ INI.WriteInteger('Main', 'AlphaBlendValue', AlphaBlendEnableValue);
+ INI.WriteString('Proxy', 'UseProxy', BoolToIntStr(IMUseProxy));
+ INI.WriteString('Proxy', 'ProxyAddress', IMProxyAddress);
+ INI.WriteString('Proxy', 'ProxyPort', IMProxyPort);
+ INI.WriteString('Proxy', 'ProxyAuth', BoolToIntStr(IMProxyAuth));
+ INI.WriteString('Proxy', 'ProxyUser', IMProxyUser);
+ INI.WriteString('Proxy', 'ProxyUserPasswd', IMProxyUserPagsswd);
+ INI.WriteString('Updater', 'UpdateServer', uURL);
+ finally
+ INI.Free;
+ end;
+ end;
+end;
+
+{Функция осуществляет сравнение двух строк. Первая строка
+может быть любой, но она не должна содержать символов соответствия (* и ?).
+Строка поиска (искомый образ) может содержать абсолютно любые символы.
+Для примера: MatchStrings('David Stidolph','*St*') возвратит True.
+Автор оригинального C-кода Sean Stanley
+Автор портации на Delphi David Stidolph}
+function MatchStrings(source, pattern: String): Boolean;
+var
+ pSource: array[0..255] of Char;
+ pPattern: array[0..255] of Char;
+
+ function MatchPattern(element, pattern: PChar): Boolean;
+
+ function IsPatternWild(pattern: PChar): Boolean;
+ begin
+ Result := StrScan(pattern, '*') <> nil;
+ if not Result then
+ Result := StrScan(pattern, '?') <> nil;
+ end;
+
+ begin
+ if 0 = StrComp(pattern, '*') then
+ Result := True
+ else if (element^ = Chr(0)) and (pattern^ <> Chr(0)) then
+ Result := False
+ else if element^ = Chr(0) then
+ Result := True
+ else
+ begin
+ case pattern^ of
+ '*': if MatchPattern(element, @pattern[1]) then
+ Result := True
+ else
+ Result := MatchPattern(@element[1], pattern);
+ '?': Result := MatchPattern(@element[1], @pattern[1]);
+ else
+ if element^ = pattern^ then
+ Result := MatchPattern(@element[1], @pattern[1])
+ else
+ Result := False;
+ end;
+ end;
+ end;
+begin
+ StrPCopy(pSource, source);
+ StrPCopy(pPattern, pattern);
+ Result := MatchPattern(pSource, pPattern);
+end;
+
+{ Функция для получения имени файла из пути без или с его расширением.
+ Возвращает имя файла, без или с его расширением.
+ Входные параметры:
+ FileName - имя файла, которое надо обработать
+ ShowExtension - если TRUE, то функция возвратит короткое имя файла
+ (без полного пути доступа к нему), с расширением этого файла, иначе, возвратит
+ короткое имя файла, без расширения этого файла. }
+function ExtractFileNameEx(FileName: String; ShowExtension: Boolean): String;
+var
+ I: Integer;
+ S, S1: string;
+begin
+ I := Length(FileName);
+ if I <> 0 then
+ begin
+ while (FileName[i] <> '\') and (i > 0) do
+ i := i - 1;
+ S := Copy(FileName, i + 1, Length(FileName) - i);
+ i := Length(S);
+ if i = 0 then
+ begin
+ Result := '';
+ Exit;
+ end;
+ while (S[i] <> '.') and (i > 0) do
+ i := i - 1;
+ S1 := Copy(S, 1, i - 1);
+ if s1 = '' then
+ s1 := s;
+ if ShowExtension = True then
+ Result := s
+ else
+ Result := s1;
+ end
+ else
+ Result := '';
+end;
+
+{ Прозрачность окна MessageBox }
+procedure MakeTransp(winHWND: HWND);
+var
+ exStyle: Longint;
+begin
+ exStyle := GetWindowLong(winHWND, GWL_EXSTYLE);
+ if (exStyle and WS_EX_LAYERED = 0) then
+ begin
+ exStyle := exStyle or WS_EX_LAYERED;
+ SetwindowLong(winHWND, GWL_EXSTYLE, exStyle);
+ end;
+ SetLayeredWindowAttributes(winHWND, 0, AlphaBlendEnableValue, LWA_ALPHA);
+end;
+
+// Для мультиязыковой поддержки
+procedure MsgDie(Caption, Msg: WideString);
+begin
+ if AlphaBlendEnable then
+ PostMessage(GetForegroundWindow, WM_USER + 2, 0, 0);
+ MessageBoxW(GetForegroundWindow, PWideChar(Msg), PWideChar(Caption), MB_ICONERROR);
+end;
+
+// Для мультиязыковой поддержки
+procedure MsgInf(Caption, Msg: WideString);
+begin
+ if AlphaBlendEnable then
+ PostMessage(GetForegroundWindow, WM_USER + 2, 0, 0);
+ MessageBoxW(GetForegroundWindow, PWideChar(Msg), PWideChar(Caption), MB_ICONINFORMATION);
+end;
+
+// Для мультиязыковой поддержки
+function GetLangStr(StrID: String): WideString;
+begin
+ if (not Assigned(LangDoc)) or (not LangDoc.Active) then
+ begin
+ Result := '';
+ Exit;
+ end;
+ if LangDoc.ChildNodes['strings'].ChildNodes.FindNode(StrID) <> nil then
+ Result := LangDoc.ChildNodes['strings'].ChildNodes[StrID].Text
+ else
+ Result := 'String not found.';
+end;
+
+function GetSysLang: AnsiString;
+var
+ WinLanguage: Array [0..50] of Char;
+begin
+ //Result := Lo(GetSystemDefaultUILanguage);
+ VerLanguageName(GetSystemDefaultLangID, WinLanguage, 50);
+ Result := StrPas(WinLanguage);
+end;
+
+{ Функция разбивает строку S на слова, разделенные символами-разделителями,
+указанными в строке Sep. Функция возвращает первое найденное слово, при
+этом из строки S удаляется начальная часть до следующего слова }
+function Tok(Sep: String; var S: String): String;
+
+ function isoneof(c, s: string): Boolean;
+ var
+ iTmp: integer;
+ begin
+ Result := False;
+ for iTmp := 1 to Length(s) do
+ begin
+ if c = Copy(s, iTmp, 1) then
+ begin
+ Result := True;
+ Exit;
+ end;
+ end;
+ end;
+
+var
+ c, t: String;
+begin
+ if s = '' then
+ begin
+ Result := s;
+ Exit;
+ end;
+ c := Copy(s, 1, 1);
+ while isoneof(c, sep) do
+ begin
+ s := Copy(s, 2, Length(s) - 1);
+ c := Copy(s, 1, 1);
+ end;
+ t := '';
+ while (not isoneof(c, sep)) and (s <> '') do
+ begin
+ t := t + c;
+ s := Copy(s, 2, length(s) - 1);
+ c := Copy(s, 1, 1);
+ end;
+ Result := t;
+end;
+
+{ Процедура записи значения параметра в файл настроек }
+procedure WriteCustomINI(INIPath, CustomSection, CustomParams, ParamsStr: String);
+var
+ Path: String;
+ IsFileClosed: Boolean;
+ sFile: DWORD;
+ INI: TIniFile;
+begin
+ Path := INIPath + ININame;
+ if FileExists(Path) then
+ begin
+ // Ждем пока файл освободит антивирь или еще какая-нибудь гадость
+ IsFileClosed := False;
+ repeat
+ sFile := CreateFile(PChar(Path),GENERIC_READ or GENERIC_WRITE,0,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
+ if (sFile <> INVALID_HANDLE_VALUE) then
+ begin
+ CloseHandle(sFile);
+ IsFileClosed := True;
+ end;
+ until IsFileClosed;
+ // End
+ INI := TIniFile.Create(Path);
+ try
+ INI.WriteString(CustomSection, CustomParams, ParamsStr);
+ finally
+ INI.Free;
+ end;
+ end
+ else
+ MsgDie(ProgramsName, GetLangStr('SettingsErrSave'));
+end;
+
+{ Функция чтения значения параметра из файла настроек }
+function ReadCustomINI(INIPath, CustomSection, CustomParams, DefaultParamsStr: String): String;
+var
+ Path: String;
+ INI: TIniFile;
+begin
+ Path := INIPath + ININame;
+ INI := TIniFile.Create(Path);
+ if FileExists(Path) then
+ begin
+ try
+ Result := INI.ReadString(CustomSection, CustomParams, DefaultParamsStr);
+ finally
+ INI.Free;
+ end;
+ end
+ else
+ MsgDie(ProgramsName, GetLangStr('SettingsErrRead'));
+end;
+
+// Если файл не существует, то вместо размера файла функция вернёт -1
+function GetMyFileSize(const Path: String): Integer;
+var
+ FD: TWin32FindData;
+ FH: THandle;
+begin
+ FH := FindFirstFile(PChar(Path), FD);
+ Result := 0;
+ if FH = INVALID_HANDLE_VALUE then
+ Exit;
+ Result := FD.nFileSizeLow;
+ if ((FD.nFileSizeLow and $80000000) <> 0) or
+ (FD.nFileSizeHigh <> 0) then
+ Result := -1;
+ //FindClose(FH);
+end;
+
+{ Поиск окна программы }
+function SearchMainWindow(MainWindowName: pWideChar): Boolean;
+var
+ HToDB: HWND;
+begin
+ // Ищем окно
+ HToDB := FindWindow(nil, MainWindowName);
+ if HToDB <> 0 then
+ Result := True
+ else
+ Result := False
+end;
+
+{ Процедура для отправки сообщений программе }
+{ Стандартные команды:
+ 001 - Перечитать настройки из файла HistoryToDB.ini
+ 002 - Синхронизация истории
+ 003 - Закрыть все компоненты плагина
+ 0040 - Показать все окна плагина (Режим AntiBoss)
+ 0041 - Скрыть все окна плагина (Режим AntiBoss)
+ 0050 - Запустить перерасчет MD5-хешей
+ 0051 - Запустить перерасчет MD5-хешей и удаления дубликатов
+ 0060 - Запущен импорт истории
+ 0061 - Импорт истории завершен
+ 007 - Обновить контакт-лист в БД
+ 008 - Показать историю контакта/чата
+ Формат команды:
+ для истории контакта:
+ 008|0|UserID|UserName|ProtocolType
+ для истории чата:
+ 008|2|ChatName
+ 009 - Экстренно закрыть все компоненты плагина.
+}
+procedure OnSendMessageToAllComponent(Msg: String);
+var
+ HToDB: HWND;
+ copyDataStruct : TCopyDataStruct;
+ EncryptMsg, WinName: String;
+begin
+ EncryptMsg := EncryptStr(Msg);
+ WinName := 'HistoryToDBViewer for ' + IMClientType;
+ // Ищем окно HistoryToDBViewer и посылаем ему команду
+ HToDB := FindWindow(nil, pChar(WinName));
+ if HToDB <> 0 then
+ begin
+ copyDataStruct.dwData := Integer(cdtString);
+ copyDataStruct.cbData := 2*Length(EncryptMsg);
+ copyDataStruct.lpData := PChar(EncryptMsg);
+ SendMessage(HToDB, WM_COPYDATA, 0, Integer(@copyDataStruct));
+ end;
+ WinName := 'HistoryToDBSync for ' + IMClientType;
+ // Ищем окно HistoryToDBSync и посылаем ему команду
+ HToDB := FindWindow(nil, pChar(WinName));
+ if HToDB <> 0 then
+ begin
+ copyDataStruct.dwData := Integer(cdtString);
+ copyDataStruct.cbData := 2*Length(EncryptMsg);
+ copyDataStruct.lpData := PChar(EncryptMsg);
+ SendMessage(HToDB, WM_COPYDATA, 0, Integer(@copyDataStruct));
+ end;
+ WinName := 'HistoryToDBImport for ' + IMClientType;
+ // Ищем окно HistoryToDBImport и посылаем ему команду
+ HToDB := FindWindow(nil, pChar(WinName));
+ if HToDB <> 0 then
+ begin
+ copyDataStruct.dwData := Integer(cdtString);
+ copyDataStruct.cbData := 2*Length(EncryptMsg);
+ copyDataStruct.lpData := PChar(EncryptMsg);
+ SendMessage(HToDB, WM_COPYDATA, 0, Integer(@copyDataStruct));
+ end;
+end;
+
+procedure OnSendMessageToOneComponent(WinName, Msg: String);
+var
+ HToDB: HWND;
+ copyDataStruct : TCopyDataStruct;
+ EncryptMsg: String;
+begin
+ EncryptMsg := EncryptStr(Msg);
+ // Ищем окно HistoryToDBViewer и посылаем ему команду
+ HToDB := FindWindow(nil, pChar(WinName));
+ if HToDB <> 0 then
+ begin
+ copyDataStruct.dwData := Integer(cdtString);
+ copyDataStruct.cbData := 2*Length(EncryptMsg);
+ copyDataStruct.lpData := PChar(EncryptMsg);
+ SendMessage(HToDB, WM_COPYDATA, 0, Integer(@copyDataStruct));
+ end;
+end;
+
+function StrContactProtoToInt(Proto: AnsiString): Integer;
+var
+ ProtoType: Integer;
+begin
+ { Протоколы
+ 0 - ICQ
+ 1 - Google Talk
+ 2 - MRA
+ 3 - Jabber
+ 4 - QIP.Ru
+ 5 - Facebook
+ 6 - VKontacte
+ 7 - Twitter
+ 8 - Social (LiveJournal)
+ 9 - AIM
+ 10 - IRC
+ 11 - MSN
+ 12 - YAHOO
+ 13 - GADU
+ 14 - SKYPE
+ 15 - Unknown
+ }
+ if MatchStrings(LowerCase(Proto), 'icq*') then
+ ProtoType := 0
+ else if MatchStrings(LowerCase(Proto), 'google talk*') then
+ ProtoType := 1
+ else if MatchStrings(LowerCase(Proto), 'mra*') then
+ ProtoType := 2
+ else if MatchStrings(LowerCase(Proto), 'jabber*') then
+ ProtoType := 3
+ else if (LowerCase(Proto) = 'qip.ru') then
+ ProtoType := 4
+ else if MatchStrings(LowerCase(Proto), 'facebook*') then
+ ProtoType := 5
+ else if MatchStrings(LowerCase(Proto), 'vkontakte*') then
+ ProtoType := 6
+ else if MatchStrings(Proto, 'ВКонтакте*') then
+ ProtoType := 6
+ else if MatchStrings(Proto, 'вконтакте*') then
+ ProtoType := 6
+ else if MatchStrings(LowerCase(Proto), 'twitter*') then
+ ProtoType := 7
+ else if MatchStrings(LowerCase(Proto), 'livejournal*') then
+ ProtoType := 8
+ else if MatchStrings(LowerCase(Proto), 'aim*') then
+ ProtoType := 9
+ else if MatchStrings(LowerCase(Proto), 'irc*') then
+ ProtoType := 10
+ else if MatchStrings(LowerCase(Proto), 'msn*') then
+ ProtoType := 11
+ else if MatchStrings(LowerCase(Proto), 'yahoo*') then
+ ProtoType := 12
+ else if MatchStrings(LowerCase(Proto), 'gadu*') then
+ ProtoType := 13
+ else if MatchStrings(LowerCase(Proto), 'skype*') then
+ ProtoType := 14
+ else
+ ProtoType := 15;
+ Result := ProtoType;
+end;
+
+{ Задержка не грузящая процессор }
+procedure IMDelay(Value: Cardinal);
+var
+ F, N: Cardinal;
+begin
+ N := 0;
+ while N <= (Value div 10) do
+ begin
+ SleepEx(1, True);
+ Application.ProcessMessages;
+ Inc(N);
+ end;
+ F := GetTickCount;
+ repeat
+ Application.ProcessMessages;
+ N := GetTickCount;
+ until (N - F >= (Value mod 10)) or (N < F);
+end;
+
+{ Закрытие программы через WM_CLOSE по её PID }
+function ProcCloseEnum(hwnd: THandle; data: Pointer):BOOL;stdcall;
+var
+ Pid: DWORD;
+begin
+ Result := True;
+ GetWindowThreadProcessId(hwnd, pid);
+ if Pid = DWORD(data) then
+ begin
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+ end;
+end;
+
+{ Закрытие программы через WM_QUIT по её PID }
+function ProcQuitEnum(hwnd: THandle; data: Pointer):BOOL;stdcall;
+var
+ Pid: DWORD;
+begin
+ Result := True;
+ GetWindowThreadProcessId(hwnd, pid);
+ if Pid = DWORD(data) then
+ begin
+ PostMessage(hwnd, WM_QUIT, 0, 0);
+ end;
+end;
+
+{function ProcGetCaptionForHandleEnum(hwnd: THandle; data: Pointer):BOOL;stdcall;
+var
+ Pid: DWORD;
+ WinCaption: Array [0 .. 255] of Char;
+begin
+ Result := True;
+ GetWindowThreadProcessId(hwnd, pid);
+ if Pid = DWORD(data) then
+ begin
+ //PostMessage(hwnd, WM_QUIT, 0, 0);
+ GetWindowText(hwnd, WinCaption, SizeOf(WinCaption));
+ if WinCaption <> '' then
+ MsgInf('ProcGetCaptionForHandleEnum', WinCaption);
+ end;
+end;}
+
+{ Функция отправляет WM_QUIT процессу
+ и возвращает TArrayOfString со списком полных путей + параметры запуска
+ этих процессов
+ EndType = 0 - WM_CLOSE
+ EndType = 1 - WM_QUIT
+ }
+function EndProcess(IMClientExeName: String; EndType: Integer; EndProcess: Boolean): TProcessInfoArray;
+var
+ I: Integer;
+ ProcessPIDListArray: TArrayOfCardinal;
+ MyFullCMD, MyCMD, ProcessCmdLine: String;
+begin
+ SetLength(Result, 0);
+ SetLength(ProcessPIDListArray, 0);
+ ProcessPIDListArray := GetProcessIDMulti2(IMClientExeName);
+ for I := 0 to High(ProcessPIDListArray) do
+ begin
+ SetLength(Result, Length(Result)+1);
+ Result[Length(Result)-1].ProcessName := IMClientExeName;
+ Result[Length(Result)-1].PID := ProcessPIDListArray[I];
+ ProcessCmdLine := GetProcessCmdLine(ProcessPIDListArray[I]);
+ if ProcessCmdLine = '' then
+ begin
+
+ if (IMClientExeName = 'qip.exe') and (DetectWinVersionStr = 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\QIP 2012\qip.exe"'
+ else if (IMClientExeName = 'qip.exe') and (DetectWinVersionStr <> 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files (x86)\QIP 2012\qip.exe"'
+
+ else if (IMClientExeName = 'miranda32.exe') and (IMClientType = 'Miranda') and (DetectWinVersionStr = 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\Miranda IM\miranda32.exe"'
+ else if (IMClientExeName = 'miranda32.exe') and (IMClientType = 'Miranda') and (DetectWinVersionStr <> 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files (x86)\Miranda IM\miranda32.exe"'
+ else if (IMClientExeName = 'miranda64.exe') and (IMClientType = 'Miranda') and (DetectWinVersionStr = 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\Miranda IM\miranda32.exe"'
+ else if (IMClientExeName = 'miranda64.exe') and (IMClientType = 'Miranda') and (DetectWinVersionStr <> 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\Miranda IM\miranda32.exe"'
+
+ else if (IMClientExeName = 'miranda32.exe') and (IMClientType = 'MirandaNG') and (DetectWinVersionStr = 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\Miranda NG\miranda32.exe"'
+ else if (IMClientExeName = 'miranda32.exe') and (IMClientType = 'MirandaNG') and (DetectWinVersionStr <> 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files (x86)\Miranda NG\miranda32.exe"'
+ else if (IMClientExeName = 'miranda64.exe') and (IMClientType = 'MirandaNG') and (DetectWinVersionStr = 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\Miranda NG\miranda32.exe"'
+ else if (IMClientExeName = 'miranda64.exe') and (IMClientType = 'MirandaNG') and (DetectWinVersionStr <> 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\Miranda NG\miranda32.exe"'
+
+ else if (IMClientExeName = 'skype.exe') and (DetectWinVersionStr = 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files (x86)\Skype\Phone\skype.exe"'
+ else if (IMClientExeName = 'skype.exe') and (DetectWinVersionStr <> 'Windows 7') then
+ ProcessCmdLine := '"C:\Program Files\Skype\Phone\skype.exe"'
+ else
+ ProcessCmdLine := IMClientExeName;
+ end;
+ Result[Length(Result)-1].ProcessFullCmd := ProcessCmdLine;
+ //MsgInf('EndProcess', 'ProcessName: ' + Result[Length(Result)-1].ProcessName + #13 + 'PID: ' + IntToStr(Result[Length(Result)-1].PID) + #13 + 'ProcessFullCmd: ' + Result[Length(Result)-1].ProcessFullCmd);
+ //Result[Length(Result)-1] := GetProcessFileName(StrToInt(ProcessListArray[I]), True);
+ // Если в полном CMD вида
+ // "C:/Program Files/PostgreSQL/9.1/bin/postgres.exe" "--forklog" "244" "248"
+ // или
+ // "C:\Program Files\Microsoft Firewall Client 2004\FwcAgent.exe"
+ if Result[Length(Result)-1].ProcessFullCmd[1] = '"' then
+ begin
+ MyFullCMD := Result[Length(Result)-1].ProcessFullCmd;
+ Delete(MyFullCMD, 1, 1);
+ MyCMD := Copy(MyFullCMD, 1, Pos('"', MyFullCMD)-1);
+ Delete(MyFullCMD, 1, Pos('"', MyFullCMD)+1);
+ Result[Length(Result)-1].ProcessPath := MyCMD;
+ Result[Length(Result)-1].ProcessParamCmd := MyFullCMD;
+ end
+ else
+ begin
+ MyFullCMD := Result[Length(Result)-1].ProcessFullCmd;
+ // Если в полном CMD вида
+ // C:\WINDOWS\system32\svchost -k DcomLaunch
+ if Pos(' ', MyFullCMD) > 0 then
+ begin
+ MyCMD := Copy(MyFullCMD, 1, Pos(' ', MyFullCMD)-1);
+ Delete(MyFullCMD, 1, Pos(' ', MyFullCMD));
+ Result[Length(Result)-1].ProcessPath := MyCMD;
+ Result[Length(Result)-1].ProcessParamCmd := MyFullCMD;
+ end
+ // Если в полном CMD вида
+ // C:\WINDOWS\system32\lsass.exe
+ else
+ begin
+ Result[Length(Result)-1].ProcessPath := MyFullCMD;
+ Result[Length(Result)-1].ProcessParamCmd := '';
+ end;
+ end;
+ // Завершение процесса
+ if EndProcess then
+ begin
+ if EndType = 0 then //WM_CLOSE
+ EnumWindows(@ProcCloseEnum, ProcessPIDListArray[I])
+ else //WM_QUIT
+ EnumWindows(@ProcQuitEnum, ProcessPIDListArray[I]);
+ end;
+ end;
+end;
+
+function EnumThreadWndProc(hwnd: HWND; lParam: LPARAM): BOOL; stdcall;
+var
+ WindowClassName: String;
+ WindowClassNameLength: Integer;
+ WinCaption: Array [0 .. 255] of Char;
+ ThreadProcessWinCaption: String;
+ PID: DWORD;
+begin
+ Result := True;
+ ThreadProcessWinCaption := String(LPARAM);
+ GetWindowThreadProcessId(hwnd, pid);
+ SetLength(WindowClassName, MAX_PATH);
+ WindowClassNameLength := GetClassName(hwnd, PChar(WindowClassName), MAX_PATH);
+ GetWindowText(hwnd, WinCaption, SizeOf(WinCaption));
+ if MatchStrings(LeftStr(WindowClassName, WindowClassNameLength), 'TMain*') and (WinCaption = ThreadProcessWinCaption) then
+ begin
+ Global_IMProcessPID := PID;
+ //MsgInf('EnumThreadWndProc', 'PID процесса родителя: ' + IntToStr(PID) + #10#13 + 'Класс: ' + LeftStr(WindowClassName, WindowClassNameLength) + #10#13 + 'Заголовок окна: ' + WinCaption);
+ end;
+ // Получим дочерние окна.
+ //EnumChildWindows(hwnd, @EnumThreadWndProc, lParam);
+end;
+
+{ Получение ID всех потоков указанного процесса }
+function GetThreadsOfProcess(APID: Cardinal): TIntegerDynArray;
+var
+ lSnap: DWord;
+ lThread: TThreadEntry32;
+begin
+ Result := nil;
+ if APID <> INVALID_HANDLE_VALUE then
+ begin
+ lSnap := CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
+ if (lSnap <> INVALID_HANDLE_VALUE) then
+ begin
+ lThread.dwSize := SizeOf(TThreadEntry32);
+ if Thread32First(lSnap, lThread) then
+ repeat
+ if lThread.th32OwnerProcessID = APID then
+ begin
+ SetLength(Result, Length(Result) + 1);
+ Result[High(Result)] := lThread.th32ThreadID;
+ end;
+ until not Thread32Next(lSnap, lThread);
+ CloseHandle(lSnap);
+ end;
+ end;
+end;
+
+{ Проверка процесса на наличие в памяти по его имени }
+function IsProcessRun(ProcessName: String): Boolean; overload;
+var
+ Snapshot: THandle;
+ Proc: TProcessEntry32;
+begin
+ Result := False;
+ Snapshot := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if Snapshot = INVALID_HANDLE_VALUE then
+ Exit;
+ Proc.dwSize := SizeOf(TProcessEntry32);
+ if Process32First(Snapshot, Proc) then
+ repeat
+ if Proc.szExeFile = ProcessName then
+ begin
+ Result := True;
+ Break;
+ end;
+ until not Process32Next(Snapshot, Proc);
+ CloseHandle(Snapshot);
+end;
+
+function IsProcessRun(ProcessName, WinCaption: String): Boolean; overload;
+var
+ Snapshot: THandle;
+ Proc: TProcessEntry32;
+ lThreads: TIntegerDynArray;
+ J: Integer;
+begin
+ Result := False;
+ Snapshot := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if Snapshot = INVALID_HANDLE_VALUE then
+ Exit;
+ Proc.dwSize := SizeOf(TProcessEntry32);
+ if Process32First(Snapshot, Proc) then
+ repeat
+ if ((UpperCase(ExtractFileName(Proc.szExeFile)) = UpperCase(ProcessName))
+ or (UpperCase(Proc.szExeFile) = UpperCase(ProcessName))) then
+ begin
+ // Получение Заголовков окон процесса
+ //EnumWindows(@ProcGetCaptionForHandleEnum, FProcessEntry32.th32ProcessID);
+ // Получение ClassName и Заголовков окон всех потоков процесса
+ Global_IMProcessPID := 0;
+ lThreads := GetThreadsOfProcess(Proc.th32ProcessID);
+ for J := Low(lThreads) to High(lThreads) do
+ EnumThreadWindows(lThreads[J], @EnumThreadWndProc, LPARAM(WinCaption));
+ if Global_IMProcessPID = Proc.th32ProcessID then
+ //MsgInf('IsProcessRun', 'Найден нужный процесс');
+ Result := True;
+ // Ends
+ end;
+ until not Process32Next(Snapshot, Proc);
+ CloseHandle(Snapshot);
+end;
+
+{ Завершение процесса по имени }
+function KillTask(ExeFileName: String): Integer;
+const
+ PROCESS_TERMINATE=$0001;
+var
+ ContinueLoop: BOOL;
+ FSnapshotHandle: THandle;
+ FProcessEntry32: TProcessEntry32;
+begin
+ Result := 0;
+ FSnapshotHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
+ ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
+ while Integer(ContinueLoop) <> 0 do
+ begin
+ if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName))
+ or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
+ Result := Integer(TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0),
+ FProcessEntry32.th32ProcessID), 0));
+ ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
+ end;
+ CloseHandle(FSnapshotHandle);
+end;
+
+{ Завершение процесса по имени и заголовку окна }
+function KillTask(ExeFileName, WinCaption: String): Integer; overload;
+const
+ PROCESS_TERMINATE=$0001;
+var
+ ContinueLoop: BOOL;
+ FSnapshotHandle: THandle;
+ FProcessEntry32: TProcessEntry32;
+ lThreads: TIntegerDynArray;
+ J: Integer;
+begin
+ Result := 0;
+ FSnapshotHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
+ ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
+ while Integer(ContinueLoop) <> 0 do
+ begin
+ if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName))
+ or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
+ begin
+ // Получение Заголовков окон процесса
+ //EnumWindows(@ProcGetCaptionForHandleEnum, FProcessEntry32.th32ProcessID);
+ // Получение ClassName и Заголовков окон всех потоков процесса
+ Global_IMProcessPID := 0;
+ lThreads := GetThreadsOfProcess(FProcessEntry32.th32ProcessID);
+ for J := Low(lThreads) to High(lThreads) do
+ EnumThreadWindows(lThreads[J], @EnumThreadWndProc, LPARAM(WinCaption));
+ if Global_IMProcessPID = FProcessEntry32.th32ProcessID then
+ //MsgInf('KillTask', 'Найден нужный процесс');
+ Result := Integer(TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0), FProcessEntry32.th32ProcessID), 0));
+ // Ends
+ end;
+ ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
+ end;
+ CloseHandle(FSnapshotHandle);
+end;
+
+{ Получение PID программы в памяти }
+function GetProcessID(ExeFileName: String): Cardinal;
+var
+ ContinueLoop: BOOL;
+ FSnapshotHandle: THandle;
+ FProcessEntry32: TProcessEntry32;
+begin
+ Result := 0;
+ FSnapshotHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
+ ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
+ repeat
+ if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName))
+ or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
+ begin
+ Result := FProcessEntry32.th32ProcessID;
+ Break;
+ end;
+ ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
+ until not ContinueLoop;
+ CloseHandle(FSnapshotHandle);
+end;
+
+{ Получение PID для нескольких процессов с одинаковым именем }
+{function GetProcessIDMulti(ExeFileName: String): TArrayOfString;
+var
+ ContinueLoop: BOOL;
+ FSnapshotHandle: THandle;
+ FProcessEntry32: TProcessEntry32;
+begin
+ SetLength(Result, 0);
+ //Result := 0;
+ FSnapshotHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
+ ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
+ repeat
+ if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName))
+ or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
+ begin
+ SetLength(Result, Length(Result)+1);
+ Result[Length(Result)-1] := IntToStr(FProcessEntry32.th32ProcessID);
+ end;
+ ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
+ until not ContinueLoop;
+ CloseHandle(FSnapshotHandle);
+end;}
+
+{ Получение PID для нескольких процессов с одинаковым именем }
+function GetProcessIDMulti2(ExeFileName: String): TArrayOfCardinal;
+var
+ ContinueLoop: BOOL;
+ FSnapshotHandle: THandle;
+ FProcessEntry32: TProcessEntry32;
+begin
+ SetLength(Result, 0);
+ //Result := 0;
+ FSnapshotHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
+ ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
+ repeat
+ if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName))
+ or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then
+ begin
+ SetLength(Result, Length(Result)+1);
+ Result[Length(Result)-1] := FProcessEntry32.th32ProcessID;
+ end;
+ ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
+ until not ContinueLoop;
+ CloseHandle(FSnapshotHandle);
+end;
+
+{ Получаем полный путь до приложения по его PID }
+function GetProcessFileName(PID: DWord; FullPath: Boolean=True): String;
+var
+ Handle: THandle;
+begin
+ Result := '';
+ Handle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, PID);
+ try
+ if Handle <> 0 then
+ begin
+ SetLength(Result, MAX_PATH);
+ if FullPath then
+ begin
+ if GetModuleFileNameEx(Handle, 0, PChar(Result), MAX_PATH) > 0 then
+ SetLength(Result, StrLen(PChar(Result)))
+ else
+ Result := '';
+ end
+ else
+ begin
+ if GetModuleBaseNameA(Handle, 0, PAnsiChar(Result), MAX_PATH) > 0 then
+ SetLength(Result, StrLen(PChar(Result)))
+ else
+ Result := '';
+ end;
+ end;
+ finally
+ CloseHandle(Handle);
+ end;
+end;
+
+{ Получаем команду запуска программы с полным путем по её PID }
+function GetProcessCmdLine(dwProcessId : DWORD): String;
+const
+ STATUS_SUCCESS = $00000000;
+ SE_DEBUG_NAME = 'SeDebugPrivilege';
+ ProcessWow64Information = 26;
+var
+ ProcessHandle : THandle;
+ ProcessBasicInfo : PROCESS_BASIC_INFORMATION;
+ ReturnLength : DWORD;
+ lpNumberOfBytesRead : ULONG_PTR;
+ TokenHandle : THandle;
+ lpLuid : TOKEN_PRIVILEGES;
+ OldlpLuid : TOKEN_PRIVILEGES;
+ Rtl : RTL_USER_PROCESS_PARAMETERS;
+ Peb : _PEB;
+ IsProcessx64 : Boolean;
+ {$IFDEF CPUX64}
+ PEBBaseAddress32 : Pointer;
+ Peb32 : _PEB32;
+ Rtl32 : RTL_USER_PROCESS_PARAMETERS32;
+ {$ENDIF}
+ Ws: WideString;
+begin
+ Result:='';
+ if OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, TokenHandle) then
+ begin
+ try
+ if not LookupPrivilegeValue(nil, SE_DEBUG_NAME, lpLuid.Privileges[0].Luid) then
+ RaiseLastOSError
+ else
+ begin
+ lpLuid.PrivilegeCount := 1;
+ lpLuid.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
+ ReturnLength := 0;
+ OldlpLuid := lpLuid;
+ // Включаем себе SeDebugPrivilege
+ if not AdjustTokenPrivileges(TokenHandle, False, lpLuid, SizeOf(OldlpLuid), OldlpLuid, ReturnLength) then RaiseLastOSError;
+ end;
+
+ ProcessHandle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, false, dwProcessId);
+ if ProcessHandle = 0 then RaiseLastOSError
+ else
+ try
+ IsProcessx64 := ProcessIsX64(ProcessHandle);
+
+ {$IFNDEF CPUX64}
+ if IsProcessx64 then
+ raise Exception.Create('Only 32 bits processes are supported');
+ {$ENDIF}
+
+ {$IFDEF CPUX64}
+ if IsProcessx64 then
+ begin
+ {$ENDIF}
+ // Получаем доступ к PROCESS_BASIC_INFORMATION по адресу PEB
+ if (NtQueryInformationProcess(ProcessHandle,0{=>ProcessBasicInformation},@ProcessBasicInfo, SizeOf(ProcessBasicInfo), @ReturnLength)=STATUS_SUCCESS) and (ReturnLength=SizeOf(ProcessBasicInfo)) then
+ begin
+ // Читаем PEB структуру
+ if not ReadProcessMemory(ProcessHandle, ProcessBasicInfo.PEBBaseAddress, @Peb, sizeof(Peb), lpNumberOfBytesRead) then
+ RaiseLastOSError
+ else
+ begin
+ // Читаем RTL_USER_PROCESS_PARAMETERS структуру
+ if not ReadProcessMemory(ProcessHandle, Peb.ProcessParameters, @Rtl, SizeOf(Rtl), lpNumberOfBytesRead) then
+ RaiseLastOSError
+ else
+ begin
+ SetLength(ws,(Rtl.CommandLine.Length div 2));
+ if not ReadProcessMemory(ProcessHandle,Rtl.CommandLine.Buffer,PWideChar(ws),Rtl.CommandLine.Length,lpNumberOfBytesRead) then
+ RaiseLastOSError
+ else
+ Result := String(ws);
+ end;
+ end;
+ end
+ else
+ RaiseLastOSError;
+ {$IFDEF CPUX64}
+ end
+ else
+ begin
+ // Получаем PEB адрес
+ if NtQueryInformationProcess(ProcessHandle, ProcessWow64Information, @PEBBaseAddress32, SizeOf(PEBBaseAddress32), nil)=STATUS_SUCCESS then
+ begin
+ // Читаем PEB структуру
+ if not ReadProcessMemory(ProcessHandle, PEBBaseAddress32, @Peb32, sizeof(Peb32), lpNumberOfBytesRead) then
+ RaiseLastOSError
+ else
+ begin
+ // Читаем RTL_USER_PROCESS_PARAMETERS структуру
+ if not ReadProcessMemory(ProcessHandle, Pointer(Peb32.ProcessParameters), @Rtl32, SizeOf(Rtl32), lpNumberOfBytesRead) then
+ RaiseLastOSError
+ else
+ begin
+ SetLength(ws,(Rtl32.CommandLine.Length div 2));
+ if not ReadProcessMemory(ProcessHandle, Pointer(Rtl32.CommandLine.Buffer), PWideChar(ws), Rtl32.CommandLine.Length, lpNumberOfBytesRead) then
+ RaiseLastOSError
+ else
+ Result := String(Ws);
+ end;
+ end;
+ end
+ else
+ RaiseLastOSError;
+ end;
+ {$ENDIF}
+ finally
+ CloseHandle(ProcessHandle);
+ end;
+ finally
+ CloseHandle(TokenHandle);
+ end;
+ end
+ else
+ RaiseLastOSError;
+end;
+
+{ Включаем себе SeDebugPrivilege }
+function SetProcessDebugPrivelege: Boolean;
+var
+ hToken: THandle;
+ tp: TTokenPrivileges;
+ rl: Cardinal;
+begin
+ Result := False;
+ if not OpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES,hToken) then
+ Exit;
+ try
+ if not LookupPrivilegeValue(nil,'SeDebugPrivilege', tp.Privileges[0].Luid) then
+ Exit;
+ tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
+ tp.PrivilegeCount := 1;
+ Result := AdjustTokenPrivileges(hToken,false,tp,0,nil,rl) and (GetLastError=0);
+ finally
+ CloseHandle(hToken);
+ end
+end;
+
+// Завершение любых процессов в том числе системных.
+// Включение, приминение и отключения привилегии.
+// Для примера возьмем привилегию отладки приложений 'SeDebugPrivilege'
+// необходимую для завершения ЛЮБЫХ процессов в системе (завершение процесов
+// созданных текущим пользователем привилегия не нужна.
+// Название добавление/удаление привилгии немного неправильные. Привилегия или
+// есть в токене процесса или ее нет. Если привилегия есть, то она может быть в
+// двух состояниях - или включеная или отключеная. И в этом примере мы только
+// включаем или выключаем необходимую привилегию, а не добавляем ее.
+function ProcessTerminate(dwPID: Cardinal): Boolean;
+var
+ hToken:THandle;
+ SeDebugNameValue:Int64;
+ tkp:TOKEN_PRIVILEGES;
+ ReturnLength:Cardinal;
+ hProcess:THandle;
+begin
+ Result := False;
+ // Включаем привилегию SeDebugPrivilege
+ // Для начала получаем токен нашего процесса
+ if not OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken ) then
+ Exit;
+ // Получаем LUID привилегии
+ if not LookupPrivilegeValue(nil, 'SeDebugPrivilege', SeDebugNameValue) then
+ begin
+ CloseHandle(hToken);
+ Exit;
+ end;
+ tkp.PrivilegeCount := 1;
+ tkp.Privileges[0].Luid := SeDebugNameValue;
+ tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
+ // Добавляем привилегию к нашему процессу
+ AdjustTokenPrivileges(hToken, False, tkp, SizeOf(tkp), tkp, ReturnLength);
+ if GetLastError() <> ERROR_SUCCESS then
+ Exit;
+ // Завершаем процесс. Если у нас есть SeDebugPrivilege, то мы можем
+ // завершить и системный процесс
+ // Получаем дескриптор процесса для его завершения
+ hProcess := OpenProcess(PROCESS_TERMINATE, FALSE, dwPID);
+ if hProcess = 0 then
+ Exit;
+ // Завершаем процесс
+ if not TerminateProcess(hProcess, DWORD(-1)) then
+ Exit;
+ CloseHandle( hProcess );
+ // Отключаем привилегию
+ tkp.Privileges[0].Attributes := 0;
+ AdjustTokenPrivileges(hToken, FALSE, tkp, SizeOf(tkp), tkp, ReturnLength);
+ if GetLastError() <> ERROR_SUCCESS then
+ Exit;
+ Result := True;
+end;
+
+function StringToParts(sString: String; tdDelim: TDelim): TArrayOfString;
+var
+ iCounter,iBegin:Integer;
+begin
+ if length(sString)>0 then
+ begin
+ include(tdDelim, #0);
+ iBegin:=1;
+ SetLength(Result, 0);
+ for iCounter:=1 to Length(sString)+1 do
+ begin
+ if(sString[iCounter] in tdDelim) then
+ begin
+ SetLength(Result, Length(Result)+1);
+ Result[Length(Result)-1] := Copy(sString, iBegin, iCounter-iBegin);
+ iBegin := iCounter+1;
+ end;
+ end;
+ end;
+end;
+
+{ Edit1.Text := ExtractWord(ExtractWord('admin:login:password', ':', 3)); //'password' }
+function ExtractWord(const AString: string; const ADelimiter: Char; const ANumber: integer): string;
+var
+ i, j, k: integer;
+begin
+ i := 1;
+ k := 1;
+ while k <> ANumber do
+ begin
+ if AString[i] = ADelimiter then
+ begin
+ Inc(k);
+ end;
+ Inc(i);
+ end;
+ j := i + 1;
+ while (j <= Length(AString)) and (AString[j] <> ADelimiter) do
+ Inc(j);
+ Result := Copy(AString, i, j - i);
+end;
+
+{ Функция возвращает путь до пользовательской временной папки }
+function GetUserTempPath: WideString;
+var
+ UserPath: WideString;
+begin
+ Result := '';
+ SetLength(UserPath, MAX_PATH);
+ GetTempPath(MAX_PATH, PChar(UserPath));
+ GetLongPathName(PChar(UserPath), PChar(UserPath), MAX_PATH);
+ SetLength(UserPath, StrLen(PChar(UserPath)));
+ Result := UserPath;
+end;
+
+{
+DwMajorVersion:DWORD - старшая цифра версии Windows
+
+ Windows 95 - 4
+ Windows 98 - 4
+ Windows Me - 4
+ Windows NT 3.51 - 3
+ Windows NT 4.0 - 4
+ Windows 2000 - 5
+ Windows XP - 5
+
+DwMinorVersion: DWORD - младшая цифра версии
+
+ Windows 95 - 0
+ Windows 98 - 10
+ Windows Me - 90
+ Windows NT 3.51 - 51
+ Windows NT 4.0 - 0
+ Windows 2000 - 0
+ Windows XP - 1
+
+
+DwBuildNumber: DWORD
+ Win NT 4 - номер билда
+ Win 9x - старший байт - старшая и младшая цифры версии / младший - номер
+билда
+
+dwPlatformId: DWORD
+
+ VER_PLATFORM_WIN32s Win32s on Windows 3.1.
+ VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 9x
+ VER_PLATFORM_WIN32_NT Win32 on Windows NT, 2000
+
+
+SzCSDVersion:DWORD
+ NT - содержит PСhar с инфо о установленном ServicePack
+ 9x - доп. инфо, может и не быть
+}
+function DetectWinVersion: TWinVersion;
+var
+ OSVersionInfo : TOSVersionInfo;
+begin
+ Result := wvUnknown; // Неизвестная версия ОС
+ OSVersionInfo.dwOSVersionInfoSize := sizeof(TOSVersionInfo);
+ if GetVersionEx(OSVersionInfo)
+ then
+ begin
+ case OSVersionInfo.DwMajorVersion of
+ 3: Result := wvNT3; // Windows NT 3
+ 4: case OSVersionInfo.DwMinorVersion of
+ 0: if OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT
+ then Result := wvNT4 // Windows NT 4
+ else Result := wv95; // Windows 95
+ 10: Result := wv98; // Windows 98
+ 90: Result := wvME; // Windows ME
+ end;
+ 5: case OSVersionInfo.DwMinorVersion of
+ 0: Result := wvW2K; // Windows 2000
+ 1: Result := wvXP; // Windows XP
+ 2: Result := wv2003; // Windows 2003
+ 3: Result := wvVista; // Windows Vista
+ end;
+ 6: case OSVersionInfo.DwMinorVersion of
+ 0: Result := wv2008; // Windows 2008
+ 1: Result := wv7; // Windows 7
+ end;
+ 7: case OSVersionInfo.DwMinorVersion of
+ 1: Result := wv8; // Windows 8
+ end;
+ end;
+ end;
+end;
+
+function DetectWinVersionStr: String;
+const
+ VersStr : Array[TWinVersion] of String = (
+ 'Unknown OS',
+ 'Windows 95',
+ 'Windows 98',
+ 'Windows ME',
+ 'Windows NT 3',
+ 'Windows NT 4',
+ 'Windows 2000',
+ 'Windows XP',
+ 'Windows Server 2003',
+ 'Windows Vista',
+ 'Windows 7',
+ 'Windows Server 2008',
+ 'Windows 8');
+begin
+ Result := VersStr[DetectWinVersion];
+end;
+
+begin
+end.
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dpr b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dpr
new file mode 100644
index 0000000000..62b3039fd9
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dpr
@@ -0,0 +1,32 @@
+{ ################################################################################ }
+{ # # }
+{ # Обновление и установка набора программ IM-History - HistoryToDBUpdater v1.0 # }
+{ # # }
+{ # License: GPLv3 # }
+{ # # }
+{ # Author: Grigorev Michael (icq: 161867489, email: sleuthhound@gmail.com) # }
+{ # # }
+{ ################################################################################ }
+
+program HistoryToDBUpdater;
+
+uses
+ madExcept,
+ madLinkDisAsm,
+ madListHardware,
+ madListProcesses,
+ madListModules,
+ Forms,
+ Main in 'Main.pas' {MainForm},
+ Global in 'Global.pas';
+
+{$R *.res}
+
+begin
+ Application.Initialize;
+ Application.MainFormOnTaskbar := True;
+ Application.Title := 'HistoryToDBUpdater';
+ Application.CreateForm(TMainForm, MainForm);
+ if MainForm.RunAppDone then
+ Application.Run;
+end.
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dproj b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dproj
new file mode 100644
index 0000000000..72aa3a5ce1
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.dproj
@@ -0,0 +1,197 @@
+п»ї<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{939BF92A-9B69-4A14-B992-518631C54279}</ProjectGuid>
+ <MainSource>HistoryToDBUpdater.dpr</MainSource>
+ <Base>True</Base>
+ <Config Condition="'$(Config)'==''">Release</Config>
+ <TargetedPlatforms>3</TargetedPlatforms>
+ <AppType>Application</AppType>
+ <FrameworkType>VCL</FrameworkType>
+ <ProjectVersion>14.4</ProjectVersion>
+ <Platform Condition="'$(Platform)'==''">Win32</Platform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
+ <Base_Win32>true</Base_Win32>
+ <CfgParent>Base</CfgParent>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
+ <Base_Win64>true</Base_Win64>
+ <CfgParent>Base</CfgParent>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
+ <Cfg_1>true</Cfg_1>
+ <CfgParent>Base</CfgParent>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
+ <Cfg_1_Win32>true</Cfg_1_Win32>
+ <CfgParent>Cfg_1</CfgParent>
+ <Cfg_1>true</Cfg_1>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
+ <Cfg_1_Win64>true</Cfg_1_Win64>
+ <CfgParent>Cfg_1</CfgParent>
+ <Cfg_1>true</Cfg_1>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
+ <Cfg_2>true</Cfg_2>
+ <CfgParent>Base</CfgParent>
+ <Base>true</Base>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Base)'!=''">
+ <DCC_S>false</DCC_S>
+ <DCC_K>false</DCC_K>
+ <VerInfo_Locale>1049</VerInfo_Locale>
+ <DCC_N>false</DCC_N>
+ <DCC_ImageBase>00400000</DCC_ImageBase>
+ <DCC_E>false</DCC_E>
+ <DCC_F>false</DCC_F>
+ <DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
+ <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleDisplayName=;CFBundleIdentifier=;CFBundleVersion=;CFBundlePackageType=;CFBundleSignature=;CFBundleAllowMixedLocalizations=;CFBundleExecutable=</VerInfo_Keys>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Base_Win32)'!=''">
+ <DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
+ <VerInfo_Locale>1033</VerInfo_Locale>
+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+ <Icon_MainIcon>HistoryToDBUpdater_Icon1.ico</Icon_MainIcon>
+ <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+ <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Base_Win64)'!=''">
+ <DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
+ <VerInfo_Locale>1033</VerInfo_Locale>
+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+ <Icon_MainIcon>HistoryToDBUpdater_Icon1.ico</Icon_MainIcon>
+ <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+ <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_1)'!=''">
+ <DCC_DebugInformation>false</DCC_DebugInformation>
+ <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
+ <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
+ <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
+ <VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
+ <DCC_DebugInformation>true</DCC_DebugInformation>
+ <DCC_Define>madExcept;$(DCC_Define)</DCC_Define>
+ <DCC_LocalDebugSymbols>true</DCC_LocalDebugSymbols>
+ <DCC_MapFile>3</DCC_MapFile>
+ <Icon_MainIcon>HistoryToDBUpdater_Icon.ico</Icon_MainIcon>
+ <DCC_BplOutput>..\..\..\bin10\Release\Plugins\</DCC_BplOutput>
+ <DCC_ExeOutput>..\..\..\bin10\Release\Plugins\</DCC_ExeOutput>
+ <DCC_DcpOutput>..\..\..\bin10\Release\Obj\hpp\</DCC_DcpOutput>
+ <DCC_DcuOutput>..\..\..\bin10\Release\Obj\hpp\</DCC_DcuOutput>
+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+ <VerInfo_Locale>1033</VerInfo_Locale>
+ <VerInfo_MinorVer>5</VerInfo_MinorVer>
+ <VerInfo_Keys>CompanyName=http://www.im-history.ru;FileDescription=HistoryToDBUpdater;FileVersion=2.5.0.0;InternalName=HistoryToDBUpdater;LegalCopyright=Michael Grigorev;LegalTrademarks=http://www.im-history.ru;OriginalFilename=HistoryToDBUpdater.exe;ProductName=HistoryToDBUpdater;ProductVersion=1.0.0.0;Comments=http://www.im-history.ru</VerInfo_Keys>
+ <VerInfo_MajorVer>2</VerInfo_MajorVer>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
+ <VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
+ <VerInfo_MajorVer>2</VerInfo_MajorVer>
+ <DCC_Define>madExcept;$(DCC_Define)</DCC_Define>
+ <DCC_DebugInformation>true</DCC_DebugInformation>
+ <VerInfo_MinorVer>5</VerInfo_MinorVer>
+ <DCC_LocalDebugSymbols>true</DCC_LocalDebugSymbols>
+ <Icon_MainIcon>HistoryToDBUpdater_Icon.ico</Icon_MainIcon>
+ <DCC_MapFile>3</DCC_MapFile>
+ <DCC_ExeOutput>..\..\..\bin10\Release64\Plugins\</DCC_ExeOutput>
+ <DCC_BplOutput>..\..\..\bin10\Release64\Plugins\</DCC_BplOutput>
+ <VerInfo_Locale>1033</VerInfo_Locale>
+ <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
+ <DCC_DcpOutput>..\..\..\bin10\Release64\Obj\hpp\</DCC_DcpOutput>
+ <VerInfo_Keys>CompanyName=http://www.im-history.ru;FileDescription=HistoryToDBUpdater;FileVersion=2.5.0.0;InternalName=HistoryToDBUpdater;LegalCopyright=Michael Grigorev;LegalTrademarks=http://www.im-history.ru;OriginalFilename=HistoryToDBUpdater.exe;ProductName=HistoryToDBUpdater;ProductVersion=1.0.0.0;Comments=http://www.im-history.ru</VerInfo_Keys>
+ <DCC_DcuOutput>..\..\..\bin10\Release64\Obj\hpp\</DCC_DcuOutput>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Cfg_2)'!=''">
+ <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
+ <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
+ <DCC_Optimize>false</DCC_Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <DelphiCompile Include="$(MainSource)">
+ <MainSource>MainSource</MainSource>
+ </DelphiCompile>
+ <DCCReference Include="Main.pas">
+ <Form>MainForm</Form>
+ </DCCReference>
+ <DCCReference Include="Global.pas"/>
+ <BuildConfiguration Include="Debug">
+ <Key>Cfg_2</Key>
+ <CfgParent>Base</CfgParent>
+ </BuildConfiguration>
+ <BuildConfiguration Include="Base">
+ <Key>Base</Key>
+ </BuildConfiguration>
+ <BuildConfiguration Include="Release">
+ <Key>Cfg_1</Key>
+ <CfgParent>Base</CfgParent>
+ </BuildConfiguration>
+ </ItemGroup>
+ <ProjectExtensions>
+ <Borland.Personality>Delphi.Personality.12</Borland.Personality>
+ <Borland.ProjectType/>
+ <BorlandProject>
+ <Delphi.Personality>
+ <Source>
+ <Source Name="MainSource">HistoryToDBUpdater.dpr</Source>
+ </Source>
+ <VersionInfo>
+ <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
+ <VersionInfo Name="MajorVer">1</VersionInfo>
+ <VersionInfo Name="MinorVer">0</VersionInfo>
+ <VersionInfo Name="Release">0</VersionInfo>
+ <VersionInfo Name="Build">0</VersionInfo>
+ <VersionInfo Name="Debug">False</VersionInfo>
+ <VersionInfo Name="PreRelease">False</VersionInfo>
+ <VersionInfo Name="Special">False</VersionInfo>
+ <VersionInfo Name="Private">False</VersionInfo>
+ <VersionInfo Name="DLL">False</VersionInfo>
+ <VersionInfo Name="Locale">1049</VersionInfo>
+ <VersionInfo Name="CodePage">1251</VersionInfo>
+ </VersionInfo>
+ <VersionInfoKeys>
+ <VersionInfoKeys Name="CompanyName"/>
+ <VersionInfoKeys Name="FileDescription"/>
+ <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="InternalName"/>
+ <VersionInfoKeys Name="LegalCopyright"/>
+ <VersionInfoKeys Name="LegalTrademarks"/>
+ <VersionInfoKeys Name="OriginalFilename"/>
+ <VersionInfoKeys Name="ProductName"/>
+ <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="Comments"/>
+ <VersionInfoKeys Name="CFBundleName"/>
+ <VersionInfoKeys Name="CFBundleDisplayName"/>
+ <VersionInfoKeys Name="CFBundleIdentifier"/>
+ <VersionInfoKeys Name="CFBundleVersion"/>
+ <VersionInfoKeys Name="CFBundlePackageType"/>
+ <VersionInfoKeys Name="CFBundleSignature"/>
+ <VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
+ <VersionInfoKeys Name="CFBundleExecutable"/>
+ </VersionInfoKeys>
+ <Excluded_Packages>
+ <Excluded_Packages Name="$(BDSBIN)\dcloffice2k170.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
+ <Excluded_Packages Name="$(BDSBIN)\dclofficexp170.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
+ </Excluded_Packages>
+ </Delphi.Personality>
+ <Platforms>
+ <Platform value="Win32">True</Platform>
+ <Platform value="Win64">True</Platform>
+ </Platforms>
+ </BorlandProject>
+ <ProjectFileVersion>12</ProjectFileVersion>
+ </ProjectExtensions>
+ <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
+ <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
+</Project>
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.manifest b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.manifest
new file mode 100644
index 0000000000..812068c2ab
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.manifest
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ name="Microsoft.Windows.Shell.explorer"
+ processorArchitecture="x86"
+ version="5.1.0.0"
+ type="win32"/>
+<description>HistoryToDBUpdater</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="x86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.mes b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.mes
new file mode 100644
index 0000000000..1fcb334c1d
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.mes
@@ -0,0 +1,163 @@
+[GeneralSettings]
+MesVersion=4
+HandleExceptions=1
+LinkInCode=1
+AppendMapFileToBinary=1
+NoOwnMadExceptSettings=0
+CheckFileCrc=1
+CheckForFrozenMainThread=0
+FreezeTimeout=60000
+ReportLeaks=0
+WindowsLogo=0
+CrashOnBuffer=0
+CrashOnUnderrun=0
+AutomaticallySaveBugReport=1
+AutoSaveBugReportIfNotSent=1
+AutomaticallyMailBugReport=0
+AutoMailProgressBox=0
+CopyBugReportToClipboard=0
+SuspendAllRunningThreads=0
+ShowPleaseWaitBox=1
+PleaseWaitIcon=plwait1
+AutomaticallyContinueApplication=0
+AutomaticallyRestartApplication=0
+AutomaticallyCloseApplication=0
+SendInBackground=1
+SendHelper=196608
+Send32Icon=send321
+UploadViaHttp=0
+HttpServer=
+HttpSsl=0
+HttpPort=0
+HttpAccount=
+HttpPassword=
+UploadToFogBugz=0
+UploadToBugZilla=0
+UploadToMantis=0
+BugTrackerAccount=
+BugTrackerPassword=
+BugTrackerProject=
+BugTrackerArea=
+BugTrackerAssignTo=
+MailAsSmtpServer=0
+MailAsSmtpClient=0
+SmtpServer=
+SmtpSsl=0
+SmtpTls=0
+SmtpPort=0
+SmtpAccount=
+SmtpPassword=
+MailViaMapi=1
+MailViaMailto=1
+MailAddress=sleuthhound@gmail.com
+BugReportFile=bugreport.txt
+AttachBugReport=1
+AttachBugReportFile=1
+DeleteBugReportFile=1
+BugReportSendAs=bugreport.txt
+BugReportZip=
+ScreenShotDepth=8
+ScreenShotAppOnly=0
+ScreenShotSendAs=screenshot.png
+ScreenShotZip=
+AdditionalAttachments=
+AppendBugReports=1
+BugReportFileSize=100000
+DontSaveDuplicateExceptions=1
+DontSaveDuplicateFreezings=1
+DuplicateExceptionDefinition=1
+DuplicateFreezeDefinition=2
+ShowExceptionBox=1
+OkBtnText=&OK
+DetailsBtnText=&Details
+PleaseWaitTitle=Information
+PleaseWaitText=Please wait a moment...
+BugTrackerTitle=%25appname%25, %25exceptMsg%25
+BugTrackerDescr=error details: %0d%0a%25errorDetails%25
+MailSubject=bug report
+MailBody=please find the bug report attached
+SendBoxTitle=Sending bug report...
+PrepareAttachMsg=Preparing attachments...
+MxLookupMsg=Searching for mail server...
+ConnectMsg=Connecting to server...
+SendMailMsg=Sending mail...
+FieldsMsg=Setting fields...
+SendAttachMsg=Sending attachments...
+SendFinalizeMsg=Finalizing...
+MailFailureMsg=Sorry, sending the bug report didn't work.
+VersionVariable=
+[ExceptionBox]
+ShowButtonMailBugReport=1
+ShowButtonSaveBugReport=0
+ShowButtonPrintBugReport=0
+ShowButtonShowBugReport=1
+ShowButtonContinueApplication=1
+ShowButtonRestartApplication=1
+ShowButtonCloseApplication=1
+IconButtonSendBugReport=send1
+IconButtonSaveBugReport=save1
+IconButtonPrintBugReport=print1
+IconButtonShowBugReport=show1
+IconButtonContinueApplication=continue1
+IconButtonCantContinueApplication=cantContinue1
+IconButtonRestartApplication=restart1
+IconButtonCloseApplication=close1
+FocusedButton=0
+SendAssistant=SendAssistant
+SaveAssistant=SaveAssistant
+PrintAssistant=PrintAssistant
+AutomaticallyShowBugReport=0
+NoOwnerDrawButtons=0
+BigExceptionIcon=big1
+TitleBar=%25appname%25
+ExceptionMessage=An error occurred in the application.
+FrozenMessage=The application seems to be frozen.
+BitFaultMsg=The file "%25modname%25" seems to be corrupt!
+MailBugReportText=send bug report
+SaveBugReportText=save bug report
+PrintBugReportText=print bug report
+ShowBugReportText=show bug report
+ContinueApplicationText=continue application
+RestartApplicationText=restart application
+CloseApplicationText=close application
+[BugReport]
+ListThreads=1
+ListModules=1
+ListHardware=1
+ShowCpuRegisters=1
+ShowStackDump=1
+Disassembly=1
+HideUglyItems=0
+ShowRelativeAddrs=1
+ShowRelativeLines=1
+FormatDisassembly=0
+LimitDisassembly=5
+EnabledPlugins=modules|processes|hardware
+[Filters]
+Filter1ExceptionClasses=EDBEditError
+Filter1DontCreateBugReport=1
+Filter1DontCreateScreenshot=1
+Filter1DontSuspendThreads=1
+Filter1DontCallHandlers=1
+Filter1ShowBox=3
+Filter1Assis=
+Filter2ExceptionClasses=
+Filter2DontCreateBugReport=0
+Filter2DontCreateScreenshot=0
+Filter2DontSuspendThreads=0
+Filter2DontCallHandlers=0
+Filter2ShowBox=0
+Filter2Assis=
+GeneralDontCreateBugReport=0
+GeneralDontCreateScreenshot=0
+GeneralDontSuspendThreads=0
+GeneralDontCallHandlers=0
+GeneralShowBox=0
+GeneralAssis=
+[Assistants]
+Assistant1=SendAssistant|Send Assistant|ContactForm|DetailsForm|ScrShotForm
+Assistant2=SaveAssistant|Save Assistant|ContactForm|DetailsForm
+Assistant3=PrintAssistant|Print Assistant|ContactForm|DetailsForm
+Forms1=TPF0%0eTMEContactForm%0bContactForm%07Message%0c%13%00%00%00Contact Information%08MinWidth%04%00%00%00%00%08OnAction%0c%1b%00%00%00madExcept.HandleContactForm%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c%0a%00%00%00your name:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%08NameEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%09%0aOutputName%0c%0c%00%00%00contact name%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%08INVLabel%06Label2%07Caption%0c%0b%00%00%00your email:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%09EmailEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00contact email%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%0bINVCheckBox%08MemCheck%07Caption%0c%0b%00%00%00remember me%07Checked%08%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%00
+Forms2=TPF0%0eTMEDetailsForm%0bDetailsForm%07Message%0c%0d%00%00%00Error Details%08MinWidth%04%00%00%00%00%08OnAction%0c%00%00%00%00%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c'%00%00%00in which situation did the error occur?%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%0bDetailsMemo%07Colored%09%07Enabled%09%05Lines%04%09%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00error details%0aOutputType%07%0dnvoOwnSection%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%00
+Forms3=TPF0%0eTMEScrShotForm%0bScrShotForm%0dActiveControl%07%0bContinueBtn%07Message%0c%18%00%00%00Screenshot Configuration%08MinWidth%04%00%00%00%00%08OnAction%0c%1e%00%00%00madExcept.HandleScreenshotForm%05Timer%04%fa%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%0bINVCheckBox%0bAttachCheck%07Caption%0c%25%00%00%00attach a screenshot to the bug report%07Checked%09%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%08INVImage%0aScrShotImg%06Border%09%09Clickable%09%07Enabled%09%04File%0c%00%00%00%00%06Height%04%00%00%00%00%07Spacing%04%00%00%00%00%05Width%04%00%00%00%00%00%00%08INVLabel%06Label1%07Caption%0c%15%00%00%00(click to edit image)%07Enabled%09%07Spacing%04%00%00%00%00%00%00%00
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.otares b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.otares
new file mode 100644
index 0000000000..93e7e944f2
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.otares
Binary files differ
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.res b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.res
new file mode 100644
index 0000000000..f283649744
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater.res
Binary files differ
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater_Icon.ico b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater_Icon.ico
new file mode 100644
index 0000000000..244fcd4ddd
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/HistoryToDBUpdater_Icon.ico
Binary files differ
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.dfm b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.dfm
new file mode 100644
index 0000000000..623f7ef672
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.dfm
@@ -0,0 +1,530 @@
+object MainForm: TMainForm
+ Left = 0
+ Top = 0
+ BorderIcons = [biSystemMenu, biMinimize]
+ Caption = 'HistoryToDBUpdater'
+ ClientHeight = 357
+ ClientWidth = 486
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ Icon.Data = {
+ 0000010001001010000001000000680400001600000028000000100000002000
+ 0000010020000000000000040000000000000000000000000000000000000000
+ 0000000000000000000000000000FF1F2A000000000000000000000000000000
+ 00000000000000000000FF1F2A00000000000000000000000000000000000000
+ 000000000000D0CDC500FF1F2A00FEEFA900FF1F2A00CDCDCD00CDCDCD00CDCD
+ CD00CDCDCD00FF1F2A00FEEFA900FF1F2A000000000000000000000000000000
+ 0000D0CDC500FF1F2A00FEEFA900FFE55F00FF1F2A00FF1F2A00FF1F2A00FF1F
+ 2A00FF1F2A00FF1F2A00FFE55F00FEEFA900FF1F2A00D0CDC500000000000000
+ 0000FF1F2A00FEEFA900FFE55F00FFE55F00FFE55F00FFD35000FECF4D00FFCC
+ 4A00FFD35000FFE55F00FFE55F00FFE55F00FEEFA900FF1F2A0000000000FF1F
+ 2A00FEEFA900FFE55F00FFE55F00FFE55F00FFE55F00FFD35000FFCA4800FFCC
+ 4A00FFD35000FFE55F00FFE55F00FFE55F00FFE55F00FF1F2A00FF1F2A000000
+ 0000FF1F2A00FEEFA900FFE55F00FFE55F00FFE55F00FFD35000FFCA4800FFCC
+ 4A00FFD35000FFE55F00FFE55F00FFE55F00FEEFA900FF1F2A00000000000000
+ 0000C1BDB600FF1F2A00FEEFA900FFE55F00FF1F2A00FF1F2A00FF1F2A00FF1F
+ 2A00FF1F2A00FF1F2A00FFE55F00FEEFA900FF1F2A00CFC7BF00000000000000
+ 0000C1BDB600F9F3ED00FF1F2A00FEEFA900FF1F2A00D2D2D200D2D2D200D2D2
+ D200D2D2D200FF1F2A00FEEFA900FF1F2A00BAB7AF00CFC7BF00000000000000
+ 0000BAB7AF00A39A8F00BAB2A700FF1F2A00D2D2D200D2D2D200D2D2D200D2D2
+ D200D2D2D200D2D2D200FF1F2A00CFC7BF00A39A8F00BAB7AF00000000000000
+ 0000B1AB9F00C9C2B900CFC7BF00D5CCC400DCD3CA00E4D9D200E8DDD500E4D6
+ CF00E4D6CF00E4D6CF00D5CCC400CFC7BF00C9C2B900B1AB9F00000000000000
+ 0000B0AB9E00C7C0B600CCC4BB00D3C9C100DAD0C700E1D7CF00EBE1DA00E4D9
+ D100E4D9D100DDD2CA00DBCDC500DDCAC400DBC4BF00C1ADA400000000000000
+ 0000AFAA9D00C8C1B700E8E3DB00F5F0E800FDF8F200FCF8F100FBF7F000FCF7
+ F100FCF7F100FDF8F200F7F0EA00ECE3DC00CDC3BB00B2AA9E00000000000000
+ 0000AEA89C00FBF5EF00EEE7DE00E0D8CE00DDD5CC00DDD4CB00DDD4CB00DDD4
+ CB00DDD4CB00DDD5CC00E0D7CE00EDE6DE00FBF6EF00AEA89C00000000000000
+ 0000AFA99D00E1D8CE00E1D7CE00DFD6CC00DFD5CB00DFD5CB00DFD5CB00DFD5
+ CB00DFD5CB00DFD5CB00DFD6CC00E1D7CE00E1D8CE00AFA99D00000000000000
+ 000000000000B6B0A400D6CFC400E6DED500EFE7DD00EEE6DC00EEE6DC00EEE6
+ DC00EEE6DC00EFE7DD00E6DED500D6CFC400B6B0A40000000000000000000000
+ 00000000000000000000C4C0B700AEA99C00AEA89C00AEA89C00AEA89C00AEA8
+ 9C00AEA89C00AEA89C00AEA99C00C4C0B700000000000000000000000000F7EF
+ FFFFC007FFFF8001FFFF8001FFFF0000FFFF8001FFFF8001FFFF8001FFFF8001
+ FFFF8001FFFF8001FFFF8001FFFF8001FFFF8001FFFFC003FFFFE007FFFF}
+ OldCreateOrder = False
+ Position = poScreenCenter
+ OnClose = FormClose
+ OnCreate = FormCreate
+ OnDestroy = FormDestroy
+ OnShow = FormShow
+ DesignSize = (
+ 486
+ 357)
+ PixelsPerInch = 96
+ TextHeight = 13
+ object GBUpdater: TGroupBox
+ Left = 8
+ Top = 8
+ Width = 472
+ Height = 145
+ Anchors = [akLeft, akTop, akRight]
+ Caption = ' '#1054#1073#1085#1086#1074#1083#1077#1085#1080#1077' '
+ TabOrder = 0
+ DesignSize = (
+ 472
+ 145)
+ object LAmountDesc: TLabel
+ Left = 16
+ Top = 56
+ Width = 37
+ Height = 13
+ Caption = #1054#1073#1098#1077#1084':'
+ end
+ object LAmount: TLabel
+ Left = 59
+ Top = 56
+ Width = 30
+ Height = 13
+ Caption = '10000'
+ end
+ object LSpeedDesc: TLabel
+ Left = 16
+ Top = 75
+ Width = 52
+ Height = 13
+ Caption = #1057#1082#1086#1088#1086#1089#1090#1100':'
+ end
+ object LSpeed: TLabel
+ Left = 74
+ Top = 75
+ Width = 49
+ Height = 13
+ Caption = '1000 '#1050#1073'/c'
+ end
+ object LFileDesc: TLabel
+ Left = 210
+ Top = 75
+ Width = 53
+ Height = 13
+ Caption = #1054#1087#1080#1089#1072#1085#1080#1077':'
+ end
+ object LFileDescription: TLabel
+ Left = 269
+ Top = 75
+ Width = 62
+ Height = 13
+ Caption = #1053#1077' '#1080#1079#1074#1077#1089#1090#1085#1086
+ end
+ object LFileMD5Desc: TLabel
+ Left = 210
+ Top = 94
+ Width = 25
+ Height = 13
+ Caption = 'MD5:'
+ end
+ object LFileMD5: TLabel
+ Left = 241
+ Top = 94
+ Width = 62
+ Height = 13
+ Caption = #1053#1077' '#1080#1079#1074#1077#1089#1090#1085#1086
+ end
+ object LFileNameDesc: TLabel
+ Left = 210
+ Top = 56
+ Width = 58
+ Height = 13
+ Caption = #1048#1084#1103' '#1092#1072#1081#1083#1072':'
+ end
+ object LFileName: TLabel
+ Left = 274
+ Top = 56
+ Width = 62
+ Height = 13
+ Caption = #1053#1077' '#1080#1079#1074#1077#1089#1090#1085#1086
+ end
+ object LStatus: TLabel
+ Left = 17
+ Top = 21
+ Width = 322
+ Height = 13
+ Hint = 'UpdateStatus'
+ Caption = #1053#1072#1078#1084#1080#1090#1077' '#1082#1085#1086#1087#1082#1091' "'#1054#1073#1085#1086#1074#1080#1090#1100'" '#1076#1083#1103' '#1085#1072#1095#1072#1083#1072' '#1087#1088#1086#1094#1077#1089#1089#1072' '#1086#1073#1085#1086#1074#1083#1077#1085#1080#1103'.'
+ end
+ object ProgressBarDownloads: TProgressBar
+ Left = 16
+ Top = 40
+ Width = 444
+ Height = 10
+ Anchors = [akLeft, akTop, akRight]
+ TabOrder = 0
+ end
+ object ButtonSettings: TButton
+ Left = 114
+ Top = 109
+ Width = 90
+ Height = 25
+ Caption = #1053#1072#1089#1090#1088#1086#1081#1082#1080
+ ImageIndex = 1
+ Images = ImageList_Main
+ TabOrder = 2
+ OnClick = ButtonSettingsClick
+ end
+ object ButtonUpdate: TButton
+ Left = 16
+ Top = 109
+ Width = 95
+ Height = 25
+ Hint = 'UpdateButton'
+ Caption = #1054#1073#1085#1086#1074#1080#1090#1100
+ ImageIndex = 0
+ Images = ImageList_Main
+ TabOrder = 1
+ OnClick = ButtonUpdateStartClick
+ end
+ end
+ object SettingsPageControl: TPageControl
+ Left = 8
+ Top = 159
+ Width = 472
+ Height = 193
+ ActivePage = TabSheetSettings
+ Anchors = [akLeft, akTop, akRight]
+ TabOrder = 1
+ object TabSheetSettings: TTabSheet
+ Caption = #1054#1073#1097#1080#1077' '#1085#1072#1089#1090#1088#1086#1081#1082#1080
+ ImageIndex = 2
+ DesignSize = (
+ 464
+ 165)
+ object GBSettings: TGroupBox
+ Left = 3
+ Top = 0
+ Width = 458
+ Height = 161
+ Anchors = [akLeft, akTop, akRight]
+ Caption = ' '#1054#1073#1097#1080#1077' '#1085#1072#1089#1090#1088#1086#1081#1082#1080
+ TabOrder = 0
+ object LLanguage: TLabel
+ Left = 16
+ Top = 81
+ Width = 88
+ Height = 13
+ Caption = #1071#1079#1099#1082' '#1087#1088#1086#1075#1088#1072#1084#1084#1099':'
+ end
+ object LIMClientType: TLabel
+ Left = 16
+ Top = 27
+ Width = 56
+ Height = 13
+ Caption = 'IM-'#1082#1083#1080#1077#1085#1090':'
+ end
+ object LDBType: TLabel
+ Left = 16
+ Top = 54
+ Width = 39
+ Height = 13
+ Caption = #1058#1080#1087' '#1041#1044':'
+ end
+ object LPlatformType: TLabel
+ Left = 261
+ Top = 27
+ Width = 18
+ Height = 13
+ Caption = 'x86'
+ end
+ object CBLang: TComboBox
+ Left = 110
+ Top = 78
+ Width = 145
+ Height = 21
+ Style = csDropDownList
+ TabOrder = 2
+ OnChange = CBLangChange
+ end
+ object CBIMClientType: TComboBox
+ Left = 110
+ Top = 24
+ Width = 145
+ Height = 21
+ Style = csDropDownList
+ TabOrder = 0
+ OnChange = CBIMClientTypeChange
+ end
+ object CBDBType: TComboBox
+ Left = 110
+ Top = 51
+ Width = 145
+ Height = 21
+ Style = csDropDownList
+ TabOrder = 1
+ OnChange = CBDBTypeChange
+ end
+ end
+ end
+ object TabSheetConnectSettings: TTabSheet
+ Caption = #1053#1072#1089#1090#1088#1086#1081#1082#1080' '#1089#1086#1077#1076#1080#1085#1077#1085#1080#1103
+ DesignSize = (
+ 464
+ 165)
+ object GBConnectSettings: TGroupBox
+ Left = 3
+ Top = 0
+ Width = 458
+ Height = 161
+ Anchors = [akLeft, akTop, akRight]
+ Caption = ' '#1053#1072#1089#1090#1088#1086#1081#1082#1080' '#1089#1086#1077#1076#1080#1085#1077#1085#1080#1103' '
+ TabOrder = 0
+ object LProxyAddress: TLabel
+ Left = 16
+ Top = 47
+ Width = 118
+ Height = 13
+ Caption = #1040#1076#1088#1077#1089' '#1087#1088#1086#1082#1089#1080'-'#1089#1077#1088#1074#1077#1088#1072':'
+ end
+ object LProxyPort: TLabel
+ Left = 267
+ Top = 48
+ Width = 29
+ Height = 13
+ Caption = #1055#1086#1088#1090':'
+ end
+ object LProxyUser: TLabel
+ Left = 16
+ Top = 98
+ Width = 76
+ Height = 13
+ Caption = #1055#1086#1083#1100#1079#1086#1074#1072#1090#1077#1083#1100':'
+ end
+ object LProxyUserPasswd: TLabel
+ Left = 16
+ Top = 125
+ Width = 41
+ Height = 13
+ Caption = #1055#1072#1088#1086#1083#1100':'
+ end
+ object CBUseProxy: TCheckBox
+ Left = 16
+ Top = 24
+ Width = 193
+ Height = 17
+ Caption = #1048#1089#1087#1086#1083#1100#1079#1086#1074#1072#1090#1100' '#1089#1074#1086#1081' '#1087#1088#1086#1082#1089#1080'-'#1089#1077#1088#1074#1077#1088
+ TabOrder = 0
+ OnClick = CBUseProxyClick
+ end
+ object EProxyAddress: TEdit
+ Left = 140
+ Top = 44
+ Width = 121
+ Height = 21
+ TabOrder = 1
+ Text = '127.0.0.1'
+ end
+ object EProxyPort: TEdit
+ Left = 302
+ Top = 44
+ Width = 73
+ Height = 21
+ MaxLength = 5
+ NumbersOnly = True
+ TabOrder = 2
+ Text = '3128'
+ end
+ object EProxyUser: TEdit
+ Left = 98
+ Top = 95
+ Width = 163
+ Height = 21
+ TabOrder = 4
+ end
+ object CBProxyAuth: TCheckBox
+ Left = 16
+ Top = 71
+ Width = 233
+ Height = 17
+ Caption = #1055#1088#1086#1082#1089#1080'-'#1089#1077#1088#1074#1077#1088' '#1090#1088#1077#1073#1091#1077#1090' '#1072#1074#1090#1086#1088#1080#1079#1072#1094#1080#1102
+ TabOrder = 3
+ OnClick = CBProxyAuthClick
+ end
+ object EProxyUserPasswd: TEdit
+ Left = 98
+ Top = 122
+ Width = 163
+ Height = 21
+ PasswordChar = '*'
+ TabOrder = 5
+ end
+ end
+ end
+ object TabSheetLog: TTabSheet
+ Caption = #1051#1086#1075#1080
+ ImageIndex = 1
+ DesignSize = (
+ 464
+ 165)
+ object LogMemo: TMemo
+ Left = 3
+ Top = 3
+ Width = 458
+ Height = 159
+ Anchors = [akLeft, akTop, akRight, akBottom]
+ ReadOnly = True
+ ScrollBars = ssVertical
+ TabOrder = 0
+ end
+ end
+ end
+ object IMDownloader1: TIMDownloader
+ OnError = IMDownloader1Error
+ OnAccepted = IMDownloader1Accepted
+ OnHeaders = IMDownloader1Headers
+ OnMD5Checked = IMDownloader1MD5Checked
+ OnDownloading = IMDownloader1Downloading
+ OnStartDownload = IMDownloader1StartDownload
+ OnBreak = IMDownloader1Break
+ Left = 384
+ Top = 112
+ end
+ object ImageList_Main: TImageList
+ ColorDepth = cd32Bit
+ DrawingStyle = dsTransparent
+ Left = 384
+ Top = 64
+ Bitmap = {
+ 494C010102000400300210001000FFFFFFFF2110FFFFFFFFFFFFFFFF424D3600
+ 0000000000003600000028000000400000001000000001002000000000000010
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000112A1251235A26B72A6E2DE42C732EF52C732EF5286C2CE6027920FA0279
+ 1CFF000200040000000000000000000000000000000000000000000000000000
+ 0000000000000000000029292963414141BF3C3C3CBF1F1F1F63000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 00000000000000000000000000000000000000000000000000000207030D2A65
+ 2EB637873CFB9AC49CFFB2C19CFFBCC09BFFBDC29CFFAFD2B0FF0A8732FF41A0
+ 5DFF06731FF2030C051C00000000000000000000000000000000000000001111
+ 11290505050E01010102767676EABDBDBDFFB2B2B2FF545454EA010101020404
+ 040E0C0C0C290000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000000000000308030D397E3ED16EB6
+ 85FFADE8C7FFBFD29FFF20964FFF1A9047FF148E41FF0F8A39FF389E5CFF7EC0
+ 95FF44A260FF06781FF8030D051E0000000000000000000000004E4E4E9B6D6D
+ 6DFD5A5A5AE70B0B0B19777777E7CBCBCBFFC7C7C7FF585858E7080808194F4F
+ 4FE74D4D4DFD2B2B2B9B00000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000034743BB174BF8CFF98D7
+ B2FF77BF7EFFBBC17CFF279A59FF8FCAA8FF8CC8A4FF89C5A0FF87C49DFF68B5
+ 84FF81C196FF46A464FF057620F500030009000000004F4F4F7BBCBCBCFFDEDE
+ DEFFA6A6A6FF7D7D7DF4848484FEC4C4C4FFC2C2C2FF6C6C6CFE686868F4A6A6
+ A6FFD2D2D2FF808080FF2727277B000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000001631194650AB5AFBB4EAD3FF67BB
+ 72FF6CBC6FFFBDB56BFF2F9E61FF93CDACFF6DB98DFF69B788FF64B584FF5FB2
+ 7EFF65B481FF82C197FF3A9F5AFF007B23FB000000005353537DA5A5A5FED5D5
+ D5FFC5C5C5FFCBCBCBFFD1D1D1FFC9C9C9FFC7C7C7FFCCCCCCFFC5C5C5FFBDBD
+ BDFFCBCBCBFF6D6D6DFE3131317D000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000003D8146B291D7AEFF9FDEB3FF83C5
+ 6EFFA7D07EFFC4A45AFF35A269FF95CEAFFF93CDACFF90CBA9FF8FCBA7FF72BB
+ 8FFF89C7A0FF44A466FF088735FF215A24BF00000000000000005A5A5A85C5C5
+ C5FFC1C1C1FFC5C5C5FFC7C7C7FFAAAAAAFFA7A7A7FFC1C1C1FFBEBEBEFFB5B5
+ B5FFAAAAAAFF3636368500000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 00000000000000000000000000000000000052AA5DE4AFE9CFFF82D48FFFBEDC
+ 89FFC2CB81FFCCA154FF3BA46DFF38A26BFF33A065FF2F9C5FFF53AE7AFF90CB
+ A9FF4DAA72FF168E44FFA0D8BBFF296D2CE8838383CD7F7F7FE3959595EECFCF
+ CFFFC6C6C6FFCCCCCCFF7A7A7AC629292944272727446F6F6FC6C1C1C1FFBCBC
+ BCFFB9B9B9FF5C5C5CEE4E4E4EE3424242CD0000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000005BBB67F6BDEFDDFF71D17BFF8FD1
+ 6AFFBBE09DFFC7A65CFFD3AF5CFFC59851FFC5BB6CFFAED178FF39A162FF58B2
+ 80FF269755FF58A265FFB0E3CEFF2D7832F7BEBEBEFDE2E2E2FFD2D2D2FFC6C6
+ C6FFCDCDCDFFB1B1B1FF27272744000000000000000028282844A8A8A8FFC2C2
+ C2FFB7B7B7FFC0C0C0FFD2D2D2FF5F5F5FFD0000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000005BBB68F5BDF0DCFF80D882FF75DB
+ 6BFFBEE599FFCCDFA6FFCAA75BFFC1BC6AFFB7DA8AFFA5D85EFF3AA666FF2F9E
+ 63FF57BB4EFF61AA6AFFB1E4CEFF317C35F6C2C2C2FDE9E9E9FFD6D6D6FFC9C9
+ C9FFCECECEFFA5A5A5FF23232344000000000000000029292944ACACACFFC4C4
+ C4FFBABABAFFC6C6C6FFDDDDDDFF696969FD0000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 00000000000000000000000000000000000054AD60E2B2ECD2FF9AE2A1FF9CEA
+ 8CFFD4EDB6FFD0EAC7FFCFB86CFFCCB064FFCBC973FF74DB65FF64D94BFF63D7
+ 4BFF6AD35BFF71BA7CFFA4DBC1FF337A36E6A0A0A0CDADADADE3B3B3B3EED8D8
+ D8FFCDCDCDFFBCBCBCFF656565C61F1F1F44222222446F6F6FC6C3C3C3FFC2C2
+ C2FFCDCDCDFF838383EE787878E3696969CD0000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000408449AD97DEB4FFB4EBCCFFB0EF
+ A6FFC9EEA8FFD1EAC9FFD5CF8CFFD9CB8AFFCDB364FFBBBB65FF99D66FFF81DE
+ 71FF78DC6FFF90D0A2FF87C8A3FF2C672FB9000000000000000066666685D4D4
+ D4FFCCCCCCFFC9C9C9FFBABABAFF9C9C9CFFA1A1A1FFC2C2C2FFC6C6C6FFC1C1
+ C1FFB7B7B7FF4747478500000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000162E1A3C5DBF6AFABFF3E2FFB4EF
+ B3FFB4F0ABFFC0EDB6FFD4E3B6FFD9D89BFFDAD394FFCDB46BFFC7B26BFFB4CB
+ 83FF93DF99FFAEE7CDFF43984AFC142D154F000000006363637DC3C3C3FEDCDC
+ DCFFD4D4D4FFD9D9D9FFDBDBDBFFD6D6D6FFD4D4D4FFD9D9D9FFD2D2D2FFCBCB
+ CBFFC8C8C8FF787878FE3636367D000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000000000003D7E46A586D79FFFBFF2
+ DEFFC7F2D6FFD5EFD5FFD0E9CFFFD5DBA5FFDCDEAAFFDBCD8FFFD7C88AFFC9C0
+ 8DFFBCD5AEFF78C790FF33743BB600000000000000006363637BDCDCDCFFEDED
+ EDFFDBDBDBFFB9B9B9F4BDBDBDFED6D6D6FFD4D4D4FFAFAFAFFEA4A4A4F4CBCB
+ CBFFE7E7E7FFB7B7B7FF4343437B000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000001040105499653C48BD8
+ A1FFCDF5E8FFD4EDDAFFCEEDD3FFCFDFAEFFD6DEB4FFD4D4A1FFCED0A0FFC3D0
+ A9FF86C990FF428E4BD1040A040F0000000000000000000000007F7F7F9BCCCC
+ CCFDB7B7B7E713131319AFAFAFE7DEDEDEFFDDDDDDFFA1A1A1E7101010199C9C
+ 9CE7A6A6A6FD6363639B00000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000020302043D7C
+ 45A45DBD69F8A4E1BAFFB9EACCFFC4E0BDFFC4DAB3FFBCD7AFFFA5D7ABFF5ABA
+ 65FB3F8447B60309040C00000000000000000000000000000000000000002121
+ 21290A0A0A0E02020202B6B6B6EAE5E5E5FFE4E4E4FF9E9E9EEA010101020A0A
+ 0A0E1C1C1C290000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000162E193D3F8249AA53AB5EDF5BBA67F45DBD69F857B263E942884BB21B36
+ 1D48000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000004E4E4E63959595BF929292BF4A4A4A63000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 000000000000000000000000000000000000424D3E000000000000003E000000
+ 2800000040000000100000000100010000000000800000000000000000000000
+ 000000000000000000000000FFFFFF0000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 0000000000000000000000000000000000000000000000000000000000000000
+ 000000000000}
+ end
+end
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.pas b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.pas
new file mode 100644
index 0000000000..7579d1834a
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/Main.pas
@@ -0,0 +1,1497 @@
+{ ################################################################################ }
+{ # # }
+{ # Обновление и установка набора программ IM-History - HistoryToDBUpdater v1.0 # }
+{ # # }
+{ # License: GPLv3 # }
+{ # # }
+{ # Author: Grigorev Michael (icq: 161867489, email: sleuthhound@gmail.com) # }
+{ # # }
+{ ################################################################################ }
+
+unit Main;
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+ Dialogs, StdCtrls, ComCtrls, XMLIntf, XMLDoc, Global, IniFiles, uIMDownloader, ShellApi,
+ ImgList;
+
+type
+ TMainForm = class(TForm)
+ GBUpdater: TGroupBox;
+ ProgressBarDownloads: TProgressBar;
+ LAmountDesc: TLabel;
+ LAmount: TLabel;
+ LSpeedDesc: TLabel;
+ LSpeed: TLabel;
+ ButtonSettings: TButton;
+ ButtonUpdate: TButton;
+ SettingsPageControl: TPageControl;
+ TabSheetConnectSettings: TTabSheet;
+ TabSheetLog: TTabSheet;
+ GBConnectSettings: TGroupBox;
+ LProxyAddress: TLabel;
+ LProxyPort: TLabel;
+ LProxyUser: TLabel;
+ LProxyUserPasswd: TLabel;
+ CBUseProxy: TCheckBox;
+ EProxyAddress: TEdit;
+ EProxyPort: TEdit;
+ EProxyUser: TEdit;
+ CBProxyAuth: TCheckBox;
+ EProxyUserPasswd: TEdit;
+ LogMemo: TMemo;
+ LFileDesc: TLabel;
+ LFileDescription: TLabel;
+ LFileMD5Desc: TLabel;
+ LFileMD5: TLabel;
+ LFileNameDesc: TLabel;
+ LFileName: TLabel;
+ IMDownloader1: TIMDownloader;
+ LStatus: TLabel;
+ TabSheetSettings: TTabSheet;
+ GBSettings: TGroupBox;
+ LLanguage: TLabel;
+ CBLang: TComboBox;
+ LIMClientType: TLabel;
+ CBIMClientType: TComboBox;
+ LDBType: TLabel;
+ CBDBType: TComboBox;
+ ImageList_Main: TImageList;
+ LPlatformType: TLabel;
+ procedure FormCreate(Sender: TObject);
+ procedure FormShow(Sender: TObject);
+ procedure FormClose(Sender: TObject; var Action: TCloseAction);
+ procedure FormDestroy(Sender: TObject);
+ procedure ButtonSettingsClick(Sender: TObject);
+ procedure ButtonUpdateStartClick(Sender: TObject);
+ procedure ButtonUpdateStopClick(Sender: TObject);
+ procedure CBUseProxyClick(Sender: TObject);
+ procedure CBProxyAuthClick(Sender: TObject);
+ procedure IMDownloader1StartDownload(Sender: TObject);
+ procedure IMDownloader1Break(Sender: TObject);
+ procedure IMDownloader1Downloading(Sender: TObject; AcceptedSize, MaxSize: Cardinal);
+ procedure IMDownloader1Error(Sender: TObject; E: TIMDownloadError);
+ procedure IMDownloader1Accepted(Sender: TObject);
+ procedure IMDownloader1Headers(Sender: TObject; Headers: String);
+ procedure IMDownloader1MD5Checked(Sender: TObject; MD5Correct, SizeCorrect: Boolean; MD5Str: string);
+ procedure CBLangChange(Sender: TObject);
+ procedure CBIMClientTypeChange(Sender: TObject);
+ procedure CBDBTypeChange(Sender: TObject);
+ procedure ButtonUpdateEnableStart;
+ procedure ButtonUpdateEnableStop;
+ procedure FindLangFile;
+ procedure CoreLanguageChanged;
+ procedure InstallUpdate;
+ procedure SetProxySettings;
+ procedure AntiBoss(HideAllForms: Boolean);
+ procedure RunIMClient(IMClientName: String; IMProcessArray: TProcessInfoArray);
+ procedure RunAllIMClients;
+ function StartStepByStepUpdate(CurrStep: Integer; INIFileName: String): Integer;
+ private
+ { Private declarations }
+ FLanguage : WideString;
+ procedure OnControlReq(var Msg : TWMCopyData); message WM_COPYDATA;
+ // Для мультиязыковой поддержки
+ procedure OnLanguageChanged(var Msg: TMessage); message WM_LANGUAGECHANGED;
+ procedure LoadLanguageStrings;
+ function EndTask(TaskName, FormName: String): Boolean;
+ public
+ { Public declarations }
+ RunAppDone: Boolean;
+ C1, C2: TLargeInteger;
+ iCounterPerSec: TLargeInteger;
+ TrueHeader: Boolean;
+ CurrentUpdateStep: Integer;
+ HeaderMD5: String;
+ HeaderFileSize: Integer;
+ HeaderFileName: String;
+ MD5InMemory: String;
+ IMMD5Correct: Boolean;
+ IMSizeCorrect: Boolean;
+ INISavePath: String;
+ SavePath: String;
+ SystemLang: String;
+ IMCancelCopy: Boolean;
+ DropboxProcessInfo: TProcessInfoArray;
+ QIPProcessInfo: TProcessInfoArray;
+ RnQProcessInfo: TProcessInfoArray;
+ SkypeProcessInfo: TProcessInfoArray;
+ MirandaProcessInfo: TProcessInfoArray;
+ property CoreLanguage: WideString read FLanguage;
+ end;
+
+function CopyProgressFunc(TotalFileSize: Int64; TotalBytesTransferred: Int64;
+ StreamSize: Int64; StreamBytesTransferred: Int64; dwStreamNumber: DWORD;
+ dwCallbackReason: DWORD; hSourceFile: THandle; hDestinationFile: THandle;
+ lpData: Pointer): DWORD; stdcall;
+
+var
+ MainForm: TMainForm;
+
+
+implementation
+
+{$R *.dfm}
+
+procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
+var
+ INI: TIniFile;
+ Path: WideString;
+ IsFileClosed: Boolean;
+ sFile: DWORD;
+begin
+ // Переменная для режима анти-босс
+ Global_MainForm_Showing := False;
+ // Сохранение настроек
+ DBType := CBDBType.Items[CBDBType.ItemIndex];
+ IMClientType := CBIMClientType.Items[CBIMClientType.ItemIndex];
+ DefaultLanguage := CoreLanguage;
+ Path := ProfilePath + ININame;
+ if FileExists(Path) then
+ begin
+ try
+ // Ждем пока файл освободит антивирь или еще какая-нибудь гадость
+ IsFileClosed := False;
+ repeat
+ sFile := CreateFile(PChar(Path),GENERIC_READ or GENERIC_WRITE,0,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
+ if (sFile <> INVALID_HANDLE_VALUE) then
+ begin
+ CloseHandle(sFile);
+ IsFileClosed := True;
+ end;
+ until IsFileClosed;
+ // End
+ INI := TIniFile.Create(Path);
+ if ParamCount = 0 then
+ begin
+ INI.WriteString('Main', 'DBType', DBType);
+ INI.WriteString('Main', 'IMClientType', IMClientType);
+ INI.WriteString('Main', 'DefaultLanguage', DefaultLanguage);
+ end;
+ INI.WriteString('Proxy', 'UseProxy', BoolToIntStr(CBUseProxy.Checked));
+ INI.WriteString('Proxy', 'ProxyAddress', EProxyAddress.Text);
+ INI.WriteString('Proxy', 'ProxyPort', EProxyPort.Text);
+ INI.WriteString('Proxy', 'ProxyAuth', BoolToIntStr(CBProxyAuth.Checked));
+ INI.WriteString('Proxy', 'ProxyUser', EProxyUser.Text);
+ INI.WriteString('Proxy', 'ProxyUserPasswd', EncryptStr(EProxyUserPasswd.Text));
+ INI.WriteString('Updater', 'UpdateServer', UpdateServer);
+ finally
+ INI.Free;
+ end;
+ end;
+ if FileExists(INISavePath) then
+ DeleteFile(INISavePath);
+ // Пишем все в лог
+ if EnableDebug then
+ LogMemo.Lines.SaveToFile(ProfilePath + DebugLogName);
+end;
+
+procedure TMainForm.FormCreate(Sender: TObject);
+var
+ CmdHelpStr: WideString;
+begin
+ RunAppDone := False;
+ TrueHeader := False;
+ IMMD5Correct := False;
+ IMSizeCorrect := False;
+ CurrentUpdateStep := 0;
+ // Определяем системный язык
+ if MatchStrings(GetSysLang, 'Русский*') or MatchStrings(GetSysLang, 'Russian*') then
+ SystemLang := 'Russian'
+ else
+ SystemLang := 'English';
+ // Подсказка по параметрам запуска
+ if SystemLang = 'Russian' then
+ begin
+ CmdHelpStr := 'Параметры запуска ' + ProgramsName + ' v' + ProgramsVer + ' ' + PlatformType + ':' + #13 +
+ '--------------------------------------------------------------' + #13#13 +
+ 'HistoryToDBUpdater.exe <1>' + #13#13 +
+ '<1> - (Необязательный параметр) - Путь до файла настроек HistoryToDB.ini (Например: "C:\Program Files\QIP Infium\Profiles\username@qip.ru\Plugins\QIPHistoryToDB\")';
+ end
+ else
+ begin
+ CmdHelpStr := 'Startup options ' + ProgramsName + ' v' + ProgramsVer + ' ' + PlatformType + ':' + #13 +
+ '------------------------------------------------' + #13#13 +
+ 'HistoryToDBUpdater.exe <1>' + #13#13 +
+ '<1> - (Optional) - The path to the configuration file HistoryToDB.ini (Example: "C:\Program Files\QIP Infium\Profiles\username@qip.ru\Plugins\QIPHistoryToDB\")';
+ end;
+ // Проверка входных параметров
+ if (ParamStr(1) = '/?') or (ParamStr(1) = '-?') then
+ begin
+ MsgInf(ProgramsName, CmdHelpStr);
+ Exit;
+ end
+ else
+ begin
+ if ParamCount >= 1 then
+ begin
+ ProfilePath := IncludeTrailingPathDelimiter(ParamStr(1));
+ end
+ else
+ begin
+ ProfilePath := ExtractFilePath(Application.ExeName);
+ end;
+ PluginPath := ExtractFilePath(Application.ExeName);
+ // Временный каталог
+ SavePath := GetUserTempPath + 'IMHistory\';
+ INISavePath := SavePath + 'HistoryToDBUpdate.ini';
+ IMDownloader1.DirPath := PluginPath;
+ // Инициализация криптования
+ EncryptInit;
+ // Читаем настройки
+ LoadINI(ProfilePath, false);
+ // Загружаем настройки локализации
+ if ParamCount >= 1 then
+ FLanguage := DefaultLanguage
+ else
+ FLanguage := SystemLang;
+ LangDoc := NewXMLDocument();
+ if not DirectoryExists(PluginPath + dirLangs) then
+ CreateDir(PluginPath + dirLangs);
+ if not FileExists(PluginPath + dirLangs + defaultLangFile) then
+ begin
+ if SystemLang = 'Russian' then
+ CmdHelpStr := 'Файл локализации ' + PluginPath + dirLangs + defaultLangFile + ' не найден.'
+ else
+ CmdHelpStr := 'The localization file ' + PluginPath + dirLangs + defaultLangFile + ' is not found.';
+ MsgInf(ProgramsName, CmdHelpStr);
+ // Освобождаем ресурсы
+ EncryptFree;
+ Exit;
+ end;
+ CoreLanguageChanged;
+ // Заполняем список языков
+ FindLangFile;
+ // Для мультиязыковой поддержки
+ MainFormHandle := Handle;
+ SetWindowLong(Handle, GWL_HWNDPARENT, 0);
+ SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_APPWINDOW);
+ // Загружаем язык интерфейса
+ LoadLanguageStrings;
+ // Программа запущена
+ RunAppDone := True;
+ end;
+end;
+
+procedure TMainForm.FormDestroy(Sender: TObject);
+begin
+ if RunAppDone then
+ begin
+ // Освобождаем ресурсы
+ EncryptFree;
+ end;
+end;
+
+procedure TMainForm.FormShow(Sender: TObject);
+var
+ I: Integer;
+begin
+ // Переменная для режима анти-босс
+ Global_MainForm_Showing := True;
+ // Прозрачность окна
+ AlphaBlend := AlphaBlendEnable;
+ AlphaBlendValue := AlphaBlendEnableValue;
+ // Др. настройки
+ LAmount.Caption := '0 '+GetLangStr('Kb');
+ LFileName.Caption := GetLangStr('Unknown');
+ LFileDescription.Caption := GetLangStr('Unknown');
+ LFileMD5.Caption := GetLangStr('Unknown');
+ LSpeed.Caption := '0 '+GetLangStr('KbSec');
+ CBUseProxy.Checked := False;
+ EProxyAddress.Enabled := False;
+ EProxyPort.Enabled := False;
+ CBProxyAuth.Enabled := False;
+ SettingsPageControl.ActivePage := TabSheetSettings;
+ SettingsPageControl.Visible := False;
+ MainForm.Height := SettingsPageControl.Height + 5;
+ if (DBType = 'Unknown') or (ParamCount = 0) then
+ begin
+ CBDBType.Enabled := True;
+ CBDBType.Items.Add('Unknown');
+ CBDBType.Items.Add('mysql');
+ CBDBType.Items.Add('postgresql');
+ CBDBType.Items.Add('oracle');
+ CBDBType.Items.Add('sqlite-3');
+ CBDBType.Items.Add('firebird-2.0');
+ CBDBType.Items.Add('firebird-2.5');
+ if ParamCount = 0 then
+ begin
+ for I := 0 to CBDBType.Items.Count-1 do
+ if CBDBType.Items[I] = DBType then
+ CBDBType.ItemIndex := I
+ end
+ else
+ CBDBType.ItemIndex := 0;
+ // Показываем настройки
+ ButtonSettingsClick(Self);
+ end
+ else
+ begin
+ CBDBType.Enabled := False;
+ CBDBType.Items.Add(DBType);
+ CBDBType.ItemIndex := 0;
+ end;
+ if (IMClientType = 'Unknown') or (ParamCount = 0) then
+ begin
+ CBIMClientType.Enabled := True;
+ CBIMClientType.Items.Add('Unknown');
+ CBIMClientType.Items.Add('QIP');
+ CBIMClientType.Items.Add('RnQ');
+ CBIMClientType.Items.Add('Skype');
+ CBIMClientType.Items.Add('Miranda');
+ CBIMClientType.Items.Add('MirandaNG');
+ if ParamCount = 0 then
+ begin
+ for I := 0 to CBIMClientType.Items.Count-1 do
+ if CBIMClientType.Items[I] = IMClientType then
+ CBIMClientType.ItemIndex := I
+ end
+ else
+ CBIMClientType.ItemIndex := 0;
+ // Показываем настройки если не были показыны ранее
+ if not SettingsPageControl.Visible then
+ ButtonSettingsClick(Self);
+ end
+ else
+ begin
+ CBIMClientType.Enabled := False;
+ CBIMClientType.Items.Add(IMClientType);
+ CBIMClientType.ItemIndex := 0;
+ end;
+ // Платформа
+ LPlatformType.Caption := IMClientPlatformType;
+ // Прокси
+ CBUseProxy.Checked := IMUseProxy;
+ EProxyAddress.Text := IMProxyAddress;
+ EProxyPort.Text := IMProxyPort;
+ CBProxyAuth.Checked := IMProxyAuth;
+ EProxyUser.Text := IMProxyUser;
+ EProxyUserPasswd.Text := IMProxyUserPagsswd;
+ // Версия утилиты обновления
+ LogMemo.Lines.Add(ProgramsName + ' v' + ProgramsVer + ' ' + PlatformType);
+end;
+
+procedure TMainForm.ButtonSettingsClick(Sender: TObject);
+begin
+ if not SettingsPageControl.Visible then
+ begin
+ MainForm.Height := GBUpdater.Height + SettingsPageControl.Height + 55;
+ SettingsPageControl.Visible := True;
+ end
+ else
+ begin
+ SettingsPageControl.Visible := False;
+ MainForm.Height := SettingsPageControl.Height + 5;
+ end;
+end;
+
+procedure TMainForm.ButtonUpdateStartClick(Sender: TObject);
+var
+ AllProcessEndErr: Integer;
+begin
+ IMCancelCopy := False;
+ AllProcessEndErr := 0;
+ if (DBType = 'Unknown') or (IMClientType = 'Unknown') then
+ MsgInf(Caption, GetLangStr('SelectDBTypeAndIMClient'))
+ else
+ begin
+ LogMemo.Clear;
+ // Ищем программы синхронизации типа Dropbox
+ {if IsProcessRun('Dropbox.exe') then
+ begin
+ if SystemLang = 'Russian' then
+ MsgString := 'В памяти найдена программа Dropbox.' + #13 +
+ 'Если Вы используете её для синхронизации IM-клиента, то для корректного обновления' + #13 +
+ 'всех компонентов плагина необходимо её закрыть.' + #13 +
+ 'Закрыть Dropbox?'
+ else
+ MsgString := 'Find the program in the memory of Dropbox.' + #13 +
+ 'If you use it to synchronize the IM-client, to properly' + #13 +
+ 'update all the components necessary to close the plug.' + #13 +
+ 'Close Dropbox?';
+ case MessageBox(MainForm.Handle, PWideChar(MsgString), PWideChar(Caption),36) of
+ 6: DropboxProcessInfo := EndProcess('Dropbox.exe', True);
+ end;
+ end;}
+ // Ищем запущенные компоненты плагина и закрываем их
+ if not EndTask('HistoryToDBSync.exe', 'HistoryToDBSync for ' + IMClientType + ' (' + MyAccount + ')') then
+ Inc(AllProcessEndErr);
+ if not EndTask('HistoryToDBViewer.exe', 'HistoryToDBViewer for ' + IMClientType + ' (' + MyAccount + ')') then
+ Inc(AllProcessEndErr);
+ if not EndTask('HistoryToDBImport.exe', 'HistoryToDBImport for ' + IMClientType + ' (' + MyAccount + ')') then
+ Inc(AllProcessEndErr);
+ // Если все процессы убиты, то обновляемся
+ if AllProcessEndErr = 0 then
+ begin
+ // Ищем все экземпляры IM-клиентов и закрываем их
+ if IMClientType = 'QIP' then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['qip.exe']));
+ QIPProcessInfo := EndProcess('qip.exe', 0, True);
+ end;
+ if IMClientType = 'Miranda' then
+ begin
+ if IMClientPlatformType = 'x86' then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['miranda32.exe']));
+ MirandaProcessInfo := EndProcess('miranda32.exe', 1, True);
+ end
+ else
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['miranda64.exe']));
+ MirandaProcessInfo := EndProcess('miranda64.exe', 1, True);
+ end;
+ end;
+ if IMClientType = 'MirandaNG' then
+ begin
+ if IMClientPlatformType = 'x86' then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['miranda32.exe']));
+ MirandaProcessInfo := EndProcess('miranda32.exe', 0, True);
+ end
+ else
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['miranda64.exe']));
+ MirandaProcessInfo := EndProcess('miranda64.exe', 0, True);
+ end;
+ end;
+ if IMClientType = 'RnQ' then
+ begin
+ if IsProcessRun('rnq.exe') then
+ begin
+ RnQProcessInfo := EndProcess('rnq.exe', 0, True);
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['rnq.exe']));
+ end;
+ if IsProcessRun('R&Q.exe') then
+ begin
+ RnQProcessInfo := EndProcess('R&Q.exe', 0, True);
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['R&Q.exe']));
+ end;
+ end;
+ if IMClientType = 'Skype' then
+ begin
+ SkypeProcessInfo := EndProcess('skype.exe', 0, True);
+ LogMemo.Lines.Add(Format(GetLangStr('EndProcess'), ['skype.exe']));
+ end;
+ // Начинаем обновление
+ TrueHeader := False;
+ CurrentUpdateStep := 0;
+ SetProxySettings;
+ if IMClientPlatformType = 'x86' then
+ IMDownloader1.URL := UpdateServer + '&platform=windows-x86'
+ else
+ IMDownloader1.URL := UpdateServer + '&platform=windows-x64';
+ IMDownloader1.DownLoad;
+ end
+ else
+ MsgInf(Caption, GetLangStr('ManualUpdate'));
+ end;
+end;
+
+{ Устанавливаем настройки прокси }
+procedure TMainForm.SetProxySettings;
+begin
+ if CBUseProxy.Checked then
+ begin
+ IMDownloader1.Proxy := EProxyAddress.Text + ':' + EProxyPort.Text;
+ if CBProxyAuth.Checked then
+ begin
+ IMDownloader1.ProxyAuthUserName := EProxyUser.Text;
+ IMDownloader1.ProxyAuthPassword := EProxyUserPasswd.Text;
+ end
+ else
+ begin
+ IMDownloader1.ProxyAuthUserName := '';
+ IMDownloader1.ProxyAuthPassword := '';
+ end;
+ end
+ else
+ begin
+ IMDownloader1.Proxy := '';
+ IMDownloader1.AuthUserName := '';
+ IMDownloader1.AuthPassword := '';
+ end;
+end;
+
+procedure TMainForm.IMDownloader1Accepted(Sender: TObject);
+var
+ MaxSteps: Integer;
+begin
+ LStatus.Caption := GetLangStr('DownloadSuccessful');
+ LStatus.Hint := 'DownloadSuccessful';
+ LStatus.Repaint;
+ LAmount.Caption := CurrToStr(IMDownloader1.AcceptedSize/1024)+' '+GetLangStr('Kb');
+ LAmount.Repaint;
+ if not TrueHeader then
+ begin
+ LFileName.Caption := GetLangStr('Unknown');
+ LFileDescription.Caption := GetLangStr('Unknown');
+ LFileMD5.Caption := GetLangStr('Unknown');
+ LStatus.Caption := GetLangStr('InvalidResponseHeader');
+ LStatus.Hint := 'InvalidResponseHeader';
+ LStatus.Repaint;
+ ButtonUpdateEnableStart;
+ end
+ else
+ begin
+ LStatus.Caption := GetLangStr('IsChecksum');
+ LStatus.Hint := 'IsChecksum';
+ LStatus.Repaint;
+ if MD5InMemory <> 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' then
+ begin
+ LogMemo.Lines.Add(GetLangStr('MD5FileInMemory') + ' ' + MD5InMemory);
+ LogMemo.Lines.Add(GetLangStr('FileSizeInMemory') + ' ' + IntToStr(IMDownloader1.OutStream.Size));
+ end;
+ if IMMD5Correct and IMSizeCorrect then
+ begin
+ if MD5InMemory <> 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' then
+ begin
+ LStatus.Caption := GetLangStr('ChecksumConfirmed');
+ LStatus.Hint := 'ChecksumConfirmed';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(GetLangStr('ChecksumConfirmed'));
+ end
+ else
+ begin
+ LStatus.Caption := GetLangStr('ChecksumFileEqServer');
+ LStatus.Hint := 'ChecksumFileEqServer';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(GetLangStr('ChecksumFileEqServer'));
+ end;
+ // Если первый шаг - скачивание INI файла
+ if CurrentUpdateStep = 0 then
+ INISavePath := SavePath + HeaderFileName;
+ // Проверяем каталог для сохранения
+ if not DirectoryExists(SavePath) then
+ CreateDir(SavePath);
+ // Удаляем старый файл
+ if CurrentUpdateStep = 0 then
+ begin
+ if FileExists(INISavePath) then
+ DeleteFile(INISavePath);
+ end;
+ if FileExists(SavePath + HeaderFileName) then
+ DeleteFile(SavePath + HeaderFileName);
+ // Сохряняем новый
+ try
+ if MD5InMemory <> 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' then
+ begin
+ IMDownloader1.OutStream.SaveToFile(SavePath + HeaderFileName);
+ LStatus.Caption := GetLangStr('FileSavedAs') + ' ' + HeaderFileName;
+ LStatus.Hint := 'FileSavedAs';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(GetLangStr('FileSavedAs') + ' ' + HeaderFileName);
+ end;
+ Inc(CurrentUpdateStep);
+ if CurrentUpdateStep > 0 then
+ MaxSteps := StartStepByStepUpdate(CurrentUpdateStep, INISavePath);
+ except
+ on E: Exception do
+ begin
+ LStatus.Caption := GetLangStr('ErrFileSavedAs') + ' ' + HeaderFileName;
+ LStatus.Hint := 'ErrFileSavedAs';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(GetLangStr('ErrFileSavedAs') + ' ' + HeaderFileName);
+ end;
+ end;
+ end
+ else
+ begin
+ if not IMMD5Correct then
+ begin
+ LStatus.Caption := GetLangStr('ChecksumNotConfirmed');
+ LStatus.Hint := 'ChecksumNotConfirmed';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(GetLangStr('ChecksumNotConfirmed'));
+ end;
+ if not IMSizeCorrect then
+ begin
+ LStatus.Caption := GetLangStr('SizeNotConfirmed');
+ LStatus.Hint := 'SizeNotConfirmed';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(GetLangStr('SizeNotConfirmed'));
+ end;
+ ButtonUpdateEnableStart;
+ end;
+ end;
+end;
+
+function TMainForm.StartStepByStepUpdate(CurrStep: Integer; INIFileName: String): Integer;
+var
+ UpdateINI: TIniFile;
+ MaxStep, IMClientCount, IMClientDownloadFileCount: Integer;
+ DatabaseCount, DatabaseDownloadFileCount, I, UpdateServerInServiceMode: Integer;
+ IMClientName, IMClientNum, UpdateURL: String;
+ DatabaseName, DatabaseNum, TmpUpdateServer: String;
+ FileListArray: TArrayOfString;
+ DownloadListArray: TArrayOfString;
+begin
+ Result := 0;
+ if FileExists(INIFileName) then
+ begin
+ UpdateINI := TIniFile.Create(INIFileName);
+ UpdateServerInServiceMode := UpdateINI.ReadInteger('HistoryToDBUpdate', 'UpdateServerInServiceMode', 0);
+ LogMemo.Lines.Add('UpdateServerInServiceMode = ' + IntToStr(UpdateServerInServiceMode));
+ //Сервер обновлений временно на сервисном обслуживании
+ if UpdateServerInServiceMode = 1 then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateServerInServiceMode'), [' ']));
+ IMDownloader1.BreakDownload;
+ MsgInf(Caption, Format(GetLangStr('UpdateServerInServiceMode'), [#13]));
+ Result := -1;
+ // Вкл. кнопки
+ ButtonUpdateEnableStart;
+ // Запуск IM-клиента
+ RunAllIMClients;
+ // Выход
+ Close;
+ Exit;
+ end;
+ // Смена сервера обновления
+ TmpUpdateServer := UpdateINI.ReadString('HistoryToDBUpdate', 'UpdateServer', UpdateServer);
+ if TmpUpdateServer <> UpdateServer then
+ UpdateServer := TmpUpdateServer;
+ // End
+ MaxStep := UpdateINI.ReadInteger('HistoryToDBUpdate', 'FileCount', 0);
+ IMClientCount := UpdateINI.ReadInteger('HistoryToDBUpdate', 'IMClientCount', 0);
+ if EnableDebug then
+ LogMemo.Lines.Add('Число IM-клиентов в INI-файле = ' + IntToStr(IMClientCount));
+ IMClientDownloadFileCount := 0;
+ SetLength(DownloadListArray, 0);
+ if IMClientCount > 0 then
+ begin
+ IMClientName := '';
+ while (IMClientCount > 0) and (IMClientName <> CBIMClientType.Items[CBIMClientType.ItemIndex]) do
+ begin
+ IMClientName := UpdateINI.ReadString('HistoryToDBUpdate', 'IMClient'+IntToStr(IMClientCount)+'Name', '');
+ IMClientNum := UpdateINI.ReadString('HistoryToDBUpdate', 'IMClient'+IntToStr(IMClientCount)+'File', '');
+ if EnableDebug then
+ begin
+ LogMemo.Lines.Add('IM-клиент = ' + IMClientName);
+ LogMemo.Lines.Add('Номера файлов = ' + IMClientNum);
+ end;
+ Dec(IMClientCount);
+ end;
+ FileListArray := StringToParts(IMClientNum, [',']);
+ SetLength(DownloadListArray, Length(FileListArray));
+ DownloadListArray := FileListArray;
+ IMClientDownloadFileCount := Length(FileListArray);
+ if EnableDebug then
+ begin
+ for I := 0 to High(FileListArray) do
+ LogMemo.Lines.Add('№ файла для '+IMClientName+' = ' + FileListArray[I]);
+ end;
+ end;
+ DatabaseCount := UpdateINI.ReadInteger('HistoryToDBUpdate', 'DatabaseCount', 0);
+ DatabaseDownloadFileCount := 0;
+ if EnableDebug then
+ LogMemo.Lines.Add('Число типов Database в INI-файле = ' + IntToStr(DatabaseCount));
+ if DatabaseCount > 0 then
+ begin
+ DatabaseName := '';
+ while (DatabaseCount > 0) and (DatabaseName <> CBDBType.Items[CBDBType.ItemIndex]) do
+ begin
+ DatabaseName := UpdateINI.ReadString('HistoryToDBUpdate', 'Database'+IntToStr(DatabaseCount)+'Name', '');
+ DatabaseNum := UpdateINI.ReadString('HistoryToDBUpdate', 'Database'+IntToStr(DatabaseCount)+'File', '');
+ if EnableDebug then
+ begin
+ LogMemo.Lines.Add('Database = ' + DatabaseName);
+ LogMemo.Lines.Add('Номера файлов = ' + DatabaseNum);
+ end;
+ Dec(DatabaseCount);
+ end;
+ FileListArray := StringToParts(DatabaseNum, [',']);
+ SetLength(DownloadListArray, Length(DownloadListArray) + Length(FileListArray));
+ DatabaseDownloadFileCount := Length(FileListArray);
+ for I := 0 to High(FileListArray) do
+ begin
+ DownloadListArray[IMClientDownloadFileCount+I] := FileListArray[I];
+ if EnableDebug then
+ LogMemo.Lines.Add('№ файла для '+DatabaseName+' = ' + FileListArray[I]);
+ end;
+ end;
+ if EnableDebug then
+ begin
+ LogMemo.Lines.Add('Число шагов = ' + IntToStr(Length(DownloadListArray)));
+ for I := 0 to High(DownloadListArray) do
+ LogMemo.Lines.Add('DownloadListArray['+IntToStr(I)+'] = ' + DownloadListArray[I]);
+ end;
+ MaxStep := IMClientDownloadFileCount + DatabaseDownloadFileCount;
+ Result := MaxStep;
+ if EnableDebug then
+ LogMemo.Lines.Add('Число шагов = ' + IntToStr(MaxStep));
+ if CurrentUpdateStep > MaxStep then
+ begin
+ LStatus.Caption := GetLangStr('AllUpdatesDownloaded');
+ LStatus.Hint := 'AllUpdatesDownloaded';
+ LStatus.Repaint;
+ LogMemo.Lines.Add('=========================================');
+ LogMemo.Lines.Add(GetLangStr('AllUpdatesDownloaded'));
+ InstallUpdate;
+ LStatus.Caption := GetLangStr('AllUpdatesInstalled');
+ LStatus.Hint := 'AllUpdatesInstalled';
+ LStatus.Repaint;
+ LogMemo.Lines.Add('=========================================');
+ LogMemo.Lines.Add(GetLangStr('AllUpdatesInstalled'));
+ // Вкл. кнопки
+ ButtonUpdateEnableStart;
+ // Запуск IM-клиента
+ RunAllIMClients;
+ Close;
+ Exit;
+ end;
+ LogMemo.Lines.Add('================= ' + GetLangStr('Step') + ' '+IntToStr(CurrStep)+' =================');
+ LogMemo.Lines.Add(GetLangStr('NumberFilesUpdate') + ' = ' + IntToStr(MaxStep));
+ if MaxStep > 0 then
+ begin
+ UpdateURL := UpdateINI.ReadString('HistoryToDBUpdate', 'File'+DownloadListArray[CurrStep-1], '');
+ if (UpdateURL <> '') and (CurrStep <= MaxStep) then
+ begin
+ LogMemo.Lines.Add(GetLangStr('FileToUpdate') + ' = ' + UpdateURL);
+ if MatchStrings(UpdateURL, '*file=*Lang') then
+ IMDownloader1.DirPath := PluginPath + dirLangs
+ else if MatchStrings(UpdateURL, '*file=*-update-*-to-*') then
+ IMDownloader1.DirPath := PluginPath + dirSQLUpdate
+ else
+ IMDownloader1.DirPath := PluginPath;
+ IMDownloader1.URL := UpdateURL;
+ IMDownloader1.DownLoad;
+ end
+ else
+ CurrentUpdateStep := 0;
+ end;
+ end
+ else
+ LogMemo.Lines.Add(GetLangStr('UpdateSettingsFileNotFound') + ' ' + INIFileName);
+end;
+
+procedure TMainForm.InstallUpdate;
+var
+ SR: TSearchRec;
+begin
+ LAmount.Caption := '0 '+GetLangStr('Kb');
+ LFileName.Caption := GetLangStr('Unknown');
+ LFileDescription.Caption := GetLangStr('Unknown');
+ LFileMD5.Caption := GetLangStr('Unknown');
+ LSpeed.Caption := '0 '+GetLangStr('KbSec');
+ // Обновление
+ if FindFirst(SavePath + '*.*', faAnyFile or faDirectory, SR) = 0 then
+ begin
+ repeat
+ if (SR.Attr = faDirectory) and ((SR.Name = '.') or (SR.Name = '..')) then // Чтобы не было файлов . и ..
+ begin
+ Continue; // Продолжаем цикл
+ end;
+ if MatchStrings(SR.Name, 'HistoryToDBUpdater.exe') then
+ begin
+ LStatus.Caption := Format(GetLangStr('UpdateFile'), [SR.Name]);
+ LStatus.Hint := 'UpdateFile';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFile'), [SR.Name]));
+ if CopyFileEx(PChar(SavePath + SR.Name), PChar(PluginPath + 'HistoryToDBUpdater.upd'), Addr(CopyProgressFunc), nil, Addr(IMCancelCopy), COPY_FILE_RESTARTABLE) then
+ begin
+ DeleteFile(SavePath + SR.Name);
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileDone'), [SR.Name]));
+ end
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileErr'), [SR.Name]));
+ end;
+ if MatchStrings(SR.Name, '*.xml') then
+ begin
+ LStatus.Caption := Format(GetLangStr('UpdateLangFile'), [SR.Name]);
+ LStatus.Hint := 'UpdateLangFile';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateLangFile'), [SR.Name]));
+ if FileExists(PluginPath + dirLangs + SR.Name) then
+ DeleteFile(PluginPath + dirLangs + SR.Name);
+ if CopyFileEx(PChar(SavePath + SR.Name), PChar(PluginPath + dirLangs + SR.Name), Addr(CopyProgressFunc), nil, Addr(IMCancelCopy), COPY_FILE_RESTARTABLE) then
+ begin
+ DeleteFile(SavePath + SR.Name);
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateLangFileDone'), [SR.Name]));
+ end
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileErr'), [SR.Name]));
+ end;
+ if MatchStrings(SR.Name, '*.sql') then
+ begin
+ LStatus.Caption := Format(GetLangStr('UpdateSQLFile'), [SR.Name]);
+ LStatus.Hint := 'UpdateSQLFile';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateSQLFile'), [SR.Name]));
+ if not DirectoryExists(PluginPath + dirSQLUpdate) then
+ CreateDir(PluginPath + dirSQLUpdate);
+ if FileExists(PluginPath + dirSQLUpdate + SR.Name) then
+ DeleteFile(PluginPath + dirSQLUpdate + SR.Name);
+ if CopyFileEx(PChar(SavePath + SR.Name), PChar(PluginPath + dirSQLUpdate + SR.Name), Addr(CopyProgressFunc), nil, Addr(IMCancelCopy), COPY_FILE_RESTARTABLE) then
+ begin
+ DeleteFile(SavePath + SR.Name);
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateSQLFileDone'), [SR.Name]));
+ end
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileErr'), [SR.Name]));
+ end;
+ if MatchStrings(SR.Name, '*.exe') then
+ begin
+ LStatus.Caption := Format(GetLangStr('UpdateFile'), [SR.Name]);
+ LStatus.Hint := 'UpdateFile';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFile'), [SR.Name]));
+ if FileExists(PluginPath + SR.Name) then
+ DeleteFile(PluginPath + SR.Name);
+ if CopyFileEx(PChar(SavePath + SR.Name), PChar(PluginPath + SR.Name), nil, nil, Addr(IMCancelCopy), COPY_FILE_RESTARTABLE) then
+ begin
+ DeleteFile(SavePath + SR.Name);
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileDone'), [SR.Name]));
+ end
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileErr'), [SR.Name]));
+ end;
+ if MatchStrings(SR.Name, '*.dll') then
+ begin
+ LStatus.Caption := Format(GetLangStr('UpdateFile'), [SR.Name]);
+ LStatus.Hint := 'UpdateFile';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFile'), [SR.Name]));
+ if FileExists(PluginPath + SR.Name) then
+ DeleteFile(PluginPath + SR.Name);
+ if CopyFileEx(PChar(SavePath + SR.Name), PChar(PluginPath + SR.Name), Addr(CopyProgressFunc), nil, Addr(IMCancelCopy), COPY_FILE_RESTARTABLE) then
+ begin
+ DeleteFile(SavePath + SR.Name);
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileDone'), [SR.Name]));
+ end
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileErr'), [SR.Name]));
+ end;
+ if MatchStrings(SR.Name, '*.msg') then
+ begin
+ LStatus.Caption := Format(GetLangStr('UpdateFile'), [SR.Name]);
+ LStatus.Hint := 'UpdateFile';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFile'), [SR.Name]));
+ if FileExists(PluginPath + SR.Name) then
+ DeleteFile(PluginPath + SR.Name);
+ if CopyFileEx(PChar(SavePath + SR.Name), PChar(PluginPath + SR.Name), nil, nil, Addr(IMCancelCopy), COPY_FILE_RESTARTABLE) then
+ begin
+ DeleteFile(SavePath + SR.Name);
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileDone'), [SR.Name]));
+ end
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileErr'), [SR.Name]));
+ end;
+ if MatchStrings(SR.Name, '*.txt') then
+ begin
+ LStatus.Caption := Format(GetLangStr('UpdateFile'), [SR.Name]);
+ LStatus.Hint := 'UpdateFile';
+ LStatus.Repaint;
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFile'), [SR.Name]));
+ if FileExists(PluginPath + SR.Name) then
+ DeleteFile(PluginPath + SR.Name);
+ if CopyFileEx(PChar(SavePath + SR.Name), PChar(PluginPath + SR.Name), Addr(CopyProgressFunc), nil, Addr(IMCancelCopy), COPY_FILE_RESTARTABLE) then
+ begin
+ DeleteFile(SavePath + SR.Name);
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileDone'), [SR.Name]));
+ end
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('UpdateFileErr'), [SR.Name]));
+ end;
+ until FindNext(SR) <> 0;
+ FindClose(SR);
+ end;
+end;
+
+procedure TMainForm.IMDownloader1Break(Sender: TObject);
+begin
+ LStatus.Caption := GetLangStr('DownloadStopped');
+ LStatus.Hint := 'DownloadStopped';
+ LAmount.Caption := CurrToStr(IMDownloader1.AcceptedSize/1024)+' '+GetLangStr('Kb');
+ LAmount.Repaint;
+ ButtonUpdateEnableStart;
+end;
+
+procedure TMainForm.IMDownloader1Downloading(Sender: TObject; AcceptedSize, MaxSize: Cardinal);
+begin
+ QueryPerformanceCounter(C2);
+ ProgressBarDownloads.Max := MaxSize;
+ ProgressBarDownloads.Position := AcceptedSize;
+ LStatus.Caption := GetLangStr('Loading');
+ LStatus.Hint := 'Loading';
+ LAmount.Caption := CurrToStr(AcceptedSize/1024)+' '+GetLangStr('Kb');
+ LAmount.Repaint;
+ LSpeed.Caption := CurrToStr((AcceptedSize/1024)/((C2 - C1) / iCounterPerSec))+' '+GetLangStr('KbSec');
+ LSpeed.Repaint;
+end;
+
+procedure TMainForm.IMDownloader1Error(Sender: TObject; E: TIMDownloadError);
+var
+ S, HS: String;
+begin
+ case E of
+ deInternetOpen:
+ begin
+ S := GetLangStr('ErrInternetOpen');
+ HS := 'ErrInternetOpen';
+ end;
+ deInternetOpenUrl:
+ begin
+ S := GetLangStr('ErrInternetOpenURL');
+ HS := 'ErrInternetOpenURL';
+ end;
+ deDownloadingFile:
+ begin
+ S := GetLangStr('ErrDownloadingFile');
+ HS := 'ErrDownloadingFile';
+ end;
+ deRequest:
+ begin
+ S := GetLangStr('ErrRequest');
+ HS := 'ErrRequest';
+ end;
+ end;
+ LStatus.Caption := S;
+ LStatus.Hint := HS;
+ LogMemo.Lines.Add(S);
+ LAmount.Caption := CurrToStr(IMDownloader1.AcceptedSize/1024)+' '+GetLangStr('Kb');
+ LAmount.Repaint;
+ if not TrueHeader then
+ begin
+ LFileName.Caption := GetLangStr('Unknown');
+ LFileDescription.Caption := GetLangStr('Unknown');
+ LFileMD5.Caption := GetLangStr('Unknown');
+ end;
+ ButtonUpdateEnableStart;
+end;
+
+{ Получение информации о файле
+ Формат инормации:
+ Имя_файла|Описани_файла|MD5Sum_файла|Размер_файла
+}
+procedure TMainForm.IMDownloader1Headers(Sender: TObject; Headers: string);
+var
+ HeadersStrList: TStringList;
+ I: Integer;
+ Size: String;
+ Ch: Char;
+ ResultFilename, ResultFileDesc, ResultMD5Sum, ResultHeaders: String;
+ ResultFileSize: Integer;
+begin
+ //LogMemo.Lines.Add(Headers);
+ HeadersStrList := TStringList.Create;
+ HeadersStrList.Clear;
+ HeadersStrList.Text := Headers;
+ HeadersStrList.Delete(HeadersStrList.Count-1); // Последний элемент содержит всегда CRLF
+ if HeadersStrList.Count > 0 then
+ begin
+ ResultFilename := 'Test';
+ ResultFileDesc := 'Test';
+ ResultMD5Sum := '00000000000000000000000000000000';
+ ResultFileSize := 0;
+ LogMemo.Lines.Add(GetLangStr('ParseHeader'));
+ for I := 0 to HeadersStrList.Count - 1 do
+ begin
+ //LogMemo.Lines.Add(HeadersStrList[I]);
+ // Парсим строку вида
+ // Content-Disposition: attachment; filename="ИМЯ-ФАЙЛА"
+ // Такую строку вставляет в заголовок HTTP-запроса
+ // только мой скрипт get.php
+ if pos('content-disposition', lowercase(HeadersStrList[I])) > 0 then
+ begin
+ ResultFilename := HeadersStrList[I];
+ Delete(ResultFilename, 1, Pos('"', HeadersStrList[I]));
+ Delete(ResultFilename, Length(ResultFilename),1);
+ //LogMemo.Lines.Add('Filename: '+ResultFilename);
+ end;
+ // Парсим строку вида
+ // Content-Description: Desc
+ if pos('content-description', lowercase(HeadersStrList[I])) > 0 then
+ begin
+ ResultFileDesc := HeadersStrList[I];
+ Delete(ResultFileDesc, 1, Pos(':', HeadersStrList[I]));
+ Delete(ResultFileDesc, 1,1);
+ //LogMemo.Lines.Add('Description: '+ResultFileDesc);
+ end;
+ // Парсим строку вида
+ // Content-MD5Sum: MD5
+ if pos('content-md5sum', lowercase(HeadersStrList[I])) > 0 then
+ begin
+ ResultMD5Sum := HeadersStrList[I];
+ Delete(ResultMD5Sum, 1, Pos(':', HeadersStrList[I]));
+ Delete(ResultMD5Sum, 1,1);
+ //LogMemo.Lines.Add('MD5: '+ResultMD5Sum);
+ end;
+ // Парсим строку вида
+ // Content-Length: РАЗМЕР
+ if pos('content-length', lowercase(HeadersStrList[i])) > 0 then
+ begin
+ Size := '';
+ for Ch in HeadersStrList[I]do
+ if Ch in ['0'..'9'] then
+ Size := Size + Ch;
+ ResultFileSize := StrToIntDef(Size,-1);// + Length(HeadersStrList.Text);
+ end;
+ end;
+ ResultHeaders := ResultFilename + '|' + ResultFileDesc + '|' + ResultMD5Sum + '|' + IntToStr(ResultFileSize) + '|';
+ if(ResultHeaders <> 'Test|Test|00000000000000000000000000000000|' + IntToStr(ResultFileSize) + '|') then
+ begin
+ LogMemo.Lines.Add(GetLangStr('HeaderData'));
+ LogMemo.Lines.Add(GetLangStr('FileName') + ' ' + ResultFilename);
+ LogMemo.Lines.Add(GetLangStr('FileDesc') + ' ' + ResultFileDesc);
+ LogMemo.Lines.Add('MD5: ' + ResultMD5Sum);
+ LogMemo.Lines.Add(GetLangStr('FileSize') + ' ' + IntToStr(ResultFileSize));
+ LFileName.Caption := ResultFilename;
+ LFileDescription.Caption := ResultFileDesc;
+ LFileMD5.Caption := ResultMD5Sum;
+ HeaderFileName := ResultFilename;
+ HeaderMD5 := ResultMD5Sum;
+ HeaderFileSize := ResultFileSize;
+ if (CurrentUpdateStep = 0) and FileExists(PluginPath+HeaderFileName) then
+ DeleteFile(PluginPath+HeaderFileName);
+ TrueHeader := True;
+ end
+ else
+ begin
+ LogMemo.Lines.Add(GetLangStr('InvalidResponseHeader'));
+ LogMemo.Lines.Add(GetLangStr('InvalidResponseHeaderDesc'));
+ HeaderFileName := 'Test';
+ HeaderMD5 := '00000000000000000000000000000000';
+ HeaderFileSize := 0;
+ TrueHeader := False;
+ end;
+ end;
+ HeadersStrList.Free;
+end;
+
+procedure TMainForm.IMDownloader1MD5Checked(Sender: TObject; MD5Correct, SizeCorrect: Boolean; MD5Str: string);
+begin
+ MD5InMemory := MD5Str;
+ IMMD5Correct := MD5Correct;
+ IMSizeCorrect := SizeCorrect;
+end;
+
+procedure TMainForm.IMDownloader1StartDownload(Sender: TObject);
+begin
+ QueryPerformanceFrequency(iCounterPerSec);
+ QueryPerformanceCounter(C1);
+ ButtonUpdateEnableStop;
+ LStatus.Caption := GetLangStr('InitDownload');
+ LStatus.Hint := 'InitDownload';
+ LAmount.Caption := '0 '+GetLangStr('Kb');
+ LSpeed.Caption := '0 '+GetLangStr('KbSec');
+ LogMemo.Lines.Add(GetLangStr('InitDownloadFromURL') + ' ' + IMDownloader1.URL);
+end;
+
+procedure TMainForm.ButtonUpdateStopClick(Sender: TObject);
+begin
+ // Прерываем закачку
+ IMDownloader1.BreakDownload;
+ //Останавливаем процесс копирования
+ IMCancelCopy := True;
+end;
+
+procedure TMainForm.CBUseProxyClick(Sender: TObject);
+begin
+ if CBUseProxy.Checked then
+ begin
+ EProxyAddress.Enabled := True;
+ EProxyPort.Enabled := True;
+ CBProxyAuth.Enabled := True;
+ end
+ else
+ begin
+ EProxyAddress.Enabled := False;
+ EProxyPort.Enabled := False;
+ CBProxyAuth.Enabled := False;
+ end;
+end;
+
+procedure TMainForm.CBProxyAuthClick(Sender: TObject);
+begin
+ if CBProxyAuth.Checked then
+ begin
+ EProxyUser.Enabled := True;
+ EProxyUserPasswd.Enabled := True;
+ end
+ else
+ begin
+ EProxyUser.Enabled := False;
+ EProxyUserPasswd.Enabled := False;
+ end;
+end;
+
+procedure TMainForm.ButtonUpdateEnableStart;
+begin
+ ButtonUpdate.OnClick := ButtonUpdateStartClick;
+ ButtonUpdate.Caption := GetLangStr('UpdateButton');
+ ButtonUpdate.Hint := 'UpdateButton';
+ ButtonSettings.Enabled := True;
+ CBIMClientType.Enabled := True;
+ CBDBType.Enabled := True;
+end;
+
+procedure TMainForm.ButtonUpdateEnableStop;
+begin
+ ButtonUpdate.OnClick := ButtonUpdateStopClick;
+ ButtonUpdate.Caption := GetLangStr('StopButton');
+ ButtonUpdate.Hint := 'StopButton';
+ ButtonSettings.Enabled := False;
+ CBIMClientType.Enabled := False;
+ CBDBType.Enabled := False;
+end;
+
+procedure TMainForm.CBDBTypeChange(Sender: TObject);
+begin
+ DBType := CBDBType.Items[CBDBType.ItemIndex];
+end;
+
+procedure TMainForm.CBIMClientTypeChange(Sender: TObject);
+begin
+ IMClientType := CBIMClientType.Items[CBIMClientType.ItemIndex];
+end;
+
+{ Смена языка }
+procedure TMainForm.CBLangChange(Sender: TObject);
+begin
+ FLanguage := CBLang.Items[CBLang.ItemIndex];
+ DefaultLanguage := CBLang.Items[CBLang.ItemIndex];
+ CoreLanguageChanged;
+end;
+
+{ Процедура поиска языковых файлов и заполнения списка }
+procedure TMainForm.FindLangFile;
+var
+ SR: TSearchRec;
+ I: Integer;
+begin
+ CBLang.Items.Clear;
+ if FindFirst(PluginPath + dirLangs + '\*.*', faAnyFile or faDirectory, SR) = 0 then
+ begin
+ repeat
+ if (SR.Attr = faDirectory) and ((SR.Name = '.') or (SR.Name = '..')) then // Чтобы не было файлов . и ..
+ begin
+ Continue; // Продолжаем цикл
+ end;
+ if MatchStrings(SR.Name, '*.xml') then
+ begin
+ // Заполняем лист
+ CBLang.Items.Add(ExtractFileNameEx(SR.Name, False));
+ end;
+ until FindNext(SR) <> 0;
+ FindClose(SR);
+ end;
+ if CBLang.Items.Count > 0 then
+ begin
+ for I := 0 to CBLang.Items.Count-1 do
+ begin
+ if CBLang.Items[I] = CoreLanguage then
+ CBLang.ItemIndex := I;
+ end;
+ end
+ else
+ begin
+ CBLang.Items.Add(GetLangStr('NotFoundLangFile'));
+ CBLang.ItemIndex := 0;
+ CBLang.Enabled := False;
+ end;
+end;
+
+{ Смена языка интерфейса по событию WM_LANGUAGECHANGED }
+procedure TMainForm.OnLanguageChanged(var Msg: TMessage);
+begin
+ LoadLanguageStrings;
+end;
+
+{ Функция для мультиязыковой поддержки }
+procedure TMainForm.CoreLanguageChanged;
+var
+ LangFile: String;
+begin
+ if CoreLanguage = '' then
+ Exit;
+ try
+ LangFile := PluginPath + dirLangs + CoreLanguage + '.xml';
+ if FileExists(LangFile) then
+ LangDoc.LoadFromFile(LangFile)
+ else
+ begin
+ if FileExists(PluginPath + dirLangs + defaultLangFile) then
+ LangDoc.LoadFromFile(PluginPath + dirLangs + defaultLangFile)
+ else
+ begin
+ MsgDie(ProgramsName, 'Not found any language file!');
+ Exit;
+ end;
+ end;
+ Global.CoreLanguage := CoreLanguage;
+ SendMessage(MainFormHandle, WM_LANGUAGECHANGED, 0, 0);
+ //SendMessage(AboutFormHandle, WM_LANGUAGECHANGED, 0, 0);
+ except
+ on E: Exception do
+ MsgDie(ProgramsName, 'Error on CoreLanguageChanged: ' + E.Message + sLineBreak +
+ 'CoreLanguage: ' + CoreLanguage);
+ end;
+end;
+
+{ Для мультиязыковой поддержки }
+procedure TMainForm.LoadLanguageStrings;
+begin
+ if IMClientType <> 'Unknown' then
+ Caption := ProgramsName + ' for ' + IMClientType + ' (' + MyAccount + ')'
+ else
+ Caption := ProgramsName;
+ if ButtonUpdate.Hint = 'UpdateButton' then
+ begin
+ ButtonUpdate.Caption := GetLangStr('UpdateButton');
+ ButtonUpdate.Hint := 'UpdateButton';
+ end
+ else
+ begin
+ ButtonUpdate.Caption := GetLangStr('StopButton');
+ ButtonUpdate.Hint := 'StopButton';
+ end;
+ ButtonSettings.Caption := GetLangStr('SettingsButton');
+ LIMClientType.Caption := GetLangStr('IMClientType');
+ LDBType.Caption := GetLangStr('LDBType');
+ LLanguage.Caption := GetLangStr('Language');
+ TabSheetSettings.Caption := GetLangStr('GeneralSettings');
+ TabSheetConnectSettings.Caption := GetLangStr('ConnectionSettings');
+ TabSheetLog.Caption := GetLangStr('Logs');
+ GBSettings.Caption := GetLangStr('GeneralSettings');
+ GBConnectSettings.Caption := GetLangStr('ConnectionSettings');
+ CBUseProxy.Caption := GetLangStr('UseProxy');
+ LProxyAddress.Caption := GetLangStr('ProxyAddress');
+ LProxyPort.Caption := GetLangStr('ProxyPort');
+ CBProxyAuth.Caption := GetLangStr('ProxyAuth');
+ LProxyUser.Caption := GetLangStr('ProxyUser');
+ LProxyUserPasswd.Caption := GetLangStr('ProxyUserPasswd');
+ EProxyAddress.Left := LProxyAddress.Left + LProxyAddress.Width + 5;
+ LProxyPort.Left := EProxyAddress.Left + EProxyAddress.Width + 5;
+ EProxyPort.Left := LProxyPort.Left + LProxyPort.Width + 5;
+ GBUpdater.Caption := GetLangStr('Update');
+ LStatus.Caption := GetLangStr(LStatus.Hint);
+ LAmountDesc.Caption := GetLangStr('Amount');
+ LSpeedDesc.Caption := GetLangStr('Speed');
+ LFileNameDesc.Caption := GetLangStr('FileName');
+ LFileDesc.Caption := GetLangStr('FileDesc');
+ LAmount.Left := LAmountDesc.Left + LAmountDesc.Width + 5;
+ LSpeed.Left := LSpeedDesc.Left + LSpeedDesc.Width + 5;
+ LFileName.Left := LFileNameDesc.Left + LFileNameDesc.Width + 5;
+ LFileDescription.Left := LFileDesc.Left + LFileDesc.Width + 5;
+ if ButtonSettings.Enabled then
+ begin
+ LFileName.Caption := GetLangStr('Unknown');
+ LFileDescription.Caption := GetLangStr('Unknown');
+ LFileMD5.Caption := GetLangStr('Unknown');
+ end;
+end;
+
+function TMainForm.EndTask(TaskName, FormName: String): Boolean;
+begin
+ Result := False;
+ if IsProcessRun(TaskName, FormName) then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('InMemoryFoundProcess'), [TaskName, IntToStr(GetProcessID(TaskName))]));
+ LogMemo.Lines.Add(GetLangStr('SendExitCommand'));
+ OnSendMessageToOneComponent(FormName, '009');
+ Sleep(1200);
+ LogMemo.Lines.Add(Format(GetLangStr('SearchProcessInMemory'), [TaskName]));
+ if IsProcessRun(TaskName, FormName) then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('InMemoryFoundProcess'), [TaskName, IntToStr(GetProcessID(TaskName))]));
+ LogMemo.Lines.Add(Format(GetLangStr('KillProcess'), [TaskName]));
+ if KillTask(TaskName, FormName) = 1 then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('KillProcessDone'), [TaskName]));
+ Result := True;
+ end
+ else
+ begin
+ if Global_IMProcessPID <> 0 then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('NotKillProcess'), [TaskName]));
+ LogMemo.Lines.Add(Format(GetLangStr('SeDebugPrivilege'), [TaskName]));
+ if ProcessTerminate(Global_IMProcessPID) then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('SeDebugPrivilegeDone'), [TaskName]));
+ Result := True;
+ end
+ else
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('NotKillSeDebugPrivilege'), [TaskName]));
+ Result := False;
+ end;
+ end;
+ end;
+ end
+ else
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('InMemoryNotFoundProcess'), [TaskName]));
+ Result := True;
+ end;
+ end
+ else
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('InMemoryNotFoundProcess'), [TaskName]));
+ Result := True;
+ end;
+end;
+
+{ Прием управляющих команд от плагина по событию WM_COPYDATA }
+procedure TMainForm.OnControlReq(var Msg : TWMCopyData);
+var
+ ControlStr, EncryptControlStr: String;
+ copyDataType : TCopyDataType;
+ GotChars: Integer;
+begin
+ copyDataType := TCopyDataType(Msg.CopyDataStruct.dwData);
+ if copyDataType = cdtString then
+ begin
+ GotChars := Msg.CopyDataStruct.cbData div SizeOf(Char);
+ SetLength(EncryptControlStr, GotChars);
+ Move(Msg.CopyDataStruct.lpData^, PChar(EncryptControlStr)^, GotChars * sizeof(Char));
+ if EnableDebug then WriteInLog(ProfilePath, FormatDateTime('dd.mm.yy hh:mm:ss', Now) + ' - Процедура OnControlReq: Получено шифрованное управляющее сообщение: ' + EncryptControlStr, 1);
+ ControlStr := DecryptStr(EncryptControlStr);
+ if EnableDebug then WriteInLog(ProfilePath, FormatDateTime('dd.mm.yy hh:mm:ss', Now) + ' - Процедура OnControlReq: Управляющее сообщение расшифровано: ' + ControlStr, 1);
+ //Msg.Result := 2006;
+ if ControlStr = 'Russian' then
+ begin
+ FLanguage := 'Russian';
+ CoreLanguageChanged;
+ end
+ else if ControlStr = 'English' then
+ begin
+ FLanguage := 'English';
+ CoreLanguageChanged;
+ end;
+ // 001 - Перечитать настройки из файла HistoryToDB.ini
+ if ControlStr = '001' then
+ begin
+ // Читаем настройки
+ LoadINI(ProfilePath, true);
+ end;
+ // 004 - Режим Анти-босс
+ if ControlStr = '0040' then // Показать формы
+ AntiBoss(False);
+ if ControlStr = '0041' then // Скрыть формы
+ AntiBoss(True);
+ // 003 - Выход из программы
+ {if (ControlStr = '003') and (ButtonUpdate.Enabled) then
+ Close;}
+ // 009 - Экстренный выход из программы
+ if ControlStr = '009' then
+ begin
+ IMDownloader1.BreakDownload;
+ Close;
+ end;
+ end;
+end;
+
+{ Поддержка режима Анти-босс }
+procedure TMainForm.AntiBoss(HideAllForms: Boolean);
+begin
+ if not Assigned(MainForm) then Exit;
+ if HideAllForms then
+ begin
+ ShowWindow(MainForm.Handle, SW_HIDE);
+ MainForm.Hide;
+ //ShowWindow(AboutForm.Handle, SW_HIDE);
+ //AboutForm.Hide;
+ end
+ else
+ begin
+ // Если форма была ранее открыта, то показываем её
+ if Global_MainForm_Showing then
+ begin
+ ShowWindow(MainForm.Handle, SW_SHOW);
+ MainForm.Show;
+ // Если форма свернута, то разворачиваем её поверх всех окон
+ if MainForm.WindowState = wsMinimized then
+ begin
+ MainForm.FormStyle := fsStayOnTop;
+ MainForm.WindowState := wsNormal;
+ MainForm.FormStyle := fsNormal;
+ end;
+ if MainForm.WindowState = wsNormal then
+ begin
+ MainForm.FormStyle := fsStayOnTop;
+ MainForm.FormStyle := fsNormal;
+ end;
+ end;
+ {if Global_AboutForm_Showing then
+ begin
+ ShowWindow(AboutForm.Handle, SW_SHOW);
+ AboutForm.Show;
+ end;}
+ end;
+end;
+
+procedure TMainForm.RunIMClient(IMClientName: String; IMProcessArray: TProcessInfoArray);
+var
+ i: Integer;
+begin
+ for i := Low(IMProcessArray) to High(IMProcessArray) do
+ begin
+ if LowerCase(IMClientName) = LowerCase(IMProcessArray[i].ProcessName) then
+ begin
+ if FileExists(IMProcessArray[i].ProcessPath) then
+ begin
+ LogMemo.Lines.Add(Format(GetLangStr('StartProgram'), [IMProcessArray[i].ProcessPath + IMProcessArray[i].ProcessParamCmd]));
+ ShellExecute(0, 'open', PWideChar(IMProcessArray[i].ProcessPath), PWideChar(' '+IMProcessArray[i].ProcessParamCmd), nil, SW_SHOWNORMAL);
+ Sleep(500);
+ if IsProcessRun(IMProcessArray[i].ProcessName) then
+ LogMemo.Lines.Add(Format(GetLangStr('StartProgramDone'), [IMProcessArray[i].ProcessPath]))
+ else
+ LogMemo.Lines.Add(Format(GetLangStr('StartProgramFail'), [IMProcessArray[i].ProcessPath]));
+ end;
+ end;
+ end;
+end;
+
+procedure TMainForm.RunAllIMClients;
+begin
+ if IMClientType = 'QIP' then
+ RunIMClient('qip.exe', QIPProcessInfo);
+ if (IMClientType = 'Miranda') or (IMClientType = 'MirandaNG') then
+ {$IfDef WIN32}
+ RunIMClient('miranda32.exe', MirandaProcessInfo);
+ {$Else}
+ RunIMClient('miranda64.exe', MirandaProcessInfo);
+ {$EndIf}
+ if IMClientType = 'RnQ' then
+ begin
+ RunIMClient('R&Q.exe', RnQProcessInfo);
+ RunIMClient('rnq.exe', RnQProcessInfo);
+ end;
+ if IMClientType = 'Skype' then
+ begin
+ if SystemLang = 'Russian' then
+ begin
+ if FileExists(PluginPath + 'installupdater-ru.cmd') then
+ ShellExecute(0, 'open', PWideChar(PluginPath + 'installupdater-ru.cmd'), nil, nil, SW_HIDE)
+ else
+ RunIMClient('skype.exe', SkypeProcessInfo);
+ end
+ else
+ begin
+ if FileExists(PluginPath + 'installupdater-en.cmd') then
+ ShellExecute(0, 'open', PWideChar(PluginPath + 'installupdater-en.cmd'), nil, nil, SW_HIDE)
+ else
+ RunIMClient('skype.exe', SkypeProcessInfo);
+ end;
+ end;
+ // Запуск Dropbox
+ {if not IsProcessRun('Dropbox.exe') then
+ RunIMClient('Dropbox.exe', DropboxProcessInfo);}
+end;
+
+function CopyProgressFunc(TotalFileSize: Int64; TotalBytesTransferred: Int64;
+ StreamSize: Int64; StreamBytesTransferred: Int64; dwStreamNumber: DWORD;
+ dwCallbackReason: DWORD; hSourceFile: THandle; hDestinationFile: THandle;
+ lpData: Pointer): DWORD; stdcall;
+begin
+ MainForm.ProgressBarDownloads.Position := 100 * TotalBytesTransferred div TotalFileSize;
+ Application.ProcessMessages;
+ CopyProgressFunc := PROGRESS_CONTINUE;
+end;
+
+end.
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/NTNative.pas b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/NTNative.pas
new file mode 100644
index 0000000000..0f6a2bd831
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/NTNative.pas
@@ -0,0 +1,210 @@
+unit NTNative;
+
+interface
+
+uses Classes, SysUtils, Windows;
+
+type
+ Pointer32 = ULONG;
+ THANDLE32 = ULONG;
+
+ _UNICODE_STRING = record
+ Length: Word;
+ MaximumLength: Word;
+ Buffer: LPWSTR;
+ end;
+ UNICODE_STRING = _UNICODE_STRING;
+
+ //http://msdn.microsoft.com/en-us/library/windows/desktop/ms684280%28v=vs.85%29.aspx
+ PROCESS_BASIC_INFORMATION = record
+ Reserved1 : Pointer;
+ PebBaseAddress: Pointer;
+ Reserved2: array [0..1] of Pointer;
+ UniqueProcessId: ULONG_PTR;
+ Reserved3: Pointer;
+ end;
+
+
+ //http://undocumented.ntinternals.net/UserMode/Structures/RTL_DRIVE_LETTER_CURDIR.html
+ _RTL_DRIVE_LETTER_CURDIR = record
+ Flags: Word;
+ Length: Word;
+ TimeStamp: ULONG;
+ DosPath: UNICODE_STRING;
+ end;
+ RTL_DRIVE_LETTER_CURDIR = _RTL_DRIVE_LETTER_CURDIR;
+
+ _CURDIR = record
+ DosPath: UNICODE_STRING;
+ Handle: THANDLE;
+ end;
+ CURDIR = _CURDIR;
+
+ //http://undocumented.ntinternals.net/UserMode/Structures/RTL_USER_PROCESS_PARAMETERS.html
+ _RTL_USER_PROCESS_PARAMETERS = record
+ MaximumLength: ULONG;
+ Length: ULONG;
+ Flags: ULONG;
+ DebugFlags: ULONG;
+ ConsoleHandle: THANDLE;
+ ConsoleFlags: ULONG;
+ StandardInput: THANDLE;
+ StandardOutput: THANDLE;
+ StandardError: THANDLE;
+ CurrentDirectory: CURDIR;
+ DllPath: UNICODE_STRING;
+ ImagePathName: UNICODE_STRING;
+ CommandLine: UNICODE_STRING;
+ Environment: Pointer;
+ StartingX: ULONG;
+ StartingY: ULONG;
+ CountX: ULONG;
+ CountY: ULONG;
+ CountCharsX: ULONG;
+ CountCharsY: ULONG;
+ FillAttribute: ULONG;
+ WindowFlags: ULONG;
+ ShowWindowFlags: ULONG;
+ WindowTitle: UNICODE_STRING;
+ DesktopInfo: UNICODE_STRING;
+ ShellInfo: UNICODE_STRING;
+ RuntimeData: UNICODE_STRING;
+ CurrentDirectories: array[0..31] of RTL_DRIVE_LETTER_CURDIR;
+ end;
+ RTL_USER_PROCESS_PARAMETERS = _RTL_USER_PROCESS_PARAMETERS;
+ PRTL_USER_PROCESS_PARAMETERS = ^RTL_USER_PROCESS_PARAMETERS;
+
+ _PEB = record
+ Reserved1 : array [0..1] of Byte;
+ BeingDebugged : Byte;
+ Reserved2 : Byte;
+ Reserved3 : array [0..1] of Pointer;
+ Ldr : Pointer;
+ ProcessParameters : PRTL_USER_PROCESS_PARAMETERS;
+ Reserved4 : array [0..102] of Byte;
+ Reserved5 : array [0..51] of Pointer;
+ PostProcessInitRoutine : Pointer;
+ Reserved6 : array [0..127] of byte;
+ Reserved7 : Pointer;
+ SessionId : ULONG;
+ end;
+ PEB=_PEB;
+
+{$IFDEF CPUX64}
+ _UNICODE_STRING32 = record
+ Length: Word;
+ MaximumLength: Word;
+ Buffer: Pointer32;
+ end;
+ UNICODE_STRING32 = _UNICODE_STRING32;
+
+ _RTL_DRIVE_LETTER_CURDIR32 = record
+ Flags: Word;
+ Length: Word;
+ TimeStamp: ULONG;
+ DosPath: UNICODE_STRING32;
+ end;
+ RTL_DRIVE_LETTER_CURDIR32 = _RTL_DRIVE_LETTER_CURDIR32;
+
+ _CURDIR32 = record
+ DosPath: UNICODE_STRING32;
+ Handle: THANDLE32;
+ end;
+ CURDIR32 = _CURDIR32;
+
+ _RTL_USER_PROCESS_PARAMETERS32 = record
+ MaximumLength: ULONG;
+ Length: ULONG;
+ Flags: ULONG;
+ DebugFlags: ULONG;
+ ConsoleHandle: THANDLE32;
+ ConsoleFlags: ULONG;
+ StandardInput: THANDLE32;
+ StandardOutput: THANDLE32;
+ StandardError: THANDLE32;
+ CurrentDirectory: CURDIR32;
+ DllPath: UNICODE_STRING32;
+ ImagePathName: UNICODE_STRING32;
+ CommandLine: UNICODE_STRING32;
+ Environment: Pointer32;
+ StartingX: ULONG;
+ StartingY: ULONG;
+ CountX: ULONG;
+ CountY: ULONG;
+ CountCharsX: ULONG;
+ CountCharsY: ULONG;
+ FillAttribute: ULONG;
+ WindowFlags: ULONG;
+ ShowWindowFlags: ULONG;
+ WindowTitle: UNICODE_STRING32;
+ DesktopInfo: UNICODE_STRING32;
+ ShellInfo: UNICODE_STRING32;
+ RuntimeData: UNICODE_STRING32;
+ CurrentDirectories: array[0..31] of RTL_DRIVE_LETTER_CURDIR32;
+ end;
+ RTL_USER_PROCESS_PARAMETERS32 = _RTL_USER_PROCESS_PARAMETERS32;
+ PRTL_USER_PROCESS_PARAMETERS32 = ^RTL_USER_PROCESS_PARAMETERS32;
+
+ _PEB32 = record
+ Reserved1 : array [0..1] of Byte;
+ BeingDebugged : Byte;
+ Reserved2 : Byte;
+ Reserved3 : array [0..1] of Pointer32;
+ Ldr : Pointer32;
+ ProcessParameters : Pointer32;//PRTL_USER_PROCESS_PARAMETERS;
+ Reserved4 : array [0..102] of Byte;
+ Reserved5 : array [0..51] of Pointer32;
+ PostProcessInitRoutine : Pointer32;
+ Reserved6 : array [0..127] of byte;
+ Reserved7 : Pointer32;
+ SessionId : ULONG;
+ end;
+ PEB32=_PEB32;
+{$ENDIF}
+
+type
+ TIsWow64Process = function(Handle:THandle; var IsWow64 : BOOL) : BOOL; stdcall;
+var
+ _IsWow64Process : TIsWow64Process;
+
+function NtQueryInformationProcess(ProcessHandle : THandle; ProcessInformationClass : DWORD; ProcessInformation : Pointer; ProcessInformationLength : ULONG; ReturnLength : PULONG ): LongInt; stdcall; external 'ntdll.dll';
+function NtQueryVirtualMemory(ProcessHandle : THandle; BaseAddress : Pointer; MemoryInformationClass : DWORD; MemoryInformation : Pointer; MemoryInformationLength : ULONG; ReturnLength : PULONG ): LongInt; stdcall; external 'ntdll.dll';
+function ProcessIsX64(hProcess: DWORD): Boolean;
+procedure Init_IsWow64Process;
+
+implementation
+
+procedure Init_IsWow64Process;
+var
+ hKernel32 : Integer;
+begin
+ hKernel32 := LoadLibrary(kernel32);
+ if (hKernel32 = 0) then RaiseLastOSError;
+ try
+ _IsWow64Process := GetProcAddress(hkernel32, 'IsWow64Process');
+ finally
+ FreeLibrary(hKernel32);
+ end;
+end;
+
+function ProcessIsX64(hProcess: DWORD): Boolean;
+var
+ IsWow64: BOOL;
+begin
+ Result := False;
+ {$IFNDEF CPUX64}
+ Exit;
+ {$ENDIF}
+ if not Assigned(_IsWow64Process) then
+ Init_IsWow64Process;
+
+ if Assigned(_IsWow64Process) then
+ begin
+ if (_IsWow64Process(hProcess, IsWow64)) then
+ Result := not IsWow64
+ else
+ RaiseLastOSError;
+ end;
+end;
+
+end.
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/jedi.inc b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/jedi.inc
new file mode 100644
index 0000000000..c31a08c04a
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/jedi.inc
@@ -0,0 +1,1430 @@
+{$IFNDEF JEDI_INC}
+{$DEFINE JEDI_INC}
+
+{**************************************************************************************************}
+{ }
+{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");}
+{ you may not use this file except in compliance with the License. You may obtain a copy of the }
+{ License at http://www.mozilla.org/MPL/ }
+{ }
+{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF }
+{ ANY KIND, either express or implied. See the License for the specific language governing rights }
+{ and limitations under the License. }
+{ }
+{ The Original Code is: jedi.inc. }
+{ The Initial Developer of the Original Code is Project JEDI http://www.delphi-jedi.org }
+{ }
+{ Alternatively, the contents of this file may be used under the terms of the GNU Lesser General }
+{ Public License (the "LGPL License"), in which case the provisions of the LGPL License are }
+{ applicable instead of those above. If you wish to allow use of your version of this file only }
+{ under the terms of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting the provisions above and replace them with }
+{ the notice and other provisions required by the LGPL License. If you do not delete the }
+{ provisions above, a recipient may use your version of this file under either the MPL or the }
+{ LGPL License. }
+{ }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{ }
+{**************************************************************************************************}
+{ }
+{ This file defines various generic compiler directives used in different libraries, e.g. in the }
+{ JEDI Code Library (JCL) and JEDI Visual Component Library Library (JVCL). The directives in }
+{ this file are of generic nature and consist mostly of mappings from the VERXXX directives }
+{ defined by Delphi, C++Builder and FPC to friendly names such as DELPHI5 and }
+{ SUPPORTS_WIDESTRING. These friendly names are subsequently used in the libraries to test for }
+{ compiler versions and/or whether the compiler supports certain features (such as widestrings or }
+{ 64 bit integers. The libraries provide an additional, library specific, include file. For the }
+{ JCL e.g. this is jcl.inc. These files should be included in source files instead of this file }
+{ (which is pulled in automatically). }
+{ }
+{**************************************************************************************************}
+{ }
+{ Last modified: $Date:: 2012-09-04 16:01:38 +0200 (Гєt, 04 9 2012) $ }
+{ Revision: $Rev:: 161 $ }
+{ Author: $Author:: outchy $ }
+{ }
+{**************************************************************************************************}
+
+(*
+
+- Development environment directives
+
+ This file defines two directives to indicate which development environment the
+ library is being compiled with. Currently this can either be Delphi, Kylix,
+ C++Builder or FPC.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ DELPHI Defined if compiled with Delphi
+ KYLIX Defined if compiled with Kylix
+ DELPHICOMPILER Defined if compiled with Delphi or Kylix/Delphi
+ BCB Defined if compiled with C++Builder
+ CPPBUILDER Defined if compiled with C++Builder (alias for BCB)
+ BCBCOMPILER Defined if compiled with C++Builder or Kylix/C++
+ DELPHILANGUAGE Defined if compiled with Delphi, Kylix or C++Builder
+ BORLAND Defined if compiled with Delphi, Kylix or C++Builder
+ FPC Defined if compiled with FPC
+
+- Platform Directives
+
+ Platform directives are not all explicitly defined in this file, some are
+ defined by the compiler itself. They are listed here only for completeness.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ WIN32 Defined when target platform is 32 bit Windows
+ WIN64 Defined when target platform is 64 bit Windows
+ MSWINDOWS Defined when target platform is 32 bit Windows
+ LINUX Defined when target platform is Linux
+ UNIX Defined when target platform is Unix-like (including Linux)
+ CLR Defined when target platform is .NET
+
+- Architecture directives. These are auto-defined by FPC
+ CPU32 and CPU64 are mostly for generic pointer size dependant differences rather
+ than for a specific architecture.
+
+ CPU386 Defined when target platform is native x86 (win32)
+ CPUx86_64 Defined when target platform is native x86_64 (win64)
+ CPU32 Defined when target is 32-bit
+ CPU64 Defined when target is 64-bit
+ CPUASM Defined when target assembler is available
+
+- Visual library Directives
+
+ The following directives indicate for a visual library. In a Delphi/BCB
+ (Win32) application you need to define the VisualCLX symbol in the project
+ options, if you want to use the VisualCLX library. Alternatively you can use
+ the IDE expert, which is distributed with the JCL to do this automatically.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ VCL Defined for Delphi/BCB (Win32) exactly if VisualCLX is not defined
+ VisualCLX Defined for Kylix; needs to be defined for Delphi/BCB to
+ use JCL with VisualCLX applications.
+
+
+- Other cross-platform related defines
+
+ These symbols are intended to help in writing portable code.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ PUREPASCAL Code is machine-independent (as opposed to assembler code)
+ Win32API Code is specific for the Win32 API;
+ use instead of "{$IFNDEF CLR} {$IFDEF MSWINDOWS}" constructs
+
+
+- Delphi Versions
+
+ The following directives are direct mappings from the VERXXX directives to a
+ friendly name of the associated compiler. These directives are only defined if
+ the compiler is Delphi (ie DELPHI is defined).
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ DELPHI1 Defined when compiling with Delphi 1 (Codename WASABI/MANGO)
+ DELPHI2 Defined when compiling with Delphi 2 (Codename POLARIS)
+ DELPHI3 Defined when compiling with Delphi 3 (Codename IVORY)
+ DELPHI4 Defined when compiling with Delphi 4 (Codename ALLEGRO)
+ DELPHI5 Defined when compiling with Delphi 5 (Codename ARGUS)
+ DELPHI6 Defined when compiling with Delphi 6 (Codename ILLIAD)
+ DELPHI7 Defined when compiling with Delphi 7 (Codename AURORA)
+ DELPHI8 Defined when compiling with Delphi 8 (Codename OCTANE)
+ DELPHI2005 Defined when compiling with Delphi 2005 (Codename DIAMONDBACK)
+ DELPHI9 Alias for DELPHI2005
+ DELPHI10 Defined when compiling with Delphi 2006 (Codename DEXTER)
+ DELPHI2006 Alias for DELPHI10
+ DELPHI11 Defined when compiling with Delphi 2007 for Win32 (Codename SPACELY)
+ DELPHI2007 Alias for DELPHI11
+ DELPHI12 Defined when compiling with Delphi 2009 for Win32 (Codename TIBURON)
+ DELPHI2009 Alias for DELPHI12
+ DELPHI14 Defined when compiling with Delphi 2010 for Win32 (Codename WEAVER)
+ DELPHI2010 Alias for DELPHI14
+ DELPHI15 Defined when compiling with Delphi XE for Win32 (Codename FULCRUM)
+ DELPHIXE Alias for DELPHI15
+ DELPHI16 Defined when compiling with Delphi XE2 for Win32 (Codename PULSAR)
+ DELPHIXE2 Alias for DELPHI16
+ DELPHI17 Defined when compiling with Delphi XE3 for Win32 (Codename WATERDRAGON)
+ DELPHIXE3 Alias for DELPHI17
+ DELPHI1_UP Defined when compiling with Delphi 1 or higher
+ DELPHI2_UP Defined when compiling with Delphi 2 or higher
+ DELPHI3_UP Defined when compiling with Delphi 3 or higher
+ DELPHI4_UP Defined when compiling with Delphi 4 or higher
+ DELPHI5_UP Defined when compiling with Delphi 5 or higher
+ DELPHI6_UP Defined when compiling with Delphi 6 or higher
+ DELPHI7_UP Defined when compiling with Delphi 7 or higher
+ DELPHI8_UP Defined when compiling with Delphi 8 or higher
+ DELPHI2005_UP Defined when compiling with Delphi 2005 or higher
+ DELPHI9_UP Alias for DELPHI2005_UP
+ DELPHI10_UP Defined when compiling with Delphi 2006 or higher
+ DELPHI2006_UP Alias for DELPHI10_UP
+ DELPHI11_UP Defined when compiling with Delphi 2007 for Win32 or higher
+ DELPHI2007_UP Alias for DELPHI11_UP
+ DELPHI12_UP Defined when compiling with Delphi 2009 for Win32 or higher
+ DELPHI2009_UP Alias for DELPHI12_UP
+ DELPHI14_UP Defined when compiling with Delphi 2010 for Win32 or higher
+ DELPHI2010_UP Alias for DELPHI14_UP
+ DELPHI15_UP Defined when compiling with Delphi XE for Win32 or higher
+ DELPHIXE_UP Alias for DELPHI15_UP
+ DELPHI16_UP Defined when compiling with Delphi XE2 for Win32 or higher
+ DELPHIXE2_UP Alias for DELPHI16_UP
+ DELPHI17_UP Defined when compiling with Delphi XE3 for Win32 or higher
+ DELPHIXE3_UP Alias for DELPHI17_UP
+
+
+- Kylix Versions
+
+ The following directives are direct mappings from the VERXXX directives to a
+ friendly name of the associated compiler. These directives are only defined if
+ the compiler is Kylix (ie KYLIX is defined).
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ KYLIX1 Defined when compiling with Kylix 1
+ KYLIX2 Defined when compiling with Kylix 2
+ KYLIX3 Defined when compiling with Kylix 3 (Codename CORTEZ)
+ KYLIX1_UP Defined when compiling with Kylix 1 or higher
+ KYLIX2_UP Defined when compiling with Kylix 2 or higher
+ KYLIX3_UP Defined when compiling with Kylix 3 or higher
+
+
+- Delphi Compiler Versions (Delphi / Kylix, not in BCB mode)
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ DELPHICOMPILER1 Defined when compiling with Delphi 1
+ DELPHICOMPILER2 Defined when compiling with Delphi 2
+ DELPHICOMPILER3 Defined when compiling with Delphi 3
+ DELPHICOMPILER4 Defined when compiling with Delphi 4
+ DELPHICOMPILER5 Defined when compiling with Delphi 5
+ DELPHICOMPILER6 Defined when compiling with Delphi 6 or Kylix 1, 2 or 3
+ DELPHICOMPILER7 Defined when compiling with Delphi 7
+ DELPHICOMPILER8 Defined when compiling with Delphi 8
+ DELPHICOMPILER9 Defined when compiling with Delphi 2005
+ DELPHICOMPILER10 Defined when compiling with Delphi Personality of BDS 4.0
+ DELPHICOMPILER11 Defined when compiling with Delphi 2007 for Win32
+ DELPHICOMPILER12 Defined when compiling with Delphi Personality of BDS 6.0
+ DELPHICOMPILER14 Defined when compiling with Delphi Personality of BDS 7.0
+ DELPHICOMPILER15 Defined when compiling with Delphi Personality of BDS 8.0
+ DELPHICOMPILER16 Defined when compiling with Delphi Personality of BDS 9.0
+ DELPHICOMPILER17 Defined when compiling with Delphi Personality of BDS 10.0
+ DELPHICOMPILER1_UP Defined when compiling with Delphi 1 or higher
+ DELPHICOMPILER2_UP Defined when compiling with Delphi 2 or higher
+ DELPHICOMPILER3_UP Defined when compiling with Delphi 3 or higher
+ DELPHICOMPILER4_UP Defined when compiling with Delphi 4 or higher
+ DELPHICOMPILER5_UP Defined when compiling with Delphi 5 or higher
+ DELPHICOMPILER6_UP Defined when compiling with Delphi 6 or Kylix 1, 2 or 3 or higher
+ DELPHICOMPILER7_UP Defined when compiling with Delphi 7 or higher
+ DELPHICOMPILER8_UP Defined when compiling with Delphi 8 or higher
+ DELPHICOMPILER9_UP Defined when compiling with Delphi 2005
+ DELPHICOMPILER10_UP Defined when compiling with Delphi 2006 or higher
+ DELPHICOMPILER11_UP Defined when compiling with Delphi 2007 for Win32 or higher
+ DELPHICOMPILER12_UP Defined when compiling with Delphi 2009 for Win32 or higher
+ DELPHICOMPILER14_UP Defined when compiling with Delphi 2010 for Win32 or higher
+ DELPHICOMPILER15_UP Defined when compiling with Delphi XE for Win32 or higher
+ DELPHICOMPILER16_UP Defined when compiling with Delphi XE2 for Win32 or higher
+ DELPHICOMPILER17_UP Defined when compiling with Delphi XE3 for Win32 or higher
+
+
+- C++Builder Versions
+
+ The following directives are direct mappings from the VERXXX directives to a
+ friendly name of the associated compiler. These directives are only defined if
+ the compiler is C++Builder (ie BCB is defined).
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ BCB1 Defined when compiling with C++Builder 1
+ BCB3 Defined when compiling with C++Builder 3
+ BCB4 Defined when compiling with C++Builder 4
+ BCB5 Defined when compiling with C++Builder 5 (Codename RAMPAGE)
+ BCB6 Defined when compiling with C++Builder 6 (Codename RIPTIDE)
+ BCB10 Defined when compiling with C++Builder Personality of BDS 4.0 (also known as C++Builder 2006) (Codename DEXTER)
+ BCB11 Defined when compiling with C++Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) (Codename COGSWELL)
+ BCB12 Defined when compiling with C++Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) (Codename TIBURON)
+ BCB14 Defined when compiling with C++Builder Personality of RAD Studio 2010 (also known as C++Builder 2010) (Codename WEAVER)
+ BCB15 Defined when compiling with C++Builder Personality of RAD Studio XE (also known as C++Builder XE) (Codename FULCRUM)
+ BCB16 Defined when compiling with C++Builder Personality of RAD Studio XE2 (also known as C++Builder XE2) (Codename PULSAR)
+ BCB17 Defined when compiling with C++Builder Personality of RAD Studio XE3 (also known as C++Builder XE3) (Codename WATERDRAGON)
+ BCB1_UP Defined when compiling with C++Builder 1 or higher
+ BCB3_UP Defined when compiling with C++Builder 3 or higher
+ BCB4_UP Defined when compiling with C++Builder 4 or higher
+ BCB5_UP Defined when compiling with C++Builder 5 or higher
+ BCB6_UP Defined when compiling with C++Builder 6 or higher
+ BCB10_UP Defined when compiling with C++Builder Personality of BDS 4.0 or higher
+ BCB11_UP Defined when compiling with C++Builder Personality of RAD Studio 2007 or higher
+ BCB12_UP Defined when compiling with C++Builder Personality of RAD Studio 2009 or higher
+ BCB14_UP Defined when compiling with C++Builder Personality of RAD Studio 2010 or higher
+ BCB15_UP Defined when compiling with C++Builder Personality of RAD Studio XE or higher
+ BCB16_UP Defined when compiling with C++Builder Personality of RAD Studio XE2 or higher
+ BCB17_UP Defined when compiling with C++Builder Personality of RAD Studio XE3 or higher
+
+
+- RAD Studio / Borland Developer Studio Versions
+
+ The following directives are direct mappings from the VERXXX directives to a
+ friendly name of the associated IDE. These directives are only defined if
+ the IDE is Borland Developer Studio Version 2 or above.
+
+ Note: Borland Developer Studio 2006 is marketed as Delphi 2006 or C++Builder 2006,
+ but those provide only different labels for identical content.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ BDS Defined when compiling with BDS version of dcc32.exe (Codename SIDEWINDER)
+ BDS2 Defined when compiling with BDS 2.0 (Delphi 8) (Codename OCTANE)
+ BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) (Codename DIAMONDBACK)
+ BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) (Codename DEXTER)
+ BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) (Codename HIGHLANDER)
+ BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) (Codename TIBURON)
+ BDS7 Defined when compiling with BDS 7.0 (Embarcadero RAD Studio 2010) (Codename WEAVER)
+ BDS8 Defined when compiling with BDS 8.0 (Embarcadero RAD Studio XE) (Codename FULCRUM)
+ BDS9 Defined when compiling with BDS 9.0 (Embarcadero RAD Studio XE2) (Codename PULSAR)
+ BDS10 Defined when compiling with BDS 10.0 (Embarcadero RAD Studio XE3) (Codename WATERDRAGON)
+ BDS2_UP Defined when compiling with BDS 2.0 or higher
+ BDS3_UP Defined when compiling with BDS 3.0 or higher
+ BDS4_UP Defined when compiling with BDS 4.0 or higher
+ BDS5_UP Defined when compiling with BDS 5.0 or higher
+ BDS6_UP Defined when compiling with BDS 6.0 or higher
+ BDS7_UP Defined when compiling with BDS 7.0 or higher
+ BDS8_UP Defined when compiling with BDS 8.0 or higher
+ BDS9_UP Defined when compiling with BDS 9.0 or higher
+ BDS10_UP Defined when compiling with BDS 10.0 or higher
+
+- Compiler Versions
+
+ The following directives are direct mappings from the VERXXX directives to a
+ friendly name of the associated compiler. Unlike the DELPHI_X and BCB_X
+ directives, these directives are indepedent of the development environment.
+ That is, they are defined regardless of whether compilation takes place using
+ Delphi or C++Builder.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ COMPILER1 Defined when compiling with Delphi 1
+ COMPILER2 Defined when compiling with Delphi 2 or C++Builder 1
+ COMPILER3 Defined when compiling with Delphi 3
+ COMPILER35 Defined when compiling with C++Builder 3
+ COMPILER4 Defined when compiling with Delphi 4 or C++Builder 4
+ COMPILER5 Defined when compiling with Delphi 5 or C++Builder 5
+ COMPILER6 Defined when compiling with Delphi 6 or C++Builder 6
+ COMPILER7 Defined when compiling with Delphi 7
+ COMPILER8 Defined when compiling with Delphi 8
+ COMPILER9 Defined when compiling with Delphi 9
+ COMPILER10 Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0
+ COMPILER11 Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0
+ COMPILER12 Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0
+ COMPILER14 Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0
+ COMPILER15 Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0
+ COMPILER16 Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0
+ COMPILER17 Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0
+ COMPILER1_UP Defined when compiling with Delphi 1 or higher
+ COMPILER2_UP Defined when compiling with Delphi 2 or C++Builder 1 or higher
+ COMPILER3_UP Defined when compiling with Delphi 3 or higher
+ COMPILER35_UP Defined when compiling with C++Builder 3 or higher
+ COMPILER4_UP Defined when compiling with Delphi 4 or C++Builder 4 or higher
+ COMPILER5_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher
+ COMPILER6_UP Defined when compiling with Delphi 6 or C++Builder 6 or higher
+ COMPILER7_UP Defined when compiling with Delphi 7
+ COMPILER8_UP Defined when compiling with Delphi 8
+ COMPILER9_UP Defined when compiling with Delphi Personalities of BDS 3.0
+ COMPILER10_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher
+ COMPILER11_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher
+ COMPILER12_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher
+ COMPILER14_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher
+ COMPILER15_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher
+ COMPILER16_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher
+ COMPILER17_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher
+
+
+- RTL Versions
+
+ Use e.g. following to determine the exact RTL version since version 14.0:
+ {$IFDEF CONDITIONALEXPRESSIONS}
+ {$IF Declared(RTLVersion) and (RTLVersion >= 14.2)}
+ // code for Delphi 6.02 or higher, Kylix 2 or higher, C++Builder 6 or higher
+ ...
+ {$IFEND}
+ {$ENDIF}
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ RTL80_UP Defined when compiling with Delphi 1 or higher
+ RTL90_UP Defined when compiling with Delphi 2 or higher
+ RTL93_UP Defined when compiling with C++Builder 1 or higher
+ RTL100_UP Defined when compiling with Delphi 3 or higher
+ RTL110_UP Defined when compiling with C++Builder 3 or higher
+ RTL120_UP Defined when compiling with Delphi 4 or higher
+ RTL125_UP Defined when compiling with C++Builder 4 or higher
+ RTL130_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher
+ RTL140_UP Defined when compiling with Delphi 6, Kylix 1, 2 or 3 or C++Builder 6 or higher
+ RTL150_UP Defined when compiling with Delphi 7 or higher
+ RTL160_UP Defined when compiling with Delphi 8 or higher
+ RTL170_UP Defined when compiling with Delphi Personalities of BDS 3.0 or higher
+ RTL180_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher
+ RTL185_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher
+ RTL190_UP Defined when compiling with Delphi.NET of BDS 5.0 or higher
+ RTL200_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher
+ RTL210_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher
+ RTL220_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher
+ RTL230_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher
+ RTL240_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher
+
+
+- CLR Versions
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ CLR Defined when compiling for .NET
+ CLR10 Defined when compiling for .NET 1.0 (may be overriden by FORCE_CLR10)
+ CLR10_UP Defined when compiling for .NET 1.0 or higher
+ CLR11 Defined when compiling for .NET 1.1 (may be overriden by FORCE_CLR11)
+ CLR11_UP Defined when compiling for .NET 1.1 or higher
+ CLR20 Defined when compiling for .NET 2.0 (may be overriden by FORCE_CLR20)
+ CLR20_UP Defined when compiling for .NET 2.0 or higher
+
+
+- Feature Directives
+
+ The features directives are used to test if the compiler supports specific
+ features, such as method overloading, and adjust the sources accordingly. Use
+ of these directives is preferred over the use of the DELPHI and COMPILER
+ directives.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+)
+ SUPPORTS_SINGLE Compiler supports the Single type (D1+)
+ SUPPORTS_DOUBLE Compiler supports the Double type (D1+)
+ SUPPORTS_EXTENDED Compiler supports the Extended type (D1+)
+ SUPPORTS_CURRENCY Compiler supports the Currency type (D2+)
+ SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+)
+ SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+)
+ SUPPORTS_VARIANT Compiler supports variant (D2+)
+ SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+)
+ SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+)
+ SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+)
+ SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+)
+ SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC)
+ SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+)
+ SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+)
+ SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+)
+ SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+)
+ SUPPORTS_UINT64 Compiler supports the UInt64 type (D XE+ ?)
+ SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+)
+ SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+)
+ SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+)
+ SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+)
+ SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+)
+ SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+)
+ SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC)
+ SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+)
+ SUPPORTS_SETPEFLAGS Compiler supports the SetPEFlags directive (D6+/BCB6+)
+ SUPPORTS_EXPERIMENTAL_WARNINGS Compiler supports the WARN SYMBOL_EXPERIMENTAL and WARN UNIT_EXPERIMENTAL directives (D6+/BCB6+)
+ SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC)
+ SUPPORTS_FOR_IN Compiler supports for in loops (D9+)
+ SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+)
+ SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+)
+ SUPPORTS_REGION Compiler supports the REGION and ENDREGION directives (D9+)
+ SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+)
+ SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+)
+ SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+)
+ SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+)
+ SUPPORTS_CLASS_CTORDTORS Compiler supports class contructors/destructors (D14+)
+ SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+)
+ SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+)
+ SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+)
+ SUPPORTS_METHODINFO Compiler supports the METHODINFO directives (D10+)
+ SUPPORTS_GENERICS Compiler supports generic implementations (D11.NET, D12+)
+ SUPPORTS_DEPRECATED_DETAILS Compiler supports additional text for the deprecated directive (D11.NET, D12+)
+ ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC)
+ ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC)
+ ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+)
+ SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+)
+ SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+)
+ SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+)
+ SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+)
+ SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+)
+ SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+)
+ SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7)
+ SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive
+ SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive
+ SUPPORTS_PACKAGES Compiler supports Packages
+ HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86)
+ HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC)
+ HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC)
+ HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC)
+ HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC)
+ HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC)
+ HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC)
+ HAS_UNIT_HTTPPROD Unit HTTPProd exists (D9+)
+ HAS_UNIT_GIFIMG Unit GifImg exists (D11+)
+ HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+)
+ HAS_UNIT_PNGIMAGE Unit PngImage exists (D12+)
+ HAS_UNIT_CHARACTER Unit Character exists (D12+)
+ XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC)
+ SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.NET, D12+)
+ SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+)
+ SUPPORTS_INT_ALIASES Types Int8, Int16, Int32, UInt8, UInt16 and UInt32 are defined in the unit System (D12+)
+ HAS_UNIT_RTTI Unit RTTI is available (D14+)
+ SUPPORTS_CAST_INTERFACE_TO_OBJ The compiler supports casts from interfaces to objects (D14+)
+ SUPPORTS_DELAYED_LOADING The compiler generates stubs for delaying imported function loads (D14+)
+ HAS_UNIT_REGULAREXPRESSIONSAPI Unit RegularExpressionsAPI is available (D15+)
+ HAS_UNIT_SYSTEM_UITYPES Unit System.UITypes is available (D16+)
+ HAS_UNIT_SYSTEM_ACTIONS Unit System.Actions is available (D17+)
+
+
+- Compiler Settings
+
+ The compiler settings directives indicate whether a specific compiler setting
+ is in effect. This facilitates changing compiler settings locally in a more
+ compact and readible manner.
+
+ Directive Description
+ ------------------------------------------------------------------------------
+ ALIGN_ON Compiling in the A+ state (no alignment)
+ BOOLEVAL_ON Compiling in the B+ state (complete boolean evaluation)
+ ASSERTIONS_ON Compiling in the C+ state (assertions on)
+ DEBUGINFO_ON Compiling in the D+ state (debug info generation on)
+ IMPORTEDDATA_ON Compiling in the G+ state (creation of imported data references)
+ LONGSTRINGS_ON Compiling in the H+ state (string defined as AnsiString)
+ IOCHECKS_ON Compiling in the I+ state (I/O checking enabled)
+ WRITEABLECONST_ON Compiling in the J+ state (typed constants can be modified)
+ LOCALSYMBOLS Compiling in the L+ state (local symbol generation)
+ LOCALSYMBOLS_ON Alias of LOCALSYMBOLS
+ TYPEINFO_ON Compiling in the M+ state (RTTI generation on)
+ OPTIMIZATION_ON Compiling in the O+ state (code optimization on)
+ OPENSTRINGS_ON Compiling in the P+ state (variable string parameters are openstrings)
+ OVERFLOWCHECKS_ON Compiling in the Q+ state (overflow checing on)
+ RANGECHECKS_ON Compiling in the R+ state (range checking on)
+ TYPEDADDRESS_ON Compiling in the T+ state (pointers obtained using the @ operator are typed)
+ SAFEDIVIDE_ON Compiling in the U+ state (save FDIV instruction through RTL emulation)
+ VARSTRINGCHECKS_ON Compiling in the V+ state (type checking of shortstrings)
+ STACKFRAMES_ON Compiling in the W+ state (generation of stack frames)
+ EXTENDEDSYNTAX_ON Compiling in the X+ state (Delphi extended syntax enabled)
+*)
+
+{$DEFINE BORLAND}
+
+{ Set FreePascal to Delphi mode }
+{$IFDEF FPC}
+ {$MODE DELPHI}
+ {$ASMMODE Intel}
+ {$UNDEF BORLAND}
+ {$DEFINE CPUASM}
+ // FPC defines CPU32, CPU64 and Unix automatically
+{$ENDIF}
+
+{$IFDEF BORLAND}
+ {$IFDEF LINUX}
+ {$DEFINE KYLIX}
+ {$ENDIF LINUX}
+ {$IFNDEF CLR}
+ {$IFNDEF CPUX86}
+ {$IFNDEF CPUX64}
+ {$DEFINE CPU386} // For Borland compilers select the x86 compat assembler by default
+ {$DEFINE CPU32} // Assume Borland compilers are 32-bit (rather than 64-bit)
+ {$DEFINE CPUASM}
+ {$ELSE ~CPUX64}
+ {$DEFINE CPU64}
+ {$DEFINE CPUASM}
+ {$DEFINE DELPHI64_TEMPORARY}
+ {$ENDIF ~CPUX64}
+ {$ELSE ~CPUX86}
+ {$DEFINE CPU386}
+ {$DEFINE CPU32}
+ {$DEFINE CPUASM}
+ {$ENDIF ~CPUX86}
+ {$ENDIF ~CLR}
+{$ENDIF BORLAND}
+
+{------------------------------------------------------------------------------}
+{ VERXXX to COMPILERX, DELPHIX and BCBX mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF BORLAND}
+ {$IFDEF KYLIX}
+ {$I kylix.inc} // FPC incompatible stuff
+ {$ELSE ~KYLIX}
+
+ {$DEFINE UNKNOWN_COMPILER_VERSION}
+
+ {$IFDEF VER80}
+ {$DEFINE COMPILER1}
+ {$DEFINE DELPHI1}
+ {$DEFINE DELPHICOMPILER1}
+ {$DEFINE RTL80_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER90}
+ {$DEFINE COMPILER2}
+ {$DEFINE DELPHI2}
+ {$DEFINE DELPHICOMPILER2}
+ {$DEFINE RTL90_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER93}
+ {$DEFINE COMPILER2}
+ {$DEFINE BCB1}
+ {$DEFINE BCB}
+ {$DEFINE RTL93_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER100}
+ {$DEFINE COMPILER3}
+ {$DEFINE DELPHI3}
+ {$DEFINE DELPHICOMPILER3}
+ {$DEFINE RTL100_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER110}
+ {$DEFINE COMPILER35}
+ {$DEFINE BCB3}
+ {$DEFINE BCB}
+ {$DEFINE RTL110_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER120}
+ {$DEFINE COMPILER4}
+ {$DEFINE DELPHI4}
+ {$DEFINE DELPHICOMPILER4}
+ {$DEFINE RTL120_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER125}
+ {$DEFINE COMPILER4}
+ {$DEFINE BCB4}
+ {$DEFINE BCB}
+ {$DEFINE RTL125_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER130}
+ {$DEFINE COMPILER5}
+ {$IFDEF BCB}
+ {$DEFINE BCB5}
+ {$ELSE}
+ {$DEFINE DELPHI5}
+ {$DEFINE DELPHICOMPILER5}
+ {$ENDIF}
+ {$DEFINE RTL130_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER140}
+ {$DEFINE COMPILER6}
+ {$IFDEF BCB}
+ {$DEFINE BCB6}
+ {$ELSE}
+ {$DEFINE DELPHI6}
+ {$DEFINE DELPHICOMPILER6}
+ {$ENDIF}
+ {$DEFINE RTL140_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER150}
+ {$DEFINE COMPILER7}
+ {$DEFINE DELPHI7}
+ {$DEFINE DELPHICOMPILER7}
+ {$DEFINE RTL150_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER160}
+ {$DEFINE BDS2}
+ {$DEFINE BDS}
+ {$IFDEF CLR}
+ {$DEFINE CLR10}
+ {$ENDIF CLR}
+ {$DEFINE COMPILER8}
+ {$DEFINE DELPHI8}
+ {$DEFINE DELPHICOMPILER8}
+ {$DEFINE RTL160_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER170}
+ {$DEFINE BDS3}
+ {$DEFINE BDS}
+ {$IFDEF CLR}
+ {$DEFINE CLR11}
+ {$ENDIF CLR}
+ {$DEFINE COMPILER9}
+ {$DEFINE DELPHI9}
+ {$DEFINE DELPHI2005} // synonym to DELPHI9
+ {$DEFINE DELPHICOMPILER9}
+ {$DEFINE RTL170_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER180}
+ {$DEFINE BDS}
+ {$IFDEF CLR}
+ {$DEFINE CLR11}
+ {$ENDIF CLR}
+ {$IFDEF VER185}
+ {$DEFINE BDS5}
+ {$DEFINE COMPILER11}
+ {$IFDEF BCB}
+ {$DEFINE BCB11}
+ {$ELSE}
+ {$DEFINE DELPHI11}
+ {$DEFINE DELPHI2007} // synonym to DELPHI11
+ {$DEFINE DELPHICOMPILER11}
+ {$ENDIF}
+ {$DEFINE RTL185_UP}
+ {$ELSE ~~VER185}
+ {$DEFINE BDS4}
+ {$DEFINE COMPILER10}
+ {$IFDEF BCB}
+ {$DEFINE BCB10}
+ {$ELSE}
+ {$DEFINE DELPHI10}
+ {$DEFINE DELPHI2006} // synonym to DELPHI10
+ {$DEFINE DELPHICOMPILER10}
+ {$ENDIF}
+ {$DEFINE RTL180_UP}
+ {$ENDIF ~VER185}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$IFDEF VER190} // Delphi 2007 for .NET
+ {$DEFINE BDS}
+ {$DEFINE BDS5}
+ {$IFDEF CLR}
+ {$DEFINE CLR20}
+ {$ENDIF CLR}
+ {$DEFINE COMPILER11}
+ {$DEFINE DELPHI11}
+ {$DEFINE DELPHI2007} // synonym to DELPHI11
+ {$DEFINE DELPHICOMPILER11}
+ {$DEFINE RTL190_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF VER190}
+
+ {$IFDEF VER200} // RAD Studio 2009
+ {$DEFINE BDS}
+ {$DEFINE BDS6}
+ {$IFDEF CLR}
+ {$DEFINE CLR20}
+ {$ENDIF CLR}
+ {$DEFINE COMPILER12}
+ {$IFDEF BCB}
+ {$DEFINE BCB12}
+ {$ELSE}
+ {$DEFINE DELPHI12}
+ {$DEFINE DELPHI2009} // synonym to DELPHI12
+ {$DEFINE DELPHICOMPILER12}
+ {$ENDIF BCB}
+ {$IFDEF CLR}
+ {$DEFINE RTL190_UP}
+ {$ELSE}
+ {$DEFINE RTL200_UP}
+ {$ENDIF}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF VER200}
+
+ {$IFDEF VER210} // RAD Studio 2010
+ {$DEFINE BDS}
+ {$DEFINE BDS7}
+ {$DEFINE COMPILER14}
+ {$IFDEF BCB}
+ {$DEFINE BCB14}
+ {$ELSE}
+ {$DEFINE DELPHI14}
+ {$DEFINE DELPHI2010} // synonym to DELPHI14
+ {$DEFINE DELPHICOMPILER14}
+ {$ENDIF BCB}
+ {$DEFINE RTL210_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF VER210}
+
+ {$IFDEF VER220} // RAD Studio XE
+ {$DEFINE BDS}
+ {$DEFINE BDS8}
+ {$DEFINE COMPILER15}
+ {$IFDEF BCB}
+ {$DEFINE BCB15}
+ {$ELSE}
+ {$DEFINE DELPHI15}
+ {$DEFINE DELPHIXE} // synonym to DELPHI15
+ {$DEFINE DELPHICOMPILER15}
+ {$ENDIF BCB}
+ {$DEFINE RTL220_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF VER220}
+
+ {$IFDEF VER230} // RAD Studio XE2
+ {$DEFINE BDS}
+ {$DEFINE BDS9}
+ {$DEFINE COMPILER16}
+ {$IFDEF BCB}
+ {$DEFINE BCB16}
+ {$ELSE}
+ {$DEFINE DELPHI16}
+ {$DEFINE DELPHIXE2} // synonym to DELPHI16
+ {$DEFINE DELPHICOMPILER16}
+ {$ENDIF BCB}
+ {$DEFINE RTL230_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF VER230}
+
+ {$IFDEF VER240} // RAD Studio XE3
+ {$DEFINE BDS}
+ {$DEFINE BDS10}
+ {$DEFINE COMPILER17}
+ {$IFDEF BCB}
+ {$DEFINE BCB17}
+ {$ELSE}
+ {$DEFINE DELPHI17}
+ {$DEFINE DELPHIXE3} // synonym to DELPHI17
+ {$DEFINE DELPHICOMPILER17}
+ {$ENDIF BCB}
+ {$DEFINE RTL240_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF VER240}
+
+ {$IFDEF UNKNOWN_COMPILER_VERSION} // adjust for newer version (always use latest version)
+ {$DEFINE BDS}
+ {$DEFINE BDS10}
+ {$DEFINE COMPILER17}
+ {$IFDEF BCB}
+ {$DEFINE BCB17}
+ {$ELSE}
+ {$DEFINE DELPHI17}
+ {$DEFINE DELPHIXE3} // synonym to DELPHI17
+ {$DEFINE DELPHICOMPILER17}
+ {$ENDIF BCB}
+ {$DEFINE RTL240_UP}
+ {$UNDEF UNKNOWN_COMPILER_VERSION}
+ {$ENDIF}
+
+ {$ENDIF ~KYLIX}
+
+ {$IFDEF BCB}
+ {$DEFINE CPPBUILDER}
+ {$DEFINE BCBCOMPILER}
+ {$ELSE ~BCB}
+ {$DEFINE DELPHI}
+ {$DEFINE DELPHICOMPILER}
+ {$ENDIF ~BCB}
+
+{$ENDIF BORLAND}
+
+{------------------------------------------------------------------------------}
+{ DELPHIX_UP from DELPHIX mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHI17} {$DEFINE DELPHI17_UP} {$ENDIF}
+{$IFDEF DELPHI16} {$DEFINE DELPHI16_UP} {$ENDIF}
+{$IFDEF DELPHI15} {$DEFINE DELPHI15_UP} {$ENDIF}
+{$IFDEF DELPHI14} {$DEFINE DELPHI14_UP} {$ENDIF}
+{$IFDEF DELPHI12} {$DEFINE DELPHI12_UP} {$ENDIF}
+{$IFDEF DELPHI11} {$DEFINE DELPHI11_UP} {$ENDIF}
+{$IFDEF DELPHI10} {$DEFINE DELPHI10_UP} {$ENDIF}
+{$IFDEF DELPHI9} {$DEFINE DELPHI9_UP} {$ENDIF}
+{$IFDEF DELPHI8} {$DEFINE DELPHI8_UP} {$ENDIF}
+{$IFDEF DELPHI7} {$DEFINE DELPHI7_UP} {$ENDIF}
+{$IFDEF DELPHI6} {$DEFINE DELPHI6_UP} {$ENDIF}
+{$IFDEF DELPHI5} {$DEFINE DELPHI5_UP} {$ENDIF}
+{$IFDEF DELPHI4} {$DEFINE DELPHI4_UP} {$ENDIF}
+{$IFDEF DELPHI3} {$DEFINE DELPHI3_UP} {$ENDIF}
+{$IFDEF DELPHI2} {$DEFINE DELPHI2_UP} {$ENDIF}
+{$IFDEF DELPHI1} {$DEFINE DELPHI1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ DELPHIX_UP from DELPHIX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHI17_UP}
+ {$DEFINE DELPHIXE3_UP} // synonym to DELPHI17_UP
+ {$DEFINE DELPHI16_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI16_UP}
+ {$DEFINE DELPHIXE2_UP} // synonym to DELPHI16_UP
+ {$DEFINE DELPHI15_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI15_UP}
+ {$DEFINE DELPHIXE_UP} // synonym to DELPHI15_UP
+ {$DEFINE DELPHI14_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI14_UP}
+ {$DEFINE DELPHI2010_UP} // synonym to DELPHI14_UP
+ {$DEFINE DELPHI12_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI12_UP}
+ {$DEFINE DELPHI2009_UP} // synonym to DELPHI12_UP
+ {$DEFINE DELPHI11_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI11_UP}
+ {$DEFINE DELPHI2007_UP} // synonym to DELPHI11_UP
+ {$DEFINE DELPHI10_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI10_UP}
+ {$DEFINE DELPHI2006_UP} // synonym to DELPHI10_UP
+ {$DEFINE DELPHI9_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI9_UP}
+ {$DEFINE DELPHI2005_UP} // synonym to DELPHI9_UP
+ {$DEFINE DELPHI8_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI8_UP} {$DEFINE DELPHI7_UP} {$ENDIF}
+{$IFDEF DELPHI7_UP} {$DEFINE DELPHI6_UP} {$ENDIF}
+{$IFDEF DELPHI6_UP} {$DEFINE DELPHI5_UP} {$ENDIF}
+{$IFDEF DELPHI5_UP} {$DEFINE DELPHI4_UP} {$ENDIF}
+{$IFDEF DELPHI4_UP} {$DEFINE DELPHI3_UP} {$ENDIF}
+{$IFDEF DELPHI3_UP} {$DEFINE DELPHI2_UP} {$ENDIF}
+{$IFDEF DELPHI2_UP} {$DEFINE DELPHI1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ BCBX_UP from BCBX mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF BCB17} {$DEFINE BCB17_UP} {$ENDIF}
+{$IFDEF BCB16} {$DEFINE BCB16_UP} {$ENDIF}
+{$IFDEF BCB15} {$DEFINE BCB15_UP} {$ENDIF}
+{$IFDEF BCB14} {$DEFINE BCB14_UP} {$ENDIF}
+{$IFDEF BCB12} {$DEFINE BCB12_UP} {$ENDIF}
+{$IFDEF BCB11} {$DEFINE BCB11_UP} {$ENDIF}
+{$IFDEF BCB10} {$DEFINE BCB10_UP} {$ENDIF}
+{$IFDEF BCB6} {$DEFINE BCB6_UP} {$ENDIF}
+{$IFDEF BCB5} {$DEFINE BCB5_UP} {$ENDIF}
+{$IFDEF BCB4} {$DEFINE BCB4_UP} {$ENDIF}
+{$IFDEF BCB3} {$DEFINE BCB3_UP} {$ENDIF}
+{$IFDEF BCB1} {$DEFINE BCB1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ BCBX_UP from BCBX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF BCB17_UP} {$DEFINE BCB16_UP} {$ENDIF}
+{$IFDEF BCB16_UP} {$DEFINE BCB15_UP} {$ENDIF}
+{$IFDEF BCB15_UP} {$DEFINE BCB14_UP} {$ENDIF}
+{$IFDEF BCB14_UP} {$DEFINE BCB12_UP} {$ENDIF}
+{$IFDEF BCB12_UP} {$DEFINE BCB11_UP} {$ENDIF}
+{$IFDEF BCB11_UP} {$DEFINE BCB10_UP} {$ENDIF}
+{$IFDEF BCB10_UP} {$DEFINE BCB6_UP} {$ENDIF}
+{$IFDEF BCB6_UP} {$DEFINE BCB5_UP} {$ENDIF}
+{$IFDEF BCB5_UP} {$DEFINE BCB4_UP} {$ENDIF}
+{$IFDEF BCB4_UP} {$DEFINE BCB3_UP} {$ENDIF}
+{$IFDEF BCB3_UP} {$DEFINE BCB1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ BDSX_UP from BDSX mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF BDS10} {$DEFINE BDS10_UP} {$ENDIF}
+{$IFDEF BDS9} {$DEFINE BDS9_UP} {$ENDIF}
+{$IFDEF BDS8} {$DEFINE BDS8_UP} {$ENDIF}
+{$IFDEF BDS7} {$DEFINE BDS7_UP} {$ENDIF}
+{$IFDEF BDS6} {$DEFINE BDS6_UP} {$ENDIF}
+{$IFDEF BDS5} {$DEFINE BDS5_UP} {$ENDIF}
+{$IFDEF BDS4} {$DEFINE BDS4_UP} {$ENDIF}
+{$IFDEF BDS3} {$DEFINE BDS3_UP} {$ENDIF}
+{$IFDEF BDS2} {$DEFINE BDS2_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ BDSX_UP from BDSX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF BDS10_UP} {$DEFINE BDS9_UP} {$ENDIF}
+{$IFDEF BDS9_UP} {$DEFINE BDS8_UP} {$ENDIF}
+{$IFDEF BDS8_UP} {$DEFINE BDS7_UP} {$ENDIF}
+{$IFDEF BDS7_UP} {$DEFINE BDS6_UP} {$ENDIF}
+{$IFDEF BDS6_UP} {$DEFINE BDS5_UP} {$ENDIF}
+{$IFDEF BDS5_UP} {$DEFINE BDS4_UP} {$ENDIF}
+{$IFDEF BDS4_UP} {$DEFINE BDS3_UP} {$ENDIF}
+{$IFDEF BDS3_UP} {$DEFINE BDS2_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ DELPHICOMPILERX_UP from DELPHICOMPILERX mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHICOMPILER17} {$DEFINE DELPHICOMPILER17_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER16} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER15} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER14} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER12} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER11} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER10} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER9} {$DEFINE DELPHICOMPILER9_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER8} {$DEFINE DELPHICOMPILER8_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER7} {$DEFINE DELPHICOMPILER7_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER6} {$DEFINE DELPHICOMPILER6_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER5} {$DEFINE DELPHICOMPILER5_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER4} {$DEFINE DELPHICOMPILER4_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER3} {$DEFINE DELPHICOMPILER3_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER2} {$DEFINE DELPHICOMPILER2_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER1} {$DEFINE DELPHICOMPILER1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ DELPHICOMPILERX_UP from DELPHICOMPILERX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHICOMPILER17_UP} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER16_UP} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER15_UP} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER14_UP} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER12_UP} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER11_UP} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER10_UP} {$DEFINE DELPHICOMPILER9_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER9_UP} {$DEFINE DELPHICOMPILER8_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER8_UP} {$DEFINE DELPHICOMPILER7_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER8_UP} {$DEFINE DELPHICOMPILER7_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER7_UP} {$DEFINE DELPHICOMPILER6_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER6_UP} {$DEFINE DELPHICOMPILER5_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER5_UP} {$DEFINE DELPHICOMPILER4_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER4_UP} {$DEFINE DELPHICOMPILER3_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER3_UP} {$DEFINE DELPHICOMPILER2_UP} {$ENDIF}
+{$IFDEF DELPHICOMPILER2_UP} {$DEFINE DELPHICOMPILER1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ COMPILERX_UP from COMPILERX mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF COMPILER17} {$DEFINE COMPILER17_UP} {$ENDIF}
+{$IFDEF COMPILER16} {$DEFINE COMPILER16_UP} {$ENDIF}
+{$IFDEF COMPILER15} {$DEFINE COMPILER15_UP} {$ENDIF}
+{$IFDEF COMPILER14} {$DEFINE COMPILER14_UP} {$ENDIF}
+{$IFDEF COMPILER12} {$DEFINE COMPILER12_UP} {$ENDIF}
+{$IFDEF COMPILER11} {$DEFINE COMPILER11_UP} {$ENDIF}
+{$IFDEF COMPILER10} {$DEFINE COMPILER10_UP} {$ENDIF}
+{$IFDEF COMPILER9} {$DEFINE COMPILER9_UP} {$ENDIF}
+{$IFDEF COMPILER8} {$DEFINE COMPILER8_UP} {$ENDIF}
+{$IFDEF COMPILER7} {$DEFINE COMPILER7_UP} {$ENDIF}
+{$IFDEF COMPILER6} {$DEFINE COMPILER6_UP} {$ENDIF}
+{$IFDEF COMPILER5} {$DEFINE COMPILER5_UP} {$ENDIF}
+{$IFDEF COMPILER4} {$DEFINE COMPILER4_UP} {$ENDIF}
+{$IFDEF COMPILER35} {$DEFINE COMPILER35_UP} {$ENDIF}
+{$IFDEF COMPILER3} {$DEFINE COMPILER3_UP} {$ENDIF}
+{$IFDEF COMPILER2} {$DEFINE COMPILER2_UP} {$ENDIF}
+{$IFDEF COMPILER1} {$DEFINE COMPILER1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ COMPILERX_UP from COMPILERX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF COMPILER17_UP} {$DEFINE COMPILER16_UP} {$ENDIF}
+{$IFDEF COMPILER16_UP} {$DEFINE COMPILER15_UP} {$ENDIF}
+{$IFDEF COMPILER15_UP} {$DEFINE COMPILER14_UP} {$ENDIF}
+{$IFDEF COMPILER14_UP} {$DEFINE COMPILER12_UP} {$ENDIF}
+{$IFDEF COMPILER12_UP} {$DEFINE COMPILER11_UP} {$ENDIF}
+{$IFDEF COMPILER11_UP} {$DEFINE COMPILER10_UP} {$ENDIF}
+{$IFDEF COMPILER10_UP} {$DEFINE COMPILER9_UP} {$ENDIF}
+{$IFDEF COMPILER9_UP} {$DEFINE COMPILER8_UP} {$ENDIF}
+{$IFDEF COMPILER8_UP} {$DEFINE COMPILER7_UP} {$ENDIF}
+{$IFDEF COMPILER7_UP} {$DEFINE COMPILER6_UP} {$ENDIF}
+{$IFDEF COMPILER6_UP} {$DEFINE COMPILER5_UP} {$ENDIF}
+{$IFDEF COMPILER5_UP} {$DEFINE COMPILER4_UP} {$ENDIF}
+{$IFDEF COMPILER4_UP} {$DEFINE COMPILER35_UP} {$ENDIF}
+{$IFDEF COMPILER35_UP} {$DEFINE COMPILER3_UP} {$ENDIF}
+{$IFDEF COMPILER3_UP} {$DEFINE COMPILER2_UP} {$ENDIF}
+{$IFDEF COMPILER2_UP} {$DEFINE COMPILER1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ RTLX_UP from RTLX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF RTL240_UP} {$DEFINE RTL230_UP} {$ENDIF}
+{$IFDEF RTL230_UP} {$DEFINE RTL220_UP} {$ENDIF}
+{$IFDEF RTL220_UP} {$DEFINE RTL210_UP} {$ENDIF}
+{$IFDEF RTL210_UP} {$DEFINE RTL200_UP} {$ENDIF}
+{$IFDEF RTL200_UP} {$DEFINE RTL190_UP} {$ENDIF}
+{$IFDEF RTL190_UP} {$DEFINE RTL185_UP} {$ENDIF}
+{$IFDEF RTL185_UP} {$DEFINE RTL180_UP} {$ENDIF}
+{$IFDEF RTL180_UP} {$DEFINE RTL170_UP} {$ENDIF}
+{$IFDEF RTL170_UP} {$DEFINE RTL160_UP} {$ENDIF}
+{$IFDEF RTL160_UP} {$DEFINE RTL150_UP} {$ENDIF}
+{$IFDEF RTL150_UP} {$DEFINE RTL145_UP} {$ENDIF}
+{$IFDEF RTL145_UP} {$DEFINE RTL142_UP} {$ENDIF}
+{$IFDEF RTL142_UP} {$DEFINE RTL140_UP} {$ENDIF}
+{$IFDEF RTL140_UP} {$DEFINE RTL130_UP} {$ENDIF}
+{$IFDEF RTL130_UP} {$DEFINE RTL125_UP} {$ENDIF}
+{$IFDEF RTL125_UP} {$DEFINE RTL120_UP} {$ENDIF}
+{$IFDEF RTL120_UP} {$DEFINE RTL110_UP} {$ENDIF}
+{$IFDEF RTL110_UP} {$DEFINE RTL100_UP} {$ENDIF}
+{$IFDEF RTL100_UP} {$DEFINE RTL93_UP} {$ENDIF}
+{$IFDEF RTL93_UP} {$DEFINE RTL90_UP} {$ENDIF}
+{$IFDEF RTL90_UP} {$DEFINE RTL80_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ Check for CLR overrides of default detection }
+{------------------------------------------------------------------------------}
+
+{$IFDEF CLR}
+ {$IFDEF FORCE_CLR10}
+ {$DEFINE CLR10}
+ {$UNDEF CLR11}
+ {$UNDEF CLR20}
+ {$ENDIF FORCE_CLR10}
+
+ {$IFDEF FORCE_CLR11}
+ {$UNDEF CLR10}
+ {$DEFINE CLR11}
+ {$UNDEF CLR20}
+ {$ENDIF FORCE_CLR11}
+
+ {$IFDEF FORCE_CLR20}
+ {$UNDEF CLR10}
+ {$UNDEF CLR11}
+ {$DEFINE CLR20}
+ {$ENDIF FORCE_CLR20}
+{$ENDIF CLR}
+
+{------------------------------------------------------------------------------}
+{ CLRX from CLRX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF CLR10} {$DEFINE CLR10_UP} {$ENDIF}
+{$IFDEF CLR11} {$DEFINE CLR11_UP} {$ENDIF}
+{$IFDEF CLR20} {$DEFINE CLR20_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ CLRX_UP from CLRX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF CLR20_UP} {$DEFINE CLR11_UP} {$ENDIF}
+{$IFDEF CLR11_UP} {$DEFINE CLR10_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHICOMPILER}
+ {$DEFINE DELPHILANGUAGE}
+{$ENDIF}
+
+{$IFDEF BCBCOMPILER}
+ {$DEFINE DELPHILANGUAGE}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ KYLIXX_UP from KYLIXX mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF KYLIX3} {$DEFINE KYLIX3_UP} {$ENDIF}
+{$IFDEF KYLIX2} {$DEFINE KYLIX2_UP} {$ENDIF}
+{$IFDEF KYLIX1} {$DEFINE KYLIX1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ KYLIXX_UP from KYLIXX_UP mappings }
+{------------------------------------------------------------------------------}
+
+{$IFDEF KYLIX3_UP} {$DEFINE KYLIX2_UP} {$ENDIF}
+{$IFDEF KYLIX2_UP} {$DEFINE KYLIX1_UP} {$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ Map COMPILERX_UP to friendly feature names }
+{------------------------------------------------------------------------------}
+
+{$IFDEF FPC}
+ {$IFDEF VER1_0}
+ Please use FPC 2.0 or higher to compile this.
+ {$ELSE}
+ {$DEFINE SUPPORTS_OUTPARAMS}
+ {$DEFINE SUPPORTS_WIDECHAR}
+ {$DEFINE SUPPORTS_WIDESTRING}
+ {$IFDEF HASINTF}
+ {$DEFINE SUPPORTS_INTERFACE}
+ {$ENDIF}
+ {$IFDEF HASVARIANT}
+ {$DEFINE SUPPORTS_VARIANT}
+ {$ENDIF}
+ {$IFDEF FPC_HAS_TYPE_SINGLE}
+ {$DEFINE SUPPORTS_SINGLE}
+ {$ENDIF}
+ {$IFDEF FPC_HAS_TYPE_DOUBLE}
+ {$DEFINE SUPPORTS_DOUBLE}
+ {$ENDIF}
+ {$IFDEF FPC_HAS_TYPE_EXTENDED}
+ {$DEFINE SUPPORTS_EXTENDED}
+ {$ENDIF}
+ {$IFDEF HASCURRENCY}
+ {$DEFINE SUPPORTS_CURRENCY}
+ {$ENDIF}
+ {$DEFINE SUPPORTS_THREADVAR}
+ {$DEFINE SUPPORTS_CONSTPARAMS}
+ {$DEFINE SUPPORTS_LONGWORD}
+ {$DEFINE SUPPORTS_INT64}
+ {$DEFINE SUPPORTS_DYNAMICARRAYS}
+ {$DEFINE SUPPORTS_DEFAULTPARAMS}
+ {$DEFINE SUPPORTS_OVERLOAD}
+ {$DEFINE ACCEPT_DEPRECATED} // 2.2 also gives warnings
+ {$DEFINE ACCEPT_PLATFORM} // 2.2 also gives warnings
+ {$DEFINE ACCEPT_LIBRARY}
+ {$DEFINE SUPPORTS_EXTSYM}
+ {$DEFINE SUPPORTS_NODEFINE}
+
+ {$DEFINE SUPPORTS_CUSTOMVARIANTS}
+ {$DEFINE SUPPORTS_VARARGS}
+ {$DEFINE SUPPORTS_ENUMVALUE}
+ {$IFDEF LINUX}
+ {$DEFINE HAS_UNIT_LIBC}
+ {$ENDIF LINUX}
+ {$DEFINE HAS_UNIT_CONTNRS}
+ {$DEFINE HAS_UNIT_TYPES}
+ {$DEFINE HAS_UNIT_VARIANTS}
+ {$DEFINE HAS_UNIT_STRUTILS}
+ {$DEFINE HAS_UNIT_DATEUTILS}
+ {$DEFINE HAS_UNIT_RTLCONSTS}
+
+ {$DEFINE XPLATFORM_RTL}
+
+ {$IFDEF VER2_2}
+ {$DEFINE SUPPORTS_DISPINTERFACE}
+ {$DEFINE SUPPORTS_IMPLEMENTS}
+ {$DEFINE SUPPORTS_DISPID}
+ {$ELSE}
+ {$UNDEF SUPPORTS_DISPINTERFACE}
+ {$UNDEF SUPPORTS_IMPLEMENTS}
+ {$endif}
+ {$UNDEF SUPPORTS_UNSAFE_WARNINGS}
+ {$ENDIF}
+{$ENDIF FPC}
+
+{$IFDEF CLR}
+ {$DEFINE SUPPORTS_UNICODE}
+{$ENDIF CLR}
+
+{$IFDEF COMPILER1_UP}
+ {$DEFINE SUPPORTS_CONSTPARAMS}
+ {$DEFINE SUPPORTS_SINGLE}
+ {$DEFINE SUPPORTS_DOUBLE}
+ {$DEFINE SUPPORTS_EXTENDED}
+ {$DEFINE SUPPORTS_PACKAGES}
+{$ENDIF COMPILER1_UP}
+
+{$IFDEF COMPILER2_UP}
+ {$DEFINE SUPPORTS_CURRENCY}
+ {$DEFINE SUPPORTS_THREADVAR}
+ {$DEFINE SUPPORTS_VARIANT}
+ {$DEFINE SUPPORTS_WIDECHAR}
+{$ENDIF COMPILER2_UP}
+
+{$IFDEF COMPILER3_UP}
+ {$DEFINE SUPPORTS_OUTPARAMS}
+ {$DEFINE SUPPORTS_WIDESTRING}
+ {$DEFINE SUPPORTS_INTERFACE}
+ {$DEFINE SUPPORTS_DISPINTERFACE}
+ {$DEFINE SUPPORTS_DISPID}
+ {$DEFINE SUPPORTS_WEAKPACKAGEUNIT}
+{$ENDIF COMPILER3_UP}
+
+{$IFDEF COMPILER35_UP}
+ {$DEFINE SUPPORTS_EXTSYM}
+ {$DEFINE SUPPORTS_NODEFINE}
+{$ENDIF COMPILER35_UP}
+
+{$IFDEF COMPILER4_UP}
+ {$DEFINE SUPPORTS_LONGWORD}
+ {$DEFINE SUPPORTS_INT64}
+ {$DEFINE SUPPORTS_DYNAMICARRAYS}
+ {$DEFINE SUPPORTS_DEFAULTPARAMS}
+ {$DEFINE SUPPORTS_OVERLOAD}
+ {$DEFINE SUPPORTS_IMPLEMENTS}
+{$ENDIF COMPILER4_UP}
+
+{$IFDEF COMPILER6_UP}
+ {$DEFINE SUPPORTS_DEPRECATED}
+ {$DEFINE SUPPORTS_LIBRARY}
+ {$DEFINE SUPPORTS_PLATFORM}
+ {$DEFINE SUPPORTS_LOCAL}
+ {$DEFINE SUPPORTS_SETPEFLAGS}
+ {$DEFINE SUPPORTS_EXPERIMENTAL_WARNINGS}
+ {$DEFINE ACCEPT_DEPRECATED}
+ {$DEFINE ACCEPT_PLATFORM}
+ {$DEFINE ACCEPT_LIBRARY}
+ {$DEFINE SUPPORTS_DEPRECATED_WARNINGS}
+ {$DEFINE SUPPORTS_LIBRARY_WARNINGS}
+ {$DEFINE SUPPORTS_PLATFORM_WARNINGS}
+ {$DEFINE SUPPORTS_CUSTOMVARIANTS}
+ {$DEFINE SUPPORTS_VARARGS}
+ {$DEFINE SUPPORTS_ENUMVALUE}
+ {$DEFINE SUPPORTS_COMPILETIME_MESSAGES}
+{$ENDIF COMPILER6_UP}
+
+{$IFDEF COMPILER7_UP}
+ {$DEFINE SUPPORTS_UNSAFE_WARNINGS}
+{$ENDIF COMPILER7_UP}
+
+{$IFDEF COMPILER9_UP}
+ {$DEFINE SUPPORTS_FOR_IN}
+ {$DEFINE SUPPORTS_INLINE}
+ {$DEFINE SUPPORTS_NESTED_CONSTANTS}
+ {$DEFINE SUPPORTS_NESTED_TYPES}
+ {$DEFINE SUPPORTS_REGION}
+ {$IFDEF CLR}
+ {$DEFINE SUPPORTS_ENHANCED_RECORDS}
+ {$DEFINE SUPPORTS_CLASS_FIELDS}
+ {$DEFINE SUPPORTS_CLASS_HELPERS}
+ {$DEFINE SUPPORTS_CLASS_OPERATORS}
+ {$DEFINE SUPPORTS_STRICT}
+ {$DEFINE SUPPORTS_STATIC}
+ {$DEFINE SUPPORTS_FINAL}
+ {$ENDIF CLR}
+{$ENDIF COMPILER9_UP}
+
+{$IFDEF COMPILER10_UP}
+ {$DEFINE SUPPORTS_ENHANCED_RECORDS}
+ {$DEFINE SUPPORTS_CLASS_FIELDS}
+ {$DEFINE SUPPORTS_CLASS_HELPERS}
+ {$DEFINE SUPPORTS_CLASS_OPERATORS}
+ {$DEFINE SUPPORTS_STRICT}
+ {$DEFINE SUPPORTS_STATIC}
+ {$DEFINE SUPPORTS_FINAL}
+ {$DEFINE SUPPORTS_METHODINFO}
+{$ENDIF COMPILER10_UP}
+
+{$IFDEF COMPILER11_UP}
+ {$IFDEF CLR}
+ {$DEFINE SUPPORTS_GENERICS}
+ {$DEFINE SUPPORTS_DEPRECATED_DETAILS}
+ {$ENDIF CLR}
+{$ENDIF COMPILER11_UP}
+
+{$IFDEF COMPILER12_UP}
+ {$DEFINE SUPPORTS_GENERICS}
+ {$DEFINE SUPPORTS_DEPRECATED_DETAILS}
+ {$DEFINE SUPPORTS_INT_ALIASES}
+ {$IFNDEF CLR}
+ {$DEFINE SUPPORTS_UNICODE}
+ {$DEFINE SUPPORTS_UNICODE_STRING}
+ {$ENDIF CLR}
+{$ENDIF COMPILER12_UP}
+
+{$IFDEF COMPILER14_UP}
+ {$DEFINE SUPPORTS_CLASS_CTORDTORS}
+ {$DEFINE HAS_UNIT_RTTI}
+ {$DEFINE SUPPORTS_CAST_INTERFACE_TO_OBJ}
+ {$DEFINE SUPPORTS_DELAYED_LOADING}
+{$ENDIF COMPILER14_UP}
+
+{$IFDEF COMPILER16_UP}
+ {$DEFINE USE_64BIT_TYPES}
+{$ENDIF COMPILER16_UP}
+
+{$IFDEF RTL130_UP}
+ {$DEFINE HAS_UNIT_CONTNRS}
+{$ENDIF RTL130_UP}
+
+{$IFDEF RTL140_UP}
+ {$IFDEF LINUX}
+ {$DEFINE HAS_UNIT_LIBC}
+ {$ENDIF LINUX}
+ {$DEFINE HAS_UNIT_RTLCONSTS}
+ {$DEFINE HAS_UNIT_TYPES}
+ {$DEFINE HAS_UNIT_VARIANTS}
+ {$DEFINE HAS_UNIT_STRUTILS}
+ {$DEFINE HAS_UNIT_DATEUTILS}
+ {$DEFINE XPLATFORM_RTL}
+{$ENDIF RTL140_UP}
+
+{$IFDEF RTL170_UP}
+ {$DEFINE HAS_UNIT_HTTPPROD}
+{$ENDIF RTL170_UP}
+
+{$IFDEF RTL185_UP}
+ {$DEFINE HAS_UNIT_GIFIMG}
+{$ENDIF RTL185_UP}
+
+{$IFDEF RTL200_UP}
+ {$DEFINE HAS_UNIT_ANSISTRINGS}
+ {$DEFINE HAS_UNIT_PNGIMAGE}
+ {$DEFINE HAS_UNIT_CHARACTER}
+{$ENDIF RTL200_UP}
+
+{$IFDEF RTL220_UP}
+ {$DEFINE SUPPORTS_UINT64}
+ {$DEFINE HAS_UNIT_REGULAREXPRESSIONSAPI}
+{$ENDIF RTL220_UP}
+
+{$IFDEF RTL230_UP}
+ {$DEFINE HAS_UNITSCOPE}
+ {$DEFINE HAS_UNIT_SYSTEM_UITYPES}
+{$ENDIF RTL230_UP}
+
+{$IFDEF RTL240_UP}
+ {$DEFINE HAS_UNIT_SYSTEM_ACTIONS}
+{$ENDIF RTL240_UP}
+
+{------------------------------------------------------------------------------}
+{ Cross-platform related defines }
+{------------------------------------------------------------------------------}
+
+{$IFNDEF CPUASM}
+ {$DEFINE PUREPASCAL}
+{$ENDIF ~CPUASM}
+
+{$IFDEF WIN32}
+ {$DEFINE MSWINDOWS} // predefined for D6+/BCB6+
+ {$DEFINE Win32API}
+{$ENDIF}
+
+{$IFDEF DELPHILANGUAGE}
+ {$IFDEF LINUX}
+ {$DEFINE UNIX}
+ {$ENDIF}
+
+ {$IFNDEF CONSOLE}
+ {$IFDEF LINUX}
+ {$DEFINE VisualCLX}
+ {$ENDIF}
+ {$IFNDEF VisualCLX}
+ {$DEFINE VCL}
+ {$ENDIF}
+ {$ENDIF ~CONSOLE}
+{$ENDIF DELPHILANGUAGE}
+
+{------------------------------------------------------------------------------}
+{ Compiler settings }
+{------------------------------------------------------------------------------}
+
+{$IFOPT A+} {$DEFINE ALIGN_ON} {$ENDIF}
+{$IFOPT B+} {$DEFINE BOOLEVAL_ON} {$ENDIF}
+{$IFDEF COMPILER2_UP}
+ {$IFOPT C+} {$DEFINE ASSERTIONS_ON} {$ENDIF}
+{$ENDIF}
+{$IFOPT D+} {$DEFINE DEBUGINFO_ON} {$ENDIF}
+{$IFOPT G+} {$DEFINE IMPORTEDDATA_ON} {$ENDIF}
+{$IFDEF COMPILER2_UP}
+ {$IFOPT H+} {$DEFINE LONGSTRINGS_ON} {$ENDIF}
+{$ENDIF}
+
+// Hints
+{$IFOPT I+} {$DEFINE IOCHECKS_ON} {$ENDIF}
+{$IFDEF COMPILER2_UP}
+ {$IFOPT J+} {$DEFINE WRITEABLECONST_ON} {$ENDIF}
+{$ENDIF}
+{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$DEFINE LOCALSYMBOLS_ON} {$ENDIF}
+{$IFOPT M+} {$DEFINE TYPEINFO_ON} {$ENDIF}
+{$IFOPT O+} {$DEFINE OPTIMIZATION_ON} {$ENDIF}
+{$IFOPT P+} {$DEFINE OPENSTRINGS_ON} {$ENDIF}
+{$IFOPT Q+} {$DEFINE OVERFLOWCHECKS_ON} {$ENDIF}
+{$IFOPT R+} {$DEFINE RANGECHECKS_ON} {$ENDIF}
+
+// Real compatibility
+{$IFOPT T+} {$DEFINE TYPEDADDRESS_ON} {$ENDIF}
+{$IFOPT U+} {$DEFINE SAFEDIVIDE_ON} {$ENDIF}
+{$IFOPT V+} {$DEFINE VARSTRINGCHECKS_ON} {$ENDIF}
+{$IFOPT W+} {$DEFINE STACKFRAMES_ON} {$ENDIF}
+
+// Warnings
+{$IFOPT X+} {$DEFINE EXTENDEDSYNTAX_ON} {$ENDIF}
+
+// for Delphi/BCB trial versions remove the point from the line below
+{.$UNDEF SUPPORTS_WEAKPACKAGEUNIT}
+
+{$ENDIF ~JEDI_INC}
diff --git a/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/readme-dev.txt b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/readme-dev.txt
new file mode 100644
index 0000000000..4ee09c3d24
--- /dev/null
+++ b/plugins/MirandaNGHistoryToDB/HistoryToDBUpdater/readme-dev.txt
@@ -0,0 +1,38 @@
+HistoryToDBUpdater
+------------------
+
+Утилита установки/обновления компонентов плагинов RnQHistoryToDB, QIPHistoryToDB, MirandaIMHistoryToDB, MirandaNGHistoryToDB.
+
+Автор: Михаил Григорьев
+E-Mail: sleuthhound@gmail.com
+ICQ: 161867489
+WWW: http://www.im-history.ru
+Лицензия: GNU GPLv3
+
+Системные требования:
+---------------------
+РћРЎ: Win2000/XP/2003/Vista/7
+IM-клиент: Любой
+БД: MySQL 4.0, 4.1, 5.0, 5.1
+ PostgreSQL 7.1 - 8.3
+ Oracle 8i - 11i
+ SQLite 3
+ Firebird 2.x
+
+Необходимые компоненты для сборки плагина:
+------------------------------------------
+
+1. Embarcadero RAD Studio XE3
+
+2. IM-History Downloader Component
+ See also directory IMDownloaderComponent
+
+3. DCPcrypt Cryptographic Component Library v2
+ http://www.cityinthesky.co.uk/
+
+Описание параметров запуска:
+----------------------------
+
+HistoryToDBUpdater.exe <1>
+
+<1> - (Необязательный параметр) - Путь до файла настроек HistoryToDB.ini (Например: "C:\Program Files\QIP Infium\Profiles\username@qip.ru\Plugins\QIPHistoryToDB\")