CreateProcess的第二个参数应该是什么? [英] What should the second parameter of CreateProcess be?

查看:87
本文介绍了CreateProcess的第二个参数应该是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CreateProcess()启动服务器.这是代码:

I am trying to start a server using CreateProcess(). Here is the Code:

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    // TODO: Place code here.

    int result; 
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    CreateProcess("C:\\AP\\DatabaseBase\\dbntsrv.exe", "*** WHAT SHOULD I PUT HERE***", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
    return 0;
}

我从文档中不了解第二个参数应该是什么.你能帮我吗? 谢谢

I did not understand from the documentation what the 2nd parameter should be. Can you please help me with it? Thank You

推荐答案

从MSDN:

lpCommandLine [输入,输出,可选]

lpCommandLine [in, out, optional]

要执行的命令行.此字符串的最大长度为32,768个字符,包括Unicode终止null 特点.如果lpApplicationName为NULL,则模块名称部分为 lpCommandLine限制为MAX_PATH个字符.

The command line to be executed. The maximum length of this string is 32,768 characters, including the Unicode terminating null character. If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.

此函数的Unicode版本CreateProcessW可以修改此字符串的内容.因此,此参数不能为 指向只读存储器的指针(例如const变量或文字) 细绳).如果此参数是常量字符串,则该函数可以 导致访问冲突.

The Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.

lpCommandLine参数可以为NULL.在这种情况下,函数使用lpApplicationName指向的字符串作为 命令行.

The lpCommandLine parameter can be NULL. In that case, the function uses the string pointed to by lpApplicationName as the command line.

因此,至少NULL在那里可以.只要您不传递参数.

So NULL is OK there, at least. As soon as you don't pass arguments.

这篇关于CreateProcess的第二个参数应该是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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