aboutsummaryrefslogtreecommitdiffstats
path: root/nt/addsection.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-06-15 12:57:51 +0000
committerKaroly Lorentey2005-06-15 12:57:51 +0000
commitef85512e51f043d73788f00a2aed13cccde0682c (patch)
treefc1fa1378533250f260ef8eaa9a84ae882d9df84 /nt/addsection.c
parent8736257554f49445f7b4402ac7a9436b38ce6452 (diff)
parentef88a9999004e6c26148c8d280d6a41f623d7249 (diff)
downloademacs-ef85512e51f043d73788f00a2aed13cccde0682c.tar.gz
emacs-ef85512e51f043d73788f00a2aed13cccde0682c.zip
Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364 Remove "-face" suffix from widget faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365 Remove "-face" suffix from custom faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366 Remove "-face" suffix from change-log faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367 Remove "-face" suffix from compilation faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368 Remove "-face" suffix from diff-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369 lisp/longlines.el (longlines-visible-face): Face removed * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370 Remove "-face" suffix from woman faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371 Remove "-face" suffix from whitespace-highlight face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372 Remove "-face" suffix from ruler-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373 Remove "-face" suffix from show-paren faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374 Remove "-face" suffix from log-view faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375 Remove "-face" suffix from smerge faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376 Remove "-face" suffix from show-tabs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377 Remove "-face" suffix from highlight-changes faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378 Remove "-face" suffix from and downcase info faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379 Remove "-face" suffix from pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380 Update uses of renamed pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381 Tweak ChangeLog * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383 Remove "-face" suffix from strokes-char face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384 Remove "-face" suffix from compare-windows face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385 Remove "-face" suffix from calendar faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386 Remove "-face" suffix from diary-button face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387 Remove "-face" suffix from testcover faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388 Remove "-face" suffix from viper faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389 Remove "-face" suffix from org faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390 Remove "-face" suffix from sgml-namespace face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391 Remove "-face" suffix from table-cell face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392 Remove "-face" suffix from tex-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393 Remove "-face" suffix from texinfo-heading face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394 Remove "-face" suffix from flyspell faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397 Remove "-face" suffix from gomoku faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398 Remove "-face" suffix from mpuz faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408 Remove "-face" suffix from Buffer-menu-buffer face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409 Remove "-face" suffix from antlr-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410 Remove "-face" suffix from ebrowse faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412 Remove "-face" suffix from flymake faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413 Remove "-face" suffix from idlwave faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414 Remove "-face" suffix from sh-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415 Remove "-face" suffix from vhdl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417 Remove "-face" suffix from which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418 Remove "-face" suffix from cperl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419 Remove "-face" suffix from ld-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420 Fix cperl-mode font-lock problem * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421 Tweak which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
Diffstat (limited to 'nt/addsection.c')
-rw-r--r--nt/addsection.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/nt/addsection.c b/nt/addsection.c
index ae44c7f943c..8fbe8c38050 100644
--- a/nt/addsection.c
+++ b/nt/addsection.c
@@ -1,5 +1,5 @@
1/* Add an uninitialized data section to an executable. 1/* Add an uninitialized data section to an executable.
2 Copyright (C) 1999 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2005 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -283,15 +283,19 @@ copy_executable_and_add_section (file_data *p_infile,
283 PIMAGE_SECTION_HEADER dst_section; 283 PIMAGE_SECTION_HEADER dst_section;
284 DWORD offset; 284 DWORD offset;
285 int i; 285 int i;
286 int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0;
286 287
287#define COPY_CHUNK(message, src, size) \ 288#define COPY_CHUNK(message, src, size, verbose) \
288 do { \ 289 do { \
289 unsigned char *s = (void *)(src); \ 290 unsigned char *s = (void *)(src); \
290 unsigned long count = (size); \ 291 unsigned long count = (size); \
291 printf ("%s\n", (message)); \ 292 if (verbose) \
292 printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base); \ 293 { \
293 printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \ 294 printf ("%s\n", (message)); \
294 printf ("\t0x%08x Size in bytes.\n", count); \ 295 printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base); \
296 printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \
297 printf ("\t0x%08x Size in bytes.\n", count); \
298 } \
295 memcpy (dst, s, count); \ 299 memcpy (dst, s, count); \
296 dst += count; \ 300 dst += count; \
297 } while (0) 301 } while (0)
@@ -321,13 +325,14 @@ copy_executable_and_add_section (file_data *p_infile,
321 dst = (unsigned char *) p_outfile->file_base; 325 dst = (unsigned char *) p_outfile->file_base;
322 326
323 COPY_CHUNK ("Copying DOS header...", dos_header, 327 COPY_CHUNK ("Copying DOS header...", dos_header,
324 (DWORD) nt_header - (DWORD) dos_header); 328 (DWORD) nt_header - (DWORD) dos_header, be_verbose);
325 dst_nt_header = (PIMAGE_NT_HEADERS) dst; 329 dst_nt_header = (PIMAGE_NT_HEADERS) dst;
326 COPY_CHUNK ("Copying NT header...", nt_header, 330 COPY_CHUNK ("Copying NT header...", nt_header,
327 (DWORD) section - (DWORD) nt_header); 331 (DWORD) section - (DWORD) nt_header, be_verbose);
328 dst_section = (PIMAGE_SECTION_HEADER) dst; 332 dst_section = (PIMAGE_SECTION_HEADER) dst;
329 COPY_CHUNK ("Copying section table...", section, 333 COPY_CHUNK ("Copying section table...", section,
330 nt_header->FileHeader.NumberOfSections * sizeof (*section)); 334 nt_header->FileHeader.NumberOfSections * sizeof (*section),
335 be_verbose);
331 336
332 /* To improve the efficiency of demand loading, make the file 337 /* To improve the efficiency of demand loading, make the file
333 alignment match the section alignment (VC++ 6.0 does this by 338 alignment match the section alignment (VC++ 6.0 does this by
@@ -351,7 +356,9 @@ copy_executable_and_add_section (file_data *p_infile,
351 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) 356 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
352 { 357 {
353 char msg[100]; 358 char msg[100];
354 sprintf (msg, "Copying raw data for %s...", section->Name); 359 /* Windows section names are fixed 8-char strings, only
360 zero-terminated if the name is shorter than 8 characters. */
361 sprintf (msg, "Copying raw data for %.8s...", section->Name);
355 362
356 /* Update the file-relative offset for this section's raw data (if 363 /* Update the file-relative offset for this section's raw data (if
357 it has any) in case things have been relocated; we will update 364 it has any) in case things have been relocated; we will update
@@ -362,7 +369,7 @@ copy_executable_and_add_section (file_data *p_infile,
362 /* Can always copy the original raw data. */ 369 /* Can always copy the original raw data. */
363 COPY_CHUNK 370 COPY_CHUNK
364 (msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile), 371 (msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile),
365 section->SizeOfRawData); 372 section->SizeOfRawData, be_verbose);
366 373
367 /* Round up the raw data size to the new alignment. */ 374 /* Round up the raw data size to the new alignment. */
368 dst_section->SizeOfRawData = 375 dst_section->SizeOfRawData =
@@ -402,7 +409,7 @@ copy_executable_and_add_section (file_data *p_infile,
402 COPY_CHUNK 409 COPY_CHUNK
403 ("Copying remainder of executable...", 410 ("Copying remainder of executable...",
404 OFFSET_TO_PTR (offset, p_infile), 411 OFFSET_TO_PTR (offset, p_infile),
405 p_infile->size - offset); 412 p_infile->size - offset, be_verbose);
406 413
407 /* Final size for new image. */ 414 /* Final size for new image. */
408 p_outfile->size = DST_TO_OFFSET (); 415 p_outfile->size = DST_TO_OFFSET ();