Author Topic: Msvcrt.inc Could Use _getwch PROTO  (Read 4063 times)

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Msvcrt.inc Could Use _getwch PROTO
« on: May 19, 2014, 10:30:00 PM »
"crt__getwch" would be nice in future versions for __UNICODE__ builds   :t

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1209
Re: Msvcrt.inc Could Use _getwch PROTO
« Reply #1 on: May 20, 2014, 02:11:19 AM »
Beyond no PROTO, there is no _getwch import in the MASM32 msvcrt.lib import library. The attachment contains all of the components I used to create an import library from the MSVCRT.DLL in the SYSTEM32 directory on my Windows XP SP3 system. Unless you have MinGW with pexports.exe installed you will not be able to use makedef.bat, so you’ll be stuck with the module-definition file I included. Note that I modified the file by removing a number of imports, that had what looked like C++ mangled names, between $I10_OUTPUT and _Ciacos, because the original MASM32 import library did not include these. The import library I created is 130KB versus 449KB for the original MASM32 import library. I’m not sure why this is, but the one I created appears to work fine. I tried to compare the two import libraries by using POLIB to extract a module-definition file from the import library, and while this works fine for the one I created it will not work for the MASM32 import library.


Well Microsoft, here’s another nice mess you’ve gotten us into.

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: Msvcrt.inc Could Use _getwch PROTO
« Reply #2 on: May 20, 2014, 03:05:34 AM »
thanks Michael - i made one using Erol's tools   :P
it can also be dynamically linked with GetProcAddress, i suppose

EDIT: i mentioned the size thing to Erol some time ago
he said that his tools use a "compact" format, or something to that effect
and that Hutch's method uses an "extended" format
so, it's not an error

Vortex

  • Member
  • *****
  • Posts: 2454
Re: Msvcrt.inc Could Use _getwch PROTO
« Reply #3 on: May 20, 2014, 03:33:04 AM »
The size difference can be explained with the long \ short library formats :

Code: [Select]
In an import library with the long format, a single member contains the following information:
Archive member header
File header
Section headers
Data that corresponds to each of the section headers
COFF symbol table
Strings
In contrast, a short import library is written as follows:
Archive member header
Import header
Null-terminated import name string
Null-terminated DLL name string

This is sufficient information to accurately reconstruct the entire contents of the member at the time of its use.

Source  : Microsoft PE and COFF Specification

http://msdn.microsoft.com/en-us/library/gg463119.aspx

pecoff_v83.docx , page 97

My def2lib tool is using the short library format.