有哪一位高手可以帮忙翻译一下,下面这段VC++程序呀,
把它翻译成VB程序,,,可以吗????
高分奉送,绝不食言!!!!!
/***************************************************************
Module name: InjCode.cpp
Copyright (c) 2003 Robert KusterNotice: If this code works, it was written by Robert Kuster.
Else, I don't know who wrote it. Use it on your own risk. No responsibilities for
possible damages of even functionality can be taken.
***************************************************************/#include <Windows.h>
#include "InjCode.h"//---------------------------------------------------------------------
// INJDATA
// Notice: The data structure being injected.
//
typedef LRESULT (WINAPI *SENDMESSAGE)(HWND,UINT,WPARAM,LPARAM);typedef struct {
HWND hwnd;
SENDMESSAGE fnSendMessage; // pointer to user32!SendMessage BYTE pbText[128 * sizeof(TCHAR)];
} INJDATA, *PINJDATA;
//---------------------------------------------------------------------
// ThreadFunc
// Notice: - the code being injected; 
//    - the remote copy of this function retrieves the password;
//
// Return value: password length
//
static DWORD WINAPI ThreadFunc (INJDATA *pData)
{
// There must be less than a page-worth of local
// variables used in this function. int nXferred  = 0; // number of chars retrieved by WM_GETTEXT // Get password
nXferred = pData->fnSendMessage( pData->hwnd, WM_GETTEXT,
 sizeof(pData->pbText)/sizeof(TCHAR),
 (LPARAM)pData->pbText );
pData->pbText [127 * sizeof(TCHAR)] = __TEXT('\0'); // The thread's exit code is the number 
// of characters retrieved by WM_GETTEXT
return nXferred;
}// This function s the memory address after ThreadFunc.
// int cbCodeSize = (PBYTE) AfterThreadFunc - (PBYTE) ThreadFunc.
static void AfterThreadFunc (void) {
}
//---------------------------------------------------------------------
// GetTextRemote
// Notice: - copies ThreadFunc and INJDATA to the remote process;
//    - starts the excecution of the remote ThreadFunc;
//
// Return value: password length;
//
int GetTextRemote (HANDLE hProcess, HWND hWnd, BYTE* pbString, bool fUnicode)
{
HINSTANCE hUser32;
INJDATA *pDataRemote; // the address (in the remote process) where INJDATA will be copied to;
DWORD *pCodeRemote; // the address (in the remote process) where ThreadFunc will be copied to;
HANDLE hThread = NULL; // the handle to the thread executing the remote copy of ThreadFunc;
DWORD dwThreadId = 0; int   nCharsXferred = 0; // number of chars retrieved by WM_GETTEXT in the remote thread;
DWORD dwNumBytesXferred = 0; // number of bytes written/read to/from the remote process;

__try {
hUser32 = GetModuleHandle(__TEXT("user32"));
if (hUser32 == NULL)
__leave; // Initialize INJDATA and then 
// copy it to the remote process
INJDATA DataLocal = {
hWnd,
(SENDMESSAGE) GetProcAddress(hUser32, fUnicode ? "SendMessageW" : "SendMessageA")
};

if( DataLocal.fnSendMessage == NULL )
__leave;

// 1. Allocate memory in the remote process for INJDATA
// 2. Write a copy of DataLocal to the allocated memory
pDataRemote = (INJDATA*) VirtualAllocEx( hProcess, 0, sizeof(INJDATA), MEM_COMMIT, PAGE_READWRITE );
if (pDataRemote == NULL)
__leave;
WriteProcessMemory( hProcess, pDataRemote, &DataLocal, sizeof(INJDATA), &dwNumBytesXferred );
// Calculate the number of bytes that ThreadFunc occupies
const int cbCodeSize = ((LPBYTE) AfterThreadFunc - (LPBYTE) ThreadFunc); // 1. Allocate memory in the remote process for the injected ThreadFunc
// 2. Write a copy of ThreadFunc to the allocated memory
pCodeRemote = (PDWORD) VirtualAllocEx( hProcess, 0, cbCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
if (pCodeRemote == NULL)
__leave;
WriteProcessMemory( hProcess, pCodeRemote, &ThreadFunc, cbCodeSize, &dwNumBytesXferred );
// Start execution of remote ThreadFunc
hThread = CreateRemoteThread(hProcess, NULL, 0, 
(LPTHREAD_START_ROUTINE) pCodeRemote,
pDataRemote, 0 , &dwThreadId);
if (hThread == NULL)
__leave; WaitForSingleObject(hThread, INFINITE); // Get result (password) back
ReadProcessMemory( hProcess, pDataRemote, &DataLocal, sizeof(INJDATA), &dwNumBytesXferred); if (fUnicode)  wcscpy((LPWSTR) pbString, (LPCWSTR) DataLocal.pbText);
else    strcpy((LPSTR)  pbString, (LPCSTR)  DataLocal.pbText);
}
__finally {
if ( pDataRemote != 0 )
VirtualFreeEx( hProcess, pDataRemote, 0, MEM_RELEASE ); if ( pCodeRemote != 0 )
VirtualFreeEx( hProcess, pCodeRemote, 0, MEM_RELEASE ); if ( hThread != NULL ) {
GetExitCodeThread(hThread, (PDWORD) &nCharsXferred);
CloseHandle(hThread);
}
} // Return the number of chars retrieved 
// by WM_GETTEXT in the remote thread.
return nCharsXferred;
}///////////////////////////////////////////////////////////////////////////int GetWindowTextRemoteA (HANDLE hProcess, HWND hWnd, LPSTR  lpString)
{
return GetTextRemote (hProcess, hWnd, (BYTE*)lpString, false);
}int GetWindowTextRemoteW (HANDLE hProcess, HWND hWnd, LPWSTR lpString)
{
return GetTextRemote (hProcess, hWnd, (BYTE*)lpString, true);
}//////////////////////// End Of File //////////////////////////////////////

解决方案 »

  1.   

    不要翻译它,把它封装成dll,然后在vb中声明后使用
      

  2.   

    既然,上面几位高手,已经看懂了,,,为什么不帮忙翻译一下呢???
    万分的感激呀,,,,
    如果真的有高手愿意帮忙的话,,我愿意高分奉送呀,,不够再加呀!!!
    您如果不愿意在这里给我的话,,可以寄到我的信箱呀,,
    [email protected]
    [email protected]
      

  3.   

    同意,封装成dll,然后在vb中申明的办法
      

  4.   

    这个程序可是一个好东东呀,,,
    如果弄明白了???
    肯定会受意非浅的,,,
    那可就不是简简单单的取个文本框文字的事了???
    它可是CreateRemoteThead()&&WriteProcessMemory()呀????
    我想只要是高手,一定应该明白这意味着什么吧????
    病毒呀???黑客呀???大概都是从这里旦生的吧!!!!
      

  5.   

    我先
    那天成VC高手了,我帮你翻译Notice: If this code works, it was written by Robert Kuster.
    Else, I don't know who wrote it. Use it on your own risk. No responsibilities for
    possible damages of even functionality can be taken
      

  6.   

    给 flyingscf(zlj) ::
        喂,,老兄,,同路人呀,,,,
      希望能和你成为朋友呀,,,
      我的MSN是[email protected]
      

  7.   

    自己看下MSND吧,主要就CreateRemoteThead、WriteProcessMemory两个函数;是将自己的代码注入其他进程的。这种代码也太多了。
      

  8.   

    To  liwz123(lwz_li) ::
        我要是能看懂MSDN,,就不用到这里来问了,,,
      你要是懂的话,,为什么不说出个所以然来呢???
      

  9.   

    太不好翻了,要用指针的用DLL封装吧,没有好办法了。
      

  10.   

    翻译成VB代码, 不等于自己写一个VB程序.
    计算机语言翻译应该不能和英语和汉语的翻译相提并论吧
      

  11.   

    TO sxxny(柳水) ::
       你怎么不明白我的意思呢,,我的意思,,不是说像英语翻译成汉语那样,
      而就是根据这段C++代码的意思,,写一个可以达到一样功能的VB程序,,
      OK?????