Never though I'm going to dive so deep in this Win32 rabbit hole.
I was originally thinking just wrote a simple wrapper of win32's tape API, but then I realized that the encryption is missing. With Win32's tape api, you can basically implement something like `/dev/st0` (simple read and write) amd `mt` command (rewind, seek, set compression, etc.). I was thinking just use LTOEnc for encryption control.
But that software can only read the encryption key from a file, which, to me, is a big security hole: I can do that in memory, why write to the disk temporarily?
So I start reading LTOEnc's code. I found Microsoft really don't want you to directly talk to SCSI. I read their documents, they never said about IOCTL_SCSI_PASS_THROUGH_DIRECT. They are recommending something like IOCTL_CDROM or something that is not so lower level.
Anyway, thanks to LTOEnc, and Oracle's helpdesk generously providing HPE product's tech ref manual, I now can implement the encryption control in my win32 lib. And soon I can do that in Java.
Several days ago I was suffering from jextract and the new project Panama things. Since it's new, there is not much useful documentation and can't get it work in a frustrating day. I was thinking maybe I'm not good at java stuff and should quit and become a Uber eat delivery guy or something. (I blame HR for those negative thoughts)
After several days of suffering and trying, I kind of know how it works and now I'm even writing win32 library in C++. I
m amazing