| 372 | } |
| 373 | |
| 374 | void CustomFunctionInjector::ExtendStoryHeader(std::wstring const & headerPath) |
| 375 | { |
| 376 | extendingStory_ = true; |
| 377 | |
| 378 | std::ifstream f(headerPath.c_str(), std::ios::in | std::ios::binary); |
| 379 | f.seekg(0, std::ios::end); |
| 380 | auto length = f.tellg(); |
| 381 | f.seekg(0, std::ios::beg); |
| 382 | std::string s(length, '\0'); |
| 383 | f.read(const_cast<char *>(s.data()), length); |
| 384 | f.close(); |
| 385 | |
| 386 | auto headers = functions_.GenerateHeaders(); |
| 387 | Debug("CustomFunctionInjector::ExtendStoryHeader(): Appending to header:\r\n"); |
| 388 | // TODO - if debug? |
| 389 | OutputDebugStringA(headers.c_str()); |
| 390 | std::cout << headers << std::endl; |
| 391 | s += headers; |
| 392 | |
| 393 | std::ofstream wf(headerPath.c_str(), std::ios::out | std::ios::binary); |
| 394 | wf.write(s.data(), s.size()); |
| 395 | wf.close(); |
| 396 | |
| 397 | extendingStory_ = false; |
| 398 | } |
| 399 | |
| 400 | void CustomFunctionInjector::OnCreateFile(LPCWSTR lpFileName, |
| 401 | DWORD dwDesiredAccess, |
nothing calls this directly
no test coverage detected