GetSystemDirectory() 函数原型如下:
[C++] 纯文本查看 复制代码 UINT WINAPI GetSystemDirectory(
__out LPTSTR lpBuffer,
__in UINT uSize
);
该函数返回系统目录,系统目录就是包含了系统所需的动态链接库以及驱动程序等文件的目录,一般的就在 C:\Windows\system32 。
第 1 个参数 lpBuffer 是输出参数,指向存放系统目录的缓冲区。
第 2 个参数 uSize 是输入参数,指定第一个参数所指缓冲区的大小。
测试代码:
[C++] 纯文本查看 复制代码 #include "stdafx.h"
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{ TCHAR SystemDir[MAX_PATH];
GetSystemDirectory(SystemDir, MAX_PATH);
_tprintf (TEXT("System Directory is : %s\n"), SystemDir);
return 0;
}
运行输出:System Directory is : C:\Windows\system32 |