Prepare C# Application to Handle Restart Message


[Apps must adhere to system restart manager messages]

4.1 Your app must handle critical shutdowns appropriately

In a critical shutdown, apps that return FALSE to WM_QUERYENDSESSION will be sent WM_ENDSESSION and closed, while those that time out in response to WM_QUERYENDSESSION will be terminated.

4.2 A GUI app must return TRUE immediately in preparation for a restart


Console apps can call SetConsoleCtrlHandler to specify the function that will handle shutdown notifications. Service apps can call RegisterServiceCtrlHandlerEx to specify the function that will receive shutdown notifications.

4.3 Your app must return 0 within 30 seconds and shut down


At a minimum, app should prepare by saving any user data and state the information that is needed after a restart.

Import XSD to EA

Based on:


Thanks to great integration capabilities of EA, VB for Applications is used to automate data transfer from Excel to EA (and vice versa)

The process consists of two steps:

  • XSD to Excel conversion
  • Excel to EA export

XSD to Excel conversion

Xsd2xls is a small program, converting complex XSD into flat XLS structure.

[Please email me for the download link]

Excel to EA export

Once XSD is already imported to Excel, it can be converted into EA objects.

Register EA OLE automation object in Excel

Samples can be found at []

More samples to be added.





Signing C# application

This post is linking to the resources describing signing process of the C# application, that is using unsigned, 3rd parry libraries


How to: Create a Public/Private Key Pair

At the command prompt, type the following command:

sn –k <file name.snk>



Signing and Checking Code with Authenticode




Install Root Certificate


Administrators is the minimum group membership required to complete this procedure.

  1. To manage trusted root certificates for a local computer
  2. Click Start, click Start Search, type mmc, and then press ENTER.
  3. On the File menu, click Add/Remove Snap-in.
  4. Under Available snap-ins, click Local Group Policy Object Editor, click Add, select the computer whose local Group Policy object (GPO) you want to edit, and then click Finish.
  5. If you have no more snap-ins to add to the console, click OK.
  6. In the console tree, go to Local Computer Policy, Computer Configuration, Windows Settings, Security Settings, and then click Public Key Policies.
  7. Double-click Certificate Path Validation Settings, and then click the Stores tab.
  8. Select the Define these policy settings check box.
  9. Under Per user certificate stores, clear the Allow user trusted root CAs to be used to validate certificates and Allow users to trust peer trust certificates check boxes.
  10. Under Root certificate stores, select the root CAs that the client computers can trust, and then click OK to apply the new settings.


How to: Sign 3rt party dll


  1. Disassemble dll

C:\Foo\bin> ildasm /all / Bar.dll

  1. Assemble and sign dll

C:\Foo\bin> ilasm /dll /key=Foo.snk