网站首页  词典首页

请输入您要查询的函数:

 

术语 winexec
释义 WinExec
语法:
C++
UINT WINAPI WinExec(
__in LPCSTR lpCmdLine,
__in UINT uCmdShow
);
WinExec的功能
运行指定的应用程序。
注意:此功能只提供16位Windows的兼容性。应用程序应该使用CreateProcess函数。
参数
lpCmdLine [in]
命令行(文件为应用程序名加上可选参数)被处决。如果在lpCmdLine参数可执行文件的名称不包含目录路径,在此序列可执行文件的系统搜索:
该目录由该应用程序加载。
当前目录。
Windows系统目录中。该GetSystemDirectory函数检索此目录的路径。
Windows目录。 GetWindowsDirectory函数检索此目录的路径。
在PATH环境变量中列出的目录。
uCmdShow [in]
显示选项。如需可接受的值的列表,看到的ShowWindow函数nCmdShow参数的描述。
返回值
如果函数成功,返回值大于31。
如果函数失败,返回值是下面的错误值之一。
返回代码/ valueDescription
0The系统内存不足或资源。
ERROR_BAD_FORMATThe。exe文件是无效的。
ERROR_FILE_NOT_FOUNDThe指定的文件未找到。
ERROR_PATH_NOT_FOUNDThe指定的路径未找到。
备注
该WinExec的函数返回时,开始进程调用GetMessage函数或超时达到极限。为了避免在超时延迟时间等待,呼叫尽快在任何过程中,GetMessage函数开始的,以WinExec的电话。
安全备注
可执行文件的名称被视为第一个空白,在lpCmdLine分隔的字符串。如果可执行文件或路径名中有一个空间,有一个风险,就是一个不同的可执行文件可以运行,因为这样的函数解析空间。下面的示例是危险的,因为该函数将试图运行“Program.exe的”,如果它存在,而不是“MyApp.exe将”。
WinExec的(的“C:\\ \\ Program Files文件\\ \\ MyApp的”,...)
如果恶意用户创建“Program.exe的”在一个系统的应用程序调用,任何程序错误地调用WinExec的使用Program Files目录将运行此应用程序而不是预定的应用领域。
若要避免此问题,使用CreateProcess而不是WinExec的。但是,如果您必须使用传统的原因WinExec的,请确保应用程序的名称是用引号引起如以下示例所示。
WinExec的(“\\的”C:\\ \\ Program Files文件\\ \\ MyApp.exe将\\“-的L - S”,...)
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
CreateProcess的
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==WinExec Function
Runs the specified application.
Note This function is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function.
Syntax
C++
UINT WINAPI WinExec(
__in LPCSTR lpCmdLine,
__in UINT uCmdShow
);
Parameters
lpCmdLine [in]
The command line (file name plus optional parameters) for the application to be executed. If the name of the executable file in the lpCmdLine parameter does not contain a directory path, the system searches for the executable file in this sequence:
The directory from which the application loaded.
The current directory.
The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
The directories listed in the PATH environment variable.
uCmdShow [in]
The display options. For a list of the acceptable values, see the description of the nCmdShow parameter of the ShowWindow function.
Return Value
If the function succeeds, the return value is greater than 31.
If the function fails, the return value is one of the following error values.
Return code/valueDescription
0The system is out of memory or resources.
ERROR_BAD_FORMATThe .exe file is invalid.
ERROR_FILE_NOT_FOUNDThe specified file was not found.
ERROR_PATH_NOT_FOUNDThe specified path was not found.

Remarks
The WinExec function returns when the started process calls the GetMessage function or a time-out limit is reached. To avoid waiting for the time out delay, call the GetMessage function as soon as possible in any process started by a call to WinExec.
Security Remarks
The executable name is treated as the first white space-delimited string in lpCmdLine. If the executable or path name has a space in it, there is a risk that a different executable could be run because of the way the function parses spaces. The following example is dangerous because the function will attempt to run "Program.exe", if it exists, instead of "MyApp.exe".
WinExec("C:\\\\Program Files\\\\MyApp", ...)
If a malicious user were to create an application called "Program.exe" on a system, any program that incorrectly calls WinExec using the Program Files directory will run this application instead of the intended application.
To avoid this problem, use CreateProcess rather than WinExec. However, if you must use WinExec for legacy reasons, make sure the application name is enclosed in quotation marks as shown in the example below.
WinExec("\\"C:\\\\Program Files\\\\MyApp.exe\\" -L -S", ...)
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
CreateProcess
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms687393(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:27:05