News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Create lib files from system dlls

Started by Mikl__, April 26, 2017, 12:00:14 PM

Previous topic - Next topic

Mikl__

Hi, all!
I needed to create files from system dll files. I wrote a bat-file\masm64\bin\dumpbin /nologo /exports user32.dll > user32.txtor if there is no dumpbin.exe file\masm64\bin\link /dump /nologo /exports user32.dll > user32.txtThis is the contents of the user32.txt fileDump of file user32.dll
File Type: DLL
  Section contains the following exports for USER32.dll
    00000000 characteristics
    4CE799CD time date stamp Sat Nov 20 17:50:05 2010
        0.00 version
        1500 ordinal base
        1003 number of functions
         830 number of names

    ordinal hint RVA      name

       1502    0 000083C0 ActivateKeyboardLayout
       1503    1 0002AD40 AddClipboardFormatListener
       1504    2 000235B8 AdjustWindowRect
       1505    3 00017CE4 AdjustWindowRectEx
       1506    4 0007F30C AlignRects
       1507    5 00042164 AllowForegroundActivation
       1508    6 00007D80 AllowSetForegroundWindow
       1509    7 0001BFF0 AnimateWindow
       1510    8 0007A810 AnyPopup
       . . .
I deleted linesDump of file user32.dll
File Type: DLL
  Section contains the following exports for USER32.dll
    00000000 characteristics
    4CE799CD time date stamp Sat Nov 20 17:50:05 2010
        0.00 version
        1500 ordinal base
        1003 number of functions
         830 number of names
    ordinal hint RVA      name
and lines       1500      0002B260 [NONAME]
       1501      0002AE80 [NONAME]
       1550      00076598 [NONAME]
       1551      00076640 [NONAME]
       1552      00076600 [NONAME]
       1553      00023D2C [NONAME]
       1554      00023DF8 [NONAME]
       1555      00076668 [NONAME]
       1556      00076698 [NONAME]
       2000      00006B80 [NONAME]
       2001      0006E738 [NONAME]
       2002      00023E78 [NONAME]
       2005      00003F00 [NONAME]
       2500      000405D0 [NONAME]
       2501      000405F4 [NONAME]
       2502      0004062C [NONAME]
  Summary
        2000 .data
        A000 .pdata
       10000 .rdata
        1000 .reloc
       5B000 .rsrc
       81000 .text
I wrote a bat-file that created def-file@echo off
set filename=user32
set OUTPUT=%filename%.def

if "%STDOUT_REDIRECTED%" == "" (
    set STDOUT_REDIRECTED=yes
    cmd.exe /c %0 %* >%OUTPUT%
    exit /b %ERRORLEVEL%
)
echo EXPORTS
for /f "tokens=1-4" %%A in (%filename%.txt) do (
echo %%D       @%%A
)
and I wrote a bat-file that created lib-fileset filename=user32
\masm64\bin\lib /def:%filename%.def /out:%filename%.lib /machine:x64
or if there is no lib.exe file \masm64\bin\link -lib /def:%filename%.def /out:%filename%.lib /machine:x64It is all right, but there are funtions imported from NTDLL.dll in user32.dll
  • DefDlgProcA forwarded to NTDLL.NtdllDialogWndProc_A
  • DefDlgProcW forwarded to NTDLL.NtdllDialogWndProc_W
  • DefWindowProcA forwarded to NTDLL.NtdllDefWindowProc_A
  • DefWindowProcW forwarded to NTDLL.NtdllDefWindowProc_W
How to correctly insert these functions into the file user32.def?

hutch--

Mikl__, get Pelle's tools as they have the right bits to do what you want.

Mikl__

Hi, hutch--!
Thanks for the advice! Will the polib work with 64-bit code?

TWell


Mikl__