Source code commentary

com.mplify.win2k.diskmon.JNILayer

com.mplify.win2k.diskmon.JNILayer is basically a Java class that provides wrapper functions for a few Win32 API calls. Each public method of the class returns an instance of an inner class that contains values obtained through Java Native Interface (JNI) calls to the Win32 API. The actual native calls are made when the inner class is constructed. We wrap functions used in examining the filesystem and the Microsoft Windows Network Neighborhood, i.e. functions that allow us to enumerate disks and network resources and that allow us to get meta-information about files. The JNI code has been developed while reading and being inspired by Rob Gordon's 'Essential JNI', Prentice Hall 1998. The reference on JNI is of course JAVA NATIVE INTERFACE: PROGRAMMER'S GUIDE AND SPECIFICATION from Sun.

The following inner classes exist:

com.mplify.win2k.diskmon.JNILayer$Win32GetDiskFreeSpaceEx

This class wraps a call to GetDiskFreeSpaceEx(). GetDiskFreeSpaceEx() retrieves information about the amount of space available on a disk volume: the total amount of space, the total amount of free space, and the total amount of free space available to the user associated with the calling thread.

com.mplify.win2k.diskmon.JNILayer$Win32FindFirstVolume

This class wraps a call to FindFirstVolume(). FindFirstVolume() returns the name of a volume on a computer. FindFirstVolume() is used to begin scanning the volumes of a computer.

com.mplify.win2k.diskmon.JNILayer$Win32FindNextVolume

This class wraps a call to FindNextVolume(). FindNextVolume() continues a volume search started by a call to the FindFirstVolume() function.

com.mplify.win2k.diskmon.JNILayer$Win32FindVolumeClose

This class wraps a call to FindVolumeClose(). FindVolumeClose() closes the specified volume search handle..

com.mplify.win2k.diskmon.JNILayer$Win32GetLogicalDrives

This class wraps a call to GetLogicalDrives(). GetLogicalDrives() retrieves a bitmask representing the currently available disk drives.

com.mplify.win2k.diskmon.JNILayer$Win32GetVolumeInformation

This class wraps a call to GetVolumeInformation(). GetVolumeInformation() retrieves information about a file system and volume whose root directory is specified.

com.mplify.win2k.diskmon.JNILayer$Win32GetFileInformation

This class wraps several Win32 calls in order to retrieve file attribute and ownership information about a file, namely: GetNamedSecurityInfo() , LookupAccountSid() , GetFileAttributesEx() and FileTimeToSystemTime()

com.mplify.win2k.diskmon.JNILayer$Win32GetNetResources

This class wraps several Win32 calls in order to retrieve 'Network Neighborhood' information without the terrifying hassle that comes with the Win32 API calls. The following calls are wrapped into two easy-to-understand methods: WNetOpenEnum() , WNetEnumResource() and WNetCloseEnum() . Construction of the class builds a list of Win32NetResource instances, which is a Java counterpart to the Win32 NETRESOURCE structure.