NW triple null eldritch horror
This commit is contained in:
parent
08a50eaad4
commit
7ad29f670d
1 changed files with 30 additions and 7 deletions
35
main.cpp
35
main.cpp
|
|
@ -98,17 +98,22 @@ int listDirectory(std::string path, std::vector<char*> *directoryContents){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int explodePaths(TCHAR* volumePaths, int volumePathsBufferSize, char separator, std::vector<char*> *dest){
|
int explodePaths(TCHAR* volumePaths, int volumePathsBufferSize, char separator, std::vector<char*> *dest){
|
||||||
|
static int lmao = 0;
|
||||||
char* nextOcurrence = strchr(volumePaths, separator);
|
char* nextOcurrence = strchr(volumePaths, separator);
|
||||||
if (nextOcurrence[0] == nextOcurrence[sizeof(TCHAR)]) return 0;
|
//TODO Test de cadena original
|
||||||
|
|
||||||
char* itemPath;
|
char* itemPath;
|
||||||
itemPath = (char*)calloc(1, volumePathsBufferSize);
|
itemPath = (char*)calloc(1, volumePathsBufferSize);
|
||||||
for (int i = 0; &volumePaths[i] == nextOcurrence; i++) {
|
//for (int i = 0; &volumePaths[i] == nextOcurrence; i++) {
|
||||||
|
for (int i = 0; volumePaths[i] != nextOcurrence[0]; i++) {
|
||||||
itemPath[i] = volumePaths[i];
|
itemPath[i] = volumePaths[i];
|
||||||
}
|
}
|
||||||
dest->push_back(itemPath);
|
dest->push_back(itemPath);
|
||||||
|
//TODO Test de recursividad
|
||||||
|
//if (debug) { std::cout << dest->at(0) << std::endl; exit(1); }
|
||||||
|
if (debug && lmao == 3) { std::cout << volumePaths << std::endl; exit(1); }
|
||||||
|
lmao++;
|
||||||
|
if (nextOcurrence[0] == nextOcurrence[sizeof(TCHAR)]) return 0;
|
||||||
return explodePaths(nextOcurrence, volumePathsBufferSize, separator, dest);
|
return explodePaths(nextOcurrence, volumePathsBufferSize, separator, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,7 +121,7 @@ int explodePaths(TCHAR* volumePaths, int volumePathsBufferSize, char separator,
|
||||||
int listVolumes(std::vector<char*> *onPresentPaths){
|
int listVolumes(std::vector<char*> *onPresentPaths){
|
||||||
//int listVolumes(){
|
//int listVolumes(){
|
||||||
HANDLE hFind = INVALID_HANDLE_VALUE;
|
HANDLE hFind = INVALID_HANDLE_VALUE;
|
||||||
char separator = '\0';
|
const char separator = '\0';
|
||||||
|
|
||||||
int numVolumes = 0;
|
int numVolumes = 0;
|
||||||
//Volume name
|
//Volume name
|
||||||
|
|
@ -126,7 +131,14 @@ int listVolumes(std::vector<char*> *onPresentPaths){
|
||||||
int volumePathsBufferSize = (MAX_PATH + 1) * sizeof(TCHAR);
|
int volumePathsBufferSize = (MAX_PATH + 1) * sizeof(TCHAR);
|
||||||
unsigned long volumePathLength;
|
unsigned long volumePathLength;
|
||||||
TCHAR volumePaths[volumePathsBufferSize];
|
TCHAR volumePaths[volumePathsBufferSize];
|
||||||
|
//TODO BORRAR
|
||||||
|
std::fill(volumePaths, volumePaths + volumePathsBufferSize, '4');
|
||||||
|
for (int i = 0; i < volumePathsBufferSize; i++){
|
||||||
|
std::cout << std::to_string(i) + ": ";
|
||||||
|
std::cout << volumePaths[i];
|
||||||
|
std::cout << " | ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl << "I IA" << std::endl;
|
||||||
|
|
||||||
hFind = FindFirstVolume(volumeName, volumeNameSize);
|
hFind = FindFirstVolume(volumeName, volumeNameSize);
|
||||||
//if (debug) std::cout << volumeNameSize << std::endl;
|
//if (debug) std::cout << volumeNameSize << std::endl;
|
||||||
|
|
@ -139,6 +151,17 @@ int listVolumes(std::vector<char*> *onPresentPaths){
|
||||||
if (volumePathLength == 1) { if (debug) std::cout << "Skill Issue" << std::endl; continue; }
|
if (volumePathLength == 1) { if (debug) std::cout << "Skill Issue" << std::endl; continue; }
|
||||||
if (debug) std::cout << volumeName;
|
if (debug) std::cout << volumeName;
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
if (debug && volumePaths[0] == 'E') {
|
||||||
|
std::cout << volumePathLength << std::endl;
|
||||||
|
/*exit(1);*/
|
||||||
|
for (int i = 0; i < volumePathsBufferSize; i++){
|
||||||
|
std::cout << std::to_string(i) + ": ";
|
||||||
|
std::cout << volumePaths[i];
|
||||||
|
std::cout << " | ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl << "I IA" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
if(explodePaths(volumePaths, volumePathsBufferSize, separator, onPresentPaths)){
|
if(explodePaths(volumePaths, volumePathsBufferSize, separator, onPresentPaths)){
|
||||||
if (debug) std::cout << volumePaths << std::endl;
|
if (debug) std::cout << volumePaths << std::endl;
|
||||||
for (int i = 0; i < onPresentPaths->size(); i++){
|
for (int i = 0; i < onPresentPaths->size(); i++){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue