Click here to Skip to main content
15,860,972 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Registry REG_BINARY Problem Pin
CPallini12-Apr-09 11:17
mveCPallini12-Apr-09 11:17 
GeneralRe: Registry REG_BINARY Problem [modified] Pin
locoone12-Apr-09 11:50
locoone12-Apr-09 11:50 
GeneralRe: Registry REG_BINARY Problem Pin
CPallini13-Apr-09 4:46
mveCPallini13-Apr-09 4:46 
GeneralRe: Registry REG_BINARY Problem Pin
locoone13-Apr-09 12:40
locoone13-Apr-09 12:40 
QuestionRemoving the MS-DOS stub from a PE File Pin
iNoble11-Apr-09 8:05
iNoble11-Apr-09 8:05 
AnswerRe: Removing the MS-DOS stub from a PE File Pin
Baltoro11-Apr-09 9:08
Baltoro11-Apr-09 9:08 
GeneralRe: Removing the MS-DOS stub from a PE File [modified] Pin
iNoble11-Apr-09 9:40
iNoble11-Apr-09 9:40 
GeneralRe: Removing the MS-DOS stub from a PE File Pin
Baltoro11-Apr-09 10:21
Baltoro11-Apr-09 10:21 
If you remove the MS DOS header, the Windows loader will fail to load your executable, because (from what the documentation says), the loader reads the IMAGE_DOS_HEADER.e_lfanew field (which contains the file offset of the IMAGE_NT_HEADERS). {Actually, I think it will load the file, it will just fail to execute properly.) I'm just guessing here, but I would guess that the loader checks alot of things to determine if the Portable Executable is valid. You could test this by calling LoadLibrary and providing your new file as a parameter, instead of just attempting to launch it normally ( with CreateProcess).
Actually, I have no idea what will happen when it encounters that space where the original IMAGE_NT_HEADERS used to be.
Did you actually try loading this new file?
In his article, Matt Pietrek states: "Immediately following the PE header in memory is an array of IMAGE_SECTION_HEADERs." This is the Section Table. Since the size of the NT header is known, I would guess that the loader has a problem resolving where to load the Section Table, if it cannot find it at it's normal location. This table contains it's own set of headers, many of it's fields are RVAs, that tell the loader where to find everything else in the file.
Also, (and I just realized this in re-reading your code) you call CopyMemory for the two PE headers, and then initialize a new IMAGE_DOS_HEADER, and you don't write this structure (nor the IMAGE_NT_HEADERS) to LPBYTE lpFile.
You should re-think your entire appraoch to the problem.
GeneralRe: Removing the MS-DOS stub from a PE File Pin
iNoble11-Apr-09 13:16
iNoble11-Apr-09 13:16 
AnswerRe: Removing the MS-DOS stub from a PE File Pin
Stephen Hewitt12-Apr-09 6:08
Stephen Hewitt12-Apr-09 6:08 
GeneralRe: Removing the MS-DOS stub from a PE File Pin
iNoble12-Apr-09 11:36
iNoble12-Apr-09 11:36 
GeneralRe: Removing the MS-DOS stub from a PE File Pin
Baltoro13-Apr-09 5:55
Baltoro13-Apr-09 5:55 
Questionneed help.. [modified] Pin
badboyz8911-Apr-09 7:31
badboyz8911-Apr-09 7:31 
AnswerRe: need help.. Pin
CARPETBURNER12-Apr-09 0:06
CARPETBURNER12-Apr-09 0:06 
Questionwho can share the code to intercept iexplore connect send recv closesocket Pin
ernst2002053011-Apr-09 5:19
ernst2002053011-Apr-09 5:19 
AnswerRe: who can share the code to intercept iexplore connect send recv closesocket Pin
Green Fuze11-Apr-09 20:00
Green Fuze11-Apr-09 20:00 
News[ANN] Announcement: NUI C++ multi-platform appllication framework, 3D hardware GUI [modified] Pin
meelooo11-Apr-09 0:17
meelooo11-Apr-09 0:17 
GeneralRe: [ANN] Announcement: NUI C++ multi-platform appllication framework, 3D hardware GUI Pin
Rajesh R Subramanian11-Apr-09 0:20
professionalRajesh R Subramanian11-Apr-09 0:20 
GeneralRe: [ANN] Announcement: NUI C++ multi-platform appllication framework, 3D hardware GUI Pin
meelooo11-Apr-09 0:26
meelooo11-Apr-09 0:26 
GeneralRe: [ANN] Announcement: NUI C++ multi-platform appllication framework, 3D hardware GUI Pin
Rajesh R Subramanian11-Apr-09 0:31
professionalRajesh R Subramanian11-Apr-09 0:31 
QuestionGEt path of msi Pin
p_196010-Apr-09 23:46
p_196010-Apr-09 23:46 
AnswerRe: GEt path of msi Pin
Rajesh R Subramanian10-Apr-09 23:51
professionalRajesh R Subramanian10-Apr-09 23:51 
GeneralRe: GEt path of msi Pin
p_196010-Apr-09 23:53
p_196010-Apr-09 23:53 
GeneralRe: GEt path of msi Pin
Rajesh R Subramanian11-Apr-09 0:23
professionalRajesh R Subramanian11-Apr-09 0:23 
GeneralRe: GEt path of msi Pin
p_196011-Apr-09 1:04
p_196011-Apr-09 1:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.