doscalls: fixes to DosQueryPathInfo(x, FIL_QUERYFULLNAME, ...).

This gets unzip.exe (and self-extracting zip files) to mostly work.
This commit is contained in:
Ryan C. Gordon committed 2022-01-31 10:12:42 -05:00
1 parent 44a4efd45b
commit fc4154b166
1 file changed
+12 -5
+12 -5
View File
@@ -1149,14 +1149,21 @@ static APIRET queryPathInfoEaSize(PSZ unixPath, PVOID pInfoBuf, ULONG cbInfoBuf)
static APIRET queryPathInfoFullName(PSZ unixPath, PVOID pInfoBuf, ULONG cbInfoBuf)
{
char *real = realpath(unixPath, NULL);
if (real == NULL)
return ERROR_NOT_ENOUGH_MEMORY; // !!! FIXME: no
if (real == NULL) {
// !!! FIXME: what _should_ this do if file doesn't exist? If parent directory doesn't?
real = strdup(unixPath); // could be file doesn't exist, but this still needs to return something...
if (real == NULL) {
return ERROR_NOT_ENOUGH_MEMORY; // !!! FIXME: no
}
}
if ((strlen(real) + 3) < cbInfoBuf) {
if ((strlen(real) + 3) >= cbInfoBuf) {
free(real);
return ERROR_BUFFER_OVERFLOW;
} // if
}
// !!! FIXME: this needs to map to drive letters defined in a config
// !!! FIXME: eventually.
char *dst = (char *) pInfoBuf;
*(dst++) = 'C';
*(dst++) = ':';
@@ -1167,7 +1174,7 @@ static APIRET queryPathInfoFullName(PSZ unixPath, PVOID pInfoBuf, ULONG cbInfoBu
if (*dst == '/')
*dst = '\\';
dst++;
} // while
}
return NO_ERROR;
} // queryPathInfoFullName