您的位置:首页 > 编程语言 > C语言/C++

VC++ 获得程序运行根目录 汇编源码

2010-10-18 09:40 204 查看
代码

char *GetAppPath()
{
static char appPath[MAX_PATH];

__asm
{
push edi

lea eax, appPath
push LENGTH appPath
push eax
push 0
call dword ptr GetModuleHandle

push eax
call dword ptr GetModuleFileName
std
lea edi, appPath
add edi, LENGTH appPath
mov al, '\\'
mov ecx, LENGTH appPath
repne scasb
cld
mov byte ptr [edi+2], 0

pop edi
};

return appPath;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: