Hi, I just get from Telerik very cool Just Code productivity tool. I received “Complimentary Developer License with Subscription and Priority Support” license for free, because one lady likes bonsai like me :). Just kidding, I get it to have a chance to write this review. I try also install Just Decompile tool because it is free and I had fillings that those two tool can helping me doing complementary work. I have to say that I have full of respect for companies that know how to return back to the community. On the Internet you can find so many free good quality resources written, crated and described by so many hackers just for free, just for giving back. For example when I created KinectCam project I had in mind the same thing. I want give something back, not because of any kind of profit, but only just for help others, solve something for free. Because I found so many answers, so many helps for free. And I like that Just Decompile is for free. And I think to living good you need giving something back.
I was thinking for a some time what software I can show you here? What can I decompile for you. And I decided that I decompile KinectCam for you here in this post. There was so many questions to me. Can I give you a source code of this project? Yes I can, but I can also show you the way to feel like a hacker and decompile my work by yourself. I have not objections with that. So if you want, you can go ahead and just decompile :). There was a time when I was starting my coding adventure. It was about 17 years ago. I started with Turbo Pascal with my best friend of that time. And it was awesome, we try to write project for my friend technical high school homework. He received A for that :). And I discover that it is something I will be doing in live and for live. Did you know that Anders Hejlsberg create Turbo Pascal and later C#? So I somehow continue my fascination and follow his ideas until now.
After a three years when I finished my High School. And I went to the Technical University. And Turbo Pascal helped me again a few times. I was poor student, so when I had a chance to get some extra money I can spent and went with my girlfriend to ice creams or pizza it was nice to me. And it was because of my helping for other students with theirs Turbo Pascal projects. Later I started my fascination to study GNU/Linux operating system, I was trying to programming it, I was studding administration of this systems, configuring it only from bash console, securing it and much more. That was a most beautiful time, and I had a good feelings because of that. I was surrounded by so many things created by hackers for hackers. Things open for learn, for study, for free. What I am trying to say in this section is that I still remember what does “Hacker Ethics” means, my favorite quote is
“The hacker ethic refers to the feelings of right and wrong, to the ethical ideas this community of people had — that knowledge should be shared with other people who can benefit from it, and that important resources should be utilized rather than wasted.”.
And I truly believe in that if someone created something she or he is an author of this. And nobody can get it away from this person. Unfortunately sometimes people forget about that. Anyway, I still remember also very good “How To Became A Hacker” document written by Erik Steven Raymond. So like I said I have no objection to you to just decompile KinectCam, but remember that if I created it I should not be forgotten and I deserve to put my name as an first author in your decompiled code. But that’s is up to you. That’s the difference that so many people is unable to understood. That can describes you as a hacker if you remember that.
Now let’s go to the subject and decompile KinectCam with Just Decompile. When you download it and unzip it to a folder there are three assemblies: Microsft.Kinect.dll created by Microsoft, BaseClasses.NET.dll created originally by Maxim Kartavenkov that I found on the Internet DirectShow Virtual Video Capture Source Filter in C#. And last one is very small KinectCam.dll created by me. Last one assembly was created as a kind of adapter that using Kinect and shows captured video in Virtual Cam. So we can start with just decompile KinectCam.dll assembly :). To do so I will start Just Decompile and open with it KinectCam.dll assembly (Open->File). It looks like below.
And you just open KinectCam.dll and magic happens. And you may travel inside code I created. Some variables have different names. Some things are a bit changed but it is sill suppose to work code. And you may find everything open to you. You can feel like a hacker now. Couldn’t you? It can looks like this.
My favorite feature of the Just Decompile is creating Visual Studio project for you from entire .net assembly you analyze. So, let’s do it right now (Tools-Create Project).
And project will be generated just like that.
So we can view file and open KinectCam.csproj file in Visual Studio 2012.
And you can see that only things you need is fix project because it is not working. First you need change project type to .net 2.0.
I received yesterday Just Code too, so now I have a chance to see what this tool find. I see on left bottom corner that I have 7 errors in 2 files. Let’s checks what is wrong?
So let’s fix them all. First was easy _pvi variables was created two times for a different types. So I just change its name to _pvi2 and change it also on 3 times in 4 lines below. The same for next two bugs. Now we have two bugs with HRESULT, we cannot cast. But we can create new instance of HRESULT. So we can return new HRESULT(-2147023728) on first error and on second error with HRESULT something similar but with different number of the result. And that is it for next bug too. Last two bugs with Label2 I left for you. You also should feel like a hacker, right? :). The tip is, move the label to the correct accessible scope :P. I can almost rebuild project. But when I try it reminds me that I should allow use unsafe code. So I did that.
So basically that is the way Just Decompile works. But there is one more thing :). You can find KinectSensor in KinectHelper.cs file, for example in InitializeSensor method. And with Just Code you can JUST CODE->Navigate->Go to Definition… :). And you can also not only see but debug external assembly as well. I hope you also like today described productivity tools. Enjoy :).