Making A Windows Installer Use A Serial Key

Posted on  by
Making A Windows Installer Use A Serial Key Average ratng: 9,5/10 2242 votes

Reinstalling Windows Vista using old genuine serial number. Since I have a serial number on my laptop that have used from my previous genuine windows vista, how do I get windows vista installer then use my old serial number so my OS still genuine. Many thanks!!! The Product Key determines which Vista version gets installed. Advanced Installer Architect 15.0.1 Serial key is considered one of the greatest as well as most successful Windows Installer devices that may securely set up your Windows as well as easily set up your item.

2 Apr 2013CPOL
Building installation project with serial number validation using VSI, Orca, C++, or Delphi.

Introduction

In a Visual Studio Installer (VSI) project, we can add a Customer Information dialog box in the user interface. This dialog box has an input field for a serial number. There is minimal support for validating this field in visual studio; and unfortunately there are only few articles talking about how to include custom code to validate the serial number that is entered by the user. This article provides the necessary steps to do custom validation in VSI setup projects using external DLL file written in C++ or Delphi and I'll give two demos in both C++ and Delphi.

Create simple VSI setup project

I'll try to make things clear and simple in this article; so, we will create just an empty setup project (nothing to install) because we just want to test the serial number validation. In Visual Studio 2010 add new project, select Other Project Types then Visual Studio Installer and choose Setup Project and name it 'SetupDemo' .

Create Customer Information dialog

In the Solution Explorer panel click User Interface Editor button.

Go to the User Interface tab and select Install-Start node and from the context menu choose Add Dialog.

Choose Customer Information dialog and click Ok, then change this new dialog order to be after the Welcome dialog.

To activate the serial number validation select Customer Information dialog and from the property panel set the ShowSerialNumber to True.

The SerialNumberTemplate property

