News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

masm32 library sources.. user32.lib,comctl.lib

Started by randomnumber, September 16, 2009, 09:42:43 PM

Previous topic - Next topic

randomnumber

av been recently introduced to asm programming an loving ery line of it.. i like the short single lines :cheekygreen:.. straight to the point.. :U

is there any sources for the files in the lib\ directory like user32.lib,comctl.lib? i wan't to know wat exactly the fuctions defined in use32.inc and comctl.inc are doing.. can one decompile it? if so? wat tool can i use? and how will i tell one procedure from another?

Vortex

Hi randomnumber,

Welcome to the forum.

user32.lib and comctl32.lib are import libraries. During the linking of object modules, import libraries informs the linker about the association of the API functions and DLLs. An example : if your source code uses the ExitProcess function ( which is exported by kernel32.dll ) you specify kernel32.lib in your code and the linker will know that ExitProcess is exported by kernel32.dll.

Normally, the linker creates an import library if you build a DLL file. Linkers and other tools can create import libraries if you supply the correct information about DLLs.

Creating kernel32.lib from kernel32.def, the module definition file which is the list of exported functions :


LIBRARY kernel32
EXPORTS
"_ActivateActCtx@8"
"_AddAtomA@4"
"_AddAtomW@4"
"_AddConsoleAliasA@12"
"_AddConsoleAliasW@12"
.
.
.


Building the import library withe Pelle's library manager Polib.exe :

\masm32\bin\polib.exe /OUT:kernel32.lib /DEF:kernel32.def /MACHINE:IX86

You can also create the import library with my def2lib tool :

def2lib.exe kernel32.def

To analyse the contents of an import library , you can use dumpbin.exe  or podump.exe :

\masm32\bin\dumpbin.exe /ALL kernel32.lib >kernel32_dump.txt

A very nice tool coded by WJR is peview to analyze MS COFF object files and libraries :

http://www.magma.ca/~wjr/

randomnumber

oh.. so the kernel32.lib, comctl32.lib don't contain the actual code for the procedures?.. i wanted to see the code defined in the procedures contained in the include files.. that would make me understand properly what is going on. is there somewhere i can get the source code for the code procedures defined in user32.inc,comctl32.inc and the rest?

hutch--

To see the code you are after you need to disassemble the original OS DLLs and depending on the jurisdiction you live in may be legal or not. You are usually OK if you are not trying to modify them but be warned they are very complicated internally so while you can learn useful things from them, its no joy to do if you are not experienced in reading very large amounts of disassembled code.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ecube

randomnumber you can also optionally dynamically load dll's and then call the procedures, but just linking in is the easiest, as you can use invoke with masm on them. If you're curious as to what functions are in what dll's you can get a program like pe explorer and look at the exports, but that's pretty silly. its better just to use msdn to look up functions, what they do, and it'll tell you what OS's support em and what dll's they're in, for instance

http://msdn.microsoft.com/en-us/library/ms682658%28VS.85%29.aspx

Minimum supported client   Windows 2000 Professional
Minimum supported server   Windows 2000 Server
Header   Winbase.h (include Windows.h)
Library   Kernel32.lib
DLL   Kernel32.dll

you can ignore the header, instead you use a include file which should always be the libs name e.g for this one is


include c:\masm32\include\kernel32.inc

and

includelib c:\masm32\lib\kernel32.lib

randomnumber

thanks hutch-- and e**3 ...
     din;t know it cud b illegal but then agen.. its windows..  :tdown. i thus will not say that i have... but i have made progress with ida pro.. he he he hh.. alot of functions i myte say close to 2000 lines.. dynamic libraries as are called. i am rili getting up to speed with the windows api..

question.. is it possible to send a window message from one computer window to another window in a different computer?

Vortex

Quotequestion.. is it possible to send a window message from one computer window to another window in a different computer?

That's not an easy task. You have to deal with the networking API.