Jump to content

DosFindFromName

From EDM2
Revision as of 16:46, 24 May 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

DosFindFromName finds the next set of entries that match the criteria specified in a previous call to DosFindFirst, continuing a directory search from a given position.

Syntax

DosFindFromName(hDir, pfindbuf, cbBuf, pcFileNames, ulPosition, pszFileSpec)

Parameters

hDir (HDIR) - input
The open directory handle associated with this search request.
This handle is the same one used by DosFindFirst.
pfindbuf (PVOID) - in/out
Pointer to the directory search structures.
cbBuf (ULONG) - input
Length, in bytes, the buffer returned in pfindbuf.
pcFileNames (PULONG) - in/out
Number of entries in the buffer returned in pfindbuf.
ulPosition (ULONG) - input
Starting position for search.
pszFileSpec (PVOID) - input
File name to start with.
pszFileSpec is in either Unicode or ASCII depending on how the search handle was created. If the search handle was opened buy DosFindFirstUni, then pszFileSpec is in Unicode; otherwise, it is in ASCII.

Returns

rc (APIRET) - returns
Return code.
DosFindFromName returns one of the following values:
0 NO_ERROR
6 ERROR_INVALID_HANDLE
18 ERROR_NO_MORE_FILES
26 ERROR_NOT_DOS_DISK
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
275 ERROR_EAS_DIDNT_FIT

Remarks

DosFindFromName allows you to perform a find using a name. The search would start at the beginning of the directory, but it would only return data from pszFileSpec on. This reduces the load on the network.

Example Code

Declaration:

#include <os2.h>

HDIR      hDir;         /*  The open directory handle associated with this search request. */
PVOID     pfindbuf;     /*  Pointer to the directory search structures. */
ULONG     cbBuf;        /*  Length, in bytes, the buffer returned in pfindbuf. */
PULONG    pcFileNames;  /*  Number of entries in the buffer returned in pfindbuf. */
ULONG     ulPosition;   /*  Starting position for search. */
PVOID     pszFileSpec;  /*  File name to start with. */
APIRET    rc;           /*  Return code. */

rc = DosFindFromName(hDir, pfindbuf, cbBuf,
       pcFileNames, ulPosition, pszFileSpec);