代码我找到了:
[DllImport("coredll.dll")]
private extern static int GetDeviceUniqueID( [In,Out] byte[] appdata,
int cbApplictionData,
int dwDeviceIDVersion,
[In,Out] byte[] deviceIDOuput,
out uint pcbDeviceIDOutput);
private byte[] GetDeviceID(string AppString)
{
//Call the GetDeviceUniqueID;
byte[] AppData = new byte[AppString.Length];
for (int count = 0; count < AppString.Length; count++)
AppData[count] = (byte)AppString[count];
int appDataSize = AppData.Length;
byte[] DeviceOutput = new byte[20];
uint SizeOut = 20;
GetDeviceUniqueID(AppData, appDataSize, 1, DeviceOutput, out SizeOut);
return DeviceOutput;
}