Fun facts about Marvel Comics movies

I am a big fan of the Marvel Universe and the superhero movies they release each year. There are two fun facts about those movies:

  1. The Marvel movies have after credits: when the movie ends and the credits start rolling, do not leave the movies. Instead hang on for a while after the credits you might observe a scene or two.
  2. Stan Lee appears in the movies: if you pay close attention, like hunting for an Easter egg, Mr. Stan Lee will make an appearance in the movie as a background character.

To give you an example, in the gallery below, I show you Stan Lee, the movie and at which time he makes a random appearance in the movie:

You might also like:

Using C/C++ TLS callbacks in Visual Studio with your 32 or 64bits programs

In the following article, I share with you how to use TLS callbacks in your C/C++ program compiled with Visual Studio.

Background

TLS (thread local storage) callbacks are a mechanism provided by the Windows loader to give your program a chance to do initialization/deinitialization tasks when the process starts, terminates, a thread is created or terminated.

A TLS callback has the following prototype:

typedef VOID (NTAPI *PIMAGE_TLS_CALLBACK) (
    PVOID DllHandle,
    DWORD Reason,
    PVOID Reserved);

The Reason argument can be any of the following constants:

  • DLL_PROCESS_ATTACH   = 1
  • DLL_PROCESS_DETACH  = 0
  • DLL_THREAD_ATTACH  = 2
  • DLL_THREAD_DETACH  = 3

The TLS callbacks are encoded inside the compiled program’s TLS data directory(IMAGE_DIRECTORY_ENTRY_TLS). Please refer to the PE file structure. Continue reading “Using C/C++ TLS callbacks in Visual Studio with your 32 or 64bits programs”