Created
November 15, 2014 02:06
-
-
Save blaquee/9d605d2ce93d99daaa74 to your computer and use it in GitHub Desktop.
explicit TLS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#undef UNICODE | |
#include <Windows.h> | |
#pragma comment(linker, "/INCLUDE:__tls_used") | |
void NTAPI TlsCallBack(PVOID h, DWORD dwReason, PVOID pv); | |
#pragma data_seg(".CRT$XLB") | |
PIMAGE_TLS_CALLBACK p_thread_callback = TlsCallBack; | |
#pragma data_seg() | |
int myglobal_; | |
void NTAPI TlsCallBack(PVOID h, DWORD dwReason, PVOID pv) | |
{ | |
MessageBox(NULL, "In TLS", "Inside TLS func", MB_OK); | |
return; | |
} | |
int main(int argc, char** argv) | |
{ | |
MessageBox(NULL, "Main func", "In main func", MB_OK); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment