Name
hw_Lock -- lock a file system object for examination (V5.0)
Synopsis
APTR handle = hw_Lock(STRPTR name, int mode);
Function
This function can be used to lock a file system object for further examination via the hw_ExLock() call. If the file system object is a directory, you may also iterate through its entries using hw_NextDirEntry().

The following bits are currently supported by the mode parameter:

HWLOCKMODE_READ_LEGACY:
Open the file system object for reading. This must be set. Please note that this flag is actually set to 0 for compatibility reasons. This means that hw_Lock() cannot use the bitwise AND-operator to check if it is set. Instead, it will check if the HWLOCKMODE_WRITE flag is set and in case it isn't set, the file system object will be opened in read mode. You should only use this flag if you also need to target Hollywood 5. For Hollywood 6.0 and higher, use HWLOCKMODE_READ instead. For Hollywood 10.0 and higher, use HWLOCKMODE_ANY instead. (see below).

HWLOCKMODE_WRITE:
Open the file system object for writing. Currently unsupported. Do not use this.

HWLOCKMODE_READ:
File system object should be opened for reading. Please note that this flag requires Hollywood 6.0. If you want to open file system objects for reading with earlier Hollywood versions, use HWLOCKMODE_READ_LEGACY. See above for details. Starting with Hollywood 10.0 HWLOCKMODE_READ is deprecated as well and HWLOCKMODE_ANY should be used. (V6.0)

HWLOCKMODE_NOADAPTER:
If this flag is set, hw_Lock() will skip all file and directory adapters and use Hollywood's inbuilt handlers. Use this only if you have a good reason to skip the file and directory adapters. (V6.0)

HWLOCKMODE_ANY:
Setting this flag tells hw_Lock() that any file system object is acceptable, i.e. it doesn't matter if name points to a directory or a file. (V10.0)

HWLOCKMODE_FILE:
Setting this flag tells hw_Lock() that the file system object specified by name must be a file. If it is a directory, hw_Lock() will fail. (V10.0)

HWLOCKMODE_DIR:
Setting this flag tells hw_Lock() that the file system object specified by name must be a directory. If it is a file, hw_Lock() will fail. (V10.0)

This function is thread-safe.

Designer compatibility
Supported since Designer 4.0

Inputs
name
file system object to open
mode
locking mode (see above)
Results
handle
handle to refer to this object later or NULL on error

Show TOC