void PrintDirectoryReparsePoint(const char *path) { int size = strlen(path) + 2; char *directory = (char *) malloc(size); strcpy_s(directory, size, path); NormalizeSlashes(directory, '\\'); if (directory[strlen(directory) - 1] != '\\') strcat_s(directory, size, "\\"); char volumeName[_MAX_PATH]; int rc = GetVolumeNameForVolumeMountPointA(directory, volumeName, sizeof(volumeName)); if (rc) { char volumePathNames[_MAX_PATH]; DWORD returnLength; rc = GetVolumePathNamesForVolumeNameA(volumeName, volumePathNames, sizeof(volumePathNames), &returnLength); if (rc) { char *p = volumePathNames; while (*p) { if (_stricmp(p, directory)) // if it's not the path we've already found { NormalizeSlashes(directory, '/'); NormalizeSlashes(p, '/'); puts(directory); puts(p); } p += strlen(p) + 1; } } } free(directory); }
void PrintRemapForSubstDrive(char driveLetter) { const int BUF_SIZE = 1024; char targetPath[BUF_SIZE]; char rootPath[8]; sprintf_s(rootPath, 8, "%c:", driveLetter); DWORD result = QueryDosDeviceA(rootPath, targetPath, BUF_SIZE); if (result == 0) { return; } else { if (targetPath[0] == '\\' && targetPath[1] == '?' && targetPath[2] == '?' && targetPath[3] == '\\') { // example path: \??\C:\jetbrains\idea NormalizeSlashes(targetPath, '/'); printf("%c:\n%s\n", driveLetter, targetPath + 4); } } }
static void IdentifyVersion (void) { int i; //jff 3/24/98 index of args on commandline struct stat sbuf; //jff 3/24/98 used to test save path for existence char *iwad; // set save path to -save parm or current dir //jff 3/27/98 default to current dir //V.Aguilar (5/30/99): In LiNUX, default to $HOME/.lxdoom { // CPhipps - use DOOMSAVEDIR if defined char* p = getenv("DOOMSAVEDIR"); if (p != NULL) if (strlen(p) > PATH_MAX-12) p = NULL; strcpy(basesavegame,(p == NULL) ? I_DoomExeDir() : p); } if ((i=M_CheckParm("-save")) && i<myargc-1) //jff 3/24/98 if -save present { if (!stat(myargv[i+1],&sbuf) && S_ISDIR(sbuf.st_mode)) // and is a dir { strcpy(basesavegame,myargv[i+1]); //jff 3/24/98 use that for savegame NormalizeSlashes(basesavegame); //jff 9/22/98 fix c:\ not working } //jff 9/3/98 use logical output routine else lprintf(LO_ERROR,"Error: -save path does not exist, using %s\n", basesavegame); } // locate the IWAD and determine game mode from it iwad = FindIWADFile(); #if (defined(GL_DOOM) && defined(_DEBUG)) // proff 11/99: used for debugging { FILE *f; f=fopen("levelinfo.txt","w"); if (f) { fprintf(f,"%s\n",iwad); fclose(f); } } #endif if (iwad && *iwad) { //jff 9/3/98 use logical output routine lprintf(LO_CONFIRM,"IWAD found: %s\n",iwad); //jff 4/20/98 print only if found CheckIWAD(iwad,&gamemode,&haswolflevels); /* jff 8/23/98 set gamemission global appropriately in all cases * cphipps 12/1999 - no version output here, leave that to the caller */ switch(gamemode) { case retail: case registered: case shareware: gamemission = doom; break; case commercial: i = strlen(iwad); gamemission = doom2; if (i>=10 && !strnicmp(iwad+i-10,"doom2f.wad",10)) language=french; else if (i>=7 && !strnicmp(iwad+i-7,"tnt.wad",7)) gamemission = pack_tnt; else if (i>=12 && !strnicmp(iwad+i-12,"plutonia.wad",12)) gamemission = pack_plut; break; default: gamemission = none; break; } if (gamemode == indetermined) //jff 9/3/98 use logical output routine lprintf(LO_WARN,"Unknown Game Version, may not work\n"); D_AddFile(iwad,source_iwad); free(iwad); } else I_Error("IdentifyVersion: IWAD not found\n" "prboom requires a doom data (\"IWAD\") file to use.\n" "please install one, either freedoom or a package built\n" "using game-data-packager.\n" ); }
static bool IdentifyVersion (void) { int i; //jff 3/24/98 index of args on commandline struct stat sbuf; //jff 3/24/98 used to test save path for existence char *iwad = NULL; // set save path to -save parm or current dir strcpy(basesavegame,I_DoomExeDir()); lprintf(LO_ALWAYS, "IdentifyVersion: basesavegame: %s\n", basesavegame); #ifndef __CELLOS_LV2__ if ((i=M_CheckParm("-save")) && i<myargc-1) //jff 3/24/98 if -save present { if (!stat(myargv[i+1],&sbuf) && S_ISDIR(sbuf.st_mode)) // and is a dir { strcpy(basesavegame,myargv[i+1]); //jff 3/24/98 use that for savegame NormalizeSlashes(basesavegame); //jff 9/22/98 fix c:\ not working } //jff 9/3/98 use logical output routine else lprintf(LO_ERROR,"Error: -save path does not exist, using %s\n", basesavegame); } #endif // locate the IWAD and determine game mode from it iwad = FindIWADFile(); lprintf(LO_ALWAYS, "iwad: %s\n", iwad); if (iwad && *iwad) { //jff 9/3/98 use logical output routine lprintf(LO_CONFIRM,"IWAD found: %s\n",iwad); //jff 4/20/98 print only if found if (!CheckIWAD(iwad,&gamemode,&haswolflevels)) return false; /* jff 8/23/98 set gamemission global appropriately in all cases * cphipps 12/1999 - no version output here, leave that to the caller */ switch(gamemode) { case retail: case registered: case shareware: gamemission = doom; break; case commercial: i = strlen(iwad); gamemission = doom2; if (i>=10 && !strnicmp(iwad+i-10,"doom2f.wad",10)) language=french; else if (i>=7 && !strnicmp(iwad+i-7,"tnt.wad",7)) gamemission = pack_tnt; else if (i>=12 && !strnicmp(iwad+i-12,"plutonia.wad",12)) gamemission = pack_plut; break; default: gamemission = none; break; } if (gamemode == indetermined) //jff 9/3/98 use logical output routine lprintf(LO_WARN,"Unknown Game Version, may not work\n"); D_AddFile(iwad,source_iwad); free(iwad); } else return I_Error("IdentifyVersion: IWAD not found\n"); return true; }