Changeset 159 for trunk/src/helpers/dosh.c
- Timestamp:
- Apr 25, 2002, 7:25:16 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dosh.c
r154 r159 1942 1942 * 1943 1943 * In the pathological case of a dot in the path 1944 * but not in the filename itself, this correctly 1945 * returns NULL. 1944 * but not in the filename itself (e.g. 1945 * "C:\files.new\readme"), this correctly returns 1946 * NULL. 1946 1947 * 1947 1948 *@@added V0.9.6 (2000-10-16) [umoeller] … … 2008 2009 CHAR szName[5]; 2009 2010 2010 APIRET rc = NO_ERROR; // return code2011 APIRET arc; 2011 2012 BYTE fsqBuffer[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0}; 2012 2013 ULONG cbBuffer = sizeof(fsqBuffer); // Buffer length) … … 2017 2018 szName[2] = '\0'; 2018 2019 2019 rc = DosQueryFSAttach(szName, // logical drive of attached FS 2020 0, // ulOrdinal, ignored for FSAIL_QUERYNAME 2021 FSAIL_QUERYNAME, // return data for a Drive or Device 2022 pfsqBuffer, // returned data 2023 &cbBuffer); // returned data length 2024 2025 if (rc == NO_ERROR) 2020 if (!(arc = DosQueryFSAttach(szName, // logical drive of attached FS 2021 0, // ulOrdinal, ignored for FSAIL_QUERYNAME 2022 FSAIL_QUERYNAME, // return data for a Drive or Device 2023 pfsqBuffer, // returned data 2024 &cbBuffer))) // returned data length 2026 2025 { 2027 2026 // The data for the last three fields in the FSQBUFFER2 … … 3434 3433 3435 3434 /* 3435 *@@ doshCanonicalize: 3436 * simplifies path specifications to remove '.' 3437 * and '..' entries and generates a fully 3438 * qualified path name where possible. 3439 * File specifications are left unchanged. 3440 * 3441 * This returns: 3442 * 3443 * -- NO_ERROR: the buffers were valid. 3444 * 3445 * -- ERROR_INVALID_PARAMETER: the buffers 3446 * were invalid. 3447 * 3448 *@@added V0.9.19 (2002-04-22) [pr] 3449 */ 3450 3451 APIRET doshCanonicalize(PCSZ pcszFileIn, // in: path to canonicalize 3452 PSZ pszFileOut, // out: canonicalized path if NO_ERROR 3453 ULONG cbFileOut) // in: size of pszFileOut buffer 3454 { 3455 APIRET ulrc = NO_ERROR; 3456 CHAR szFileTemp[CCHMAXPATH]; 3457 3458 if (pcszFileIn && pszFileOut && cbFileOut) 3459 { 3460 strncpy(szFileTemp, pcszFileIn, sizeof(szFileTemp) - 1); 3461 szFileTemp[sizeof(szFileTemp) - 1] = 0; 3462 if ( strchr(szFileTemp, '\\') 3463 || strchr(szFileTemp, ':') 3464 ) 3465 { 3466 ULONG cbFileTemp = strlen(szFileTemp); 3467 3468 if ( (cbFileTemp > 3) 3469 && (szFileTemp[cbFileTemp - 1] == '\\') 3470 ) 3471 { 3472 szFileTemp[cbFileTemp - 1] = 0; 3473 } 3474 3475 if (DosQueryPathInfo(szFileTemp, 3476 FIL_QUERYFULLNAME, 3477 pszFileOut, 3478 cbFileOut)) 3479 { 3480 pszFileOut[0] = 0; 3481 } 3482 } 3483 else 3484 { 3485 strncpy(pszFileOut, pcszFileIn, cbFileOut - 1); 3486 pszFileOut[cbFileOut - 1] = 0; 3487 } 3488 } 3489 else 3490 ulrc = ERROR_INVALID_PARAMETER; 3491 3492 return(ulrc); 3493 } 3494 3495 /* 3436 3496 *@@category: Helpers\Control program helpers\Module handling 3437 3497 * helpers for importing functions from a module (DLL).
Note:
See TracChangeset
for help on using the changeset viewer.