[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/nt/addsection.c
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] Changes to emacs/nt/addsection.c |
Date: |
Fri, 10 Jun 2005 08:54:57 -0400 |
Index: emacs/nt/addsection.c
diff -c emacs/nt/addsection.c:1.6 emacs/nt/addsection.c:1.7
*** emacs/nt/addsection.c:1.6 Mon Sep 1 15:45:46 2003
--- emacs/nt/addsection.c Fri Jun 10 12:54:56 2005
***************
*** 283,297 ****
PIMAGE_SECTION_HEADER dst_section;
DWORD offset;
int i;
! #define COPY_CHUNK(message, src, size)
\
do {
\
unsigned char *s = (void *)(src);
\
unsigned long count = (size);
\
! printf ("%s\n", (message));
\
! printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base);
\
! printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base);
\
! printf ("\t0x%08x Size in bytes.\n", count);
\
memcpy (dst, s, count);
\
dst += count;
\
} while (0)
--- 283,301 ----
PIMAGE_SECTION_HEADER dst_section;
DWORD offset;
int i;
+ int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0;
! #define COPY_CHUNK(message, src, size, verbose)
\
do {
\
unsigned char *s = (void *)(src);
\
unsigned long count = (size);
\
! if (verbose)
\
! {
\
! printf ("%s\n", (message));
\
! printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base);
\
! printf ("\t0x%08x Offset in output file.\n", dst -
p_outfile->file_base); \
! printf ("\t0x%08x Size in bytes.\n", count);
\
! }
\
memcpy (dst, s, count);
\
dst += count;
\
} while (0)
***************
*** 321,333 ****
dst = (unsigned char *) p_outfile->file_base;
COPY_CHUNK ("Copying DOS header...", dos_header,
! (DWORD) nt_header - (DWORD) dos_header);
dst_nt_header = (PIMAGE_NT_HEADERS) dst;
COPY_CHUNK ("Copying NT header...", nt_header,
! (DWORD) section - (DWORD) nt_header);
dst_section = (PIMAGE_SECTION_HEADER) dst;
COPY_CHUNK ("Copying section table...", section,
! nt_header->FileHeader.NumberOfSections * sizeof (*section));
/* To improve the efficiency of demand loading, make the file
alignment match the section alignment (VC++ 6.0 does this by
--- 325,338 ----
dst = (unsigned char *) p_outfile->file_base;
COPY_CHUNK ("Copying DOS header...", dos_header,
! (DWORD) nt_header - (DWORD) dos_header, be_verbose);
dst_nt_header = (PIMAGE_NT_HEADERS) dst;
COPY_CHUNK ("Copying NT header...", nt_header,
! (DWORD) section - (DWORD) nt_header, be_verbose);
dst_section = (PIMAGE_SECTION_HEADER) dst;
COPY_CHUNK ("Copying section table...", section,
! nt_header->FileHeader.NumberOfSections * sizeof (*section),
! be_verbose);
/* To improve the efficiency of demand loading, make the file
alignment match the section alignment (VC++ 6.0 does this by
***************
*** 351,357 ****
for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
{
char msg[100];
! sprintf (msg, "Copying raw data for %s...", section->Name);
/* Update the file-relative offset for this section's raw data (if
it has any) in case things have been relocated; we will update
--- 356,364 ----
for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
{
char msg[100];
! /* Windows section names are fixed 8-char strings, only
! zero-terminated if the name is shorter than 8 characters. */
! sprintf (msg, "Copying raw data for %.8s...", section->Name);
/* Update the file-relative offset for this section's raw data (if
it has any) in case things have been relocated; we will update
***************
*** 362,368 ****
/* Can always copy the original raw data. */
COPY_CHUNK
(msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile),
! section->SizeOfRawData);
/* Round up the raw data size to the new alignment. */
dst_section->SizeOfRawData =
--- 369,375 ----
/* Can always copy the original raw data. */
COPY_CHUNK
(msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile),
! section->SizeOfRawData, be_verbose);
/* Round up the raw data size to the new alignment. */
dst_section->SizeOfRawData =
***************
*** 402,408 ****
COPY_CHUNK
("Copying remainder of executable...",
OFFSET_TO_PTR (offset, p_infile),
! p_infile->size - offset);
/* Final size for new image. */
p_outfile->size = DST_TO_OFFSET ();
--- 409,415 ----
COPY_CHUNK
("Copying remainder of executable...",
OFFSET_TO_PTR (offset, p_infile),
! p_infile->size - offset, be_verbose);
/* Final size for new image. */
p_outfile->size = DST_TO_OFFSET ();
- [Emacs-diffs] Changes to emacs/nt/addsection.c,
Eli Zaretskii <=