<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx</link><description>Starting off with the wrong tool.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3390041</link><pubDate>Mon, 18 Jun 2007 23:17:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3390041</guid><dc:creator>Yaniv Pessach</dc:creator><description>&lt;p&gt;I agree with Raymond that the product teams (and Raymond in particular) should not have to explain how to make a specific API call from (a possibly very long) list of programming languages. That’s a bit backwards.&lt;/p&gt;
&lt;p&gt;I also agree that rundll32.dll is overused, and often mis-used.&lt;/p&gt;
&lt;p&gt;However, there seems to be a real need to easily make an API call without having to write the 15-lines programs that makes such a call. &amp;nbsp;Even I, as a developer, encounter this mental barrier that &amp;nbsp;‘writing a whole program to…’ takes too much time/attention.&lt;/p&gt;
&lt;p&gt;To deal with this apparent need, I took some time this weekend to write a simple program to execute an arbitrary DLL method call with arbitrary parameters from the command-line. &amp;nbsp;For example, execute &lt;/p&gt;
&lt;p&gt;&amp;gt;RunAnyDLL user32.dll MessageBoxA UINT 0 LPSTR Welcome LPSTR goodbye UINT 1&lt;/p&gt;
&lt;p&gt;A v0.1 version of this tool is available on tool available on &lt;a rel="nofollow" target="_new" href="http://www.yanivpessach.com/shared/runanydll/"&gt;http://www.yanivpessach.com/shared/runanydll/&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;The current version uses .NET (it emits a module using the .NET interop), but I may rewrite it to use straight C/++. Feedback most welcome.&lt;/p&gt;
&lt;p&gt;// Yaniv Pessach&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3390041" width="1" height="1"&gt;</description></item><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3242076</link><pubDate>Tue, 12 Jun 2007 10:33:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3242076</guid><dc:creator>andreister</dc:creator><description>
&lt;p&gt;OK, I've come across one post from Raymond (&lt;a href="http://blogs.msdn.com/oldnewthing/archive/2004/01/15/58973.aspx" rel="nofollow" target="_new"&gt;http://blogs.msdn.com/oldnewthing/archive/2004/01/15/58973.aspx&lt;/a&gt;) about calling convention and rundll. I'm assuming calling SHExitWindowsEx via rundll would also fail because SHExitWindowsEx is merely a wrapper on ExitWindowsEx. &lt;/p&gt;

