Tips

Tips

Video

Showing posts with label Tips. Show all posts
Showing posts with label Tips. Show all posts

Saturday, October 24, 2015

DLL injection and DLL injection example

View here for understand DLL injection and example
- Today I will show you another way using DLL Injection with parameters
- Change NewWndProc function.


DLL injection and DLL injection example (2/2)



NewWndProc









Data Structure

typedef struct tag_locksomeoneuseskill
{ 
 int iIndex;   // skill ID
 int iPos;   // vị trí monster trong mảng NPC
}Locksomeoneuseskill; // struct tham số cho function LockSomeOneUseSkill 


Source code


// dllmain.cpp : Defines the entry point for the DLL application.
/* ****************************************
 * Author: Zidane (huuvi168@gmail.com)
 * Last modified: 2015-06-08
 * ****************************************/

/************************************************************************
VịLH - NewWndProc - 23/05/2013
 Hàm nhận các sự kiện bên chương trình chính gửi qua
params:
 + HWND: HWnd cửa sổ đang chọn
 + UINT: Message của chương trình
 + WPARAM: Tham số wparam
 + LPARAM: Tham số lparam
return: 
 
*************************************************************************/

LRESULT CALLBACK NewWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ 
      switch(uMsg) 
      {
          case WM_COPYDATA: // get data from shared memory area
                        COPYDATASTRUCT* pcds = (COPYDATASTRUCT *)lParam; 
                 if (pcds->dwData == DATA_LOCKSOMEONEUSESKILL)
                 {           
                    iIdSkill = ((Locksomeoneuseskill *)(pcds->lpData))->iIndex;
                    iPosition = ((Locksomeoneuseskill *)(pcds->lpData))->iPos;
                  }
               break; 
      }


     if (!hWnd)
                                                       return CallWindowProc(OldWndProc, hWnd, uMsg, wParam, lParam);
     DWORD pid;
     GetWindowThreadProcessId(hWnd, &pid);  
 

      // Ứng dụng gửi rất nhiều message nhưng chỉ xử lý message 
      // WM_HOOK_WRITE thôi
      if (uMsg == WM_HOOK_WRITE)
      {   
    switch (wParam)
    {     
  case WPARAM_LOCKSOMEONEUSESKILL:
      if (iPosition > 0 && iIdSkill > 0)
   LockSomeOneUseSkill(pid, iPosition, iIdSkill);
      break;   
  }
           } 

           return CallWindowProc(OldWndProc, hWnd, uMsg, wParam, lParam);
      }
}







Main function



COPYDATASTRUCT MyCDS;
Locksomeoneuseskill locksomeoneStruct;
locksomeoneStruct.iIndex = 128;
locksomeoneStruct.iPos = 10488;
  
MyCDS.dwData = DATA_LOCKSOMEONEUSESKILL;
MyCDS.cbData = sizeof(locksomeoneStruct);
MyCDS.lpData = &locksomeoneStruct;

// copy data locksomeoneuseskill
::SendMessage(m_hCurrentWnd, WM_COPYDATA, 0, reinterpret_cast<lparam>(&MyCDS));  

// using function looksomeoneusekill
::SendMessage(m_hCurrentWnd, WM_HOOK_WRITE, WPARAM_LOCKSOMEONEUSESKILL, 1); 

Description

WM_COPYDATA constant will be reference to below source


case WM_COPYDATA: // get data from shared memory area
   COPYDATASTRUCT* pcds = (COPYDATASTRUCT *)lParam; 
   if (pcds->dwData == DATA_LOCKSOMEONEUSESKILL)
   {           
 iIdSkill = ((Locksomeoneuseskill *)(pcds->lpData))->iIndex;
 iPosition = ((Locksomeoneuseskill *)(pcds->lpData))->iPos;
   } 



View more: http://learn-tech-tips.blogspot.com/2015/08/dll-injection-exmaple.html
Have a nice weekend day!
Zidane

How to Edit picture with lighting border

How to Edit picture with lighting border


[Photoshop]
Sometime you want to highlight picture for easy viewing.
Today I'll show you how to lighting border picture same as Result picture







