| 196 | } |
| 197 | |
| 198 | void LoadClr() |
| 199 | { |
| 200 | wchar_t buffer[255]; |
| 201 | if (!GetModuleFileNameW(g_myDllModule, buffer, 255)) |
| 202 | return; |
| 203 | |
| 204 | std::wstring modulePath(buffer); |
| 205 | |
| 206 | // Get just the directory path. |
| 207 | modulePath = modulePath.substr(0, modulePath.find_last_of('\\') + 1); |
| 208 | modulePath = modulePath.append(LOAD_DLL_FILE_NAME); |
| 209 | |
| 210 | // Copy the string, or we end up with junk data by the time we send it off |
| 211 | // to our thread routine. |
| 212 | dllLocation = new wchar_t[modulePath.length() + 1]; |
| 213 | wcscpy(dllLocation, modulePath.c_str()); |
| 214 | dllLocation[modulePath.length()] = '\0'; |
| 215 | |
| 216 | g_hThread = (HANDLE)_beginthreadex(NULL, 0, ThreadMain, NULL, 0, NULL); |
| 217 | } |
| 218 | |
| 219 | BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved) |
| 220 | { |