Сейчас на форуме: igorcauret, Rio (+6 невидимых)

 eXeL@B —› Вопросы новичков —› Руководство Inside Windows Debugging. Не компилируется Hello World
Посл.ответ Сообщение

Ранг: 6.8 (гость), 1thx
Активность: 0.020
Статус: Участник

Создано: 03 марта 2015 16:00 · Поправил: volopas
· Личное сообщение · #1

Ссылка на официальный сайт:
https://www.microsoftpressstore.com/store/inside-windows-debugging-9780735662780
(руководство скачивается урезанное. Полное руководство см.
http://goo.gl/N73ien http://samuel-svn.googlecode.com/svn/trunk/调试器/ )
На стр. xxiii - xxvi описано, как компилировать:
Code:
  1.  Compiling the C/C++ Code Samples
  2.  You can compile the C/C++ code samples from the companion source code using the
  3.  Windows 7 Driver Development Kit (DDK) build tools. The following steps detail this
  4.  process. I strongly recommend that you complete these steps before you start read-
  5.  ing, because you’ll need the code samples to follow the experiments shown later in this
  6.  book.
  7.  
  8.  1. Download the Windows 7 DDK ISO image from the Microsoft Download Center
  9.  at http://www.microsoft.com/download/en/details.aspxid=11800, and save it to
  10.  your local hard drive. Set plenty of time aside for this download if you have a
  11.  slow Internet connection; the DDK ISO file is over 600 MB in size.
  12.  2. After the download is complete, mount the saved ISO file into a drive letter. There
  13.  are several free tools for mounting ISO images on Windows. Virtual Clone Drive,
  14.  which you can find on the Internet, is good freeware that works well both on
  15.  Windows Vista and Windows 7. With that freeware installed, you should be able to
  16.  right-click the ISO file and mount it, as shown in the following screen shot:
  17.  3. Double-click the newly mounted drive to kick off the DDK setup program, as
  18.  shown here:
  19.  
  20.  
  21.  
  22.  
  23.  4. Select the Full Development Environment components from the DDK.
  24.  
  25.  
  26.  
  27.  
  28.  5. Then Install the components to the C:\DDK\7600.16835.1 directory, as shown in
  29.  the following screen shot. This step will take several minutes to complete.
  30.  6. You can now unmount the DDK drive by right-clicking the mounted drive letter
  31.  and selecting the Unmount menu action. This concludes this one-time installa-
  32.  tion of the Windows DDK build tools.
  33.  
  34.  
  35.  
  36.  
  37.  To build x86 binaries, first start a command prompt window and type the
  38.  7. 
  39.  following command:
  40.  
  41.  C:\DDK\7600.16385.1>bin\setenv.bat c:\DDK\7600.16385.1
  42.  
  43.  
  44.  8. You can then build all the native code samples at once. Simply navigate to the
  45.  root directory that you extracted the companion source code to and issue the
  46.  following command. It should take only a minute or so to build all the C/C++
  47.  code from the companion source code:
  48.  
  49.  C:\book\code>bcz
  50.  


Скомпилированная таким макаром прога вылетает с ошибкой:

---------------------------
C:\book\code\chapter_02\HelloWorld\objfre_win7_x86\i386\HelloWorld.exe
---------------------------
C:\book\code\chapter_02\HelloWorld\objfre_win7_x86\i386\HelloWorld.exe не является приложением Win32.


---------------------------
ОК
---------------------------



Ранг: 397.0 (мудрец), 179thx
Активность: 0.170.1
Статус: Участник

Создано: 03 марта 2015 16:23
· Личное сообщение · #2

compiled as x64?

-----
...или ты работаешь хорошо, или ты работаешь много...




Ранг: 6.8 (гость), 1thx
Активность: 0.020
Статус: Участник

Создано: 03 марта 2015 16:44 · Поправил: volopas
· Личное сообщение · #3

Exeinfo PE показывает, что Image is 32bit executable
В ольге не запускается, но PE header нормальный
Code:
  1. 00000000   /4D 5A       ASCII "MZ"           ; DOS EXE Signature
  2. 00000002    9000        DW 0090              ; DOS_PartPag = 90 (144.)
  3. 00000004    0300        DW 0003              ; DOS_PageCnt = 3
  4. 00000006    0000        DW 0000              ; DOS_ReloCnt = 0
  5. 00000008    0400        DW 0004              ; DOS_HdrSize = 4
  6. 0000000A    0000        DW 0000              ; DOS_MinMem = 0
  7. 0000000C    FFFF        DW FFFF              ; DOS_MaxMem = FFFF (65535.)
  8. 0000000E    0000        DW 0000              ; DOS_ReloSS = 0
  9. 00000010    B800        DW 00B8              ; DOS_ExeSP = B8
  10. 00000012    0000        DW 0000              ; DOS_ChkSum = 0
  11. 00000014    0000        DW 0000              ; DOS_ExeIP = 0
  12. 00000016    0000        DW 0000              ; DOS_ReloCS = 0
  13. 00000018    4000        DW 0040              ; DOS_TablOff = 40
  14. 0000001A    0000        DW 0000              ; DOS_Overlay = 0
  15. ...
  16. 000000DF    00          DB 00
  17. 000000E0    50 45 00 00>ASCII "PE"           ; PE signature (PE)
  18. 000000E4    4C01        DW 014C              ; Machine = IMAGE_FILE_MACHINE_I386
  19. 000000E6    0300        DW 0003              ; NumberOfSections = 3
  20. 000000E8    CA7DF554    DD 54F57DCA          ; TimeDateStamp = 54F57DCA
  21. 000000EC    00000000    DD 00000000          ; PointerToSymbolTable = 0
  22. 000000F0    00000000    DD 00000000          ; NumberOfSymbols = 0
  23. 000000F4    E000        DW 00E0              ; SizeOfOptionalHeader = E0 (224.)
  24. 000000F6    0201        DW 0102              ; Characteristics = EXECUTABLE_IMAGE|32BIT_MACHINE
  25. 000000F8    0B01        DW 010B              ; MagicNumber = PE32
  26. 000000FA    09          DB 09                ; MajorLinkerVersion = 9
  27. 000000FB    00          DB 00                ; MinorLinkerVersion = 0
  28. 000000FC    000E0000    DD 00000E00          ; SizeOfCode = E00 (3584.)
  29. 00000100    00060000    DD 00000600          ; SizeOfInitializedData = 600 (1536.)
  30. 00000104    00000000    DD 00000000          ; SizeOfUninitializedData = 0
  31. 00000108    6C140000    DD 0000146C          ; AddressOfEntryPoint = 146C
  32. 0000010C    00100000    DD 00001000          ; BaseOfCode = 1000
  33. 00000110    00200000    DD 00002000          ; BaseOfData = 2000
  34. 00000114    00000001    DD 01000000          ; ImageBase = 1000000
  35. 00000118    00100000    DD 00001000          ; SectionAlignment = 1000
  36. 0000011C    00020000    DD 00000200          ; FileAlignment = 200
  37. 00000120    0600        DW 0006              ; MajorOSVersion = 6
  38. 00000122    0100        DW 0001              ; MinorOSVersion = 1
  39. 00000124    0600        DW 0006              ; MajorImageVersion = 6
  40. 00000126    0100        DW 0001              ; MinorImageVersion = 1
  41. 00000128    0600        DW 0006              ; MajorSubsystemVersion = 6
  42. 0000012A    0000        DW 0000              ; MinorSubsystemVersion = 0
  43. 0000012C    00000000    DD 00000000          ; Reserved
  44. 00000130    00400000    DD 00004000          ; SizeOfImage = 4000 (16384.)
  45. 00000134    00040000    DD 00000400          ; SizeOfHeaders = 400 (1024.)
  46. 00000138    3C110100    DD 0001113C          ; CheckSum = 1113C
  47. 0000013C    0300        DW 0003              ; Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI
  48. 0000013E    4081        DW 8140              ; DLLCharacteristics = 8140
  49. 00000140    00000400    DD 00040000          ; SizeOfStackReserve = 40000 (262144.)
  50. 00000144    00200000    DD 00002000          ; SizeOfStackCommit = 2000 (8192.)
  51. 00000148    00001000    DD 00100000          ; SizeOfHeapReserve = 100000 (1048576.)
  52. 0000014C    00100000    DD 00001000          ; SizeOfHeapCommit = 1000 (4096.)
  53. 00000150    00000000    DD 00000000          ; LoaderFlags = 0
  54. 00000154    10000000    DD 00000010          ; NumberOfRvaAndSizes = 10 (16.)
  55. 00000158    00000000    DD 00000000          ; Export Table address = 0
  56. 0000015C    00000000    DD 00000000          ; Export Table size = 0
  57. 00000160    4C190000    DD 0000194C          ; Import Table address = 194C
  58. 00000164    3C000000    DD 0000003C          ; Import Table size = 3C (60.)
  59. 00000168    00000000    DD 00000000          ; Resource Table address = 0
  60. 0000016C    00000000    DD 00000000          ; Resource Table size = 0
  61. 00000170    00000000    DD 00000000          ; Exception Table address = 0
  62. 00000174    00000000    DD 00000000          ; Exception Table size = 0
  63. 00000178    00000000    DD 00000000          ; Certificate File pointer = 0
  64. 0000017C    00000000    DD 00000000          ; Certificate Table size = 0
  65. 00000180    00300000    DD 00003000          ; Relocation Table address = 3000
  66. 00000184    00010000    DD 00000100          ; Relocation Table size = 100 (256.)
  67. 00000188    A0100000    DD 000010A0          ; Debug Data address = 10A0
  68. 0000018C    1C000000    DD 0000001C          ; Debug Data size = 1C (28.)
  69. 00000190    00000000    DD 00000000          ; Architecture Data address = 0
  70. 00000194    00000000    DD 00000000          ; Architecture Data size = 0
  71. 00000198    00000000    DD 00000000          ; Global Ptr address = 0
  72. 0000019C    00000000    DD 00000000          ; Must be 0
  73. 000001A0    00000000    DD 00000000          ; TLS Table address = 0
  74. 000001A4    00000000    DD 00000000          ; TLS Table size = 0
  75. 000001A8    F8100000    DD 000010F8          ; Load Config Table address = 10F8
  76. 000001AC    40000000    DD 00000040          ; Load Config Table size = 40 (64.)
  77. 000001B0    00000000    DD 00000000          ; Bound Import Table address = 0
  78. 000001B4    00000000    DD 00000000          ; Bound Import Table size = 0
  79. 000001B8    00100000    DD 00001000          ; Import Address Table address = 1000
  80. 000001BC    78000000    DD 00000078          ; Import Address Table size = 78 (120.)
  81. 000001C0    00000000    DD 00000000          ; Delay Import Descriptor address = 0
  82. 000001C4    00000000    DD 00000000          ; Delay Import Descriptor size = 0
  83. 000001C8    00000000    DD 00000000          ; COM+ Runtime Header address = 0
  84. 000001CC    00000000    DD 00000000          ; Import Address Table size = 0
  85. 000001D0    00000000    DD 00000000          ; Reserved
  86. 000001D4    00000000    DD 00000000          ; Reserved
  87. 000001D8    2E 74 65 78>ASCII ".text"        ; SECTION
  88. 000001E0    1A0C0000    DD 00000C1A          ; VirtualSize = C1A (3098.)
  89. 000001E4    00100000    DD 00001000          ; VirtualAddress = 1000
  90. 000001E8    000E0000    DD 00000E00          ; SizeOfRawData = E00 (3584.)
  91. 000001EC    00040000    DD 00000400          ; PointerToRawData = 400
  92. 000001F0    00000000    DD 00000000          ; PointerToRelocations = 0
  93. 000001F4    00000000    DD 00000000          ; PointerToLineNumbers = 0
  94. 000001F8    0000        DW 0000              ; NumberOfRelocations = 0
  95. 000001FA    0000        DW 0000              ; NumberOfLineNumbers = 0
  96. 000001FC    20000060    DD 60000020          ; Characteristics = CODE|EXECUTE|READ
  97. 00000200    2E 64 61 74>ASCII ".data"        ; SECTION
  98. 00000208    78030000    DD 00000378          ; VirtualSize = 378 (888.)
  99. 0000020C    00200000    DD 00002000          ; VirtualAddress = 2000
  100. 00000210    00020000    DD 00000200          ; SizeOfRawData = 200 (512.)
  101. 00000214    00120000    DD 00001200          ; PointerToRawData = 1200
  102. 00000218    00000000    DD 00000000          ; PointerToRelocations = 0
  103. 0000021C    00000000    DD 00000000          ; PointerToLineNumbers = 0
  104. 00000220    0000        DW 0000              ; NumberOfRelocations = 0
  105. 00000222    0000        DW 0000              ; NumberOfLineNumbers = 0
  106. 00000224    400000C0    DD C0000040          ; Characteristics = INITIALIZED_DATA|READ|WRITE
  107. 00000228    2E 72 65 6C>ASCII ".reloc"       ; SECTION
  108. 00000230    72010000    DD 00000172          ; VirtualSize = 172 (370.)
  109. 00000234    00300000    DD 00003000          ; VirtualAddress = 3000
  110. 00000238    00020000    DD 00000200          ; SizeOfRawData = 200 (512.)
  111. 0000023C    00140000    DD 00001400          ; PointerToRawData = 1400
  112. 00000240    00000000    DD 00000000          ; PointerToRelocations = 0
  113. 00000244    00000000    DD 00000000          ; PointerToLineNumbers = 0
  114. 00000248    0000        DW 0000              ; NumberOfRelocations = 0
  115. 0000024A    0000        DW 0000              ; NumberOfLineNumbers = 0
  116. 0000024C    40000042    DD 42000040          ; Characteristics = INITIALIZED_DATA|DISCARDABLE|READ
  117. 00000250    00          DB 00
  118. ...
  119.  
  120.  


Добавлено спустя 14 минут
Ольга не может создать процесс:
00477958 |. E8 73760300 CALL <JMP.&KERNEL32.CreateProcessA> ; \CreateProcessA

Getlasterror=ERROR_BAD_EXE_FORMAT 193 (0xC1) %1 is not a valid Win32 application.




Ранг: 2014.5 (!!!!), 1278thx
Активность: 1.340.25
Статус: Модератор
retired

Создано: 03 марта 2015 17:07
· Личное сообщение · #4

ОС какая?



Ранг: 6.8 (гость), 1thx
Активность: 0.020
Статус: Участник

Создано: 03 марта 2015 17:47
· Личное сообщение · #5

WinXP Pro SP3



Ранг: 51.8 (постоянный), 58thx
Активность: 0.03=0.03
Статус: Участник

Создано: 03 марта 2015 19:38
· Личное сообщение · #6

В заголовке 6-ая версия ОС, на XP не запустится.




Ранг: 1053.6 (!!!!), 1078thx
Активность: 1.060.81
Статус: Участник

Создано: 03 марта 2015 19:46
· Личное сообщение · #7

volopas пишет:
objfre_win7_x86

под 7 собрано же


 eXeL@B —› Вопросы новичков —› Руководство Inside Windows Debugging. Не компилируется Hello World
:: Ваш ответ
Жирный  Курсив  Подчеркнутый  Перечеркнутый  {mpf5}  Код  Вставить ссылку 
:s1: :s2: :s3: :s4: :s5: :s6: :s7: :s8: :s9: :s10: :s11: :s12: :s13: :s14: :s15: :s16:


Максимальный размер аттача: 500KB.
Ваш логин: german1505 » Выход » ЛС
   Для печати Для печати