pszPathOrName always points to an ASCIIZ string. Let DPATH be an environment variable in the environment segment of the process.
DPATH=c:\sysdir;c:\init /* In the environment */The following two code fragments are equivalent:
DosScanEnv("DPATH", &PathRef); DosSearchPath(0, /* Path Source Bit = 0 */ PathRef, "myprog.ini", &ResultBuffer, ResultBufLen); DosSearchPath(2, /* Path Source Bit = 1 */ "DPATH", "myprog.ini", &ResultBuffer, ResultBufLen);They both use the search path stored as DPATH in the environment segment. In the first case, the application issues DosScanEnv to find the variable; in the second case, DosSearchPath issues DosScanEnv for the application.
DosSearchPath does not check for consistency or formatting of the names. It issues DosFindFirst on a series of names that it builds from pszPathOrName and pszFilename
To determine the size of the returned path name, pBuf must be scanned for the ASCIIZ terminator.
An application must issue DosQuerySysInfo to determine the maximum path length that the operating system supports. The returned value should be used to dynamically allocate buffers that are to be used to store paths.