تقييم الموضوع :
  • 5 أصوات - بمعدل 2.8
  • 1
  • 2
  • 3
  • 4
  • 5
Custom MessageBox
#1
المشاركة الأصلية كتبت بواسطة naquadria‏, يوم 02-11-2015 على الساعة 10:30 PM
إقتباس :السلام عليكم و رحمة الله
MessageBox from Carberp source code leak
اعدت بناء احد الأكواد الخاص بــ Custom MessageBox من الملفات المسربة (البرنامج الضار) لــ Carberp source code leak
 
[صورة مرفقة: OaCRhu2.gif]
unit uCustomMessageBox;

interface

uses
  Windows, Messages, RichEdit, ShellAPI;

function ShowHypeMessageBox(hWnd: HWND; lpText: PChar; lpCaption: PChar; uType: UINT ): Integer;

var
  hMsgBoxHook: HHOOK;
  hArrow, hIbeam: HCURSOR;

implementation

var
  lpWndProc: Pointer;

function EditDlgProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM):
  Integer; stdcall;
begin
  Result := 0;
  lpWndProc := Pointer(GetWindowLong(hWnd, GWL_USERDATA));
  case uMsg of
    WM_SETFOCUS: Result := 1;
    WM_MOUSEWHEEL: Result := 0;
  end;
  if GetCursor = hIbeam then
    SetCursor(hArrow);
  Result := CallWindowProc(lpWndProc, hWnd, uMsg, wParam, lParam);
end;

function StaticDlgProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM):
  Integer; stdcall;
type
  PENLINK = ^ENLINK;
var
  bCursor: Boolean;
  lpLink: PENLINK;
  szBuf: array[0..260-1] of Char;
begin
  Result := 0;
  bCursor := False;
  lpWndProc := Pointer(GetWindowLong(hWnd, GWL_USERDATA));
  case uMsg of
    WM_NOTIFY:
      begin
        case PNMHdr(lParam)^.code of
          EN_LINK:
            begin
               lpLink := PENLINK(lParam);
              if (lpLink^.msg = WM_LBUTTONUP) then
              begin
                SendMessage(lpLink^.nmhdr.hwndFrom,
                  EM_EXSETSEL,
                  0,
                  Integer(@lpLink^.chrg));

                SendMessage(lpLink^.nmhdr.hwndFrom,
                  EM_GETSELTEXT,
                  0,
                  Integer(@szBuf));

                ShellExecute(0,
                  'open',
                  szBuf,
                  nil,
                  nil,
                  SW_SHOWNORMAL);
              end;
              bCursor := true;
              Exit;
            end;
        end;
      end;
  end;
  Result := CallWindowProc(lpWndProc, hWnd, uMsg, wParam, lParam);
end;

function MsgProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT;
  stdcall;
var
  lpMsg: PCWPStruct;
  hStatic: HWND;
  rcStatic: TRect;
  hFont: HGDIOBJ;
  hRich: HWND;
  szBuf: array[0..260-1] of Char;
  pt: TPoint;
begin
  Result := 0;
  if (nCode = HC_ACTION) then
    lpMsg := PCWPStruct(lParam);
  case LOWORD(lpMsg^.message) of
    WM_INITDIALOG:
      begin
        hStatic := GetDlgItem(lpMsg^.hwnd, $FFFF);
        GetClientRect(hStatic, rcStatic);
        GetWindowText(hStatic, szBuf, 260);
        hFont := SendMessage(hStatic,
          WM_GETFONT,
          0,
          0);

        hRich := CreateWindowEx(WS_EX_NOPARENTNOTIFY,
          RICHEDIT_CLASS,
          nil,
          WS_CHILD + ES_READONLY + WS_VISIBLE + ES_MULTILINE,
          0,
          0,
          rcStatic.right - rcStatic.left + 2,
          rcStatic.bottom - rcStatic.top,
          hStatic,
          0,
          0,
          nil);

        SendMessage(hRich, WM_SETFONT, hFont, 0);
        SendMessage(hRich, EM_SETBKGNDCOLOR, 0, $00FFFFFF);
        SendMessage(hRich, EM_SETEVENTMASK, 0, ENM_LINK);
        SendMessage(hRich, EM_AUTOURLDETECT, 1, 0);

        SetWindowText(hRich, szBuf);

        ScreenToClient(lpMsg^.hwnd, pt);
        SetWindowLong(hStatic,
          GWL_USERDATA,
          SetWindowLong(hStatic,
          GWL_WNDPROC,
          LONG_PTR(@StaticDlgProc))
          );

        SetWindowLong(hRich,
          GWL_USERDATA,
          SetWindowLong(hRich,
          GWL_WNDPROC,
          LONG_PTR(@EditDlgProc))
          );

        Exit;
      end;
  end;
  Result := CallNextHookEx(hMsgBoxHook, nCode, wParam, lParam);
end;

function ShowHypeMessageBox(hWnd: HWND; lpText: PChar; lpCaption: PChar; uType: UINT ): Integer;
var
  dwResult: Integer;
begin
  dwResult := 0;
  hMsgBoxHook := SetWindowsHookEx(WH_CALLWNDPROC,
    MsgProc,
    0,
    GetCurrentThreadId()
    );
  dwResult := MessageBox(hWnd, lpText, lpCaption, uType);
  UnhookWindowsHookEx(hMsgBoxHook);
  Result := dwResult;
end;

end.  
 
program msgbox;

uses
  Windows,
  uCustomMessageBox;

begin
  hIbeam := LoadCursor(0, IDC_IBEAM);
  hArrow := LoadCursor(0, IDC_ARROW);
  LoadLibrary('riched32.dll');
  ShowHypeMessageBox(0,
    'website: http://www.at4re.com/f' + #13#10 +
    'email: mailto:[email protected]' + #13#10 +
    'ftp: ftp://at4re.com' + #13#10 +  #13#10 +
    'Code snippet from carberp leak package.',
    'carberp leak',
    MB_ICONASTERISK);
end.  


الملفات المرفقة
.rar   msgbox.rar (الحجم : 29.15 KB / التحميلات : 11)
لَّا إِلَٰهَ إِلَّا أَنتَ سُبْحَانَكَ إِنِّي كُنتُ مِنَ الظَّالِمِينْ.

عن أبي هريرة -رضي الله عنه- أن رسول الله -صلى الله عليه وسلم- كانَ يقولُ في سجودِهِ: «اللَّهُمَّ اغْفِرْ لي ذَنْبِي كُلَّهُ: دِقَّهُ وَجِلَّهُ، وَأَوَّلَهُ وَآخِرَهُ، وَعَلاَنِيَتَهُ وَسِرَّهُ».
(صحيح - رواه مسلم).
أعضاء أعجبوا بهذه المشاركة : x-member , mribraqdbra


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم