barbh@hp-ptp.HP.COM (Barbara Holden) (05/04/90)
I need to replace some of the standard functions in PMWIN.DLL with some handtailored ones of my own. Is there any other way of doing besides generating a new PMWIN.DLL that contains stub calls to the "real" PMWIN.DLL (renamed) for all non-tailored functions? Is the above even feasible? Comments, advice are eagerly solicited. Thanks alot!
dbaum@camilla.East.Sun.COM (Derek Baum - Sun PC Distributed Systems) (05/04/90)
In article <6860001@hp-ptp.HP.COM> barbh@hp-ptp.HP.COM (Barbara Holden) writes: >I need to replace some of the standard functions in PMWIN.DLL with some >handtailored ones of my own. Is there any other way of doing besides >generating a new PMWIN.DLL that contains stub calls to the "real" >PMWIN.DLL (renamed) for all non-tailored functions? >Is the above even feasible? > >Comments, advice are eagerly solicited. Thanks alot! It is indeed feasible to generate a new PMWIN.DLL as you suggest (I've done it for PMGPI.DLL), but there are a number of problems: problem #1: is due to the number of exports: on OS|2 1.2 PMWIN.DLL exports 311 functions! If you only wanted to tailor one function you would have to write stubs for the remaining 310! problem #2: is that the real PMWIN.DLL cannot simply be renamed, since it has its module name embedded in its newexe header. problem #3: is that some of the exports are not documented: on OS|2 1.2 PMWIN.DLL exports 25 undocumented functions, for example: GETSCREENSELECTOR, FARCALLHOOK, STARTTIMER, ABNORMALPROCESSEXIT. It is difficult to create stubs for undocumented functions. I have managed to automate the process for creating such stub DLLs, since I needed to obtain trace information from undocumented DLL functions. solution #1: generate stubs automatically solution #2: use objexit.exe, a sed look-alike for binary files. solution #3: stubs pass 32 words of parameters to undocumented functions and then clean unused parameters from the stack The mechanics work as follows: dxgen c:\os2\dll\pmwin.dll # creates pmwin.def, pmwin.c, pmwin.mk pmwin.c can be edited to set the actual number of parameters and trace format for known functions. make pmwin.mk # copies real pmwin.dll to p_win.dll and edits internal module name # builds stub pmwin.dll which traces parameters and then calls p_win.dll # pmwin.c can be edited to remove the functions that require special # tailoring. -- Derek Baum consulting at: Sun Microsystems Internet: dbaum@East.Sun.COM (508)671-0456 UUCP: ...!sun!suneast!dbaum