recently I posted a question regarding licencing commercial components
2. How they give license and perform protective actions for such controls while if anyone purchase it can give the .dll to friends and they use it wihout any payment.
Search for LicFileLicenseProvider class.
I studied the SDK documentation and quickstarts about the related classes but am a little confuzed: How can I generate valid .LIC files to be used in validation process by the LicFileLicenseProvider class?
Otherwise - like most commercial library companies do - derive from LicenseProvider and create your own provider that stores keys in the registry, validates over the Internet, or something that isn't easy to crack (everything can be cracked , it's only a matter of cost-benefits analysis comparing the worth of the data to be cracked vs. the cost of the resources to crack it).
As far as the files that are generated go, VS.NET automatically creates a .licx file. This simply has the fully-qualified type names of licensed components. You can - and VS.NET does during compilation - run lc.exe on that file to generates a valid .licenses file that must be named the same as the assembly (replacing .dll with .licenses, of course) and added as an embedded resource (using the /res param in csc.exe).
First I thank you Heath about suggesting implementing an inherited custom class which seems nice.
secondly, .licx file (which I coudn't figure out where it is generated and placed) and .licences files that you say are generated using lc.exe of .licx file, seems not the file that LicFileLicenseProvider class works with. look at this paragraph from Framework SDK 1.1 about LicFileLicenseProvider.GetLicense() method:
"At design time, the GetLicense method looks for a license file named myClassName.LIC, where myClassName is the FullName of the component to create. This file must be in the same directory as the .dll file that contains the component.
Next, this method checks the first line of the license file against a key specified in the IsKeyValid method. If the key is valid, this line is used as the LicenseKey."
what are these .LIC files and how to generate them?
As I was inferring before, if you are using VS.NET you don't have to worry about the .licx and .licenses files. VS.NET takes care of all this automatically but the licensed component MUST be included in the .exe assembly because the CLR only looks for the valid .licenses files for licensed components in the application itself. Otherwise, developers could get a valid license for one component, wrap it in a library, and distribute it to other developers thereby circumventing the licensing requirement!
The .lic file is the file that the LicFileLicenseProvider looks for. If you derive your own class, you can have it look for any file you want, but that is the default convention for the base LicFileLicenseProvider class. You need to decide what contents to put into it. That's where my article would come in handy for you (it's not bullet proof and is only meant for conceptualization). This is the file that developers could register with you to receive. You override IsKeyValid to determine if 1) the file exists, and 2) if the contents are correct (if you use my article, you'd check the signature to determine that nothing's been changed then check the value(s) and see if they match the computer configuration, like the computer name as an example).
I never said SECRET key. Key is a pretty generic term. There's also public keys, you know. It's just an eval key, an encoded string or something that unlocks the application. I wouldn't recommend this mechanism, though. I referred him to my article about XML Digital Signatures as a viable alternative.
I know using try-catch means a performance drop.
I wana know in which part or parts the drop actually happens, does it occurs only when catching an exception or even "trying" a block of code means a drop in comparisson to the same code not inside try block in situation that no exception occurs?
Thanks for the tip. As I have never worked with active directory I'd like to ask if it is possible to query the computers on a LAN without using active directory, or is the active directory part of every windows-based LAN? I have tried to run the demo but it throws a COM exception at startup
Hey Nick - thanks a lot for your code snippet, it works flawlessly! You have saved me a lot of time One more question - do you have any idea how can I get the IP address and physical address of the listed network cards?