You probably should use special function described in Win32-SDK help files.
Most probably function in interest is DeviceIoControl. I see some words about locking a volume here, like FSCTL_LOCK_VOLUME.
You can use those functions via Win32::API module.