Optional Parameters in C / C++


Recently, while developing a function to help me create logs to keep track of my program for debugging purposes, I came across a need to  specify an undefined amount of parameters so that I can call functions such as CreateLog(“Function Entry: Install”, “Success”, “Remark”, “More Remark”).  Therefore, I have searched online to see whether this can be done.  To my amazement, this was in fact an easy task.  By using the __VA_ARGS__ option and vsprintf function, it can be accomplished.  I have yet the time to tidy the codes for this post but at the very least an article to help out.

If you are not sure what I meant by Optional Parameters, see here.

Article: http://www.lysator.liu.se/c/c-faq/c-7.html

What’s the difference between AppData\Local and AppData\Roaming?

User Account Control Data Redirection


Familiarizing your applications with UAC.  It has become an important piece of information for my future projects.  Data redirection is when Windows redirect the data your application writes to a different directory called VirtualStore.  Something along the lines mentioned, for more please visit the article link below.

Source: http://windowsteamblog.com/windows/b/developers/archive/2009/08/04/user-account-control-data-redirection.aspx

Escalating UAC privileges in C / C++ applications using Visual Studio


To set this linker option in the Visual Studio development environment

  1. Open the project’s Property Pages dialog box. For details, see How to: Open Project Property Pages.
  2. Expand the Configuration Properties node.
  3. Expand the Linker node.
  4. Select the Manifest File property page.
  5. Modify the Enable User Account Control (UAC), UAC Execution Level, and UAC Bypass UI Protection properties.

To set this linker option programmatically

Source: http://msdn.microsoft.com/en-us/library/bb384691.aspx

How User Account Control (UAC) Affects Your Application


There is a need for me recently to run applications with privileges for the registry hive and I came across an article on UAC by MSDN.  The image below depicts how UAC process flow works.

Article: http://msdn.microsoft.com/en-us/library/bb384608.aspx

C vs C++ where Exploit, Game Hack and Malware are concerned


On the contrary of comparing which language is best used in the idea of creating exploits, game hacks and malwares, 01blasphemer has pointed some of the reasons why the C language is at advantage in HackForums. Read the rest of this entry »

Thread.Sleep (.NET) vs Sleep Function (WinAPI)


Thread.Sleep is a sign of a poorly designed program.

by Peter Ritchie.

Thread.Sleep has it’s use: simulating lengthy operations while testing/debugging on an MTA thread.  In .NET there’s no other reason to use it.

Thread.Sleep(n) means block the current thread for at least the number of timeslices (or thread quantums) that can occur within n milliseconds.  The length of a timeslice is different on different versions/types of Windows and different processors and generally ranges from 15 to 30 milliseconds.  This means the thread is almost guaranteed to block for more than n milliseconds.  The likelihood that your thread will re-awaken exactly after n milliseconds is about as impossible as impossible can be.  So, Thread.Sleep is pointless for timing.  Read the rest of this entry »

Getting the IE Address URL directly!


As of right now, I am trying to fetch the URL that exists in the Internet Explorer address bar.  I tried using registry to call out to “Software\Microsoft\Internet Explorer\TypedURLs\url1” but Internet Explorer only changes the registry if the adress bar’s URL windowas entered by the user!  If you were to link to another page with a click, the registry would not be updated.  What I am doing right now is to use a different method, to find the window of the address bar and retrieve the text directly.  However, I find this method rather hard although proven effecient, a little of Google search got me into this link which right now I am using.  Whether or not it gives me the final solution, I will post it up later in a full article on how to retrieve it with the source code available!  This link has also provided me a good tool to check on windows classes, texts and its child, a little much more better than the Microsoft Spy++.  The tool is called Windowse.  Below is the link to the article that is helping me right now.

Article: http://delphi.about.com/od/windowsshellapi/l/aa060303a.htm

Recursive File Search in C | Source Code


This source code below is written by se7en from LeetCoders.  It is capable of running through the enter C drive in 8 seconds on my computer finding more than 230,000 files.  Although the downside of it is that it costs quite an amount of CPU usage during its process.  You might try to optimize it by placing Sleep function or something that is possible in reducing the CPU usage. Read the rest of this entry »

HTTP File Downloader for Linux and Windows in C | Source Code


A member in HackForums by the handle Jakash3 has posted a source code on how to download files from the Internet that can be compiled in both Linux and Windows.  Another great feature is that it supports IPv6. Read the rest of this entry »