mardi 27 décembre 2016

How to start a thread in DLLMain?

How can I start a thread in DLLMain means std :: thread - fundamentally. No means WinApi, and STL means. When I run the function in the flow, then I crash the application is called from this DLL. Thank you in advance.

This code gets the hash sum on the file (exe) and writes it to a file. (* .txt). But the application crash `

void initialize()
{
    string buffer;
    thread t(calclulateHash, ref(buffer));
    t.detach();
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:
        {
            initialize();
            break;
        }
    }
    return true;
}

Aucun commentaire:

Enregistrer un commentaire