无效的运行时参数_itoa_s [英] invalid cruntime parameter _itoa_s

查看:411
本文介绍了无效的运行时参数_itoa_s的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 _itoa_s _ultoa_s 时遇到了一个奇怪的行为,如果我尝试从一个 DWORD 。该函数返回零(成功),我的应用程序继续,但我得到一个错误代码 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);`


$ b b

ProcessHandleToId 为给定的 ProcessHandle PID(DWORD) c $ c>。



getIntSize 将数字的数目返回到相应的 int /

是的,安全的CRT函数将会中止你的脚本。

程序,当它们检测到问题时,状态代码为0xc0000417。



这意味着您正在查找这个问题的源代码错误。它不是_ultoa_s()调用,这是轰炸你的程序。这是另一个函数调用,在代码中的其他地方。我不能帮你找到它当然。但调试器应该给你一个好主意,看看调用堆栈当它打破。


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).

解决方案

Yes, the safe CRT functions will abort your program with status code 0xc0000417 when they detect a problem. However, they will do this immediately, the function will not return.

Which means that you are looking at the wrong source code for this problem. It isn't the _ultoa_s() call that's bombing your program. It's another function call, somewhere else in your code. I can't help you find it of course. But the debugger should give you a good idea, look at the call stack when it breaks.

这篇关于无效的运行时参数_itoa_s的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