pkunzip -p win_peb.zip c:\djgpp(The good idea is to read this document up to end beforhand)
c:\>mkdir c:\lib_temp c:\>cd c:\lib_temp c:\lib_temp>dll2a.exe user32.dll c:\lib_temp>ren user32.a c:\djgpp\lib\libuser.aYou can use next makefile and generate all automaticaly with DJGPP GNU MAKE.
#begin of 'makefile' LIBDIR=$(DJDIR)/LIB/ DLLDIR=$(WINDIR)/SYSTEM/ # For Windows NT or 2000 DLLDIR must by DLLDIR=$(WINDIR)/SYSTEM32/ # WINDIR -- predefined Windows enviroment variable # DJDIR -- DJGPP enviroment variable, must be defined in DJGPP.ENV lib: libuser.a libuser.a libkern.a libgdi.a libshell.a libwadv.a lwinmm.a lwinmm.a lcdlg.a libuser.a: user32.dll dll2s.exe -o $@ $< libkern.a: %(DLLDIR)kernel32.dll dll2s.exe -o $(LIBDIR)$@ $< libgdi.a: %(DLLDIR)gdi32.dll dll2s.exe -o $(LIBDIR)$@ $< libshell.a: %(DLLDIR)shell32.dll dll2s.exe -o $(LIBDIR)$@ $< libwadv.a: %(DLLDIR)advapi32.dll dll2s.exe -o $(LIBDIR)$@ $< libwinmm.a: %(DLLDIR)winmm.dll dll2s.exe -o $(LIBDIR)$@ $< libcdlg.a: %(DLLDIR)comdlg32.dll dll2s.exe -o $(LIBDIR)$@ $< libwsock.a: %(DLLDIR)wsock32.dll dll2s.exe -o $(LIBDIR)$@ $< #end of 'makefile'It borrows some time, because for each function in each library assembler file will be created, exec "as.exe" and exec "ar.exe". Up to ten minuit per library for big library and slow machin.
inline void PUSH(int a){ asm volatile("pushl %0;": :"g" (a) );}; inline void PUSH(void* a){ asm volatile("pushl %0;": :"g" (a) );}; #define API1(f,a) ( PUSH(a),f()) #define API2(f,a1,a2) ( PUSH(a2),PUSH(a1),f()) ...And you can call to API e.g. this way:
#include "gw_api.h" extern "C" { #include <user32.h> #include <kernel32.h> }; ... API4( MessageBox, 0, &"Hello world !",&"Test", 0);Warning! In this case you must use optimisation (keys -O1, -O2, -O#), otherwise GNU compiller generate inline function as no inline, and PUSH failure. In this case you can use #define instead inline. This might be use only with GNU 2.8x or older.
make_pe [-c][-s Stack_Reserve_Size][-p Heap_Reserve_Size][-o out_file] input_fileNext option's keys supported:
Table of Contents | | Home page | | License |