1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* DOS dumping utility
*
* Copyright 2006 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <time.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <fcntl.h>
#include "windef.h"
#include "winbase.h"
#include "winedump.h"
void dos_dump(void)
{
const IMAGE_DOS_HEADER* dh;
if ((dh = PRD(0, sizeof(IMAGE_DOS_HEADER))))
{
printf("DOS image:\n");
printf(" Signature: %.2s\n", (const char*)&dh->e_magic);
printf(" Bytes on last page: %u\n", dh->e_cblp);
printf(" Number of pages: %u\n", dh->e_cp);
printf(" Relocations: %u\n", dh->e_crlc);
printf(" Size of header: %u\n", dh->e_cparhdr);
printf(" Min extra paragraphs: %u\n", dh->e_minalloc);
printf(" Max extra paragraphs: %u\n", dh->e_maxalloc);
printf(" Initial stack: %x:%x\n", dh->e_ss, dh->e_sp);
printf(" Checksum: %x\n", dh->e_csum);
printf(" Initial address: %x:%x\n", dh->e_cs, dh->e_ip);
printf(" Relocation (file): %u\n", dh->e_lfarlc);
printf(" Overlay number: %u\n", dh->e_ovno);
printf(" OEM id(info): %x(%x)\n", dh->e_oemid, dh->e_oeminfo);
printf(" Offset to ext header: %x\n", dh->e_lfanew);
}
}