网站首页  词典首页

请输入您要查询的函数:

 

术语 getmodulefilenameex
释义 GetModuleFileNameEx
语法:
C++
DWORD WINAPI GetModuleFileNameEx(
__in HANDLE hProcess,
__in_opt HMODULE hModule,
__out LPTSTR lpFilename,
__in DWORD nSize
);
GetModuleFileNameEx函数
检索完全限定路径包含指定的模块文件。
参数
hProcess [in]
句柄的进程,它包含的模块。
句柄必须有PROCESS_QUERY_INFORMATION和PROCESS_VM_READ访问权限。有关更多信息,请参见过程的安全性和访问权限。
该GetModuleFileNameEx函数不检索该被装用LOAD_LIBRARY_AS_DATAFILE标志模块路径。有关更多信息,请参阅LoadLibraryEx。
hModule [中,可选]
句柄到模块。如果该参数为NULL,GetModuleFileNameEx返回在hProcess指定的进程的可执行文件的路径。
lpFilename [out]
A到接收的缓冲区指针的完全合格的路径模块。如果文件名大小比nSize参数的值越大,函数成功,但文件的名称被截断,空终止。
nSize [in]
该lpFilename缓冲区的大小,以字符。
返回值
如果函数成功,返回值指定了复制到缓冲区的字符串的长度。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
该GetModuleFileNameEx功能主要是用来通过调试器和类似的应用程序必须提取从另一个进程模块信息的使用。如果在目标进程模块列表已损坏或尚未初始化,或者如果在作为结果的DLL函数调用模块列表的变化被加载或卸载,GetModuleFileNameEx可能失败或返回不正确的信息。
来检索在当前进程模块名称,使用GetModuleFileName函数。这是更有效和更比调用的句柄当前进程GetModuleFileNameEx可靠。
以检索远程进程主要可执行模块的名称,使用GetProcessImageFileName或QueryFullProcessImageName功能。这是更有效和更比调用一个空模块处理GetModuleFileNameEx功能可靠。
与PSAPI版本的Windows 7和Windows Server 2008 R2的2起,这个函数被定义为K32GetModuleFileNameEx在Psapi.h和Kernel32.lib和Kernel32.dll出口。但是,您应该马上为GetModuleFileNameEx这个函数。为了确保对程序将运行在Windows的早期版本的符号的正确决议,添加Psapi.lib到TARGETLIBS宏和编译程序与- DPSAPI_VERSION = 1。
实例
有关示例,请参见枚举一个进程所有模块。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderPsapi.h
LibraryKernel32.lib在Windows 7和Windows Server 2008 R2的Psapi.lib在Windows Server 2008,Windows Vista中的Windows Server 2003,和Windows XP/2000
DLLKernel32.dll在Windows 7和Windows Server 2008 R2的Psapi.dll在Windows Server 2008,Windows Vista中的Windows Server 2003,和Windows XP/2000
Unicode和ANSI namesGetModuleFileNameExW(Unicode)和GetModuleFileNameExA(ANSI)的
参见
EnumProcesses
GetModuleBaseName
GetModuleFileName
GetModuleHandle
调用LoadLibrary
模块信息
PSAPI函数
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==GetModuleFileNameEx Function
Retrieves the fully-qualified path for the file containing the specified module.
Syntax
C++
DWORD WINAPI GetModuleFileNameEx(
__in HANDLE hProcess,
__in_opt HMODULE hModule,
__out LPTSTR lpFilename,
__in DWORD nSize
);
Parameters
hProcess [in]
A handle to the process that contains the module.
The handle must have the PROCESS_QUERY_INFORMATION and PROCESS_VM_READ access rights. For more information, see Process Security and Access Rights .
The GetModuleFileNameEx function does not retrieve the path for modules that were loaded using the LOAD_LIBRARY_AS_DATAFILE flag. For more information, see LoadLibraryEx .
hModule [in, optional]
A handle to the module. If this parameter is NULL, GetModuleFileNameEx returns the path of the executable file of the process specified in hProcess.
lpFilename [out]
A pointer to a buffer that receives the fully-qualified path to the module. If the size of the file name is larger than the value of the nSize parameter, the function succeeds but the file name is truncated and null terminated.
nSize [in]
The size of the lpFilename buffer, in characters.
Return Value
If the function succeeds, the return value specifies the length of the string copied to the buffer.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
The GetModuleFileNameEx function is primarily designed for use by debuggers and similar applications that must extract module information from another process. If the module list in the target process is corrupted or is not yet initialized, or if the module list changes during the function call as a result of DLLs being loaded or unloaded, GetModuleFileNameEx may fail or return incorrect information.
To retrieve the name of a module in the current process, use the GetModuleFileName function. This is more efficient and more reliable than calling GetModuleFileNameEx with a handle to the current process.
To retrieve the name of the main executable module for a remote process, use the GetProcessImageFileName or QueryFullProcessImageName function. This is more efficient and more reliable than calling the GetModuleFileNameEx function with a NULL module handle.
Starting with PSAPI version 2 for Windows 7 and Windows Server 2008 R2, this function is defined as K32GetModuleFileNameEx in Psapi.h and exported in Kernel32.lib and Kernel32.dll. However, you should always call this function as GetModuleFileNameEx. To ensure correct resolution of symbols for programs that will run on earlier versions of Windows, add Psapi.lib to the TARGETLIBS macro and compile the program with –DPSAPI_VERSION=1.
Examples
For an example, see Enumerating All Modules for a Process .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderPsapi.h
LibraryKernel32.lib on Windows 7 and Windows Server 2008 R2, Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000
DLLKernel32.dll on Windows 7 and Windows Server 2008 R2, Psapi.dll on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000
Unicode and ANSI namesGetModuleFileNameExW (Unicode) and GetModuleFileNameExA (ANSI)
See Also
EnumProcesses
GetModuleBaseName
GetModuleFileName
GetModuleHandle
LoadLibrary
Module Information
PSAPI Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms683198(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 13:26:19