Platform SDK: Win32 API |
The level 1 lock acts as a sentinel to guarantee that only one application may obtain the level 2 and 3 locks. An application specifies permissions only when requesting the level 1 lock. The lock level and permissions determine the kind of access that processes other than the lock owner have to the volume while it is locked. Bit 0 of the Permissions parameter for the lock volume function determines if the system allows or fails write operations by other processes. Bit 1 of Permissions determines if the system allows or fails new file mappings by other processes. Bit 2 of Permissions is only used when obtaining the restrictive level 0 lock for formatting and is ignored for a level 1 lock. The following table shows which operations are allowed at each lock level based on the permissions set on the level 1 lock.
Permissions | Level 1 | Level 2 | Level 3 |
---|---|---|---|
Bit 0 = 0 Bit 1 = 0 |
Write operations are failed. New file mappings are allowed. Read operations are allowed. |
Write operations are failed. New file mappings are allowed. Read operations are allowed. |
Write operations are failed. New file mappings are blocked. Read operations are blocked. |
Bit 0 = 0 Bit 1 = 1 |
Write operations are failed. New file mappings are failed. Read operations are allowed. |
Write operations are failed. New file mappings are failed. Read operations are allowed. |
Write operations are failed. New file mappings are failed. Read operations are blocked. |
Bit 0 = 1 Bit 1 = 0 |
Write operations are allowed. New file mappings are allowed. Read operations are allowed. |
Write operations are blocked. New file mappings are allowed. Read operations are allowed. |
Write operations are blocked. New file mappings are blocked. Read operations are blocked. |
Bit 0 = 1 Bit 1 = 1 |
Write operations are allowed. New file mappings are failed. Read operations are allowed. |
Write operations are blocked. New file mappings are failed. Read operations are allowed. |
Write operations are blocked. New file mappings are failed. Read operations are blocked. |
Calling an unlock physical or logical volume function on a level 1 lock completely releases the lock on the volume.