我挂接了CreateProcessW(),在分析原来API传入的参数LPCTSTR lpApplicationName, LPTSTR lpCommandLine,去发现有问题!
大家看看这段代码
char buf[255];
memset(buf,0,255);
strcat(buf,lpApplicationName);
strcat(buf,lpCommandLine);
strcat(buf,"是否执行该程序?");
然后用MessaegBox()显示buf里面的内容,发现MessageBox()显示的是"C是否执行该程序?"要么就是
"E是否执行该程序?"....反正就是显示不出lpApplicationName和lpCommandLine,后来我改了一下
string str="";
str+=lpApplicationName;
str+="是否执行该程序?"; OutputDebugString(lpApplicationName);
OutputDebugString(lpCommandLine);
结果还是一样!用调试器捕捉的调试输出还是一个老样子!
我觉得是Unicode编码的问题吧~~因为CreateProcessW传入的是宽字符,但我实在不会处理啊,各位高手帮帮忙~~谢谢了~~!
大家看看这段代码
char buf[255];
memset(buf,0,255);
strcat(buf,lpApplicationName);
strcat(buf,lpCommandLine);
strcat(buf,"是否执行该程序?");
然后用MessaegBox()显示buf里面的内容,发现MessageBox()显示的是"C是否执行该程序?"要么就是
"E是否执行该程序?"....反正就是显示不出lpApplicationName和lpCommandLine,后来我改了一下
string str="";
str+=lpApplicationName;
str+="是否执行该程序?"; OutputDebugString(lpApplicationName);
OutputDebugString(lpCommandLine);
结果还是一样!用调试器捕捉的调试输出还是一个老样子!
我觉得是Unicode编码的问题吧~~因为CreateProcessW传入的是宽字符,但我实在不会处理啊,各位高手帮帮忙~~谢谢了~~!
解决方案 »
- 关于VC对话框静态文本设置背景透明的问题
- bind Error:10049~ 跪求各位大侠!
- 询问简单的数据库问题
- 如何使用DirectShow呢?请多指教!
- 求教关于宏定义结构的基本问题
- 一个256色的图标,为什么会失真
- 如何将查询到的记录行内容更新到对话框
- 如何在VC中动态生成一个XML文档?请大虾指教,高分相送!
- 向各位请教一个菜问题!!!C++语言中!!!不在任何函数内的(**也不在main(){...}和winmain(){...}内**)语句在什么时候执行???
- 谁能解释一下光栅操作机制,书上说是定义如何合并输出操作中的颜色,,,???
- 第一次发贴,问一个新手问题,给分100
- 怎么知道ADO里的执行结果??
wcscat(buf,lpApplicationName);
wcscat(buf,lpCommandLine);
wcscat(buf,"是否执行该程序?");
编译不过去了.CreateProcessW()改成CreateProcessA整个程序就不能用了~我把代码发上来好了.
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
)
{
/* string str="";
str+=lpApplicationName;
str+="是否执行该程序?";*/
char buf[255];
memset(buf,0,255);
strcat(buf,lpApplicationName);
strcat(buf,lpCommandLine);
strcat(buf,"是否执行该程序?");
OutputDebugString(lpApplicationName);
OutputDebugString(lpCommandLine); if(MessageBox(NULL,buf,"注意",MB_YESNO|MB_ICONWARNING)
==IDNO)
return FALSE;
return ((PFNCPW)(PROC)g_CreateProcessW)(
lpApplicationName,
lpCommandLine,
lpProcessAttributes,
lpThreadAttributes,
bInheritHandles,
dwCreationFlags,
lpEnvironment,
lpCurrentDirectory,
lpStartupInfo,
lpProcessInformation
);
}
运行步骤如下,注入到taskmgr中,用taskmgr的新任务..结果显示如下"C是否执行该程序?"即使捕获的OutputDebugString(lpApplicationName);
OutputDebugString(lpCommandLine);还是一样的结果,都不能正常显示lpApplicationName和lpCommandLine.急啊~~!晕啊@_@!我先上课去,晚上再上来,谢谢各位高手了!