File Category

The functions in the File category monitor and close the file, device, and pipe resources that are open on a server.

Function

Description

NetFileClose2

Forces a resource closed.

NetFileClose32

This function is the same as NetFileClose2 except that it is RPC-based.

NetFileEnum2

Lists all resources open on a server.

NetFileEnum32

This function is the same as NetFileEnum2 except that it uses 32-bit data structures, is RPC-based, and is resumable.

NetFileGetInfo2

Retrieves information about an opening of a server resource.

NetFileGetInfo32

This function is the same as NetFileGetInfo2 except that it uses 32-bit data structures and is RPC-based.

NetFileClose2 and NetFileClose32 force a server resource closed. These functions can be used when a system error prevents normal closure (for example, when the DosClose function fails).

NetFileEnum2 and NetFileEnum32 return information about resources open on a server. A file can be opened one or more times by one or more applications. Each file opening is uniquely identified. NetFileEnum2 and NetFileEnum32 return an entry for all file openings.

NetFileGetInfo2 and NetFileGetInfo32 return information about one particular opening of a resource.

NetFileEnum2, NetFileEnum32, NetFileGetInfo2, and NetFileGetInfo32 can return the file identifier only or the file identifier and additional detailed data.

Four levels and data structures are available. Levels 0 and 1 return short file identifiers. Levels 2 and 3 return long file identifiers. Long file identifiers support file identifiers greater than 65,536. Levels 0 and 2 return only the identification number that was assigned to the resource when it was opened. Levels 1 and 3 return the identification number, permissions, file locks, and the name of the user who opened the resource.

You should use levels 2 and 3 to ensure that data is returned for all open resources. Levels 0 and 1 are provided only for compatibility with previous LAN Manager releases.

NetFileEnum2 and NetFileGetInfo2 can return level 0 and level 1 data only for those resources that have file identifier values less than 65,536. You should not make assumptions about file identifiers; an open resource can have an identifier greater than 65,536 even if it is the only open resource.

Levels 0 and 1 do not guarantee the return of all valid data. When level 0 or 1 is used, the value of the TotalRemaining parameter returned by NetFileEnum2 also reflects only the number of open files that have file identifier values less than 65,536.

NetFileEnum32 and NetFileGetInfo32 do not support levels 0 and 1.

File Category Data Structures

The NetFileEnum2 and NetFileGetInfo2 functions return data at levels 0, 1, 2, or 3.

The NetFileEnum32 and NetFileGetInfo32 functions return data at levels 2 or 3 only.

These functions return data structures as follows.

Opened Resources (level 0)

The file_info_0 structure has the following format:

fi0_id is the identification number assigned to the resource at opening.

Opened Resources (level 1)

The file_info_1 structure has the following format:

Within this structure, the parameters are defined as follows:

fi1_id is the identification number assigned to the resource at opening.

fi1_permissions lists the opening application’s access permissions.

The bit mask of fi1_permissions is defined in the shares.h file:

Manifest

Bit Mask

Meaning

FILE_READ

0x1

Permission to read a resource, and by default, execute the resource.

FILE_WRITE

0x2

Permission to write to a resource.

FILE_CREATE

0x4

Permission to create a resource; data may be written when creating it.

fi1_num_locks tells how many file-locks are on the file, device, or pipe.

fi1_pathname points to an ASCIIZ string giving the path name of the opened resource.

fil_username points to a string telling which user opened the resource.

Opened Resources (level 2)

The file_info_2 data structure that can be returned by NetFileEnum2 and NetFileGetInfo2 has the following format:

Within this structure, fi2_id specifies the identification number assigned to the resource when it is opened.

The 32-bit data structure FILE_INFO_2 that can be returned by NetFileEnum32 and NetFileGetInfo32 has the following format:

Within this structure, the parameters are defined in the same way as in the file_info_2 structure.

Opened Resources (level 3)

The file_info_3 data structure has the following format:

Within this structure, the parameters are defined as follows:

fi3_id specifies the identification number assigned to the resource when it is opened.

fi3_permissions specifies the access permissions of the opening application. The bit mask of fi3_permissions is defined in the shares.h header file as follows:

Code

Bit Mask

Meaning

PERM_FILE_READ

0x1

Permission to read a resource and, by default, execute the resource.

PERM_FILE_WRITE

0x2

Permission to write to a resource.

PERM_FILE_CREATE

0x4

Permission to create a resource; data can be written when creating the resource.

fi3_num_locks tells how many file locks are on the file, device, or pipe.

fi3_pathname points to an ASCIIZ string that gives the path name of the opened resource.

fi3_username points to an ASCIIZ string that specifies which user opened the resource.

The 32-bit data structure FILE_INFO_3 that can be returned by NetFileEnum32 and NetFileGetInfo32 has the following format:

Within this structure, the parameters are defined in the same way as in the file_info_3 structure.

Previous Page Page Top Index Next Page See Page