|
传奇3冷雨夜lyy登录器主程序源码,适用于老C插件的,13魔法老版本引擎的,小白勿下哦。
- uses
- Windows, Forms, SysUtils, Menus, SUIPopupMenu, TrayIcon, SUIDlg, SUIMgr,
- ExtCtrls, JSocket, SUIMainMenu, SUIButton, Controls, StdCtrls,
- SUIComboBox, SUIGroupBox, SHDocVw, SUIImagePanel, Classes, SUIForm,
- Messages, FastIniFile, shellapi, DelHood,Mir3, LyThread, GIFImage, OleCtrls,
- RzTray, ImgList, RzBHints, jpeg, IdBaseComponent, IdAntiFreezeBase,Tlhelp32,
- IdAntiFreeze, Graphics, RzLabel, hookstart;
- const
- CM_RESTORE = WM_USER + 11;
- MAP_NAME='DBT3_Common_Data';
- {$I _b资源文件\_ClassName.inc}
- type
- TForm1 = class(TForm)
- ClientSocket1: TClientSocket;
- suiFileTheme1: TsuiFileTheme;
- suiThemeManager_butt: TsuiThemeManager;
- suiThemeManager_optr: TsuiThemeManager;
- suiThemeManager_form: TsuiThemeManager;
- MessForm: TsuiMessageDialog;
- suiPopupMenu1: TsuiPopupMenu;
- M1: TMenuItem;
- M4: TMenuItem;
- M2: TMenuItem;
- suiPopupMenu2: TsuiPopupMenu;
- N8: TMenuItem;
- O2: TMenuItem;
- suiMessageDialog1: TsuiMessageDialog;
- Timer1: TTimer;
- suiMSNPopForm1: TsuiMSNPopForm;
- TrayIcon1: TRzTrayIcon;
- suiPopupMenu3: TsuiPopupMenu;
- N4: TMenuItem;
- ImageList1: TImageList;
- N5: TMenuItem;
- N6: TMenuItem;
- RzBalloonHints1: TRzBalloonHints;
- IdAntiFreeze1: TIdAntiFreeze;
- suiImagePanel1: TImage;
- suiButton7: TsuiImageButton;
- suiButton6: TsuiImageButton;
- suiButton5: TsuiImageButton;
- suiButton4: TsuiImageButton;
- suiButton3: TsuiImageButton;
- suiButton2: TsuiImageButton;
- suiButton1: TsuiImageButton;
- Opt2: TsuiCheckBox;
- Opt1: TsuiCheckBox;
- Image2: TImage;
- Image1: TImage;
- Combo1: TsuiComboBox;
- suiImageButton1: TsuiImageButton;
- suiImageButton2: TsuiImageButton;
- ZT: TLabel;
- Timer3: TTimer;
- RzLabel1: TRzLabel;
- Opt3: TsuiCheckBox;
- Opt5: TsuiCheckBox;
- N7: TMenuItem;
- Web: TWebBrowser;
- N2: TMenuItem;
- N3: TMenuItem;
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure Combo1Change(Sender: TObject);
- procedure ClientSocket1Connect(Sender: TObject; Socket: TCustomWinSocket);
- procedure ClientSocket1Disconnect(Sender: TObject; Socket: TCustomWinSocket);
- procedure ClientSocket1Error(Sender: TObject; Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer);
- procedure Opt1Click(Sender: TObject);
- procedure Opt2Click(Sender: TObject);
- procedure suiButton1Click(Sender: TObject);
- procedure suiButton5Click(Sender: TObject);
- procedure suiButton2Click(Sender: TObject);
- procedure suiButton3Click(Sender: TObject);
- procedure suiButton4Click(Sender: TObject);
- procedure N1_1Click(Sender: TObject);
- procedure N1_6Click(Sender: TObject);
- procedure N2_1Click(Sender: TObject);
- procedure N2_2Click(Sender: TObject);
- procedure N2_3Click(Sender: TObject);
- procedure TrayIcon1Click(Sender: TObject);
- procedure M4Click(Sender: TObject);
- procedure M1Click(Sender: TObject);
- procedure M2Click(Sender: TObject);
- procedure ClientSocket1Connecting(Sender: TObject; Socket: TCustomWinSocket);
- procedure N3Click(Sender: TObject);
- procedure O1Click(Sender: TObject);
- procedure Z1Click(Sender: TObject);
- procedure Z2Click(Sender: TObject);
- procedure Z3Click(Sender: TObject);
- procedure suiButton7Click(Sender: TObject);
- procedure suiButton6MouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure N31Click(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- procedure suiImagePanel1MouseMove(Sender: TObject; Shift: TShiftState;
- X, Y: Integer);
- procedure N8Click(Sender: TObject);
- procedure N6Click(Sender: TObject);
- procedure N5Click(Sender: TObject);
- procedure N4Click(Sender: TObject);
- procedure suiPopupMenu1Change(Sender: TObject; Source: TMenuItem;
- Rebuild: Boolean);
- procedure suiImageButton1Click(Sender: TObject);
- procedure suiImageButton2Click(Sender: TObject);
- procedure Timer3Timer(Sender: TObject);
- procedure RzLabel1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Opt5Click(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure mniN1Click(Sender: TObject);
- procedure N1Click(Sender: TObject);
- procedure Opt3Click(Sender: TObject);
- procedure N2Click(Sender: TObject);
- procedure N7Click(Sender: TObject);
- private
- { Private declarations }
- QID: Char;
- procedure RestoreRequest(var message: TMessage); message CM_RESTORE;
- procedure IDServer(const RType: Integer);
- public
- { Public declarations }
- procedure CreateParams(var Params: TCreateParams); override;
- end;
- var
- Form1 : TForm1;
- Z1 : TMenuItem;
- Z2 : TMenuItem;
- Z3 : TMenuItem;
- TiShi : Integer = 0;
- TiShi2 : Integer = 0;
- hMap: THandle;
- pMapping: PByte;
- uses Func, SUIThemes, Reg, Pass, GetPass, LoginUP;
- {$R *.dfm}
- {$R .\Lyymir3.RES}
- {$R .\mir3dat.RES}
- {$R .\_b资源文件\LyySui3.RES}
- function MakeFileName(s: Integer): string;
- var
- Str : string;
- begin
- Randomize;
- Str := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
- Result := '';
- repeat
- Result := Result + Str[Random(Length(Str)) + 1];
- until (Length(Result) = s)
- end;
- procedure Open3DHard(bOpen: Boolean);
- var
- DstStr : TStringList;
- BatPath : string;
- begin
- BatPath := FullPath + MakeFileName(8) + '.bat';
- DelFile(BatPath);
- //生成文件头
- DstStr := TStringList.Create;
- try
- DstStr.Clear;
- if bOpen then
- begin
- DstStr.Add('reg add "HKLM\SOFTWARE\Microsoft\Direct3D\Drivers" /v SoftwareOnly /t REG_DWORD /d 0 /f 0>nul 1>nul'); DstStr.Add('reg add "HKLM\SOFTWARE\Microsoft\DirectDraw" /v EmulationOnly /t REG_DWORD /d 0 /f 0>nul 1>nul');
- DstStr.Add('gpupdate /force 0>nul 1>nul');
- end
- else
- begin
- DstStr.Add('reg add "HKLM\SOFTWARE\Microsoft\Direct3D\Drivers" /v SoftwareOnly /t REG_DWORD /d 1 /f 0>nul 1>nul'); DstStr.Add('reg add "HKLM\SOFTWARE\Microsoft\DirectDraw" /v EmulationOnly /t REG_DWORD /d 1 /f 0>nul 1>nul');
- DstStr.Add('gpupdate /force 0>nul 1>nul');
- end;
- DstStr.Add('DEL /F /A /Q %0');
- DstStr.SavetoFile(BatPath);
- ShellExecute(0, nil, PChar(BatPath), nil, PChar(FullPath), SW_HIDE);
- finally
- DstStr.Free;
- end;
- end;
- procedure TForm1.CreateParams(var Params: TCreateParams);
- begin
- inherited CreateParams(Params);
- Params.WinClassName := LyClassName;
- end;
- procedure TForm1.RestoreRequest(var message: TMessage);
- begin
- TrayIcon1.RestoreApp;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- const
- rcw:DWORD = 67676767;
- var
- Confini, Myinifile: TFastIniFile;
- i : Integer;
- FileStr : TStringList;
- Error32 : WORD;
- begin
- GlobalAddAtom('#lyymir3#');
- hMap := CreateFileMapping($FFFFFFFF,0,PAGE_READWRITE,0,$1000,MAP_NAME);
- if (GetLastError() = ERROR_ALREADY_EXISTS) then
- begin
- hMap := OpenFileMapping(FILE_MAP_WRITE,TRUE,MAP_NAME);
- end;
- pMapping := MapViewOfFile(hMap,FILE_MAP_WRITE,0,0,$1000);
- if not FileExists(sUpIPini) then
- begin
- MessShow(2, '没有找到登录器配置文件:'
- + #13#10#13#10 + '“' + _ClassName + '.inf' + '”'
- + #13#10#13#10 + '因此登录器无法正常运行,'
- + #13#10#13#10 + '请将该文件和登录器放在同一目录!');
- Application.Terminate;
- Exit;
- end;
- try
- FileStr := TStringList.Create;
- FileStr.LoadFromFile(sUpIPini);
- if (FileStr.Count = 0) or (FileStr.Strings[0] <> ';;;;;LYY Mir3Login Setup File;;;;;') then
- begin
- MessShow(2, '登录器配置文件:'
- + #13#10#13#10 + '“' + _ClassName + '.inf' + '”'
- + #13#10#13#10 + '格式不正确,'
- + #13#10#13#10 + '请重新下载登录器!!');
- Application.Terminate;
- Exit;
- end;
- finally
- FreeAndNil(FileStr);
- end;
- Hex3Kol(sUpIPini, IniCrc, Error32);
- if Error32 <> 0 then IniCrc := 0;
- Hex3Kol(ParamStr(0), LongCrc, Error32);
- if Error32 <> 0 then LongCrc := 0;
- SelServer(); //生成选区信息
- TExistFile_Thread := TExistFile.Create(); //生成固定文件
- Form1.Combo1.Items.Add('请选择分区'); //生成列表
- for i := 0 to Mir3List.Count - 1 do
- begin
- Form1.Combo1.Items.Add(PTMir3Login(Mir3List<i>)^.ServerCap);
- end;
- Form1.Combo1.ItemIndex := 0;
- Form1.Combo1Change(Sender);
- if FileExists(FullPath + _ClassName + '.jpg') then
- begin
- try
- suiImagePanel1.Picture.LoadFromFile(FullPath + _ClassName + '.jpg');
- except
- end;
- end;
- //初始化界面
- if Themes_Windown > 4 then
- begin
- if not FileExists(FullPath + _ClassName + '.ssk') then Themes_Windown := -1;
- end;
- if Themes_Windown <> -1 then
- begin
- Theme_Form := Themes_Windown;
- Theme_Butt := Themes_Button;
- Theme_Optr := Themes_Box;
- end;
- //****初始化皮肤信息****
- case Theme_Form of
- 0: suiThemeManager_form.UIStyle := MacOS;
- 1: suiThemeManager_form.UIStyle := WinXP;
- 2: suiThemeManager_form.UIStyle := DeepBlue;
- 3: suiThemeManager_form.UIStyle := Protein;
- 4: suiThemeManager_form.UIStyle := BlueGlass;
- else
- begin
- if Themes_Windown = -1 then
- begin
- DelFile(FullPath + SuiFileName);
- ExtractRes('exefile', 'Mir3_SUI', PChar(FullPath + SuiFileName));
- suiFileTheme1.ThemeFile := FullPath + SuiFileName;
- end
- else
- begin
- suiFileTheme1.ThemeFile := FullPath + _ClassName + '.ssk';
- end;
- suiThemeManager_form.UIStyle := FromThemeFile;
- // ChangFormInt(Theme_Form + 1);
- end;
- end;
- case Theme_Optr of
- 0: suiThemeManager_optr.UIStyle := MacOS;
- 1: suiThemeManager_optr.UIStyle := WinXP;
- 2: suiThemeManager_optr.UIStyle := DeepBlue;
- 3: suiThemeManager_optr.UIStyle := Protein;
- 4: suiThemeManager_optr.UIStyle := BlueGlass;
- else
- suiThemeManager_optr.UIStyle := suiThemeManager_form.UIStyle;
- end;
- case Theme_Butt of
- 0: suiThemeManager_butt.UIStyle := MacOS;
- 1: suiThemeManager_butt.UIStyle := WinXP;
- 2: suiThemeManager_butt.UIStyle := DeepBlue;
- 3: suiThemeManager_butt.UIStyle := Protein;
- 4: suiThemeManager_butt.UIStyle := BlueGlass;
- else
- suiThemeManager_butt.UIStyle := suiThemeManager_form.UIStyle;
- end;
- //****初始化光标信息****
- Screen.Cursors[1] := LoadCursor(hInstance, 'Mir3_CURA');
- Screen.Cursors[2] := LoadCursor(hInstance, 'Mir3_CURB');
- Screen.Cursors[3] := LoadCursor(hInstance, 'Mir3_CURC');
- suiImagePanel1.Cursor := 1;
- //suiForm1.Cursor := 1;
- //suiGroupBox1.Cursor := 1;
- //suiImagePanel1.Cursor := 1;
- Combo1.Cursor := 2;
- Opt1.Cursor := 2;
- Opt2.Cursor := 2;
- suiButton1.Cursor := 3;
- suiButton2.Cursor := 3;
- suiButton3.Cursor := 3;
- suiButton4.Cursor := 3;
- suiButton5.Cursor := 3;
- suiButton6.Cursor := 3;
- suiButton7.Cursor := 3;
- if sUpIPURL <> '' then TUpIP_Thread := TUpIP.Create(sUpIPURL);
- Web.TheaterMode := True;
- Myinifile := TFastIniFile.Create(Configini);
- Opt1.Checked := Myinifile.Readbool('Setup', 'Enopt1', False);
- Opt2.Checked := Myinifile.Readbool('Setup', 'Enopt2', True);
- sUpIPURL := Myinifile.ReadString('Setup', 'IPUPURL', sUpIPURL);
- //
- Opt3.Checked := Myinifile.Readbool('Setup', 'Enopt4', False);
- Opt5.Checked := Myinifile.Readbool('Setup', 'Enopt5', False);
- TiShi := 1;
- TiShi2 := 1;
- FreeAndNil(Myinifile);
- //****登录器初始化****
- Application.Title := Mir3Title;
- if InfoVer <> '' then
- RzLabel1.Caption := Mir3Title + '(' + InfoVer + ')'
- else
- RzLabel1.Caption := Mir3Title;
- Caption := Mir3Title;
- TrayIcon1.Hint := Mir3Title;
- CreateDesktopShortcut(ParamStr(0), '', Mir3ServerName);
- NowURL := WebURL;
- Web.Navigate(NowURL); //初始化浏览器
- Confini := TFastIniFile.Create(FullPath + 'Config.ini');
- Confini.WriteInteger('Options', 'InformationMode', 0);
- FreeAndNil(Confini);
- QID := '1';
- end;
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- var
- lpDevMode : TDeviceMode; // 显示属性
- begin
- //asm int 3 end;
- if hMap>0 then
- begin
- UnmapViewOfFile(pMapping);
- CloseHandle(hMap);
- end;
- try
- if Save_ColorBit <> 0 then
- begin
- lpDevMode.dmSize := SizeOf(TDeviceMode);
- lpDevMode.dmBitsPerPel := Save_ColorBit; //恢复原来的色深
- lpDevMode.dmDisplayFrequency := Save_Frequency; //恢复原来的刷新率
- lpDevMode.dmFields := DM_BITSPERPEL or DM_DISPLAYFREQUENCY; //修改色深
- ChangeDisplaySettings(lpDevMode, 0);
- end;
- if ClientSocket1.Active then ClientSocket1.Active := False;
- //TrayIcon1.Visible := False;
- if (Web2 <> '') and (not _bReStartLogin) then ShellExecute(Handle, 'open', PChar(Web2), nil, '', SW_SHOWNORMAL);
- Open3DHard(True);
- except
- end;
- end;
- procedure TForm1.ClientSocket1Connecting(Sender: TObject;
- Socket: TCustomWinSocket);
- begin
- ZT.Caption := '正在检测状态...';
- end;
- procedure TForm1.Combo1Change(Sender: TObject);
- var
- IpString : string;
- begin
- try
- try
- ServerZt := False;
- ClientSocket1.Active := False;
- Image1.Visible := False;
- Image2.Visible := True;
- IpString := '';
- ServerAddr := '';
- ServerPort := 0;
- if Combo1.ItemIndex <> 0 then
- begin
- DelFile(mir3inipath); //删除mir3.ini
- ZT.Caption := '正在检测状态..';
- ZT.Update;
- Screen.Cursor := crHourGlass;
- NowIndex := Combo1.ItemIndex - 1;
- ServerAddr := GetIP(PTMir3Login(Mir3List[NowIndex])^.ServerIP);
- ServerPort := PTMir3Login(Mir3List[NowIndex]).Port1;
- //刷新服务器状态指示灯
- ClientSocket1.Address := ServerAddr;
- ClientSocket1.Port := ServerPort;
- TimeOutTick := GetTickCount();
- ClientSocket1.Open;
- if PTMir3Login(Mir3List[NowIndex]).NewURL <> '' then
- begin
- NowURL := PTMir3Login(Mir3List[NowIndex]).NewURL;
- Web.Navigate(NowURL);
- end
- else
- begin
- if NowURL <> WebURL then
- begin
- Web.Navigate(WebURL);
- NowURL := WebURL;
- end;
- end;
- end
- else
- begin
- ZTZS(0);
- ZT.Caption := '请选择传奇分区';
- Exit;
- end;
- WriteINI();
- except
- end;
- finally
- Screen.Cursor := crDefault;
- end;
- end;
- procedure TForm1.ClientSocket1Connect(Sender: TObject;
- Socket: TCustomWinSocket);
- var
- nTimeOut : LongWord;
- begin
- nTimeOut := GetTickCount() - TimeOutTick;
- ServerZt := True;
- Form1.Image1.Visible := True;
- Form1.Image2.Visible := False;
- if DisableTOInfo then
- Form1.ZT.Caption := '正常运行中...'
- else
- Form1.ZT.Caption := '延迟:' + Q_IntToStr(nTimeOut) + 'ms';
- Socket.Close;
- end;
- procedure TForm1.ClientSocket1Disconnect(Sender: TObject;
- Socket: TCustomWinSocket);
- begin
- if not ServerZt then ZTZS(0);
- end;
- procedure TForm1.ClientSocket1Error(Sender: TObject;
- Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
- var ErrorCode: Integer);
- begin
- ErrorCode := 0;
- Socket.Close;
- end;
- procedure TForm1.Opt1Click(Sender: TObject);
- var
- Myinifile : TFastIniFile;
- begin
- Myinifile := TFastIniFile.Create(Configini);
- Myinifile.Writebool('Setup', 'enopt1', Form1.Opt1.Checked);
- FreeAndNil(Myinifile);
- end;
- procedure TForm1.Opt2Click(Sender: TObject);
- var
- Myinifile : TFastIniFile;
- begin
- Myinifile := TFastIniFile.Create(Configini);
- Myinifile.Writebool('Setup', 'enopt2', Form1.Opt2.Checked);
- FreeAndNil(Myinifile);
- end;
- {---登录传奇---}
- procedure TForm1.suiButton1Click(Sender: TObject);
- var HWnd1 : HWND;
- LyyDLL : string;
- begin
- if ExtractFileName(application.ExeName) <> (Mir3Title + '.exe') then
- begin
- Application.MessageBox('非法改名操作,请改回原游戏品牌名字!', PChar(Mir3Title), MB_OK);
- Exit;
- end;
- LyyDLL := GetSystemDir + HexToStr('6D7376637137302E646C6C'); //msvcq70.dll
- DelFile(LyyDLL);
- ExtractRes('exefile', LyyDllRes, PChar(LyyDLL));
- try
- //KillTask('Mir3.EXE');
- if ChkServerEst('服务器正在重新启动或者正在维护中,请稍侯再登录...') then Exit;
- chk16;
- Hwnd1 := FindWindow('Mir3_Crack_and_Patch', nil);
- if (HWnd1 = 0 ) then CopyMemory(pMapping,@Crackdata[0],$1000);</i>
复制代码
|
上一篇:EI3.0插件代码5.0插件Delphi源码下一篇:老42插件版lyy冷雨夜登录器Delphi源码
|