Hi, I just get from Telerik very cool Just Code productivity tool. I received a “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 installed Just Decompile tool because it is free, and I had fillings that two tools can help me do complementary work. I have to say that I have full respect for companies that know how to return to the community. On the Internet, you can find so many free good quality resources written, created, and described by so many hackers for free, just to give back. For example when I created KinectCam project I had in mind the same thing. I want to give something back, not because of any kind of profit, but only just to help others and solve something for free. Because I found so many answers and so much help 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 were so many questions for me. Can I give you a source code for this project? Yes, I can, but I can also show you how to feel like a hacker and decompile my work yourself. I have no objections to 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 at that time. And it was awesome; we tried to write a project for my friend’s technical high school homework. He received an A for that :). And I discover that it is something I will be doing in life and for life. Did you know that Anders Hejlsberg create Turbo Pascal and later C#? So I somehow continued my fascination and followed 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 a poor student, so when I had a chance to get some extra money, I could spend and go with my girlfriend to ice cream or pizza; it was nice for me. And it was because of my helping other students with their Turbo Pascal projects. Later, I started my fascination with studying GNU/Linux operating system; I was trying to program it, I was studying the administration of this systems, configuring it only from bash console, securing it and much more. That was a beautiful time, and I had good feelings. I was surrounded by so many things created by hackers for hackers. Things open for learning, for study, for free. What I am trying to say in this section is that I still remember what “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 perfect “How To Became A Hacker” document written by Erik Steven Raymond. So like I said, I have no objection to you just decompiling KinectCam, but remember that if I created it, I should not be forgotten, and I deserve to put my name as an author in your decompiled code. But that’s up to you. That’s the difference that so many people are unable to understand. 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 the last one is a very small KinectCam.dll created by me. The last assembly was created as a kind of adapter that uses Kinect and shows captured video in Virtual Cam. So we can start with just decompiling 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 the code I created. Some variables have different names. Some things are slightly changed, but it is still supposed 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. In the bottom left corner, I see 7 errors in 2 files. Let’s checks what is wrong?
So let’s fix them all. The first easy _pvi variables were created two times for different types. So I changed its name to _pvi2 3 times in the 4 lines below. The same for the next two bugs. Now we have two bugs with HRESULT; we cannot cast. But we can create a new instance of HRESULT. So we can return a new HRESULT(-2147023728) on the first error and on a second error with HRESULT something similar but with a different result number. And that is it for the next bug too. Last two bugs with Label2 I left for you. You also should feel like a hacker, right? :). The tip is to move the label to the correct accessible scope :P. I can almost rebuild project. But when I try, it reminds me that I should use unsafe code. So I did that.
So basically that is the way Just Decompile works. But there is one more thing :). For example, you can find KinectSensor in KinectHelper.cs file in the 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’s described productivity tools. Enjoy :).