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

 

代码
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;
}

 

 

posted @ 2010-10-18 09:40  base  阅读(587)  评论(0编辑  收藏  举报