The normal way to get the windows serial number is WMI.
ManagementObjectSearcher mos = new ManagementObjectSearcher('Select * From Win32_OperatingSystem'); // ... // Select number from managementobject mo['SerialNumber']
I don’t want to use WMI because the compact framework dosn’t support it. The assembly must work on the desktop and the compact framework side so i can’t add the reference.
How can i get the same result using a pinvoke call?
You’ll need to invoke KernelIOControl for WindowsCE.
Here’s the c++ code, don’t have the time to convert it to c#
Edit: (pinvoke kernelIOControl c#)