HMODULE g_hModule = GetModuleHandle( 0 ); HRSRC hRes = FindResource( g_hModule, MAKEINTRESOURCE( ID_DLL_MYDLL ), "ID_DLL" ); HGLOBAL hResource = LoadResource( g_hModule, hRes ); DWORD iResSize = SizeofResource( g_hModule, hRes ); BYTE* pData = ( BYTE* )LockResource( hResource );
When I included a dll file into my project, I used:
fstream pFile( ".\\My Dll.dll", ios::out ); pFile.write( ( const char* )pData, iResSize ); pFile.close();
So that It creates the dll outside of the executable at run time.
But ive noticed that the dll fails to be properly written and the file size is out of sync
2.04 MB (2,145,280 bytes) For original dll
2.04 MB (2,146,101 bytes) For the dll that was written
What could be causing this?