Fighting with proxy – home vs. office

Hmmmm, I am wondering if everyone have same problem as I do – at work, we are using proxy server. Internet Explorer is working fine – it can dynamically enable\disable proxy, same applies for applications that can use IE as proxy configuration source – however there are many applications where you must manually enable\disable proxy.

 For example Miranda or Last.FM – and I really hate this 🙁

 One of my friends have very nice idea – what if you could have local proxy (on your laptop) and some scripts that will enable\disable master proxy for this? I like this idea, because you have only one connection to manage and you will point all your applications to this local proxy.

 Right now I am looking for best candidate for this – free local proxy, that supports master proxy and have configuration in registry\file or supports some scripting interfaces…

 Do you know any such products? Let me know… If I will implement this successfully, I will post step-by-step procedures on this blog.


Good bye, "Click to activate" ActiveX

Hooooray, great news 🙂

 Maybe you remember when Microsoft lost his case with Eolas, we were force to click on every #$%#@ ActiveX component on every web page – I don’t want to blame Microsoft for this, I don’t want to blame Eolas and definitely I don’t want to blame lawyers (because I got one at home ;))…

But soon we will finally forget those dark times – Microsoft licensed that “technology” from Eolas – so soon we will get back our wonderfull old-style ActiveX processing 🙂

 To be more specific – December 2007 will be avaible patch preview and patch itself should be delivered at end of April 2008…

 Want more details? Follow

Empty tokens in For /f?

I received email with following question from Otto:

I have file with delimiters, however not every token have values. For example following file:


If I try to use For /f to parse it (For /f “usebackq delims=; tokens=1,2,*” %%i IN (`Type Test.txt`) Do Echo a=%%i b=%%j c=%%k, following is output:

a=test1 b=test2 c=test3
a=t1 b=t3 c=
a=te2 b=te3 c=
a=tes1 b=tes2 c=

As you can see, For /f ignores empty tokens… So how to solve it?

Only solution that came to my mind was to recommend using search&replace utility to replace these values first… However after some time I thought – “Hey, this is task ideal for regex replacement”.


So I tried yesterday to write EmptyTokenParser.cmd that should be able to handle it (using SED from GnuWin32).


@Echo off
Set Int.File=%~1
Set Int.Delimiter=%~2

type “%Int.File%” | sed s/”^%Int.Delimiter%”/”#empty#%Int.Delimiter%”/g;s/”%Int.Delimiter%%Int.Delimiter%”/”%Int.Delimiter%#Empty#%Int.Delimiter%”/g;s/”%Int.Delimiter%$”/”%Int.Delimiter%#Empty#/g

Usage is quite easy – EmptyTokenParser “Test.txt” “;” and result will appear like this:


 You must download SED to make it work. SED among many GREAT command line utilities can be found at

So the final script:

For /f “usebackq delims=; tokens=1,2,*” %%i IN (`EmptyTokenParser “Test.txt” “;”`) Do Echo a=%%i b=%%j c=%%k



a=test1 b=test2 c=test3
a=t1 b=#Empty# c=t3
a=#empty# b=te2 c=te3
a=tes1 b=tes2 c=#Empty#

P.S.: Do you also use your blogs to write reminders? 😉

Auto-Update script

Small script I wrote long time ago – I was delaying release, because it was not finished, however I decided to release it – maybe small bits of code will be useful for you or you could just check it and wait for some (at least beta ;)) version.

I am using it however for some utilities like SysInternals. So what it can do?

If you have utilities WITHOUT version number in name (for example, this script can automatically check and automatically download new version whenever it is available.


Configuration is really simple:

  1. In Configuration folder create new folder (for example Handle)
  2. In this folder create file with SAME name (Handle\Handle.ini)
  3. In this file, add line URL=xxx, where xxx is URL of target file (for example URL=
  4. That’s it – you auto update configuration for Handle from SysInternals is finished


Again, I tried to keep it simple 🙂 To use it, just run Auto-Update.cmd with parameter /Update (only supported parameter now, will add more in future). After this parameter, you must specify name of package you want to update or “*” to update all packages. So if I want to update Handle package created above, I will run Auto-Update /Update Handle. If I want to update all packages, I will run Auto-Update /Update *.

Technical details

Well, there is nothing more about this small, but useful script. It is using WGet to get timestamps\download files and EchoX (really great utility) for echoing different colors.

P.S.: I “hosted” project on my Live Drive – so far I really like this new service from Windows Live 🙂

Check application streaming – for free ;)

I think everyone heard at least something about application streaming – related to my last post, it would solve most of our problems 🙂

Currently there are few solutions available like SoftGrid, Tarpoon, Thinstall, Altiris etc.

Problem is that most administrators would like to try application streaming before deploying it (or recommending it to their managers ;)).

I found two really nice sites where you can test it for free 🙂

  • – Thinstall is working similar way as AutoIt – it can generate packages that also contains required runtime. I really like this, because you can think about it as streaming also streaming engine itself 😉 On this page, you can download some free applications that are streamed for you.
  • Stream 24/7 – this site allows you to stream some applications also, however approach is different, you need to have client installed. It is powered by app streaming solution from Endeavors Technologies company.

Currently I am testing and I like this concept so far, however I can imagine future of it…


