1

Ok, I know this is highly unlikely but hear me out:

We are developing a winforms application with C# and VS 2010 and have finished prototype. We have this prototype tested by our test users. Also we have a licensing logic implemented that is being tested as well and it gathers certain info from local PC (HDD Serial No, CPU ID etc.) to create an almost-unique activation key.

Test users have informed us that sometimes (even when physical devices are exactly the same) activation key changes and naturally application requires another license. We highly suspect this is because underlying methods(WMI) produce different values based on user's privileges on Windows (Vista and above).

So, given this information; Is it possible that a C# application run under different privileges (Sometimes Admin sometimes standard user) on its own?

Community
  • 1
  • 1
raidensan
  • 1,099
  • 13
  • 31
  • 3
    Don't write your own licensing code. If it's *worth* doing (which should always be seriously assessed), buy in a product that does it well. Your primary skill-set and business interests are not, I presume, writing licensing code. – Damien_The_Unbeliever Jul 28 '15 at 14:13
  • Well, we have to. Since our manager insist we can do it ourselves. So, we are on our own on this. A side note: This application runs on PC's that generally don't have internet connection and this complicates things a lot. – raidensan Jul 28 '15 at 14:21
  • 1
    Does your manager understand that the more time and effort you spend on trying to get this licensing code working is time and effort taken away from features that your customers actually want? Those same (legitimate) customers who are going to be annoyed by broken licensing? As opposed to the unlicensed users (if your product does something people value, it *will* have its licensing broken) who don't get these annoyances? – Damien_The_Unbeliever Jul 28 '15 at 14:24
  • You are absolutely right and I can't argue with that. – raidensan Jul 28 '15 at 14:28
  • Your best bet is probably to figure out which parameters the non-admin users can't get, and remove those from the equation. Failing that, you'll have to move the licensing logic into a service. – Harry Johnston Jul 28 '15 at 21:53
  • I do have a vague feeling though that Windows may already have an API for doing this sort of thing? – Harry Johnston Jul 28 '15 at 21:56

1 Answers1

0

I don't think so, how would the application enter the admin-password on it's own to get elevated privileges...?

M463
  • 2,003
  • 3
  • 23
  • 39
  • That's the tricky part bugging me. But we couldn't find any other reasonable answer to this behavior. Also we have an UACHelper class to detect users elevation and keep close track of it by logging every time license interface executes. – raidensan Jul 28 '15 at 14:13
  • Does your program actually **requires** to be started with elevated privileges? – M463 Jul 28 '15 at 14:15
  • I don't think so, since we don't have an application manifest implemented to force app to start with admin privileges. – raidensan Jul 28 '15 at 14:17
  • Then I don't know a way how the application could get to run with e.p. without entering the admin-pw on it's own - which is rather unlikely. I fear you have to search down another path, maybe review your licencing code. – M463 Jul 28 '15 at 14:20