May be you are a die hard Microsoft fan, or just another bunch of showbiz talk-lock fella or more better you use some of the Vista features in your application and want that only genuine Microsoft Vista owners apply to your services.
Actually, I wrote this code like a year ago, and now while browsing through my backups, I noted that it lied there uselessly. I never used it but probably any one of ya might want to apply this logic.
This is the usage of the function:
1: bool valid = new WgaHelper().IsVistaGenuine();
And this my fella, would be the code that verifies it genuinely:
1: public bool IsVistaGenuine()
2: {
3: bool isGenuine = true;
4:
5: if (IsVista)
6: {
7: Guid guidSlid = new Guid("55c92734-d682-4d71-983e-d6ec3f16059f");
8: Windows_SLID windowsSlid = ToGUID(guidSlid);
9: try
10: {
11: GenuineState genuineState = GenuineState.Last;
12: uint genuineStateUInt = SLIsGenuineLocal(ref windowsSlid, ref genuineState, IntPtr.Zero);
13:
14: if (genuineState != GenuineState.Genuine)
15: {
16: isGenuine = false;
17: }
18: }
19: catch (Exception ex)
20: {
21: Debug.Fail(ex.Message);
22: }
23: }
24:
25: return isGenuine;
26: }
Explanation to working of the code, I will describe in later, here or maybe on CodeProject (I got no articles there
)!
Here are the files, both demo executable and the source code: