C++ question menu

Shout-Out

User Tag List

Thread: C++ question

Results 1 to 3 of 3
  1. #1
    Lynie's Avatar Contributor
    Reputation
    87
    Join Date
    Mar 2008
    Posts
    74
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C++ question

    What do you need to have the project's language to Unicode or Multi-Byte?
    Could you please help me debug this? Well I mean nothing is actually writing to the address.
    Code:
    Code:
    #include "windows.h"
    #include <iostream>
    #include "string.h"
    
    
    DWORD proc_id;
    HANDLE hProcess;
    
    void GetWarrockID()
    {
    	HWND hWnd = NULL;
    	hWnd = FindWindow( 0, "Warrock" );
    	if ( hWnd != NULL )
    	{
    		GetWindowThreadProcessId( hWnd, &proc_id );
    		hProcess = OpenProcess( PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, proc_id );
    	}
    	else
    		std::cout <<  "Unable to find process" ;
    }
    
    void WriteLong( long adress, long value )
    {
    	GetWarrockID();
    	WriteProcessMemory( hProcess, (LPVOID*)(DWORD)adress, &value, sizeof( value ), NULL );
    }
    
    void WritePointerFloat( long baseAdress, short offset, float value )
    {
    	long mAdress;
    	long sAdress;
    	GetWarrockID();
    	ReadProcessMemory( hProcess, (LPVOID*)(DWORD)baseAdress, &mAdress, sizeof( mAdress ), NULL );
    	sAdress = mAdress + offset;
    	WriteProcessMemory( hProcess, (LPVOID*)(DWORD)sAdress, &value, sizeof( value ), NULL );
    }
    
    void BoxsOn()
    {
    	WriteLong(0x943A16, 1);
    }
    
    int main()
    {
    	while(true)
    	{
    		system("pause");
    		BoxsOn();
    	}
    	return 0;
    }
    Yes I know it's warrock, but I'm just trying to learn writeprocessmemory in c++. But for some reason it fails. It doesn't write to the memory. :s.
    Please help.

    C++ question
  2. #2
    Jens's Avatar Contributor
    Reputation
    179
    Join Date
    Sep 2006
    Posts
    251
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well first off, if you havent set the IDE to multi byte (cant remember how tbh) you have to use:

    hWnd = FindWindow( 0, L"Warrock" );

    put an 'L' in front of "Warrock", wee for casting

    also, dont -ever- use System("pause"); its horrible, use cin.ignore or something else

  3. #3
    Lynie's Avatar Contributor
    Reputation
    87
    Join Date
    Mar 2008
    Posts
    74
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply, but I used multi-byte before. It compiles but it just won't right to the memory. And thanks for the tip ^^

Similar Threads

  1. Model Changing Question
    By MasterYuke in forum World of Warcraft General
    Replies: 6
    Last Post: 09-17-2006, 09:56 PM
  2. Couple Private Server questions
    By Jboz in forum World of Warcraft General
    Replies: 21
    Last Post: 07-26-2006, 07:37 PM
  3. Sorry..newb mail question
    By nolbishop in forum World of Warcraft General
    Replies: 2
    Last Post: 06-07-2006, 07:21 PM
  4. Question..
    By janzi9 in forum Community Chat
    Replies: 3
    Last Post: 04-02-2006, 10:20 AM
  5. A GALB question
    By bassman in forum World of Warcraft General
    Replies: 4
    Last Post: 03-28-2006, 09:49 AM
All times are GMT -5. The time now is 08:35 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search