Click here to Skip to main content
15,867,568 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Does this line of code bother anyone? Pin
CPallini7-Oct-14 23:06
mveCPallini7-Oct-14 23:06 
GeneralRe: Does this line of code bother anyone? Pin
stgagnon8-Oct-14 2:41
stgagnon8-Oct-14 2:41 
AnswerRe: Does this line of code bother anyone? Pin
Stefan_Lang13-Oct-14 3:00
Stefan_Lang13-Oct-14 3:00 
GeneralRe: Does this line of code bother anyone? Pin
Chris Maunder8-Oct-14 3:07
cofounderChris Maunder8-Oct-14 3:07 
QuestionAbout SetFocus in Doc/View Architecture Pin
Drakesal6-Oct-14 5:12
Drakesal6-Oct-14 5:12 
Questionsaving records without database? Pin
Robin Percival Vibar5-Oct-14 20:49
Robin Percival Vibar5-Oct-14 20:49 
AnswerRe: saving records without database? Pin
CPallini5-Oct-14 21:15
mveCPallini5-Oct-14 21:15 
QuestionTLS Callback generates Virus alert Pin
MarkMacro693-Oct-14 22:50
MarkMacro693-Oct-14 22:50 
Hello Everybody,

I'm working on a simple C++ Project in VS 2013 Express. I'm trying to implement a TLS Callback function into a simple prog. What I want to do in future is to check for any present debuggers before the main (entrypoint) is called (...I know that most debuggers can handle TLS).

Here is my code so far and it works:

C++
#include <windows.h>
#include <stdio.h>

using namespace std;

// tls callback declaration
void WINAPI TLSCallback(PVOID DllHandle, DWORD dwReason, PVOID Reserved)
{
	MessageBox(0, L"TLS Callback before main.", L"TLS CallBack", 0);
	
}
// end declaration

//linker specs
#ifdef _M_IX86
#pragma comment (linker, "/INCLUDE:__tls_used")
#pragma comment (linker, "/INCLUDE:__xl_b")
#else
#pragma comment (linker, "/INCLUDE:_tls_used")
#pragma comment (linker, "/INCLUDE:_xl_b")
#endif
#ifdef _WIN64
#pragma const_seg (".CRT$XLB")
const
#else
#pragma data_seg (".CRT$XLB")
#endif
//end linker


//tls import
EXTERN_C
{
PIMAGE_TLS_CALLBACK _xl_b = TLSCallback;
#pragma data_seg ()
#pragma const_seg ()
}
//end 

int main(int argc, char* argv[])
{
	printf("Hello World from main()!");
	getchar();
	return 0;
}


However, the really strange thing (at least to me) is, that if I switch in VS 2013 Express from Debug Configuration to Release Configuration and compile the project, AntiVir pops up with a message like "TR/Crypt.XPACK.Gen" found in compiled EXE. O.k. since TLS is also used by maleware I can basically understand that AntiVir doesn't like such things, but why does it not happen in Debug Configuration? Is there any way that it also would work in Release Configuration (Linker Options etc.?) ?Confused | :confused:

modified 4-Oct-14 5:22am.

Questionquine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 4:08
Reuben Cabrera2-Oct-14 4:08 
GeneralRe: quine mccluskey method on C/C++ Pin
David Crow2-Oct-14 5:13
David Crow2-Oct-14 5:13 
GeneralRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 21:38
Reuben Cabrera2-Oct-14 21:38 
GeneralRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 21:45
Reuben Cabrera2-Oct-14 21:45 
QuestionRe: quine mccluskey method on C/C++ Pin
Richard MacCutchan2-Oct-14 5:17
mveRichard MacCutchan2-Oct-14 5:17 
JokeRe: quine mccluskey method on C/C++ Pin
CPallini2-Oct-14 7:21
mveCPallini2-Oct-14 7:21 
GeneralRe: quine mccluskey method on C/C++ Pin
Richard MacCutchan2-Oct-14 7:30
mveRichard MacCutchan2-Oct-14 7:30 
GeneralRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 21:41
Reuben Cabrera2-Oct-14 21:41 
AnswerRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 21:35
Reuben Cabrera2-Oct-14 21:35 
GeneralRe: quine mccluskey method on C/C++ Pin
Richard MacCutchan2-Oct-14 21:45
mveRichard MacCutchan2-Oct-14 21:45 
GeneralRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 23:03
Reuben Cabrera2-Oct-14 23:03 
QuestionMFC- receiving Button-Click-Message failed Pin
Member 111256242-Oct-14 4:05
Member 111256242-Oct-14 4:05 
AnswerRe: MFC- receiving Button-Click-Message failed Pin
Richard Andrew x642-Oct-14 10:47
professionalRichard Andrew x642-Oct-14 10:47 
GeneralRe: MFC- receiving Button-Click-Message failed Pin
Member 111256243-Oct-14 1:15
Member 111256243-Oct-14 1:15 
Questionreplace malloc by new Pin
_Flaviu2-Oct-14 2:32
_Flaviu2-Oct-14 2:32 
AnswerRe: replace malloc by new Pin
_Flaviu2-Oct-14 3:02
_Flaviu2-Oct-14 3:02 
Questionhow to utilize "(int argc, const char * argv[]) " in a program Pin
Stefan611-Oct-14 13:25
Stefan611-Oct-14 13:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.