Created
June 4, 2024 00:19
use cygwin functions to list windows volume roots as `\0`-delimited cygwin paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/cygwin.h> | |
struct dos_drive_mappings | |
{ | |
struct mapping | |
{ | |
struct mapping *next; | |
size_t doslen; | |
size_t ntlen; | |
wchar_t *dospath; | |
wchar_t *ntdevpath; | |
} *mappings; | |
}; | |
void main (void) | |
{ | |
struct dos_drive_mappings *ddm = (struct dos_drive_mappings*)cygwin_internal(CW_ALLOC_DRIVE_MAP); | |
for(struct mapping * p = ddm->mappings; p != NULL; p = p->next) | |
{ | |
char * cygpath = cygwin_create_path(CCP_WIN_W_TO_POSIX, p->dospath); | |
fwrite(cygpath, sizeof(char), strlen(cygpath) + 1, stdout); | |
free(cygpath); | |
} | |
cygwin_internal(CW_FREE_DRIVE_MAP, ddm); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment