[help]address

Posts 1–8 of 8 · Page 1 of 1
[help]address
how do you add 0x to a value?
for example i have a code to find an address but it only holds the value of the address without the 0x part (ex: 15CD323F without 0x)
so how to add it to?
0x is simply a prefix that tells the compiler the number is in hexadecimal. So you could jjust write it 0x15CD323F. If you mean printing it, well you can use any printing function. printf() or fstream::<< I think some should add the 0x ( try escape character "\h" or hex command and if that doesn't work just <<"0x"<<number<<endl;
Quote Originally Posted by why06 View Post
0x is simply a prefix that tells the compiler the number is in hexadecimal. So you could jjust write it 0x15CD323F. If you mean printing it, well you can use any printing function. printf() or fstream::<< I think some should add the 0x ( try escape character "\h" or hex command and if that doesn't work just <<"0x"<<number<<endl;
cout<<hex<<numfdsf
its not a number it is a variable that holds a value that would be an address to a thing i need if it had a 0x in front
Im confused as to what u mean. Just because it doesn't have the 0x doesn't mean its not in hex. It's not like the base matters anyway. A value remains the same no matter what base it is.
here is the code
Code:
#include <fstream>
#include <iostream>
#include <stdio.h>
#include <windows.h>
using namespace std;

DWORD GetAddress(DWORD addie, LPCSTR module)
{
	if(GetModuleHandle(module)!=NULL)
	{
		DWORD addie1=(DWORD)GetModuleHandle(module);
		DWORD addie2=addie;
		DWORD address = addie1+addie2;
		return (address);
	}
	else
	return NULL;
}

void ammo() 
{
	DWORD *Addy = (DWORD*)GetAddress(0x716274,"server.dll");
	if(*Addy = 0)
	{
	Addy = (DWORD*)GetAddress(0x716A34,"server.dll");
	}
	ofstream output;
	if(Addy)
	{
	output.open("C:\\Documents and Settings\\Dana\\Desktop\\nick\\addy.txt");
	output << "Addy value: " << Addy << endl;
	output << "Addy pointer value: " << *Addy << endl;
	output.close();
	}
}

void thread()
{
	for(;;)
	{
		if(GetAsyncKeyState(VK_NUMPAD1)&1)
		{
		ammo();
		}
		Sleep(50);
	}
}

	BOOL WINAPI DllMain(HINSTANCE module, DWORD dwReason, LPVOID lpvReserved)
{
   if(dwReason == DLL_PROCESS_ATTACH)
   {
       CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)thread, NULL, NULL, NULL);
   }
return TRUE;
}
the function GetAddress returns the address of the module plus the offsett.
when i log the value of Addy, it has the right contents but without 0x.
in CE i have the values that it needs to find, adn when i look at the log file it has that without 0x.
the code is just logging the address of server.dll + 0x716274/A34.
im just wondering if i can use it like an address because it dosen't have a 0x in front
Quote Originally Posted by kibbles18 View Post
the code is just logging the address of server.dll + 0x716274/A34.
im just wondering if i can use it like an address because it dosen't have a 0x in front
Yes u can. Sometimes hex is even written like 45D4E8h and the h signifies its in hex. if it has letters in it its probably in hex. You don't need the 0x for anything. its merely a heads up just to let you know a number is in hex, because sometimes a hex number has no letters in it. For instance how would you know 403785 is in hex? You wouldn't, but its okay to assume all addresses are in hex format, when working with CE, Olly, etc.


Now about that address.
Im relatively certain. 0x716274 is the base address of server.dll and A34 is its offset, but I'll need some1 who uses CE often to dbl check that for me.
Code:
server.dll + 0x716274/A34.
half the time the address i want is server.dll + 716274 and other time it is server.dll + 716A34
then i have to find the value of that addy and add 0x7c8 to that to get the final address i need.

here is a youtube video of what i am trying to do.
the program atm CAN find the address, but it will hold the value of that address in DECIMAL form, not hex.
any help with this?
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us