Remko Weijnen's Blog (Remko's Blog)

About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like

Archive for the ‘Delphi’ Category

Packaging an Application that uses the BDE

Today I needed to package an application that uses the Borland Database Engine (BDE).

The BDE is a database engine/connectivity component commonly used in Delphi and C++ Builder applications. It has been deprecated since 2000 when it was replaced by dbExpress.

But it’s still widely used so you may still find applications that require the BDE.

In my environment I already have a package for the BDE itsself. But the application I needed to package today, needs to have an Alias addded.

This is usually done manually by going into the BDEADMIN control panel applet or by copying the file where BDE saves the aliases (IDAPI32.CFG).

Here is a screenshot of the Alias my application needs (it uses an Interbase database):


I didn’t like the copy approach and didn’t even consider the manual option so I wrote 2 little tools.


Altiris Job Builder

I have created a little tool for myself that I have call Altiris Job Builder, it retreives the Jobs from the Altiris database and shows them in a Treeview.

Then I can assemble a Master Build Job by dragging the needed Jobs to another Treeview on the right. Since it’s just for me it doesn’t have a fancy gui:


So why did I write it? Well I have divided my Jobs into Prerequisites and Packages, for instance IIS and Terminal Server and Java are prereqisuites for Citrix. But many prereqisuites are required for one or more other packages, eg Java is also used for certain applications. (more…)

The case of the VMware vSphere Client

Today I connected with my laptop to VMWare Virtual Center using vSphere client. Because I had an older version of the client I needed to update and the installer failed with this message:

The Microsoft Visual J# 2.0 Second Edition installer returned the error code '4113'

I remembered this error from the last install of this client (about a year ago), it happens because Microsoft Visual J# was already installed (in my case it was previously installed by Embarcadero’s Rad Studio).

Last year I “fixed” it by modifying the msi file but I remembered that Assarbad posted an easier solution on his Blog a while ago.

His solution was to set a public property in the MSI (USING_VIM_INSTALLER) but it means we need to unpack the installer exe first to obtain the MSI file.

  • Filed under: Delphi, VMWare
  • Compatibility Issue with RAD Studio XE

    After launching the newly installed RAD Studio XE for the first time it tried to install something. This failed because I didn’t run it elevated which makes Windows 7 fire the Program Compatibility Assistant:


    It would be better for Embarcadero to detect if we run elevated and only run the installer when we are (or request elevation).

    Maybe it’s time for Embarcadero to use Jwscl which make such things very easy?

  • Filed under: Delphi
  • RAD Studio XE destroys RAD Studio 2010?

    Just noticed this is my Start Menu after installing RAD Studio XE:


    Luckily Clicking Delphi XE launches 2010…

  • Filed under: Delphi
  • Fun with asm

    Today just some fun stuff with ASM, probably not the most recommended way to do things but for sure the most geeky way πŸ˜›

    Get the Current Session Id:

    Get the Current Console Session Id:

    And… if we can read it we can also write it?


    You can safely try it since it of course affects the current process only, so don’t worry.

    And perhaps more usefull

    I needed to obtain the Fully Qualified Domain Name (FQDN) for a given NetBios domain name. Eg from MYDOMAIN to dc=mydomain,dc=local.

    I did some tests with the TranslateName API and if you append a \ to the domain name it returns the FQDN.

    Here is a short example:


    Again a about post about using the Virtual TreeView component (did I mention it’s brilliant?), this time I will talk about memory leaks.

    I often use Records to hold the treedata, and usually the record holds some string data (eg a caption) and an (a reference to) an Interface or Object(List) that holds more data.

    If you are familiar with Virtual Tree then you know that you must can the NodeData in the OnFreeNode event.


    Setting ChildCount in a Virtual Tree

    When working with the Virtual TreeView component the most optimized way of adding (or removing child nodes is by changing the ChildCount.

    I often make the mistake of change the ChildCount of a Node using:

    If you look into the source you will see why this will not work, the proper way is:

    This is mainly a note to self since I tend to forget it all the time πŸ˜‰

    Random Active Directory Notes #4

    Previously I discussed IDirectoryObject, today I will show how to change a user’s password with IDirectoryObject.

    I didn’t find any documentation except a kb article describing how to use pure ldap to do it. Of course I could have used IADsUser::SetPassword but I decided not to because of the following reasons:

    • IADs interfaces are terribly slow (although for one use you probably wouldn’t really notice).
    • IADsUser::SetPassword tries 3 different methods to set the password (ldap over ssl, kerberos and finally NetUserSetInfo) which makes it even slower (most domain controllers do not have an ssl certificate) and unpredictable.

    All example code I found was .NET based using the .NET wrappers for Active Directory and seemed to be meant for use in Adam rather than full Active Directory (it set port number to 389 and password mode to cleartext).

    In the end it’s not very difficult but nonetheless it took me a while before I got it right.

    We can write to the unicodePwd attribute which wants the password as a double quoted unicode string. If you look at this attribute with AdsiEdit you’ll see that the type is Octet String and that it can be written only.

    I was tricked with Delphi’s QuotedStr function for a while because it doesn’t return a double but single quoted string πŸ˜‰

    Below a small snippet from the upcoming JwsclActiveDirectory that shows how to use it: (more…)