Solved How to convert a decimal number returned by a function to hex and save it to DWORD

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

King151951

Newbie
Jul 21, 2016
2
34
0
Hello


I have a function which returns a DWORD i need to convert this DWORD to hex and store it again in a global DWORD variable.
If i look for this DWORD number myself take it out of the function and hardcode it in my global variable like this(which is not what i want):
Example: My function gives me a DWORD for example 565846 i use printf to see what it is in hex and type this hex number myself in DWORD BaseA i also need to sub a -5C from it .
C++:
printf(BASE ADDRESS: 0x%04x\n", My565846inhex);
DWORD BaseA=0x8A256-0x5C
So if i do this like above everything works but i don't want to hardcode this variable every time i start the game.
What i need is something like this:
C++:
DWORD BaseA = ((GiveTHREADSTACK1(dwProcID, hProcHandle))-0x5C);
How can i convert the return value from GiveTHREADSTACK1(dwProcID, hProcHandle) to a hex number like 0xXXXXXXXX in C++
 
Last edited:

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
As idx[0] pointed out correctly it doesn't matter. The compiler does all that automatically.
But in your code it looks like you're using a threadstack as base address (correct me if I'm wrong) which is something you should NEVER rely on. If you are trying to find pointers always try to find base addresses like game.exe+XXXX or client.dll+XXXX. Sadly the pointerscanner in Cheat Engine includes threadstacks and windows modules which you should basically never use.
 

idx[0]

Jr.Coder
Full Member
Nobleman
Mar 24, 2016
55
523
1
Hi,
It doesn't matter whether the variable is in hex representation or decimal representation, the value of it remains the same thus you can simply call the function and subtract 0x5c from it.
If you don't follow then consider the following code:
C++:
DWORD test = 12345 -0xFF
/** is equivalent to:
     12345 - 255 (Decimal representation)
      -OR-
     0x4D2 - 0xFF
*/
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods