GetWindowsDirectoryA and GetSystemDirectory
#include <iostream>
#include <Windows.h> using std::cout;
using std::endl; // 获取Windows文件夹的路径
//UINT GetWindowsDirectory(LPTSTR lpBuffer,UINT uSize) //获取systrm32文件夹的路径
//UINT GetSystemDirectory(LPTSTR lpBuffer,UINT uSize) //这两个函数的使用方法很简单,和以前一样有两种方法来确定缓冲区的长度:
//1、Windows定义了一个文件路径的最长长度的常量MAX_PATH(值为260),我们可以用它来建立字符串缓冲区;
//2、给缓冲区传入NULL,调用函数成功后将返回缓冲区的长度。 int main()
{
char* buf = nullptr;
// 调用成功后,返回缓冲区的长度,返回windows文件夹的路径
UINT Size = GetWindowsDirectory(NULL,);
buf = new char [Size];
cout << Size << endl;
if( != GetWindowsDirectoryA(buf,Size))
cout << "WindowsDirectory path is :" << endl << buf << endl;
else
cout << "failed. GetLastError() :" << GetLastError() << endl;
delete buf;
buf = nullptr;
cout << endl; // 调用成功后,返回缓冲区的长度,返回系统路径
Size = GetSystemDirectory(NULL,);
buf = new char [Size];
cout << Size << endl;
if( != GetSystemDirectoryA(buf,Size))
cout << "WindowsDirectory path is :" << endl << buf << endl;
else
cout << "failed. GetLastError() :" << GetLastError() << endl;
delete buf;
buf = nullptr;
cout << endl; system("pause");
return ;
}
【转】:https://blog.csdn.net/liangjisheng/article/details/67642491
GetWindowsDirectoryA and GetSystemDirectory的更多相关文章
- C++ GetSystemDirectory()
关于GetSystemDirectory function,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724373(v ...
- OD常用断点
OD常用断点 很全很全 常用断点 拦截窗口: bp CreateWindow 创建窗口 bp CreateWindowEx(A) 创建窗口 bp ShowWindow 显示窗口 bp UpdateWi ...
- 常用汇编命令&&OD命令总结
汇编32位CPU所含有的寄存器有: 4个数据寄存器(EAX.EBX.ECX和EDX)对低16位数据的存取,不会影响高16位的数据.这些低16位寄存器分别命名为:AX.BX.CX和DX,它和先前的CPU ...
- 如何用VB获得Windows各类系统目录
现在有很多关于如何用VB获得Windows目 录的文章,但大都只讲到如何获得Windows目录和System目录,有时候我们却需要获得像"我的文档"这样的目录("我的文档 ...
- OD调试程序经常使用断点大全
经常使用断点 拦截窗体: bp CreateWindow 创建窗体 bp CreateWindowEx(A) 创建窗体 bp ShowWindow 显示窗体 bp UpdateWindow ...
- Delphi7所使用的WinAPI大全(摘自VCL源码,一共1200个函数)
经过我整理的,去掉了A和W的重复.虽然没写注释,但以后要一个一个研究.有这些WINAPI就够用了. kernel32 = 'kernel32.dll'; gdi32 = 'gdi32.dll'; us ...
- OD调试程序常用断点大全
常用断点 拦截窗口: bp CreateWindow 创建窗口 bp CreateWindowEx(A) 创建窗口 bp ShowWindow 显示窗口 bp UpdateWindow 更新 ...
- C# Windows API
API:应用程序接口(API:Application Program Interface)应用程序接口(API:application programming interface)是一组定义.程序及协 ...
- Windows API 函数列表 附帮助手册
所有Windows API函数列表,为了方便查询,也为了大家查找,所以整理一下贡献出来了. 帮助手册:700多个Windows API的函数手册 免费下载 API之网络函数 API之消息函数 API之 ...
随机推荐
- Android No static field XXX of type I in class Lcom/XXX/R$id错
问题复现: 问题原因: 出现这样的情况,你先检查你的依赖工程(module)的对应布局layout/xxx.xml是否跟主项目的layout重名,你点开R文件的时候,你会发现你的布局发生了错乱,导致你 ...
- Codeforces 1188A 构造
题意:给你一颗树,树的边权都是偶数,并且边权各不相同.你可以选择树的两个叶子结点,并且把两个叶子结点之间的路径加上一个值(可以为负数),问是否可以通过这种操作构造出这颗树?如果可以,输出构造方案.初始 ...
- IDA技巧
3. 用[shift+F12]调出字符串表,再根据这些字符串,查看引用的地方,也可以分析出一些sub_0XXXX函数的功能. 进入import函数内 x查看调用处 jump to xref 跳到引用 ...
- k8s-mysql搭建
安装官方文档https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/ 搭建完成,但是没 ...
- 【leetcode】934. Shortest Bridge
题目如下: In a given 2D binary array A, there are two islands. (An island is a 4-directionally connecte ...
- loadRunner函数之web_find
int web_find( const char *StepName, <Attributes and Specifications list>, char *searchstring, ...
- centos6 sersync2使用
接收端rsyncd搭建 http://www.cnblogs.com/hanxiaohui/p/8675409.html 推送端sersync2使用 安装 源码包D:\share\src\sersyn ...
- (转)Spring Boot干货系列:(三)启动原理解析
转:http://tengj.top/2017/03/09/springboot3/ 前言 前面几章我们见识了SpringBoot为我们做的自动配置,确实方便快捷,但是对于新手来说,如果不大懂Spri ...
- selenium自动化之验证,判断总结(持续更新)
API命令 1,is_displayed() 例子:driver.find_element_by_css_selector("#id").is_displayed() 该元素是否可 ...
- IE8 indexOf
因为ie8中的js数组没有indexOf方法,所以使用之前要先加入这段js代码 if (!Array.prototype.indexOf) { Array.prototype.indexOf = fu ...