New idea for Windows Touch Remix

20
May
3

I’m going to do a quick-dial feature for Windows Touch Remix. I want to keep the code nice so it’ll take me a few days to get there, but this is how it looks at the moment (and how it’s supposed to look, anyway):

wtr2

Personally i kind of like the shading, what do you think? :)

F#.NET

17
May
0

F#.NET is a new functional language from Microsoft. It looks very promising, and here you can see a very good video presentation Luca Bolognese gave about it.

Fibonacci function

Snippet of the day: C#.NET configuration files

17
May
0

I’ll start with a longer snippet – handling configuration files in C#.NET. I used this in Windows Touch Remix.

This is the base class I use for my configuration classes:

[Serializable()]
public class XmlConf
{
    public static T FromFile<T>(string filename)
    {
        if (!File.Exists(filename)) return default(T);
        XmlSerializer ser = new XmlSerializer(typeof(T));
        StreamReader fs = new StreamReader(filename);
        T t = (T) ser.Deserialize(fs);
        fs.Close();
        return t;
    }

    public void Save(string filename)
    {
        XmlSerializer ser = new XmlSerializer(this.GetType());
        StreamWriter fs = new StreamWriter(filename, false);
        ser.Serialize(fs, this);
        fs.Close();
    }
}

Just subclass it and add your configuration properties:

    [Serializable()]
    public class MyConf : XmlConf
    {
        public int IntVal { get; set; }
        public string StrVal { get; set; }
    }

Make sure you use getters and setters like in the above example, so the values get serialized properly. Most .NET classes (like List) are serializable, but if you have properties of your own class, make sure they are serializable.

Here’s a usage example of saving and loading the configuration:

// Save
MyConf conf = new MyConf();
conf.IntVal = 100;
conf.StrVal = "hey";
conf.Save("my.conf");

// Load
conf = MyConf.FromFile<MyConf>("my.conf");
if (conf == null) new Exception("Configuration file not found.");
Console.WriteLine(conf.IntVal);
Console.WriteLine(conf.StrVal);

Windows Touch Remix

17
May
1

I did some further work on my Windows Touch Remix project, which I’ll be presenting at the NTK (Microsoft NT Conference) in Portorož on the 25th (i think) of May.

Here is the screenshot of the current version:

wtr

These are some of the more important features:

- Can replace your desktop

- Works like a (hopefully) stylish Start Menu

- Can import apps simply by dragging them from Program Files

- Almost completely customizable

I’m also working on an online AppStore-thingy which would allow auto-configuration of apps, but more importantly provide nice big icons you can use.

If anyone knows how to make Windows not include those shortcut arrows in the icons if you’re extracting them from shortcuts, let me know (the problem is that the shortcut can be to a non-exe file or have a different icon than the exe does).

You can download WTR (Windows Touch Remix) here.

My article about new DLL injection and API hooking methods

15
May
10

I’m writing a ‘scientific’ article on DLL injection and API hooking (advanced programming techniques) for the Windows NT OS. Me and Zoran Bosnić (my menthor) are almost finished with it and it will hopefully be published in the SPE journal. I don’t know how long it takes to publish, but I hope it will be confirmed by August. Does anyone know?

Also, any idea if you can publish such an article on your own site, or have you basically given those rights away to the publisher?

A brief explanation of new methods which I’ve developed:

- DLL injection: I use debugger API in a similar manner that the CreateRemoteThread approach uses, but I execute the code via modification of the main thread’s context to run the code for me (instead of creating a new thread). This approach seems to be somewhat slower, but that is not important. What is important that it allows DLL injection into a suspended process or in other words injection will work even if you create a process in a suspended state (unlike CreateRemoteThread which does not work in this case).

- API hooking: I’ve developed a method of API hooking that is able to hook any single machine code instruction, which might be useful in some cases. Also, it allows for hooking of instructions that contain relative memory addresses, unlike Microsoft Detours. I hope it will be possible to further optimize this method, at it is considerably slow compared to Detours. However when the Detours approach is applicable I just use it instead, but I’d still like to make it faster for cases which Detours can not handle. Code redirection time with Detours: 1ns, my method: 1600ms. Wow, that really is much slower. But at least it works in such cases where Detours fails.