Initial Picture



Edit picture with lighting border

Result Picture

With white lighting border

Edit picture with lighting border

How to do it?

Step 1:

First get pure dragon by use Magic Wand Tool and remember choose Value on Tolerance = 30,

Lấy con rồng ra khỏi hình bằng cách dùng Magic Wand Tool nhớ chọn Tolerance = 30
Lưu ý: Tolerance là độ giống nhau gần nó nhất của màu sắc hiện tại
Tolerance = 30 có nghĩa là 30 màu giống nhau gần nó nhất
 

Edit picture with lighting border

Step 2:

Press Ctrl + Shift + I: for Invert selection choose-> choose the dragon :D. If you see hard for you, you can see my video.

Nhấn Ctrl + Shift + I để đổi vùng chọn (hình ban đâu chọn nền, nhấn phím này với muc đích đảo lại vùng chọn)


Edit picture with lighting border

Step 3:

Ctrl + J : create new layer with dargon choiced (layer 1)
Then create New Layer -> and fill dark background same as the below picture
Choose layer 1 -> and then choose fx -> Blending Options

Nhấn Ctrl + J đế tạo layer mới với hình con rồng đang chọn, tiếp tục tạo một layer mới và tô màu đen cho layer đó, sau đó chọn layer hình con rồng*, Chọn Blending Options -> tiến hành config Outer glow như hình bên dưới

* (lúc này ta có ba layer: layer đầu tiên là  background hình ảnh, layer thứ hai là background màu đen, layer thứ ba là layer chứa con rồng)

Edit picture with lighting border
Choose Outer glow with below settings option.

Edit picture with lighting border

After config, we have 3 layers

Edit picture with lighting border



Step 4


View the result :D

Note:

CTRL + SHIFT + I: Invert selection (đảo ngược vùng chọn)
CTRL + I                   : Copy layer
CTRL + ALT + J     : Create New Layer with choose Area








Live Demo: view here

Have a nice day!
Zidane



Get current link path of website from PHP

Get current link path of website from PHP









This function will be help you how to get current link path of website from PHP

Source code


<?php
  function getCurrentPageURL() {
    $pageURL = 'http';
 
    if (!empty($_SERVER['HTTPS'])) {
      if ($_SERVER['HTTPS'] == 'on') {
        $pageURL .= "s";
      }
    }
 
    $pageURL .= "://";
 
    if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] 
                                                . $_SERVER["REQUEST_URI"];
    } else {
      $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
    }
 
    return $pageURL;
  }
?>

Description above function:

Many people have many surprise and don't understand about function and variables
$_SERVER[“SERVER_NAME”], $_SERVER[“SERVER_PORT”]

Please read below comment, you'll be easy to understand it.
Ex I have one link patch same as:


http://sinhvienit.net/@forum/showthread.php?t=2053
http://learn-tech-tips.blogspot.com/2015/10/create-picture-with-light-border.html


When you use $SERVER, we have get some result here

$_SERVER[‘HTTP_HOST’] =>
learn-tech-tips.blogspot.com 

 $_SERVER[‘PHP_SELF’] => 
/2015/10/create-picture-with-light-border.html

$_SERVER[‘REQUEST_TIME’] => Time which client requested - TIME _STAMP

$_SERVER[‘QUERY_STRING’] => t = 2053???

$_SERVER[‘DOCUMENT_ROOT’] => folder contain source code
Ex: /home/learn-tech-tips/public_html

$_SERVER[‘REMOTE_HOST’] = Hostname of user access
$_SERVER[‘REMOTE_PORT’] => Remote Port of Browser connect to server

$_SERVER[‘REQUEST_URI’] =>
2015/10/create-picture-with-light-border.html

$_SERVER[‘SERVER_NAME’] => Name of server (same computer name)
Ex: learn-tech-tips Server

$_SERVER[‘SERVER_ADDR’] => IP of server

$_SERVER[‘REMOTE_ADDR’] => IP of access person

$_SERVER[‘HTTP_USER_AGENT’] => Information with browser of access person










Have a lucky day!
Zidane