Builder & Stub | How to create your own builder and stub in C (using Resource)

If you are looking to build it using EOF, look here.

As i have already created a similar post which creates your own builder using the File I/O (Input/Output) operation, some have came across a problem where they need their stub application to be placed and ran in memory instead of normal execution.  In order to counter this problem, the solution that can come into mind is to use the resource data in the file.  Even if your file is ran in the memory, the resource data is also loaded with it.  Be aware that the terms used may confuse you so read the synonym section.  Take a look at the concept below. Read the rest of this entry »

Builder & Stub | How to create your own builder and stub in C (using EOF)

If you are looking to build it using Resource, look here.

This question is often seen in one of the forum that i hang around.  Although the programming language is different, the idea and concept is one.  I have already prepared a source code for this project but i will explain a little or less about how it works.  Understand that the term stub i am using refers to the application that is going to read a message that has been injected from an application called builder.  Be aware that the term injected also refers to implanted or appended.  In this article, i will be showing the concept on how a builder and stub works, what will you need before coding it and your preparations as well as pseudocode to ease understanding of the concept.  Apart from that you can download the project in case you are not sure what to do with the source code given due to certain complexity. Read the rest of this entry »

Auto Updater

I came across a question today and i find it very interesting.  I never thought of this back then when i haven’t tested C’s .dll and VB .NET together.  This post would more be of a theory and it’s pretty simple.  By the way, “Auto Updater” do mean that the program is capable of updating the version itself.


If you already know how to create a dynamic link library file, i think it’s pretty easy for you to do it.  There is alot of method to do so but what i am suggesting here is to use 2 files.  1 would be your .exe file and the other would be your .dll file.  I’ll assume that you’re building everything in C/++ because i am.

In your main program, you’ll have to decide when you’re going to check for updates and you’ll have to provide the if-else yourself.  I’m only guiding on how will you perform the update for the function.

Now, the idea is to build your functions in a .dll form and your .exe file would execute them.  So whenever a bug occurs it would occur in the .dll file.  And when that happens you could send a trigger to your .exe file maybe by having them check your website whether there is a need for it to do so.  When it does need to update, it performs the update function and it will download automatically from your website (probably a link that you’ve provided) and replace it with the .dll that you previously have.  Voilà!

How do you call a function in a .dll in C/++

Let’s assume the .dll file is called “math.dll” and the function is called “Addition” as below

__declspec(dllexport) short Addition(short num1, short num2)

In order to call the function from the library, we have to first specify the function in our .exe.  The codes below shows the full syntax for what is required.

typedef short (__stdcall *fAddition)(short num1, short num2);
HINSTANCE math = LoadLibrary("math.dll");

fAddition ptAddition = (fAddition)GetProcAddress(math, "Addition");

printf("%d", ptAddition(1, 2));


As you can see,
line 1 is used to define the function and its parameters
line 2 is used to load the library into an HINSTANCE variable so that we could free it later
line 4 is used to get the address of the function from the library by using GetProcAddress
line 6 as you can see is to show you that it works
line 8 is used to free the library once we’re done using it

Other information on C/++ calling dynamic link library –


If you think that this is pretty silly for a small program (or some other reason), you might just want to build it in a single executable file.  Have it check when to update and when it does, download the updated executable (the new version) from your website or somewhere and replace it with the original file.  Produce creative ideas and you’ll be able to solve it in your own way.