Anyone has an idea how to tell apart a spinning HDD drive from a Flash-based SSD drive by a drive path?

For those who's interested, I need this for my diagnostics tool.

So far the most promising code sample I was able to find is this (it's in some Asian language, but the code is still readable.) And here's a C# rewrite of the same thing.

It basically presents two methods: HasNoSeekPenalty and HasNominalMediaRotationRate. I tested it on my 3 SSD drives and on one internal HDD, and I wasn't able to get any consistency with their implementation. HasNoSeekPenalty failed with the error code ERROR_GEN_FAILURE on my main PCIe SSD and on the spinning HDD, and returned IncursSeekPenalty as 0 on the other two SSDs. HasNoSeekPenalty also failed on any plugged in USB flash sticks.

As for HasNominalMediaRotationRate, I couldn't use it because my code cannot run elevated and that method requires elevation to open the drive.

So in my opinion both methods fail, unless there's something that needs to be corrected in the code.

I then found this half-baked example, which also didn't work for me. It seems that that method also requires elevation. I kept getting ERROR_ACCESS_DENIED, so I couldn't conclude anything.

So I'm curious if anyone else can contribute to my search?

PS. From what I understand if there was a way to determine the spin rate of the drive it would be enough to tell a spinning drive from a solid state drive.