Suche Schnelle Hilfe !!!!
-
#include "stdafx.h" #include <windows.h> #include <vector> DWORD ingameID,CurrentPlayerID; HANDLE ingame; HANDLE Process1="Diablo II1.exe"; int nr=1; DWORD WINAPI GetProcessId(HANDLE Process); unsigned long pid = GetProcessId(Process1); DWORD ReadDword(const DWORD addr) { HANDLE hnd = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); if (NULL == hnd) return -1; DWORD tmp=0; ReadProcessMemory(hnd, (void *)&addr , &tmp, 4, NULL); CloseHandle(hnd); return tmp; } void SendPacket(BYTE* Packet,DWORD PacketSize) { DWORD size1 = PacketSize; __asm { mov eax, Packet push Packet mov ebx, size1 mov edx, 0x6FB0DE40 call edx } } void GameMsg(char *Message, int Color) { typedef void (_stdcall *pPrint)(wchar_t* Text, int Color); pPrint Print = (pPrint)0x6FAC6780; wchar_t Buffer[0x130]; MultiByteToWideChar(0, 1, Message, 100, Buffer, 100); Print (Buffer, Color); } void GetPlayerList(std::vector<DWORD> *lista); void GetPlayerList(std::vector<DWORD> *lista) { lista->clear(); DWORD start = ReadDword(0x6FBcc33c); while(start != 0) { lista->push_back(start); start = ReadDword(start+0x10); } } DWORD WINAPI Game(LPVOID lpParameter) { while(true) { if(GetAsyncKeyState(VK_LCONTROL)) { /* ........ ........ ........ */ } if(GetAsyncKeyState(0x37)) { /* ........ ........ ........ */ } SleepEx(150,true); } return 0; } BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) { switch(reason) { case DLL_PROCESS_ATTACH: ingame = CreateThread(0,0,Game,0,0,&ingameID); GameMsg("Test Player ID",4); break; } return TRUE; }also beim kompilieren komme ich auf diesen fehler :
error LNK2019: Nicht aufgeloestes externes Symbol "unsigned long __stdcall GetProcessId(void *)" (?GetProcessId@@YGKPAX@Z), verwiesen in Funktion _$E1 fatal error LNK1120: 1 unaufgeloeste externe Verweisekann mir da jemand schnell helfen ?
-
Wieso hast Du GetProcessId selbst definiert?
Das müsste in der Windows.h drin sein!Da Du es selbst definiert hast wird Sie als C++ Funktion interpretiert und dadurch gemangelt. Das Original ist extern "C"!
-
Woh-xD schrieb:
// ... HANDLE Process1="Diablo II1.exe"; // einem Handle eine Zeichenkette int nr=1; // zuzuweisen ist natürlich unsinn! DWORD WINAPI GetProcessId(HANDLE Process); // Diese Funktion existiert nicht in // der WINAPI! Du kannst sie noch so // schön deklarieren... unsigned long pid = GetProcessId(Process1); // Was nicht da ist, kann man nicht // aufrufen, was dir der linker auch // mit // nicht aufgeloestes externes Symbol "unsigned long __stdcall GetProcessId(void *)" // (?GetProcessId@@YGKPAX@Z), verwiesen in Funktion _$E1 // zurecht ankreidet.Eine Funktion, welche dir die PID zu einem laufenden Prozess anhand des exe-Namens liefert
musst du dir schon selbst schreiben; so zum Beispiel:#include <iostream> #include <string> #include <cstdlib> // EXIT_FAILURE, EXIT_SUCCESS #include <windows.h> #include <tlhelp32.h> using namespace std; unsigned long get_pid_by_name( const string &name ); int main( ) { unsigned long pid = get_pid_by_name( "winlogon.exe" ); cout << "0x"; cout.fill( '0' ); cout.width( 6 ); cout << hex << pid << endl; return EXIT_SUCCESS; } unsigned long get_pid_by_name( const string &name ) { void *snapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); if( snapshot == INVALID_HANDLE_VALUE ) return 0; PROCESSENTRY32 proc_entry; proc_entry.dwSize = sizeof( PROCESSENTRY32 ); if( !Process32First( snapshot, &proc_entry ) ) { CloseHandle( snapshot ); return 0; } unsigned long pid = 0; do { if( name.compare( proc_entry.szExeFile ) == 0 ) pid = proc_entry.th32ProcessID; proc_entry.dwSize = sizeof( PROCESSENTRY32 ); } while( Process32Next( snapshot, &proc_entry ) && ( pid == 0 ) ); CloseHandle( snapshot ); return pid; }Vorsicht, der Parameter von get_pid_by_name( ) ist case-sensitive! get_pid_by_name( ) liefert 0, sollte der Prozess nicht zu finden sein, also bitte nicht nach "[System Process]" suchen

Greetz, Swordfish
-
Martin Richter schrieb:
Wieso hast Du GetProcessId selbst definiert?
Das müsste in der Windows.h drin sein!Nö, hab' in die MSDN geguckt, die gibt's wirklich nicht.
Martin Richter schrieb:
Da Du es selbst definiert hast wird Sie als C++ Funktion interpretiert und dadurch gemangelt. Das Original ist extern "C"!
Das war wohl seine Verzweiflungstat, nach dem Motto "dochdoch, die gibts schon..."
Greetz, Swordfish
-
-
Lesen schadet meistens nie:
Requires Windows "Longhorn" or Windows XP SP1.
PS: Warum brauchst Du überhaupt die ProcessID???
-
DWORD ReadDword(const DWORD addr) { HANDLE hnd = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); if (NULL == hnd) return -1; DWORD tmp=0; ReadProcessMemory(hnd, (void *)&addr , &tmp, 4, NULL); CloseHandle(hnd); return tmp; }dafür brauche ich die Process id (pid);
aber ich weiß jetzt noch immer nicht wie ich die bekomme

-
Da wird Dir auch "GetProcessId" nichts helfen... den dazu brauchst Du eine Handle!
Denn wenn Du schon ein Handle hättest, dann bräuchtest Du die ProzessId nicht!
-
und wie kann ich das dann nun benutzen ?
-
WAS willst Du denn benutzen??????
Du brauchst entweder eine
- Process-ID
oder ein
- Process-Handlewenn Du beides nicht hast, wird es halt schwierig auf den prozess zuzugreifen!!!!!
-
benutz das was Swordfish geposted hat das macht doch was du brauchst.