For example consider streamed SourceForge projects – you will have Stream button next to each project and you could easily check application without worrying about how it will affect your system.

Or jukebox concept (Endeavors was talking about it also). My idea is quite simple, you will have utility where you could burn\backup your stream applications to DVD (bluerays, whatever).

If you would like to run such application, jukebox will just ask you to insert required DVD and that’s it. New website? Stream IE6, IE7, Opera, Safari, FireFox…

And business model? Just think about online streaming – you could stream your application to internet (and it really means that you will have all tools you need at one place).

Think about streaming… Because you will heard about it more and more.

DLL hell – is there any solution?

Hi guys,


long time no post, however I decided it is time to start blogging again…

Right now I run into dll hell problems again 🙁 You don’t know DLL hell?

Lucky you 😉

Many years ago we were fighting for each megabyte – talking about HDD (which is really cheap now) and also memory (same applies). That is why Microsoft came with concept of shared libraries.

What it really means? Different applications were able to use shared libraries. If your applications requires msvcrt.dll, they could share one from System32 folder. BUT…

What if your applications requires different version than is currently deployed? Baang – you have problem. What if you have application from one stupid vendor, that overrides default library with old one? It is (or was) really common practice from developers – nothing is important, just to make my application work. I built my application on COM objects (ActiveX, objects that must be registered prior to be used), but I want to be able to run them from CD\USB without installation. Ok, I will just add function that will automatically register them when application is running.

Problem is that COM objects are accessed through registry – you request DLL without knowing exact location, location is retrieved from registry and that’s it. Problem is that Last registration wins – if you register library from CD, that you can break other applications that are using same library (Request to registry -> Retrieved location (CD)).

But don’t be too pessimistic – with Windows XP, new features arrived that can help us. SideBySide (having different versions of DLLs), .NET (GAC etc and strongly typed libraries) and local and manifest files.

Local and manifest files provides functionality I really love. They allows you to modify application behavior without having access to source codes (in 99,9% cases you don’t have access to source code and developers usually don’t understand administrator’s problems).

If you want to sandbox libraries (normal ones, not COM), just create empty .local file. For example, if affected application is called AppX.exe, create file AppX.exe.local in same folder. This will instruct Windows to search for all libraries at current folder first, even if application is trying to load library using hardcoded path. Even better is when you use AppX.exe.local as folder, not file. In this case just copy all your libraries to this folder.

So consider scenario, where you have application AppX from VendorX. This application is using library LibX.dll, but it requires older version. You will run into problem, you trace problem you LibX.dll and contact vendor – most of the time answer will be “replace LibX.dll in System32 with this file and it will work”, which is not something we want to hear. So we just create AppX.exe.local folder next to AppX.exe and copy old version of LibX.dll to this folder and problem is fixed 🙂

This solves problems with normal libraries, however what to do with COM objects (and they are usually problematic ones)? There is also one solution – create manifest file for your application.

When you query registry, bunch of information is retrieved. Probably most important is InProcServer32 that defines location of library. Using manifest file, you can skip\ignore registry query and provide directly information you want to use.

Following example was taken from great article Escape DLL hell.

Your application is called RegFreeComDemo1.exe and requires COM library VB6Hello.dll. Just create file RegFreeComDemo1.exe.manifest and paste following to this file:

<?xml version=”1.0″ encoding=”utf-8″?>
<assembly xsi:schemaLocation=”urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd” manifestVersion=”1.0″ xmlns:asmv1=”urn:schemas-microsoft-com:asm.v1″ xmlns:asmv2=”urn:schemas-microsoft-com:asm.v2″ xmlns:dsig=”” xmlns=”urn:schemas-microsoft-com:asm.v1″ xmlns:xsi=””>
  <assemblyIdentity name=”RegFreeComDemo1.exe” version=”″ type=”win32″ />
  <file name=”VB6Hello.dll” asmv2:size=”20480″>
    <hash xmlns=”urn:schemas-microsoft-com:asm.v2″>
        <dsig:Transform Algorithm=”urn:schemas-microsoft-com:HashTransforms.Identity” />
      <dsig:DigestMethod Algorithm=”″ />
    <typelib tlbid=”{ea995c49-e5d0-4f1f-8489-31239fc9d9d0}” version=”2.0″ helpdir=”” resourceid=”0″ flags=”HASDISKIMAGE” />
    <comClass clsid=”{97b5534f-3b96-40a4-88b8-19a3bf4eeb2e}” threadingModel=”Apartment” tlbid=”{ea995c49-e5d0-4f1f-8489-31239fc9d9d0}” progid=”VB6Hello.Class1″ />

Query to registry is automatically skipped and information from .manifest is used instead.

There is however one cave eat – you must know information prior to be able to generate such file. There are few ways how to retrieve them:

  • Use OleView from Microsoft

  • Import to registry and manually dump

  • Create Visual Studio project with same name, import libraries and select them as Isolated

    • MyProject\Refereces\Add\Browse – load library

    • Select added item and open Properties

    • Set Isolated to True

    • Build solution – manifest file with all required entries is automatically generated

I started to work on utility that will be able to automatically generate manifest file for you, however I am afraid it is not as simple as it looks like 🙁

If there is some developer out there that is willing to help desperate administrators, please let me know. It would be really nice to have one-click solution to most DLL hell problems 😉