Just a question here...
I'm trying to hook a DLL into a process (for a private project, only). The first time I do, it works fine. But the second time I do it, it seems to crash. It only happens when I forcibly unload the DLL from the process through:

Code:
HMODULE hHookedDll = GetModuleHandle(_T("ThreadSpy.dll"));
ASSERT( FreeLibrary(hHookedDll) );
I'm wondering if this is a bad thing? The library was dynamically loaded into the process space via LoadLibrary & CreateRemoteThread by the hooking process, so it is dynamically loaded. So shouldn't it be safe to unload it, then?

After I unload it and try to inject the DLL again, I get a crash in the process I inject it into. The crash occurs in the function:
Code:
_CRTIMP void * __cdecl _decode_pointer(void *codedptr)
So I don't know if I'm doing something wrong... Does anyone know?