home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************/
-
- DosFind... Test Utility
- Version 1.0 Beta
- 11/10/93
-
- (C) Copyright 1993 One Up Corporation
-
- /****************************************************************************/
-
- 1. The purpose of this utility is test the return codes from DosFindFirst
- and DosFindNext in situations where a network access may appear to return
- a bogus value.
-
- Specifically, these API calls have caused some application problems where
- the target directories and files are across LAN networks with LAN Server 3.0
- and other network software specifically using HPFS386 and TCP\IP.
-
- Finding directories and filenames consist of initially calling DosFindFirst.
- You send the path of the directory to search, a file or directory mask, and
- a mask for the file or directory attributes. The only difference in obtaining
- files or directories is the attributes that you use in the call.
-
- You will receive a return code, the first item returned and a handle to
- subsequent calls to DosFindNext.
-
- If the return code is Ok, you can loop through calls to DosFindNext retrieving
- the rest of the items in the directory.
-
- The following two paragraphs are from the IBM on-line help facility regarding
- DosFindFirst and DosFindNext.
-
-
- /* DosFindFirst finds the first file object
- or group of file objects whose names match
- the specification. The specification can
- include extended attributes associated
- with a file or directory. */
-
- #define INCL_DOSFILEMGR
- #include <os2.h>
-
- PSZ pszFileName;
- PHDIR pphdirDirHandle;
- ULONG ulAttribute;
- PVOID pResultBuf;
- ULONG ulResultBufLen;
- PULONG pSearchCount;
- ULONG ulFileInfoLevel;
- APIRET rc; /* Return code */
-
- rc = DosFindFirst(pszFileName,
- pphdirDirHandle, ulAttribute,
- pResultBuf, ulResultBufLen,
- pSearchCount, ulFileInfoLevel);
-
- /* DosFindNext finds the next set of file
- objects whose names match the specification
- in a previous call to DosFindFirst
- or DosFindNext. */
-
- #define INCL_DOSFILEMGR
- #include <os2.h>
-
- HDIR hdirDirHandle;
- PVOID pResultBuf;
- ULONG ulResultBufLen;
- PULONG pSearchCount;
- APIRET rc; /* Return code */
-
- rc = DosFindNext(hdirDirHandle,
- pResultBuf, ulResultBufLen,
- pSearchCount);
-
- 2. Copy the executable "TESTFIND.EXE" to a directory of your choice and run the
- file.
-
- 3. Click on "Test" to popup a file find dialog panel.
-
- 4. You can navigate your directories by double mouse clicking on the desired
- directory or single clicking on the desired drive.
-
- 5. Note that the drives are located in a drop down list from the combo
- control "Drive".
-
- 6. The "\" (backslash) in the directory listbox will take you directly
- to the root of the current drive.
-
- 7. Selecting either the "Single Step" or "Auto Step" will popup a
- Step Control dialog panel.
-
- 8. In the "Single Step" mode you will press "Step" on the "Step Control"
- panel to step through each DosFindFirst and DosFindNext API call.
- The first step in each list box initiates the DosFindFirst call.
- "Cancel" will terminate the step mode and allow the box to load
- at program speed.
-
- 9. In the "Auto Step" mode you can set the automatic step speed in
- milliseconds with the entry box next to this radio button.
- The "Cancel" button on the "Step Control" panel will terminate
- this auto stepping mode and allow the list box to load at
- program speed.
-
- 10. "Close" on the "DosFind... Test" dialog panel
- will terminate this test. "Exit" on the main menu of this
- utility will terminate the application.
-
- 11. Note the return codes from the API calls for loading the
- Directory and File List boxes "rtn:".
-
- The normal return codes are as follows:
- 0 - No Error
- 18 - No more files
-
- Other return codes as specified in the IBM documentation
- are as follows:
-
- DosFindFirst returns the following
- values:
-
- 0 NO_ERROR
- 2 ERROR_FILE_NOT_FOUND
- 3 ERROR_PATH_NOT_FOUND
- 6 ERROR_INVALID_HANDLE
- 18 ERROR_NO_MORE_FILES
- 26 ERROR_NOT_DOS_DISK
- 87 ERROR_INVALID_PARAMETER
- 108 ERROR_DRIVE_LOCKED
- 111 ERROR_BUFFER_OVERFLOW
- 113 ERROR_NO_MORE_SEARCH_HANDLES
- 206 ERROR_FILENAME_EXCED_RANGE
- 208 ERROR_META_EXPANSION_TOO_LONG
- 254 ERROR_INVALID_EA_NAME
- 255 ERROR_EA_LIST_INCONSISTENT
- 275 ERROR_EAS_DIDNT_FIT
-
-
- DosFindNext returns 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
-
- 12. The attributes for the mask of the directory and file find are
- displayed as a decimal number in the "attr:" entry windows, and can
- be changed if desired. You can use SourceCalc (Available with
- SourceLink or free from OS2AVEN Forum on CompuServe, Library 3)
- to convert hex to decimal in addition to performing boolean
- operations.
-
- /* known as Dos File Mode bits... */
- #define FILE_NORMAL 0x0000
- #define FILE_READONLY 0x0001
- #define FILE_HIDDEN 0x0002
- #define FILE_SYSTEM 0x0004
- #define FILE_DIRECTORY 0x0010
- #define FILE_ARCHIVED 0x0020
-
- #define MUST_HAVE_READONLY ( (FILE_READONLY << 8) | FILE_READONLY )
- #define MUST_HAVE_HIDDEN ( (FILE_HIDDEN << 8) | FILE_HIDDEN )
- #define MUST_HAVE_SYSTEM ( (FILE_SYSTEM << 8) | FILE_SYSTEM )
- #define MUST_HAVE_DIRECTORY ( (FILE_DIRECTORY << 8) | FILE_DIRECTORY )
- #define MUST_HAVE_ARCHIVED ( (FILE_ARCHIVED << 8) | FILE_ARCHIVED )
-
- 13. The "cnt:" display indicates the number of items returned
- by the DosFindFirst or DosFindNext call (not the count of items
- in the directory). This value is invalid with a non zero
- return code from the API call.
-
- 14. The "hnd:" field displays a hex representation of the handle
- returned by the DosFindFirst call. Since the call is made with
- HDIR_SYSTEM, the handle will be a system constant, unless the
- return code from the call is an error.
-
- 15. The Checkbox labelled "Try Twice" will cause the DosFindFirst
- call to be repeated in the "File" listbox if the first call
- fails. (Some have said that network failure of the DosFindFirst
- call is due to the first one being swallowed by the system! Sounds
- a bit strange to me, but this switch will allow you to try a
- double call if the first one fails.
-
- 16. The "Product Information" panel under "Help" provides you
- with the phone number for One Up Corporation. If you
- experience difficulties in accessing files across your
- LAN Network we would like to hear from you.
-
- *************************************************************************
-
- This testing utility is provided on an "AS IS" basis. Program bugs may
- appear during the operation of this program. This program is for test
- purposes only.
-
- The program specified as "DosFind... Test Utility" is a proprietary product
- of One Up Corporation and is protected by copyright law. One Up Corporation
- retains title to and ownership of the program. You are licensed to use
- the executable code version of this program.
-
- You may not sell, rent, lease, assign or otherwise commercially profit from
- this program.
-
- You may not decompile, disassemble or otherwise reverse engineer the program.
- You may not modify the program in any way.
-
- One Up Corporation makes no warranties, expressed or implied, for this
- program including the implied warranties of merchantability or fitness for
- any purpose.
-
- IN NO EVENT SHALL ONE UP BE LIABLE, WHETHER IN CONTRACT OR TORT,
- FOR LOST PROFITS, LOST SAVINGS, LOST DATA, LOST OR DAMAGED
- PROGRAMS, OR OTHER CONSEQUENTIAL OR INCIDENTAL DAMAGES ARISING
- OUT OF THE USE OF THIS PROGRAM.
-
- (C) Copyright 1993 One Up Corporation.
-
- SourceLink is a trademark of One Up Corporation. IBM, OS/2, and
- Presentation Manager are registered trademarks of International Business
- Machines Corporation. Other trademarks and registrations are property
- of their respective corporations.
-
- *************************************************************************
- *************************************************************************
-