By default this property specifies a template used to validate serial number entry and it also determines how the text boxes will appear in the dialog box. For example, the default of this property '<###-%%%%%%%>' creates two text boxes separated by a dash surrounded by spaces. (###) simply verifies that the user has entered three digits. (%%%%%%%) is validated by an algorithm that adds the digits together and divides the sum by 7. If the remainder is 0, validation succeeds; otherwise, it fails. Of course this serial can be broken easily by entering this serial 000-0000000. If we want to make serial number harder to guess we should use more complicated template using these special characters:

  • (#) Requires a digit that will not be included in the validation algorithm.
  • (%) Requires a digit that will be included in the validation algorithm.
  • (?) Requires an alphanumeric character that will not be included in the validation algorithm.
  • (^) Requires an uppercase or lowercase character. Numeric digits are not valid here.
  • (<) Any characters to the left of this character will not be visible in the dialog box.
  • (>) Any characters to the right of this character will not be visible in the dialog box. Required as a terminator if the < character is used.

You will face another problem when using more complicated template. For example, suppose we want to make serial number like the Microsoft product key (CB48T - GGBCX - H269K - C9W64 - X2RWD) this serial would be represented in the SerialNumberTemplate property as '^^%#^ - ^^^^^ - ^%%%^ - ^%^%% - ^%^^^', but this template would create 14 TextBoxes not 5; because each time you change the editable character a new text box is created. I think no one would like to use 14 TextBoxes to validate the serial number; so, the best way to get around all these problems is to use an external library to validate the serial number. Using this library with the help of SerialNumberTemplate property, then the Sky's The Limit; so, we still need the SerialNumberTemplate property to identify how many groups in the serial number. In this sample I will use the default template; this means serial number consists of two groups of numbers and the validation will be done inside the external library. Now build the setup project and close it.

Coding Section

Before moving to the code section; I want to mention here that for sake of simplicity I suppose user will enter 11 digits in the serial textbox; but, In real project we should add more code to check the length of the serial and the type of character if it's digit or not and so forth. The validation process depends on reading the serial textbox value. We can achieve this with help from msi.lib; this library gives us bunch of methods to work with installer and MSI packages (*.msi). These functions can interact with the Windows Installer runtime by using parameter of type MSIHandle which passes the handle of the Windows Installer session. The external library -like the validation library we are about to make- will be loaded into memory during installation so it can get the handle of the installer session and pass it to the msi.lib functions. The second important thing in the validation process is: we will use a helper property 'PIDCHECK' which we will add later to the msi package using Orca tool. When serial number value passes the validation we set PIDCHECK value to 'TRUE' and when the serial fails we set this property to 'FALSE'. The Serial number value exists in built-in property named 'PIDKEY'. We will use msi.lib method MsiGetProperty to read this property, then check/process this value and finally use MsiSetProperty method to save the result into the helper property PIDCHECK. My simple validation in this sample will be just like this: the remainder from the division of (third number + last number) by three should be Zero.

Create validation library in C++

In visual studio 2010 create new C++ Win32 dll project, name it CheckPIDDll .

We need one function to validate the serial number; so, modify the source of this library like this:

Autocad

In order to export this function to the outside world; add new Module-Definition File (.def), name it CheckPIDDll and modify it like this:

Buildthis project, the output file CheckPIDDll.dll is now ready to be used in thesetup project.

Create validation library in Delphi

In Delphi 2010 (orany Unicode Delphi version) add new Dll project.

There is a good Delphi wrapper for msi.lib from JEDI and youcan download it here : http://sourceforge.net/project/platformdownload.php?group_id=121894. Now we can write Delphi DLL library that doesthe same validation as the previous C++ library like this:

Build this project and we are ready to go to the next step.

Windows Installer Use Source

Orca tool

Orca is a Windows Installer package editor designed toprovide full access to the database tables that compose a Windows Installer package.It provides powerful access to all features of the Windows Installer. This toolprovided as part of the Windows Installer SDK; so, if you didn't work with Orcaor install it before, this tool may exist in your hard drive if you have visualstudio; so, just search for 'Orca.msi' in your Program Files folder and installthe tool. You can also download it from this link http://www.microsoft.com/en-us/download/details.aspx?id=6510. In this article I'm not going to explain Orca in details. I want just to showyou the necessary steps for adding the validation library to the msi package.

Edit the MSI package and add the validation library

Making A Windows Installer Use A Serial Key For Battlefield 1

Run Orca tool and open the MSI package of the setup projectdemo we made it before 'SetupDemo.msi'. Select Binary table from the left panel and from the context menu select AddRow , name the new row 'CheckPIDDll' and set the data value to the path of thevalidation library (either Delphi or C++ version).

Select Custom Action table from left panel and add newCustom Action name it CheckSerial, set the Type to 1 and set the Source to CheckPIDDll and Target to VerifyPID.

Select Property table and add new property name it 'PIDCHECK' and set its default value to FALSE.

Making A Windows Installer Use A Serial Keyboard

Now we need to assign the CheckSerial custom action to ClickEvent of the 'Next' button in the Customer Information dialog; so, select ControlEventtable and in the right panel scroll down to the rows contain CustomerInfoFormevents. We are interested in the NextButton events only; so, Change the rowcontains event ValidateProductID like this:

. Change the NextButton NewDialog event condition into .

Making A Windows Installer Use A Serial Key Free

Now save these changes and close Orca.Go to the Setup demo SetupDemo.msi and test the new changes. You can switchbetween the Delphi version and C++ version of the validation library by just changing the binary row.

Conclusion

That was a simple demo; but after good understanding of this kind of validation process I think making setup project with serial number like the Microsoft product key will not be so hard.

Winx hd video converter deluxe serial. WinX HD Video Converter Deluxe 5.12.1.295 license key full version free Download here.lt is one of the best and most popular video converter software that can convert and download video with very fast and increase the bitrate. WinX HD Video Converter Deluxe 5 Serial Key Download FREE. WinX HD Video Converter Deluxe the most recent And all in one video software program as an Extremely HD.

References