Is there a Win32 version of itoa?

To be clear what I mean is does Win32 provide something like IntToStrA in it's api, for now I have a custom version but that requires added code (which I would like to avoid). Point blank I'm preping some code for injection and would like it to be as small as possible so the target app will think it is just data if it checks it's process size against the original EXE or something (I know I can't hide from every app that checks this but better to do all that is possible)
Wouldn't this work?

1
2
3
4
#include <cstdlib>
#include <window.h>

#define winitoa(str) TEXT(itoa(str)) 
@Stewbond:

No that would not work... as the TEXT() macro (when it does anything) just puts a 'L' next to the given string literal to make it wide. Attempting to do that would result in an error complaining about Litoa
Why not use something like cppformat? There's little to no benefit from using API specific functions in this case, especially since the standard doesn't really provide one.
Doesn't the standard provide to_string?

http://www.cplusplus.com/reference/string/to_string/
The op wants something from an external library to make the smallest code.
My suggestion is to create a dll and load it, from the exe. The dll then could be as big as you want allowing you to have a tiny exe.
Shoulda mentioned I'm doing this in C99, it can be c++ compatible but no code should require C++ support as I'm compiling it as C only. Also another reason I cannot use the std libraries is because it takes a lot to prep for injection. Finally I should mention that while loading from DLL is simpler this is a general purpose hacking app I'm making so I need code injection to work anyway, another words ONLY windows.h functions should be considered for this case.

Edit: Thank you Stewbond for mentioning winitoa, I'll look into that to see if it fits my needs.

Edit: Scratch that just realised it is a define you put in, I'm using the /NODEFAULTLIB flag here so keep that in mind.
Last edited on
What I meant was to create the exe PLUS the dll, and load it with LoadLibrary and GetProcAddress.

Basically whenever you load the exe you load the dll and get all required functions, and call them in place of your own functions.
Since it doesn't get statically linked (don't use .lib/.a files) it will not bloat.
I get what you're saying but that's a separate method altogether and defeats the object of code injection, I'm trying to create an app that can target any app a user chooses and provide different ways for the user to try hacking it.

I'm going to have both console and GUI versions but GUI must rely ONLY on windows.h functions since windows.h is guaranteed to be included by such apps but stdlib is not yet the opposite proves true for console apps
Last edited on
Topic archived. No new replies allowed.