Self-executing reading

I need to read the data added to the end of the executable from this executable.
On win32, I have a problem that I can not open .exe for reading. I tried CreateFile and std :: ifstream.
Is there a way to specify non-exclusive read access to a file that was not originally opened when shared.

EDIT - The great thing about stackoverflow, you ask the wrong question and get the right answer.

+3
source share
3 answers

Why not just use the resources dedicated to this feature. It will not be at the end, but it will be in the executable.

.exe - , .exe

http://msdn.microsoft.com/en-us/library/ms648049(VS.85).aspx

+3

. ? EXE , , . , :

HANDLE file=CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);

32- 64- Windows .

+1

I have no problem opening an executable process image using any of these operators:

FILE* f = fopen( fname, "rb");

hFile = CreateFile( fname, FILE_READ_DATA, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); 

What is your code?

+1
source

Source: https://habr.com/ru/post/1699525/


All Articles