<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="http://rss.egloos.com/style/blog.xsl" type="text/xsl" media="screen"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
	<title>Falling into Infinity</title>
	<link>http://v0nsch3.egloos.com</link>
	<description>Falling into Infinity</description>
	<language>ko</language>
	<pubDate>Wed, 10 Sep 2008 02:32:39 GMT</pubDate>
	<generator>Egloos</generator>
	<image>
		<title>Falling into Infinity</title>
		<url>http://md.egloos.com/img/samplelogo2.gif</url>
		<link>http://v0nsch3.egloos.com</link>
		<width>80</width>
		<height>80</height>
		<description>Falling into Infinity</description>
	</image>
  	<item>
		<title><![CDATA[ MBRwizard ]]> </title>
		<link>http://v0nsch3.egloos.com/811642</link>
		<guid>http://v0nsch3.egloos.com/811642</guid>
		<description>
			<![CDATA[ 
  <p><strong>MBRwizard</strong> is a powerful, yet flexible utility designed to assist with all types of Master Boot Record difficulties. Intially developed to overcome MBR problems introduced by disk imaging products such as Symantec Ghost and Acronis True Image, MBRwizard has become a popular utility for repairing all types of MBR problems, especially those caused by disk-2-disk (d2d) and system backup and recovery applications</p><br />
<p>&nbsp;</p><br />
<p><strong>MBR Operations</strong></p><br />
<ul class="list-type-5"><br />
<li>MBR 저장 또는 삭제</li><br />
<li>백업된 MBR 복구</li><br />
<li>Wipe MBR</li><br />
<li>훼손된 MBR 정정</li><br />
<li>새로운 MBR 생성</li><br />
<li>디스크 Signature 수정</li><br />
<li>파티션 테이블 엔트리 정렬</li><br />
<li>섹터 복사</li><br />
<li>존재하는 MBR 삭제</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>Partition Operation</strong></p><br />
<ul class="list-type-5"><br />
<li>파티선 삭제</li><br />
<li>숨기기/보이기 파티션</li><br />
<li>Bootable/Active 파티션 셋팅</li><br />
<li>파티션 타입 변경</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>추가기능</strong></p><br />
<ul class="list-type-5"><br />
<li>전체 디시크 안전하게 와이핑</li><br />
<li>부팅 메뉴 - 부팅 가능한 파티션 선택</li><br />
<li>영구적인 상태 바이트 유지</li><br />
<li>MBR의 내용을 갖는 ini 파일 생성</li><br />
<li>머신 종료/재부팅</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>Downloads</strong></p><br />
<p>3개의 Release 버전(Windows XP/PE/2003, DOS/Win9x, Linux)이 있으며 3개의 Beta-Version이 있다.</p><br />
<p>&nbsp;</p><br />
<ul class="list-type-5"><br />
<li>Released Versions</li><br />
</ul><br />
<table width="98%"><br />
<tbody><br />
<tr><br />
<td><strong>Platform</strong></td><br />
<td><strong>Version</strong></td><br />
<td><strong>Release Date</strong></td><br />
</tr><br />
<tr><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz.zip">Windows XP/PE/2003</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz.zip">1.53</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz.zip">August 24, 2004</a></td><br />
</tr><br />
<tr><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizD.zip">DOS/Win9x</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizD.zip">1.52</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizD.zip">November, 11, 2003</a></td><br />
</tr><br />
<tr><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizL.zip">Linux</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizL.zip">1.52</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizL.zip">November 11, 2003</a></td><br />
</tr><br />
</tbody><br />
</table><br />
<ul class="list-type-5"><br />
<li>Pre-release, Beta Versions</li><br />
</ul><br />
<table width="98%"><br />
<tbody><br />
<tr><br />
<td><strong>Platform</strong></td><br />
<td><strong>Version</strong></td><br />
<td><strong>Release Date</strong></td><br />
<td><strong>Notes</strong></td><br />
</tr><br />
<tr><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz2.0.zip">Windows XP/PE/2003</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz2.0.zip">2.0 beta</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz2.0.zip">November 15, 2005</a></td><br />
<td>&nbsp;</td><br />
</tr><br />
<tr><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz64.zip">Windows 64 bit</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz64.zip">2.0 beta</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWiz64.zip">November 15, 2005</a></td><br />
<td>&nbsp;</td><br />
</tr><br />
<tr><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizD2.0.zip">DOS/Win9x</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizD2.0.zip">2.0 beta</a></td><br />
<td><a href="http://v0nsch3lling.springnote.com/pages/MBRWizD2.0.zip">November, 15, 2005</a></td><br />
<td>*does not include WipeDisk functionality</td><br />
</tr><br />
</tbody><br />
</table><br />
<p><strong>Operational Command</strong></p><br />
<ul class="list-type-5"><br />
<li>/List - Display the partitions listed in the MBR, their order in the MBR, partition type, size, and whether active or hidden. The Pos field indicates the order the partitions are laid out on disk, while MBRndx shows them as they're listed in the MBR.</li><br />
<li>/Disk=# - Selects the disk to use for all operations. This switch is always processed first, verifying that all operations specified on the command line will use the disk specified here. If not specified, Disk 0 will be used by default.</li><br />
<li>/Part=# - Selects the partition to use for all partition based operations. If not specified, partition '0' will be used by default. All operations use the physical location of the partition on the disk (the first column in /list), not the MBRndx field which simply identifies the current position of the partition entry in the MBR.&nbsp;&nbsp; Certain commands allow the action to be performed on all partitions, in this case /Part=* (asterisk) performs this functionality.</li><br />
<li>/Sector=# - Selects the sector to use with sector based operations. Sector 0 (MBR) will be used by default if not specified.</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>MBR Commands</strong></p><br />
<ul class="list-type-5"><br />
<li>/Save=filename - Saves the current MBR to a file, where filename is the path+filename used to store the file.&nbsp; Specifying /Sector=# on the command line will save the sector # specified rather than the MBR (Sector 0).</li><br />
<li>/Restore=filename - Reads an MBR file from filename, where filename is an existing path+filename containing the backed up contents of the MBR sector. Optionally, specifying the /Sector=# parameter will restore the file to sector # rather than 0 (MBR).</li><br />
<li>/Repair=# - Designed to create a new Master Boot Record on a blank disk, or fix a damaged, corrupt, or missing MBR.&nbsp; Specifying an option of '1' will save a PE/XP/2003 MBR to the specifed disk. This may be expanded to other OS formats if the need exists. Note, this option will not modify the partition table.</li><br />
<li>/Show=x - Shows the partition structure from a backed up MBR.&nbsp; Available options for x are a filename, the sector number containing the backup, or the word SECTOR if the contents have been previously saved to the hidden sector.</li><br />
<li>/Wipe=x - Selecting an option of 'mbr' will wipe the MBR clean, 'head' will wipe the first head or 63 sectors, and a range of sectors from x to y can be wiped by specifying /Wipe=x-y. This will effectively remove all information from the specified sectors of the disk.</li><br />
<li>/Sort - It isn’t uncommon for the partition entries in the MBR to be unsorted after reinstalling Windows or restoring a Ghost or Acronis disk image.&nbsp; This means that the partition order in the MBR won't match the order on disk. Normally this wasn’t a problem until Windows NT/2K/XP came along with its new boot loader, and the requirement that each partition entry in the boot.ini must point to the actual partition number. This option will sort the entries in the MBR to match their physical order on disk.</li><br />
<li>/IsSorted - Queries the partition entry order in the MBR and&nbsp; returns an ErrorLevel code based on the status of the partition entries: '0' = Sorted, '1' = Not Sorted</li><br />
<li>/Signature=x - Reads or Writes a new disk signature to the MBR.&nbsp; Specifying 'Zero' will clear the existing signature, otherwise an 8 digit hex entry can be entered for the signature.&nbsp; For example, /Signature= Zero, or /Signature= AC87AD87. Specifying /Signature with no options will display the existing disk signature.</li><br />
<li>/Copy=x - Copies the contents of one sector to another.&nbsp; The /Sector=x command will specify the source sector, and will be copied to the sector specified by /Copy.&nbsp; Please note, typically only the first 64 sectors (0-63) should be used as the destination, otherwise existing data on the hard disk may be overwritten. Selecting 0 as the target will overwrite and erase the contents of the MBR.</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>Partition Options</strong></p><br />
<ul class="list-type-5"><br />
<li>/Hide=# - Hides or Unhides the specified partition to the operating system. An option of '1' or 'Yes' will hide the partition, while selecting '0' or 'No' will set the partition visible. If /Part=* is specified all partitions will be hidden/unhidden.</li><br />
<li>/Active=# - Sets the specified partition status as active (bootable) or inactive. Specifying the parameter as '1' or 'Yes' will set the partition active, while an option of '0' or 'No' will set the partition non-bootable.&nbsp; /Part=* can be selected to set all partitions inactive.&nbsp; If setting the a hidden partition active, it will first be unhidden before being&nbsp; set active. Note for older operating systems: DOS and Win9x do not properly recognize multiple visible primary partitions, make certain any remaining primary partitions are unhidden if necessary.</li><br />
<li>/Type=# - Modifies the partition type in the MBR. Please note that this does not attempt to convert the actual partition and file system to a new type. This is generally required when a partitioning or backup/restore program modifies the partition type and it needs to be restored back to the original type. The # specified must be directly followed by either a d (decimal) or h (hexadecimal) in order to properly identify the new type.&nbsp; This option must be used with /Partition in order to identify the partition being modified.</li><br />
<li>/Del - Deletes the specified partition.&nbsp; Specifying /Part=* removes all partitions on selected disk, while specifying both /Disk=* /Part=* removes all partitions on all disks.</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>Miscellaneous Options</strong></p><br />
<ul class="list-type-5"><br />
<li>/Shutdown=# -An entry of '1' will force Windows to shutdown, '2' will force Windows to shutdown and reboot. '3' shuts down without force, and '4' reboots without force. Note, using the Force options may cause data loss if open programs contain unsaved data. NT/2K/XP/2003 version only.</li><br />
<li>/WipeDisk=# - Wipes (overwrites) each sector on the disk in order to securely erase all data. Selecting an option of '1' write zeros to all sectors, additional methods coming. Please note, MBRwizard can not completely wipe the system disk (C: drive) when running from Windows, as the machine will blue screen once operating system files are overwritten. An alternative option is to securely wipe the disk from WinPE, which boots from CD or USB Flash Disk, and doesn't have the same limitations. This option is currently only available under the Windows version.</li><br />
<li>/Status=x - Stores or Retrieves the status byte located at offset 0x1b2 in the MBR, which is widely recognized as an unused section of the MBR.&nbsp; This option allows a single byte to be stored to this unused location of the hard disk, used mainly as a status indicator for provisioning or deployment projects. Specifying a value for 'x' will set the status byte, valid options are 0-255.&nbsp; Selecting /Status with no options will return the current byte upon program exit.</li><br />
<li>/Confirm - Any operation that performs a change to the MBR will now ask for user confirmation before making the change.&nbsp; Specifying /confirm on the command line overrides this request and defaults to Yes for each operation without prompting.</li><br />
<li>/BootMenu -This option will list the available, bootable partitions to the user, and set one active by secting from the menu</li><br />
<li>/Msg=# - Hides the status messages shown upon program exit.&nbsp; An entry of '1' indicates that no messages should be shown, '2'=No error messages, and '3'=No status messages displayed on success.</li><br />
<li>/Ignore - Attempts to continue the specified operation if an error occurs.</li><br />
<li>/Result - Displays the return code for visual verification of success/failure.</li><br />
<li>/? - Show command line options</li><br />
</ul><br />
<p style="text-align:right">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1527168">스프링노트</a>에서 작성되었습니다.</p>			 ]]> 
		</description>

		<comments>http://v0nsch3.egloos.com/811642#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:32:38 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ AutoIt FAQ ]]> </title>
		<link>http://v0nsch3.egloos.com/811622</link>
		<guid>http://v0nsch3.egloos.com/811622</guid>
		<description>
			<![CDATA[ 
  <h1>Frequently Asked Questions (FAQ)</h1><br />
<p>This section gives some of the more frequently asked questions from the <a href="http://www.autoitscript.com/forum/" class="ext"><span style="color: rgb(0, 0, 255);">forum</span></a>.&nbsp; If you can't find the answer you seek here then the <a href="http://www.autoitscript.com/forum/" class="ext"><span style="color: rgb(0, 0, 255);">forum</span></a> should be your first port of call.</p><br />
<h2>Questions</h2><br />
<p>1. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#1"><span style="color: rgb(128, 0, 128);">Why doesn't my old AutoIt v2.64 script run in v3?</span></a></p><br />
<p>2. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#2"><span style="color: rgb(128, 0, 128);">Isn't v3 much more difficult than previous versions?</span></a></p><br />
<p>3. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#3"><span style="color: rgb(128, 0, 128);">How can I convert my v2.64 scripts to v3?</span></a></p><br />
<p>4. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#4"><span style="color: rgb(128, 0, 128);">Where is the "goto" command?</span></a></p><br />
<p>5. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#5"><span style="color: rgb(128, 0, 128);">How can I run a DOS program from within AutoIt?</span></a></p><br />
<p>6. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#6"><span style="color: rgb(128, 0, 128);">Why can I only use Run() to execute .exe and .com files?&nbsp; What about .msi / .txt and others?</span></a></p><br />
<p>7. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#7"><span style="color: rgb(128, 0, 128);">Why do I get errors when I try and use double quotes (") ?</span></a></p><br />
<p>8. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#8"><span style="color: rgb(128, 0, 128);">What do the window "title" and "text" parameters mean?</span></a></p><br />
<p>9. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#9"><span style="color: rgb(128, 0, 128);">Why can't I print a variable using "My var is $variable"?</span></a></p><br />
<p>10. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#10"><span style="color: rgb(128, 0, 128);">When I use Send() to send a variable odd things happen?</span></a></p><br />
<p>11. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#11"><span style="color: rgb(128, 0, 128);">What is the difference between the return value and @error?</span></a></p><br />
<p>12. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#12"><span style="color: rgb(128, 0, 128);">How can I exit my script with a hot-key?</span></a></p><br />
<p>13. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#13"><span style="color: rgb(128, 0, 128);">How can I use a custom icon when compiling my scripts?</span></a></p><br />
<p>14. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#14"><span style="color: rgb(128, 0, 128);">How can I make sure only one copy of my script is run?</span></a></p><br />
<p>15. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#15"><span style="color: rgb(128, 0, 128);">What are the current technical limits of AutoIt v3?</span></a></p><br />
<p>16. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#16"><span style="color: rgb(128, 0, 128);">I get a missing picture symbol in the Help file under the Examples.</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4>1. Why doesn't my old AutoIt v2.64 script run in v3?</h4><br />
<p>v3 has a different language structure to v2.64.</p><br />
<p>Previous versions of AutoIt were fine for what they were designed for - writing simple scripts to help with software installations.&nbsp; Over time people began using it for general and complicated scripting tasks.&nbsp; The old syntax and structure made this possible but very very difficult and cumbersome.&nbsp; The decision was made to make AutoIt more suitable for general automation tasks and to achieve that a more standard and basic-like language was made.&nbsp; This also means that if you already know a scripting language you will pick AutoIt v3 up easily.</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4>2. Isn't v3 much more difficult than previous versions?</h4><br />
<p>No.&nbsp; In fact in many instances it's much easier than previous versions as you don't have to try and force the language to do something it was never designed to do.&nbsp; It also uses a familiar BASIC-like language, and BASIC is known for being...well...basic :)</p><br />
<p>&nbsp;</p><br />
<p>The vast majority of old AutoIt scripts were focused around software installation and clicking "Next" a lot in dialog boxes.&nbsp; Most of these scripts can be converted to v3 simply by adding a couple of brackets here and there.&nbsp; Here is an example of such a script in v2 and v3 (simulating a software installation with a few dialogs that have a <em class="underline"><strong>N</strong></em><strong>ext</strong> button and a <em class="underline"><strong>F</strong></em><strong>inish</strong> button)</p><br />
<p>&nbsp;</p><br />
<p class="code">; v2.64 Script<br />
<br />
WinWaitActive, Welcome, Welcome to the XSoft installation<br />
<br />
Send, !n<br />
<br />
WinWaitActive, Choose Destination, Please choose the<br />
<br />
Send, !n<br />
<br />
WinWaitActive, Ready to install, Click Next to install<br />
<br />
Send, !n<br />
<br />
WinWaitActive, Installation Complete, Click Finish to exit<br />
<br />
Send, !f<br />
<br />
WinWaitClose, Installation Complete<br />
<br />
<br />
<br />
; v3 Script<br />
<br />
WinWaitActive("Welcome", "Welcome to the XSoft installation")<br />
<br />
Send("!n")<br />
<br />
WinWaitActive("Choose Destination", "Please choose the")<br />
<br />
Send("!n")<br />
<br />
WinWaitActive("Ready to install", "Click Next to install")<br />
<br />
Send("!n")<br />
<br />
WinWaitActive("Installation Complete", "Click Finish to exit")<br />
<br />
Send("!f")<br />
<br />
WinWaitClose("Installation Complete")</p><br />
<p>&nbsp;</p><br />
<p>Now, that wasn't so bad! :)&nbsp; As all "strings" are enclosed in quotes you no longer have to wrestle with problems caused by leading and trailing spaces in text.&nbsp; There is also fantastic support for many <a href="http://www.autoitscript.com/autoit3/docs/intro/editors.htm"><span style="color: rgb(0, 0, 255);">text editors</span></a> so that when you are writing v3 scripts you can have syntax highlighting which makes everything much easier.</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4>3. How can I convert my v2.64 scripts to v3?</h4><br />
<p>The first thing you should ask yourself is "Do I need to convert my script?".&nbsp; v2.64 will continue to be downloadable and supported so don't update all your scripts just for the sake of it - well not unless you want to :)</p><br />
<p>&nbsp;</p><br />
<p>There is a section in the Help file that shows how the commands in v2 and v3 are related - click <a href="http://www.autoitscript.com/autoit3/docs/intro/v264users.htm"><span style="color: rgb(0, 0, 255);">here</span></a> to see the page.</p><br />
<p>&nbsp;</p><br />
<p>One of the AutoIt v3 authors has written a utility to automatically convert v2 scripts to v3.&nbsp; Conversion is pretty good unless your code is a rats-nest of gotos :)&nbsp; You can find the converter in the "Extras" directory (Start \ AutoIt v3 \ Extras - or look in the directory that you installed AutoIt v3).</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4>4. Where is the "goto" command?</h4><br />
<p>Gone.&nbsp; It's evil.&nbsp; No, you can't ask why - it just is.&nbsp; It's like that lump of rock they find in the microwave at the end of the film <a href="http://www.imdb.com/title/tt0081633/" class="ext"><span style="color: rgb(0, 0, 255);">Time Bandits</span></a> :)</p><br />
<p>&nbsp;</p><br />
<p>AutoIt v3 features most of the common "loops" in use today and with these Goto is no longer required.&nbsp; Look up <a href="http://www.autoitscript.com/autoit3/docs/keywords/While.htm"><span style="color: rgb(0, 0, 255);">While</span></a>, <a href="http://www.autoitscript.com/autoit3/docs/keywords/Do.htm"><span style="color: rgb(0, 0, 255);">Do</span></a>, <a href="http://www.autoitscript.com/autoit3/docs/keywords/For.htm"><span style="color: rgb(0, 0, 255);">For</span></a>, <a href="http://www.autoitscript.com/autoit3/docs/keywords/ExitLoop.htm"><span style="color: rgb(0, 0, 255);">ExitLoop</span></a>, <a href="http://www.autoitscript.com/autoit3/docs/keywords/ContinueLoop.htm"><span style="color: rgb(0, 0, 255);">ContinueLoop</span></a> and <a href="http://www.autoitscript.com/autoit3/docs/keywords/Func.htm"><span style="color: rgb(0, 0, 255);">Functions</span></a> for the modern way of doing things :)&nbsp; And while you are looking at help file sections check out these on <a href="http://www.autoitscript.com/autoit3/docs/intro/lang_loops.htm"><span style="color: rgb(0, 0, 255);">loops</span></a>, <a href="http://www.autoitscript.com/autoit3/docs/intro/lang_conditional.htm"><span style="color: rgb(0, 0, 255);">conditional statements</span></a> and <a href="http://www.autoitscript.com/autoit3/docs/intro/lang_functions.htm"><span style="color: rgb(0, 0, 255);">functions</span></a>.&nbsp; I promise you, once you have got the hang of such things you will be able to script in virtually any other language within a couple of minutes.</p><br />
<p>&nbsp;</p><br />
<p>Just to get you started, the most basic use of Goto in version 2.64 was an infinite loop like:</p><br />
<p class="code">:mylabel<br />
<br />
...do something...<br />
<br />
...and something else...<br />
<br />
goto, mylabel<br />
</p><br />
<p>A simple v3 version of that is a While loop that is always "true".</p><br />
<p class="code">While 1 = 1<br />
<br />
&nbsp;&nbsp; ...do something...<br />
<br />
&nbsp;&nbsp; ...do something else...<br />
<br />
Wend<br />
</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="5"></a>5. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#5"><span style="color: rgb(128, 0, 128);">How can I run a DOS program from within AutoIt?</span></a></h4><br />
<p>If you wanted to run something like a DOS "Dir" command then you must run it though the command interpreter (command.com or cmd.exe depending on your OS).&nbsp; The <a href="http://www.autoitscript.com/autoit3/docs/macros.htm"><span style="color: rgb(0, 0, 255);">@Comspec</span></a> macro contains the correct location of this file.&nbsp; You should use the <a href="http://www.autoitscript.com/autoit3/docs/functions/RunWait.htm"><span style="color: rgb(0, 0, 255);">RunWait()</span></a> function as it waits for the DOS program to finish before continuing with the next line of the script.&nbsp; Here is an example of running the DOS Dir command on the C: drive: (effectively running the command <strong>command.com /c Dir C:\</strong> )</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; RunWait(@COMSPEC &amp; " /c Dir C:\")</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="6"></a>6. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#6"><span style="color: rgb(128, 0, 128);">Why can I only use Run() to execute .exe files?&nbsp; What about .msi / .txt and others?</span></a></h4><br />
<p>Only a few file extensions are usually "runable" - these are .exe, .bat, .com, .pif.&nbsp; Other file types like .txt and .msi are actually executed with another program.&nbsp; When you double click on a "myfile.msi" file what actually happens in the background is that "msiexec.exe myfile.msi" is executed.&nbsp; So to run a .msi file from AutoIt you would do:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; RunWait("msiexec myfile.msi")</p><br />
<p>&nbsp;</p><br />
<p>Or, run the command "start" which will automatically work out how to execute the file for you:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; RunWait(@COMSPEC &amp; " /c Start myfile.msi")</p><br />
<p class="code">&nbsp;</p><br />
<p>Or, use the ShellExecuteWait function which will automatically work out how to execute the file for you:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; ShellExecuteWait("myfile.msi")</p><br />
<p class="code">&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="7"></a>7. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#7"><span style="color: rgb(128, 0, 128);">Why do I get errors when I try and use double quotes (") ?</span></a></h4><br />
<p>If you want to use double-quotes inside a string then you must "double them up".&nbsp; So for every one quote you want you should use two.&nbsp; For example if you wanted to set a variable to the string: <strong>A word in "this" sentence has quotes around it!</strong>&nbsp; You would do:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; $var = "A word in ""this"" sentence has quotes around it!"</p><br />
<p>or use single quotes instead:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; $var = 'A word in "this" sentence has quotes around it!'</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="8"></a>8. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#8"><span style="color: rgb(128, 0, 128);">What do the window "title" and "text" parameters mean?</span></a></h4><br />
<p>There is a detailed description <a href="http://www.autoitscript.com/autoit3/docs/intro/windowsbasic.htm"><span style="color: rgb(0, 0, 255);">here</span></a>.</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="9"></a>9. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#9"><span style="color: rgb(128, 0, 128);">Why can't I print a variable using "My var is $variable"?</span></a></h4><br />
<p>If you have a variable called $msg and you want to print in inside a MsgBox then this will NOT work:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; MsgBox(0, "Example", "My variable is $msg")</p><br />
<p>It will actually print&nbsp; <strong>My variable is $msg</strong> .&nbsp;What you need to do is tell AutoIt to join the string and the variable together using the <a href="http://www.autoitscript.com/autoit3/docs/intro/lang_operators.htm"><span style="color: rgb(0, 0, 255);">&amp; operator</span></a>:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; MsgBox(0, "Example", "My variable is " &amp; $msg)</p><br />
<p>&nbsp;</p><br />
<p><strong>Advanced:</strong> If you have many variables to add into a string then you may find the <a href="http://www.autoitscript.com/autoit3/docs/functions/StringFormat.htm"><span style="color: rgb(0, 0, 255);">StringFormat()</span></a> function useful.&nbsp; For example, if I wanted to insert $var1 to $var5 into a string then it may be easier to do:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp;&nbsp; $msg = StringFormat("Var1 is %s, Var2 is %s, Var3 is %s, Var4 is %s, Var5 is %s", $var1, $var2, $var3, $var4, $var5)<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp; MsgBox(0, "Example", $msg)</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="10"></a>10. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#10"><span style="color: rgb(128, 0, 128);">When I use Send() to send a variable odd things happen?</span></a></h4><br />
<p>If you are <a href="http://www.autoitscript.com/autoit3/docs/functions/Send.htm"><span style="color: rgb(0, 0, 255);">sending</span></a> the contents of a variable then be mindful that if it contains special send characters like ! ^ + {SPACE} then these will be translated into special keystrokes - rarely what is wanted.&nbsp; To overcome this use the RAW mode of <a href="http://www.autoitscript.com/autoit3/docs/functions/Send.htm"><span style="color: rgb(0, 0, 255);">Send()</span></a> that does not translate special keys:</p><br />
<p class="code">&nbsp;&nbsp;&nbsp; Send($myvar, 1)</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);"><img src="http://www.autoitscript.com/autoit3/docs/images/blue_gradient_1024x24.jpg" width="1024" height="1"></span></p><br />
<h4><a id="11"></a>11. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#11"><span style="color: rgb(128, 0, 128);">What is the difference between the return value and @error?</span></a></h4><br />
<p>Generally a return value is used to indicate the success of a function.&nbsp; But, if a function is already returning something ( like <a href="http://www.autoitscript.com/autoit3/docs/functions/WinGetText.htm"><span style="color: rgb(0, 0, 255);">WinGetText()</span></a> ) then we need to have a way of working out if the function was successful, so we set @error instead.</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="12"></a>12. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#12"><span style="color: rgb(128, 0, 128);">How can I exit my script with a hot-key?</span></a></h4><br />
<p>Ah, an easy one.&nbsp; If you want to make your script exit when you press a certain key combination then use the <a href="http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm"><span style="color: rgb(0, 0, 255);">HotKeySet()</span></a> function to make a user function run when the desired key is pressed.&nbsp; This user function should just contain the <a href="http://www.autoitscript.com/autoit3/docs/keywords/Exit.htm"><span style="color: rgb(0, 0, 255);">Exit</span></a> keyword.</p><br />
<p>Here some code that will cause the script to exit when CTRL+ALT+x is pressed:<br />
</p><br />
<p class="code">HotKeySet("^!x", "MyExit")<br />
<br />
...<br />
<br />
...<br />
<br />
; Rest of Script<br />
<br />
...<br />
<br />
...<br />
<br />
Func MyExit()<br />
<br />
&nbsp;&nbsp;&nbsp; Exit<br />
<br />
EndFunc</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="13"></a>13. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#13"><span style="color: rgb(128, 0, 128);">How can I use a custom icon when compiling my scripts?</span></a></h4><br />
<p>You need to run the full compiler program (rather than just right-clicking a script and selecting compile).&nbsp; <a href="http://www.autoitscript.com/autoit3/docs/intro/compiler.htm"><span style="color: rgb(0, 0, 255);">This page</span></a> describes the compiler in detail.</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="14"></a>14. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#14"><span style="color: rgb(128, 0, 128);">How can I make sure only one copy of my script is run?</span></a></h4><br />
<p>Use the _Singleton() function. See the User Defined Functions documentation for more information on _Singleton() and how to use it.</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="15"></a>15. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#15"><span style="color: rgb(128, 0, 128);">What are the current technical limits of AutoIt v3?</span></a></h4><br />
<p>Here are details of the current technical limits of AutoIt. Please note that some of the limits are theoretical and you may run into performance or memory related problems before you reach the actual limit.</p><br />
<p>Maximum length of a single script line: 4,095<br />
<br />
Maximum string length: 2,147,483,647 characters</p><br />
<p>Number range (floating point): 1.7E–308 to 1.7E+308 with 15-digit precision<br />
<br />
Number range (integers): 64-bit signed integer<br />
<br />
Hexadecimal numbers: 32-bit signed integer (0x80000000 to 0x7FFFFFFF)</p><br />
<p>Arrays: A maximum of 64 dimensions and/or a total of 16 million elements<br />
<br />
Maximum depth of recursive function calls: 5100 levels</p><br />
<p>Maximum number of variables in use at one time: No limit<br />
<br />
Maximum number of user defined functions: No limit</p><br />
<p>Maximum number of GUI windows: No limit<br />
<br />
Maximum number of GUI controls: 65532</p><br />
<p>&nbsp;</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<p><span style="color: rgb(128, 0, 128);">&nbsp;</span></p><br />
<h4><a id="16"></a>16. <a href="http://www.autoitscript.com/autoit3/docs/faq.htm#15"><span style="color: rgb(128, 0, 128);">I get a missing picture symbol in the Help file under the Examples.</span></a></h4><br />
<p>This should be the Open button that enable you to open the Examples in the Help file.<br />
<br />
This issue is that the hhctrl.ocx isn't properly registered or corrupted.<br />
<br />
Try registering it by doing "regsvr32 hhctrl.ocx" from the command prompt or check if the file is still valid.<br />
</p><br />
<p><a href="http://www.autoitscript.com/autoit3/docs/faq.htm#FAQ"><span style="color: rgb(128, 0, 128);">Back To Top</span></a></p><br />
<p>&nbsp;</p><br />
<p style="text-align: right;">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1240236">스프링노트</a>에서 작성되었습니다.</p><br/><br/>tag : <a href="/tag/AutoIt" rel="tag">AutoIt</a>,&nbsp;<a href="/tag/Programming" rel="tag">Programming</a>			 ]]> 
		</description>
		<category>AutoIt</category>
		<category>AutoIt</category>
		<category>Programming</category>

		<comments>http://v0nsch3.egloos.com/811622#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:26:37 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ AutoIt GUI Reference - OnEvent Mode ]]> </title>
		<link>http://v0nsch3.egloos.com/811609</link>
		<guid>http://v0nsch3.egloos.com/811609</guid>
		<description>
			<![CDATA[ 
  <h1><a href="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_OnEventMode.htm" title="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_OnEventMode.htm" target="_blank" class="external newWindow"><span class="xquared_marker" id="xquared_marker_0"></span>GUI Reference - OnEvent Mode</a></h1><br />
<p>OnEvent 모드에서는&nbsp;GUI가 사용자의 스크립트를 멈추도록 만드는 어떤 것을이&nbsp;일어났는지 알기 위해 GUI를&nbsp;항상 Polling하는 대신에 이벤트를 처리하기 위해&nbsp;사용자가 미리 정의한 함수를 호출한다.&nbsp;예를들어, 사용자가 Button1을 클릭하면 GUI는 사용자의 메인 스크립트를 중지시키고 Button1과 연관된 미리&nbsp;사용자가 정의한 함수를 호출한다.&nbsp;미리 정의된 함수의 호출이 끝나고 나면 메인 스크립트가 재시작된다. 이 모드는&nbsp;Visual Basic forms&nbsp;metohd와 유사하다.</p><br />
<p>&nbsp;</p><br />
<p>GUI가 실행될 때,&nbsp;사용자의 메인&nbsp;스크립트는 임의의&nbsp;스크립트를&nbsp;실행시킬 수 있다.</p><br />
<p>&nbsp;</p><br />
<p>Default 모드는 MessageLoop 모드이므로 OnEvent 모드를 사용하기&nbsp;전에 Opt("GUIOnEventMode", 1)을&nbsp;호출해야 한다.</p><br />
<p>&nbsp;</p><br />
<p>기본적인 OnEvent&nbsp;형식</p><br />
<p>일반적인 OnEvent&nbsp;코드의 형태는 다음과 같다.</p><br />
<ol class="code"><br />
<li>While 1</li><br />
<li><br />
<p style="margin-left: 2em;">Sleep(1000)&nbsp;&nbsp;&nbsp;; Just idle around</p><br />
</li><br />
<li>WEnd</li><br />
<li>Func Event1()</li><br />
<li><br />
<p style="margin-left: 2em;">; Code to handle event goes&nbsp;here</p><br />
</li><br />
<li>EndFunc</li><br />
<li>Func Event2()</li><br />
<li><br />
<p style="margin-left: 2em;">; Code to handle event goes here</p><br />
</li><br />
<li>EndFunc</li><br />
</ol><br />
<p>&nbsp;</p><br />
<h2>GUI 이멘트</h2><br />
<p>OnEvent 모드에서 사용자 GUI는&nbsp;다음과 같은 이벤트들을&nbsp;생성할 수 있다.</p><br />
<p>컨트롤 이벤트</p><br />
<p>시스템 이벤트</p><br />
<p>&nbsp;</p><br />
<p>GUI에 대해서는 GUISetOnEvent 또는 컨트롤에 대해서는 GUICtrlSetOnEvent가 정의되어 있고 둘중 하나의 이벤트가 발생하면 사용자가 미리 정의한 함수를 호출한다. 이벤트에 대해 미리 정의된 함수가 없다면, 그 이벤트는 무시된다.&nbsp;When inside this called function various macros will be set to values to help process the event.</p><br />
<table class="datatable"><br />
<tbody><br />
<tr><br />
<td>매크로</td><br />
<td>설명</td><br />
</tr><br />
<tr><br />
<td>@GUI_CTRLID</td><br />
<td>메시지 또는&nbsp;시스템 ID를 전달하는 컨트롤의 ID를</td><br />
</tr><br />
<tr><br />
<td>@GUI_WINHANDLE</td><br />
<td>메시지를 전달하는&nbsp;GUI 핸들</td><br />
</tr><br />
<tr><br />
<td>@GUI_CTRLHANDLE</td><br />
<td>메시지를 전달하는 컨트롤의 핸들</td><br />
</tr><br />
</tbody><br />
</table><br />
<p>Note :&nbsp;다양한 이벤트에 대한 같은 함수를 사용하는 것은 가능하다. 이러한 경우 사용자가 필요한 것은 @GUI_CTRLID를 기반으로 한 액션을 처리하는 것이다.&nbsp;예를 들어, 사용자는 모든 시스템 이벤트에 대해 동일한&nbsp;함수를 등록할 수 있다.</p><br />
<p>&nbsp;</p><br />
<p><strong>컨트롤&nbsp;이벤트</strong></p><br />
<p>컨트롤이 클릭되거나 변화되면 컨트롤 이벤트가 발생한다.&nbsp;CUICtrlSetEvent를 통해 정의된 함수에 이벤트가 전달된다. 내부적으로 사용자가 정의한 함수에<span style="color: rgb(0, 0, 0);">서</span> @GUI_CTRLID은&nbsp;GUICtrlCreate...를 통해&nbsp;컨트롤을 만들때 리턴된 controlID이 정의된다.</p><br />
<p>&nbsp;</p><br />
<p><strong>시스템 이벤트</strong></p><br />
<p>GUI를 닫는 것과 같은&nbsp;시스템 이벤트는 컨트롤 이벤트와 유사하게 전달되지만&nbsp;컨트롤&nbsp;이벤트는 @GUI_CTRLID에 의해&nbsp;정의된다.&nbsp;이벤트는 GUISetOnEvent에 의해 정의된 함수에&nbsp;전달된다. 가능한 시스템 이벤트는 값은 다음과 같다.</p><br />
<p>&nbsp;</p><br />
<ul class="list-type-5"><br />
<li>$GUI_EVENT_CLOSE</li><br />
<li>$GUI_EVENT_MINIMIZE</li><br />
<li>$GUI_EVENT_RESTORE</li><br />
<li>$GUI_EVENT_MAXIMIZE</li><br />
<li>$GUI_EVENT_PRIMARYDOWN</li><br />
<li>$GUI_EVENT_PRIMARYUP</li><br />
<li>$GUI_EVENT_SECONDARYDOWN</li><br />
<li>$GUI_EVENT_SECONDARYUP</li><br />
<li>$GUI_EVENT_MOUSEMOVE</li><br />
<li>$GUI_EVENT_RESIZED</li><br />
<li>$GUI_EVENT_DROPPED<br />
</li><br />
</ul><br />
<h2>GUI 예제</h2><br />
<p>사용자는 위에서 언급한&nbsp;이벤트 메시지중 몇몇와 OnEvent를 사용하여 코드를 끝낼 수 있다.</p><br />
<p style="margin-left: 2em;">&nbsp;</p><br />
<ol class="code"><br />
<li>#include &lt;GUIConstantsEx.au3&gt;</li><br />
<li>Opt("GUIOnEventMode", 1)<br />
<br />
$mainwindow = GUICreate("Hello World", 200, 100)<br />
<br />
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")<br />
<br />
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)<br />
<br />
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)<br />
<br />
GUICtrlSetOnEvent($okbutton, "OKButton")<br />
<br />
GUISetState(@SW_SHOW)</li><br />
<li>While 1<br />
<br />
&nbsp;&nbsp;&nbsp;Sleep(1000)<br />
<br />
WEnd</li><br />
<li>Func OKButton()<br />
<br />
&nbsp;&nbsp;&nbsp;;Note : at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,<br />
<br />
&nbsp;&nbsp;&nbsp;; and @GUI_WINHANDLE would equal $mainwindow<br />
<br />
&nbsp;&nbsp;&nbsp;MsgBox(0, "GUI Event", "You pressed OK!")<br />
<br />
Exit<br />
<br />
EndFunc</li><br />
<li>Func CLOSEClicked()<br />
<br />
&nbsp;&nbsp;&nbsp;;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE<br />
<br />
&nbsp;&nbsp;&nbsp;; and @GUI_WinHandle would equal $mainwindow<br />
<br />
&nbsp;&nbsp;&nbsp;MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")<br />
<br />
&nbsp;&nbsp;&nbsp;Exit<br />
<br />
EndFunc<br />
</li><br />
</ol><br />
<p>&nbsp;</p><br />
<h2>발전된&nbsp;오퍼레이션과&nbsp;다수의 윈도우</h2><br />
<p>다수의 윈도우에서도 ControlID는 유일하다. 그러나 사용자는 어떻게 다수의 윈도우를 처리할 수 있을까?</p><br />
<p>여기 다른 Dummy 윈도우와 함께&nbsp;처리하는 유사한 예제가 있다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>#include &lt;GUIConstantsEx.au3&gt;</li><br />
<li>Opt("GUIOnEventMode", 1)<br />
<br />
$mainwindow = GUICreate("Hello World", 200, 100)<br />
<br />
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")<br />
<br />
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)<br />
<br />
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)<br />
<br />
GUICtrlSetOnEvent($okbutton, "OKButton")</li><br />
<li>$dummywindow = GUICreate("Dummy window for testing ", 200, 100)<br />
<br />
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")</li><br />
<li>GUISwitch($mainwindow)<br />
<br />
GUISetState(@SW_SHOW)</li><br />
<li>While 1<br />
<br />
&nbsp;&nbsp;&nbsp;Sleep(1000)<br />
<br />
WEnd</li><br />
<li>Func OKButton()<br />
<br />
&nbsp;&nbsp;&nbsp;;Note : at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,<br />
<br />
&nbsp;&nbsp;&nbsp;; and @GUI_WINHANDLE would equal $mainwindow<br />
<br />
&nbsp;&nbsp;&nbsp;MsgBox(0, "GUI Event", "You pressed OK!")<br />
<br />
&nbsp;&nbsp;&nbsp;Exit<br />
<br />
EndFunc</li><br />
<li>Func CLOSEClicked()<br />
<br />
&nbsp;&nbsp;&nbsp;;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE<br />
<br />
&nbsp;&nbsp;&nbsp;; and @GUI_WinHandle would equal $mainwindow<br />
<br />
&nbsp;&nbsp;&nbsp;If @GUI_WinHandle = $mainwindow Then<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit<br />
<br />
&nbsp;&nbsp;&nbsp;EndIf<br />
<br />
EndFunc<br />
</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>첫번째 변화는 GUISwitch 함수의 호출이다. 새로운 윈도우가 만들어지면 추후에 발생하는 GUI 오퍼레이션이 Default 윈도우가 된다.(컨트롤 생성을 포함해서) 이와 같은 예제의 경우, "Hello World" 윈도우를 통해 작업해야 한다. 그래서 Switch가 필요하다. 몇몇 GUI 함수는 호출하는 그 자체로 사용자가 윈도우 핸들의 사용하는 것을 허용한다. 이러한 함수들은 윈도우를 자동으로 스위치한다. 그러기 위해서는 다음과 같이 함수를 호출한다.</p><br />
<ol class="code"><br />
<li>GUISetState(@SW_SHOW, $mainwindow)</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>위의 코드에서는 두 개의 윈도우에 대해 버튼을 "Close"하는 이벤트를 처리하기 위해 같은 OnEvent 함수를 사용했고 어<span style="color: rgb(0, 0, 0);">떤 윈도우가 메시지를 전전달했는지 알기 위해&nbsp;</span>@GUI_WINHANDLE를 사용했다.(사용자가 Close 버튼을 클릭했을 때,&nbsp;메시지는 메인 윈도우로부터 전달된 된다.) 사용자가 희망한다면 각각의 윈도우에 대해 함수들을 분리할 수 있다.</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p style="text-align: right;">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1249410">스프링노트</a>에서 작성되었습니다.</p><br/><br/>tag : <a href="/tag/AutoIt" rel="tag">AutoIt</a>,&nbsp;<a href="/tag/Programming" rel="tag">Programming</a>			 ]]> 
		</description>
		<category>AutoIt</category>
		<category>AutoIt</category>
		<category>Programming</category>

		<comments>http://v0nsch3.egloos.com/811609#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:22:32 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ AutoIt GUI Reference - MessageLoop Mode ]]> </title>
		<link>http://v0nsch3.egloos.com/811608</link>
		<guid>http://v0nsch3.egloos.com/811608</guid>
		<description>
			<![CDATA[ 
  <h1><a href="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm" title="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm" target="_blank" class="external newWindow">GUI Reference - MessageLoop Mode</a></h1><br />
<p>Message-loop 모드에서 사용자 스크립트는 tight-loop에서 대부분의 시간을&nbsp;보낸다.&nbsp;이 루프는 GUIGetMsg 함수를 사용하여 GUI를 Pool한다. 이벤트가 발생할 때, GUIGetMsg 함수의 리턴 값은 이벤트에 대한 자세한 사항을 나타낸다. MessageLoop 모드는 AutoIt GUI에 대한 기본 메시지 모드이며 다른 가능한 모드는 OnEvent 모드가 있다.</p><br />
<p>&nbsp;</p><br />
<p><strong>In the MessageLoop mode you will only receive events while you are actively polling the GUIGetMsg function so you must ensure that you call it many times a second otherwise your GUI will be unresponsive.</strong></p><br />
<p>&nbsp;</p><br />
<h2>기본 MessageLoop 형태</h2><br />
<p>&nbsp;</p><br />
<p>MessageLoop 코드의 일반적인 형태</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>Whilw 1</li><br />
<li><br />
<p style="margin-left: 2em;">$msg = GUIGetMsg()</p><br />
</li><br />
<li><br />
<p style="margin-left: 2em;">...</p><br />
</li><br />
<li><br />
<p style="margin-left: 2em;">...</p><br />
</li><br />
<li>WEnd</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>Usually a tight loop like the one shown would send the CPU to 100% - fortunately the <a href="http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm"><span style="color: rgb(0, 0, 255);">GUIGetMsg</span></a> function automatically idles the CPU when there are no events waiting. Do <strong>not</strong> put a manual sleep in the loop for fear of stressing the CPU - this will only cause the GUI to become unresponsive.</p><br />
<p>&nbsp;</p><br />
<h2>GUI Events</h2><br />
<p>GUIGetMsg가 리턴하는 이벤트 메시지는&nbsp;세가지가 있다.</p><br />
<ul class="list-type-5"><br />
<li>이벤트 없음(No Event)</li><br />
<li>컨트롤 이벤트(Control Event)</li><br />
<li>시스템 이벤트(System Event)</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>이벤트 없음(No Event)</strong></p><br />
<p>이벤트가 없을 때, GUIGetMsg가&nbsp;리턴하는 0을 처리하는 것을 기다린다.</p><br />
<p>&nbsp;</p><br />
<p><strong>컨트롤 이벤트(Control Event)</strong></p><br />
<p>사용자가 컨트롤을 클릭하거나 변경하여&nbsp;이벤트가 전달되면, 이 이벤트는 GUICtrlCreate... 함수들에 의해 컨트롤을 만들었을때&nbsp;생성된&nbsp;controlID에 해당하는 양수 값이다.</p><br />
<p>&nbsp;</p><br />
<p><strong>시스템 이벤트(System Event)</strong></p><br />
<p>시스템 이벤트는 GUI를 닫는 것과 같은 음수 값이다. 다른 이벤트들은 아래와 같으며, GUIConstantEx.au3에 정의되어 있다.</p><br />
<ul class="list-type-5"><br />
<li>$GUI_EVENT_CLOSE</li><br />
<li>$GUI_EVENT_MINIMIZE</li><br />
<li>$GUI_EVENT_RESTORE</li><br />
<li>$GUI_EVENT_MAXIMIZE</li><br />
<li>$GUI_EVENT_PRIMARYDOWN</li><br />
<li>$GUI_EVENT_PRIMARYUP</li><br />
<li>$GUI_EVENT_SECONDARYDOWN</li><br />
<li>$GUI_EVENT_SECONDARYUP</li><br />
<li>$GUI_EVENT_MOUSEMOVE</li><br />
<li>$GUI_EVENT_RESIZED</li><br />
<li>$GUI_EVENT_DROPPED</li><br />
</ul><br />
<p>&nbsp;</p><br />
<h2>예제&nbsp;GUI</h2><br />
<p>GUI Referance page에서 아래에 있는 Hello World 예제를 보았다.</p><br />
<p>#include &lt;GUIConstantsEx.au3&gt;</p><br />
<p>&nbsp;</p><br />
<p>GUICreate("Hello World", 200, 100)</p><br />
<p>GUICtrlCreateLabel("Hello world! How are you?",&nbsp;30, 10)</p><br />
<p>GUICtrlCreateButton("OK", 70, 50,&nbsp;60)</p><br />
<p>GUISetState(@SW_SHOW)</p><br />
<p>Sleep(2000)</p><br />
<p>&nbsp;</p><br />
<p>자,&nbsp;우리는 MessageLoop를 사용한 코드를 끝낼 것이며 몇몇 이벤트 메시지들을 위에서 설명했다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>#include &lt;GUIConstantsEx.au3&gt;</li><br />
<li>GUICreate("Hello Word", 200, 100)</li><br />
<li>GUICtrlCreateLabel("Hello World! How are&nbsp;you?", 30, 10)</li><br />
<li>$okbutton =&nbsp;GUICtrlCreateButton("OK", 70, 50, 60)</li><br />
<li>GUISetState(@SW_SHOW)</li><br />
<li>While 1</li><br />
<li><br />
<p style="margin-left: 2em;">$msg = GUIGetMsg()</p><br />
</li><br />
<li><br />
<p style="margin-left: 2em;">Select</p><br />
</li><br />
<li><br />
<p style="margin-left: 4em;">Case $msg = $okbutton</p><br />
</li><br />
<li><br />
<p style="margin-left: 6em;">MsgBox(0, "GUI Event", "You pressed OK!")</p><br />
</li><br />
<li><br />
<p style="margin-left: 4em;">Case $msg = $GUI_EVENT_CLOSE</p><br />
</li><br />
<li><br />
<p style="margin-left: 6em;">MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")</p><br />
</li><br />
<li><br />
<p style="margin-left: 6em;">ExitLoop</p><br />
</li><br />
<li><br />
<p style="margin-left: 2em;">EndSelect</p><br />
</li><br />
<li>WEnd</li><br />
</ol><br />
<p>&nbsp;</p><br />
<h2>발전된 GUIGetMsg와 다수의 윈도우</h2><br />
<p>사용자가 다수의 윈도우들을 가지고 있더라고 Control_ID들은&nbsp;유일하기 때문에, 위의 코드는 다수의 윈도우와 컨트롤이 있다 하더라도 잘 동작한다. 그러나 $GUI_EVENT_CLOSE 또는 $GUI_MOUSEMOVE와 같은 이벤트들을 처리할 때, 어떤 윈도위가 이벤트를 발생시켰는지 알아야 할 필요가 있다. 이것을 하기 위해서 사용자는 GUIGetMsg를 다음과 같이 호출해야 한다.</p><br />
<ol class="code"><br />
<li>$msg = GUIGetMsg(1)</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>사용자가 파라미터 1을&nbsp;가지고 호출하면 이벤트 값을 리턴하는 대신&nbsp;배열을 리턴한다. 이 배열은 $array[0]에 이벤트 값을 저장하고 있고 윈도우 핸들($array[1]과 같은 남은 정보들을 저장한다. 이전 예제에서 두 개의 윈도우가 만들어졌다면, 코드를 다음과 같이 작성해야 한다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>#include &lt;GUIConstantsEx.au3&gt;</li><br />
<li>$mainwindow = GUICreate("Hello World", 200, 100)<br />
<br />
GUICtrlCreateLabel("Hello World! How are you?", 30, 10)<br />
<br />
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)<br />
<br />
$dummywindows = GUICreate("Dummy window for testing ", 200, 100)</li><br />
<li>GUISwitch($mainwindow)<br />
<br />
GUISetState(@SW_SHOW)</li><br />
<li>While 1<br />
<br />
&nbsp;&nbsp;&nbsp;$msg = GUIGetMsg(1)<br />
<br />
&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;Select<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case $msg[0] = $okbutton<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MsgBox(0, "GUI Event", "You pressed OK!")<br />
<br />
&nbsp;&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case $msg[0] = $GUI_EVENT_CLOSE and $msg[1] = $mainwindow<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MsgBox(0, "GUI Event", "You clicked CLOSE on the main window! Exiting...")<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExitLoop<br />
<br />
&nbsp;&nbsp;&nbsp;EndSelect<br />
<br />
WEnd</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>첫번째 주요 변화는 GUISwitch 함수의 호출이다. 하나의 새로운 윈도우가 만들어지면 향후 GUI 작업을 위한 기본 윈도우가 된다.(컨트롤의 생성도 포함된다.)&nbsp;사용자는 테스트 윈도우가 아닌 메인 "Hellow World" 윈도우를 가지고 작업하기를 원한다.몇몇&nbsp; GUI 함수는 사용자가 함수 스스로 윈도우 핸들을 사용하도록 허락한다. 사용자는&nbsp;다음 함수를 사용하여&nbsp;사용될 윈도우 핸들에 대해 자동으로 전환할 수 있다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>GUISetState(@SW_SHOW, $mainwindow)</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>&nbsp;다음 변화는 GUIGetMsg 함수가 호출되는 방법과 이벤트들이 어떻게 확인되는지($msg[0]과 $msg[1]을 사용하여)에 대한 것이다. 이 스크립트는 Close 이벤트가 메인 윈도우로부터 발생하면 종료된다.</p><br />
<p>&nbsp;</p><br />
<p style="text-align: right;">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1256600">스프링노트</a>에서 작성되었습니다.</p><br/><br/>tag : <a href="/tag/AutoIt" rel="tag">AutoIt</a>,&nbsp;<a href="/tag/Programming" rel="tag">Programming</a>			 ]]> 
		</description>
		<category>AutoIt</category>
		<category>AutoIt</category>
		<category>Programming</category>

		<comments>http://v0nsch3.egloos.com/811608#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:22:02 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ AutoIt GUI Reference - GUI Concepts ]]> </title>
		<link>http://v0nsch3.egloos.com/811607</link>
		<guid>http://v0nsch3.egloos.com/811607</guid>
		<description>
			<![CDATA[ 
  <h1><a href="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef.htm" title="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef.htm" target="_blank" class="external newWindow">GUI Reference</a></h1><br />
<p>AutoIt은&nbsp;GUI를 구성하는&nbsp;윈도우와 컨트롤을 쉽게 만들&nbsp;수 있다.</p><br />
<p>&nbsp;</p><br />
<h2>GUI Concepts</h2><br />
<p>GUI는 하나 이상의 윈도우를 가지고 있으며&nbsp;윈도우는 하나 이상의 컨트롤들을 가지고 있다. GUI는 "Event Driven"으로 사용자가 버튼을 클릭하는 것과 같은 이벤트를 발생시킨다는 것을 의미한다. 사용자는 어떤 이벤트가 발생하기를 기다리는데 많은 시간을 소비한다. 이점이 다른 스크립트와 다른 점이다. 물론 GUI가 활성화 될 때까지 다른 일을 하도록 할 수 있다.</p><br />
<p>&nbsp;</p><br />
<h2>GUI&nbsp;컨트롤</h2><br />
<p>사용자가 윈도우에서 클릭할 수 있는 임의의 것들이 모두 컨트롤이다. AutoIt이&nbsp;만들 수 있는 컨트롤은 다음과 같다.</p><br />
<p>&nbsp;</p><br />
<ul class="list-type-5"><br />
<li>Label - A plain piece of text.</li><br />
<li>Button - A simple button.</li><br />
<li>Input - A single line control that you can enter text into.</li><br />
<li>Edit - A multi-line control that you can enter text into.</li><br />
<li>Checkbox - A box that can be "checked" or "unchecked".</li><br />
<li>Radio - A set of circular buttons - only one can be active at once.</li><br />
<li>Combo - A list with a dropdown box.</li><br />
<li>List - A list.</li><br />
<li>Date - A date picker.</li><br />
<li>Pic - A picture.</li><br />
<li>Icon - An icon.</li><br />
<li>Progress - A progress bar.</li><br />
<li>Tab - A group of controls that are contained in tabs.</li><br />
<li>UpDown - A control that can be added to input controls.</li><br />
<li>Avi - Display an AVI format clip.</li><br />
<li>Menu - A menu across the top of the window.</li><br />
<li>ContextMenu - A menu that appears when you right click inside the window.</li><br />
<li>TreeView - A control similar to the windows file-explorer.</li><br />
<li>Slider - A control similar to the windows sound volume control.</li><br />
<li>ListView - A control displaying columns information.</li><br />
<li>ListViewItem - A control displaying item in a listview control.</li><br />
<li>Graphic - A control displaying graphics drawn with GUICtrlSetGraphic.</li><br />
<li>Dummy - A dummy user control</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p>컨트롤은 GUICtrlCreate...와 같은 함수들의 집합으로 만들 수 있다. 컨트롤이 만들어지면&nbsp;<strong>Control ID</strong>를 리턴한다.</p><br />
<ul class="list-type-5"><br />
<li>Control ID는 양수이다.</li><br />
<li>각각의&nbsp;Control ID는 유일하다.</li><br />
<li>Control ID는 AutoIt Window Info Tool에서 보여주는&nbsp;Control ID와 같은 값이다.</li><br />
</ul><br />
<p>&nbsp;</p><br />
<h2>GUI 기초 함수</h2><br />
<table class="datatable"><br />
<tbody><br />
<tr><br />
<td><strong>함수</strong></td><br />
<td><strong>설명</strong></td><br />
</tr><br />
<tr><br />
<td>GUICreate</td><br />
<td>윈도우를 생성한다.</td><br />
</tr><br />
<tr><br />
<td>GUICtrlCreate...</td><br />
<td>윈도우에 다양한 컨트롤을&nbsp;생성한다.</td><br />
</tr><br />
<tr><br />
<td>GUISetState</td><br />
<td>윈도우를&nbsp;보여주거나 숨긴다.</td><br />
</tr><br />
<tr><br />
<td>GUIGetMsg</td><br />
<td>이벤트가&nbsp;발생한 것을 보기 위해&nbsp;GUI를&nbsp;Poll한다.</td><br />
</tr><br />
<tr><br />
<td>GUICtrlRead</td><br />
<td>컨트롤에서 데이터를&nbsp;읽는다.</td><br />
</tr><br />
<tr><br />
<td>GUICtrlSetData</td><br />
<td>컨트롤의 데이터를&nbsp;정의하거나 변환한다.</td><br />
</tr><br />
<tr><br />
<td>GUICtrlSet...</td><br />
<td>컨트롤에 대한 다양한&nbsp;옵션을 변경한다.</td><br />
</tr><br />
</tbody><br />
</table><br />
<p>GUI와 연관된 기초적인 상수를 사용하기 위해 #include &lt;GUIConstantsEx.au3&gt;가 필요하다.</p><br />
<p>&nbsp;</p><br />
<p>먼저 "Hello World"를&nbsp;호출하는&nbsp;윈도우를 만들어보자.&nbsp;윈도우를 새로 만들면 Hidden 상태이므로 만드시 "show"해야 한다.</p><br />
<ol class="code"><br />
<li>#include &lt;GUIConstantsEx.au3&gt;</li><br />
<li>GUICreate("Hello World", 200, 100)</li><br />
<li>GUISetState(@SW_SHOW)</li><br />
<li>Sleep(2000)</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>위에서 만든 윈도우에 텍스트와 OK 버튼을 추가하자.</p><br />
<p>텍스트는 30, 10 위치에 추가하고 버튼은 70, 50 위치에&nbsp;폭 60픽셀로 추가한다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>#include &lt;GUIConstantsEx.au3&gt;</li><br />
<li>GUICreate("Hello World", 200, 100)<br />
<br />
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)<br />
<br />
GUICtrlCreateButton("OK", 70, 50, 60)<br />
<br />
GUISetState(@SW_SHOW)<br />
<br />
Sleep(2000)</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>이제 OK 버튼을 클릭하여 어떻게 동작하게 해야 할까? 이와 같은 것을 하기위해서는 <strong>MessageLoop</strong> 또는 <strong>OnEvent</strong> 함수들을 통해 이벤트를 처리해야 한다.&nbsp;기본값은 MessageLoop 모드이고 OnEvent 모드로 전환하기 위해서 Opt("GUIOnEventMode", 1)을 호출한다.</p><br />
<p>&nbsp;</p><br />
<p><strong>Message-loop Mode (default)</strong></p><br />
<p>Message-loop 모드에서 사용자 스크립트는 tight-loop에서 대부분의 시간을&nbsp;보낸다.&nbsp;이 루프는 GUIGetMsg 함수를 사용하여 GUI를 Pool한다. When an event has occurred the return value of the GUIGetMsg function will show the details (a button is clicked, the GUI has been closed, etc.).</p><br />
<p>In this mode you will only receive events while you are actively polling the GUIGetMsg function so you must ensure that you call it many times a second otherwise your GUI will be unresponsive.</p><br />
<p><em>This mode is best for GUIs where the GUI is "king" and all you care about is waiting for user events.</em></p><br />
<p>See <a href="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm"><span style="color: rgb(0, 0, 255);">this page</span></a> for a more detailed explanation of the <a href="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm"><span style="color: rgb(0, 0, 255);">MessageLoop mode</span></a>.</p><br />
<p>&nbsp;</p><br />
<p><strong>OnEvent Mode</strong></p><br />
<p>In the OnEvent mode instead of constantly polling the GUI to find out if anything has happened you make the GUI temporarily pause your script and call a pre-defined function to handle the event. For example, if the user clicks Button1 the GUI halts your main script and calls a previously defined user function that deals with Button1. When the function call is completed the main script is resumed. This mode is similar to the Visual Basic forms method.</p><br />
<p><em>This mode is best for GUIs where the GUI is of secondary importance and your script has other tasks to perform in addition to looking after the GUI.</em></p><br />
<p>See <a href="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_OnEventMode.htm"><span style="color: rgb(0, 0, 255);">this page</span></a> for a more detailed explanation of the <a href="http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_OnEventMode.htm"><span style="color: rgb(0, 0, 255);">OnEvent</span></a> mode.</p><br />
<p style="text-align: right;">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1256342">스프링노트</a>에서 작성되었습니다.</p><br/><br/>tag : <a href="/tag/AutoIt" rel="tag">AutoIt</a>,&nbsp;<a href="/tag/Programming" rel="tag">Programming</a>			 ]]> 
		</description>
		<category>AutoIt</category>
		<category>AutoIt</category>
		<category>Programming</category>

		<comments>http://v0nsch3.egloos.com/811607#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:21:52 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ AutoIt Tutorial - Simple Notepad Automation ]]> </title>
		<link>http://v0nsch3.egloos.com/811603</link>
		<guid>http://v0nsch3.egloos.com/811603</guid>
		<description>
			<![CDATA[ 
  <h1><a href="http://www.autoitscript.com/autoit3/docs/tutorials/notepad/notepad.htm" title="http://www.autoitscript.com/autoit3/docs/tutorials/notepad/notepad.htm" target="_blank" class="external newWindow">Tutorial - Notepad</a></h1><br />
<p>다음 예제는&nbsp;메모장을&nbsp;자동으로 열고 임의의 문자를 자동으로 추가하고 메모장을 닫는 것을 보여준다.</p><br />
<p>&nbsp;</p><br />
<p>우선 npad.au3라 불리는 빈 스크립트 파일을 만들고 파일을 수정한다.</p><br />
<p>&nbsp;</p><br />
<p>메모장을 실행하기 위해서 AutoIt은 Run 함수를 사용한다. 이 함수는 간단하게 주어진 실행가능한&nbsp;응용프로그램을 실행한다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>Run("notepad.exe")<br />
<br />
WinWaitActive("제목 없음 - 메모장")<br />
<br />
Send("This is some text.")<br />
<br />
WinClose("제목 없음 - 메모장")<br />
<br />
WinWaitActive("메모장", "변경된 내용을 저장하시겠습니까?")<br />
<br />
Send("!n")</li><br />
</ol><br />
<p>&nbsp;</p><br />
<ul class="list-type-5"><br />
<li>Run("notepad.exe") - 메모장 실행</li><br />
<li>WinWaitActive("제목 없음 - 메모장") - 메모장(제목 없음 - 메모장 이라는 제목을 갖고 있는)이 활성화 되는 것을 확인</li><br />
<li>Send("This is some text.") - 메모장에 This is some text. 입력</li><br />
<li>WinClose("제목 없음 - 메모장") - 메모장(제목 없음 - 메모장 이라는 제목을 갖고 있는)을 종료</li><br />
<li>WinWaitActive("메모장", "변경된 내용을 저장하시겠습니까?") - 제목이 "메모장"인 대화상자에 "변경된 내용을 저장하시겠습니까?"라는 문자열을 포함하고 있는 창이 활성화 되는 것을 확인</li><br />
<li>Send("!n") - 키보드&nbsp;"ALT + n"을 입력</li><br />
</ul><br />
<p style="text-align: right;">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1248062">스프링노트</a>에서 작성되었습니다.</p><br/><br/>tag : <a href="/tag/AutoIt" rel="tag">AutoIt</a>,&nbsp;<a href="/tag/Programming" rel="tag">Programming</a>			 ]]> 
		</description>
		<category>AutoIt</category>
		<category>AutoIt</category>
		<category>Programming</category>

		<comments>http://v0nsch3.egloos.com/811603#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:21:06 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ AutoIt Tutorial - HelloWorld ]]> </title>
		<link>http://v0nsch3.egloos.com/811592</link>
		<guid>http://v0nsch3.egloos.com/811592</guid>
		<description>
			<![CDATA[ 
  <h1><a href="http://www.autoitscript.com/autoit3/docs/tutorials/helloworld/helloworld.htm" title="http://www.autoitscript.com/autoit3/docs/tutorials/helloworld/helloworld.htm" target="_blank" class="external newWindow">Tutorial - HelloWorld</a></h1><br />
<p>&nbsp;</p><br />
<p>Tutorial은 AutoIt 스크립트를 만들고 실행하는 기초를 설명한다. Tutorial은&nbsp;이미&nbsp;AutoIt V3가 Full Version으로 설치되어 있다가 가정한다.</p><br />
<p>&nbsp;</p><br />
<ul class="list-type-5"><br />
<li>스크립트를 만들 폴더에서 마우스 오른쪽 버튼을 클릭한 뒤,&nbsp;"새로만들기" -&gt;&nbsp;"AutoIt v3 Script"를 선택한다.</li><br />
<li>만들어진 스크립트 파일의 이름을 "helloworld"로 수정한다.</li><br />
<li>스크립트 파일에서 오른쪽 버튼을 클릭하여 "Edit Script"를 선택한다.</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p style="text-align: center;"><span class="xquared_marker" id="xquared_marker_0"></span><img title="helloworld_init.png" class="attachment" src="http://v0nsch3lling.springnote.com/pages/1247550/attachments/541448" alt="helloworld_init.png">&nbsp;</p><br />
<p>&nbsp;</p><br />
<ul class="list-type-5"><br />
<li>다음 코드를 입력한다.</li><br />
</ul><br />
<ol class="code"><br />
<li>MsgBox(0, "Tutorial", "Hello World!")</li><br />
</ol><br />
<ul class="arrowListType" style="margin-left: 2em;"><br />
<li>MsgBox는 다음&nbsp;파라미터(flag, title, message)들을 인자로 받는다.</li><br />
</ul><br />
<p>&nbsp;</p><br />
<ul class="list-type-5"><br />
<li>스크립트를 저장하고&nbsp;에디터를 닫는 후, 스크립트 파일을 더블클릭하여 실행시킨다.</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p>MsgBox의 flag 파라미터를 살펴보면,&nbsp;flag의 값은 0부터 64의 값을 가질 수 있으며 각각의 flag 값은&nbsp;메시지 박스의 종류를&nbsp;나탄낸다.</p><br />
<ol class="code"><br />
<li>MsgBox(64, "Tutorial", "Hello World!")</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p style="text-align: right;">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1247550">스프링노트</a>에서 작성되었습니다.</p><br/><br/>tag : <a href="/tag/AutoIt" rel="tag">AutoIt</a>,&nbsp;<a href="/tag/Programming" rel="tag">Programming</a>			 ]]> 
		</description>
		<category>AutoIt</category>
		<category>AutoIt</category>
		<category>Programming</category>

		<comments>http://v0nsch3.egloos.com/811592#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:18:34 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ Autoit Introduction ]]> </title>
		<link>http://v0nsch3.egloos.com/811584</link>
		<guid>http://v0nsch3.egloos.com/811584</guid>
		<description>
			<![CDATA[ 
  <p>&nbsp;</p><br />
<p style="text-align: center;"><img src="http://www.autoitscript.com/autoit3/docs/images/autoit_6_240x100.jpg" width="240" height="100"></p><br />
<p style="text-align: center;"><strong>v3.2.12.0</strong></p><br />
<p style="text-align: center;">©1999-2008 Jonathan Bennett &amp; <a href="http://www.autoitscript.com/autoit3/docs/credits.htm"><span style="color: rgb(0, 0, 255);">AutoIt Team</span></a></p><br />
<p style="text-align: center;"><a href="http://www.autoitscript.com/autoit3/" class="ext"><span style="color: rgb(128, 0, 128);">AutoIt v3 Homepage</span></a></p><br />
<p>&nbsp;</p><br />
<h1>Introduction</h1><br />
<p><strong><span style="background-color: rgb(255, 247, 0);">AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting.</span></strong> It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). <strong><span style="background-color: rgb(255, 247, 0);">AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying "runtimes" required!</span></strong><br />
<br />
<br />
<br />
AutoIt was initially designed for PC "roll out" situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect.</p><br />
<p>Features:</p><br />
<ul><br />
<li>Easy to learn BASIC-like syntax</li><br />
<li>Simulate keystrokes and mouse movements</li><br />
<li>Manipulate windows and processes</li><br />
<li><strong>Interact with all standard windows controls</strong></li><br />
<li><strong>Scripts can be compiled into standalone executables</strong></li><br />
<li>Create Graphical User Interfaces (GUIs)</li><br />
<li><strong>COM support</strong></li><br />
<li>Regular expressions</li><br />
<li><strong>Directly call external DLL and Windows API functions</strong></li><br />
<li>Scriptable RunAs functions</li><br />
<li>Detailed helpfile and large community-based support forums</li><br />
<li>Compatible with Windows 95 / 98 / ME / NT4 / 2000 / XP / 2003 / Vista / 2008</li><br />
<li>Unicode and x64 support</li><br />
<li>Digitally signed for peace of mind</li><br />
<li>Works with Windows Vista's User Account Control (UAC)</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p>AutoIt has been designed to be as small as possible and stand-alone with no external .dll files or registry entries required making it safe to use on Servers. <strong><span style="background-color: rgb(255, 247, 0);">Scripts can be compiled into stand-alone executables with Aut2Exe.</span></strong></p><br />
<p>Also <strong><span style="background-color: rgb(255, 247, 0);">supplied is a combined COM and DLL version of AutoIt called AutoItX</span></strong> that allows you to add the unique features of AutoIt to your own favourite scripting or programming languages!</p><br />
<p>Best of all, AutoIt continues to be <strong>FREE</strong> - but if you want to support the time, money and effort spent on the project and web hosting then you may donate at the AutoIt <a href="http://www.autoitscript.com/autoit3/" class="ext"><span style="color: rgb(128, 0, 128);">homepage</span></a>.</p><br />
<p>&nbsp;</p><br />
<h1>Features in Detail</h1><br />
<p><strong>Basic-like Syntax and Rich Function Set</strong></p><br />
<p>AutoIt has a BASIC-like syntax which means that most people who have ever written a script or used a high-level language should be able to pick it up easily.</p><br />
<p>Although it started life as a simple automation tool, AutoIt now has functions and features that allow it to be used as a general purpose scripting language (with awesome automation as well of course!). Language features include:</p><br />
<ul><br />
<li>The usual high-level elements for functions, loops and expression parsing</li><br />
<li>A staggering amount of string handling functions <strong>and</strong> a Perl compatible regular expression engine (using the <a href="http://www.pcre.org/"><span style="color: rgb(0, 0, 255);">PCRE</span></a> library).</li><br />
<li>COM support</li><br />
<li>Call Win32 and third-party DLL APIs</li><br />
</ul><br />
<p>&nbsp;</p><br />
<p><strong>Built-in Editor with Syntax Highlighting</strong></p><br />
<p>AutoIt comes with a customised "lite" version of SciTe that makes editing scripts easy. Users can also <a href="http://www.autoitscript.com/autoit3/scite/"><span style="color: rgb(0, 0, 255);">download a complete version of SciTe</span></a> that includes additional tools to make things even easier.</p><br />
<p>&nbsp;</p><br />
<p><strong>Standalone and Small</strong></p><br />
<p><strong><span style="background-color: rgb(255, 247, 0);">AutoIt is a very small and standalone application with no reliance on massive runtimes like .NET or VB.</span></strong> All you need to run AutoIt scripts are the main AutoIt executable (AutoIt3.exe) and the script. Scripts can also be encoded into standalone executables with the built-in script compiler <strong>Aut2Exe</strong>.</p><br />
<p>&nbsp;</p><br />
<p><strong>International and 64-bit Support</strong></p><br />
<p>AutoIt is fully Unicode aware and also includes x64 versions of all the main components! How many other free scripting languages can you say that about?</p><br />
<p>&nbsp;</p><br />
<p><strong>Key and Mouse Simulation</strong></p><br />
<p>Much time has been spent optimizing the keystroke and mouse simulation functions to be as accurate as possible on all versions of Windows. All the mouse and keyboard routines are highly configurable both in terms of simulation "speed" and functionality.</p><br />
<p>&nbsp;</p><br />
<p><strong>Window Management</strong></p><br />
<p>You can expect to move, hide, show, resize, activate, close and pretty much do what you want with windows. Windows can be referenced by title, text on the window, size, position, class and even internal Win32 API handles.</p><br />
<p>&nbsp;</p><br />
<p><strong>Controls</strong></p><br />
<p>Directly get information on and interact with edit boxes, check boxes, list boxes, combos, buttons, status bars without the risk of keystrokes getting lost.&nbsp; Even work with controls in windows that aren't active!</p><br />
<p>&nbsp;</p><br />
<p><strong>Graphical User Interfaces (GUIs)</strong></p><br />
<p>AutoIt v3 will also allow you to create some complex GUIs - just like those below!</p><br />
<p><img src="http://www.autoitscript.com/autoit3/docs/images/gui_eg1.png" alt="GUI Example 1" width="284" height="302">&nbsp; <img src="http://www.autoitscript.com/autoit3/docs/images/gui_eg2.png" alt="GUI Example 2" width="274" height="302"></p><br />
<p>&nbsp;</p><br />
<p>And much, much more...</p><br />
<p>&nbsp;</p><br />
<p style="text-align: right;">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1230114">스프링노트</a>에서 작성되었습니다.</p><br/><br/>tag : <a href="/tag/AutoIt" rel="tag">AutoIt</a>,&nbsp;<a href="/tag/Programming" rel="tag">Programming</a>			 ]]> 
		</description>
		<category>AutoIt</category>
		<category>AutoIt</category>
		<category>Programming</category>

		<comments>http://v0nsch3.egloos.com/811584#comments</comments>
		<pubDate>Wed, 10 Sep 2008 02:16:27 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ Cross-Site Requestd Forgeries(CSRF) - Peter W ]]> </title>
		<link>http://v0nsch3.egloos.com/803649</link>
		<guid>http://v0nsch3.egloos.com/803649</guid>
		<description>
			<![CDATA[ 
  <p>From: Peter W &lt;<a>peterw@usa.net</a>&gt;<br /><br />
To: John Percival &lt;<a>john@jelsoft.com</a>&gt;<br /><br />
Cc: <a>bugtraq@securityfocus.com</a>, <a>clambert@whitecrown.net</a>, <a>peterw@tux.org</a><br /><br />
Subject: Cross-Site Request Forgeries (Re: The Dangers of Allowing Users to Post Images)<br /><br />
Message-ID: &lt;<a>20010615011542.C22677@usa.net</a>&gt;<br /><br />
References: &lt;<a>04f901c0f437$4911b610$9701a8c0@wellingtoncollege.berks.sch.uk</a>&gt;<br /><br />
In-Reply-To: &lt;<a>04f901c0f437$4911b610$9701a8c0@wellingtoncollege.berks.sch.uk</a>&gt;; from <a>john@jelsoft.com</a> on Wed, Jun 13, 2001 at 07:33:04PM +0100</p><br />
<p>&nbsp;</p><br />
<h1>Cross-Site Request Forgeries(CSRF, pronounced "sea surf")</h1><br />
<p>I hope you don't mind if I expand on this a bit. You've come across the tip, in my opinion, of a rather large iceberg. It's another Web/trust-relationship problem. Many Web applications are fairly good at identifying users and understanding requests, <strong style="BACKGROUND-COLOR: rgb(174,255,102)">but terrible at verifying origins and intent.(Web 응용프로그램은 Request를 보내오는 근원지와 의도 파악이 어렵다.)</strong></p><br />
<p>&nbsp;</p><br />
<p>The problem isn't the IMG tag on the message board, it's the backend app you seek to attack via the IMG tag. And I suspect lots of Web apps are vulnerable. Lots. I've been to training on highly-regarded, widely-used, expensive Web app development frameworks, and none of the classes taught how to avoid the problems I will attempt to describe. In fact, they all seem to teach the "easy way" of handling what look like user requests, which is, of course, the vulnerable way.</p><br />
<p>&nbsp;</p><br />
<p>Anyway, let's look at how your post relates to what I call CSRF.</p><br />
<p>&nbsp;</p><br />
<p>On Wed, Jun 13, 2001 at 07:33:04PM +0100, John Percival wrote:</p><br />
<p>&gt; This exploit shows <strong style="BACKGROUND-COLOR: rgb(174,255,102)">how almost any script that uses cookie session/login data<br /><br />
&gt; to validate CGI forms can be exploited</strong> <strong style="BACKGROUND-COLOR: rgb(174,255,102)">if the users can post images.</strong></p><br />
<p>&gt; What is the problem? Well, by using an [img] (or HTML &lt;img&gt; or &lt;iframe&gt; or<br /><br />
&gt; &lt;script src=""&gt;) tag, the user is having anyone who views the thread access<br /><br />
&gt; that image - <strong style="BACKGROUND-COLOR: rgb(174,255,102)">that is perform an HTTP GET on the URL specified for the image.<br /><br />
&gt; Even if its not an image, it still can be accessed, but will display a<br /><br />
&gt; broken image.(HTTP GET method가 실행된다. img 테그에 이미지에 대한 URL이 없더라도 GET method가 실행된다.)</strong></p><br />
<p>&nbsp;</p><br />
<p>Depending on what's allowed, height/width and CSS/visibility tags can be used <strong style="BACKGROUND-COLOR: rgb(174,255,102)">to hide the broken image icon.(width=0 height=0)</strong></p><br />
<p>&nbsp;</p><br />
<p>&gt; This means that the user can put a CGI script inside [img]<br /><br />
&gt; tags.</p><br />
<p>&nbsp;</p><br />
<p><strong>** Learning from Randal's purple dinosaur?</strong></p><br />
<p>The problem you describe is not uploading images, <strong style="BACKGROUND-COLOR: rgb(174,255,102)">it's allowing users to post code that's inserted in an appropriate HTML tag attribute.</strong> This is something of a variation on Randal Schwartz's purple dinosaur hack,[2] but much more interesting and dangerous than even what you describe.</p><br />
<p>&nbsp;</p><br />
<p>&gt; This script will be called by whoever views that thread. When used<br /><br />
&gt; maliciously, it could force the user to: unknowingly update their profile,<br /><br />
&gt; respond to polls in a certain way, post new messages or threads, email a<br /><br />
&gt; user with whatever text they want, the list goes on. This would be<br /><br />
&gt; particularly worrying for a 'worm' to spread through a forum, filling it<br /><br />
&gt; with rubbish posts.</p><br />
<p>&nbsp;</p><br />
<p><strong>** The difference between XSS and CSRF</strong></p><br />
<p>Right. There's something much larger going on here. Darnit, I wanted to make a nice formal paper out of this, but you're forcing my hand. :-) The problem is what I call CSRF (Cross-Site Request Forgeries, pronounced "sea surf"). <strong style="BACKGROUND-COLOR: rgb(174,255,102)">Any time you can get a user to open an HTML document, you can use things like IMG tags to forge requests, with that user's credentials, to any Web site you want</strong> -- the one the HTML document is on, or any other.</p><br />
<p>&nbsp;</p><br />
<p>This looks somewhat similar to Cross-Site Scripting (XSS), but is not the same. <strong style="BACKGROUND-COLOR: rgb(174,255,102)">XSS aimed at inserting active code in an HTML document to either abuse client-side active scripting holes, or to send privileged information(XSS는 client-side에 위치한 스크립트 취약점을 악용하거나 권한이 부여되어야 볼 수 있는 정보(sessionid, cookie)를 전달하기 위해 HTML 문서에 active code를 삽입하는것)</strong> (e.g., authentication/session cookies) to a previously unknown evil collection site. CSRF does not in any way rely on client-side active scripting, and <strong style="BACKGROUND-COLOR: rgb(174,255,102)">its aim is to take unwanted, unapproved actions on a site where the victim has some prior relationship and authority.(CSRF는 원치안고 검증되는 안은 action을 목적으로 함)</strong></p><br />
<p>&nbsp;</p><br />
<p><strong style="BACKGROUND-COLOR: rgb(174,255,102)">Where XSS sought to steal your online trading cookies so an attacker could manipulate your portfolio, CSRF seeks to use your cookies to force you to execute a trade without your knowledge or consent(XSS는 사용자의 cookie 값을 훔치는 것이고 CSRF는 사용자의 cookie 값을 사용자도 모르는 사이에 공격자가 사용하는 것)</strong> (or, in many cases, the attacker's knowledge, for that matter). [Just an extreme example there; I do not have any idea if any trading sites are vulnerable. I have not tested *any* applications or sites that I don't have some personal involvement in the design and maintenance of. Don't ask me to.]</p><br />
<p><br /><br />
&nbsp;&lt;img src="<a href="https://trading.example.com/xfer?from=MSFT&amp;to=RHAT&amp;confirm=Y">https://trading.example.com/xfer?from=MSFT&amp;to=RHAT&amp;confirm=Y</a>"&gt;<br /><br />
&nbsp;&lt;img src="<a href="https://books.example.com/clickbuy?book=ISBNhere&amp;quantity=100">https://books.example.com/clickbuy?book=ISBNhere&amp;quantity=100</a>"&gt;</p><br />
<p>&nbsp;</p><br />
<p><strong>** Ubiquity of attack channels</strong></p><br />
<p>Since HTML documents are popping up everywhere (even in corporate email systems!!!), and <strong style="BACKGROUND-COLOR: rgb(174,255,102)">it's impossible to discern what IMG or HREF values might be direct CSRF attacks</strong>, or redirect users to unwittingly do dangerous things via CSRF redirects, the fix has to be in the applications that do the<br /><br />
interesting things.</p><br />
<p>&nbsp;</p><br />
<p>&gt; For example, if a user posted something along these lines:<br /><br />
&gt; [img]http://your.forums/forums/newreply.cgi?action=newthread&amp;subject=aaa&amp;bod<br /><br />
&gt; y=some+naughty+words&amp;submit=go[/img]<br /><br />
&gt; Then the post would go through, under the name of whoever viewed the image.<br /><br />
&gt; This is of particular danger when an administrator views an image, which<br /><br />
&gt; then calls a page in an online control panel - thus granting the user access<br /><br />
&gt; to the control panel.</p><br />
<p>&nbsp;</p><br />
<p><strong>** Impossible to filter content</strong></p><br />
<p>Right, and as I say, the site you act against can be somewhere else entirely. Here's what a CSRF attack might look like:<br /><br />
&nbsp;&lt;img src="<a href="http://example.net/logo.gif">http://example.net/logo.gif</a>" height=0 width=0 alt=""&gt;<br /><br />
That's it. <strong style="BACKGROUND-COLOR: rgb(174,255,102)">When your client requests /logo.gif -- exposing no cookies -- the example.net server redirects you to a URL</strong> like the one you show, above. <strong style="BACKGROUND-COLOR: rgb(174,255,102)">So the end result us the same as if the attacker had embedded the more obvious URL inside the IMG tag.</strong></p><br />
<p>&nbsp;</p><br />
<p>If an attacker wants, he can also use a simple, innocent looking hyperlink and hope the victim clicks on it (<a href="http://example.net/kyotoanalysis.htm">http://example.net/kyotoanalysis.htm</a>). You don't allow hyperlinks? Well, someone might copy/paste the link, and be stung that way. They'd notice? Maybe not -- the URL could be a mostly useful page, <strong style="BACKGROUND-COLOR: rgb(174,255,102)">with a tiny frameset sliver that loads your attack URL.</strong></p><br />
<p>&nbsp;</p><br />
<p>&gt; How can it be fixed? Well, there are a couple of ways to stop it, but the<br /><br />
&gt; easiest (in PHP at least) seems to be to have most of the variables used by<br /><br />
&gt; scripts be used through $HTTP_POST_VARS. So instead of checking for $action<br /><br />
&gt; in a script, $HTTP_POST_VARS['action'] would be checked. This forces the<br /><br />
&gt; user to use a POST request, not a GET.</p><br />
<p>&nbsp;</p><br />
<p>which means the attacker reverts to using Javascript, or entices the victim to click on an image that's acting as a submit control in a &lt;form&gt;. Requiring POST raises the bar, but doesn't really fix the problem.</p><br />
<p>&nbsp;</p><br />
<p>&gt; Alternatively, the sessionid could be<br /><br />
&gt; required to come with the GET/POST request variables, rather than by cookie.</p><br />
<p>&nbsp;</p><br />
<p>...thereby exposing an important piece of authentication information to history files and proxy servers; I really don't like URL mangling for authentication purposes, especially in non-SSL systems. A combination of cookie + URL mangling might not be bad, though in the message board case, a CSRF attacker could use an intermediate redirect (as described earlier) to get the URL mangling (from the Referer), and redirect back to the<br /><br />
messageboard with the proper mangling as well as all cookies that might be expected/needed. So in your example case, URL mangling would buy nothing. :-(</p><br />
<p>&nbsp;</p><br />
<p>&gt; Finally, in the specific case of [img] tags, the use of ? or &amp; in the img<br /><br />
&gt; URL can be disabled by some regexes.</p><br />
<p>&nbsp;</p><br />
<p>Not at all adequate. Browsers follow redirects on IMG tags, so I redirect you to <a href="http://example.net/logo.gif">http://example.net/logo.gif</a> which in turn redirects you to the final URL, as described earlier.</p><br />
<p>&nbsp;</p><br />
<p><strong style="BACKGROUND-COLOR: rgb(174,255,102)">&gt; If the software that you run is not secure, we recommend that you disable<br /><br />
&gt; HTML and/or [img] tags, until the fixes have been implemented.(해결책이 나오기 전까지는</strong></p><br />
<p>&nbsp;</p><br />
<p>It's much worse than that. Please see the following URLs for an introduction to the dangers of CSRF, and some discussion of countermeasure strategies.</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;<a href="http://www.astray.com/pipermail/acmemail/2001-June/000803.html">http://www.astray.com/pipermail/acmemail/2001-June/000803.html</a><br /><br />
&nbsp;<a href="http://www.astray.com/pipermail/acmemail/2001-June/000808.html">http://www.astray.com/pipermail/acmemail/2001-June/000808.html</a><br /><br />
&nbsp;<a href="http://www.astray.com/pipermail/acmemail/2001-June/000804.html">http://www.astray.com/pipermail/acmemail/2001-June/000804.html</a></p><br />
<p>&nbsp;</p><br />
<p><strong>** Server-Side Countermeasures</strong></p><br />
<p><strong style="BACKGROUND-COLOR: rgb(174,255,102)">The fix MUST be implemented on the backend that's being attacked</strong>. In your example, newreply.cgi needs to be intelligent enough to detect and stop CSRF attacks.</p><br />
<p>&nbsp;</p><br />
<p>We've talked about how an attacker can post a message to the messageboard with innocent looking URLs. <strong style="BACKGROUND-COLOR: rgb(174,255,102)">But an attacker can also simply send the victim a piece of HTML email including the full attack IMG URL.</strong> No amount of IMG tag filtering in your messageboard posting system can stop that.</p><br />
<p>&nbsp;</p><br />
<p><strong>** Three-phase tests before acting</strong></p><br />
<p>When it comes to generic CSRF attacks, any application that uses a two-phase approach to action approval is vulnerable (the two phases being <span id="altools-findtxt" style="FONT-WEIGHT: bold; FONT-SIZE: 120%; COLOR: #000000; BACKGROUND-COLOR: #ffff00">[1]</span> do you possess authentication information and [2] are all the required arguments present). What's needed is a third test: is the user really using a proper application form to generate the request?</p><br />
<p>&nbsp;</p><br />
<p><strong>** The 90% solution: Referer tests</strong></p><br />
<p>For many sites, <strong style="BACKGROUND-COLOR: rgb(174,255,102)">you can achieve a high level of protection by checking the HTTP Referer header.(HTTP Referer Header를 확인하여 Referer의 값이 다르면 공격이라고 판단한다.)</strong> This would prevent things like attacks via email. <strong style="BACKGROUND-COLOR: rgb(174,255,102)">But it would also mean locking out any user whose requests did not contain Referer information.(그러나 Referer 정보를 포함하지 않는 Request를 보내는 사용자는 lock out된다.)</strong>[1] As long as the values in the allowed Referer list are all coded with XSS and CSRF in mind, this could be adequate. <strong style="BACKGROUND-COLOR: rgb(174,255,102)">Referer checks should be as specific as possible, e.g. you might require the Referer to begin with "<a href="https://example.com/admin/admin.cgi">https://example.com/admin/admin.cgi</a>" or "<a href="https://example.com/admin/">https://example.com/admin/</a>" instead of simply "<a href="https://example.com/%22."></a><a href="https://example.com/">https://example.com/</a>".(보다 확실한 대책을 세우기 위해서는 Referer 정보 중, 단순한 도메인만을 확인하는 것이 아니라 도메인 하위의 경로까지 확인한다.)</strong></p><br />
<p>&nbsp;</p><br />
<p><strong>** The more difficult cases</strong></p><br />
<p><strong style="BACKGROUND-COLOR: rgb(174,255,102)">Some other applications are more difficult to secure.</strong> Consider webmail apps. So webmail.example.com decides only "message delete" requests from webmail.example.com pages will be accepted: well, <strong style="BACKGROUND-COLOR: rgb(174,255,102)">if the attacker sends a CSRF message to your webmail account, then when you read it via webmail, the Referer in the CSRF image request (your client thinks it's an image request) says it's indeed from the proper webmail server (even in the case of an intermediate redirect; check the bugtraq archives for past discussion of anonymizing hyperlinks, redirects vs. client-pull, etc.), so the request gets&nbsp;through.(웹 메일을 통해 CSRF 메시지가 전달되고 웹 메일 사이트를 통해 CSRF 메시지가 포함된 메일을 읽는 경우는 Referer 정보를 확인하더라고 문제가 된다.)</strong> Basically, any application that allows posting of URLs needs more sophisticated protection than Referer checks. This would also include messageboards and discussion sites like Slashdot.</p><br />
<p>&nbsp;</p><br />
<p>&gt; Known Vulnerable: Infopop's UBB 6.04e (probably the whole 6.xx series),<br /><br />
&gt; ezboard 6.2, WWW Threads PHP 5.4, vBulletin 2.0.0 Release Candidate 2 and<br /><br />
&gt; before (later versions are safe). Probably many more bulletin boards and CGI<br /><br />
&gt; scripts out there, but those are the main ones that we have been tested<br /><br />
&gt; positive.</p><br />
<p>&nbsp;</p><br />
<p><strong>** One-time authorization codes</strong></p><br />
<p>The URLs I list above outline <strong style="BACKGROUND-COLOR: rgb(174,255,102)">a server-side one-use-token</strong> approach to closing the hole. <strong style="BACKGROUND-COLOR: rgb(174,255,102)">For instance, the page that users are expected to use for drafting messages (in your newreply.cgi example) would create a one-time use token, good for a limited time.(서버측에서 메시지를 작성할 만한 페이지에서는 one-time token을 발급).</strong> The newreply.cgi processing script would require this value be present, correct, and in time. So while the attacker knows that action, subject, body, and authcode values are required, the attacker does not know, and cannot ascertain, the proper value needed for the authcode argument.[0] <strong style="BACKGROUND-COLOR: rgb(174,255,102)">These tactics tend to introduce certain inconveniences (e.g., preventing use of the "back" button) so you may wish to analyze the various actions your application can take and provide varying levels of protection.</strong> For example, in a webmail system sending and deleting messages need more protection than displaying messages.</p><br />
<p>&nbsp;</p><br />
<p><strong>** Unpredicatable argument names?<span style="BACKGROUND-COLOR: rgb(174,255,102)">(서버측에서 argument name을 정하는 argument map table를 만들어 argument의 이름을 알기 어렵게 한다.)</span></strong></p><br />
<p>Other tactics may be possible. For instance, consider "action=newthread&amp;subject=aaa&amp;body=some+naughty+words&amp;submit=go". On the server side, you could have an <strong style="BACKGROUND-COLOR: rgb(174,255,102)">"argument map table" for each session,</strong> e.g. pick random surrogates for the normal argument names. For one user, the system might look for "876575665" as an argument name instead of the predictable "action", "9876dafd987" for "body", etc. There may be some tricks vis-a-vis anonymizing referers if the labels are constant throughout a session, but it might be possible to do something like this to make it more difficult to construct a valid URL for a CSRF malicious action.</p><br />
<p>&nbsp;</p><br />
<p><strong>** Attacking sites behind corporate firewalls</strong></p><br />
<p>Want more fun? CSRF tactics can be used to attack servers behind corporate firewalls. It's not just your public Web apps that are at risk. &lt;img src="<a href="http://intranet/admin/purgedatabase?rowslike=%2A&amp;confirm=yes">http://intranet/admin/purgedatabase?rowslike=%2A&amp;confirm=yes</a>"&gt; If the attacker knows enough to make a URL and can get you to open a message, that's all it takes. Here we see that HTTP Referer headers can be a double-edged sword. Earlier we described how Referer tests can add security to many apps relatively easily. But Referer headers can also leak information about "private" sites if those sites use non-anonymized hyperlinks and external document references.</p><br />
<p>&nbsp;</p><br />
<p>I'm afraid CSRF is going to be a mess to deal with in many cases.</p><br />
<p><br /><br />
Like trying to tame the seas.</p><br />
<p>&nbsp;</p><br />
<p><strong>** Workarounds</strong></p><br />
<p>Most of us probably depend on applications that won't be fixed anytime soon. So what can you do to prevent a CSRF attack from making your browser request something without your approval?<br /><br />
&nbsp;- Do not use an email client that renders HTML<br /><br />
&nbsp;- Do not use a newsgroup client tied to your Web browser<br /><br />
&nbsp;- Do not allow your browser to save usernames/passwords<br /><br />
&nbsp;- Do not ask Web sites you care about to "remember" your login<br /><br />
&nbsp;- Be sure to "log off" before and after using any authenticated</p><br />
<p>Web site that's important to you [or your employer ;-)], even if that means exiting your Web browser completely<br /><br />
&nbsp;- Consider using something like Windows 2000's "Run As" shortcut feature or my "runxas" shell script (available at the tux.org URL listed below) to run a Web browser for casual use</p><br />
<p>&nbsp;</p><br />
<p>My apologies for the somewhat rambling nature of this post; I may yet clean this up and put it in a proper paper, and do some real editing...</p><br />
<p>but I hope even in this rough form it makes some sense, and helps folks design better, safer applications.</p><br />
<p>&nbsp;</p><br />
<p>-Peter</p><br />
<p><br /><br />
<a href="http://www.tux.org/%7Epeterw/"></a></p><br />
<p><a href="http://www.tux.org/%7Epeterw/">http://www.tux.org/~peterw/</a></p><br />
<p>[0] Not unless the page that included the authcode is readable, e.g. if the composition page had XSS bugs that would facilitate construction of a URL for a CSRF attack.</p><br />
<p>[1] As discussed earlier (<a href="http://www.securityfocus.com/archive/1/41653%29,"></a><a href="http://www.securityfocus.com/archive/1/41653">http://www.securityfocus.com/archive/1/41653</a>), client-pull pages usually result in no Referer information being sent by the client. So if your application allows a request with no Referer, an attacker need only direct the victim to an HTML document that uses a client-pull META tag to send the victim to the CSRF attack URL. This might be tricker to pull off, but remains feasible. So if you want to use Referer checks, you really ought to go all the way and deny every request that lacks a Referer header.</p><br />
<p>[2] <a href="http://www.stonehenge.com/merlyn/">http://www.stonehenge.com/merlyn/</a> [3]</p><br />
<p>[3] fellow cornfed users: the horror! footnotes referenced in reverse order!</p><br />
<p style="text-align:right">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1713980">스프링노트</a>에서 작성되었습니다.</p>			 ]]> 
		</description>
		<category>CSRF</category>

		<comments>http://v0nsch3.egloos.com/803649#comments</comments>
		<pubDate>Mon, 08 Sep 2008 06:10:54 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
	<item>
		<title><![CDATA[ Using CNG - Using the Cryptography Configuration Features of CNG ]]> </title>
		<link>http://v0nsch3.egloos.com/705948</link>
		<guid>http://v0nsch3.egloos.com/705948</guid>
		<description>
			<![CDATA[ 
  <h1>Using CNG</h1><br />
<p>&nbsp;</p><br />
<h2>Using the Cryptography Configuration Features of CNG</h2><br />
<p>CNG API는 등록된 공급자에 대한 정보를 수집하고 얻기 위한 함수들을 제공한다.</p><br />
<p>&nbsp;</p><br />
<p><strong>Enumerating Providers</strong></p><br />
<p>Getting Provider Registration Information</p><br />
<p>&nbsp;</p><br />
<p><strong>Enumerating Providers</strong></p><br />
<p>사용자는 등록된 공급자 정보를 수집하기 위해 BCryptEnumRegisteredProviders 함수를 사용한다. BCryptEnumRegisteredProviders 함수는 다음 두가지 방법중 한가지 방법으로 호출될 수 있다.</p><br />
<p>&nbsp;</p><br />
<p>첫번째, 메모리를 할당하는 BCryptEnumRegisteredProviders 함수 실행한다. 이것은 ppBuffer 인자에 대해 NULL 포인터의 주소를 전달하여 실행된다. 이 코드는 CRYPT_PROVIDERS 구조체와 관련된 스트링을 위해 요구되는 메모리를 할당할 것이다. 이와 같은 방법으로 BCryptEnumRegisteredProviders가 호출되었을 때, ppBuffer가 더 이상 필요가 없다면 그 변수를&nbsp;BCryptFreeBuffer에 인자로 전달하여 사용자는 반드시 그 메모리를 free해야 한다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>#ifndef NT_SUCCESS<br /><br />
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) &gt;= 0)<br /><br />
#endif<br /><br />
<br /><br />
void EnumProviders1()<br /><br />
{<br /><br />
&nbsp;&nbsp;&nbsp; NTSTATUS status;<br /><br />
&nbsp;&nbsp;&nbsp; ULONG cbBuffer = 0;<br /><br />
&nbsp;&nbsp;&nbsp; PCRYPT_PROVIDERS pBuffer = NULL;<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp; /*<br /><br />
&nbsp;&nbsp;&nbsp; Get the providers, letting the BCryptEnumRegisteredProviders<br /><br />
&nbsp;&nbsp;&nbsp; function allocate the memory.<br /><br />
&nbsp;&nbsp;&nbsp; */<br /><br />
&nbsp;&nbsp;&nbsp; status = BCryptEnumRegisteredProviders(&amp;cbBuffer, &amp;pBuffer);<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp; if (NT_SUCCESS(status))<br /><br />
&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (pBuffer != NULL)<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Enumerate the providers.<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (ULONG i = 0; i &lt; pBuffer-&gt;cProviders; i++)<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("%S\n", pBuffer-&gt;rgpszProviders[i]);<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />
&nbsp;&nbsp;&nbsp; }<br /><br />
&nbsp;&nbsp;&nbsp; else<br /><br />
&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("BCryptEnumRegisteredProviders failed with error "<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "code 0x%08x\n", status);<br /><br />
&nbsp;&nbsp;&nbsp; }<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp; if (NULL != pBuffer)<br /><br />
&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Free the memory allocated by the<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BCryptEnumRegisteredProviders function.<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BCryptFreeBuffer(pBuffer);<br /><br />
&nbsp;&nbsp;&nbsp; }<br /><br />
}</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>두번째, 사용자 스스로 메모리를 할당하는 것이다. This is accomplished by calling the BCryptEnumRegisteredProviders function with NULL for the <em>ppBuffer</em> parameter. The BCryptEnumRegisteredProviders function will place in the value pointed to by the <em>pcbBuffer</em> parameter, the required size, in bytes, of the CRYPT_PROVIDERS structure and all strings. 그러면 사용자는 요구되는 메모리를 할당하고 ppBuffer에 대한 buffer 포인터의 주소를 BCryptEnumRegistredProviders 함수가 두번째 호출될 때, 두번째 인지로 넘겨준다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>#ifndef NT_SUCCESS<br /><br />
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) &gt;= 0)<br /><br />
#endif<br /><br />
<br /><br />
void EnumProviders2()<br /><br />
{<br /><br />
&nbsp;&nbsp;&nbsp; NTSTATUS status;<br /><br />
&nbsp;&nbsp;&nbsp; ULONG cbBuffer = 0;<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp; // Get the required size of the buffer.<br /><br />
&nbsp;&nbsp;&nbsp; status = BCryptEnumRegisteredProviders(&amp;cbBuffer, NULL);<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp; if (STATUS_BUFFER_TOO_SMALL == status)<br /><br />
&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Allocate the buffer.<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PCRYPT_PROVIDERS pBuffer =<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (PCRYPT_PROVIDERS)LocalAlloc(LPTR, cbBuffer);<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (NULL != pBuffer)<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the providers in the buffer that was allocated.<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; status = BCryptEnumRegisteredProviders(<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;cbBuffer,<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;pBuffer);<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (NT_SUCCESS(status))<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (ULONG i = 0; i &lt; pBuffer-&gt;cProviders; i++)<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Enumerate the providers.<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("%S\n", pBuffer-&gt;rgpszProviders[i]);<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />
<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Free the memory that was allocated.<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LocalFree(pBuffer);<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />
&nbsp;&nbsp;&nbsp; }<br /><br />
}</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p><strong>Getting Provider Registration Information</strong></p><br />
<p>BCryptQueryProviderRegistration 함수는 공급자에 대한 추가적이고 등록과정에서 명시된 정보를 얻기 위해 사용된다. 이 함수는 사용자가 얻기 원하는 정보에 대한 공급자의 이름을 인자로 한다. 예를 들어 Microsoft Primitive Provider에 대한 암호 인터페이스의 사용자 모드 등록정보를 얻기 위해서, 사용자는 다음과 유사한 방법을 사용한다.</p><br />
<p>&nbsp;</p><br />
<ol class="code"><br />
<li>BCryptQueryProviderRegistration(<br /><br />
&nbsp;&nbsp;&nbsp; MS_PRIMITIVE_PROVIDER,<br /><br />
&nbsp;&nbsp;&nbsp; CRYPT_UM,<br /><br />
&nbsp;&nbsp;&nbsp; BCRYPT_CIPHER_INTERFACE<br /><br />
&nbsp;&nbsp;&nbsp; ...<br /><br />
&nbsp;&nbsp;&nbsp; );</li><br />
</ol><br />
<p>&nbsp;</p><br />
<p>Like the BCryptEnumRegisteredProviders function, the BCryptQueryProviderRegistration function can either allocate memory for you or you can allocate the memory yourself. The process is the same for the two functions.</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p>&nbsp;</p><br />
<p style="text-align:right">이 글은 <a href="http://v0nsch3lling.springnote.com/pages/1559248">스프링노트</a>에서 작성되었습니다.</p>			 ]]> 
		</description>
		<category>Crypto Programming</category>

		<comments>http://v0nsch3.egloos.com/705948#comments</comments>
		<pubDate>Thu, 14 Aug 2008 17:12:39 GMT</pubDate>
		<dc:creator>휘님</dc:creator>
	</item>
</channel>
</rss>
