GetHDSerial编译不通过

源码参见https://www.codeleading.com/article/62852336906/
提示

1
2
3
4
error C2065: “STORAGE_PROPERTY_QUERY”: 未声明的标识符
error C2065: “StorageDeviceProperty”: 未声明的标识符
error C2065: “PropertyStandardQuery”: 未声明的标识符
error C2065: “IOCTL_STORAGE_QUERY_PROPERTY”: 未声明的标识符

按F1在msdn上查到的可能结果为

1
#include <Ntddstor.h>

但加了还是编译不通过,其实正确的是只要加入

1
#include <WinIoCtl.h>

refer to: https://stackoverflow.com/questions/4420632/i-dont-know-what-problem-it-is-error-error-c2065-storage-property-query