I have experienced a strange behavior when using _itoa_s
and _ultoa_s
if I try to get a char array from an DWORD
. The function returns zero(success) and my application continues, but I'm getting an exception window with error code 0xc0000417 (STATUS_INVALID_CRUNTIME_PARAMETER)
.
ULONG pid = ProcessHandleToId(hProcess);
int size = getIntSize(pid);
char *pidStr = new char[size+1];
_ultoa_s(pid, pidStr, size+1, 10);
//do sth with pidStr...
delete[] (pidStr);`
ProcessHandleToId
returns the PID (DWORD)
for a given ProcessHandle
.
getIntSize
returns the number of numbers to the corresponding int/char
array (5555 => 4).