Files
VXUG-Papers/Node Module Infector/Cross-platform demo/windows/enum.cpp
T
2021-09-20 10:51:06 -05:00

17 lines
450 B
C++

#include <windows.h>
#include <vector>
#include <string>
std::vector<std::string> getListOfDrives() {
std::vector<std::string> arrayOfDrives;
char* szDrives = new char[MAX_PATH]();
if (GetLogicalDriveStringsA(MAX_PATH, szDrives));
for (int i = 0; i < 100; i += 4)
if (szDrives[i] != (char)0)
arrayOfDrives.push_back(std::string{ szDrives[i],szDrives[i + 1],szDrives[i + 2] });
delete[] szDrives;
return arrayOfDrives;
}