RemkoWeijnen.nl

About Terminal Server, Citrix, Delphi and other stuff


1,965 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!

VN:F [1.9.3_1094]
Rating: 10.0/10 (5 votes cast)
VN:F [1.9.3_1094]
Rating: +1 (from 1 vote)
convert this post to pdf.
  • Comments Off
  • Filed under: Uncategorized
  • 113 views

    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:

    RadStudioXECompat

    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?

    VN:F [1.9.3_1094]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    convert this post to pdf.
  • 0 Comments
  • Filed under: Delphi
  • 147 views

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

    DelphiXEStartMenu

    Luckily Clicking Delphi XE launches 2010…

    VN:F [1.9.3_1094]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    convert this post to pdf.
  • 0 Comments
  • Filed under: Delphi
  • 41 views

    Rad Studio XE has been released

    RAD Studio XE has (just?) been released, see http://www.embarcadero.com/rad-studio-xe-preview

    VN:F [1.9.3_1094]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    convert this post to pdf.
  • 0 Comments
  • Filed under: Uncategorized
  • 271 views

    While browsing through my old projects folder I found a little commandline tool that I wrote about a year ago. I needed to detect a certain published application on a Citrix environment in the loginscript.

    The tool detect the current Citrix published applicationname or if you are running Terminal Server aka Remote Desktop Services the Initial Program name and stores this in an environment variable (APPNAME).

    There are no parameters and there are no special dependancies (such as MFCom).

    CtxPubApp (29)
    VN:F [1.9.3_1094]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    convert this post to pdf.
  • 0 Comments
  • Filed under: Citrix
  • 246 views

    Rating and contact options

    I have installed a new rating plugin that gives you, my readers, a convenient and fast method to give feedback. So please do so, let me know what posts you find interesting!

    I have also added a Contact form in case you have any questions, article suggestions or maybe even consultation requests. The contact page is an attempt to streamline the e-mails I get from this blog so I hope this will work :-)

    VN:F [1.9.3_1094]
    Rating: 6.0/10 (1 vote cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    convert this post to pdf.
  • 0 Comments
  • Filed under: Uncategorized
  • 360 views

    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 :P

    Get the Current Session Id:

    function GetCurrentSessionId: DWORD;
    asm
      mov     eax,fs:[$00000018];   // Get TEB
      mov     eax,[eax+$30];        // PPEB
      mov     eax,[eax+$1d4];       // PEB.SessionId
    end;
     

    Get the Current Console Session Id:

    function GetConsoleSessionId: DWORD;
    asm
      mov eax, [$7ffe02d8];
    end;

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

    procedure SetCurrentSessionId(const SessionId: DWORD);
    asm
      mov     edx,fs:[$00000018];
      mov     edx,[edx+$30];
      mov     [edx+$1d4], SessionId;
    end;

    and

    procedure SetConsoleSessionId(const SessionId: DWORD);
    var
      p: PDWORD;
      OldProtect: DWORD;
    begin
      p := PDWORD($7ffe02d8);
      Win32Check(VirtualProtect(p, SizeOf(p), PAGE_READWRITE, @OldProtect));
      p^ := SessionId;
      Win32Check(VirtualProtect(p, SizeOf(p), OldProtect, @OldProtect));
    end;

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

    And perhaps more usefull

    procedure SetIsDebuggerPresent(const Value: Boolean);
    asm
      mov edx,fs:[$00000018];     // TEB
      mov edx, [edx+$30];         // PPEB
      mov byte ptr[edx+2], Value; // +0×002 BeingDebugged    : UChar
    end;
     
    VN:F [1.9.3_1094]
    Rating: 8.7/10 (3 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    convert this post to pdf.
  • 2 Comments
  • Filed under: Delphi, Programming
  • 465 views

    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:

    Read the rest of this entry »

    VN:F [1.9.3_1094]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    convert this post to pdf.
    596 views

    Having fun with Windows Licensing

    If you look into the registry in the key HKLM\System\CurrentControlSet\ProductOptions you will find several licensing related Values.

    The ProductType and ProductSuite keys contain the OS Suite and Edition, but the ProductPolicy key is much more interesting. So let’s have a closer look at it, open RegEdit and DoubleClick the key, you will something like the screenshot below, a Binary Value:

    ProductPolicy1

    As you can see the license names are there as a Unicode string and later on I will show you how we can read the values. But because I didn’t want to extract all the names manually I decided to see if I could reverse the used structure because it didn’t look very complicated. Using a Hex Editor I could determine the important part of the structure.

    Read the rest of this entry »

    VN:F [1.9.3_1094]
    Rating: 8.0/10 (1 vote cast)
    VN:F [1.9.3_1094]
    Rating: +1 (from 1 vote)
    convert this post to pdf.
    372 views

    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.

    Read the rest of this entry »

    VN:F [1.9.3_1094]
    Rating: 6.5/10 (2 votes cast)
    VN:F [1.9.3_1094]
    Rating: +1 (from 1 vote)
    convert this post to pdf.
  • 1 Comment
  • Filed under: Delphi, Programming