次の方法で共有


2.2.26.1 SMB2_LOCK_ELEMENT Structure

The SMB2_LOCK_ELEMENT Structure packet is used by the SMB2 LOCK Request packet to indicate segments of files that are locked or unlocked.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Offset

...

Length

...

Flags

Reserved

Offset (8 bytes): The starting offset, in bytes, in the destination file from where the range being locked or unlocked starts.

Length (8 bytes): The length, in bytes, of the range being locked or unlocked.

Flags (4 bytes): The description of how the range is being locked or unlocked and how to process the operation. This field takes the following format:

Value

Meaning

SMB2_LOCKFLAG_SHARED_LOCK

0x00000001

The range MUST be locked shared, allowing other opens to read from or take a shared lock on the range. All opens MUST NOT be allowed to write within the range. Other locks can be requested and taken on this range.

SMB2_LOCKFLAG_EXCLUSIVE_LOCK

0x00000002

The range MUST be locked exclusive, not allowing other opens to read, write, or lock within the range.

SMB2_LOCKFLAG_UNLOCK

0x00000004

The range MUST be unlocked from a previous lock taken on this range. The unlock range MUST be identical to the lock range. Sub-ranges cannot be unlocked.

SMB2_LOCKFLAG_FAIL_IMMEDIATELY

0x00000010

The lock operation MUST fail immediately if it conflicts with an existing lock, instead of waiting for the range to become available.

The following are the only valid combinations for the flags field:

  • SMB2_LOCKFLAG_SHARED_LOCK

  • SMB2_LOCKFLAG_EXCLUSIVE_LOCK

  • SMB2_LOCKFLAG_SHARED_LOCK | SMB2_LOCKFLAG_FAIL_IMMEDIATELY

  • SMB2_LOCKFLAG_EXCLUSIVE_LOCK | SMB2_LOCKFLAG_FAIL_IMMEDIATELY

  • SMB2_LOCKFLAG_UNLOCK

Reserved (4 bytes): This field MUST NOT be used and MUST be reserved. The client MUST set this to 0, and the server MUST ignore it on receipt.