<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>swigger's BLOG &#187; 开发</title>
	<atom:link href="http://www.swigger.net/archives/category/dev/feed" rel="self" type="application/rss+xml" />
	<link>http://www.swigger.net</link>
	<description>醉卧沙场君莫笑 古来征战几人回</description>
	<lastBuildDate>Wed, 11 Aug 2010 17:08:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>在Debian Linux下编译第一个objc程序</title>
		<link>http://www.swigger.net/archives/202.html</link>
		<comments>http://www.swigger.net/archives/202.html#comments</comments>
		<pubDate>Wed, 11 Aug 2010 17:08:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=202</guid>
		<description><![CDATA[  首先，我们要安装相应的程序： apt-get install gcc gobjc gcc g++ gnustep libgnustep-gui-dev 然后编写一个hello.m文件： 连hello.m都是抄来的，哈哈，程序如下： #import &#60;Foundation/Foundation.h&#62; @interface HelloWorld : NSObject - (void) hello; @end @implementation HelloWorld - (void) hello { NSLog(@&#8221;hello world!&#8221;); } @end int main(void) { HelloWorld *hw = [[HelloWorld alloc] init]; [hw hello]; [hw release]; } 然后就是编译了： 编译成.o文件： gcc -fconstant-string-class=NSConstantString -I /usr/include/GNUstep/ -c hello.m 链接： [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<h1>首先，我们要安装相应的程序：</h1>
<p>apt-get install gcc gobjc gcc g++ gnustep libgnustep-gui-dev</p>
<h1>然后编写一个hello.m文件：</h1>
<p>连hello.m都是抄来的，哈哈，程序如下：</p>
<p>#import &lt;Foundation/Foundation.h&gt;</p>
<p>@interface HelloWorld : NSObject</p>
<p>- (void) hello;</p>
<p>@end</p>
<p>@implementation HelloWorld</p>
<p>- (void) hello {</p>
<p>NSLog(@&#8221;hello world!&#8221;);</p>
<p>}</p>
<p>@end</p>
<p>int main(void) {</p>
<p>HelloWorld *hw = [[HelloWorld alloc] init];</p>
<p>[hw hello];</p>
<p>[hw release];</p>
<p>}</p>
<h1>然后就是编译了：</h1>
<p>编译成.o文件：</p>
<p>gcc -fconstant-string-class=NSConstantString -I /usr/include/GNUstep/ -c hello.m</p>
<p>链接：</p>
<p>gcc hello.o -o hello -lgnustep-base</p>
<h1>一些方便的设置：</h1>
<p>在bashrc中添加一条：</p>
<p>alias objcc=’gcc -fconstant-string-class=NSConstantString -I /usr/include/GNUstep/ -lgnustep-base’</p>
<p>以上命令就简化啦：</p>
<p>objcc –o hello hello.m</p>
<h1>运行：</h1>
<p>$ ./hello</p>
<p>2010-08-12 01:03:23.930 hello[1642] hello world!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/202.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用vs2010自带工具制作文件证书</title>
		<link>http://www.swigger.net/archives/193.html</link>
		<comments>http://www.swigger.net/archives/193.html#comments</comments>
		<pubDate>Sat, 08 May 2010 11:44:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=193</guid>
		<description><![CDATA[以便给自己的程序签名，呵呵。 当然，这样签 发的程序在别人那是不被信任的。除非把自己的根证书给别人安装。 用命令行，使用如下命令： makecert  -pe -ss swigger -n &#8220;CN=swigger.net&#8221; -sv swigger_root.pvk -r swigger_root.cer 这里会弹出框要求密码，输入密码 root_pwd 或其它密码。共输入3次，前两次设置，后一次验证。 makecert -is swigger -n &#8220;CN=swigger file sign&#8221; -$ commercial -ic swigger_root.cer -sv fs.pvk fs.cer 这里继续弹出要密码，设置为 pwd2 或其它密码。共输入三次，两次设置，一次确认。还会弹出第四次要密码，要输入上一步设置的密码 root_pwd （或其它值）。 cert2spc fs.cer fs.spc 以下两条命令的pwd2是第二步设置的密码，如果不是pwd2，要换成其它值。 pvk2pfx -pvk fs.pvk -pi pwd2 -spc fs.spc -pfx fs.pfx -f signtool sign /t http://timestamp.verisign.com/scripts/timstamp.dll  /v  [...]]]></description>
			<content:encoded><![CDATA[<p>以便给自己的程序签名，呵呵。</p>
<p>当然，这样签 发的程序在别人那是不被信任的。除非把自己的根证书给别人安装。</p>
<p>用命令行，使用如下命令：</p>
<p>makecert  -pe -ss swigger -n &#8220;CN=swigger.net&#8221; -sv swigger_root.pvk -r swigger_root.cer</p>
<p>这里会弹出框要求密码，输入密码 root_pwd 或其它密码。共输入3次，前两次设置，后一次验证。</p>
<p>makecert -is swigger -n &#8220;CN=swigger file sign&#8221; -$ commercial -ic swigger_root.cer -sv fs.pvk fs.cer</p>
<p>这里继续弹出要密码，设置为 pwd2 或其它密码。共输入三次，两次设置，一次确认。还会弹出第四次要密码，要输入上一步设置的密码 root_pwd （或其它值）。</p>
<p>cert2spc fs.cer fs.spc</p>
<p>以下两条命令的pwd2是第二步设置的密码，如果不是pwd2，要换成其它值。</p>
<p>pvk2pfx -pvk fs.pvk -pi pwd2 -spc fs.spc -pfx fs.pfx -f</p>
<p>signtool sign /t <a href="http://timestamp.verisign.com/scripts/timstamp.dll">http://timestamp.verisign.com/scripts/timstamp.dll</a>  /v  /f fs.pfx /p pwd2  filename.exe</p>
<p>签名完成后，把swigger_root.cer安装到受信用的根证书，就显示文件正常签名了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/193.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为android 生成 native 程序</title>
		<link>http://www.swigger.net/archives/181.html</link>
		<comments>http://www.swigger.net/archives/181.html#comments</comments>
		<pubDate>Sun, 11 Apr 2010 10:02:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=181</guid>
		<description><![CDATA[  为android生成原生应用程序，不难啊。 初始条件：安装android的ndk，比如目前最新的 android-ndk-r3。(2010-03版) 我的目录结构： ~/android-ndk-r3 ~/android-ndk-r3/temp  这个是当前工作目录。 Step1: 写两个文件： hello.c： #include &#60;stdio.h&#62; int main() {     printf(&#34;hello, world\n&#34;);     return 0; } start.c #include &#60;stdlib.h&#62; extern int main(int argc, char **argv); void _start(int argc, char **argv) {     exit (main (argc, argv)); } Step2: compile ../build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-gcc \ -I ../build/platforms/android-3/arch-arm/usr/include/  -c hello.c ../build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-gcc \ -I [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>为android生成原生应用程序，不难啊。<br />
初始条件：安装android的ndk，比如目前最新的 android-ndk-r3。(2010-03版)<br />
我的目录结构：<br />
~/android-ndk-r3<br />
~/android-ndk-r3/temp  这个是当前工作目录。</p>
<p>Step1: 写两个文件：<br />
hello.c：<br />
<pre><div style="border:1px solid lightgrey; font-size:8pt; font-family:Courier New; overflow:auto; white-space: pre; width:99%; max-height:500px; height:expression(offsetHeight>500 ? '500px' : 'auto')">#<B><span style="color:#5F9EA0">include</span></B> <B><span style="color:#BC8F8F">&lt;stdio.h&gt;</span></B>

<B><span style="color:#228B22">int</span></B> <B><span style="color:#0000FF">main</span></B>()
{
    printf(<B><span style="color:#BC8F8F">&quot;hello, world\n&quot;</span></B>);
    <B><span style="color:#A020F0">return</span></B> 0;
}</div></pre></p>
<p>start.c<br />
<pre><div style="border:1px solid lightgrey; font-size:8pt; font-family:Courier New; overflow:auto; white-space: pre; width:99%; max-height:500px; height:expression(offsetHeight>500 ? '500px' : 'auto')">#<B><span style="color:#5F9EA0">include</span></B> <B><span style="color:#BC8F8F">&lt;stdlib.h&gt;</span></B>
<B><span style="color:#228B22">extern</span></B> <B><span style="color:#228B22">int</span></B> <B><span style="color:#0000FF">main</span></B>(<B><span style="color:#228B22">int</span></B> argc, <B><span style="color:#228B22">char</span></B> **argv);

<B><span style="color:#228B22">void</span></B> <B><span style="color:#0000FF">_start</span></B>(<B><span style="color:#228B22">int</span></B> argc, <B><span style="color:#228B22">char</span></B> **argv)
{
    exit (main (argc, argv));
}</div></pre></p>
<p>Step2: compile<br />
<pre><div style="border:1px solid lightgrey; font-size:8pt; font-family:Courier New; overflow:auto; white-space: pre; width:99%; max-height:500px; height:expression(offsetHeight>500 ? '500px' : 'auto')">../build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-gcc \
-I ../build/platforms/android-3/arch-arm/usr/include/  -c hello.c
../build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-gcc \
-I ../build/platforms/android-3/arch-arm/usr/include/  -c start.c</div></pre></p>
<p>Step3: link<br />
<pre><div style="border:1px solid lightgrey; font-size:8pt; font-family:Courier New; overflow:auto; white-space: pre; width:99%; max-height:500px; height:expression(offsetHeight>500 ? '500px' : 'auto')">../build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-ld --entry=_start \
--dynamic-linker /system/bin/linker -nostdlib     -rpath /system/lib  \
-L ../build/platforms/android-3/arch-arm/usr/lib/  \
-rpath ../build/platforms/android-3/arch-arm/usr/lib/    \
-lc -o hello hello.o start.o</div></pre></p>
<p>Step4: execute:<br />
<pre><div style="border:1px solid lightgrey; font-size:8pt; font-family:Courier New; overflow:auto; white-space: pre; width:99%; max-height:500px; height:expression(offsetHeight>500 ? '500px' : 'auto')">adb push hello /data/hello
adb shell
cd /data
chmod 755 ./hello
./hello
hello, world</div></pre></p>
<p>值得注意的一点是，在/sdcard目录下，程序运行不起来。我一开始还以为是没编好呢。后来扔到/data目录下，才成功跑起来。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/181.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>调试XP/2k3的安装过程</title>
		<link>http://www.swigger.net/archives/170.html</link>
		<comments>http://www.swigger.net/archives/170.html#comments</comments>
		<pubDate>Sun, 28 Mar 2010 06:54:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=170</guid>
		<description><![CDATA[ 在安装的源盘根目录提供一个winnt.sif，写上： [SetupData] OsLoadOptions = &#8220;/noguiboot /fastdetect /debug /debugport=com1 /baudrate=115200 /break&#8221; 即可。 不过XP的setupldr.bin不支持这个，要win2k3的才行。（推荐sp1。sp2加载ramdisk有卡住bug）]]></description>
			<content:encoded><![CDATA[<p> 在安装的源盘根目录提供一个winnt.sif，写上：</p>
<p>[SetupData]<br />
OsLoadOptions = &#8220;/noguiboot /fastdetect /debug /debugport=com1 /baudrate=115200 /break&#8221;</p>
<p>即可。</p>
<p>不过XP的setupldr.bin不支持这个，要win2k3的才行。（推荐sp1。sp2加载ramdisk有卡住bug）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/170.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>regsavekey (ntsavekey) 异常的调试过程</title>
		<link>http://www.swigger.net/archives/166.html</link>
		<comments>http://www.swigger.net/archives/166.html#comments</comments>
		<pubDate>Sun, 28 Mar 2010 06:41:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=166</guid>
		<description><![CDATA[结论非常简单，要先调用  NtInitializeRegistry. 参数见 wrk 中的 ntregapi.h 过程比较复杂，在smss.exe中用bootexecute启动的native程序里，调用 ntsavekey达不到想要的结果。 NtSaveKey会返回0，也就是没有错误。结果文件也会生成，生成的大小看起来也是对的。但是文件里面没有任何内容。所有字节都是0。 调试过程： 1. smss.exe启动的native程序是非常早的，可能是系统还有什么没准备好。试着替换其它程序而不是被smss.exe启动，来看看。 2. 替换winlogon.exe，发现能保存。 3. 替换 csrss.exe，发现也能保存。 4. 由于启动时候，smss创建csrss.exe ，后者再创建winlogon.exe。因此可以知道，在smss.exe调用native exe之后，启动csrss.exe之间，一定发生了什么事，使得ntsavekey在其前不能运行，其后可以运行。 5. 写一个简单的DLL，提供一个函数调用ntsavekey做测试，用lordpe把此DLL添加到smss.exe的依赖里。 6. WINDBG调试smss.exe启动native app后的路径，它每调几个函数就试下DLL中提供的函数看看ntsavekey是否正常。 7. 调试发现，在 NtInitializeRegistry之前，ntsavekey出现异常结果，之后，正常。 8. 结论： NtSaveKey需要用NtInitializeRegistry初始化注册表。]]></description>
			<content:encoded><![CDATA[<p>结论非常简单，要先调用  NtInitializeRegistry. 参数见 wrk 中的 ntregapi.h</p>
<p>过程比较复杂，在smss.exe中用bootexecute启动的native程序里，调用 ntsavekey达不到想要的结果。</p>
<p>NtSaveKey会返回0，也就是没有错误。结果文件也会生成，生成的大小看起来也是对的。但是文件里面没有任何内容。所有字节都是0。</p>
<p>调试过程：</p>
<p>1. smss.exe启动的native程序是非常早的，可能是系统还有什么没准备好。试着替换其它程序而不是被smss.exe启动，来看看。</p>
<p>2. 替换winlogon.exe，发现能保存。</p>
<p>3. 替换 csrss.exe，发现也能保存。</p>
<p>4. 由于启动时候，smss创建csrss.exe ，后者再创建winlogon.exe。因此可以知道，在smss.exe调用native exe之后，启动csrss.exe之间，一定发生了什么事，使得ntsavekey在其前不能运行，其后可以运行。</p>
<p>5. 写一个简单的DLL，提供一个函数调用ntsavekey做测试，用lordpe把此DLL添加到smss.exe的依赖里。</p>
<p>6. WINDBG调试smss.exe启动native app后的路径，它每调几个函数就试下DLL中提供的函数看看ntsavekey是否正常。</p>
<p>7. 调试发现，在 NtInitializeRegistry之前，ntsavekey出现异常结果，之后，正常。</p>
<p>8. 结论： NtSaveKey需要用NtInitializeRegistry初始化注册表。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/166.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>转载： windbg 如何在内核模式调试用户空间的程序</title>
		<link>http://www.swigger.net/archives/163.html</link>
		<comments>http://www.swigger.net/archives/163.html#comments</comments>
		<pubDate>Sun, 28 Mar 2010 06:31:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=163</guid>
		<description><![CDATA[1：使用!process 0 0 获取用户空间的所有的进程的信息  !process 0 0 **** NT ACTIVE PROCESS DUMP ****     PROCESS 80a02a60  Cid: 0002    Peb: 00000000  ParentCid: 0000     DirBase: 00006e05  ObjectTable: 80a03788  TableSize: 150.     Image: System  。。。。。 2：使用.process /p + 你需要断的应用程序的EProcess地址切换到应用程序的地址空间    例如：  .process  /p  0x80a02a60 3：重新加载user PDB文件      .reload /f /user 4：使用非侵入式的切换进程空间     .process /i /p 0x80a02a60 5：下应用层断点  bp        [...]]]></description>
			<content:encoded><![CDATA[<p>1：使用!process 0 0 获取用户空间的所有的进程的信息</p>
<p> !process 0 0</p>
<p>**** NT ACTIVE PROCESS DUMP ****<br />
    PROCESS 80a02a60  Cid: 0002    Peb: 00000000  ParentCid: 0000<br />
    DirBase: 00006e05  ObjectTable: 80a03788  TableSize: 150.<br />
    Image: System</p>
<p> 。。。。。</p>
<p>2：使用.process /p + 你需要断的应用程序的EProcess地址切换到应用程序的地址空间</p>
<p>   例如：</p>
<p> .process  /p  0x80a02a60</p>
<p>3：重新加载user PDB文件</p>
<p>     .reload /f /user</p>
<p>4：使用非侵入式的切换进程空间</p>
<p>    .process /i /p 0x80a02a60</p>
<p>5：下应用层断点  bp        bu      都可以</p>
<p>原文：<a href="http://blog.csdn.net/purplethunder/archive/2009/04/04/4048379.aspx">http://blog.csdn.net/purplethunder/archive/2009/04/04/4048379.aspx</a></p>
<p>另外顺便证下在windbg调试时强制调用一个函数：（设函数名是 test_reg）</p>
<p>r esp=esp-4 ; ed esp eip ; r eip = test_reg</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/163.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vs中有趣的 windows message compiler</title>
		<link>http://www.swigger.net/archives/160.html</link>
		<comments>http://www.swigger.net/archives/160.html#comments</comments>
		<pubDate>Thu, 25 Mar 2010 15:53:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=160</guid>
		<description><![CDATA[vs自带了一个mc.exe的程序，这个东西鲜有人知，它就是windows的message compiler程序。 mc编译mc代码，把它转变了一个bin格式的文件，放到资源中加载。在使用 windows event log , formatmessage的时候，就用得上这个消息了。formatmessage 有一个类似于 printf的形式的格式化能力。不过是用%1,%2这样的字眼，而不是%s,%d。这种%1,%2的形式理适合国际化。 codeproject上有一篇关于message compiler的文章：  http://www.codeproject.com/KB/system/mctutorial.aspx windows kernel有不少地方使用mc格式的文本。比如windows 在安装的时候，提示欢迎，格式化等的文字都来源于安装盘smss.exe的message resource里。 生成的 .bin 文件格式; binfile =  dword x + idgroups[x] + message[] idgroup = dword startid + dword endid  + dword offset_to_message message = dword sizeof(message) + char text[]]]></description>
			<content:encoded><![CDATA[<p>vs自带了一个mc.exe的程序，这个东西鲜有人知，它就是windows的message compiler程序。</p>
<p>mc编译mc代码，把它转变了一个bin格式的文件，放到资源中加载。在使用 windows event log , formatmessage的时候，就用得上这个消息了。formatmessage 有一个类似于 printf的形式的格式化能力。不过是用%1,%2这样的字眼，而不是%s,%d。这种%1,%2的形式理适合国际化。</p>
<p>codeproject上有一篇关于message compiler的文章：  <a href="http://www.codeproject.com/KB/system/mctutorial.aspx">http://www.codeproject.com/KB/system/mctutorial.aspx</a></p>
<p>windows kernel有不少地方使用mc格式的文本。比如windows 在安装的时候，提示欢迎，格式化等的文字都来源于安装盘smss.exe的message resource里。</p>
<p>生成的 .bin 文件格式;</p>
<p>binfile =  dword x + idgroups[x] + message[]</p>
<p>idgroup = dword startid + dword endid  + dword offset_to_message</p>
<p>message = dword sizeof(message) + char text[]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/160.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>variant 变量表</title>
		<link>http://www.swigger.net/archives/124.html</link>
		<comments>http://www.swigger.net/archives/124.html#comments</comments>
		<pubDate>Sat, 24 Oct 2009 13:53:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=124</guid>
		<description><![CDATA[老是要查头文件，又排得不整齐，排一份如下： LONGLONG      llVal;        /* VT_I8                */ LONG          lVal;         /* VT_I4                */ BYTE          bVal;         /* VT_UI1               */ SHORT         iVal;         /* VT_I2                */ FLOAT         fltVal;       /* VT_R4                */ DOUBLE        dblVal;       /* VT_R8                */ VARIANT_BOOL  boolVal;      /* VT_BOOL              */ SCODE         scode;        /* VT_ERROR             */ CY            cyVal;        /* VT_CY                */ DATE          date;         /* VT_DATE              */ wireBSTR      bstrVal;      /* VT_BSTR              [...]]]></description>
			<content:encoded><![CDATA[<p>老是要查头文件，又排得不整齐，排一份如下：</p>
<p><pre><div style="border:1px solid lightgrey; font-size:8pt; font-family:Courier New; overflow:auto; white-space: pre; width:99%; max-height:500px; height:expression(offsetHeight>500 ? '500px' : 'auto')">LONGLONG      llVal;        /* VT_I8                */
LONG          lVal;         /* VT_I4                */
BYTE          bVal;         /* VT_UI1               */
SHORT         iVal;         /* VT_I2                */
FLOAT         fltVal;       /* VT_R4                */
DOUBLE        dblVal;       /* VT_R8                */
VARIANT_BOOL  boolVal;      /* VT_BOOL              */
SCODE         scode;        /* VT_ERROR             */
CY            cyVal;        /* VT_CY                */
DATE          date;         /* VT_DATE              */
wireBSTR      bstrVal;      /* VT_BSTR              */
IUnknown *    punkVal;      /* VT_UNKNOWN           */
IDispatch *   pdispVal;     /* VT_DISPATCH          */
wirePSAFEARRAY parray;      /* VT_ARRAY             */
BYTE *        pbVal;        /* VT_BYREF|VT_UI1      */
SHORT *       piVal;        /* VT_BYREF|VT_I2       */
LONG *        plVal;        /* VT_BYREF|VT_I4       */
LONGLONG *    pllVal;       /* VT_BYREF|VT_I8       */
FLOAT *       pfltVal;      /* VT_BYREF|VT_R4       */
DOUBLE *      pdblVal;      /* VT_BYREF|VT_R8       */
VARIANT_BOOL *pboolVal;     /* VT_BYREF|VT_BOOL     */
SCODE *       pscode;       /* VT_BYREF|VT_ERROR    */
CY *          pcyVal;       /* VT_BYREF|VT_CY       */
DATE *        pdate;        /* VT_BYREF|VT_DATE     */
wireBSTR *    pbstrVal;     /* VT_BYREF|VT_BSTR     */
IUnknown **   ppunkVal;     /* VT_BYREF|VT_UNKNOWN  */
IDispatch **  ppdispVal;    /* VT_BYREF|VT_DISPATCH */
wirePSAFEARRAY *pparray;    /* VT_BYREF|VT_ARRAY    */
wireVARIANT * pvarVal;      /* VT_BYREF|VT_VARIANT  */
CHAR          cVal;         /* VT_I1                */
USHORT        uiVal;        /* VT_UI2               */
ULONG         ulVal;        /* VT_UI4               */
ULONGLONG     ullVal;       /* VT_UI8               */
INT           intVal;       /* VT_INT               */
UINT          uintVal;      /* VT_UINT              */
DECIMAL       decVal;       /* VT_DECIMAL           */
DECIMAL *     pdecVal;      /* VT_BYREF|VT_DECIMAL  */
CHAR *        pcVal;        /* VT_BYREF|VT_I1       */
USHORT *      puiVal;       /* VT_BYREF|VT_UI2      */
ULONG *       pulVal;       /* VT_BYREF|VT_UI4      */
ULONGLONG *   pullVal;      /* VT_BYREF|VT_UI8      */
INT *         pintVal;      /* VT_BYREF|VT_INT      */
UINT *        puintVal;     /* VT_BYREF|VT_UINT     */</div></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/124.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>透明窗口，连鼠标键盘事件也不接受，全透明</title>
		<link>http://www.swigger.net/archives/114.html</link>
		<comments>http://www.swigger.net/archives/114.html#comments</comments>
		<pubDate>Sat, 01 Aug 2009 15:54:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=114</guid>
		<description><![CDATA[windows的透明窗口，如果设置了LWA_ALPHA和WS_EX_TRANSPARENT，就会连鼠标键盘事件也给透明过去，这个功能还不错。可以在屏上显示水印。 关键代码： SetWindowLong(m_hWnd, GWL_EXSTYLE, WS_EX_LAYERED&#124;WS_EX_TRANSPARENT&#124;WS_EX_TOPMOST);  SetLayeredWindowAttributes(m_hWnd, RGB(0,0,0), 120, LWA_ALPHA);  SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE&#124;SWP_NOSIZE&#124;SWP_NOMOVE&#124;SWP_SHOWWINDOW); demo代码： static LRESULT WINAPI UIWndProcBase(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {  if (msg == WM_PAINT)  {   PAINTSTRUCT ps;   BeginPaint(hWnd, &#38;ps);   //OnPaint(ps.hdc);   EndPaint(hWnd, &#38;ps);  }  else if (msg == WM_DESTROY)  {   PostQuitMessage(0);  }  return DefWindowProc(hWnd, msg, wParam, lParam); [...]]]></description>
			<content:encoded><![CDATA[<p>windows的透明窗口，如果设置了LWA_ALPHA和WS_EX_TRANSPARENT，就会连鼠标键盘事件也给透明过去，这个功能还不错。可以在屏上显示水印。</p>
<p>关键代码：</p>
<p>SetWindowLong(m_hWnd, GWL_EXSTYLE, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOPMOST);<br />
 SetLayeredWindowAttributes(m_hWnd, RGB(0,0,0), 120, LWA_ALPHA);<br />
 SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW);</p>
<p>demo代码：</p>
<p><pre><div style="border:1px solid lightgrey; font-size:8pt; font-family:Courier New; overflow:auto; white-space: pre; width:99%; max-height:500px; height:expression(offsetHeight>500 ? '500px' : 'auto')"><B><span style="color:#228B22">static</span></B> LRESULT WINAPI <B><span style="color:#0000FF">UIWndProcBase</span></B>(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
 <B><span style="color:#A020F0">if</span></B> (msg == WM_PAINT)
 {
  PAINTSTRUCT ps;
  BeginPaint(hWnd, &amp;ps);
  <I><span style="color:#B22222">//OnPaint(ps.hdc);
</span></I>  EndPaint(hWnd, &amp;ps);
 }
 <B><span style="color:#A020F0">else</span></B> <B><span style="color:#A020F0">if</span></B> (msg == WM_DESTROY)
 {
  PostQuitMessage(0);
 }
 <B><span style="color:#A020F0">return</span></B> DefWindowProc(hWnd, msg, wParam, lParam);
}

<B><span style="color:#228B22">void</span></B> <B><span style="color:#0000FF">UIRun</span></B>()
{
 WNDCLASSEX wc = {<B><span style="color:#A020F0">sizeof</span></B>(wc)};
 wc.hInstance     = GetModuleHandle(0);
 wc.lpszClassName = _T(<B><span style="color:#BC8F8F">&quot;uiclassname&quot;</span></B>);
 wc.lpfnWndProc   = &amp;UIWndProcBase;
 wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
 RegisterClassEx(&amp;wc);
 wstring ws = L<B><span style="color:#BC8F8F">&quot;aaabbcd&quot;</span></B>;
 HWND hParent = CreateWindowExW(WS_EX_TRANSPARENT, _T(<B><span style="color:#BC8F8F">&quot;EDIT&quot;</span></B>), _T(<B><span style="color:#BC8F8F">&quot;&quot;</span></B>),  WS_POPUP, 0, 0, 100, 100, 0, NULL, wc.hInstance, NULL);
 HWND m_hWnd = CreateWindowEx(0, wc.lpszClassName, ws.c_str(),  WS_POPUP, 0, 0, 100, 100,
  hParent, NULL, wc.hInstance, NULL);

 SetWindowLong(m_hWnd, GWL_EXSTYLE, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOPMOST);
 SetLayeredWindowAttributes(m_hWnd, RGB(0,0,0), 120, LWA_ALPHA);
 SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW);

 MSG msg;
 <B><span style="color:#A020F0">while</span></B> (GetMessage(&amp;msg, 0, 0, 0))
 {
  TranslateMessage(&amp;msg);
  DispatchMessage(&amp;msg);
 }
}

<B><span style="color:#228B22">int</span></B> <B><span style="color:#0000FF">main</span></B>()
{
 UIRun();

 <B><span style="color:#A020F0">return</span></B> 0;
}</div></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/114.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>masm造weak symbol</title>
		<link>http://www.swigger.net/archives/104.html</link>
		<comments>http://www.swigger.net/archives/104.html#comments</comments>
		<pubDate>Fri, 24 Apr 2009 13:54:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[开发]]></category>

		<guid isPermaLink="false">http://www.swigger.net/?p=104</guid>
		<description><![CDATA[masm或ml.exe可以用alias造weak external symbol,这样可以起到链接时有就选用户提供的，无就选系统默认的这样一个功能。这个语法很简单，但不好找。以前找了又忘了，特记下： alias &#60;sym2&#62; = &#60;sym1&#62; 这次是在这里搜到的： http://rs1.szif.hu/~tomcat/win32/win32asm.txt]]></description>
			<content:encoded><![CDATA[<p>masm或ml.exe可以用alias造weak external symbol,这样可以起到链接时有就选用户提供的，无就选系统默认的这样一个功能。这个语法很简单，但不好找。以前找了又忘了，特记下：</p>
<p>alias &lt;sym2&gt; = &lt;sym1&gt;</p>
<p>这次是在这里搜到的：</p>
<p><a href="http://rs1.szif.hu/~tomcat/win32/win32asm.txt">http://rs1.szif.hu/~tomcat/win32/win32asm.txt</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swigger.net/archives/104.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
