RemkoWeijnen.nl

About Terminal Server, Citrix, Delphi and other stuff


1,272 views

Dear Visitor

Do you like my work? Did my work help you?

  • Leave a comment and tell me how it was usefull to you.
  • If you want you can make a donation with the Paypal Donate Button in the right Sidebar.

Thank you!

convert this post to pdf.
  • Comments Off
  • Filed under: Uncategorized
  • 21 views

    Random Active Directory Notes

    I am working on an Customer Management Console that will present all adminstrative tasks that customers will need in their environment in a single console.

    It will handle Active Directory, Terminal Server and Citrix, Printers and will offer specific Views and Reporting. For the Active Directory stuff I decided to create some classes that enabled me to work with AD in a more Delphi OOP way.

    In a series of Blog Posts I will write about interesting things or just random notes that I made while creating this stuff. The intention is to publish the whole unit in the Jedi Security Library when it’s finished.

    Well I hope you that you’ll find some things of interest ;-)

    Part 1 is here .

    convert this post to pdf.
    17 views

    Random Active Directory Notes #1

    If you are going to use the Active Directory Service Interface (ADSI) in Delphi, the first thing you will need is the typelibrary (TLB). This TLB is in the windows\system32 folder and has the name activeds.tlb.

    We can import this tlb in Delphi (the procedure differs somewhat, depending on the Delphi version), but there are quite some problems with the resulting pas file of this import:

    • Ugly and non meaningfull names such as __MIDL___MIDL_itf_ads_0000_0000_001.
    • Record sizes are sometimes (read: usually) wrong due to alignment errors.
    • Some Interfaces have wrong declarations resulting in Access Violations or just hard to use (eg using var for input parameters).
    • Delphi works with Typed Pointer but since it has no clue on the proper name it uses PUserTypexx (eg PUserType1 = ^_ADS_CASEIGNORE_LIST). It’s hard to recognise later on what the real type is.

    A version of the imported tlb is also in the Jedi Apilib (JwaAdsTLB) and basically it had the same errors. Because I was wondering how this would work in c++ I checked the SDK and found the header file Iads.h.

    Read the rest of this entry »

    convert this post to pdf.
    97 views

    My hoster has had some problems with the simulatesas.com domain that I use for SasLibEx enquiries. If you have sent mail to mail that has not been answered I kindly request you to send it again.

    I would also like to briefly tell you about an upcoming new release of SasLib, version 2.0. There is so much I would like to tell you about it but I will limit it to a few highlights here and save the rest for the upcoming website on SimulateSAS.com.

    • A new option to simulate Control-Alt-Delete with only user permissions (no need to be admin or even system).
    • New Switch console function to reconnect closed RDP sessions for remote control.
    • Supports Windows Vista, Server 2008, Windows 7 and Server 2008 R2.
    • Support for Delphi 2010, C++ Builder 2010 and will support MS Visual C++ 2010 once it reaches RTM.
    • Native x64 support.

    I feel especially good about 2.0 because further improvements were made to the code, again some highlights:

    • Full documentation of all functions, parameters and known possible errors.
    • 80% of the code was rewritten from scratch.
    • Uses techniques like annotations to further reduce the chance of programing errors.
    • Structured testing.
    convert this post to pdf.
    119 views

    Delphi 2010 crashed when starting, it was clear that this was happening when opening the welcome page.

    Just before the crash an error message “Message from webpage, displayNotification: Out of memory” was displayed.

    This post on the Embarcadero Developer Network which was one of the first hits in Google showed that the solution was to clear Internet Explorer’s Browsing History (Temporary Internet Files). This fixed it for me.

    convert this post to pdf.
  • 0 Comments
  • Filed under: Delphi
  • 241 views

    I am writing a class that wraps Active Directory into Objects that live in an Objectlist, much like my Terminal Server class in the Jedi Windows Security Library.

    One of the classes is TJwADUser that represents an Active Directory user with all kinds of properties. So while I was implementing them I stumbled upon the accountExpires attribute which is implemented as an 8 byte integer so I figured I could read it as Int64, cast this to TFileTime (FILETIME) and convert to TDateTime.

    This raised an error however (EVariantTypeCastError with message ‘Could not convert variant of type (Dispatch) into type (Double)’.).

    So I checked what kind of variant Active Directory returns and it is not the expected varInt64 but varDispatch.
    It turns out that we need the IADsLargeInteger interface to obtain the correct values. The code below works for me:

    function TJwADUser.GetExpirationDate: TDateTime;
    var
      LargeInteger: IADsLargeInteger;
      ft: TFileTime;
      v: Variant;
    begin
      if Get(‘accountExpires’, v) then
      begin
        LargeInteger := IDispatch(v) as IADsLargeInteger;
        ft.dwLowDateTime := LargeInteger.LowPart;
        ft.dwHighDateTime := LargeInteger.HighPart;
        if Int64(ft) = 0 then
          Result := 0
        else
          Result := FileTime2DateTime(ft)
      end
      else begin
        Result := 0;
      end;
    end;

    Notes: The Get function is a wrapper for IADs(User).Get(Ex) so you can ignore that and my function returns 0 when the value is empty or on read failure.

    convert this post to pdf.
    349 views

    Downloads working again

    The backup has been restored and all downloads should be working again. If you do find a non working download please leave a comment.

    convert this post to pdf.
  • 0 Comments
  • Filed under: Uncategorized
  • 438 views

    Yesterday I was troubleshooting why Workspace Control was not available on an HP t5540 (Windows CE) Thin Client. This was a Citrix Xenapp 5 environment on Server 2008. When logging in through the Web Interface from the Thin Client’s browser we noticed two things: Client Detection failed and the Reconnect and Disconnect buttons were not available: NoButtons I looked into the files in the webinterface folder (wwwroot/Citrix/XenApp)and searched for workplace and reconnect. I determined that the Client Detection is done in the nativeClientDetect.js (app_data/clientDetection/clientscripts). But what I saw was very strange:

    // Detect whether ICA Client is available.
    < %
    if ((sClientInfo.osWinCE() && sClientInfo.isIE())  || sClientInfo.osSymbian() ) {
    %>
            // It is difficult to reliably detect processor type for WinCE and Symbian Devices
        // and therefore to choose the right flavour of the ICA client.
        // Also, it is not possible to simply download and install ICA client for some of these devices,
        // e.g. WBTs. Therefore, we assume that ICA client is always available.
    
        function detectNativeClient() {
            return true;
        }
    

    Read the rest of this entry »

    convert this post to pdf.
  • 2 Comments
  • Filed under: Citrix
  • 258 views

    404 error on Downloads

    Most of the downloads are not working (error 404) at the moment, I am waiting for my hoster to restore some stuff from the backup so please be patient…
    UPDATE: backup is restored and downloads are working again!

    convert this post to pdf.
  • 0 Comments
  • Filed under: Uncategorized
  • 551 views

    I never liked the new eventviewer that was introduced with Windows Vista. If you want to have the old eventviewer back (you can use the old and new one together) you need to follow the following steps:

    1. Open a command prompt as Adminstrator.
    2. Type Regsvr32 els.dll (if you get error code 0×80070005 then you didn’t run as Administrator).
    3. Start mmc.exe and goto File | Add/Remove Snapin.
    4. From the available Snapins choose “Classic Event Viewer”.
    5. Right-Click Classic Event Viewer under Console Root and select New Window from Here.
    6. Choose Customize from the View menu.
    7. Deselect the Action Pane and Click OK
    8. Now save the file with a name of your choice eg EventVwrC.msc.

    It should look like this:

    EventVwrC

    Doubleclicking an Event feels familiar as well:

    EventProps

    convert this post to pdf.