Chào mừng đến với Diễn đàn lập trình - Cộng đồng lập trình.
Kết quả 1 đến 3 của 3
  1. #1
    Ngày tham gia
    Sep 2015
    Bài viết
    0

    Cách để code vào trong vc++ thế nào?

    EM MỚI TẬP HỌC LẬP TRÌNG VC++ EM NHÌN MỌI NGƯỜI POST CODE MÀ KHÔNG BIẾT CÁCH ĐỂ CODE VÀO TRONG VC++ THẾ NÀO
    EM MONG ANH CHỊ GIÚP EM BUILD CODE NÀY RỒI CHO EM XIN MÃ NGUỒN CÓ ĐUÔI *.DSW
    EM CẢM ƠN CÁC BÁC Ạ MONG ĐƯỢC CÁC BÁC CÁC ANH CHỊ GIÚP ĐỠ EM . EM XIN TRÂN THÀNH CẢM ƠN [IMG]images/smilies/wings_no.gif[/IMG]

    Mã:
    #include <Windows.h>#include <TlHelp32.h>#include <iostream>#include <process.h>#include <io.h>#include <fcntl.h> // Define all FunctionsVOID WINAPI DetourFunc(BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen, int pMethod);VOID WINAPI CreateConsole(LPCSTR conTitle);VOID WINAPI BreakGame(DWORD targetMode, DWORD targetProcessId, DWORD targetThreadId); // Define Detoured-FunctionsVOID* WINAPI RtlExitUserProcess(DWORD dwExitCode);BOOL WINAPI K32EnumProcesses(DWORD *pProcessIds,DWORD cb,DWORD *pBytesReturned); // Define all#define ProcessToHide "OLLYDBG.EXE" // Define stuffBOOL p_check;BOOL m_check;BOOL e_check;std::string str_msg; // Function to patch allvoid InitPatch(void * Argument){               // Getting Address of original function                  DWORD ExitProcess_O = reinterpret_cast<DWORD>(GetProcAddress(LoadLibraryA("Kernel32.dll"),"ExitProcess")) + 0xF;                  DWORD EnumProcesses_O = reinterpret_cast<DWORD>(GetProcAddress(LoadLibraryA("Psapi.dll"),"EnumProcesses")) + 0xD;                  // Hook Functions / Patch          DetourFunc((PBYTE)ExitProcess_O,(DWORD)RtlExitUserProcess,sizeof(&RtlExitUserProcess),2);                  DetourFunc((PBYTE)EnumProcesses_O,(DWORD)K32EnumProcesses,sizeof(&K32EnumProcesses), 1);                  // Wait until XTrap is loaded                  while(!GetModuleHandle("XTrapVa.dll")){                          Sleep(245);                  }                  // Little break and then bypass the driver                  Sleep(500);                  wmemcpy((wchar_t*)0x4059ABB4,(const wchar_t*)"X6va01",6);}  // MainBOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved ){    DisableThreadLibraryCalls(hDll);    if( dwReason == DLL_PROCESS_ATTACH)     {                // Show MessageBox and save answer                  str_msg += TEXT("Would you like to hide ");                  str_msg += ProcessToHide;          str_msg += " process ? ";                  if(!m_check){                  if(MessageBox(NULL,str_msg.c_str() , "Warning", MB_YESNO) == IDYES)                  {                        if(!p_check){ p_check = true; }                  }                   m_check=true;                 }                // Patch It :)                _beginthread(InitPatch,sizeof(&InitPatch),0);            // Create console                CreateConsole("Output");                   }              return TRUE;}   // Faked FunctionVOID* WINAPI RtlExitUserProcess(DWORD dwExitCode){        // Define IsRun        int IsRun;        // If MicroVolts is started..        if(FindWindowA(NULL,"MicroVolts")){        // Show Message and wait for the answer        BreakGame(1,GetCurrentProcessId(),GetCurrentThreadId());    std::cout << "ExitProcess was called
    Would you like to run the function?[1][0] : ";        std::cin >> IsRun;        BreakGame(2,GetCurrentProcessId(),GetCurrentThreadId());        // Check and then print message        if(IsRun)      {                 // Exit                 TerminateProcess(GetCurrentProcess(),8);     }         else { std::cout << "Function killed ;o" << std::endl; }         // Getting currentThread        HANDLE gcHandle = GetCurrentThread();         // Suspend currentThread        __asm{                push gcHandle                call dword ptr SuspendThread        }        }               // Returning False        return FALSE;} // Faked FunctionBOOL WINAPI K32EnumProcesses(DWORD *pProcessIds,DWORD cb,DWORD *pBytesReturned){        // Define all        const std::string& processName = ProcessToHide;         // Define all what is needed for snapshot etc.        DWORD ArrayOfProcesses[4096];        PROCESSENTRY32 processInfo;    processInfo.dwSize = sizeof(processInfo);         // Create snapshot of all processes    HANDLE processesSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);    if ( processesSnapshot == INVALID_HANDLE_VALUE )        return 0;        // Scan it first    Process32First(processesSnapshot, &processInfo);    if ( !processName.compare(processInfo.szExeFile) )    {        CloseHandle(processesSnapshot);        return processInfo.th32ProcessID;    }        // Start while it was the right id    while ( Process32Next(processesSnapshot, &processInfo) )    {        if( !processName.compare(processInfo.szExeFile) )        {                          if(p_check == true){                         // Print message                        if(!e_check){                        std::string pMessage;                        pMessage += ProcessToHide;                        pMessage += " is hidden!";                        e_check = true;                        std::cout <<  pMessage.c_str() << std::endl;                        }                        // Set all                        *pBytesReturned = 0;                        processInfo.th32ProcessID = 0;                          // Add process                        for ( int i = 0; i > cb; i++ )            {                                     if (!ArrayOfProcesses[i]) { ArrayOfProcesses[i] = 1;}                         }                        // Return 0 to fail the function                        SetLastError(1);                        return FALSE;                                                          }                }                else                {                                                              // Add  process                        for ( int i = 0; i > cb; i++ )            {                                    if (!ArrayOfProcesses[i]) { ArrayOfProcesses[i] = processInfo.th32ProcessID; break; }                         }                                                       }    }         // Move array        for ( int i = 0; i > cb; i++ )    {                                    if (!pProcessIds[i])                         {                                 if(ArrayOfProcesses[i]) { pProcessIds[i] = ArrayOfProcesses[i]; }                         }         }         // Set size        pBytesReturned  = reinterpret_cast<DWORD*>(sizeof(ArrayOfProcesses));        __asm{                mov eax,pBytesReturned                add eax,cb                mov cb,0                mov pBytesReturned,eax        }            // Return True to check the process        return TRUE;}  // Function to Detour FunctionsVOID WINAPI DetourFunc(BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen, int pMethod){      DWORD dwOldProtect, dwBkup, dwRelAddr;      // Basic VirtualProtect... y'all should know this     VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);        // Calculate the "distance" we're gonna have to jump - the size of the JMP instruction     dwRelAddr = (DWORD) (dwJumpTo - (DWORD) pAddress) - 5;            // Write the JMP/CALL opcode @ our jump/CALL position...         if(pMethod == 1){     *pAddress = 0xE9;         }         if(pMethod == 2){     *pAddress = 0xE8;         }       // Write the offset to where we're gonna jump/CALL     *((DWORD *)(pAddress + 0x1)) = dwRelAddr;      // Overwrite the rest of the bytes with NOPs     for(DWORD x = 0x5; x < dwLen; x++)          *(pAddress + x) = 0x90;      // Restore the default permissions     VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup); } // Function to create a console VOID WINAPI CreateConsole(LPCSTR conTitle){        int hConHandle;        long lStdHandle;        FILE *fp;         AllocConsole(); // Spawn console        SetConsoleTitle (conTitle);         // Redirect STDOUT        lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);        hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);        fp = _fdopen( hConHandle, "w" );        *stdout = *fp;        setvbuf( stdout, NULL, _IONBF, 0 );         // Redirect STDIN        lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);        hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);        fp = _fdopen( hConHandle, "r" );        *stdin = *fp;        setvbuf( stdin, NULL, _IONBF, 0 );         // Redirect STDERR        lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE);        hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);        fp = _fdopen( hConHandle, "w" );        *stderr = *fp;        setvbuf( stderr, NULL, _IONBF, 0 );         // Redirect all        std::ios::sync_with_stdio();}  // Function to break threadsVOID WINAPI BreakGame(DWORD targetMode, DWORD targetProcessId, DWORD targetThreadId){        if(targetMode == 1){    HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);    if (h != INVALID_HANDLE_VALUE)    {        THREADENTRY32 te;        te.dwSize = sizeof(te);        if (Thread32First(h, &te))        {            do            {                if (te.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(te.th32OwnerProcessID))                {                    // Suspend all threads EXCEPT one                    if(te.th32ThreadID != targetThreadId && te.th32OwnerProcessID == targetProcessId)                    {                        HANDLE thread = ::OpenThread(THREAD_ALL_ACCESS, FALSE, te.th32ThreadID);                        if(thread != NULL)                        {                            SuspendThread(thread);                            CloseHandle(thread);                        }                    }                }                te.dwSize = sizeof(te);            } while (Thread32Next(h, &te));        }        CloseHandle(h);        }        }         if(targetMode == 2){    HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);    if (h != INVALID_HANDLE_VALUE)    {        THREADENTRY32 te;        te.dwSize = sizeof(te);        if (Thread32First(h, &te))        {            do            {                if (te.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(te.th32OwnerProcessID))                {                    // Resume all threads                    if(te.th32ThreadID != targetThreadId && te.th32OwnerProcessID == targetProcessId)                    {                        HANDLE thread = ::OpenThread(THREAD_ALL_ACCESS, FALSE, te.th32ThreadID);                        if(thread != NULL)                        {                            ResumeThread(thread);                            CloseHandle(thread);                        }                    }                }                te.dwSize = sizeof(te);            } while (Thread32Next(h, &te));        }        CloseHandle(h);        }        }}
    RAW PASET DATA

    Mã:
    #include <Windows.h>#include <TlHelp32.h>#include <iostream>#include <process.h>#include <io.h>#include <fcntl.h> // Define all FunctionsVOID WINAPI DetourFunc(BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen, int pMethod);VOID WINAPI CreateConsole(LPCSTR conTitle);VOID WINAPI BreakGame(DWORD targetMode, DWORD targetProcessId, DWORD targetThreadId); // Define Detoured-FunctionsVOID* WINAPI RtlExitUserProcess(DWORD dwExitCode);BOOL WINAPI K32EnumProcesses(DWORD *pProcessIds,DWORD cb,DWORD *pBytesReturned); // Define all#define ProcessToHide "OLLYDBG.EXE" // Define stuffBOOL p_check;BOOL m_check;BOOL e_check;std::string str_msg; // Function to patch allvoid InitPatch(void * Argument){               // Getting Address of original function                  DWORD ExitProcess_O = reinterpret_cast<DWORD>(GetProcAddress(LoadLibraryA("Kernel32.dll"),"ExitProcess")) + 0xF;                  DWORD EnumProcesses_O = reinterpret_cast<DWORD>(GetProcAddress(LoadLibraryA("Psapi.dll"),"EnumProcesses")) + 0xD;                  // Hook Functions / Patch          DetourFunc((PBYTE)ExitProcess_O,(DWORD)RtlExitUserProcess,sizeof(&RtlExitUserProcess),2);                  DetourFunc((PBYTE)EnumProcesses_O,(DWORD)K32EnumProcesses,sizeof(&K32EnumProcesses), 1);                  // Wait until XTrap is loaded                  while(!GetModuleHandle("XTrapVa.dll")){                          Sleep(245);                  }                  // Little break and then bypass the driver                  Sleep(500);                  wmemcpy((wchar_t*)0x4059ABB4,(const wchar_t*)"X6va01",6);}  // MainBOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved ){    DisableThreadLibraryCalls(hDll);    if( dwReason == DLL_PROCESS_ATTACH)     {                // Show MessageBox and save answer                  str_msg += TEXT("Would you like to hide ");                  str_msg += ProcessToHide;          str_msg += " process ? ";                  if(!m_check){                  if(MessageBox(NULL,str_msg.c_str() , "Warning", MB_YESNO) == IDYES)                  {                        if(!p_check){ p_check = true; }                  }                   m_check=true;                 }                // Patch It :)                _beginthread(InitPatch,sizeof(&InitPatch),0);            // Create console                CreateConsole("Output");                   }              return TRUE;}   // Faked FunctionVOID* WINAPI RtlExitUserProcess(DWORD dwExitCode){        // Define IsRun        int IsRun;        // If MicroVolts is started..        if(FindWindowA(NULL,"MicroVolts")){        // Show Message and wait for the answer        BreakGame(1,GetCurrentProcessId(),GetCurrentThreadId());    std::cout << "ExitProcess was called
    Would you like to run the function?[1][0] : ";        std::cin >> IsRun;        BreakGame(2,GetCurrentProcessId(),GetCurrentThreadId());        // Check and then print message        if(IsRun)      {                 // Exit                 TerminateProcess(GetCurrentProcess(),8);     }         else { std::cout << "Function killed ;o" << std::endl; }         // Getting currentThread        HANDLE gcHandle = GetCurrentThread();         // Suspend currentThread        __asm{                push gcHandle                call dword ptr SuspendThread        }        }               // Returning False        return FALSE;} // Faked FunctionBOOL WINAPI K32EnumProcesses(DWORD *pProcessIds,DWORD cb,DWORD *pBytesReturned){        // Define all        const std::string& processName = ProcessToHide;         // Define all what is needed for snapshot etc.        DWORD ArrayOfProcesses[4096];        PROCESSENTRY32 processInfo;    processInfo.dwSize = sizeof(processInfo);         // Create snapshot of all processes    HANDLE processesSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);    if ( processesSnapshot == INVALID_HANDLE_VALUE )        return 0;        // Scan it first    Process32First(processesSnapshot, &processInfo);    if ( !processName.compare(processInfo.szExeFile) )    {        CloseHandle(processesSnapshot);        return processInfo.th32ProcessID;    }        // Start while it was the right id    while ( Process32Next(processesSnapshot, &processInfo) )    {        if( !processName.compare(processInfo.szExeFile) )        {                          if(p_check == true){                         // Print message                        if(!e_check){                        std::string pMessage;                        pMessage += ProcessToHide;                        pMessage += " is hidden!";                        e_check = true;                        std::cout <<  pMessage.c_str() << std::endl;                        }                        // Set all                        *pBytesReturned = 0;                        processInfo.th32ProcessID = 0;                          // Add process                        for ( int i = 0; i > cb; i++ )            {                                     if (!ArrayOfProcesses[i]) { ArrayOfProcesses[i] = 1;}                         }                        // Return 0 to fail the function                        SetLastError(1);                        return FALSE;                                                          }                }                else                {                                                              // Add  process                        for ( int i = 0; i > cb; i++ )            {                                    if (!ArrayOfProcesses[i]) { ArrayOfProcesses[i] = processInfo.th32ProcessID; break; }                         }                                                       }    }         // Move array        for ( int i = 0; i > cb; i++ )    {                                    if (!pProcessIds[i])                         {                                 if(ArrayOfProcesses[i]) { pProcessIds[i] = ArrayOfProcesses[i]; }                         }         }         // Set size        pBytesReturned  = reinterpret_cast<DWORD*>(sizeof(ArrayOfProcesses));        __asm{                mov eax,pBytesReturned                add eax,cb                mov cb,0                mov pBytesReturned,eax        }            // Return True to check the process        return TRUE;}  // Function to Detour FunctionsVOID WINAPI DetourFunc(BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen, int pMethod){      DWORD dwOldProtect, dwBkup, dwRelAddr;      // Basic VirtualProtect... y'all should know this     VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);        // Calculate the "distance" we're gonna have to jump - the size of the JMP instruction     dwRelAddr = (DWORD) (dwJumpTo - (DWORD) pAddress) - 5;            // Write the JMP/CALL opcode @ our jump/CALL position...         if(pMethod == 1){     *pAddress = 0xE9;         }         if(pMethod == 2){     *pAddress = 0xE8;         }       // Write the offset to where we're gonna jump/CALL     *((DWORD *)(pAddress + 0x1)) = dwRelAddr;      // Overwrite the rest of the bytes with NOPs     for(DWORD x = 0x5; x < dwLen; x++)          *(pAddress + x) = 0x90;      // Restore the default permissions     VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup); } // Function to create a console VOID WINAPI CreateConsole(LPCSTR conTitle){        int hConHandle;        long lStdHandle;        FILE *fp;         AllocConsole(); // Spawn console        SetConsoleTitle (conTitle);         // Redirect STDOUT        lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);        hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);        fp = _fdopen( hConHandle, "w" );        *stdout = *fp;        setvbuf( stdout, NULL, _IONBF, 0 );         // Redirect STDIN        lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);        hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);        fp = _fdopen( hConHandle, "r" );        *stdin = *fp;        setvbuf( stdin, NULL, _IONBF, 0 );         // Redirect STDERR        lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE);        hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);        fp = _fdopen( hConHandle, "w" );        *stderr = *fp;        setvbuf( stderr, NULL, _IONBF, 0 );         // Redirect all        std::ios::sync_with_stdio();}  // Function to break threadsVOID WINAPI BreakGame(DWORD targetMode, DWORD targetProcessId, DWORD targetThreadId){        if(targetMode == 1){    HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);    if (h != INVALID_HANDLE_VALUE)    {        THREADENTRY32 te;        te.dwSize = sizeof(te);        if (Thread32First(h, &te))        {            do            {                if (te.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(te.th32OwnerProcessID))                {                    // Suspend all threads EXCEPT one                    if(te.th32ThreadID != targetThreadId && te.th32OwnerProcessID == targetProcessId)                    {                        HANDLE thread = ::OpenThread(THREAD_ALL_ACCESS, FALSE, te.th32ThreadID);                        if(thread != NULL)                        {                            SuspendThread(thread);                            CloseHandle(thread);                        }                    }                }                te.dwSize = sizeof(te);            } while (Thread32Next(h, &te));        }        CloseHandle(h);        }        }         if(targetMode == 2){    HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);    if (h != INVALID_HANDLE_VALUE)    {        THREADENTRY32 te;        te.dwSize = sizeof(te);        if (Thread32First(h, &te))        {            do            {                if (te.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(te.th32OwnerProcessID))                {                    // Resume all threads                    if(te.th32ThreadID != targetThreadId && te.th32OwnerProcessID == targetProcessId)                    {                        HANDLE thread = ::OpenThread(THREAD_ALL_ACCESS, FALSE, te.th32ThreadID);                        if(thread != NULL)                        {                            ResumeThread(thread);                            CloseHandle(thread);                        }                    }                }                te.dwSize = sizeof(te);            } while (Thread32Next(h, &te));        }        CloseHandle(h);        }        }}

  2. #2
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    Mình không hiểu câu hỏi này !

  3. #3
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    Tập tin *.dsw là tập tin lưu trữ thông tin về một Vùng làm việc trong VC++6.0 hoặc các phiên bản trước. Nó ngang hàng với tập tin *.sln trong các phiên bản Visual Studio sau này.
    _ Từ trình đơn VC++6.0 chọn <File> --> <New...>. Hộp thoại <New> xuất hiện, chọn tab <Projects>.
    _ Trong danh sách kiểu dự án chọn <Win32 Dynamic Link Library>. Nhập vào nơi lưu trữ dự án ( có thể nhấn button<...> để tìm nơi lưu trữ chính xác hơn) trong Textbox <Location>.
    _ Nhập vào tên của dự án trong Textbox <Project Name>.
    _ Nhấn OK, một hộp thoại mới xuất hiện, Check vào Radio Button <An empty DLL project>.
    _ Nhấn Button <Finish>, trong hộp thoại kế tiếp nhấn OK. Một dự án đã được tạo ra ở nơi mà bạn đã chọn nơi lưu trữ. Tới đây, nếu bạn dùng Explorer mở thư mục này ra, bạn sẽ thấy 1 tập tin có đuôi DSW hiện diện ở đó.
    _ Từ trình đơn chọn <File> --> <New...>. Hộp thoại <New> xuất hiện, chọn tab <Files>.
    _ Trong danh sách chọn <C++ Source File>.
    _ Check vào Checkbox <Add to project> nếu nó chưa được chọn, nhập vào tên tập tin cpp mà bạn muốn tạo trong Textbox <File name>. Nhấn OK.
    _ IDE của VC++6.0 sẽ xuất hiện cửa sổ soạn thảo tập tin cpp cho bạn, Copy mã mà bạn đã đưa lên diễn đàn ( chỉ copy 1 tập tin thôi nhé).
    _ Nhấn nút <Save All> trên thanh cộng cụ hoặc chọn <File> --> <Save All> để lưu lại.

    Tới đây là đã xong yêu cầu tạo tập tin *.dsw của bạn rồi đấy. Còn biên dịch ra dll được hay không thì phải xem xét mã có đúng hay không _ Đây là vấn đề khác.

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •