mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[ui] added About and License dialogs
* also added partition information * also fixed enumeration of non Windows FS USB devices
This commit is contained in:
		
							parent
							
								
									c24d150189
								
							
						
					
					
						commit
						f355c450b6
					
				
					 10 changed files with 1610 additions and 118 deletions
				
			
		|  | @ -140,11 +140,12 @@ | |||
|   </ItemDefinitionGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\rufus.c" /> | ||||
|     <ClCompile Include="..\stdlg.c" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\msapi_utf8.h" /> | ||||
|     <ClInclude Include="..\rufus.h" /> | ||||
|     <ClInclude Include="..\resource.h" /> | ||||
|     <ClInclude Include="..\license.h" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Manifest Include="..\common_controls_and_elevation.manifest" /> | ||||
|  |  | |||
|  | @ -18,15 +18,18 @@ | |||
|     <ClCompile Include="..\rufus.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\stdlg.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\rufus.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\resource.h"> | ||||
|     <ClInclude Include="..\msapi_utf8.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\msapi_utf8.h"> | ||||
|     <ClInclude Include="..\license.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
|  |  | |||
|  | @ -15,10 +15,14 @@ C_DEFINES = $(C_DEFINES) /DDDKBUILD /DISOLATION_AWARE_ENABLED | |||
| TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ | ||||
|            $(SDK_LIB_PATH)\user32.lib \ | ||||
|            $(SDK_LIB_PATH)\setupapi.lib \ | ||||
|            $(SDK_LIB_PATH)\ole32.lib | ||||
|            $(SDK_LIB_PATH)\ole32.lib \ | ||||
|            $(SDK_LIB_PATH)\version.lib \ | ||||
|            $(SDK_LIB_PATH)\uuid.lib \ | ||||
|            $(SDK_LIB_PATH)\shell32.lib | ||||
| 
 | ||||
| # http://jpassing.com/2008/02/01/how-to-use-manifests-with-buildexe/ | ||||
| SXS_APPLICATION_MANIFEST=common_controls_and_elevation.manifest | ||||
| 
 | ||||
| SOURCES=rufus.c \ | ||||
|         stdlg.c \ | ||||
|         rufus.rc | ||||
|  |  | |||
							
								
								
									
										6
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -4,13 +4,15 @@ CC     = gcc | |||
| RC     = windres | ||||
| STRIP  = strip | ||||
| CFLAGS = -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow -O2 -Wl,--subsystem,windows -DWINVER=0x501 -D_WIN32_IE=0x501 | ||||
| LIBS   = -lsetupapi -lole32 | ||||
| LIBS   = -lsetupapi -lole32 -lgdi32 | ||||
| 
 | ||||
| RUFUS_SRC = rufus.c stdlg.c | ||||
| 
 | ||||
| .PHONY: all clean | ||||
| 
 | ||||
| all: $(TARGETNAME) | ||||
| 
 | ||||
| $(TARGETNAME): $(TARGETNAME).c $(TARGETNAME)_rc.o | ||||
| $(TARGETNAME): $(RUFUS_SRC) $(TARGETNAME)_rc.o | ||||
| 	@echo "[CCLD]  $@" | ||||
| 	@$(CC) -o $@ $(CFLAGS) $^ $(TARGETNAME)_rc.o $(LIBS) | ||||
| 	@$(STRIP) $(TARGETNAME).exe | ||||
|  |  | |||
							
								
								
									
										654
									
								
								license.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										654
									
								
								license.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,654 @@ | |||
| /*
 | ||||
|  * Rufus: The Resourceful USB Formatting Utility | ||||
|  * Licensing Data | ||||
|  * Copyright (c) 20111 Pete Batard <pete@akeo.ie> | ||||
|  * | ||||
|  * This program is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  */ | ||||
| 
 | ||||
| const char* additional_copyrights = | ||||
| "Device enumeration based on TestUSBDriveEject.cpp by ahmd:\r\n" | ||||
| "http://www.codeguru.com/forum/showthread.php?p=1951973\r\n" | ||||
| "Assumed Public Domain\r\n" | ||||
| "\r\n" | ||||
| "Icon by PC Unleashed:\r\n" | ||||
| "http://pcunleashed.com\r\n" | ||||
| "Freeware\r\n" | ||||
| "\r\n" | ||||
| "About and License dialogs inspired by WinSCP\r\n" | ||||
| "Copyright (c) 2000-2011 Martin Prikryl\r\n" | ||||
| "GNU General Public License (GPL) v3 or later"; | ||||
| 
 | ||||
| const char* gplv3 = | ||||
| "                    GNU GENERAL PUBLIC LICENSE\r\n" | ||||
| "                       Version 3, 29 June 2007\r\n" | ||||
| "\r\n" | ||||
| " Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\r\n" | ||||
| " Everyone is permitted to copy and distribute verbatim copies\r\n" | ||||
| " of this license document, but changing it is not allowed.\r\n" | ||||
| "\r\n" | ||||
| "                            Preamble\r\n" | ||||
| "\r\n" | ||||
| "  The GNU General Public License is a free, copyleft license for\r\n" | ||||
| "software and other kinds of works.\r\n" | ||||
| "\r\n" | ||||
| "  The licenses for most software and other practical works are designed\r\n" | ||||
| "to take away your freedom to share and change the works.  By contrast,\r\n" | ||||
| "the GNU General Public License is intended to guarantee your freedom to\r\n" | ||||
| "share and change all versions of a program--to make sure it remains free\r\n" | ||||
| "software for all its users.  We, the Free Software Foundation, use the\r\n" | ||||
| "GNU General Public License for most of our software; it applies also to\r\n" | ||||
| "any other work released this way by its authors.  You can apply it to\r\n" | ||||
| "your programs, too.\r\n" | ||||
| "\r\n" | ||||
| "  When we speak of free software, we are referring to freedom, not\r\n" | ||||
| "price.  Our General Public Licenses are designed to make sure that you\r\n" | ||||
| "have the freedom to distribute copies of free software (and charge for\r\n" | ||||
| "them if you wish), that you receive source code or can get it if you\r\n" | ||||
| "want it, that you can change the software or use pieces of it in new\r\n" | ||||
| "free programs, and that you know you can do these things.\r\n" | ||||
| "\r\n" | ||||
| "  To protect your rights, we need to prevent others from denying you\r\n" | ||||
| "these rights or asking you to surrender the rights.  Therefore, you have\r\n" | ||||
| "certain responsibilities if you distribute copies of the software, or if\r\n" | ||||
| "you modify it: responsibilities to respect the freedom of others.\r\n" | ||||
| "\r\n" | ||||
| "  For example, if you distribute copies of such a program, whether\r\n" | ||||
| "gratis or for a fee, you must pass on to the recipients the same\r\n" | ||||
| "freedoms that you received.  You must make sure that they, too, receive\r\n" | ||||
| "or can get the source code.  And you must show them these terms so they\r\n" | ||||
| "know their rights.\r\n" | ||||
| "\r\n" | ||||
| "  Developers that use the GNU GPL protect your rights with two steps:\r\n" | ||||
| "(1) assert copyright on the software, and (2) offer you this License\r\n" | ||||
| "giving you legal permission to copy, distribute and/or modify it.\r\n" | ||||
| "\r\n" | ||||
| "  For the developers' and authors' protection, the GPL clearly explains\r\n" | ||||
| "that there is no warranty for this free software.  For both users' and\r\n" | ||||
| "authors' sake, the GPL requires that modified versions be marked as\r\n" | ||||
| "changed, so that their problems will not be attributed erroneously to\r\n" | ||||
| "authors of previous versions.\r\n" | ||||
| "\r\n" | ||||
| "  Some devices are designed to deny users access to install or run\r\n" | ||||
| "modified versions of the software inside them, although the manufacturer\r\n" | ||||
| "can do so.  This is fundamentally incompatible with the aim of\r\n" | ||||
| "protecting users' freedom to change the software.  The systematic\r\n" | ||||
| "pattern of such abuse occurs in the area of products for individuals to\r\n" | ||||
| "use, which is precisely where it is most unacceptable.  Therefore, we\r\n" | ||||
| "have designed this version of the GPL to prohibit the practice for those\r\n" | ||||
| "products.  If such problems arise substantially in other domains, we\r\n" | ||||
| "stand ready to extend this provision to those domains in future versions\r\n" | ||||
| "of the GPL, as needed to protect the freedom of users.\r\n" | ||||
| "\r\n" | ||||
| "  Finally, every program is threatened constantly by software patents.\r\n" | ||||
| "States should not allow patents to restrict development and use of\r\n" | ||||
| "software on general-purpose computers, but in those that do, we wish to\r\n" | ||||
| "avoid the special danger that patents applied to a free program could\r\n" | ||||
| "make it effectively proprietary.  To prevent this, the GPL assures that\r\n" | ||||
| "patents cannot be used to render the program non-free.\r\n" | ||||
| "\r\n" | ||||
| "  The precise terms and conditions for copying, distribution and\r\n" | ||||
| "modification follow.\r\n" | ||||
| "\r\n" | ||||
| "                       TERMS AND CONDITIONS\r\n" | ||||
| "\r\n" | ||||
| "  0. Definitions.\r\n" | ||||
| "\r\n" | ||||
| "  \"This License\" refers to version 3 of the GNU General Public License.\r\n" | ||||
| "\r\n" | ||||
| "  \"Copyright\" also means copyright-like laws that apply to other kinds of\r\n" | ||||
| "works, such as semiconductor masks.\r\n" | ||||
| "\r\n" | ||||
| "  \"The Program\" refers to any copyrightable work licensed under this\r\n" | ||||
| "License.  Each licensee is addressed as \"you\".  \"Licensees\" and\r\n" | ||||
| "\"recipients\" may be individuals or organizations.\r\n" | ||||
| "\r\n" | ||||
| "  To \"modify\" a work means to copy from or adapt all or part of the work\r\n" | ||||
| "in a fashion requiring copyright permission, other than the making of an\r\n" | ||||
| "exact copy.  The resulting work is called a \"modified version\" of the\r\n" | ||||
| "earlier work or a work \"based on\" the earlier work.\r\n" | ||||
| "\r\n" | ||||
| "  A \"covered work\" means either the unmodified Program or a work based\r\n" | ||||
| "on the Program.\r\n" | ||||
| "\r\n" | ||||
| "  To \"propagate\" a work means to do anything with it that, without\r\n" | ||||
| "permission, would make you directly or secondarily liable for\r\n" | ||||
| "infringement under applicable copyright law, except executing it on a\r\n" | ||||
| "computer or modifying a private copy.  Propagation includes copying,\r\n" | ||||
| "distribution (with or without modification), making available to the\r\n" | ||||
| "public, and in some countries other activities as well.\r\n" | ||||
| "\r\n" | ||||
| "  To \"convey\" a work means any kind of propagation that enables other\r\n" | ||||
| "parties to make or receive copies.  Mere interaction with a user through\r\n" | ||||
| "a computer network, with no transfer of a copy, is not conveying.\r\n" | ||||
| "\r\n" | ||||
| "  An interactive user interface displays \"Appropriate Legal Notices\"\r\n" | ||||
| "to the extent that it includes a convenient and prominently visible\r\n" | ||||
| "feature that (1) displays an appropriate copyright notice, and (2)\r\n" | ||||
| "tells the user that there is no warranty for the work (except to the\r\n" | ||||
| "extent that warranties are provided), that licensees may convey the\r\n" | ||||
| "work under this License, and how to view a copy of this License.  If\r\n" | ||||
| "the interface presents a list of user commands or options, such as a\r\n" | ||||
| "menu, a prominent item in the list meets this criterion.\r\n" | ||||
| "\r\n" | ||||
| "  1. Source Code.\r\n" | ||||
| "\r\n" | ||||
| "  The \"source code\" for a work means the preferred form of the work\r\n" | ||||
| "for making modifications to it.  \"Object code\" means any non-source\r\n" | ||||
| "form of a work.\r\n" | ||||
| "\r\n" | ||||
| "  A \"Standard Interface\" means an interface that either is an official\r\n" | ||||
| "standard defined by a recognized standards body, or, in the case of\r\n" | ||||
| "interfaces specified for a particular programming language, one that\r\n" | ||||
| "is widely used among developers working in that language.\r\n" | ||||
| "\r\n" | ||||
| "  The \"System Libraries\" of an executable work include anything, other\r\n" | ||||
| "than the work as a whole, that (a) is included in the normal form of\r\n" | ||||
| "packaging a Major Component, but which is not part of that Major\r\n" | ||||
| "Component, and (b) serves only to enable use of the work with that\r\n" | ||||
| "Major Component, or to implement a Standard Interface for which an\r\n" | ||||
| "implementation is available to the public in source code form.  A\r\n" | ||||
| "\"Major Component\", in this context, means a major essential component\r\n" | ||||
| "(kernel, window system, and so on) of the specific operating system\r\n" | ||||
| "(if any) on which the executable work runs, or a compiler used to\r\n" | ||||
| "produce the work, or an object code interpreter used to run it.\r\n" | ||||
| "\r\n" | ||||
| "  The \"Corresponding Source\" for a work in object code form means all\r\n" | ||||
| "the source code needed to generate, install, and (for an executable\r\n" | ||||
| "work) run the object code and to modify the work, including scripts to\r\n" | ||||
| "control those activities.  However, it does not include the work's\r\n" | ||||
| "System Libraries, or general-purpose tools or generally available free\r\n" | ||||
| "programs which are used unmodified in performing those activities but\r\n" | ||||
| "which are not part of the work.  For example, Corresponding Source\r\n" | ||||
| "includes interface definition files associated with source files for\r\n" | ||||
| "the work, and the source code for shared libraries and dynamically\r\n" | ||||
| "linked subprograms that the work is specifically designed to require,\r\n" | ||||
| "such as by intimate data communication or control flow between those\r\n" | ||||
| "subprograms and other parts of the work.\r\n" | ||||
| "\r\n" | ||||
| "  The Corresponding Source need not include anything that users\r\n" | ||||
| "can regenerate automatically from other parts of the Corresponding\r\n" | ||||
| "Source.\r\n" | ||||
| "\r\n" | ||||
| "  The Corresponding Source for a work in source code form is that\r\n" | ||||
| "same work.\r\n" | ||||
| "\r\n" | ||||
| "  2. Basic Permissions.\r\n" | ||||
| "\r\n" | ||||
| "  All rights granted under this License are granted for the term of\r\n" | ||||
| "copyright on the Program, and are irrevocable provided the stated\r\n" | ||||
| "conditions are met.  This License explicitly affirms your unlimited\r\n" | ||||
| "permission to run the unmodified Program.  The output from running a\r\n" | ||||
| "covered work is covered by this License only if the output, given its\r\n" | ||||
| "content, constitutes a covered work.  This License acknowledges your\r\n" | ||||
| "rights of fair use or other equivalent, as provided by copyright law.\r\n" | ||||
| "\r\n" | ||||
| "  You may make, run and propagate covered works that you do not\r\n" | ||||
| "convey, without conditions so long as your license otherwise remains\r\n" | ||||
| "in force.  You may convey covered works to others for the sole purpose\r\n" | ||||
| "of having them make modifications exclusively for you, or provide you\r\n" | ||||
| "with facilities for running those works, provided that you comply with\r\n" | ||||
| "the terms of this License in conveying all material for which you do\r\n" | ||||
| "not control copyright.  Those thus making or running the covered works\r\n" | ||||
| "for you must do so exclusively on your behalf, under your direction\r\n" | ||||
| "and control, on terms that prohibit them from making any copies of\r\n" | ||||
| "your copyrighted material outside their relationship with you.\r\n" | ||||
| "\r\n" | ||||
| "  Conveying under any other circumstances is permitted solely under\r\n" | ||||
| "the conditions stated below.  Sublicensing is not allowed; section 10\r\n" | ||||
| "makes it unnecessary.\r\n" | ||||
| "\r\n" | ||||
| "  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\r\n" | ||||
| "\r\n" | ||||
| "  No covered work shall be deemed part of an effective technological\r\n" | ||||
| "measure under any applicable law fulfilling obligations under article\r\n" | ||||
| "11 of the WIPO copyright treaty adopted on 20 December 1996, or\r\n" | ||||
| "similar laws prohibiting or restricting circumvention of such\r\n" | ||||
| "measures.\r\n" | ||||
| "\r\n" | ||||
| "  When you convey a covered work, you waive any legal power to forbid\r\n" | ||||
| "circumvention of technological measures to the extent such circumvention\r\n" | ||||
| "is effected by exercising rights under this License with respect to\r\n" | ||||
| "the covered work, and you disclaim any intention to limit operation or\r\n" | ||||
| "modification of the work as a means of enforcing, against the work's\r\n" | ||||
| "users, your or third parties' legal rights to forbid circumvention of\r\n" | ||||
| "technological measures.\r\n" | ||||
| "\r\n" | ||||
| "  4. Conveying Verbatim Copies.\r\n" | ||||
| "\r\n" | ||||
| "  You may convey verbatim copies of the Program's source code as you\r\n" | ||||
| "receive it, in any medium, provided that you conspicuously and\r\n" | ||||
| "appropriately publish on each copy an appropriate copyright notice;\r\n" | ||||
| "keep intact all notices stating that this License and any\r\n" | ||||
| "non-permissive terms added in accord with section 7 apply to the code;\r\n" | ||||
| "keep intact all notices of the absence of any warranty; and give all\r\n" | ||||
| "recipients a copy of this License along with the Program.\r\n" | ||||
| "\r\n" | ||||
| "  You may charge any price or no price for each copy that you convey,\r\n" | ||||
| "and you may offer support or warranty protection for a fee.\r\n" | ||||
| "\r\n" | ||||
| "  5. Conveying Modified Source Versions.\r\n" | ||||
| "\r\n" | ||||
| "  You may convey a work based on the Program, or the modifications to\r\n" | ||||
| "produce it from the Program, in the form of source code under the\r\n" | ||||
| "terms of section 4, provided that you also meet all of these conditions:\r\n" | ||||
| "\r\n" | ||||
| "    a) The work must carry prominent notices stating that you modified\r\n" | ||||
| "    it, and giving a relevant date.\r\n" | ||||
| "\r\n" | ||||
| "    b) The work must carry prominent notices stating that it is\r\n" | ||||
| "    released under this License and any conditions added under section\r\n" | ||||
| "    7.  This requirement modifies the requirement in section 4 to\r\n" | ||||
| "    \"keep intact all notices\".\r\n" | ||||
| "\r\n" | ||||
| "    c) You must license the entire work, as a whole, under this\r\n" | ||||
| "    License to anyone who comes into possession of a copy.  This\r\n" | ||||
| "    License will therefore apply, along with any applicable section 7\r\n" | ||||
| "    additional terms, to the whole of the work, and all its parts,\r\n" | ||||
| "    regardless of how they are packaged.  This License gives no\r\n" | ||||
| "    permission to license the work in any other way, but it does not\r\n" | ||||
| "    invalidate such permission if you have separately received it.\r\n" | ||||
| "\r\n" | ||||
| "    d) If the work has interactive user interfaces, each must display\r\n" | ||||
| "    Appropriate Legal Notices; however, if the Program has interactive\r\n" | ||||
| "    interfaces that do not display Appropriate Legal Notices, your\r\n" | ||||
| "    work need not make them do so.\r\n" | ||||
| "\r\n" | ||||
| "  A compilation of a covered work with other separate and independent\r\n" | ||||
| "works, which are not by their nature extensions of the covered work,\r\n" | ||||
| "and which are not combined with it such as to form a larger program,\r\n" | ||||
| "in or on a volume of a storage or distribution medium, is called an\r\n" | ||||
| "\"aggregate\" if the compilation and its resulting copyright are not\r\n" | ||||
| "used to limit the access or legal rights of the compilation's users\r\n" | ||||
| "beyond what the individual works permit.  Inclusion of a covered work\r\n" | ||||
| "in an aggregate does not cause this License to apply to the other\r\n" | ||||
| "parts of the aggregate.\r\n" | ||||
| "\r\n" | ||||
| "  6. Conveying Non-Source Forms.\r\n" | ||||
| "\r\n" | ||||
| "  You may convey a covered work in object code form under the terms\r\n" | ||||
| "of sections 4 and 5, provided that you also convey the\r\n" | ||||
| "machine-readable Corresponding Source under the terms of this License,\r\n" | ||||
| "in one of these ways:\r\n" | ||||
| "\r\n" | ||||
| "    a) Convey the object code in, or embodied in, a physical product\r\n" | ||||
| "    (including a physical distribution medium), accompanied by the\r\n" | ||||
| "    Corresponding Source fixed on a durable physical medium\r\n" | ||||
| "    customarily used for software interchange.\r\n" | ||||
| "\r\n" | ||||
| "    b) Convey the object code in, or embodied in, a physical product\r\n" | ||||
| "    (including a physical distribution medium), accompanied by a\r\n" | ||||
| "    written offer, valid for at least three years and valid for as\r\n" | ||||
| "    long as you offer spare parts or customer support for that product\r\n" | ||||
| "    model, to give anyone who possesses the object code either (1) a\r\n" | ||||
| "    copy of the Corresponding Source for all the software in the\r\n" | ||||
| "    product that is covered by this License, on a durable physical\r\n" | ||||
| "    medium customarily used for software interchange, for a price no\r\n" | ||||
| "    more than your reasonable cost of physically performing this\r\n" | ||||
| "    conveying of source, or (2) access to copy the\r\n" | ||||
| "    Corresponding Source from a network server at no charge.\r\n" | ||||
| "\r\n" | ||||
| "    c) Convey individual copies of the object code with a copy of the\r\n" | ||||
| "    written offer to provide the Corresponding Source.  This\r\n" | ||||
| "    alternative is allowed only occasionally and noncommercially, and\r\n" | ||||
| "    only if you received the object code with such an offer, in accord\r\n" | ||||
| "    with subsection 6b.\r\n" | ||||
| "\r\n" | ||||
| "    d) Convey the object code by offering access from a designated\r\n" | ||||
| "    place (gratis or for a charge), and offer equivalent access to the\r\n" | ||||
| "    Corresponding Source in the same way through the same place at no\r\n" | ||||
| "    further charge.  You need not require recipients to copy the\r\n" | ||||
| "    Corresponding Source along with the object code.  If the place to\r\n" | ||||
| "    copy the object code is a network server, the Corresponding Source\r\n" | ||||
| "    may be on a different server (operated by you or a third party)\r\n" | ||||
| "    that supports equivalent copying facilities, provided you maintain\r\n" | ||||
| "    clear directions next to the object code saying where to find the\r\n" | ||||
| "    Corresponding Source.  Regardless of what server hosts the\r\n" | ||||
| "    Corresponding Source, you remain obligated to ensure that it is\r\n" | ||||
| "    available for as long as needed to satisfy these requirements.\r\n" | ||||
| "\r\n" | ||||
| "    e) Convey the object code using peer-to-peer transmission, provided\r\n" | ||||
| "    you inform other peers where the object code and Corresponding\r\n" | ||||
| "    Source of the work are being offered to the general public at no\r\n" | ||||
| "    charge under subsection 6d.\r\n" | ||||
| "\r\n" | ||||
| "  A separable portion of the object code, whose source code is excluded\r\n" | ||||
| "from the Corresponding Source as a System Library, need not be\r\n" | ||||
| "included in conveying the object code work.\r\n" | ||||
| "\r\n" | ||||
| "  A \"User Product\" is either (1) a \"consumer product\", which means any\r\n" | ||||
| "tangible personal property which is normally used for personal, family,\r\n" | ||||
| "or household purposes, or (2) anything designed or sold for incorporation\r\n" | ||||
| "into a dwelling.  In determining whether a product is a consumer product,\r\n" | ||||
| "doubtful cases shall be resolved in favor of coverage.  For a particular\r\n" | ||||
| "product received by a particular user, \"normally used\" refers to a\r\n" | ||||
| "typical or common use of that class of product, regardless of the status\r\n" | ||||
| "of the particular user or of the way in which the particular user\r\n" | ||||
| "actually uses, or expects or is expected to use, the product.  A product\r\n" | ||||
| "is a consumer product regardless of whether the product has substantial\r\n" | ||||
| "commercial, industrial or non-consumer uses, unless such uses represent\r\n" | ||||
| "the only significant mode of use of the product.\r\n" | ||||
| "\r\n" | ||||
| "  \"Installation Information\" for a User Product means any methods,\r\n" | ||||
| "procedures, authorization keys, or other information required to install\r\n" | ||||
| "and execute modified versions of a covered work in that User Product from\r\n" | ||||
| "a modified version of its Corresponding Source.  The information must\r\n" | ||||
| "suffice to ensure that the continued functioning of the modified object\r\n" | ||||
| "code is in no case prevented or interfered with solely because\r\n" | ||||
| "modification has been made.\r\n" | ||||
| "\r\n" | ||||
| "  If you convey an object code work under this section in, or with, or\r\n" | ||||
| "specifically for use in, a User Product, and the conveying occurs as\r\n" | ||||
| "part of a transaction in which the right of possession and use of the\r\n" | ||||
| "User Product is transferred to the recipient in perpetuity or for a\r\n" | ||||
| "fixed term (regardless of how the transaction is characterized), the\r\n" | ||||
| "Corresponding Source conveyed under this section must be accompanied\r\n" | ||||
| "by the Installation Information.  But this requirement does not apply\r\n" | ||||
| "if neither you nor any third party retains the ability to install\r\n" | ||||
| "modified object code on the User Product (for example, the work has\r\n" | ||||
| "been installed in ROM).\r\n" | ||||
| "\r\n" | ||||
| "  The requirement to provide Installation Information does not include a\r\n" | ||||
| "requirement to continue to provide support service, warranty, or updates\r\n" | ||||
| "for a work that has been modified or installed by the recipient, or for\r\n" | ||||
| "the User Product in which it has been modified or installed.  Access to a\r\n" | ||||
| "network may be denied when the modification itself materially and\r\n" | ||||
| "adversely affects the operation of the network or violates the rules and\r\n" | ||||
| "protocols for communication across the network.\r\n" | ||||
| "\r\n" | ||||
| "  Corresponding Source conveyed, and Installation Information provided,\r\n" | ||||
| "in accord with this section must be in a format that is publicly\r\n" | ||||
| "documented (and with an implementation available to the public in\r\n" | ||||
| "source code form), and must require no special password or key for\r\n" | ||||
| "unpacking, reading or copying.\r\n" | ||||
| "\r\n" | ||||
| "  7. Additional Terms.\r\n" | ||||
| "\r\n" | ||||
| "  \"Additional permissions\" are terms that supplement the terms of this\r\n" | ||||
| "License by making exceptions from one or more of its conditions.\r\n" | ||||
| "Additional permissions that are applicable to the entire Program shall\r\n" | ||||
| "be treated as though they were included in this License, to the extent\r\n" | ||||
| "that they are valid under applicable law.  If additional permissions\r\n" | ||||
| "apply only to part of the Program, that part may be used separately\r\n" | ||||
| "under those permissions, but the entire Program remains governed by\r\n" | ||||
| "this License without regard to the additional permissions.\r\n" | ||||
| "\r\n" | ||||
| "  When you convey a copy of a covered work, you may at your option\r\n" | ||||
| "remove any additional permissions from that copy, or from any part of\r\n" | ||||
| "it.  (Additional permissions may be written to require their own\r\n" | ||||
| "removal in certain cases when you modify the work.)  You may place\r\n" | ||||
| "additional permissions on material, added by you to a covered work,\r\n" | ||||
| "for which you have or can give appropriate copyright permission.\r\n" | ||||
| "\r\n" | ||||
| "  Notwithstanding any other provision of this License, for material you\r\n" | ||||
| "add to a covered work, you may (if authorized by the copyright holders of\r\n" | ||||
| "that material) supplement the terms of this License with terms:\r\n" | ||||
| "\r\n" | ||||
| "    a) Disclaiming warranty or limiting liability differently from the\r\n" | ||||
| "    terms of sections 15 and 16 of this License; or\r\n" | ||||
| "\r\n" | ||||
| "    b) Requiring preservation of specified reasonable legal notices or\r\n" | ||||
| "    author attributions in that material or in the Appropriate Legal\r\n" | ||||
| "    Notices displayed by works containing it; or\r\n" | ||||
| "\r\n" | ||||
| "    c) Prohibiting misrepresentation of the origin of that material, or\r\n" | ||||
| "    requiring that modified versions of such material be marked in\r\n" | ||||
| "    reasonable ways as different from the original version; or\r\n" | ||||
| "\r\n" | ||||
| "    d) Limiting the use for publicity purposes of names of licensors or\r\n" | ||||
| "    authors of the material; or\r\n" | ||||
| "\r\n" | ||||
| "    e) Declining to grant rights under trademark law for use of some\r\n" | ||||
| "    trade names, trademarks, or service marks; or\r\n" | ||||
| "\r\n" | ||||
| "    f) Requiring indemnification of licensors and authors of that\r\n" | ||||
| "    material by anyone who conveys the material (or modified versions of\r\n" | ||||
| "    it) with contractual assumptions of liability to the recipient, for\r\n" | ||||
| "    any liability that these contractual assumptions directly impose on\r\n" | ||||
| "    those licensors and authors.\r\n" | ||||
| "\r\n" | ||||
| "  All other non-permissive additional terms are considered \"further\r\n" | ||||
| "restrictions\" within the meaning of section 10.  If the Program as you\r\n" | ||||
| "received it, or any part of it, contains a notice stating that it is\r\n" | ||||
| "governed by this License along with a term that is a further\r\n" | ||||
| "restriction, you may remove that term.  If a license document contains\r\n" | ||||
| "a further restriction but permits relicensing or conveying under this\r\n" | ||||
| "License, you may add to a covered work material governed by the terms\r\n" | ||||
| "of that license document, provided that the further restriction does\r\n" | ||||
| "not survive such relicensing or conveying.\r\n" | ||||
| "\r\n" | ||||
| "  If you add terms to a covered work in accord with this section, you\r\n" | ||||
| "must place, in the relevant source files, a statement of the\r\n" | ||||
| "additional terms that apply to those files, or a notice indicating\r\n" | ||||
| "where to find the applicable terms.\r\n" | ||||
| "\r\n" | ||||
| "  Additional terms, permissive or non-permissive, may be stated in the\r\n" | ||||
| "form of a separately written license, or stated as exceptions;\r\n" | ||||
| "the above requirements apply either way.\r\n" | ||||
| "\r\n" | ||||
| "  8. Termination.\r\n" | ||||
| "\r\n" | ||||
| "  You may not propagate or modify a covered work except as expressly\r\n" | ||||
| "provided under this License.  Any attempt otherwise to propagate or\r\n" | ||||
| "modify it is void, and will automatically terminate your rights under\r\n" | ||||
| "this License (including any patent licenses granted under the third\r\n" | ||||
| "paragraph of section 11).\r\n" | ||||
| "\r\n" | ||||
| "  However, if you cease all violation of this License, then your\r\n" | ||||
| "license from a particular copyright holder is reinstated (a)\r\n" | ||||
| "provisionally, unless and until the copyright holder explicitly and\r\n" | ||||
| "finally terminates your license, and (b) permanently, if the copyright\r\n" | ||||
| "holder fails to notify you of the violation by some reasonable means\r\n" | ||||
| "prior to 60 days after the cessation.\r\n" | ||||
| "\r\n" | ||||
| "  Moreover, your license from a particular copyright holder is\r\n" | ||||
| "reinstated permanently if the copyright holder notifies you of the\r\n" | ||||
| "violation by some reasonable means, this is the first time you have\r\n" | ||||
| "received notice of violation of this License (for any work) from that\r\n" | ||||
| "copyright holder, and you cure the violation prior to 30 days after\r\n" | ||||
| "your receipt of the notice.\r\n" | ||||
| "\r\n" | ||||
| "  Termination of your rights under this section does not terminate the\r\n" | ||||
| "licenses of parties who have received copies or rights from you under\r\n" | ||||
| "this License.  If your rights have been terminated and not permanently\r\n" | ||||
| "reinstated, you do not qualify to receive new licenses for the same\r\n" | ||||
| "material under section 10.\r\n" | ||||
| "\r\n" | ||||
| "  9. Acceptance Not Required for Having Copies.\r\n" | ||||
| "\r\n" | ||||
| "  You are not required to accept this License in order to receive or\r\n" | ||||
| "run a copy of the Program.  Ancillary propagation of a covered work\r\n" | ||||
| "occurring solely as a consequence of using peer-to-peer transmission\r\n" | ||||
| "to receive a copy likewise does not require acceptance.  However,\r\n" | ||||
| "nothing other than this License grants you permission to propagate or\r\n" | ||||
| "modify any covered work.  These actions infringe copyright if you do\r\n" | ||||
| "not accept this License.  Therefore, by modifying or propagating a\r\n" | ||||
| "covered work, you indicate your acceptance of this License to do so.\r\n" | ||||
| "\r\n" | ||||
| "  10. Automatic Licensing of Downstream Recipients.\r\n" | ||||
| "\r\n" | ||||
| "  Each time you convey a covered work, the recipient automatically\r\n" | ||||
| "receives a license from the original licensors, to run, modify and\r\n" | ||||
| "propagate that work, subject to this License.  You are not responsible\r\n" | ||||
| "for enforcing compliance by third parties with this License.\r\n" | ||||
| "\r\n" | ||||
| "  An \"entity transaction\" is a transaction transferring control of an\r\n" | ||||
| "organization, or substantially all assets of one, or subdividing an\r\n" | ||||
| "organization, or merging organizations.  If propagation of a covered\r\n" | ||||
| "work results from an entity transaction, each party to that\r\n" | ||||
| "transaction who receives a copy of the work also receives whatever\r\n" | ||||
| "licenses to the work the party's predecessor in interest had or could\r\n" | ||||
| "give under the previous paragraph, plus a right to possession of the\r\n" | ||||
| "Corresponding Source of the work from the predecessor in interest, if\r\n" | ||||
| "the predecessor has it or can get it with reasonable efforts.\r\n" | ||||
| "\r\n" | ||||
| "  You may not impose any further restrictions on the exercise of the\r\n" | ||||
| "rights granted or affirmed under this License.  For example, you may\r\n" | ||||
| "not impose a license fee, royalty, or other charge for exercise of\r\n" | ||||
| "rights granted under this License, and you may not initiate litigation\r\n" | ||||
| "(including a cross-claim or counterclaim in a lawsuit) alleging that\r\n" | ||||
| "any patent claim is infringed by making, using, selling, offering for\r\n" | ||||
| "sale, or importing the Program or any portion of it.\r\n" | ||||
| "\r\n" | ||||
| "  11. Patents.\r\n" | ||||
| "\r\n" | ||||
| "  A \"contributor\" is a copyright holder who authorizes use under this\r\n" | ||||
| "License of the Program or a work on which the Program is based.  The\r\n" | ||||
| "work thus licensed is called the contributor's \"contributor version\".\r\n" | ||||
| "\r\n" | ||||
| "  A contributor's \"essential patent claims\" are all patent claims\r\n" | ||||
| "owned or controlled by the contributor, whether already acquired or\r\n" | ||||
| "hereafter acquired, that would be infringed by some manner, permitted\r\n" | ||||
| "by this License, of making, using, or selling its contributor version,\r\n" | ||||
| "but do not include claims that would be infringed only as a\r\n" | ||||
| "consequence of further modification of the contributor version.  For\r\n" | ||||
| "purposes of this definition, \"control\" includes the right to grant\r\n" | ||||
| "patent sublicenses in a manner consistent with the requirements of\r\n" | ||||
| "this License.\r\n" | ||||
| "\r\n" | ||||
| "  Each contributor grants you a non-exclusive, worldwide, royalty-free\r\n" | ||||
| "patent license under the contributor's essential patent claims, to\r\n" | ||||
| "make, use, sell, offer for sale, import and otherwise run, modify and\r\n" | ||||
| "propagate the contents of its contributor version.\r\n" | ||||
| "\r\n" | ||||
| "  In the following three paragraphs, a \"patent license\" is any express\r\n" | ||||
| "agreement or commitment, however denominated, not to enforce a patent\r\n" | ||||
| "(such as an express permission to practice a patent or covenant not to\r\n" | ||||
| "sue for patent infringement).  To \"grant\" such a patent license to a\r\n" | ||||
| "party means to make such an agreement or commitment not to enforce a\r\n" | ||||
| "patent against the party.\r\n" | ||||
| "\r\n" | ||||
| "  If you convey a covered work, knowingly relying on a patent license,\r\n" | ||||
| "and the Corresponding Source of the work is not available for anyone\r\n" | ||||
| "to copy, free of charge and under the terms of this License, through a\r\n" | ||||
| "publicly available network server or other readily accessible means,\r\n" | ||||
| "then you must either (1) cause the Corresponding Source to be so\r\n" | ||||
| "available, or (2) arrange to deprive yourself of the benefit of the\r\n" | ||||
| "patent license for this particular work, or (3) arrange, in a manner\r\n" | ||||
| "consistent with the requirements of this License, to extend the patent\r\n" | ||||
| "license to downstream recipients.  \"Knowingly relying\" means you have\r\n" | ||||
| "actual knowledge that, but for the patent license, your conveying the\r\n" | ||||
| "covered work in a country, or your recipient's use of the covered work\r\n" | ||||
| "in a country, would infringe one or more identifiable patents in that\r\n" | ||||
| "country that you have reason to believe are valid.\r\n" | ||||
| "\r\n" | ||||
| "  If, pursuant to or in connection with a single transaction or\r\n" | ||||
| "arrangement, you convey, or propagate by procuring conveyance of, a\r\n" | ||||
| "covered work, and grant a patent license to some of the parties\r\n" | ||||
| "receiving the covered work authorizing them to use, propagate, modify\r\n" | ||||
| "or convey a specific copy of the covered work, then the patent license\r\n" | ||||
| "you grant is automatically extended to all recipients of the covered\r\n" | ||||
| "work and works based on it.\r\n" | ||||
| "\r\n" | ||||
| "  A patent license is \"discriminatory\" if it does not include within\r\n" | ||||
| "the scope of its coverage, prohibits the exercise of, or is\r\n" | ||||
| "conditioned on the non-exercise of one or more of the rights that are\r\n" | ||||
| "specifically granted under this License.  You may not convey a covered\r\n" | ||||
| "work if you are a party to an arrangement with a third party that is\r\n" | ||||
| "in the business of distributing software, under which you make payment\r\n" | ||||
| "to the third party based on the extent of your activity of conveying\r\n" | ||||
| "the work, and under which the third party grants, to any of the\r\n" | ||||
| "parties who would receive the covered work from you, a discriminatory\r\n" | ||||
| "patent license (a) in connection with copies of the covered work\r\n" | ||||
| "conveyed by you (or copies made from those copies), or (b) primarily\r\n" | ||||
| "for and in connection with specific products or compilations that\r\n" | ||||
| "contain the covered work, unless you entered into that arrangement,\r\n" | ||||
| "or that patent license was granted, prior to 28 March 2007.\r\n" | ||||
| "\r\n" | ||||
| "  Nothing in this License shall be construed as excluding or limiting\r\n" | ||||
| "any implied license or other defenses to infringement that may\r\n" | ||||
| "otherwise be available to you under applicable patent law.\r\n" | ||||
| "\r\n" | ||||
| "  12. No Surrender of Others' Freedom.\r\n" | ||||
| "\r\n" | ||||
| "  If conditions are imposed on you (whether by court order, agreement or\r\n" | ||||
| "otherwise) that contradict the conditions of this License, they do not\r\n" | ||||
| "excuse you from the conditions of this License.  If you cannot convey a\r\n" | ||||
| "covered work so as to satisfy simultaneously your obligations under this\r\n" | ||||
| "License and any other pertinent obligations, then as a consequence you may\r\n" | ||||
| "not convey it at all.  For example, if you agree to terms that obligate you\r\n" | ||||
| "to collect a royalty for further conveying from those to whom you convey\r\n" | ||||
| "the Program, the only way you could satisfy both those terms and this\r\n" | ||||
| "License would be to refrain entirely from conveying the Program.\r\n" | ||||
| "\r\n" | ||||
| "  13. Use with the GNU Affero General Public License.\r\n" | ||||
| "\r\n" | ||||
| "  Notwithstanding any other provision of this License, you have\r\n" | ||||
| "permission to link or combine any covered work with a work licensed\r\n" | ||||
| "under version 3 of the GNU Affero General Public License into a single\r\n" | ||||
| "combined work, and to convey the resulting work.  The terms of this\r\n" | ||||
| "License will continue to apply to the part which is the covered work,\r\n" | ||||
| "but the special requirements of the GNU Affero General Public License,\r\n" | ||||
| "section 13, concerning interaction through a network will apply to the\r\n" | ||||
| "combination as such.\r\n" | ||||
| "\r\n" | ||||
| "  14. Revised Versions of this License.\r\n" | ||||
| "\r\n" | ||||
| "  The Free Software Foundation may publish revised and/or new versions of\r\n" | ||||
| "the GNU General Public License from time to time.  Such new versions will\r\n" | ||||
| "be similar in spirit to the present version, but may differ in detail to\r\n" | ||||
| "address new problems or concerns.\r\n" | ||||
| "\r\n" | ||||
| "  Each version is given a distinguishing version number.  If the\r\n" | ||||
| "Program specifies that a certain numbered version of the GNU General\r\n" | ||||
| "Public License \"or any later version\" applies to it, you have the\r\n" | ||||
| "option of following the terms and conditions either of that numbered\r\n" | ||||
| "version or of any later version published by the Free Software\r\n" | ||||
| "Foundation.  If the Program does not specify a version number of the\r\n" | ||||
| "GNU General Public License, you may choose any version ever published\r\n" | ||||
| "by the Free Software Foundation.\r\n" | ||||
| "\r\n" | ||||
| "  If the Program specifies that a proxy can decide which future\r\n" | ||||
| "versions of the GNU General Public License can be used, that proxy's\r\n" | ||||
| "public statement of acceptance of a version permanently authorizes you\r\n" | ||||
| "to choose that version for the Program.\r\n" | ||||
| "\r\n" | ||||
| "  Later license versions may give you additional or different\r\n" | ||||
| "permissions.  However, no additional obligations are imposed on any\r\n" | ||||
| "author or copyright holder as a result of your choosing to follow a\r\n" | ||||
| "later version.\r\n" | ||||
| "\r\n" | ||||
| "  15. Disclaimer of Warranty.\r\n" | ||||
| "\r\n" | ||||
| "  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\r\n" | ||||
| "APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\r\n" | ||||
| "HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\r\n" | ||||
| "OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\r\n" | ||||
| "THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n" | ||||
| "PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\r\n" | ||||
| "IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\r\n" | ||||
| "ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r\n" | ||||
| "\r\n" | ||||
| "  16. Limitation of Liability.\r\n" | ||||
| "\r\n" | ||||
| "  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r\n" | ||||
| "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\r\n" | ||||
| "THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\r\n" | ||||
| "GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\r\n" | ||||
| "USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\r\n" | ||||
| "DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\r\n" | ||||
| "PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\r\n" | ||||
| "EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\r\n" | ||||
| "SUCH DAMAGES.\r\n" | ||||
| "\r\n" | ||||
| "  17. Interpretation of Sections 15 and 16.\r\n" | ||||
| "\r\n" | ||||
| "  If the disclaimer of warranty and limitation of liability provided\r\n" | ||||
| "above cannot be given local legal effect according to their terms,\r\n" | ||||
| "reviewing courts shall apply local law that most closely approximates\r\n" | ||||
| "an absolute waiver of all civil liability in connection with the\r\n" | ||||
| "Program, unless a warranty or assumption of liability accompanies a\r\n" | ||||
| "copy of the Program in return for a fee.\r\n" | ||||
| "\r\n" | ||||
| "                     END OF TERMS AND CONDITIONS"; | ||||
							
								
								
									
										20
									
								
								resource.h
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								resource.h
									
										
									
									
									
								
							|  | @ -4,21 +4,37 @@ | |||
| //
 | ||||
| #define IDD_DIALOG                      101 | ||||
| #define IDI_ICON                        102 | ||||
| #define IDD_ABOUTBOX                    103 | ||||
| #define IDD_NOTIFICATION                104 | ||||
| #define IDD_LICENSE                     105 | ||||
| #define IDC_DEVICE                      1001 | ||||
| #define IDC_FILESYSTEM                  1002 | ||||
| #define IDC_START                       1003 | ||||
| #define IDC_CLOSE                       1004 | ||||
| #define IDC_CAPACITY                    1005 | ||||
| #define IDC_ALLOCSIZE                   1006 | ||||
| #define IDC_ABOUT_ICON                  1007 | ||||
| #define IDC_RUFUS_BOLD                  1008 | ||||
| #define IDC_STATUS                      1009 | ||||
| #define IDC_ABOUT                       1010 | ||||
| #define IDC_ABOUT_LICENSE               1030 | ||||
| #define IDC_ABOUT_COPYRIGHTS            1031 | ||||
| #define IDC_ABOUT_RUFUS_URL             1032 | ||||
| #define IDC_ABOUT_BUG_URL               1033 | ||||
| #define IDC_NOTIFICATION_ICON           1040 | ||||
| #define IDC_NOTIFICATION_TEXT           1041 | ||||
| #define IDC_NOTIFICATION_CLOSE          1042 | ||||
| #define IDC_NOTIFICATION_LINE           1043 | ||||
| #define IDC_LICENSE_TEXT                1050 | ||||
| 
 | ||||
| // Next default values for new objects
 | ||||
| // 
 | ||||
| #ifdef APSTUDIO_INVOKED | ||||
| #ifndef APSTUDIO_READONLY_SYMBOLS | ||||
| #define _APS_NO_MFC                     1 | ||||
| #define _APS_NEXT_RESOURCE_VALUE        103 | ||||
| #define _APS_NEXT_RESOURCE_VALUE        106 | ||||
| #define _APS_NEXT_COMMAND_VALUE         40001 | ||||
| #define _APS_NEXT_CONTROL_VALUE         1005 | ||||
| #define _APS_NEXT_CONTROL_VALUE         1051 | ||||
| #define _APS_NEXT_SYMED_VALUE           101 | ||||
| #endif | ||||
| #endif | ||||
|  |  | |||
							
								
								
									
										285
									
								
								rufus.c
									
										
									
									
									
								
							
							
						
						
									
										285
									
								
								rufus.c
									
										
									
									
									
								
							|  | @ -1,5 +1,5 @@ | |||
| /*
 | ||||
|  * Rufus: The Reliable USB Formatting Utility | ||||
|  * Rufus: The Resourceful USB Formatting Utility | ||||
|  * Copyright (c) 2011 Pete Batard <pete@akeo.ie> | ||||
|  *  | ||||
|  * Device enumeration based in part on TestUSBDriveEject.cpp by ahmd: | ||||
|  | @ -34,21 +34,30 @@ | |||
| //#include <fmifs.h>
 | ||||
| // http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=blob;f=misc/badblocks.c
 | ||||
| 
 | ||||
| // TODO: publicize the link and license for USB icon:
 | ||||
| // http://www.softicons.com/free-icons/computer-icons/icons-unleashed-vol-1-by-pc-unleashed/usb-icon
 | ||||
| 
 | ||||
| #include "msapi_utf8.h" | ||||
| #include "resource.h" | ||||
| #include "rufus.h" | ||||
| 
 | ||||
| #if !defined(GUID_DEVINTERFACE_DISK) | ||||
| const GUID GUID_DEVINTERFACE_DISK = { 0x53f56307L, 0xb6bf, 0x11d0, {0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} }; | ||||
| #endif | ||||
| 
 | ||||
| extern char *WindowsErrorString(void); | ||||
| 
 | ||||
| /*
 | ||||
|  * Globals | ||||
|  */ | ||||
| static HINSTANCE hMainInstance; | ||||
| static HWND hDialog, hDeviceList, hCapacity, hFileSystem; | ||||
| HINSTANCE hMainInstance; | ||||
| HWND hMainDialog; | ||||
| char szFolderPath[MAX_PATH]; | ||||
| HWND hStatus; | ||||
| float fScale = 1.0f; | ||||
| 
 | ||||
| static HWND hDeviceList, hCapacity, hFileSystem; | ||||
| 
 | ||||
| 
 | ||||
| #ifdef RUFUS_DEBUG | ||||
| static void _uprintf(const char *format, ...) | ||||
| void _uprintf(const char *format, ...) | ||||
| { | ||||
| 	char buf[4096], *p = buf; | ||||
| 	va_list args; | ||||
|  | @ -69,42 +78,95 @@ static void _uprintf(const char *format, ...) | |||
| 
 | ||||
| 	OutputDebugStringA(buf); | ||||
| } | ||||
| #define uprintf(...) _uprintf(__VA_ARGS__) | ||||
| #else | ||||
| #define uprintf(...) | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| /*
 | ||||
|  * Converts a windows error to human readable string | ||||
|  * uses retval as errorcode, or, if 0, use GetLastError() | ||||
|  * Convert a partition type to its human readable form | ||||
|  * http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
 | ||||
|  */ | ||||
| static char *WindowsErrorString(DWORD retval) | ||||
| static const char* GetPartitionType(BYTE Type) | ||||
| { | ||||
| static char err_string[256]; | ||||
| 
 | ||||
| 	DWORD size; | ||||
| 	DWORD error_code, format_error; | ||||
| 
 | ||||
| 	error_code = retval?retval:GetLastError(); | ||||
| 
 | ||||
| 	safe_sprintf(err_string, sizeof(err_string), "[%d] ", error_code); | ||||
| 
 | ||||
| 	size = FormatMessageU(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, | ||||
| 		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &err_string[strlen(err_string)], | ||||
| 		sizeof(err_string)-(DWORD)strlen(err_string), NULL); | ||||
| 	if (size == 0) { | ||||
| 		format_error = GetLastError(); | ||||
| 		if (format_error) | ||||
| 			safe_sprintf(err_string, sizeof(err_string), | ||||
| 				"Windows error code %u (FormatMessage error code %u)", error_code, format_error); | ||||
| 		else | ||||
| 			safe_sprintf(err_string, sizeof(err_string), "Unknown error code %u", error_code); | ||||
| 	switch(Type) { | ||||
| 	case 0x00:  | ||||
| 		return "Unused"; | ||||
| 	case 0x01: | ||||
| 		return "DOS FAT12"; | ||||
| 	case 0x02: | ||||
| 		return "Logical Disk Manager"; | ||||
| 	case 0x04: | ||||
| 		return "DOS 3.0+ FAT16"; | ||||
| 	case 0x05: | ||||
| 		return "Extended Partition"; | ||||
| 	case 0x06: | ||||
| 		return "DOS 3.31+ FAT16 (Huge)"; | ||||
| 	case 0x07: | ||||
| 		return "NTFS"; | ||||
| 	case 0x0b: | ||||
| 		return "Win95 FAT32"; | ||||
| 	case 0x0c: | ||||
| 		return "Win95 FAT32 (LBA)"; | ||||
| 	case 0x0e: | ||||
| 		return "Win95 FAT16 (LBA)"; | ||||
| 	case 0x0f: | ||||
| 		return "Win95 Extended (LBA)"; | ||||
| 	case 0x11: | ||||
| 		return "Hidden DOS FAT12"; | ||||
| 	case 0x12: | ||||
| 		return "Diagnostics Partition"; | ||||
| 	case 0x14: | ||||
| 		return "Hidden DOS 3.0+ FAT16"; | ||||
| 	case 0x16: | ||||
| 		return "Hidden DOS 3.31+ FAT16 (Huge)"; | ||||
| 	case 0x17: | ||||
| 		return "Hidden NTFS"; | ||||
| 	case 0x1b: | ||||
| 		return "Hidden Win95 FAT32"; | ||||
| 	case 0x1c: | ||||
| 		return "Hidden Win95 FAT32 (LBA)"; | ||||
| 	case 0x1e: | ||||
| 		return "Hidden Win95 FAT16 (LBA)"; | ||||
| 	case 0x1f: | ||||
| 		return "Hidden Win95 Extended (LBA)"; | ||||
| 	case 0x27: | ||||
| 		return "Windows Recovery"; | ||||
| 	case 0x42: | ||||
| 		return "Windows 2000 Dynamic Extended"; | ||||
| 	case 0x63: | ||||
| 		return "Unix System V"; | ||||
| 	case 0x82: | ||||
| 		return "Linux Swap"; | ||||
| 	case 0x83: | ||||
| 		return "Linux"; | ||||
| 	case 0x85: | ||||
| 		return "Linux Extended"; | ||||
| 	case 0x8e: | ||||
| 		return "Linux LVM"; | ||||
| 	case 0x9f: | ||||
| 	case 0xa6: | ||||
| 	case 0xa9: | ||||
| 		return "BSD"; | ||||
| 	case 0xa8: | ||||
| 	case 0xaf: | ||||
| 		return "OS-X"; | ||||
| 	case 0xab: | ||||
| 		return "OS-X (Boot)"; | ||||
| 	case 0xeb: | ||||
| 		return "BeOS"; | ||||
| 	case 0xfa: | ||||
| 		return "Bochs"; | ||||
| 	case 0xfb: | ||||
| 	case 0xfc: | ||||
| 		return "VMWare"; | ||||
| 	case 0xfd: | ||||
| 		return "Linux RAID"; | ||||
| 	default: | ||||
| 		return "Unknown"; | ||||
| 	} | ||||
| 	return err_string; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Opens a drive return both the handle and the drive letter | ||||
|  * Open a drive - return both the handle and the drive letter | ||||
|  */ | ||||
| static BOOL GetDriveHandle(DWORD num, HANDLE* hDrive, char* DriveLetter) | ||||
| { | ||||
|  | @ -117,7 +179,7 @@ static BOOL GetDriveHandle(DWORD num, HANDLE* hDrive, char* DriveLetter) | |||
| 
 | ||||
| 	size = GetLogicalDriveStringsA(sizeof(drives), drives); | ||||
| 	if (size == 0) { | ||||
| 		uprintf("GetLogicalDriveStrings failed: %s\n", WindowsErrorString(0)); | ||||
| 		uprintf("GetLogicalDriveStrings failed: %s\n", WindowsErrorString()); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	if (size > sizeof(drives)) { | ||||
|  | @ -133,14 +195,14 @@ static BOOL GetDriveHandle(DWORD num, HANDLE* hDrive, char* DriveLetter) | |||
| 		safe_sprintf(drive_name, sizeof(drive_name), "\\\\.\\%c:", drive[0]); | ||||
| 		*hDrive = CreateFileA(drive_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); | ||||
| 		if (hDrive == INVALID_HANDLE_VALUE) { | ||||
| 			uprintf("Could not open drive %c: %s\n", WindowsErrorString(0)); | ||||
| 			uprintf("Could not open drive %c: %s\n", WindowsErrorString()); | ||||
| 			continue; | ||||
| 		} | ||||
| 	 | ||||
| 		r = DeviceIoControl(*hDrive, IOCTL_STORAGE_GET_DEVICE_NUMBER, NULL, | ||||
| 			0, &device_number, sizeof(device_number), &size, NULL); | ||||
| 		if ((!r) || (size <= 0)) { | ||||
| 			uprintf("IOCTL_STORAGE_GET_DEVICE_NUMBER failed: %s\n", WindowsErrorString(0)); | ||||
| 			uprintf("IOCTL_STORAGE_GET_DEVICE_NUMBER (GetDriveHandle) failed: %s\n", WindowsErrorString()); | ||||
| 			safe_closehandle(*hDrive); | ||||
| 			break; | ||||
| 		} | ||||
|  | @ -156,7 +218,7 @@ static BOOL GetDriveHandle(DWORD num, HANDLE* hDrive, char* DriveLetter) | |||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Returns the drive letter and volume label | ||||
|  * Return the drive letter and volume label | ||||
|  */ | ||||
| static BOOL GetDriveLabel(DWORD num, char* letter, char** label) | ||||
| { | ||||
|  | @ -169,28 +231,32 @@ static BOOL GetDriveLabel(DWORD num, char* letter, char** label) | |||
| 	if (!GetDriveHandle(num, &hDrive, DrivePath)) | ||||
| 		return FALSE; | ||||
| 	safe_closehandle(hDrive); | ||||
| 
 | ||||
| 	if (!GetVolumeInformationA(DrivePath, volume_label, sizeof(volume_label), NULL, NULL, NULL, NULL, 0)) { | ||||
| 		uprintf("GetVolumeInformation (Label) failed: %s\n", WindowsErrorString(0)); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	*label = volume_label; | ||||
| 	*letter = DrivePath[0]; | ||||
| 
 | ||||
| 	if (GetVolumeInformationA(DrivePath, volume_label, sizeof(volume_label), NULL, NULL, NULL, NULL, 0)) { | ||||
| 		*label = volume_label; | ||||
| 	} else { | ||||
| 		uprintf("GetVolumeInformation (Label) failed: %s\n", WindowsErrorString()); | ||||
| 	} | ||||
| 
 | ||||
| 	return TRUE; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Returns the drive letter and volume label | ||||
|  * Returns the drive properties (size, FS) | ||||
|  */ | ||||
| static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize, char* FSType, DWORD FSTypeSize) | ||||
| { | ||||
| 	BOOL r; | ||||
| 	HANDLE hDrive; | ||||
| 	DWORD size; | ||||
| 	BYTE geometry[128]; | ||||
| 	BYTE geometry[128], layout[1024]; | ||||
| 	void* disk_geometry = (void*)geometry; | ||||
| 	void* drive_layout = (void*)layout; | ||||
| 	PDISK_GEOMETRY_EX DiskGeometry = (PDISK_GEOMETRY_EX)disk_geometry; | ||||
| 	PDRIVE_LAYOUT_INFORMATION_EX DriveLayout = (PDRIVE_LAYOUT_INFORMATION_EX)drive_layout; | ||||
| 	char DrivePath[] = "#:\\"; | ||||
| 	DWORD i, nb_partitions = 0; | ||||
| 
 | ||||
| 	*DriveSize = 0; | ||||
| 
 | ||||
|  | @ -200,22 +266,54 @@ static BOOL GetDriveInfo(DWORD num, LONGLONG* DriveSize, char* FSType, DWORD FST | |||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,  | ||||
| 			NULL, 0, geometry, sizeof(geometry), &size, NULL ); | ||||
| 	if (!r || size <= 0) { | ||||
| 		uprintf("IOCTL_DISK_GET_DRIVE_GEOMETRY_EX failed: %s\n", WindowsErrorString(0)); | ||||
| 		uprintf("IOCTL_DISK_GET_DRIVE_GEOMETRY_EX failed: %s\n", WindowsErrorString()); | ||||
| 		safe_closehandle(hDrive); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	*DriveSize = ((PDISK_GEOMETRY_EX)(disk_geometry))->DiskSize.QuadPart; | ||||
| 	*DriveSize = DiskGeometry->DiskSize.QuadPart; | ||||
| 
 | ||||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_LAYOUT_EX,  | ||||
| 			NULL, 0, layout, sizeof(layout), &size, NULL ); | ||||
| 	if (!r || size <= 0) { | ||||
| 		uprintf("IOCTL_DISK_GET_DRIVE_LAYOUT_EX failed: %s\n", WindowsErrorString()); | ||||
| 	} else { | ||||
| 		switch (DriveLayout->PartitionStyle) { | ||||
| 		case PARTITION_STYLE_MBR: | ||||
| 			for (i=0; i<DriveLayout->PartitionCount; i++) { | ||||
| 				if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) { | ||||
| 					uprintf("Partition #%d:\n", ++nb_partitions); | ||||
| 					uprintf("  Type: %s (0x%02X)\n  Boot: %s\n  Recognized: %s\n  Hidden Sectors: %d\n", | ||||
| 						GetPartitionType(DriveLayout->PartitionEntry[i].Mbr.PartitionType), | ||||
| 						DriveLayout->PartitionEntry[i].Mbr.PartitionType, | ||||
| 						DriveLayout->PartitionEntry[i].Mbr.BootIndicator?"Yes":"No", | ||||
| 						DriveLayout->PartitionEntry[i].Mbr.RecognizedPartition?"Yes":"No", | ||||
| 						DriveLayout->PartitionEntry[i].Mbr.HiddenSectors); | ||||
| 				} | ||||
| 			} | ||||
| 			uprintf("Partition type: MBR, NB Partitions: %d\n", nb_partitions); | ||||
| 			break; | ||||
| 		case PARTITION_STYLE_GPT: | ||||
| 			uprintf("Partition type: GPT, NB Partitions: %d\n", DriveLayout->PartitionCount); | ||||
| 			break; | ||||
| 		default: | ||||
| 			uprintf("Partition type: RAW\n"); | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	safe_closehandle(hDrive); | ||||
| 
 | ||||
| 	if (!GetVolumeInformationA(DrivePath, NULL, 0, NULL, NULL, NULL, FSType, FSTypeSize)) { | ||||
| 		uprintf("GetVolumeInformation (Properties) failed: %s\n", WindowsErrorString(0)); | ||||
| 		return FALSE; | ||||
| 		safe_sprintf(FSType, FSTypeSize, "Non Windows (Please Select)"); | ||||
| 		uprintf("GetVolumeInformation (Properties) failed: %s\n", WindowsErrorString()); | ||||
| 	} | ||||
| 
 | ||||
| 	return TRUE; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Populate the UI properties | ||||
|  */ | ||||
| static BOOL PopulateProperties(int index) | ||||
| { | ||||
| 	double HumanReadableSize; | ||||
|  | @ -251,7 +349,7 @@ static BOOL PopulateProperties(int index) | |||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Refreshes the list of USB devices | ||||
|  * Refresh the list of USB devices | ||||
|  */ | ||||
| static BOOL GetUSBDevices(void) | ||||
| { | ||||
|  | @ -271,7 +369,7 @@ static BOOL GetUSBDevices(void) | |||
| 
 | ||||
| 	dev_info = SetupDiGetClassDevsA(&GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE); | ||||
| 	if (dev_info == INVALID_HANDLE_VALUE) { | ||||
| 		uprintf("SetupDiGetClassDevs (Interface) failed: %d\n", WindowsErrorString(0)); | ||||
| 		uprintf("SetupDiGetClassDevs (Interface) failed: %d\n", WindowsErrorString()); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -280,7 +378,7 @@ static BOOL GetUSBDevices(void) | |||
| 		memset(buffer, 0, sizeof(buffer)); | ||||
| 		if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_ENUMERATOR_NAME, | ||||
| 				&datatype, (LPBYTE)buffer, sizeof(buffer), &size)) { | ||||
| 			uprintf("SetupDiGetDeviceRegistryProperty (Enumerator Name) failed: %d\n", WindowsErrorString(0)); | ||||
| 			uprintf("SetupDiGetDeviceRegistryProperty (Enumerator Name) failed: %d\n", WindowsErrorString()); | ||||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
|  | @ -289,7 +387,7 @@ static BOOL GetUSBDevices(void) | |||
| 		memset(buffer, 0, sizeof(buffer)); | ||||
| 		if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_FRIENDLYNAME, | ||||
| 				&datatype, (LPBYTE)buffer, sizeof(buffer), &size)) { | ||||
| 			uprintf("SetupDiGetDeviceRegistryProperty (Friendly Name) failed: %d\n", WindowsErrorString(0)); | ||||
| 			uprintf("SetupDiGetDeviceRegistryProperty (Friendly Name) failed: %d\n", WindowsErrorString()); | ||||
| 			continue; | ||||
| 		} | ||||
| 		uprintf("found drive '%s'\n", buffer); | ||||
|  | @ -303,7 +401,7 @@ static BOOL GetUSBDevices(void) | |||
| 
 | ||||
| 			if (!SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &GUID_DEVINTERFACE_DISK, j, &devint_data)) { | ||||
| 				if(GetLastError() != ERROR_NO_MORE_ITEMS) { | ||||
| 					uprintf("SetupDiEnumDeviceInterfaces failed: %s\n", WindowsErrorString(0)); | ||||
| 					uprintf("SetupDiEnumDeviceInterfaces failed: %s\n", WindowsErrorString()); | ||||
| 				} | ||||
| 				break; | ||||
| 			} | ||||
|  | @ -317,18 +415,18 @@ static BOOL GetUSBDevices(void) | |||
| 					} | ||||
| 					devint_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A); | ||||
| 				} else { | ||||
| 					uprintf("SetupDiGetDeviceInterfaceDetail (dummy) failed: %s\n", WindowsErrorString(0)); | ||||
| 					uprintf("SetupDiGetDeviceInterfaceDetail (dummy) failed: %s\n", WindowsErrorString()); | ||||
| 					continue; | ||||
| 				} | ||||
| 			} | ||||
| 			if(!SetupDiGetDeviceInterfaceDetailA(dev_info, &devint_data, devint_detail_data, size, &size, NULL)) { | ||||
| 				uprintf("SetupDiGetDeviceInterfaceDetail (actual) failed: %s\n", WindowsErrorString(0)); | ||||
| 				uprintf("SetupDiGetDeviceInterfaceDetail (actual) failed: %s\n", WindowsErrorString()); | ||||
| 				continue; | ||||
| 			} | ||||
| 
 | ||||
| 			hDrive = CreateFileA(devint_detail_data->DevicePath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); | ||||
| 			if(hDrive == INVALID_HANDLE_VALUE) { | ||||
| 				uprintf("could not open '%s': %s\n", devint_detail_data->DevicePath, WindowsErrorString(0));  | ||||
| 				uprintf("could not open '%s': %s\n", devint_detail_data->DevicePath, WindowsErrorString());  | ||||
| 				continue; | ||||
| 			} | ||||
| 
 | ||||
|  | @ -336,7 +434,7 @@ static BOOL GetUSBDevices(void) | |||
| 			r = DeviceIoControl(hDrive, IOCTL_STORAGE_GET_DEVICE_NUMBER,  | ||||
| 						NULL, 0, &device_number, sizeof(device_number), &size, NULL ); | ||||
| 			if (!r || size <= 0) { | ||||
| 				uprintf("IOCTL_STORAGE_GET_DEVICE_NUMBER 2 failed: %s\n", WindowsErrorString(0)); | ||||
| 				uprintf("IOCTL_STORAGE_GET_DEVICE_NUMBER (GetUSBDevices) failed: %s\n", WindowsErrorString()); | ||||
| 				continue; | ||||
| 			} | ||||
| 
 | ||||
|  | @ -347,7 +445,7 @@ static BOOL GetUSBDevices(void) | |||
| 		} | ||||
| 	} | ||||
| 	IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, 0)); | ||||
| 	PostMessage(hDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0); | ||||
| 	PostMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0); | ||||
| 
 | ||||