&lt;p&gt;Then, if yes, it looks like this Microsoft article (&lt;a href="http://support.microsoft.com/?kbid=234216" rel="nofollow" target="_new"&gt;http://support.microsoft.com/?kbid=234216&lt;/a&gt;) about shutdown on Win98 is not valid, right? It suggests using "rundll32.exe shell32.dll,SHExitWindowsEx X" to restart Windows 98/Me automatically.&lt;/p&gt;

&lt;p&gt;Or back in time of Win98, ExitWindowsEx had a different signature?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;/p&gt;

&lt;p&gt;Andrew&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;&lt;a href="http://blogs.msdn.com/oldnewthing/archive/2006/04/24/582152.aspx"&gt;I already discussed this&lt;/a&gt;. Most KB articles are not reviewed by the product team; it's just a bunch of product support people helping each other out. Maybe their advice is good, maybe not. -Raymond&lt;/i&gt;]&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3242076" width="1" height="1"&gt;</description></item><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3233496</link><pubDate>Mon, 11 Jun 2007 21:20:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3233496</guid><dc:creator>Phil Wilson</dc:creator><description>&lt;p&gt;Usin Win32_PointingDevice in a WMI script that sets DoubleSpeedThreshold or QuadSpeedThreshold is all it takes to solve the mouse problem, same principle as DC's PowerState script. You can do some serious stuff with WMI and VBScript. &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3233496" width="1" height="1"&gt;</description></item><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3233467</link><pubDate>Mon, 11 Jun 2007 21:18:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3233467</guid><dc:creator>pc486</dc:creator><description>&lt;P&gt;I cannot accept an answer of "write it in &amp;lt;lower-level language X&amp;gt;," even if it's just a small executable that makes one or two calls. Let me first say that I don't use Windows as a platform for anything, work or home (but I do enjoy this and other Microsoft blogs). There may be something I'm missing here with the way Windows does its job. That said, I fully understand a developers feelings of wanting to (maybe forced too) script in something higher level. I write scripts all the time in evil bourne/bash to ugly Perl to any one of my own domain specific languages (translation: Lisp). I can get more done in 10 lines of script than a C++ or C# program can in 500. The act of starting a new project/directory+makefile just to make some syscall or low-level call is a significant developer performance hit as well as a maintenance problem.&lt;/P&gt;
&lt;P&gt;OK, now down to problem solving. Others have pointed out rundll, but Raymond shot that down by showing that it cannot create arbitrary calls. It is possible to create arbitrary calls out of some languages with tools like SWIG (&lt;A href="http://www.swig.org/" target=_new rel=nofollow&gt;http://www.swig.org/&lt;/A&gt;) or Lisp's Common Foreign Function Interface (&lt;A href="http://common-lisp.net/project/cffi/" target=_new rel=nofollow&gt;http://common-lisp.net/project/cffi/&lt;/A&gt;). But what about a SWIG/CFFI like command-line tool that can be passed a symbol and the symbol signature to make the call? In other words, is there a "correct" rundll?&lt;/P&gt;
&lt;P&gt;- Tristan&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;It's not "write it in &amp;lt;lower-level language&amp;gt;. It's "At the end of the day, it's a call in the designated target language. You'll need to bridge the gap." Maybe there's a "p/invoke"-like way of doing it, maybe somebody else bridged it for you. -Raymond&lt;/I&gt;]&lt;/DIV&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3233467" width="1" height="1"&gt;</description></item><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3224305</link><pubDate>Mon, 11 Jun 2007 11:12:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3224305</guid><dc:creator>ExOrPhine</dc:creator><description>&lt;p&gt;This worked for me pretty well:&lt;/p&gt;
&lt;p&gt;1. Connect the potato and the tire with a usual tube&lt;/p&gt;
&lt;p&gt;2. Deflate the potato and concurrently inflate the tire&lt;/p&gt;
&lt;p&gt;3. If it doesn't work - reiterate&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3224305" width="1" height="1"&gt;</description></item><item><title>Free win32 compilers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3205369</link><pubDate>Sun, 10 Jun 2007 16:32:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3205369</guid><dc:creator>Craig Ringer</dc:creator><description>&lt;p&gt;@coditza&lt;/p&gt;
&lt;p&gt;Download the Visual C++ Express Edition. It's not hard, and provides a rather good tool. The only thing I've really been bugged by the lack of so far is a profiler, and that might just be my inability to find it.&lt;/p&gt;
&lt;p&gt;I build cross platform software so I use MinGW (gcc for Windows), the VC++ Express Edition (which also includes a command line cl.exe), and gcc on Linux &amp;amp; Mac OS X quite a lot. Do you know how much I paid for any of those? $0.&lt;/p&gt;
&lt;p&gt;Some years ago I too used to be annoyed by the lack of a quality free compiler on win32. Especially when it came to C++. Thankfully it's just not an issue anymore.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3205369" width="1" height="1"&gt;</description></item><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3169050</link><pubDate>Sat, 09 Jun 2007 00:17:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3169050</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Would people actually be willing to USE a bigger, badder rundll32? Something that checks ESP after the call and puts up a big error box in case of mismatch? Would they agree to use a syntax like the below? [argv0 being a placeholder name, of course.]&lt;/p&gt;
&lt;p&gt;argv0 kernel32.dll SetSystemPowerState b=bb true true&lt;/p&gt;
&lt;p&gt;argv0 user32.dll GetSystemMetrics i=u 76 &amp;gt;&amp;gt; sm_cxscreen.txt&lt;/p&gt;
&lt;p&gt;argv0 /CDECL /GETLASTERROR somedll.dll _cfunc v=ii 42 999&lt;/p&gt;
&lt;p&gt;(Or, as is more likely, someone trying to start a screensaver the not-quite-right way...)&lt;/p&gt;
&lt;p&gt;argv0 user32.dll SendMessageA u=puup $fgwnd 0x0112 0xF140 0&lt;/p&gt;
&lt;p&gt;Because, you see, I've got some code already written along those lines. If people are interested I suppose I could clean it up for external release.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3169050" width="1" height="1"&gt;</description></item><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3165896</link><pubDate>Fri, 08 Jun 2007 20:05:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3165896</guid><dc:creator>Mihai</dc:creator><description>&lt;p&gt;If you want to do Windows development without installing a compiler (and all the headers), you can always use debug.&lt;/p&gt;
&lt;p&gt;It's been there since early MS-DOS.&lt;/p&gt;
&lt;p&gt;Ok, it is not a compiler, but it is enough to call the one or two Win32 APIs required.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3165896" width="1" height="1"&gt;</description></item><item><title>re: How do I inflate a bicycle tire with a potato?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3163955</link><pubDate>Fri, 08 Jun 2007 18:07:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3163955</guid><dc:creator>name required</dc:creator><description>&lt;p&gt;Wang - I had a slightly longer term version which involved fermenting the potatoes, I'm sure they give off gas under such circumstances*. Of course, there would be certain beneficial side-effects with my version of the &amp;quot;code&amp;quot;. Warning: can cause the ocular system to crash.&lt;/p&gt;
&lt;p&gt;* Caveat: I am not a bootlegger†&lt;/p&gt;
&lt;p&gt;† RIP &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3163955" width="1" height="1"&gt;</description></item><item><title>Don't get fixated</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2007/06/07/3128210.aspx#3161116</link><pubDate>Fri, 08 Jun 2007 15:39:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3161116</guid><dc:creator>James Risto</dc:creator><description>&lt;p&gt;My take-away on this is to not get too particularly fixated on one tool. The command line is extensible via a lot of things ... sometimes, you have to use C. A one page C program can save a lot of tears from somewhere else.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3161116" width="1" height="1"&gt;</description></item></channel></rss>