<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Hi Juan, <br></span></div><div><br><span></span></div><div><span>Thanks for replying.  I am looking at that tool's directory and I'm not sure how to use it.  There is little documentation on the sources and a google search didn't provide much help.  No matter what directory I run the executables found there, they all give me this error. Is there any documentation on how to use these tools and what is their purpose?<br></span></div><div><br><span></span></div><div><span>~/sandbox/wine/sources/wine-1.3.36$ ~/sandbox/wine/sources/wine-1.3.36/tools/winapi/winapi_extract <br>winapi_extract: You must run this tool in the main Wine directory or a sub directory<br><br></span></div><div>Thanks</div><div>Roger R. Cruz</div><div><br></div>  <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"> <div
 style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Juan Lang <juan.lang@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Roger Cruz <roger_r_cruz@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> "wine-devel@winehq.org" <wine-devel@winehq.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, April 2, 2012 3:45 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: Programmatically determining arguments to a WinAPI function<br> </font> </div> <br>
Hi Roger,<br><br>On Mon, Apr 2, 2012 at 10:41 AM, Roger Cruz <<a ymailto="mailto:roger_r_cruz@yahoo.com" href="mailto:roger_r_cruz@yahoo.com">roger_r_cruz@yahoo.com</a>> wrote:<br>> I'm looking for a way to determine programmatically what the arguments to a<br>> Win32 API implemented in Wine are.  I'm trying to implement an API<br>> redirection stub that I can use to trace calls into all of the<br>> Wine-implemented DLLs.  My stub needs to know what each argument passed into<br>> the Win32 API, their types and sizes, and whether they reside on the stack<br>> or register when calling the routine and finally their return value.<br><br>I think you want to look at winapi<br>(http://source.winehq.org/source/tools/winapi/).<br><br>> In researching Wine, I have come to find out two tools, winedump and<br>> winebuild that may be helpful in doing this but I have yet to find out how<br>> to use them correctly to get the
 information  I seek.  Maybe they just don't<br>> have that capability or maybe I just haven't played with them enough to find<br>> all of its uses.<br>><br>> For example, I found that each DLL has a *.spec file which looks to have<br>> some of the info I need:<br>><br>> @ stdcall GetSystemTimeAsFileTime(ptr)<br>><br>> Looking at the man pages, this tells me that GetSystemTimeAsFileTime takes<br>> in an argument as a pointer but I don't see any return value information<br>> here.  Also, does this file ever represent arguments passed by value on the<br>> stack, like a structure?  If so, does it capture how big the structure is?<br>> What about function prototypes with variable arguments (similar to<br>> printf(...)).. are those capture in the file?  Can I also assume (based on<br>> the calling convention listed as stdcall) which arguments will be on<br>> registers and which will be
 on the stack?<br><br>Yes.  stdcall, cdecl, and fastcall are all documented as to their<br>calling convention.  In particular, stdcall and cdecl both accept all<br>arguments on the stack and return through EAX.  (They differ in who<br>pops arguments from the stack.)  This is basic Win32 stuff, any<br>Windows reference in the last 25+ years ought to tell you it.<br>fastcall is more recent, but they're all up on Wikipedia:<br>http://en.wikipedia.org/wiki/X86_calling_conventions<br><br>--Juan<br><br><br> </div> </div>  </div></body></html>