| 	return TRUE; | ||||
| } | ||||
|  | @ -359,6 +457,9 @@ static BOOL GetUSBDevices(void) | |||
|  */ | ||||
| static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||
| { | ||||
| 	HDC hDC; | ||||
| 	DRAWITEMSTRUCT* pDI; | ||||
| 
 | ||||
| 	switch (message) { | ||||
| 
 | ||||
| 	case WM_DEVICECHANGE: | ||||
|  | @ -366,15 +467,39 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 		return (INT_PTR)TRUE; | ||||
| 
 | ||||
| 	case WM_INITDIALOG: | ||||
| 		hDialog = hDlg; | ||||
| 		hMainDialog = hDlg; | ||||
| 		hDeviceList = GetDlgItem(hDlg, IDC_DEVICE); | ||||
| 		hCapacity = GetDlgItem(hDlg, IDC_CAPACITY); | ||||
| 		hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM); | ||||
| 		// High DPI scaling
 | ||||
| 		hDC = GetDC(hDlg); | ||||
| 		fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; | ||||
| 		ReleaseDC(hDlg, hDC); | ||||
| 		// Create the status line
 | ||||
| 		CreateStatusBar(); | ||||
| 		// Display the version in the right area of the status bar
 | ||||
| 		SendMessageA(GetDlgItem(hDlg, IDC_STATUS), SB_SETTEXTA, SBT_OWNERDRAW | 1, (LPARAM)APP_VERSION); | ||||
| 		GetUSBDevices(); | ||||
| 		return (INT_PTR)TRUE; | ||||
| 
 | ||||
| 	// Change the colour of the version text in the status bar
 | ||||
| 	case WM_DRAWITEM: | ||||
| 		if (wParam == IDC_STATUS) { | ||||
| 			pDI = (DRAWITEMSTRUCT*)lParam; | ||||
| 			SetBkMode(pDI->hDC, TRANSPARENT); | ||||
| 			SetTextColor(pDI->hDC, GetSysColor(COLOR_3DSHADOW)); | ||||
| 			pDI->rcItem.top += (int)(2.0f * fScale); | ||||
| 			pDI->rcItem.left += (int)(4.0f * fScale); | ||||
| 			DrawTextExA(pDI->hDC, APP_VERSION, -1, &pDI->rcItem, DT_LEFT, NULL); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 		} | ||||
| 		break; | ||||
| 
 | ||||
| 	case WM_COMMAND: | ||||
| 		switch(LOWORD(wParam)) { | ||||
| 		case IDC_ABOUT: | ||||
| 			CreateAboutBox(); | ||||
| 			break; | ||||
| 		case IDC_DEVICE:		// dropdown: device description
 | ||||
| 			switch (HIWORD(wParam)) { | ||||
| 			case CBN_SELCHANGE: | ||||
|  | @ -398,44 +523,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 	return (INT_PTR)FALSE; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Center a dialog with regards to the main application Window or the desktop | ||||
|  */ | ||||
| void CenterDialog(HWND hDlg) | ||||
| { | ||||
| 	POINT Point; | ||||
| 	HWND hParent; | ||||
| 	RECT DialogRect; | ||||
| 	RECT ParentRect; | ||||
| 	int nWidth; | ||||
| 	int nHeight; | ||||
| 
 | ||||
| 	// Get the size of the dialog box.
 | ||||
| 	GetWindowRect(hDlg, &DialogRect); | ||||
| 
 | ||||
| 	// Get the parent
 | ||||
| 	hParent = GetParent(hDlg); | ||||
| 	if (hParent == NULL) { | ||||
| 		hParent = GetDesktopWindow(); | ||||
| 	} | ||||
| 	GetClientRect(hParent, &ParentRect); | ||||
| 
 | ||||
| 	// Calculate the height and width of the current dialog
 | ||||
| 	nWidth = DialogRect.right - DialogRect.left; | ||||
| 	nHeight = DialogRect.bottom - DialogRect.top; | ||||
| 
 | ||||
| 	// Find the center point and convert to screen coordinates.
 | ||||
| 	Point.x = (ParentRect.right - ParentRect.left) / 2; | ||||
| 	Point.y = (ParentRect.bottom - ParentRect.top) / 2; | ||||
| 	ClientToScreen(hParent, &Point); | ||||
| 
 | ||||
| 	// Calculate the new x, y starting point.
 | ||||
| 	Point.x -= nWidth / 2; | ||||
| 	Point.y -= nHeight / 2 + 35; | ||||
| 
 | ||||
| 	// Move the window.
 | ||||
| 	MoveWindow(hDlg, Point.x, Point.y, nWidth, nHeight, FALSE); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Application Entrypoint | ||||
|  |  | |||
							
								
								
									
										40
									
								
								rufus.h
									
										
									
									
									
								
							
							
						
						
									
										40
									
								
								rufus.h
									
										
									
									
									
								
							|  | @ -1,5 +1,5 @@ | |||
| /*
 | ||||
|  * Rufus: The Reliable USB Formatting Utility | ||||
|  * Rufus: The Resourceful USB Formatting Utility | ||||
|  * Copyright (c) 2011 Pete Batard <pete@akeo.ie> | ||||
|  * | ||||
|  * This program is free software: you can redistribute it and/or modify | ||||
|  | @ -20,7 +20,12 @@ | |||
| 
 | ||||
| #define RUFUS_DEBUG | ||||
| 
 | ||||
| #define APP_VERSION                 "Rufus v0.1.0.1" | ||||
| #define APP_VERSION                 "Rufus v1.0.0.1" | ||||
| #define MAX_TOOLTIPS                16 | ||||
| #define WHITE                       RGB(255,255,255) | ||||
| #define SEPARATOR_GREY              RGB(223,223,223) | ||||
| #define RUFUS_URL                   "https://github.com/pbatard/rufus/wiki/Rufus"
 | ||||
| #define BUG_URL                     "https://github.com/pbatard/rufus/issues"
 | ||||
| #define IGNORE_RETVAL(expr)         do { (void)(expr); } while(0) | ||||
| #ifndef ARRAYSIZE | ||||
| #define ARRAYSIZE(A)                (sizeof(A)/sizeof((A)[0])) | ||||
|  | @ -41,17 +46,42 @@ | |||
| #define safe_sprintf _snprintf | ||||
| #define safe_strlen(str) ((((char*)str)==NULL)?0:strlen(str)) | ||||
| #define safe_strdup _strdup | ||||
| 
 | ||||
| #if defined(_MSC_VER) | ||||
| #define safe_vsnprintf(buf, size, format, arg) _vsnprintf_s(buf, size, _TRUNCATE, format, arg) | ||||
| #else | ||||
| #define safe_vsnprintf vsnprintf | ||||
| #endif | ||||
| 
 | ||||
| #if !defined(GUID_DEVINTERFACE_DISK) | ||||
| const GUID GUID_DEVINTERFACE_DISK = { 0x53f56307L, 0xb6bf, 0x11d0, {0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} }; | ||||
| /*
 | ||||
|  * Globals | ||||
|  */ | ||||
| extern HINSTANCE hMainInstance; | ||||
| extern HWND hMainDialog; | ||||
| extern HWND hStatus; | ||||
| extern float fScale; | ||||
| extern char szFolderPath[MAX_PATH]; | ||||
| 
 | ||||
| /*
 | ||||
|  * Shared prototypes | ||||
|  */ | ||||
| extern void CenterDialog(HWND hDlg); | ||||
| extern void CreateStatusBar(void); | ||||
| extern INT_PTR CreateAboutBox(void); | ||||
| 
 | ||||
| #ifdef RUFUS_DEBUG | ||||
| extern void _uprintf(const char *format, ...); | ||||
| #define uprintf(...) _uprintf(__VA_ARGS__) | ||||
| #else | ||||
| #define uprintf(...) | ||||
| #endif | ||||
| 
 | ||||
| /* Custom notifications */ | ||||
| enum MessageType { | ||||
| 	MSG_INFO, | ||||
| 	MSG_WARNING, | ||||
| 	MSG_ERROR | ||||
| }; | ||||
| 
 | ||||
| typedef struct { | ||||
| 	DWORD DeviceType; | ||||
| 	ULONG DeviceNumber; | ||||
|  |  | |||
							
								
								
									
										64
									
								
								rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										64
									
								
								rufus.rc
									
										
									
									
									
								
							|  | @ -29,19 +29,62 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL | |||
| 
 | ||||
| IDD_DIALOG DIALOGEX 12, 12, 221, 260 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_APPWINDOW | ||||
| CAPTION "Rufus" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     PUSHBUTTON      "Close",IDC_CLOSE,119,230,50,14 | ||||
|     PUSHBUTTON      "Start",IDC_START,53,230,50,14 | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,102,223,50,14 | ||||
|     PUSHBUTTON      "Close",IDC_CLOSE,156,223,50,14 | ||||
|     COMBOBOX        IDC_DEVICE,16,20,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | ||||
|     LTEXT           "Device",IDC_STATIC,17,8,22,8 | ||||
|     COMBOBOX        IDC_FILESYSTEM,16,80,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | ||||
|     LTEXT           "File System",IDC_STATIC,17,68,51,10 | ||||
|     COMBOBOX        IDC_CAPACITY,16,49,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | ||||
|     LTEXT           "Capacity",IDC_STATIC,17,37,29,8 | ||||
|     COMBOBOX        IDC_CAPACITY,16,50,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | ||||
|     LTEXT           "Capacity",IDC_STATIC,17,38,29,8 | ||||
|     COMBOBOX        IDC_ALLOCSIZE,16,111,190,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP | ||||
|     LTEXT           "Allocation unit size",IDC_STATIC,17,99,105,10 | ||||
|     PUSHBUTTON      "About...",IDC_ABOUT,16,223,50,14 | ||||
| END | ||||
| 
 | ||||
| IDD_ABOUTBOX DIALOGEX 0, 0, 287, 195 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| CAPTION "About Rufus" | ||||
| FONT 8, "Microsoft Sans Serif", 400, 0, 0x0 | ||||
| BEGIN | ||||
|     ICON            IDI_ICON,IDC_ABOUT_ICON,11,8,20,20 | ||||
|     LTEXT           "Rufus",IDC_RUFUS_BOLD,46,8,25,8,SS_NOPREFIX | SS_NOTIFY | ||||
|     LTEXT           "Copyright (c) 2011 Pete Batard",IDC_STATIC,46,36,139,8 | ||||
|     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP | ||||
|     CONTROL         "<a href=""https://github.com/pbatard/rufus/wiki/Rufus"">https://github.com/pbatard/rufus</a>",IDC_ABOUT_RUFUS_URL, | ||||
|                     "SysLink",WS_TABSTOP,46,47,114,9 | ||||
|     LTEXT           "Version 1.0.0.1",IDC_STATIC,46,19,78,8 | ||||
|     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP | ||||
|     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL | ||||
|     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 | ||||
|     LTEXT           "Portions copyright:",IDC_STATIC,46,95,59,8 | ||||
|     CONTROL         "<a>https://github.com/pbatard/rufus/issues</a>",IDC_ABOUT_BUG_URL, | ||||
|                     "SysLink",WS_TABSTOP,46,76,203,14 | ||||
| END | ||||
| 
 | ||||
| IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63 | ||||
| STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME | ||||
| CAPTION "Rufus" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     LTEXT           "",IDC_NOTIFICATION_LINE,0,0,263,39 | ||||
|     CONTROL         "",IDC_STATIC,"Static",SS_WHITERECT,0,0,263,38 | ||||
|     ICON            32516,IDC_NOTIFICATION_ICON,6,6,20,20 | ||||
|     LTEXT           "",IDC_NOTIFICATION_TEXT,35,10,219,20 | ||||
|     DEFPUSHBUTTON   "Close",IDC_NOTIFICATION_CLOSE,211,44,50,14 | ||||
| END | ||||
| 
 | ||||
| IDD_LICENSE DIALOGEX 0, 0, 335, 205 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| CAPTION "Rufus License" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Close",IDOK,278,187,50,14 | ||||
|     EDITTEXT        IDC_LICENSE_TEXT,7,7,321,176,ES_MULTILINE | ES_READONLY | WS_VSCROLL | ||||
| END | ||||
| 
 | ||||
| 
 | ||||
|  | @ -88,6 +131,19 @@ END | |||
| GUIDELINES DESIGNINFO | ||||
| BEGIN | ||||
|     IDD_DIALOG, DIALOG | ||||
|     BEGIN | ||||
|         BOTTOMMARGIN, 246 | ||||
|     END | ||||
| 
 | ||||
|     IDD_ABOUTBOX, DIALOG | ||||
|     BEGIN | ||||
|     END | ||||
| 
 | ||||
|     IDD_NOTIFICATION, DIALOG | ||||
|     BEGIN | ||||
|     END | ||||
| 
 | ||||
|     IDD_LICENSE, DIALOG | ||||
|     BEGIN | ||||
|     END | ||||
| END | ||||
|  |  | |||
							
								
								
									
										639
									
								
								stdlg.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										639
									
								
								stdlg.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,639 @@ | |||
| /*
 | ||||
|  * Rufus: The Resourceful USB Formatting Utility | ||||
|  * Standard Dialog Routines (Browse for folder, About, etc) | ||||
|  * Copyright (c) 2011 Pete Batard <pete@akeo.ie> | ||||
|  * | ||||
|  * Based on zadig_stdlg.c, part of libwdi: http://libwdi.sf.net
 | ||||
|  * | ||||
|  * This program is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #include <windows.h> | ||||
| #include <windowsx.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <shlobj.h> | ||||
| #include <commdlg.h> | ||||
| 
 | ||||
| #include "rufus.h" | ||||
| #include "msapi_utf8.h" | ||||
| #include "resource.h" | ||||
| #include "license.h" | ||||
| 
 | ||||
| /* Windows versions */ | ||||
| enum WindowsVersion { | ||||
| 	WINDOWS_UNDEFINED, | ||||
| 	WINDOWS_UNSUPPORTED, | ||||
| 	WINDOWS_2K, | ||||
| 	WINDOWS_XP, | ||||
| 	WINDOWS_2003_XP64, | ||||
| 	WINDOWS_VISTA, | ||||
| 	WINDOWS_7, | ||||
| 	WINDOWS_8 | ||||
| }; | ||||
| 
 | ||||
| /* The following is only available on Vista and later */ | ||||
| #if (_WIN32_WINNT >= 0x0600) | ||||
| static HRESULT (WINAPI *pSHCreateItemFromParsingName)(PCWSTR, IBindCtx*, REFIID, void **) = NULL; | ||||
| #endif | ||||
| #define INIT_VISTA_SHELL32 if (pSHCreateItemFromParsingName == NULL) {						\ | ||||
| 	pSHCreateItemFromParsingName = (HRESULT (WINAPI *)(PCWSTR, IBindCtx*, REFIID, void **))	\ | ||||
| 			GetProcAddress(GetModuleHandleA("SHELL32"), "SHCreateItemFromParsingName");		\ | ||||
| 	} | ||||
| #define IS_VISTA_SHELL32_AVAILABLE (pSHCreateItemFromParsingName != NULL) | ||||
| // And this one is simply not available in MinGW32
 | ||||
| static LPITEMIDLIST (WINAPI *pSHSimpleIDListFromPath)(PCWSTR pszPath) = NULL; | ||||
| #define INIT_XP_SHELL32 if (pSHSimpleIDListFromPath == NULL) {								\ | ||||
| 	pSHSimpleIDListFromPath = (LPITEMIDLIST (WINAPI *)(PCWSTR))								\ | ||||
| 			GetProcAddress(GetModuleHandleA("SHELL32"), "SHSimpleIDListFromPath");			\ | ||||
| 	} | ||||
| 
 | ||||
| /* Globals */ | ||||
| static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE; | ||||
| static char* szMessageText = NULL; | ||||
| static char* szMessageTitle = NULL; | ||||
| enum WindowsVersion nWindowsVersion = WINDOWS_UNSUPPORTED; | ||||
| static HWND hBrowseEdit; | ||||
| static WNDPROC pOrgBrowseWndproc; | ||||
| HFONT hBoldFont = NULL; | ||||
| 
 | ||||
| /*
 | ||||
|  * Convert a windows error to human readable string | ||||
|  * uses retval as errorcode, or, if 0, use GetLastError() | ||||
|  */ | ||||
| char *WindowsErrorString(void) | ||||
| { | ||||
| static char err_string[256]; | ||||
| 
 | ||||
| 	DWORD size; | ||||
| 	DWORD error_code, format_error; | ||||
| 
 | ||||
| 	error_code = GetLastError(); | ||||
| 
 | ||||
| 	safe_sprintf(err_string, sizeof(err_string), "[%d] ", error_code); | ||||
| 
 | ||||
| 	size = FormatMessageU(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, | ||||
| 		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &err_string[strlen(err_string)], | ||||
| 		sizeof(err_string)-(DWORD)strlen(err_string), NULL); | ||||
| 	if (size == 0) { | ||||
| 		format_error = GetLastError(); | ||||
| 		if (format_error) | ||||
| 			safe_sprintf(err_string, sizeof(err_string), | ||||
| 				"Windows error code %u (FormatMessage error code %u)", error_code, format_error); | ||||
| 		else | ||||
| 			safe_sprintf(err_string, sizeof(err_string), "Unknown error code %u", error_code); | ||||
| 	} | ||||
| 	return err_string; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Detect Windows version | ||||
|  */ | ||||
| void DetectWindowsVersion(void) | ||||
| { | ||||
| 	OSVERSIONINFO OSVersion; | ||||
| 
 | ||||
| 	memset(&OSVersion, 0, sizeof(OSVERSIONINFO)); | ||||
| 	OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); | ||||
| 	nWindowsVersion = WINDOWS_UNSUPPORTED; | ||||
| 	if ((GetVersionEx(&OSVersion) != 0) && (OSVersion.dwPlatformId == VER_PLATFORM_WIN32_NT)) { | ||||
| 		if ((OSVersion.dwMajorVersion == 5) && (OSVersion.dwMinorVersion == 0)) { | ||||
| 			nWindowsVersion = WINDOWS_2K; | ||||
| 		} else if ((OSVersion.dwMajorVersion == 5) && (OSVersion.dwMinorVersion == 1)) { | ||||
| 			nWindowsVersion = WINDOWS_XP; | ||||
| 		} else if ((OSVersion.dwMajorVersion == 5) && (OSVersion.dwMinorVersion == 2)) { | ||||
| 			nWindowsVersion = WINDOWS_2003_XP64; | ||||
| 		} else if (OSVersion.dwMajorVersion == 6) { | ||||
| 			if (OSVersion.dwBuildNumber < 7000) { | ||||
| 				nWindowsVersion = WINDOWS_VISTA; | ||||
| 			} else { | ||||
| 				nWindowsVersion = WINDOWS_7; | ||||
| 			} | ||||
| 		} else if (OSVersion.dwMajorVersion >= 8) { | ||||
| 			nWindowsVersion = WINDOWS_8; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * We need a sub-callback to read the content of the edit box on exit and update | ||||
|  * our path, else if what the user typed does match the selection, it is discarded. | ||||
|  * Talk about a convoluted way of producing an intuitive folder selection dialog | ||||
|  */ | ||||
| INT CALLBACK BrowseDlgCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||
| { | ||||
| 	switch(message) { | ||||
| 	case WM_DESTROY: | ||||
| 		GetWindowTextU(hBrowseEdit, szFolderPath, sizeof(szFolderPath)); | ||||
| 		break; | ||||
| 	} | ||||
| 	return (INT)CallWindowProc(pOrgBrowseWndproc, hDlg, message, wParam, lParam); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Main BrowseInfo callback to set the initial directory and populate the edit control | ||||
|  */ | ||||
| INT CALLBACK BrowseInfoCallback(HWND hDlg, UINT message, LPARAM lParam, LPARAM pData) | ||||
| { | ||||
| 	char dir[MAX_PATH]; | ||||
| 	wchar_t* wpath; | ||||
| 	LPITEMIDLIST pidl; | ||||
| 
 | ||||
| 	switch(message) { | ||||
| 	case BFFM_INITIALIZED: | ||||
| 		pOrgBrowseWndproc = (WNDPROC)SetWindowLongPtr(hDlg, GWLP_WNDPROC, (LONG_PTR)BrowseDlgCallback); | ||||
| 		// Windows hides the full path in the edit box by default, which is bull.
 | ||||
| 		// Get a handle to the edit control to fix that
 | ||||
| 		hBrowseEdit = FindWindowExA(hDlg, NULL, "Edit", NULL); | ||||
| 		SetWindowTextU(hBrowseEdit, szFolderPath); | ||||
| 		SetFocus(hBrowseEdit); | ||||
| 		// On XP, BFFM_SETSELECTION can't be used with a Unicode Path in SendMessageW
 | ||||
| 		// or a pidl (at least with MinGW) => must use SendMessageA
 | ||||
| 		if (nWindowsVersion <= WINDOWS_XP) { | ||||
| 			SendMessageLU(hDlg, BFFM_SETSELECTION, (WPARAM)TRUE, szFolderPath); | ||||
| 		} else { | ||||
| 			// On Windows 7, MinGW only properly selects the specified folder when using a pidl
 | ||||
| 			wpath = utf8_to_wchar(szFolderPath); | ||||
| 			pidl = (*pSHSimpleIDListFromPath)(wpath); | ||||
| 			safe_free(wpath); | ||||
| 			// NB: see http://connect.microsoft.com/VisualStudio/feedback/details/518103/bffm-setselection-does-not-work-with-shbrowseforfolder-on-windows-7
 | ||||
| 			// for details as to why we send BFFM_SETSELECTION twice.
 | ||||
| 			SendMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); | ||||
| 			Sleep(100); | ||||
| 			PostMessageW(hDlg, BFFM_SETSELECTION, (WPARAM)FALSE, (LPARAM)pidl); | ||||
| 		} | ||||
| 		break; | ||||
| 	case BFFM_SELCHANGED: | ||||
| 		// Update the status
 | ||||
| 		if (SHGetPathFromIDListU((LPITEMIDLIST)lParam, dir)) { | ||||
| 			SendMessageLU(hDlg, BFFM_SETSTATUSTEXT, 0, dir); | ||||
| 			SetWindowTextU(hBrowseEdit, dir); | ||||
| 		} | ||||
| 		break; | ||||
| 	} | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Browse for a folder and update the folder edit box | ||||
|  * Will use the newer IFileOpenDialog if *compiled* for Vista or later | ||||
|  */ | ||||
| void BrowseForFolder(void) { | ||||
| 
 | ||||
| 	BROWSEINFOW bi; | ||||
| 	LPITEMIDLIST pidl; | ||||
| 
 | ||||
| #if (_WIN32_WINNT >= 0x0600)	// Vista and later
 | ||||
| 	WCHAR *wpath; | ||||
| 	size_t i; | ||||
| 	HRESULT hr; | ||||
| 	IShellItem *psi = NULL; | ||||
| 	IShellItem *si_path = NULL;	// Automatically freed
 | ||||
| 	IFileOpenDialog *pfod = NULL; | ||||
| 	WCHAR *fname; | ||||
| 	char* tmp_path = NULL; | ||||
| 
 | ||||
| 	// Even if we have Vista support with the compiler,
 | ||||
| 	// it does not mean we have the Vista API available
 | ||||
| 	INIT_VISTA_SHELL32; | ||||
| 	if (IS_VISTA_SHELL32_AVAILABLE) { | ||||
| 		hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC, | ||||
| 			&IID_IFileOpenDialog, (LPVOID)&pfod); | ||||
| 		if (FAILED(hr)) { | ||||
| 			uprintf("CoCreateInstance for FileOpenDialog failed: error %X", hr); | ||||
| 			pfod = NULL;	// Just in case
 | ||||
| 			goto fallback; | ||||
| 		} | ||||
| 		hr = pfod->lpVtbl->SetOptions(pfod, FOS_PICKFOLDERS); | ||||
| 		if (FAILED(hr)) { | ||||
| 			uprintf("Failed to set folder option for FileOpenDialog: error %X", hr); | ||||
| 			goto fallback; | ||||
| 		} | ||||
| 		// Set the initial folder (if the path is invalid, will simply use last)
 | ||||
| 		wpath = utf8_to_wchar(szFolderPath); | ||||
| 		// The new IFileOpenDialog makes us split the path
 | ||||
| 		fname = NULL; | ||||
| 		if ((wpath != NULL) && (wcslen(wpath) >= 1)) { | ||||
| 			for (i=wcslen(wpath)-1; i!=0; i--) { | ||||
| 				if (wpath[i] == L'\\') { | ||||
| 					wpath[i] = 0; | ||||
| 					fname = &wpath[i+1]; | ||||
| 					break; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		hr = (*pSHCreateItemFromParsingName)(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); | ||||
| 		if (SUCCEEDED(hr)) { | ||||
| 			if (wpath != NULL) { | ||||
| 				hr = pfod->lpVtbl->SetFolder(pfod, si_path); | ||||
| 			} | ||||
| 			if (fname != NULL) { | ||||
| 				hr = pfod->lpVtbl->SetFileName(pfod, fname); | ||||
| 			} | ||||
| 		} | ||||
| 		safe_free(wpath); | ||||
| 
 | ||||
| 		hr = pfod->lpVtbl->Show(pfod, hMainDialog); | ||||
| 		if (SUCCEEDED(hr)) { | ||||
| 			hr = pfod->lpVtbl->GetResult(pfod, &psi); | ||||
| 			if (SUCCEEDED(hr)) { | ||||
| 				psi->lpVtbl->GetDisplayName(psi, SIGDN_FILESYSPATH, &wpath); | ||||
| 				tmp_path = wchar_to_utf8(wpath); | ||||
| 				CoTaskMemFree(wpath); | ||||
| 				if (tmp_path == NULL) { | ||||
| 					uprintf("Could not convert path"); | ||||
| 				} else { | ||||
| 					safe_strcpy(szFolderPath, MAX_PATH, tmp_path); | ||||
| 					safe_free(tmp_path); | ||||
| 				} | ||||
| 			} else { | ||||
| 				uprintf("Failed to set folder option for FileOpenDialog: error %X", hr); | ||||
| 			} | ||||
| 		} else if ((hr & 0xFFFF) != ERROR_CANCELLED) { | ||||
| 			// If it's not a user cancel, assume the dialog didn't show and fallback
 | ||||
| 			uprintf("could not show FileOpenDialog: error %X", hr); | ||||
| 			goto fallback; | ||||
| 		} | ||||
| 		pfod->lpVtbl->Release(pfod); | ||||
| 		return; | ||||
| 	} | ||||
| fallback: | ||||
| 	if (pfod != NULL) { | ||||
| 		pfod->lpVtbl->Release(pfod); | ||||
| 	} | ||||
| #endif | ||||
| 	INIT_XP_SHELL32; | ||||
| 	memset(&bi, 0, sizeof(BROWSEINFOW)); | ||||
| 	bi.hwndOwner = hMainDialog; | ||||
| 	bi.lpszTitle = L"Please select the installation folder:"; | ||||
| 	bi.lpfn = BrowseInfoCallback; | ||||
| 	// BIF_NONEWFOLDERBUTTON = 0x00000200 is unknown on MinGW
 | ||||
| 	bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | | ||||
| 		BIF_DONTGOBELOWDOMAIN | BIF_EDITBOX | 0x00000200; | ||||
| 	pidl = SHBrowseForFolderW(&bi); | ||||
| 	if (pidl != NULL) { | ||||
| 		CoTaskMemFree(pidl); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void CreateBoldFont(HDC dc) { | ||||
| 	TEXTMETRIC tm; | ||||
| 	LOGFONT lf; | ||||
| 
 | ||||
| 	if (hBoldFont != NULL) | ||||
| 		return; | ||||
| 	GetTextMetrics(dc, &tm); | ||||
| 	lf.lfHeight = tm.tmHeight+1; | ||||
| 	lf.lfWidth = tm.tmAveCharWidth+1; | ||||
| 	lf.lfEscapement = 0; | ||||
| 	lf.lfOrientation = 0; | ||||
| 	lf.lfWeight = FW_BOLD; | ||||
| 	lf.lfItalic = tm.tmItalic; | ||||
| 	lf.lfUnderline = FALSE; | ||||
| 	lf.lfStrikeOut = tm.tmStruckOut; | ||||
| 	lf.lfCharSet = tm.tmCharSet; | ||||
| 	lf.lfOutPrecision = OUT_DEFAULT_PRECIS; | ||||
| 	lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; | ||||
| 	lf.lfQuality = DEFAULT_QUALITY; | ||||
| 	lf.lfPitchAndFamily = tm.tmPitchAndFamily; | ||||
| 	GetTextFace(dc, LF_FACESIZE, lf.lfFaceName); | ||||
| 	hBoldFont = CreateFontIndirect(&lf); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Create the application status bar | ||||
|  */ | ||||
| void CreateStatusBar(void) | ||||
| { | ||||
| 	RECT rect; | ||||
| 	int edge[2]; | ||||
| 
 | ||||
| 	// Create the status bar.
 | ||||
| 	hStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, | ||||
| 		0, 0, 0, 0, hMainDialog, (HMENU)IDC_STATUS,  hMainInstance, NULL); | ||||
| 
 | ||||
| 	// Create 2 status areas
 | ||||
| 	GetClientRect(hMainDialog, &rect); | ||||
| 	edge[0] = rect.right - (int)(100.0f*fScale); | ||||
| 	edge[1] = rect.right; | ||||
| 	SendMessage(hStatus, SB_SETPARTS, (WPARAM) 2, (LPARAM)&edge); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Center a dialog with regards to the main application Window or the desktop | ||||
|  */ | ||||
| void CenterDialog(HWND hDlg) | ||||
| { | ||||
| 	POINT Point; | ||||
| 	HWND hParent; | ||||
| 	RECT DialogRect; | ||||
| 	RECT ParentRect; | ||||
| 	int nWidth; | ||||
| 	int nHeight; | ||||
| 
 | ||||
| 	// Get the size of the dialog box.
 | ||||
| 	GetWindowRect(hDlg, &DialogRect); | ||||
| 
 | ||||
| 	// Get the parent
 | ||||
| 	hParent = GetParent(hDlg); | ||||
| 	if (hParent == NULL) { | ||||
| 		hParent = GetDesktopWindow(); | ||||
| 	} | ||||
| 	GetClientRect(hParent, &ParentRect); | ||||
| 
 | ||||
| 	// Calculate the height and width of the current dialog
 | ||||
| 	nWidth = DialogRect.right - DialogRect.left; | ||||
| 	nHeight = DialogRect.bottom - DialogRect.top; | ||||
| 
 | ||||
| 	// Find the center point and convert to screen coordinates.
 | ||||
| 	Point.x = (ParentRect.right - ParentRect.left) / 2; | ||||
| 	Point.y = (ParentRect.bottom - ParentRect.top) / 2; | ||||
| 	ClientToScreen(hParent, &Point); | ||||
| 
 | ||||
| 	// Calculate the new x, y starting point.
 | ||||
| 	Point.x -= nWidth / 2; | ||||
| 	Point.y -= nHeight / 2 + 35; | ||||
| 
 | ||||
| 	// Move the window.
 | ||||
| 	MoveWindow(hDlg, Point.x, Point.y, nWidth, nHeight, FALSE); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * License callback | ||||
|  */ | ||||
| INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||
| { | ||||
| 	switch (message) { | ||||
| 	case WM_INITDIALOG: | ||||
| 		CenterDialog(hDlg); | ||||
| 		SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3); | ||||
| 		break; | ||||
| 	case WM_COMMAND: | ||||
| 		switch (LOWORD(wParam)) { | ||||
| 		case IDOK: | ||||
| 		case IDCANCEL: | ||||
| 			EndDialog(hDlg, LOWORD(wParam)); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 		} | ||||
| 	} | ||||
| 	return (INT_PTR)FALSE; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * About dialog callback | ||||
|  */ | ||||
| INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||
| { | ||||
| 	switch (message) { | ||||
| 	case WM_INITDIALOG: | ||||
| 		CenterDialog(hDlg); | ||||
| 		SetDlgItemTextA(hDlg, IDC_ABOUT_COPYRIGHTS, additional_copyrights); | ||||
| 		break; | ||||
| 	case WM_CTLCOLORSTATIC: | ||||
| 		if ((HWND)lParam == GetDlgItem(hDlg, IDC_RUFUS_BOLD)) { | ||||
| 			CreateBoldFont((HDC)wParam); | ||||
| 			SetBkMode((HDC)wParam, TRANSPARENT); | ||||
| 			SelectObject((HDC)wParam, hBoldFont); | ||||
| 			return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | ||||
| 		} | ||||
| 		break; | ||||
| 	case WM_NOTIFY: | ||||
| 		switch (((LPNMHDR)lParam)->code) { | ||||
| 		case NM_CLICK: | ||||
| 		case NM_RETURN: | ||||
| 			switch (LOWORD(wParam)) { | ||||
| 			case IDC_ABOUT_RUFUS_URL: | ||||
| 				ShellExecuteA(hDlg, "open", RUFUS_URL, NULL, NULL, SW_SHOWNORMAL); | ||||
| 				break; | ||||
| 			case IDC_ABOUT_BUG_URL: | ||||
| 				ShellExecuteA(hDlg, "open", BUG_URL, NULL, NULL, SW_SHOWNORMAL); | ||||
| 				break; | ||||
| 			} | ||||
| 			break; | ||||
| 		} | ||||
| 		break; | ||||
| 	case WM_COMMAND: | ||||
| 		switch (LOWORD(wParam)) { | ||||
| 		case IDOK: | ||||
| 		case IDCANCEL: | ||||
| 			EndDialog(hDlg, LOWORD(wParam)); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 		case IDC_ABOUT_LICENSE: | ||||
| 			DialogBoxA(hMainInstance, MAKEINTRESOURCEA(IDD_LICENSE), hDlg, LicenseCallback); | ||||
| 			break; | ||||
| 		} | ||||
| 		break; | ||||
| 	} | ||||
| 	return (INT_PTR)FALSE; | ||||
| } | ||||
| 
 | ||||
| INT_PTR CreateAboutBox(void) | ||||
| { | ||||
| 	return DialogBoxA(hMainInstance, MAKEINTRESOURCEA(IDD_ABOUTBOX), hMainDialog, AboutCallback); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * We use our own MessageBox for notifications to have greater control (center, no close button, etc) | ||||
|  */ | ||||
| INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||
| { | ||||
| 	LRESULT loc; | ||||
| 	int i; | ||||
| 	// Prevent resizing
 | ||||
| 	static LRESULT disabled[9] = { HTLEFT, HTRIGHT, HTTOP, HTBOTTOM, HTSIZE, | ||||
| 		HTTOPLEFT, HTTOPRIGHT, HTBOTTOMLEFT, HTBOTTOMRIGHT }; | ||||
| 	static HBRUSH white_brush, separator_brush; | ||||
| 
 | ||||
| 	switch (message) { | ||||
| 	case WM_INITDIALOG: | ||||
| 		white_brush = CreateSolidBrush(WHITE); | ||||
| 		separator_brush = CreateSolidBrush(SEPARATOR_GREY); | ||||
| 		CenterDialog(hDlg); | ||||
| 		// Change the default icon
 | ||||
| 		if (Static_SetIcon(GetDlgItem(hDlg, IDC_NOTIFICATION_ICON), hMessageIcon) == 0) { | ||||
| 			uprintf("could not set dialog icon"); | ||||
| 		} | ||||
| 		// Set the dialog title
 | ||||
| 		if (szMessageTitle != NULL) { | ||||
| 			SetWindowTextA(hDlg, szMessageTitle); | ||||
| 		} | ||||
| 		// Set the control text
 | ||||
| 		if (szMessageText != NULL) { | ||||
| 			SetWindowTextA(GetDlgItem(hDlg, IDC_NOTIFICATION_TEXT), szMessageText); | ||||
| 		} | ||||
| 		return (INT_PTR)TRUE; | ||||
| 	case WM_CTLCOLORSTATIC: | ||||
| 		// Change the background colour for static text and icon
 | ||||
| 		SetBkMode((HDC)wParam, TRANSPARENT); | ||||
| 		if ((HWND)lParam == GetDlgItem(hDlg, IDC_NOTIFICATION_LINE)) { | ||||
| 			return (INT_PTR)separator_brush; | ||||
| 		} | ||||
| 		return (INT_PTR)white_brush; | ||||
| 	case WM_NCHITTEST: | ||||
| 		// Check coordinates to prevent resize actions
 | ||||
| 		loc = DefWindowProc(hDlg, message, wParam, lParam); | ||||
| 		for(i = 0; i < 9; i++) { | ||||
| 			if (loc == disabled[i]) { | ||||
| 				return (INT_PTR)TRUE; | ||||
| 			} | ||||
| 		} | ||||
| 		return (INT_PTR)FALSE; | ||||
| 	case WM_COMMAND: | ||||
| 		switch (LOWORD(wParam)) { | ||||
| 		case IDOK: | ||||
| 		case IDCANCEL: | ||||
| 		case IDC_NOTIFICATION_CLOSE: | ||||
| 			EndDialog(hDlg, LOWORD(wParam)); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 		} | ||||
| 		break; | ||||
| 	} | ||||
| 	return (INT_PTR)FALSE; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Display a custom notification | ||||
|  */ | ||||
| void Notification(int type, char* text, char* title) | ||||
| { | ||||
| 	szMessageText = text; | ||||
| 	szMessageTitle = title; | ||||
| 	switch(type) { | ||||
| 	case MSG_WARNING: | ||||
| 		hMessageIcon = LoadIcon(NULL, IDI_WARNING); | ||||
| 		break; | ||||
| 	case MSG_ERROR: | ||||
| 		hMessageIcon = LoadIcon(NULL, IDI_ERROR); | ||||
| 		break; | ||||
| 	case MSG_INFO: | ||||
| 	default: | ||||
| 		hMessageIcon = LoadIcon(NULL, IDI_INFORMATION); | ||||
| 		break; | ||||
| 	} | ||||
| 	DialogBox(hMainInstance, MAKEINTRESOURCE(IDD_NOTIFICATION), hMainDialog, NotificationCallback); | ||||
| 	szMessageText = NULL; | ||||
| } | ||||
| 
 | ||||
| struct { | ||||
| 	HWND hTip; | ||||
| 	WNDPROC original_proc; | ||||
| 	LPWSTR wstring; | ||||
| } ttlist[MAX_TOOLTIPS] = { {0} }; | ||||
| 
 | ||||
| INT_PTR CALLBACK TooltipCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||
| { | ||||
| 	LPNMTTDISPINFOW lpnmtdi; | ||||
| 	int i = MAX_TOOLTIPS; | ||||
| 
 | ||||
| 	// Make sure we have an original proc
 | ||||
| 	for (i=0; i<MAX_TOOLTIPS; i++) { | ||||
| 		if (ttlist[i].hTip == hDlg) break; | ||||
| 	} | ||||
| 	if (i == MAX_TOOLTIPS) { | ||||
| 		return (INT_PTR)FALSE; | ||||
| 	} | ||||
| 
 | ||||
| 	switch (message) | ||||
| 	{ | ||||
| 	case WM_NOTIFY: | ||||
| 		switch (((LPNMHDR)lParam)->code) { | ||||
| 		case TTN_GETDISPINFOW: | ||||
| 			lpnmtdi = (LPNMTTDISPINFOW)lParam; | ||||
| 			lpnmtdi->lpszText = ttlist[i].wstring; | ||||
| 			SendMessage(hDlg, TTM_SETMAXTIPWIDTH, 0, 300); | ||||
| 			return (INT_PTR)TRUE; | ||||
| 		} | ||||
| 		break; | ||||
| 	} | ||||
| 	return CallWindowProc(ttlist[i].original_proc, hDlg, message, wParam, lParam); | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Create a tooltip for the control passed as first parameter | ||||
|  * duration sets the duration in ms. Use -1 for default | ||||
|  * message is an UTF-8 string | ||||
|  */ | ||||
| HWND CreateTooltip(HWND hControl, char* message, int duration) | ||||
| { | ||||
| 	TOOLINFOW toolInfo = {0}; | ||||
| 	int i; | ||||
| 
 | ||||
| 	if ( (hControl == NULL) || (message == NULL) ) { | ||||
| 		return (HWND)NULL; | ||||
| 	} | ||||
| 
 | ||||
| 	// Find an empty slot
 | ||||
| 	for (i=0; i<MAX_TOOLTIPS; i++) { | ||||
| 		if (ttlist[i].hTip == NULL) break; | ||||
| 	} | ||||
| 	if (i == MAX_TOOLTIPS) { | ||||
| 		return (HWND)NULL; // No more space
 | ||||
| 	} | ||||
| 
 | ||||
| 	// Create the tooltip window
 | ||||
| 	ttlist[i].hTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, | ||||
| 		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hMainDialog, NULL, | ||||
| 		hMainInstance, NULL); | ||||
| 
 | ||||
| 	if (ttlist[i].hTip == NULL) { | ||||
| 		return (HWND)NULL; | ||||
| 	} | ||||
| 
 | ||||
| 	// Subclass the tooltip to handle multiline
 | ||||
| 	ttlist[i].original_proc = (WNDPROC)SetWindowLongPtr(ttlist[i].hTip, GWLP_WNDPROC, (LONG_PTR)TooltipCallback); | ||||
| 
 | ||||
| 	// Set the string to display (can be multiline)
 | ||||
| 	ttlist[i].wstring = utf8_to_wchar(message); | ||||
| 
 | ||||
| 	// Set tooltip duration (ms)
 | ||||
| 	PostMessage(ttlist[i].hTip, TTM_SETDELAYTIME, (WPARAM)TTDT_AUTOPOP, (LPARAM)duration); | ||||
| 
 | ||||
| 	// Associate the tooltip to the control
 | ||||
| 	toolInfo.cbSize = sizeof(toolInfo); | ||||
| 	toolInfo.hwnd = ttlist[i].hTip;	// Set to the tooltip itself to ease up subclassing
 | ||||
| 	toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS; | ||||
| 	toolInfo.uId = (UINT_PTR)hControl; | ||||
| 	toolInfo.lpszText = LPSTR_TEXTCALLBACKW; | ||||
| 	SendMessageW(ttlist[i].hTip, TTM_ADDTOOLW, 0, (LPARAM)&toolInfo); | ||||
| 
 | ||||
| 	return ttlist[i].hTip; | ||||
| } | ||||
| 
 | ||||
| void DestroyTooltip(HWND hWnd) | ||||
| { | ||||
| 	int i; | ||||
| 
 | ||||
| 	if (hWnd == NULL) return; | ||||
| 	for (i=0; i<MAX_TOOLTIPS; i++) { | ||||
| 		if (ttlist[i].hTip == hWnd) break; | ||||
| 	} | ||||
| 	if (i == MAX_TOOLTIPS) return; | ||||
| 	DestroyWindow(hWnd); | ||||
| 	safe_free(ttlist[i].wstring); | ||||
| 	ttlist[i].original_proc = NULL; | ||||
| 	ttlist[i].hTip = NULL; | ||||
| } | ||||
| 
 | ||||
| void DestroyAllTooltips(void) | ||||
| { | ||||
| 	int i; | ||||
| 
 | ||||
| 	for (i=0; i<MAX_TOOLTIPS; i++) { | ||||
| 		if (ttlist[i].hTip == NULL) continue; | ||||
| 		DestroyWindow(ttlist[i].hTip); | ||||
| 		safe_free(ttlist[i].wstring); | ||||
| 	} | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue