modify the project demo-module
std::string
get_str() {
return "hello string";
}
// This is an example of an exported function.
__declspec(dllexport) BOOL _stdcall demoFunction(unsigned char *buffer, unsigned int size) {
OutputDebugStringA("demoFunction1 in\n");
printf("demoFunction1 in\n");
static std::string the_string = get_str(); // crash on windows xp
if (!the_string.empty()) {
printf(the_string.c_str());
OutputDebugStringA(the_string.c_str());
} else {
// bad behavior on windows 7 and later. string is always emtpy
OutputDebugStringA("the the_string is empty().\n");
printf("the the_string is empty().\n");
}
OutputDebugStringA("demoFunction2 after static std::string\n");
printf("demoFunction2 after static std::string\n");
if (!buffer)
return FALSE;
char *p = "{f56fee02-16d1-44a3-b191-4d7535f92ca5}";
memcpy_s(buffer, size, p, strlen(p));
return TRUE;
}
THE LINE: static std::string the_string = get_str(); will crash on windows xp.
and on windows 7 and later, the string is always empty;
Any idea?
btw: I test it with project "demo-mmloader-shellcode" with x86.
modify the project demo-module
THE LINE: static std::string the_string = get_str(); will crash on windows xp.
and on windows 7 and later, the string is always empty;
Any idea?
btw: I test it with project "demo-mmloader-shellcode" with x86.