├── .idea
├── .gitignore
├── .name
├── BDS_MOD_SAMPLE.iml
├── misc.xml
└── modules.xml
├── CMakeLists.txt
├── LICENSE
├── dllmain.cpp
├── hook
└── SymHook.h
├── lib
├── detours.h
├── detours.lib
├── detver.h
└── mod.h
├── mul_finder.txt
├── readme.txt
└── src
├── Sample.cpp
└── Sample.h
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | mul_feature_finder
--------------------------------------------------------------------------------
/.idea/BDS_MOD_SAMPLE.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.17)
2 | project(mul_feature_finder)
3 |
4 | set(CMAKE_CXX_STANDARD 17)
5 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
6 | add_compile_definitions(-O3 -Wall)
7 | elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
8 | add_compile_options(/wd4819 /EHsc)
9 | endif ()
10 |
11 | #上面不用管
12 | include_directories(${PROJECT_NAME} lib hook src) #这里是.h文件的文件夹
13 | add_library(${PROJECT_NAME} SHARED dllmain.cpp src/Sample.cpp) #这里是.cpp文件
14 | target_link_libraries(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/lib/detours.lib)
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : 定义 DLL 应用程序的入口点。
2 | #include
3 | #include "src/Sample.h"
4 |
5 | void mod_init() {
6 | initConfig();
7 | }
8 |
9 | void mod_exit() {
10 |
11 |
12 | }
13 |
14 | BOOL APIENTRY DllMain(HMODULE hModule,
15 | DWORD ul_reason_for_call,
16 | LPVOID lpReserved
17 | ) {
18 | switch (ul_reason_for_call) {
19 | case DLL_PROCESS_ATTACH:
20 | mod_init();
21 | break;
22 | case DLL_THREAD_ATTACH:
23 | break;
24 | case DLL_THREAD_DETACH:
25 | break;
26 | case DLL_PROCESS_DETACH:
27 | mod_exit();
28 | break;
29 | }
30 | return TRUE;
31 | }
32 |
--------------------------------------------------------------------------------
/hook/SymHook.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace SymHook {
4 | using RVA = unsigned int;
5 |
6 | // [ԭ��] private: static class std::unordered_map,class std::allocator >,class SharedPtr,struct std::hash,class std::allocator > >,struct std::equal_to,class std::allocator > >,class std::allocator,class std::allocator > const ,class SharedPtr > > > BlockTypeRegistry::mBlockLookupMap
7 | // [����] ?mBlockLookupMap@BlockTypeRegistry@@0V?$unordered_map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$SharedPtr@VBlockLegacy@@@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$SharedPtr@VBlockLegacy@@@@@std@@@2@@std@@A
8 | constexpr RVA MSSYM_MD5_ceb8b47184006e4d7622b39978535236 = 0x01973620;
9 |
10 | // [ԭ��] public: virtual void __cdecl MinecraftEventing::fireEventPlayerMessageChat(class std::basic_string,class std::allocator > const & __ptr64,class std::basic_string,class std::allocator > const & __ptr64) __ptr64
11 | // [����] ?fireEventPlayerMessageChat@MinecraftEventing@@UEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z
12 | constexpr RVA MSSYM_MD5_c5508c07a9bc049d2b327ac921a4b334 = 0x002EFE60;
13 |
14 | // [ԭ��] public: void __cdecl Level::spawnParticleEffect(class std::basic_string,class std::allocator > const & __ptr64,class Vec3 const & __ptr64,class Dimension * __ptr64) __ptr64
15 | // [����] ?spawnParticleEffect@Level@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVVec3@@PEAVDimension@@@Z
16 | constexpr RVA MSSYM_MD5_a2fdc6a066bbe9a360c9c9d76725a8fb = 0x00A79650;
17 |
18 | // [ԭ��] void __cdecl CommandUtils::displayLocalizableMessage(bool,class Player & __ptr64,class std::basic_string,class std::allocator > const & __ptr64,class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > const & __ptr64)
19 | // [����] ?displayLocalizableMessage@CommandUtils@@YAX_NAEAVPlayer@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@@Z
20 | constexpr RVA MSSYM_MD5_24be62e9330073695808606844de0d99 = 0x00445CB0;
21 |
22 | // [ԭ��] public: virtual void __cdecl ServerLevel::tick(void) __ptr64
23 | // [����] ?tick@ServerLevel@@UEAAXXZ
24 | constexpr RVA MSSYM_B1QA4tickB1AE11ServerLevelB2AAA7UEAAXXZ = 0x004EA570;
25 |
26 | // [ԭ��] public: virtual int __cdecl ServerPlayer::tickWorld(struct Tick const & __ptr64) __ptr64
27 | // [����] ?tickWorld@ServerPlayer@@UEAAHAEBUTick@@@Z
28 | constexpr RVA MSSYM_B1QA9tickWorldB1AE12ServerPlayerB2AAE13UEAAHAEBUTickB3AAAA1Z = 0x004ED3C0;
29 |
30 | // [ԭ��] public: virtual void __cdecl Dimension::tick(void) __ptr64
31 | // [����] ?tick@Dimension@@UEAAXXZ
32 | constexpr RVA MSSYM_B1QA4tickB1AA9DimensionB2AAA7UEAAXXZ = 0x00A633C0;
33 |
34 | // [ԭ��] public: virtual void __cdecl Level::tick(void) __ptr64
35 | // [����] ?tick@Level@@UEAAXXZ
36 | constexpr RVA MSSYM_B1QA4tickB1AA5LevelB2AAA7UEAAXXZ = 0x00A75A30;
37 |
38 | // [ԭ��] public: void __cdecl LevelChunk::tick(class BlockSource & __ptr64,struct Tick const & __ptr64) __ptr64
39 | // [����] ?tick@LevelChunk@@QEAAXAEAVBlockSource@@AEBUTick@@@Z
40 | constexpr RVA MSSYM_B1QA4tickB1AE10LevelChunkB2AAE20QEAAXAEAVBlockSourceB2AAA8AEBUTickB3AAAA1Z = 0x00A30750;
41 |
42 | // [ԭ��] public: void __cdecl LevelChunk::tickBlocks(class BlockSource & __ptr64) __ptr64
43 | // [����] ?tickBlocks@LevelChunk@@QEAAXAEAVBlockSource@@@Z
44 | constexpr RVA MSSYM_B1QE10tickBlocksB1AE10LevelChunkB2AAE20QEAAXAEAVBlockSourceB3AAAA1Z = 0x00A31630;
45 |
46 | // [ԭ��] public: void __cdecl LevelChunk::tickBlockEntities(class BlockSource & __ptr64) __ptr64
47 | // [����] ?tickBlockEntities@LevelChunk@@QEAAXAEAVBlockSource@@@Z
48 | constexpr RVA MSSYM_B1QE17tickBlockEntitiesB1AE10LevelChunkB2AAE20QEAAXAEAVBlockSourceB3AAAA1Z = 0x00A36690;
49 |
50 | // [ԭ��] public: void __cdecl Spawner::tick(class BlockSource & __ptr64,class LevelChunk const & __ptr64) __ptr64
51 | // [����] ?tick@Spawner@@QEAAXAEAVBlockSource@@AEBVLevelChunk@@@Z
52 | constexpr RVA MSSYM_B1QA4tickB1AA7SpawnerB2AAE20QEAAXAEAVBlockSourceB2AAE14AEBVLevelChunkB3AAAA1Z = 0x00B3C410;
53 |
54 | // [ԭ��] public: bool __cdecl BlockTickingQueue::tickPendingTicks(class BlockSource & __ptr64,struct Tick const & __ptr64,int,bool) __ptr64
55 | // [����] ?tickPendingTicks@BlockTickingQueue@@QEAA_NAEAVBlockSource@@AEBUTick@@H_N@Z
56 | constexpr RVA MSSYM_B1QE16tickPendingTicksB1AE17BlockTickingQueueB2AAA4QEAAB1UE16NAEAVBlockSourceB2AAA8AEBUTickB2AAA1HB1UA1NB1AA1Z = 0x00A204D0;
57 |
58 | // [ԭ��] public: virtual void __cdecl Dimension::tickRedstone(void) __ptr64
59 | // [����] ?tickRedstone@Dimension@@UEAAXXZ
60 | constexpr RVA MSSYM_B1QE12tickRedstoneB1AA9DimensionB2AAA7UEAAXXZ = 0x00A63010;
61 |
62 | // [ԭ��] public: virtual void __cdecl Actor::getDebugText(class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > & __ptr64) __ptr64
63 | // [����] ?getDebugText@Actor@@UEAAXAEAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z
64 | constexpr RVA MSSYM_MD5_f04fad6bac034f1e861181d3580320f2 = 0x00569BC0;
65 |
66 | // [ԭ��] public: virtual class Vec3 const & __ptr64 __cdecl Actor::getPos(void)const __ptr64
67 | // [����] ?getPos@Actor@@UEBAAEBVVec3@@XZ
68 | constexpr RVA MSSYM_B1QA6getPosB1AA5ActorB2AAE12UEBAAEBVVec3B2AAA2XZ = 0x00554A80;
69 |
70 | // [ԭ��] public: virtual bool __cdecl Actor::attack(class Actor & __ptr64) __ptr64
71 | // [����] ?attack@Actor@@UEAA_NAEAV1@@Z
72 | constexpr RVA MSSYM_B1QA6attackB1AA5ActorB2AAA4UEAAB1UA6NAEAV1B2AAA1Z = 0x00550BF0;
73 |
74 | // [ԭ��] public: virtual bool __cdecl Player::attack(class Actor & __ptr64) __ptr64
75 | // [����] ?attack@Player@@UEAA_NAEAVActor@@@Z
76 | constexpr RVA MSSYM_B1QA6attackB1AA6PlayerB2AAA4UEAAB1UE10NAEAVActorB3AAAA1Z = 0x0071BF40;
77 |
78 | // [ԭ��] public: void __cdecl Explosion::explode(void) __ptr64
79 | // [����] ?explode@Explosion@@QEAAXXZ
80 | constexpr RVA MSSYM_B1QA7explodeB1AA9ExplosionB2AAA7QEAAXXZ = 0x00A69850;
81 |
82 | // [ԭ��] public: virtual void __cdecl Actor::setNameTag(class std::basic_string,class std::allocator > const & __ptr64) __ptr64
83 | // [����] ?setNameTag@Actor@@UEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
84 | constexpr RVA MSSYM_B1QE10setNameTagB1AA5ActorB2AAA9UEAAXAEBVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB3AAAA1Z = 0x00562DA0;
85 |
86 | // [ԭ��] public: virtual void __cdecl Mob::buildDebugInfo(class std::basic_string,class std::allocator > & __ptr64)const __ptr64
87 | // [����] ?buildDebugInfo@Mob@@UEBAXAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
88 | constexpr RVA MSSYM_B1QE14buildDebugInfoB1AA3MobB2AAA9UEBAXAEAVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB3AAAA1Z = 0x006F4960;
89 |
90 | // [ԭ��] public: class Vec3 __cdecl Actor::getViewVector(float)const __ptr64
91 | // [����] ?getViewVector@Actor@@QEBA?AVVec3@@M@Z
92 | constexpr RVA MSSYM_B1QE13getViewVectorB1AA5ActorB2AAA4QEBAB1QA6AVVec3B2AAA1MB1AA1Z = 0x005552A0;
93 |
94 | // [ԭ��] public: virtual class std::basic_string,class std::allocator > const & __ptr64 __cdecl Actor::getNameTag(void)const __ptr64
95 | // [����] ?getNameTag@Actor@@UEBAAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
96 | constexpr RVA MSSYM_B1QE10getNameTagB1AA5ActorB2AAA8UEBAAEBVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB2AAA2XZ = 0x00562BC0;
97 |
98 | // [ԭ��] public: virtual void __cdecl ServerPlayer::setPlayerGameType(enum GameType) __ptr64
99 | // [����] ?setPlayerGameType@ServerPlayer@@UEAAXW4GameType@@@Z
100 | constexpr RVA MSSYM_B1QE17setPlayerGameTypeB1AE12ServerPlayerB2AAE15UEAAXW4GameTypeB3AAAA1Z = 0x004F1A20;
101 |
102 | // [ԭ��] private: virtual bool __cdecl DyePowderItem::_useOn(class ItemStack & __ptr64,class Actor & __ptr64,class BlockPos,unsigned char,float,float,float)const __ptr64
103 | // [����] ?_useOn@DyePowderItem@@EEBA_NAEAVItemStack@@AEAVActor@@VBlockPos@@EMMM@Z
104 | constexpr RVA MSSYM_B2QUA5useOnB1AE13DyePowderItemB2AAA4EEBAB1UE14NAEAVItemStackB2AAA9AEAVActorB2AAA9VBlockPosB2AAA4EMMMB1AA1Z = 0x007D56D0;
105 |
106 | // [ԭ��] private: virtual bool __cdecl RedStoneDustItem::_useOn(class ItemStack & __ptr64,class Actor & __ptr64,class BlockPos,unsigned char,float,float,float)const __ptr64
107 | // [����] ?_useOn@RedStoneDustItem@@EEBA_NAEAVItemStack@@AEAVActor@@VBlockPos@@EMMM@Z
108 | constexpr RVA MSSYM_B2QUA5useOnB1AE16RedStoneDustItemB2AAA4EEBAB1UE14NAEAVItemStackB2AAA9AEAVActorB2AAA9VBlockPosB2AAA4EMMMB1AA1Z = 0x008097E0;
109 |
110 | // [ԭ��] public: class Block const & __ptr64 __cdecl BlockSource::getBlock(class BlockPos const & __ptr64)const __ptr64
111 | // [����] ?getBlock@BlockSource@@QEBAAEBVBlock@@AEBVBlockPos@@@Z
112 | constexpr RVA MSSYM_B1QA8getBlockB1AE11BlockSourceB2AAE13QEBAAEBVBlockB2AAE12AEBVBlockPosB3AAAA1Z = 0x00A16410;
113 |
114 | // [ԭ��] public: class Block const & __ptr64 __cdecl BlockSource::getBlock(int,int,int)const __ptr64
115 | // [����] ?getBlock@BlockSource@@QEBAAEBVBlock@@HHH@Z
116 | constexpr RVA MSSYM_B1QA8getBlockB1AE11BlockSourceB2AAE13QEBAAEBVBlockB2AAA3HHHB1AA1Z = 0x00A1D720;
117 |
118 | // [ԭ��] public: class BlockLegacy const & __ptr64 __cdecl Block::getLegacyBlock(void)const __ptr64
119 | // [����] ?getLegacyBlock@Block@@QEBAAEBVBlockLegacy@@XZ
120 | constexpr RVA MSSYM_B1QE14getLegacyBlockB1AA5BlockB2AAE19QEBAAEBVBlockLegacyB2AAA2XZ = 0x000BBB60;
121 |
122 | // [ԭ��] public: bool __cdecl BlockSource::setBlock(int,int,int,class Block const & __ptr64,int) __ptr64
123 | // [����] ?setBlock@BlockSource@@QEAA_NHHHAEBVBlock@@H@Z
124 | constexpr RVA MSSYM_B1QA8setBlockB1AE11BlockSourceB2AAA4QEAAB1UE13NHHHAEBVBlockB2AAA1HB1AA1Z = 0x00A16490;
125 |
126 | // [ԭ��] public: bool __cdecl BlockSource::setBlock(class BlockPos const & __ptr64,class Block const & __ptr64,int,struct ActorBlockSyncMessage const * __ptr64) __ptr64
127 | // [����] ?setBlock@BlockSource@@QEAA_NAEBVBlockPos@@AEBVBlock@@HPEBUActorBlockSyncMessage@@@Z
128 | constexpr RVA MSSYM_B1QA8setBlockB1AE11BlockSourceB2AAA4QEAAB1UE13NAEBVBlockPosB2AAA9AEBVBlockB2AAE26HPEBUActorBlockSyncMessageB3AAAA1Z = 0x00A164E0;
129 |
130 | // [ԭ��] private: virtual bool __cdecl ShovelItem::_useOn(class ItemStack & __ptr64,class Actor & __ptr64,class BlockPos,unsigned char,float,float,float)const __ptr64
131 | // [����] ?_useOn@ShovelItem@@EEBA_NAEAVItemStack@@AEAVActor@@VBlockPos@@EMMM@Z
132 | constexpr RVA MSSYM_B2QUA5useOnB1AE10ShovelItemB2AAA4EEBAB1UE14NAEAVItemStackB2AAA9AEAVActorB2AAA9VBlockPosB2AAA4EMMMB1AA1Z = 0x0080CF30;
133 |
134 | // [ԭ��] public: void __cdecl BlockSource::updateNeighborsAt(class BlockPos const & __ptr64) __ptr64
135 | // [����] ?updateNeighborsAt@BlockSource@@QEAAXAEBVBlockPos@@@Z
136 | constexpr RVA MSSYM_B1QE17updateNeighborsAtB1AE11BlockSourceB2AAE17QEAAXAEBVBlockPosB3AAAA1Z = 0x00A176C0;
137 |
138 | // [ԭ��] public: virtual enum EventResult __cdecl VanillaServerGameplayEventListener::onBlockPlacedByPlayer(class Player & __ptr64,class Block const & __ptr64,class BlockPos const & __ptr64,bool) __ptr64
139 | // [����] ?onBlockPlacedByPlayer@VanillaServerGameplayEventListener@@UEAA?AW4EventResult@@AEAVPlayer@@AEBVBlock@@AEBVBlockPos@@_N@Z
140 | constexpr RVA MSSYM_B1QE21onBlockPlacedByPlayerB1AE34VanillaServerGameplayEventListenerB2AAA4UEAAB1QE14AW4EventResultB2AAE10AEAVPlayerB2AAA9AEBVBlockB2AAE12AEBVBlockPosB3AAUA1NB1AA1Z = 0x00BD5270;
141 |
142 | // [ԭ��] private: bool __cdecl GameMode::_destroyBlockInternal(class BlockPos const & __ptr64,unsigned char) __ptr64
143 | // [����] ?_destroyBlockInternal@GameMode@@AEAA_NAEBVBlockPos@@E@Z
144 | constexpr RVA MSSYM_B2QUE20destroyBlockInternalB1AA8GameModeB2AAA4AEAAB1UE13NAEBVBlockPosB2AAA1EB1AA1Z = 0x00775EB0;
145 |
146 | // [ԭ��] public: class std::basic_string,class std::allocator > __cdecl Block::toDebugString(void)const __ptr64
147 | // [����] ?toDebugString@Block@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
148 | constexpr RVA MSSYM_B1QE13toDebugStringB1AA5BlockB2AAA4QEBAB1QA2AVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB2AAA2XZ = 0x008D7100;
149 |
150 | // [ԭ��] public: virtual class AABB const & __ptr64 __cdecl BlockLegacy::getOutline(class BlockSource & __ptr64,class BlockPos const & __ptr64,class AABB & __ptr64)const __ptr64
151 | // [����] ?getOutline@BlockLegacy@@UEBAAEBVAABB@@AEAVBlockSource@@AEBVBlockPos@@AEAV2@@Z
152 | constexpr RVA MSSYM_B1QE10getOutlineB1AE11BlockLegacyB2AAE12UEBAAEBVAABBB2AAE15AEAVBlockSourceB2AAE12AEBVBlockPosB2AAA5AEAV2B2AAA1Z = 0x008DA4A0;
153 |
154 | // [ԭ��] public: void __cdecl BlockLegacy::getDebugText(class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > & __ptr64,class BlockPos const & __ptr64)const __ptr64
155 | // [����] ?getDebugText@BlockLegacy@@QEBAXAEAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEBVBlockPos@@@Z
156 | constexpr RVA MSSYM_MD5_794b421b4bf67101f7418cd0d78bad83 = 0x008DB770;
157 |
158 | // [ԭ��] public: virtual void __cdecl BlockActor::getDebugText(class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > & __ptr64,class BlockPos const & __ptr64) __ptr64
159 | // [����] ?getDebugText@BlockActor@@UEAAXAEAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEBVBlockPos@@@Z
160 | constexpr RVA MSSYM_MD5_b5a16de43d7486d6e9b23cfb126773a7 = 0x0089DF70;
161 |
162 | // [ԭ��] public: bool __cdecl BlockSource::setExtraBlock(class BlockPos const & __ptr64,class Block const & __ptr64,int) __ptr64
163 | // [����] ?setExtraBlock@BlockSource@@QEAA_NAEBVBlockPos@@AEBVBlock@@H@Z
164 | constexpr RVA MSSYM_B1QE13setExtraBlockB1AE11BlockSourceB2AAA4QEAAB1UE13NAEBVBlockPosB2AAA9AEBVBlockB2AAA1HB1AA1Z = 0x00A16860;
165 |
166 | // [ԭ��] public: class Block const * __ptr64 __cdecl BlockLegacy::tryGetStateFromLegacyData(unsigned short)const __ptr64
167 | // [����] ?tryGetStateFromLegacyData@BlockLegacy@@QEBAPEBVBlock@@G@Z
168 | constexpr RVA MSSYM_B1QE25tryGetStateFromLegacyDataB1AE11BlockLegacyB2AAE13QEBAPEBVBlockB2AAA1GB1AA1Z = 0x008D8BF0;
169 |
170 | // [ԭ��] private: void __cdecl HopperBlockActor::_tick(class BlockSource & __ptr64,int) __ptr64
171 | // [����] ?_tick@HopperBlockActor@@AEAAXAEAVBlockSource@@H@Z
172 | constexpr RVA MSSYM_B2QUA4tickB1AE16HopperBlockActorB2AAE20AEAAXAEAVBlockSourceB2AAA1HB1AA1Z = 0x008B7AA0;
173 |
174 | // [ԭ��] public: class Biome & __ptr64 __cdecl BlockSource::getBiome(class BlockPos const & __ptr64) __ptr64
175 | // [����] ?getBiome@BlockSource@@QEAAAEAVBiome@@AEBVBlockPos@@@Z
176 | constexpr RVA MSSYM_B1QA8getBiomeB1AE11BlockSourceB2AAE13QEAAAEAVBiomeB2AAE12AEBVBlockPosB3AAAA1Z = 0x00A1CFE0;
177 |
178 | // [ԭ��] public: void __cdecl Village::tick(struct Tick,class BlockSource & __ptr64) __ptr64
179 | // [����] ?tick@Village@@QEAAXUTick@@AEAVBlockSource@@@Z
180 | constexpr RVA MSSYM_B1QA4tickB1AA7VillageB2AAE10QEAAXUTickB2AAE15AEAVBlockSourceB3AAAA1Z = 0x00644680;
181 |
182 | // [ԭ��] public: float __cdecl Village::getApproximateRadius(void)const __ptr64
183 | // [����] ?getApproximateRadius@Village@@QEBAMXZ
184 | constexpr RVA MSSYM_B1QE20getApproximateRadiusB1AA7VillageB2AAA7QEBAMXZ = 0x00645380;
185 |
186 | // [ԭ��] public: virtual void __cdecl VillagerV2::buildDebugInfo(class std::basic_string,class std::allocator > & __ptr64)const __ptr64
187 | // [����] ?buildDebugInfo@VillagerV2@@UEBAXAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
188 | constexpr RVA MSSYM_B1QE14buildDebugInfoB1AE10VillagerV2B2AAA9UEBAXAEAVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB3AAAA1Z = 0x0070A500;
189 |
190 | // [ԭ��] public: static bool __cdecl Village::isVillagePOI(class BlockSource const & __ptr64,class BlockPos const & __ptr64)
191 | // [����] ?isVillagePOI@Village@@SA_NAEBVBlockSource@@AEBVBlockPos@@@Z
192 | constexpr RVA MSSYM_B1QE12isVillagePOIB1AA7VillageB2AAA2SAB1UE16NAEBVBlockSourceB2AAE12AEBVBlockPosB3AAAA1Z = 0x0064FA90;
193 |
194 | // [ԭ��] public: void __cdecl VillageManager::tick(struct Tick const & __ptr64) __ptr64
195 | // [����] ?tick@VillageManager@@QEAAXAEBUTick@@@Z
196 | constexpr RVA MSSYM_B1QA4tickB1AE14VillageManagerB2AAE13QEAAXAEBUTickB3AAAA1Z = 0x00652BD0;
197 |
198 | // [ԭ��] public: class std::weak_ptr __cdecl VillageManager::getPOI(class BlockPos const & __ptr64)const __ptr64
199 | // [����] ?getPOI@VillageManager@@QEBA?AV?$weak_ptr@VPOIInstance@@@std@@AEBVBlockPos@@@Z
200 | constexpr RVA MSSYM_B1QA6getPOIB1AE14VillageManagerB2AAA4QEBAB1QA2AVB2QDA4weakB1UA3ptrB1AE12VPOIInstanceB3AAAA3stdB2AAE12AEBVBlockPosB3AAAA1Z = 0x006562E0;
201 |
202 | // [ԭ��] public: unsigned __int64 __cdecl Village::getBedPOICount(void)const __ptr64
203 | // [����] ?getBedPOICount@Village@@QEBA_KXZ
204 | constexpr RVA MSSYM_B1QE14getBedPOICountB1AA7VillageB2AAA4QEBAB1UA3KXZ = 0x00645420;
205 |
206 | // [ԭ��] public: class Mob * __ptr64 __cdecl Spawner::spawnMob(class BlockSource & __ptr64,struct ActorDefinitionIdentifier const & __ptr64,class Actor * __ptr64,class Vec3 const & __ptr64,bool,bool,bool) __ptr64
207 | // [����] ?spawnMob@Spawner@@QEAAPEAVMob@@AEAVBlockSource@@AEBUActorDefinitionIdentifier@@PEAVActor@@AEBVVec3@@_N44@Z
208 | constexpr RVA MSSYM_B1QA8spawnMobB1AA7SpawnerB2AAE11QEAAPEAVMobB2AAE15AEAVBlockSourceB2AAE29AEBUActorDefinitionIdentifierB2AAA9PEAVActorB2AAA8AEBVVec3B3AAUA3N44B1AA1Z = 0x00B39A30;
209 |
210 | // [ԭ��] public: int __cdecl MobSpawnRules::getSpawnCount(class SpawnConditions const & __ptr64,class BlockSource & __ptr64,class Random & __ptr64,struct MobSpawnHerdInfo const & __ptr64)const __ptr64
211 | // [����] ?getSpawnCount@MobSpawnRules@@QEBAHAEBVSpawnConditions@@AEAVBlockSource@@AEAVRandom@@AEBUMobSpawnHerdInfo@@@Z
212 | constexpr RVA MSSYM_B1QE13getSpawnCountB1AE13MobSpawnRulesB2AAE24QEBAHAEBVSpawnConditionsB2AAE15AEAVBlockSourceB2AAE10AEAVRandomB2AAE20AEBUMobSpawnHerdInfoB3AAAA1Z = 0x0085E940;
213 |
214 | // [ԭ��] public: virtual class MobSpawnerData const * __ptr64 __cdecl BlockLegacy::getMobToSpawn(class SpawnConditions const & __ptr64,class BlockSource & __ptr64)const __ptr64
215 | // [����] ?getMobToSpawn@BlockLegacy@@UEBAPEBVMobSpawnerData@@AEBVSpawnConditions@@AEAVBlockSource@@@Z
216 | constexpr RVA MSSYM_B1QE13getMobToSpawnB1AE11BlockLegacyB2AAE22UEBAPEBVMobSpawnerDataB2AAE19AEBVSpawnConditionsB2AAE15AEAVBlockSourceB3AAAA1Z = 0x008DB2B0;
217 |
218 | // [ԭ��] public: int __cdecl ActorSpawnRuleGroup::getActorSpawnPool(struct ActorDefinitionIdentifier const & __ptr64)const __ptr64
219 | // [����] ?getActorSpawnPool@ActorSpawnRuleGroup@@QEBAHAEBUActorDefinitionIdentifier@@@Z
220 | constexpr RVA MSSYM_B1QE17getActorSpawnPoolB1AE19ActorSpawnRuleGroupB2AAE34QEBAHAEBUActorDefinitionIdentifierB3AAAA1Z = 0x00612280;
221 |
222 | // [ԭ��] private: bool __cdecl Spawner::_popCapAllows(class Dimension const & __ptr64,class MobSpawnerData const & __ptr64,bool,bool)const __ptr64
223 | // [����] ?_popCapAllows@Spawner@@AEBA_NAEBVDimension@@AEBVMobSpawnerData@@_N2@Z
224 | constexpr RVA MSSYM_B2QUE12popCapAllowsB1AA7SpawnerB2AAA4AEBAB1UE14NAEBVDimensionB2AAE18AEBVMobSpawnerDataB3AAUA2N2B1AA1Z = 0x00B39F00;
225 |
226 | // [ԭ��] private: int __cdecl Spawner::_handlePopulationCap(class MobSpawnerData const * __ptr64,class SpawnConditions const & __ptr64,int) __ptr64
227 | // [����] ?_handlePopulationCap@Spawner@@AEAAHPEBVMobSpawnerData@@AEBVSpawnConditions@@H@Z
228 | constexpr RVA MSSYM_B2QUE19handlePopulationCapB1AA7SpawnerB2AAE23AEAAHPEBVMobSpawnerDataB2AAE19AEBVSpawnConditionsB2AAA1HB1AA1Z = 0x00B3BB40;
229 |
230 | // [ԭ��] protected: bool __cdecl Hopper::_tryMoveInItem(class BlockSource & __ptr64,class Container & __ptr64,class ItemStack & __ptr64,int,int,int) __ptr64
231 | // [����] ?_tryMoveInItem@Hopper@@IEAA_NAEAVBlockSource@@AEAVContainer@@AEAVItemStack@@HHH@Z
232 | constexpr RVA MSSYM_B2QUE13tryMoveInItemB1AA6HopperB2AAA4IEAAB1UE16NAEAVBlockSourceB2AAE13AEAVContainerB2AAE13AEAVItemStackB2AAA3HHHB1AA1Z = 0x006D0120;
233 |
234 | // [ԭ��] public: virtual void __cdecl HopperBlockActor::setItem(int,class ItemStack const & __ptr64) __ptr64
235 | // [����] ?setItem@HopperBlockActor@@UEAAXHAEBVItemStack@@@Z
236 | constexpr RVA MSSYM_B1QA7setItemB1AE16HopperBlockActorB2AAE19UEAAXHAEBVItemStackB3AAAA1Z = 0x008B8290;
237 |
238 | // [ԭ��] public: class std::basic_string,class std::allocator > __cdecl ItemStackBase::getName(void)const __ptr64
239 | // [����] ?getName@ItemStackBase@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
240 | constexpr RVA MSSYM_B1QA7getNameB1AE13ItemStackBaseB2AAA4QEBAB1QA2AVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB2AAA2XZ = 0x007F9540;
241 |
242 | // [ԭ��] public: bool __cdecl Item::useOn(class ItemStack & __ptr64,class Actor & __ptr64,int,int,int,unsigned char,float,float,float)const __ptr64
243 | // [����] ?useOn@Item@@QEBA_NAEAVItemStack@@AEAVActor@@HHHEMMM@Z
244 | constexpr RVA MSSYM_B1QA5useOnB1AA4ItemB2AAA4QEBAB1UE14NAEAVItemStackB2AAA9AEAVActorB2AAA7HHHEMMMB1AA1Z = 0x007ED3E0;
245 |
246 | // [ԭ��] public: class BaseCircuitComponent * __ptr64 __cdecl CircuitSceneGraph::getBaseComponent(class BlockPos const & __ptr64) __ptr64
247 | // [����] ?getBaseComponent@CircuitSceneGraph@@QEAAPEAVBaseCircuitComponent@@AEBVBlockPos@@@Z
248 | constexpr RVA MSSYM_B1QE16getBaseComponentB1AE17CircuitSceneGraphB2AAE28QEAAPEAVBaseCircuitComponentB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B8EAB0;
249 |
250 | // [ԭ��] public: void __cdecl CircuitSystem::evaluate(class BlockSource * __ptr64) __ptr64
251 | // [����] ?evaluate@CircuitSystem@@QEAAXPEAVBlockSource@@@Z
252 | constexpr RVA MSSYM_B1QA8evaluateB1AE13CircuitSystemB2AAE20QEAAXPEAVBlockSourceB3AAAA1Z = 0x00B93B50;
253 |
254 | // [ԭ��] public: virtual bool __cdecl ConsumerComponent::evaluate(class CircuitSystem & __ptr64,class BlockPos const & __ptr64) __ptr64
255 | // [����] ?evaluate@ConsumerComponent@@UEAA_NAEAVCircuitSystem@@AEBVBlockPos@@@Z
256 | constexpr RVA MSSYM_B1QA8evaluateB1AE17ConsumerComponentB2AAA4UEAAB1UE18NAEAVCircuitSystemB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B94F60;
257 |
258 | // [ԭ��] public: virtual bool __cdecl TransporterComponent::evaluate(class CircuitSystem & __ptr64,class BlockPos const & __ptr64) __ptr64
259 | // [����] ?evaluate@TransporterComponent@@UEAA_NAEAVCircuitSystem@@AEBVBlockPos@@@Z
260 | constexpr RVA MSSYM_B1QA8evaluateB1AE20TransporterComponentB2AAA4UEAAB1UE18NAEAVCircuitSystemB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B973B0;
261 |
262 | // [ԭ��] public: virtual bool __cdecl RedstoneTorchCapacitor::evaluate(class CircuitSystem & __ptr64,class BlockPos const & __ptr64) __ptr64
263 | // [����] ?evaluate@RedstoneTorchCapacitor@@UEAA_NAEAVCircuitSystem@@AEBVBlockPos@@@Z
264 | constexpr RVA MSSYM_B1QA8evaluateB1AE22RedstoneTorchCapacitorB2AAA4UEAAB1UE18NAEAVCircuitSystemB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B95A30;
265 |
266 | // [ԭ��] public: virtual void __cdecl TransporterComponent::cacheValues(class CircuitSystem & __ptr64,class BlockPos const & __ptr64) __ptr64
267 | // [����] ?cacheValues@TransporterComponent@@UEAAXAEAVCircuitSystem@@AEBVBlockPos@@@Z
268 | constexpr RVA MSSYM_B1QE11cacheValuesB1AE20TransporterComponentB2AAE22UEAAXAEAVCircuitSystemB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B97340;
269 |
270 | // [ԭ��] public: virtual void __cdecl ComparatorCapacitor::cacheValues(class CircuitSystem & __ptr64,class BlockPos const & __ptr64) __ptr64
271 | // [����] ?cacheValues@ComparatorCapacitor@@UEAAXAEAVCircuitSystem@@AEBVBlockPos@@@Z
272 | constexpr RVA MSSYM_B1QE11cacheValuesB1AE19ComparatorCapacitorB2AAE22UEAAXAEAVCircuitSystemB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B94E50;
273 |
274 | // [ԭ��] public: virtual void __cdecl RepeaterCapacitor::cacheValues(class CircuitSystem & __ptr64,class BlockPos const & __ptr64) __ptr64
275 | // [����] ?cacheValues@RepeaterCapacitor@@UEAAXAEAVCircuitSystem@@AEBVBlockPos@@@Z
276 | constexpr RVA MSSYM_B1QE11cacheValuesB1AE17RepeaterCapacitorB2AAE22UEAAXAEAVCircuitSystemB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B96D20;
277 |
278 | // [ԭ��] public: virtual void __cdecl RedstoneTorchCapacitor::cacheValues(class CircuitSystem & __ptr64,class BlockPos const & __ptr64) __ptr64
279 | // [����] ?cacheValues@RedstoneTorchCapacitor@@UEAAXAEAVCircuitSystem@@AEBVBlockPos@@@Z
280 | constexpr RVA MSSYM_B1QE11cacheValuesB1AE22RedstoneTorchCapacitorB2AAE22UEAAXAEAVCircuitSystemB2AAE12AEBVBlockPosB3AAAA1Z = 0x00B95830;
281 |
282 | // [ԭ��] private: int __cdecl RedstoneTorchCapacitor::FindStrongestStrength(class BlockPos const & __ptr64,class CircuitSystem & __ptr64,bool & __ptr64) __ptr64
283 | // [����] ?FindStrongestStrength@RedstoneTorchCapacitor@@AEAAHAEBVBlockPos@@AEAVCircuitSystem@@AEA_N@Z
284 | constexpr RVA MSSYM_B1QE21FindStrongestStrengthB1AE22RedstoneTorchCapacitorB2AAE17AEAAHAEBVBlockPosB2AAE17AEAVCircuitSystemB2AAA3AEAB1UA1NB1AA1Z = 0x00B95AA0;
285 |
286 | // [ԭ��] public: virtual void __cdecl Actor::setPos(class Vec3 const & __ptr64) __ptr64
287 | // [����] ?setPos@Actor@@UEAAXAEBVVec3@@@Z
288 | constexpr RVA MSSYM_B1QA6setPosB1AA5ActorB2AAE13UEAAXAEBVVec3B3AAAA1Z = 0x00554A20;
289 |
290 | // [ԭ��] private: class std::unique_ptr > __cdecl ActorFactory::_constructActor(struct ActorDefinitionIdentifier const & __ptr64,class Vec3 const & __ptr64,class Vec2 const & __ptr64) __ptr64
291 | // [����] ?_constructActor@ActorFactory@@AEAA?AV?$unique_ptr@VActor@@U?$default_delete@VActor@@@std@@@std@@AEBUActorDefinitionIdentifier@@AEBVVec3@@AEBVVec2@@@Z
292 | constexpr RVA MSSYM_MD5_4ad35b002b3931f6af40cb4fe59053ef = 0x005FDF40;
293 |
294 | // [ԭ��] private: void __cdecl Core::Random::_setSeed(unsigned int) __ptr64
295 | // [����] ?_setSeed@Random@Core@@AEAAXI@Z
296 | constexpr RVA MSSYM_B2QUA7setSeedB1AA6RandomB1AA4CoreB2AAA6AEAAXIB1AA1Z = 0x00163ED0;
297 |
298 | // [ԭ��] private: unsigned int __cdecl Core::Random::_genRandInt32(void) __ptr64
299 | // [����] ?_genRandInt32@Random@Core@@AEAAIXZ
300 | constexpr RVA MSSYM_B2QUE12genRandInt32B1AA6RandomB1AA4CoreB2AAA7AEAAIXZ = 0x001B0070;
301 |
302 | // [ԭ��] public: enum VanillaBiomeTypes __cdecl Biome::getBiomeType(void)const __ptr64
303 | // [����] ?getBiomeType@Biome@@QEBA?AW4VanillaBiomeTypes@@XZ
304 | constexpr RVA MSSYM_B1QE12getBiomeTypeB1AA5BiomeB2AAA4QEBAB1QE20AW4VanillaBiomeTypesB2AAA2XZ = 0x00840C80;
305 |
306 | // [ԭ��] public: virtual void __cdecl GrassBlock::tick(class BlockSource & __ptr64,class BlockPos const & __ptr64,class Random & __ptr64)const __ptr64
307 | // [����] ?tick@GrassBlock@@UEBAXAEAVBlockSource@@AEBVBlockPos@@AEAVRandom@@@Z
308 | constexpr RVA MSSYM_B1QA4tickB1AE10GrassBlockB2AAE20UEBAXAEAVBlockSourceB2AAE12AEBVBlockPosB2AAE10AEAVRandomB3AAAA1Z = 0x0093B500;
309 |
310 | // [ԭ��] public: class Dimension * __ptr64 __cdecl Level::getDimension(class AutomaticID)const __ptr64
311 | // [����] ?getDimension@Level@@QEBAPEAVDimension@@V?$AutomaticID@VDimension@@H@@@Z
312 | constexpr RVA MSSYM_B1QE12getDimensionB1AA5LevelB2AAE17QEBAPEAVDimensionB2AAA1VB2QDE11AutomaticIDB1AE10VDimensionB2AAA1HB3AAAA1Z = 0x00A72D50;
313 |
314 | // [ԭ��] public: unsigned __int64 __cdecl NetworkIdentifier::getHash(void)const __ptr64
315 | // [����] ?getHash@NetworkIdentifier@@QEBA_KXZ
316 | constexpr RVA MSSYM_B1QA7getHashB1AE17NetworkIdentifierB2AAA4QEBAB1UA3KXZ = 0x00339FB0;
317 |
318 | // [ԭ��] public: virtual void __cdecl ServerNetworkHandler::handle(class NetworkIdentifier const & __ptr64,class CommandRequestPacket const & __ptr64) __ptr64
319 | // [����] ?handle@ServerNetworkHandler@@UEAAXAEBVNetworkIdentifier@@AEBVCommandRequestPacket@@@Z
320 | constexpr RVA MSSYM_B1QA6handleB1AE20ServerNetworkHandlerB2AAE26UEAAXAEBVNetworkIdentifierB2AAE24AEBVCommandRequestPacketB3AAAA1Z = 0x003A03A0;
321 |
322 | // [ԭ��] public: virtual class std::basic_string,class std::allocator > __cdecl AutomationPlayerCommandOrigin::getName(void)const __ptr64
323 | // [����] ?getName@AutomationPlayerCommandOrigin@@UEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
324 | constexpr RVA MSSYM_B1QA7getNameB1AE29AutomationPlayerCommandOriginB2AAA4UEBAB1QA2AVB2QDA5basicB1UA6stringB1AA2DUB2QDA4charB1UA6traitsB1AA1DB1AA3stdB2AAA1VB2QDA9allocatorB1AA1DB1AA12B2AAA3stdB2AAA2XZ = 0x0041EBA0;
325 |
326 | // [ԭ��] public: virtual enum CommandPermissionLevel __cdecl PlayerCommandOrigin::getPermissionsLevel(void)const __ptr64
327 | // [����] ?getPermissionsLevel@PlayerCommandOrigin@@UEBA?AW4CommandPermissionLevel@@XZ
328 | constexpr RVA MSSYM_B1QE19getPermissionsLevelB1AE19PlayerCommandOriginB2AAA4UEBAB1QE25AW4CommandPermissionLevelB2AAA2XZ = 0x0041E2C0;
329 |
330 | // [ԭ��] public: void __cdecl CommandRegistry::registerCommand(class std::basic_string,class std::allocator > const & __ptr64,char const * __ptr64,enum CommandPermissionLevel,struct CommandFlag,struct CommandFlag) __ptr64
331 | // [����] ?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBDW4CommandPermissionLevel@@UCommandFlag@@3@Z
332 | constexpr RVA MSSYM_MD5_8574de98358ff66b5a913417f44dd706 = 0x0042D260;
333 |
334 | // [ԭ��] public: struct MCRESULT __cdecl MinecraftCommands::executeCommand(class std::shared_ptr,bool)const __ptr64
335 | // [����] ?executeCommand@MinecraftCommands@@QEBA?AUMCRESULT@@V?$shared_ptr@VCommandContext@@@std@@_N@Z
336 | constexpr RVA MSSYM_B1QE14executeCommandB1AE17MinecraftCommandsB2AAA4QEBAB1QE10AUMCRESULTB2AAA1VB2QDA6sharedB1UA3ptrB1AE15VCommandContextB3AAAA3stdB3AAUA1NB1AA1Z = 0x0045C120;
337 |
338 | // [ԭ��] public: class std::unique_ptr > __cdecl CommandRequestPacket::createCommandContext(class NetworkIdentifier const & __ptr64,class Level & __ptr64,int)const __ptr64
339 | // [����] ?createCommandContext@CommandRequestPacket@@QEBA?AV?$unique_ptr@VCommandContext@@U?$default_delete@VCommandContext@@@std@@@std@@AEBVNetworkIdentifier@@AEAVLevel@@H@Z
340 | constexpr RVA MSSYM_MD5_607250778ae0b2889b9591dc98bd2cd0 = 0x0035C140;
341 |
342 | // [ԭ��] private: class std::unique_ptr > __cdecl CommandRegistry::createCommand(struct CommandRegistry::ParseToken const & __ptr64,class CommandOrigin const & __ptr64,int,class std::basic_string,class std::allocator > & __ptr64,class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > & __ptr64)const __ptr64
343 | // [����] ?createCommand@CommandRegistry@@AEBA?AV?$unique_ptr@VCommand@@U?$default_delete@VCommand@@@std@@@std@@AEBUParseToken@1@AEBVCommandOrigin@@HAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@AEAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@3@@Z
344 | constexpr RVA MSSYM_MD5_573632dacfa65053246fc05eeebd2c0e = 0x00425350;
345 |
346 | // [ԭ��] public: virtual enum CommandPermissionLevel __cdecl Player::getCommandPermissionLevel(void)const __ptr64
347 | // [����] ?getCommandPermissionLevel@Player@@UEBA?AW4CommandPermissionLevel@@XZ
348 | constexpr RVA MSSYM_B1QE25getCommandPermissionLevelB1AA6PlayerB2AAA4UEBAB1QE25AW4CommandPermissionLevelB2AAA2XZ = 0x00718760;
349 |
350 | // [ԭ��] public: virtual int __cdecl StoneSlabBlock::getVariant(class Block const & __ptr64)const __ptr64
351 | // [����] ?getVariant@StoneSlabBlock@@UEBAHAEBVBlock@@@Z
352 | constexpr RVA MSSYM_B1QE10getVariantB1AE14StoneSlabBlockB2AAE14UEBAHAEBVBlockB3AAAA1Z = 0x009D36D0;
353 |
354 | // [ԭ��] public: virtual int __cdecl WoodSlabBlock::getVariant(class Block const & __ptr64)const __ptr64
355 | // [����] ?getVariant@WoodSlabBlock@@UEBAHAEBVBlock@@@Z
356 | constexpr RVA MSSYM_B1QE10getVariantB1AE13WoodSlabBlockB2AAE14UEBAHAEBVBlockB3AAAA1Z = 0x00A11720;
357 |
358 | // [ԭ��] public: virtual bool __cdecl OceanMonumentFeature::isFeatureChunk(class BiomeSource const & __ptr64,class Random & __ptr64,class ChunkPos const & __ptr64,unsigned int) __ptr64
359 | // [����] ?isFeatureChunk@OceanMonumentFeature@@UEAA_NAEBVBiomeSource@@AEAVRandom@@AEBVChunkPos@@I@Z
360 | constexpr RVA MSSYM_B1QE14isFeatureChunkB1AE20OceanMonumentFeatureB2AAA4UEAAB1UE16NAEBVBiomeSourceB2AAE10AEAVRandomB2AAE12AEBVChunkPosB2AAA1IB1AA1Z = 0x00ACAB50;
361 |
362 | // [ԭ��] protected: virtual bool __cdecl RandomScatteredLargeFeature::isFeatureChunk(class BiomeSource const & __ptr64,class Random & __ptr64,class ChunkPos const & __ptr64,unsigned int) __ptr64
363 | // [����] ?isFeatureChunk@RandomScatteredLargeFeature@@MEAA_NAEBVBiomeSource@@AEAVRandom@@AEBVChunkPos@@I@Z
364 | constexpr RVA MSSYM_B1QE14isFeatureChunkB1AE27RandomScatteredLargeFeatureB2AAA4MEAAB1UE16NAEBVBiomeSourceB2AAE10AEAVRandomB2AAE12AEBVChunkPosB2AAA1IB1AA1Z = 0x00ADD600;
365 |
366 | // [ԭ��] public: virtual class Biome const * __ptr64 __cdecl LayerBiomeSource::getBiome(int,int)const __ptr64
367 | // [����] ?getBiome@LayerBiomeSource@@UEBAPEBVBiome@@HH@Z
368 | constexpr RVA MSSYM_B1QA8getBiomeB1AE16LayerBiomeSourceB2AAE13UEBAPEBVBiomeB2AAA2HHB1AA1Z = 0x0086A370;
369 |
370 | }
371 |
372 | // �����
373 |
--------------------------------------------------------------------------------
/lib/detours.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Core Detours Functionality (detours.h of detours.lib)
4 | //
5 | // Microsoft Research Detours Package, Version 4.0.1
6 | //
7 | // Copyright (c) Microsoft Corporation. All rights reserved.
8 | //
9 |
10 | #pragma once
11 | #ifndef _DETOURS_H_
12 | #define _DETOURS_H_
13 |
14 | #define DETOURS_VERSION 0x4c0c1 // 0xMAJORcMINORcPATCH
15 |
16 | //////////////////////////////////////////////////////////////////////////////
17 | //
18 |
19 | #undef DETOURS_X64
20 | #undef DETOURS_X86
21 | #undef DETOURS_IA64
22 | #undef DETOURS_ARM
23 | #undef DETOURS_ARM64
24 | #undef DETOURS_BITS
25 | #undef DETOURS_32BIT
26 | #undef DETOURS_64BIT
27 |
28 | #if defined(_X86_)
29 | #define DETOURS_X86
30 | #define DETOURS_OPTION_BITS 64
31 |
32 | #elif defined(_AMD64_)
33 | #define DETOURS_X64
34 | #define DETOURS_OPTION_BITS 32
35 |
36 | #elif defined(_IA64_)
37 | #define DETOURS_IA64
38 | #define DETOURS_OPTION_BITS 32
39 |
40 | #elif defined(_ARM_)
41 | #define DETOURS_ARM
42 |
43 | #elif defined(_ARM64_)
44 | #define DETOURS_ARM64
45 |
46 | #else
47 | #error Unknown architecture (x86, amd64, ia64, arm, arm64)
48 | #endif
49 |
50 | #ifdef _WIN64
51 | #undef DETOURS_32BIT
52 | #define DETOURS_64BIT 1
53 | #define DETOURS_BITS 64
54 | // If all 64bit kernels can run one and only one 32bit architecture.
55 | //#define DETOURS_OPTION_BITS 32
56 | #else
57 | #define DETOURS_32BIT 1
58 | #undef DETOURS_64BIT
59 | #define DETOURS_BITS 32
60 | // If all 64bit kernels can run one and only one 32bit architecture.
61 | //#define DETOURS_OPTION_BITS 32
62 | #endif
63 |
64 | #define VER_DETOURS_BITS DETOUR_STRINGIFY(DETOURS_BITS)
65 |
66 | //////////////////////////////////////////////////////////////////////////////
67 | //
68 |
69 | #if (_MSC_VER < 1299)
70 | typedef LONG LONG_PTR;
71 | typedef ULONG ULONG_PTR;
72 | #endif
73 |
74 | ///////////////////////////////////////////////// SAL 2.0 Annotations w/o SAL.
75 | //
76 | // These definitions are include so that Detours will build even if the
77 | // compiler doesn't have full SAL 2.0 support.
78 | //
79 | #ifndef DETOURS_DONT_REMOVE_SAL_20
80 |
81 | #ifdef DETOURS_TEST_REMOVE_SAL_20
82 | #undef _Analysis_assume_
83 | #undef _Benign_race_begin_
84 | #undef _Benign_race_end_
85 | #undef _Field_range_
86 | #undef _Field_size_
87 | #undef _In_
88 | #undef _In_bytecount_
89 | #undef _In_count_
90 | #undef _In_opt_
91 | #undef _In_opt_bytecount_
92 | #undef _In_opt_count_
93 | #undef _In_opt_z_
94 | #undef _In_range_
95 | #undef _In_reads_
96 | #undef _In_reads_bytes_
97 | #undef _In_reads_opt_
98 | #undef _In_reads_opt_bytes_
99 | #undef _In_reads_or_z_
100 | #undef _In_z_
101 | #undef _Inout_
102 | #undef _Inout_opt_
103 | #undef _Inout_z_count_
104 | #undef _Out_
105 | #undef _Out_opt_
106 | #undef _Out_writes_
107 | #undef _Outptr_result_maybenull_
108 | #undef _Readable_bytes_
109 | #undef _Success_
110 | #undef _Writable_bytes_
111 | #undef _Pre_notnull_
112 | #endif
113 |
114 | #if defined(_Deref_out_opt_z_) && !defined(_Outptr_result_maybenull_)
115 | #define _Outptr_result_maybenull_ _Deref_out_opt_z_
116 | #endif
117 |
118 | #if defined(_In_count_) && !defined(_In_reads_)
119 | #define _In_reads_(x) _In_count_(x)
120 | #endif
121 |
122 | #if defined(_In_opt_count_) && !defined(_In_reads_opt_)
123 | #define _In_reads_opt_(x) _In_opt_count_(x)
124 | #endif
125 |
126 | #if defined(_In_opt_bytecount_) && !defined(_In_reads_opt_bytes_)
127 | #define _In_reads_opt_bytes_(x) _In_opt_bytecount_(x)
128 | #endif
129 |
130 | #if defined(_In_bytecount_) && !defined(_In_reads_bytes_)
131 | #define _In_reads_bytes_(x) _In_bytecount_(x)
132 | #endif
133 |
134 | #ifndef _In_
135 | #define _In_
136 | #endif
137 |
138 | #ifndef _In_bytecount_
139 | #define _In_bytecount_(x)
140 | #endif
141 |
142 | #ifndef _In_count_
143 | #define _In_count_(x)
144 | #endif
145 |
146 | #ifndef _In_opt_
147 | #define _In_opt_
148 | #endif
149 |
150 | #ifndef _In_opt_bytecount_
151 | #define _In_opt_bytecount_(x)
152 | #endif
153 |
154 | #ifndef _In_opt_count_
155 | #define _In_opt_count_(x)
156 | #endif
157 |
158 | #ifndef _In_opt_z_
159 | #define _In_opt_z_
160 | #endif
161 |
162 | #ifndef _In_range_
163 | #define _In_range_(x,y)
164 | #endif
165 |
166 | #ifndef _In_reads_
167 | #define _In_reads_(x)
168 | #endif
169 |
170 | #ifndef _In_reads_bytes_
171 | #define _In_reads_bytes_(x)
172 | #endif
173 |
174 | #ifndef _In_reads_opt_
175 | #define _In_reads_opt_(x)
176 | #endif
177 |
178 | #ifndef _In_reads_opt_bytes_
179 | #define _In_reads_opt_bytes_(x)
180 | #endif
181 |
182 | #ifndef _In_reads_or_z_
183 | #define _In_reads_or_z_
184 | #endif
185 |
186 | #ifndef _In_z_
187 | #define _In_z_
188 | #endif
189 |
190 | #ifndef _Inout_
191 | #define _Inout_
192 | #endif
193 |
194 | #ifndef _Inout_opt_
195 | #define _Inout_opt_
196 | #endif
197 |
198 | #ifndef _Inout_z_count_
199 | #define _Inout_z_count_(x)
200 | #endif
201 |
202 | #ifndef _Out_
203 | #define _Out_
204 | #endif
205 |
206 | #ifndef _Out_opt_
207 | #define _Out_opt_
208 | #endif
209 |
210 | #ifndef _Out_writes_
211 | #define _Out_writes_(x)
212 | #endif
213 |
214 | #ifndef _Outptr_result_maybenull_
215 | #define _Outptr_result_maybenull_
216 | #endif
217 |
218 | #ifndef _Writable_bytes_
219 | #define _Writable_bytes_(x)
220 | #endif
221 |
222 | #ifndef _Readable_bytes_
223 | #define _Readable_bytes_(x)
224 | #endif
225 |
226 | #ifndef _Success_
227 | #define _Success_(x)
228 | #endif
229 |
230 | #ifndef _Pre_notnull_
231 | #define _Pre_notnull_
232 | #endif
233 |
234 | #ifdef DETOURS_INTERNAL
235 |
236 | #pragma warning(disable:4615) // unknown warning type (suppress with older compilers)
237 |
238 | #ifndef _Benign_race_begin_
239 | #define _Benign_race_begin_
240 | #endif
241 |
242 | #ifndef _Benign_race_end_
243 | #define _Benign_race_end_
244 | #endif
245 |
246 | #ifndef _Field_size_
247 | #define _Field_size_(x)
248 | #endif
249 |
250 | #ifndef _Field_range_
251 | #define _Field_range_(x,y)
252 | #endif
253 |
254 | #ifndef _Analysis_assume_
255 | #define _Analysis_assume_(x)
256 | #endif
257 |
258 | #endif // DETOURS_INTERNAL
259 | #endif // DETOURS_DONT_REMOVE_SAL_20
260 |
261 | //////////////////////////////////////////////////////////////////////////////
262 | //
263 | #ifndef GUID_DEFINED
264 | #define GUID_DEFINED
265 | typedef struct _GUID
266 | {
267 | DWORD Data1;
268 | WORD Data2;
269 | WORD Data3;
270 | BYTE Data4[ 8 ];
271 | } GUID;
272 |
273 | #ifdef INITGUID
274 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
275 | const GUID name \
276 | = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
277 | #else
278 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
279 | const GUID name
280 | #endif // INITGUID
281 | #endif // !GUID_DEFINED
282 |
283 | #if defined(__cplusplus)
284 | #ifndef _REFGUID_DEFINED
285 | #define _REFGUID_DEFINED
286 | #define REFGUID const GUID &
287 | #endif // !_REFGUID_DEFINED
288 | #else // !__cplusplus
289 | #ifndef _REFGUID_DEFINED
290 | #define _REFGUID_DEFINED
291 | #define REFGUID const GUID * const
292 | #endif // !_REFGUID_DEFINED
293 | #endif // !__cplusplus
294 |
295 | #ifndef ARRAYSIZE
296 | #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
297 | #endif
298 |
299 | //
300 | //////////////////////////////////////////////////////////////////////////////
301 |
302 | #ifdef __cplusplus
303 | extern "C" {
304 | #endif // __cplusplus
305 |
306 | /////////////////////////////////////////////////// Instruction Target Macros.
307 | //
308 | #define DETOUR_INSTRUCTION_TARGET_NONE ((PVOID)0)
309 | #define DETOUR_INSTRUCTION_TARGET_DYNAMIC ((PVOID)(LONG_PTR)-1)
310 | #define DETOUR_SECTION_HEADER_SIGNATURE 0x00727444 // "Dtr\0"
311 |
312 | extern const GUID DETOUR_EXE_RESTORE_GUID;
313 | extern const GUID DETOUR_EXE_HELPER_GUID;
314 |
315 | #define DETOUR_TRAMPOLINE_SIGNATURE 0x21727444 // Dtr!
316 | typedef struct _DETOUR_TRAMPOLINE DETOUR_TRAMPOLINE, *PDETOUR_TRAMPOLINE;
317 |
318 | /////////////////////////////////////////////////////////// Binary Structures.
319 | //
320 | #pragma pack(push, 8)
321 | typedef struct _DETOUR_SECTION_HEADER
322 | {
323 | DWORD cbHeaderSize;
324 | DWORD nSignature;
325 | DWORD nDataOffset;
326 | DWORD cbDataSize;
327 |
328 | DWORD nOriginalImportVirtualAddress;
329 | DWORD nOriginalImportSize;
330 | DWORD nOriginalBoundImportVirtualAddress;
331 | DWORD nOriginalBoundImportSize;
332 |
333 | DWORD nOriginalIatVirtualAddress;
334 | DWORD nOriginalIatSize;
335 | DWORD nOriginalSizeOfImage;
336 | DWORD cbPrePE;
337 |
338 | DWORD nOriginalClrFlags;
339 | DWORD reserved1;
340 | DWORD reserved2;
341 | DWORD reserved3;
342 |
343 | // Followed by cbPrePE bytes of data.
344 | } DETOUR_SECTION_HEADER, *PDETOUR_SECTION_HEADER;
345 |
346 | typedef struct _DETOUR_SECTION_RECORD
347 | {
348 | DWORD cbBytes;
349 | DWORD nReserved;
350 | GUID guid;
351 | } DETOUR_SECTION_RECORD, *PDETOUR_SECTION_RECORD;
352 |
353 | typedef struct _DETOUR_CLR_HEADER
354 | {
355 | // Header versioning
356 | ULONG cb;
357 | USHORT MajorRuntimeVersion;
358 | USHORT MinorRuntimeVersion;
359 |
360 | // Symbol table and startup information
361 | IMAGE_DATA_DIRECTORY MetaData;
362 | ULONG Flags;
363 |
364 | // Followed by the rest of the IMAGE_COR20_HEADER
365 | } DETOUR_CLR_HEADER, *PDETOUR_CLR_HEADER;
366 |
367 | typedef struct _DETOUR_EXE_RESTORE
368 | {
369 | DWORD cb;
370 | DWORD cbidh;
371 | DWORD cbinh;
372 | DWORD cbclr;
373 |
374 | PBYTE pidh;
375 | PBYTE pinh;
376 | PBYTE pclr;
377 |
378 | IMAGE_DOS_HEADER idh;
379 | union {
380 | IMAGE_NT_HEADERS inh; // all environments have this
381 | #ifdef IMAGE_NT_OPTIONAL_HDR32_MAGIC // some environments do not have this
382 | IMAGE_NT_HEADERS32 inh32;
383 | #endif
384 | #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC // some environments do not have this
385 | IMAGE_NT_HEADERS64 inh64;
386 | #endif
387 | #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC // some environments do not have this
388 | BYTE raw[sizeof(IMAGE_NT_HEADERS64) +
389 | sizeof(IMAGE_SECTION_HEADER) * 32];
390 | #else
391 | BYTE raw[0x108 + sizeof(IMAGE_SECTION_HEADER) * 32];
392 | #endif
393 | };
394 | DETOUR_CLR_HEADER clr;
395 |
396 | } DETOUR_EXE_RESTORE, *PDETOUR_EXE_RESTORE;
397 |
398 | #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC
399 | C_ASSERT(sizeof(IMAGE_NT_HEADERS64) == 0x108);
400 | #endif
401 |
402 | // The size can change, but assert for clarity due to the muddying #ifdefs.
403 | #ifdef _WIN64
404 | C_ASSERT(sizeof(DETOUR_EXE_RESTORE) == 0x688);
405 | #else
406 | C_ASSERT(sizeof(DETOUR_EXE_RESTORE) == 0x678);
407 | #endif
408 |
409 | typedef struct _DETOUR_EXE_HELPER
410 | {
411 | DWORD cb;
412 | DWORD pid;
413 | DWORD nDlls;
414 | CHAR rDlls[4];
415 | } DETOUR_EXE_HELPER, *PDETOUR_EXE_HELPER;
416 |
417 | #pragma pack(pop)
418 |
419 | #define DETOUR_SECTION_HEADER_DECLARE(cbSectionSize) \
420 | { \
421 | sizeof(DETOUR_SECTION_HEADER),\
422 | DETOUR_SECTION_HEADER_SIGNATURE,\
423 | sizeof(DETOUR_SECTION_HEADER),\
424 | (cbSectionSize),\
425 | \
426 | 0,\
427 | 0,\
428 | 0,\
429 | 0,\
430 | \
431 | 0,\
432 | 0,\
433 | 0,\
434 | 0,\
435 | }
436 |
437 | /////////////////////////////////////////////////////////////// Helper Macros.
438 | //
439 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x)
440 | #define DETOURS_STRINGIFY_(x) #x
441 |
442 | ///////////////////////////////////////////////////////////// Binary Typedefs.
443 | //
444 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_BYWAY_CALLBACK)(
445 | _In_opt_ PVOID pContext,
446 | _In_opt_ LPCSTR pszFile,
447 | _Outptr_result_maybenull_ LPCSTR *ppszOutFile);
448 |
449 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FILE_CALLBACK)(
450 | _In_opt_ PVOID pContext,
451 | _In_ LPCSTR pszOrigFile,
452 | _In_ LPCSTR pszFile,
453 | _Outptr_result_maybenull_ LPCSTR *ppszOutFile);
454 |
455 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_SYMBOL_CALLBACK)(
456 | _In_opt_ PVOID pContext,
457 | _In_ ULONG nOrigOrdinal,
458 | _In_ ULONG nOrdinal,
459 | _Out_ ULONG *pnOutOrdinal,
460 | _In_opt_ LPCSTR pszOrigSymbol,
461 | _In_opt_ LPCSTR pszSymbol,
462 | _Outptr_result_maybenull_ LPCSTR *ppszOutSymbol);
463 |
464 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_COMMIT_CALLBACK)(
465 | _In_opt_ PVOID pContext);
466 |
467 | typedef BOOL (CALLBACK *PF_DETOUR_ENUMERATE_EXPORT_CALLBACK)(_In_opt_ PVOID pContext,
468 | _In_ ULONG nOrdinal,
469 | _In_opt_ LPCSTR pszName,
470 | _In_opt_ PVOID pCode);
471 |
472 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FILE_CALLBACK)(_In_opt_ PVOID pContext,
473 | _In_opt_ HMODULE hModule,
474 | _In_opt_ LPCSTR pszFile);
475 |
476 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FUNC_CALLBACK)(_In_opt_ PVOID pContext,
477 | _In_ DWORD nOrdinal,
478 | _In_opt_ LPCSTR pszFunc,
479 | _In_opt_ PVOID pvFunc);
480 |
481 | // Same as PF_DETOUR_IMPORT_FUNC_CALLBACK but extra indirection on last parameter.
482 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FUNC_CALLBACK_EX)(_In_opt_ PVOID pContext,
483 | _In_ DWORD nOrdinal,
484 | _In_opt_ LPCSTR pszFunc,
485 | _In_opt_ PVOID* ppvFunc);
486 |
487 | typedef VOID * PDETOUR_BINARY;
488 | typedef VOID * PDETOUR_LOADED_BINARY;
489 |
490 | //////////////////////////////////////////////////////////// Transaction APIs.
491 | //
492 | LONG WINAPI DetourTransactionBegin(VOID);
493 | LONG WINAPI DetourTransactionAbort(VOID);
494 | LONG WINAPI DetourTransactionCommit(VOID);
495 | LONG WINAPI DetourTransactionCommitEx(_Out_opt_ PVOID **pppFailedPointer);
496 |
497 | LONG WINAPI DetourUpdateThread(_In_ HANDLE hThread);
498 |
499 | LONG WINAPI DetourAttach(_Inout_ PVOID *ppPointer,
500 | _In_ PVOID pDetour);
501 |
502 | LONG WINAPI DetourAttachEx(_Inout_ PVOID *ppPointer,
503 | _In_ PVOID pDetour,
504 | _Out_opt_ PDETOUR_TRAMPOLINE *ppRealTrampoline,
505 | _Out_opt_ PVOID *ppRealTarget,
506 | _Out_opt_ PVOID *ppRealDetour);
507 |
508 | LONG WINAPI DetourDetach(_Inout_ PVOID *ppPointer,
509 | _In_ PVOID pDetour);
510 |
511 | BOOL WINAPI DetourSetIgnoreTooSmall(_In_ BOOL fIgnore);
512 | BOOL WINAPI DetourSetRetainRegions(_In_ BOOL fRetain);
513 | PVOID WINAPI DetourSetSystemRegionLowerBound(_In_ PVOID pSystemRegionLowerBound);
514 | PVOID WINAPI DetourSetSystemRegionUpperBound(_In_ PVOID pSystemRegionUpperBound);
515 |
516 | ////////////////////////////////////////////////////////////// Code Functions.
517 | //
518 | PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule,
519 | _In_ LPCSTR pszFunction);
520 | PVOID WINAPI DetourCodeFromPointer(_In_ PVOID pPointer,
521 | _Out_opt_ PVOID *ppGlobals);
522 | PVOID WINAPI DetourCopyInstruction(_In_opt_ PVOID pDst,
523 | _Inout_opt_ PVOID *ppDstPool,
524 | _In_ PVOID pSrc,
525 | _Out_opt_ PVOID *ppTarget,
526 | _Out_opt_ LONG *plExtra);
527 | BOOL WINAPI DetourSetCodeModule(_In_ HMODULE hModule,
528 | _In_ BOOL fLimitReferencesToModule);
529 | PVOID WINAPI DetourAllocateRegionWithinJumpBounds(_In_ LPCVOID pbTarget,
530 | _Out_ PDWORD pcbAllocatedSize);
531 |
532 | ///////////////////////////////////////////////////// Loaded Binary Functions.
533 | //
534 | HMODULE WINAPI DetourGetContainingModule(_In_ PVOID pvAddr);
535 | HMODULE WINAPI DetourEnumerateModules(_In_opt_ HMODULE hModuleLast);
536 | PVOID WINAPI DetourGetEntryPoint(_In_opt_ HMODULE hModule);
537 | ULONG WINAPI DetourGetModuleSize(_In_opt_ HMODULE hModule);
538 | BOOL WINAPI DetourEnumerateExports(_In_ HMODULE hModule,
539 | _In_opt_ PVOID pContext,
540 | _In_ PF_DETOUR_ENUMERATE_EXPORT_CALLBACK pfExport);
541 | BOOL WINAPI DetourEnumerateImports(_In_opt_ HMODULE hModule,
542 | _In_opt_ PVOID pContext,
543 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile,
544 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK pfImportFunc);
545 |
546 | BOOL WINAPI DetourEnumerateImportsEx(_In_opt_ HMODULE hModule,
547 | _In_opt_ PVOID pContext,
548 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile,
549 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK_EX pfImportFuncEx);
550 |
551 | _Writable_bytes_(*pcbData)
552 | _Readable_bytes_(*pcbData)
553 | _Success_(return != NULL)
554 | PVOID WINAPI DetourFindPayload(_In_opt_ HMODULE hModule,
555 | _In_ REFGUID rguid,
556 | _Out_ DWORD *pcbData);
557 |
558 | _Writable_bytes_(*pcbData)
559 | _Readable_bytes_(*pcbData)
560 | _Success_(return != NULL)
561 | PVOID WINAPI DetourFindPayloadEx(_In_ REFGUID rguid,
562 | _Out_ DWORD * pcbData);
563 |
564 | DWORD WINAPI DetourGetSizeOfPayloads(_In_opt_ HMODULE hModule);
565 |
566 | ///////////////////////////////////////////////// Persistent Binary Functions.
567 | //
568 |
569 | PDETOUR_BINARY WINAPI DetourBinaryOpen(_In_ HANDLE hFile);
570 |
571 | _Writable_bytes_(*pcbData)
572 | _Readable_bytes_(*pcbData)
573 | _Success_(return != NULL)
574 | PVOID WINAPI DetourBinaryEnumeratePayloads(_In_ PDETOUR_BINARY pBinary,
575 | _Out_opt_ GUID *pGuid,
576 | _Out_ DWORD *pcbData,
577 | _Inout_ DWORD *pnIterator);
578 |
579 | _Writable_bytes_(*pcbData)
580 | _Readable_bytes_(*pcbData)
581 | _Success_(return != NULL)
582 | PVOID WINAPI DetourBinaryFindPayload(_In_ PDETOUR_BINARY pBinary,
583 | _In_ REFGUID rguid,
584 | _Out_ DWORD *pcbData);
585 |
586 | PVOID WINAPI DetourBinarySetPayload(_In_ PDETOUR_BINARY pBinary,
587 | _In_ REFGUID rguid,
588 | _In_reads_opt_(cbData) PVOID pData,
589 | _In_ DWORD cbData);
590 | BOOL WINAPI DetourBinaryDeletePayload(_In_ PDETOUR_BINARY pBinary, _In_ REFGUID rguid);
591 | BOOL WINAPI DetourBinaryPurgePayloads(_In_ PDETOUR_BINARY pBinary);
592 | BOOL WINAPI DetourBinaryResetImports(_In_ PDETOUR_BINARY pBinary);
593 | BOOL WINAPI DetourBinaryEditImports(_In_ PDETOUR_BINARY pBinary,
594 | _In_opt_ PVOID pContext,
595 | _In_opt_ PF_DETOUR_BINARY_BYWAY_CALLBACK pfByway,
596 | _In_opt_ PF_DETOUR_BINARY_FILE_CALLBACK pfFile,
597 | _In_opt_ PF_DETOUR_BINARY_SYMBOL_CALLBACK pfSymbol,
598 | _In_opt_ PF_DETOUR_BINARY_COMMIT_CALLBACK pfCommit);
599 | BOOL WINAPI DetourBinaryWrite(_In_ PDETOUR_BINARY pBinary, _In_ HANDLE hFile);
600 | BOOL WINAPI DetourBinaryClose(_In_ PDETOUR_BINARY pBinary);
601 |
602 | /////////////////////////////////////////////////// Create Process & Load Dll.
603 | //
604 | typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEA)(
605 | _In_opt_ LPCSTR lpApplicationName,
606 | _Inout_opt_ LPSTR lpCommandLine,
607 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
608 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
609 | _In_ BOOL bInheritHandles,
610 | _In_ DWORD dwCreationFlags,
611 | _In_opt_ LPVOID lpEnvironment,
612 | _In_opt_ LPCSTR lpCurrentDirectory,
613 | _In_ LPSTARTUPINFOA lpStartupInfo,
614 | _Out_ LPPROCESS_INFORMATION lpProcessInformation);
615 |
616 | typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEW)(
617 | _In_opt_ LPCWSTR lpApplicationName,
618 | _Inout_opt_ LPWSTR lpCommandLine,
619 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
620 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
621 | _In_ BOOL bInheritHandles,
622 | _In_ DWORD dwCreationFlags,
623 | _In_opt_ LPVOID lpEnvironment,
624 | _In_opt_ LPCWSTR lpCurrentDirectory,
625 | _In_ LPSTARTUPINFOW lpStartupInfo,
626 | _Out_ LPPROCESS_INFORMATION lpProcessInformation);
627 |
628 | BOOL WINAPI DetourCreateProcessWithDllA(_In_opt_ LPCSTR lpApplicationName,
629 | _Inout_opt_ LPSTR lpCommandLine,
630 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
631 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
632 | _In_ BOOL bInheritHandles,
633 | _In_ DWORD dwCreationFlags,
634 | _In_opt_ LPVOID lpEnvironment,
635 | _In_opt_ LPCSTR lpCurrentDirectory,
636 | _In_ LPSTARTUPINFOA lpStartupInfo,
637 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
638 | _In_ LPCSTR lpDllName,
639 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
640 |
641 | BOOL WINAPI DetourCreateProcessWithDllW(_In_opt_ LPCWSTR lpApplicationName,
642 | _Inout_opt_ LPWSTR lpCommandLine,
643 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
644 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
645 | _In_ BOOL bInheritHandles,
646 | _In_ DWORD dwCreationFlags,
647 | _In_opt_ LPVOID lpEnvironment,
648 | _In_opt_ LPCWSTR lpCurrentDirectory,
649 | _In_ LPSTARTUPINFOW lpStartupInfo,
650 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
651 | _In_ LPCSTR lpDllName,
652 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
653 |
654 | #ifdef UNICODE
655 | #define DetourCreateProcessWithDll DetourCreateProcessWithDllW
656 | #define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEW
657 | #else
658 | #define DetourCreateProcessWithDll DetourCreateProcessWithDllA
659 | #define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEA
660 | #endif // !UNICODE
661 |
662 | BOOL WINAPI DetourCreateProcessWithDllExA(_In_opt_ LPCSTR lpApplicationName,
663 | _Inout_opt_ LPSTR lpCommandLine,
664 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
665 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
666 | _In_ BOOL bInheritHandles,
667 | _In_ DWORD dwCreationFlags,
668 | _In_opt_ LPVOID lpEnvironment,
669 | _In_opt_ LPCSTR lpCurrentDirectory,
670 | _In_ LPSTARTUPINFOA lpStartupInfo,
671 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
672 | _In_ LPCSTR lpDllName,
673 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
674 |
675 | BOOL WINAPI DetourCreateProcessWithDllExW(_In_opt_ LPCWSTR lpApplicationName,
676 | _Inout_opt_ LPWSTR lpCommandLine,
677 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
678 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
679 | _In_ BOOL bInheritHandles,
680 | _In_ DWORD dwCreationFlags,
681 | _In_opt_ LPVOID lpEnvironment,
682 | _In_opt_ LPCWSTR lpCurrentDirectory,
683 | _In_ LPSTARTUPINFOW lpStartupInfo,
684 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
685 | _In_ LPCSTR lpDllName,
686 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
687 |
688 | #ifdef UNICODE
689 | #define DetourCreateProcessWithDllEx DetourCreateProcessWithDllExW
690 | #else
691 | #define DetourCreateProcessWithDllEx DetourCreateProcessWithDllExA
692 | #endif // !UNICODE
693 |
694 | BOOL WINAPI DetourCreateProcessWithDllsA(_In_opt_ LPCSTR lpApplicationName,
695 | _Inout_opt_ LPSTR lpCommandLine,
696 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
697 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
698 | _In_ BOOL bInheritHandles,
699 | _In_ DWORD dwCreationFlags,
700 | _In_opt_ LPVOID lpEnvironment,
701 | _In_opt_ LPCSTR lpCurrentDirectory,
702 | _In_ LPSTARTUPINFOA lpStartupInfo,
703 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
704 | _In_ DWORD nDlls,
705 | _In_reads_(nDlls) LPCSTR *rlpDlls,
706 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
707 |
708 | BOOL WINAPI DetourCreateProcessWithDllsW(_In_opt_ LPCWSTR lpApplicationName,
709 | _Inout_opt_ LPWSTR lpCommandLine,
710 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
711 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
712 | _In_ BOOL bInheritHandles,
713 | _In_ DWORD dwCreationFlags,
714 | _In_opt_ LPVOID lpEnvironment,
715 | _In_opt_ LPCWSTR lpCurrentDirectory,
716 | _In_ LPSTARTUPINFOW lpStartupInfo,
717 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
718 | _In_ DWORD nDlls,
719 | _In_reads_(nDlls) LPCSTR *rlpDlls,
720 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
721 |
722 | #ifdef UNICODE
723 | #define DetourCreateProcessWithDlls DetourCreateProcessWithDllsW
724 | #else
725 | #define DetourCreateProcessWithDlls DetourCreateProcessWithDllsA
726 | #endif // !UNICODE
727 |
728 | BOOL WINAPI DetourProcessViaHelperA(_In_ DWORD dwTargetPid,
729 | _In_ LPCSTR lpDllName,
730 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
731 |
732 | BOOL WINAPI DetourProcessViaHelperW(_In_ DWORD dwTargetPid,
733 | _In_ LPCSTR lpDllName,
734 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
735 |
736 | #ifdef UNICODE
737 | #define DetourProcessViaHelper DetourProcessViaHelperW
738 | #else
739 | #define DetourProcessViaHelper DetourProcessViaHelperA
740 | #endif // !UNICODE
741 |
742 | BOOL WINAPI DetourProcessViaHelperDllsA(_In_ DWORD dwTargetPid,
743 | _In_ DWORD nDlls,
744 | _In_reads_(nDlls) LPCSTR *rlpDlls,
745 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
746 |
747 | BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
748 | _In_ DWORD nDlls,
749 | _In_reads_(nDlls) LPCSTR *rlpDlls,
750 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
751 |
752 | #ifdef UNICODE
753 | #define DetourProcessViaHelperDlls DetourProcessViaHelperDllsW
754 | #else
755 | #define DetourProcessViaHelperDlls DetourProcessViaHelperDllsA
756 | #endif // !UNICODE
757 |
758 | BOOL WINAPI DetourUpdateProcessWithDll(_In_ HANDLE hProcess,
759 | _In_reads_(nDlls) LPCSTR *rlpDlls,
760 | _In_ DWORD nDlls);
761 |
762 | BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
763 | _In_ HMODULE hImage,
764 | _In_ BOOL bIs32Bit,
765 | _In_reads_(nDlls) LPCSTR *rlpDlls,
766 | _In_ DWORD nDlls);
767 |
768 | BOOL WINAPI DetourCopyPayloadToProcess(_In_ HANDLE hProcess,
769 | _In_ REFGUID rguid,
770 | _In_reads_bytes_(cbData) PVOID pvData,
771 | _In_ DWORD cbData);
772 | BOOL WINAPI DetourRestoreAfterWith(VOID);
773 | BOOL WINAPI DetourRestoreAfterWithEx(_In_reads_bytes_(cbData) PVOID pvData,
774 | _In_ DWORD cbData);
775 | BOOL WINAPI DetourIsHelperProcess(VOID);
776 | VOID CALLBACK DetourFinishHelperProcess(_In_ HWND,
777 | _In_ HINSTANCE,
778 | _In_ LPSTR,
779 | _In_ INT);
780 |
781 | //
782 | //////////////////////////////////////////////////////////////////////////////
783 | #ifdef __cplusplus
784 | }
785 | #endif // __cplusplus
786 |
787 | //////////////////////////////////////////////// Detours Internal Definitions.
788 | //
789 | #ifdef __cplusplus
790 | #ifdef DETOURS_INTERNAL
791 |
792 | #define NOTHROW
793 | // #define NOTHROW (nothrow)
794 |
795 | //////////////////////////////////////////////////////////////////////////////
796 | //
797 | #if (_MSC_VER < 1299)
798 | #include
799 | typedef IMAGEHLP_MODULE IMAGEHLP_MODULE64;
800 | typedef PIMAGEHLP_MODULE PIMAGEHLP_MODULE64;
801 | typedef IMAGEHLP_SYMBOL SYMBOL_INFO;
802 | typedef PIMAGEHLP_SYMBOL PSYMBOL_INFO;
803 |
804 | static inline
805 | LONG InterlockedCompareExchange(_Inout_ LONG *ptr, _In_ LONG nval, _In_ LONG oval)
806 | {
807 | return (LONG)::InterlockedCompareExchange((PVOID*)ptr, (PVOID)nval, (PVOID)oval);
808 | }
809 | #else
810 | #pragma warning(push)
811 | #pragma warning(disable:4091) // empty typedef
812 | #include
813 | #pragma warning(pop)
814 | #endif
815 |
816 | #ifdef IMAGEAPI // defined by DBGHELP.H
817 | typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(_In_ LPAPI_VERSION AppVersion);
818 |
819 | typedef BOOL (NTAPI *PF_SymInitialize)(_In_ HANDLE hProcess,
820 | _In_opt_ LPCSTR UserSearchPath,
821 | _In_ BOOL fInvadeProcess);
822 | typedef DWORD (NTAPI *PF_SymSetOptions)(_In_ DWORD SymOptions);
823 | typedef DWORD (NTAPI *PF_SymGetOptions)(VOID);
824 | typedef DWORD64 (NTAPI *PF_SymLoadModule64)(_In_ HANDLE hProcess,
825 | _In_opt_ HANDLE hFile,
826 | _In_ LPSTR ImageName,
827 | _In_opt_ LPSTR ModuleName,
828 | _In_ DWORD64 BaseOfDll,
829 | _In_opt_ DWORD SizeOfDll);
830 | typedef BOOL (NTAPI *PF_SymGetModuleInfo64)(_In_ HANDLE hProcess,
831 | _In_ DWORD64 qwAddr,
832 | _Out_ PIMAGEHLP_MODULE64 ModuleInfo);
833 | typedef BOOL (NTAPI *PF_SymFromName)(_In_ HANDLE hProcess,
834 | _In_ LPSTR Name,
835 | _Out_ PSYMBOL_INFO Symbol);
836 |
837 | typedef struct _DETOUR_SYM_INFO
838 | {
839 | HANDLE hProcess;
840 | HMODULE hDbgHelp;
841 | PF_ImagehlpApiVersionEx pfImagehlpApiVersionEx;
842 | PF_SymInitialize pfSymInitialize;
843 | PF_SymSetOptions pfSymSetOptions;
844 | PF_SymGetOptions pfSymGetOptions;
845 | PF_SymLoadModule64 pfSymLoadModule64;
846 | PF_SymGetModuleInfo64 pfSymGetModuleInfo64;
847 | PF_SymFromName pfSymFromName;
848 | } DETOUR_SYM_INFO, *PDETOUR_SYM_INFO;
849 |
850 | PDETOUR_SYM_INFO DetourLoadImageHlp(VOID);
851 |
852 | #endif // IMAGEAPI
853 |
854 | #if defined(_INC_STDIO) && !defined(_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS)
855 | #error detours.h must be included before stdio.h (or at least define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS earlier)
856 | #endif
857 | #define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS 1
858 |
859 | #ifndef DETOUR_TRACE
860 | #if DETOUR_DEBUG
861 | #define DETOUR_TRACE(x) printf x
862 | #define DETOUR_BREAK() __debugbreak()
863 | #include
864 | #include
865 | #else
866 | #define DETOUR_TRACE(x)
867 | #define DETOUR_BREAK()
868 | #endif
869 | #endif
870 |
871 | #if 1 || defined(DETOURS_IA64)
872 |
873 | //
874 | // IA64 instructions are 41 bits, 3 per bundle, plus 5 bit bundle template => 128 bits per bundle.
875 | //
876 |
877 | #define DETOUR_IA64_INSTRUCTIONS_PER_BUNDLE (3)
878 |
879 | #define DETOUR_IA64_TEMPLATE_OFFSET (0)
880 | #define DETOUR_IA64_TEMPLATE_SIZE (5)
881 |
882 | #define DETOUR_IA64_INSTRUCTION_SIZE (41)
883 | #define DETOUR_IA64_INSTRUCTION0_OFFSET (DETOUR_IA64_TEMPLATE_SIZE)
884 | #define DETOUR_IA64_INSTRUCTION1_OFFSET (DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTION_SIZE)
885 | #define DETOUR_IA64_INSTRUCTION2_OFFSET (DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTION_SIZE + DETOUR_IA64_INSTRUCTION_SIZE)
886 |
887 | C_ASSERT(DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTIONS_PER_BUNDLE * DETOUR_IA64_INSTRUCTION_SIZE == 128);
888 |
889 | __declspec(align(16)) struct DETOUR_IA64_BUNDLE
890 | {
891 | public:
892 | union
893 | {
894 | BYTE data[16];
895 | UINT64 wide[2];
896 | };
897 |
898 | enum {
899 | A_UNIT = 1u,
900 | I_UNIT = 2u,
901 | M_UNIT = 3u,
902 | B_UNIT = 4u,
903 | F_UNIT = 5u,
904 | L_UNIT = 6u,
905 | X_UNIT = 7u,
906 | };
907 | struct DETOUR_IA64_METADATA
908 | {
909 | ULONG nTemplate : 8; // Instruction template.
910 | ULONG nUnit0 : 4; // Unit for slot 0
911 | ULONG nUnit1 : 4; // Unit for slot 1
912 | ULONG nUnit2 : 4; // Unit for slot 2
913 | };
914 |
915 | protected:
916 | static const DETOUR_IA64_METADATA s_rceCopyTable[33];
917 |
918 | UINT RelocateBundle(_Inout_ DETOUR_IA64_BUNDLE* pDst, _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra) const;
919 |
920 | bool RelocateInstruction(_Inout_ DETOUR_IA64_BUNDLE* pDst,
921 | _In_ BYTE slot,
922 | _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra) const;
923 |
924 | // 120 112 104 96 88 80 72 64 56 48 40 32 24 16 8 0
925 | // f. e. d. c. b. a. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0.
926 |
927 | // 00
928 | // f.error. d.c. b.a. 9.8. 7.6. 5.4. 3.2. 1.0.
929 | // 0000 0000 0000 0000 0000 0000 0000 001f : Template [4..0]
930 | // 0000 0000 0000 0000 0000 03ff ffff ffe0 : Zero [ 41.. 5]
931 | // 0000 0000 0000 0000 0000 3c00 0000 0000 : Zero [ 45.. 42]
932 | // 0000 0000 0007 ffff ffff c000 0000 0000 : One [ 82.. 46]
933 | // 0000 0000 0078 0000 0000 0000 0000 0000 : One [ 86.. 83]
934 | // 0fff ffff ff80 0000 0000 0000 0000 0000 : Two [123.. 87]
935 | // f000 0000 0000 0000 0000 0000 0000 0000 : Two [127..124]
936 | BYTE GetTemplate() const;
937 | // Get 4 bit opcodes.
938 | BYTE GetInst0() const;
939 | BYTE GetInst1() const;
940 | BYTE GetInst2() const;
941 | BYTE GetUnit(BYTE slot) const;
942 | BYTE GetUnit0() const;
943 | BYTE GetUnit1() const;
944 | BYTE GetUnit2() const;
945 | // Get 37 bit data.
946 | UINT64 GetData0() const;
947 | UINT64 GetData1() const;
948 | UINT64 GetData2() const;
949 |
950 | // Get/set the full 41 bit instructions.
951 | UINT64 GetInstruction(BYTE slot) const;
952 | UINT64 GetInstruction0() const;
953 | UINT64 GetInstruction1() const;
954 | UINT64 GetInstruction2() const;
955 | void SetInstruction(BYTE slot, UINT64 instruction);
956 | void SetInstruction0(UINT64 instruction);
957 | void SetInstruction1(UINT64 instruction);
958 | void SetInstruction2(UINT64 instruction);
959 |
960 | // Get/set bitfields.
961 | static UINT64 GetBits(UINT64 Value, UINT64 Offset, UINT64 Count);
962 | static UINT64 SetBits(UINT64 Value, UINT64 Offset, UINT64 Count, UINT64 Field);
963 |
964 | // Get specific read-only fields.
965 | static UINT64 GetOpcode(UINT64 instruction); // 4bit opcode
966 | static UINT64 GetX(UINT64 instruction); // 1bit opcode extension
967 | static UINT64 GetX3(UINT64 instruction); // 3bit opcode extension
968 | static UINT64 GetX6(UINT64 instruction); // 6bit opcode extension
969 |
970 | // Get/set specific fields.
971 | static UINT64 GetImm7a(UINT64 instruction);
972 | static UINT64 SetImm7a(UINT64 instruction, UINT64 imm7a);
973 | static UINT64 GetImm13c(UINT64 instruction);
974 | static UINT64 SetImm13c(UINT64 instruction, UINT64 imm13c);
975 | static UINT64 GetSignBit(UINT64 instruction);
976 | static UINT64 SetSignBit(UINT64 instruction, UINT64 signBit);
977 | static UINT64 GetImm20a(UINT64 instruction);
978 | static UINT64 SetImm20a(UINT64 instruction, UINT64 imm20a);
979 | static UINT64 GetImm20b(UINT64 instruction);
980 | static UINT64 SetImm20b(UINT64 instruction, UINT64 imm20b);
981 |
982 | static UINT64 SignExtend(UINT64 Value, UINT64 Offset);
983 |
984 | BOOL IsMovlGp() const;
985 |
986 | VOID SetInst(BYTE Slot, BYTE nInst);
987 | VOID SetInst0(BYTE nInst);
988 | VOID SetInst1(BYTE nInst);
989 | VOID SetInst2(BYTE nInst);
990 | VOID SetData(BYTE Slot, UINT64 nData);
991 | VOID SetData0(UINT64 nData);
992 | VOID SetData1(UINT64 nData);
993 | VOID SetData2(UINT64 nData);
994 | BOOL SetNop(BYTE Slot);
995 | BOOL SetNop0();
996 | BOOL SetNop1();
997 | BOOL SetNop2();
998 |
999 | public:
1000 | BOOL IsBrl() const;
1001 | VOID SetBrl();
1002 | VOID SetBrl(UINT64 target);
1003 | UINT64 GetBrlTarget() const;
1004 | VOID SetBrlTarget(UINT64 target);
1005 | VOID SetBrlImm(UINT64 imm);
1006 | UINT64 GetBrlImm() const;
1007 |
1008 | UINT64 GetMovlGp() const;
1009 | VOID SetMovlGp(UINT64 gp);
1010 |
1011 | VOID SetStop();
1012 |
1013 | UINT Copy(_Out_ DETOUR_IA64_BUNDLE *pDst, _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra = NULL) const;
1014 | };
1015 | #endif // DETOURS_IA64
1016 |
1017 | #ifdef DETOURS_ARM
1018 |
1019 | #define DETOURS_PFUNC_TO_PBYTE(p) ((PBYTE)(((ULONG_PTR)(p)) & ~(ULONG_PTR)1))
1020 | #define DETOURS_PBYTE_TO_PFUNC(p) ((PBYTE)(((ULONG_PTR)(p)) | (ULONG_PTR)1))
1021 |
1022 | #endif // DETOURS_ARM
1023 |
1024 | //////////////////////////////////////////////////////////////////////////////
1025 |
1026 | #ifdef __cplusplus
1027 | extern "C" {
1028 | #endif // __cplusplus
1029 |
1030 | #define DETOUR_OFFLINE_LIBRARY(x) \
1031 | PVOID WINAPI DetourCopyInstruction##x(_In_opt_ PVOID pDst, \
1032 | _Inout_opt_ PVOID *ppDstPool, \
1033 | _In_ PVOID pSrc, \
1034 | _Out_opt_ PVOID *ppTarget, \
1035 | _Out_opt_ LONG *plExtra); \
1036 | \
1037 | BOOL WINAPI DetourSetCodeModule##x(_In_ HMODULE hModule, \
1038 | _In_ BOOL fLimitReferencesToModule); \
1039 |
1040 | DETOUR_OFFLINE_LIBRARY(X86)
1041 | DETOUR_OFFLINE_LIBRARY(X64)
1042 | DETOUR_OFFLINE_LIBRARY(ARM)
1043 | DETOUR_OFFLINE_LIBRARY(ARM64)
1044 | DETOUR_OFFLINE_LIBRARY(IA64)
1045 |
1046 | #undef DETOUR_OFFLINE_LIBRARY
1047 |
1048 | //////////////////////////////////////////////////////////////////////////////
1049 | //
1050 | // Helpers for manipulating page protection.
1051 | //
1052 |
1053 | _Success_(return != FALSE)
1054 | BOOL WINAPI DetourVirtualProtectSameExecuteEx(_In_ HANDLE hProcess,
1055 | _In_ PVOID pAddress,
1056 | _In_ SIZE_T nSize,
1057 | _In_ DWORD dwNewProtect,
1058 | _Out_ PDWORD pdwOldProtect);
1059 |
1060 | _Success_(return != FALSE)
1061 | BOOL WINAPI DetourVirtualProtectSameExecute(_In_ PVOID pAddress,
1062 | _In_ SIZE_T nSize,
1063 | _In_ DWORD dwNewProtect,
1064 | _Out_ PDWORD pdwOldProtect);
1065 | #ifdef __cplusplus
1066 | }
1067 | #endif // __cplusplus
1068 |
1069 | //////////////////////////////////////////////////////////////////////////////
1070 |
1071 | #define MM_ALLOCATION_GRANULARITY 0x10000
1072 |
1073 | //////////////////////////////////////////////////////////////////////////////
1074 |
1075 | #endif // DETOURS_INTERNAL
1076 | #endif // __cplusplus
1077 |
1078 | #endif // _DETOURS_H_
1079 | //
1080 | //////////////////////////////////////////////////////////////// End of File.
1081 |
--------------------------------------------------------------------------------
/lib/detours.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bedrock-dev/MCBEMulStructureFinder/953eafc7a89b23a5fa9933b1809a75e1720f50cc/lib/detours.lib
--------------------------------------------------------------------------------
/lib/detver.h:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Common version parameters.
4 | //
5 | // Microsoft Research Detours Package, Version 4.0.1
6 | //
7 | // Copyright (c) Microsoft Corporation. All rights reserved.
8 | //
9 |
10 | #define _USING_V110_SDK71_ 1
11 |
12 | #include "winver.h"
13 | #if 0
14 | #include
15 | #include
16 | #else
17 | #ifndef DETOURS_STRINGIFY
18 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x)
19 | #define DETOURS_STRINGIFY_(x) #x
20 | #endif
21 |
22 | #define VER_FILEFLAGSMASK 0x3fL
23 | #define VER_FILEFLAGS 0x0L
24 | #define VER_FILEOS 0x00040004L
25 | #define VER_FILETYPE 0x00000002L
26 | #define VER_FILESUBTYPE 0x00000000L
27 | #endif
28 | #define VER_DETOURS_BITS DETOUR_STRINGIFY(DETOURS_BITS)
29 |
--------------------------------------------------------------------------------
/lib/mod.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //from https://github.com/zhkj-liuxiaohua/MCMODDLL-CPP
3 | #include
4 | #include
5 | #include "detours.h"
6 |
7 | using VA = unsigned __int64;
8 | using RVA = unsigned long int;
9 |
10 | template
11 | auto Hook(T *p, T f) {
12 | int error = DetourTransactionBegin();
13 | if (error != NO_ERROR) {
14 | return "Hook: DetourTransactionBegin Error";
15 | }
16 | error = DetourUpdateThread(GetCurrentThread());
17 | if (error != NO_ERROR) {
18 | return "Hook: DetourUpdateThread Error";
19 | }
20 | error = DetourAttach((PVOID *)
21 | p, (PVOID)
22 | f);
23 | if (error != NO_ERROR) {
24 | return "Hook: DetourAttach Error";
25 | }
26 | error = DetourTransactionCommit();
27 | if (error != NO_ERROR) {
28 | return "Hook: DetourTransactionCommit Error";
29 | }
30 | return static_cast(nullptr);
31 | }
32 |
33 | template
34 | auto UnHook(T *p, T f) {
35 | int error = DetourTransactionBegin();
36 | if (error != NO_ERROR) {
37 | return "UnHook: DetourTransactionBegin Error";
38 | }
39 | error = DetourUpdateThread(GetCurrentThread());
40 | if (error != NO_ERROR) {
41 | return "UnHook: DetourUpdateThread Error";
42 | }
43 | error = DetourDetach((PVOID *)
44 | p, (PVOID)
45 | f);
46 | if (error != NO_ERROR) {
47 | return "UnHook: DetourDetach Error";
48 | }
49 | error = DetourTransactionCommit();
50 | if (error != NO_ERROR) {
51 | return "UnHook: DetourTransactionCommit Error";
52 | }
53 | return static_cast(nullptr);
54 | }
55 |
56 | struct RegisterStaticHook {
57 |
58 | RegisterStaticHook(RVA sym, void *hook, void **org) {
59 | auto base = reinterpret_cast(GetModuleHandle(NULL));
60 | *org = reinterpret_cast(base + sym);
61 | auto ret = Hook(org, hook);
62 | if (ret != nullptr)
63 | std::cout << "[Error]" << " " << ret << std::endl;
64 | }
65 |
66 | // workaround for a warning
67 | template
68 | RegisterStaticHook(RVA sym, T hook, void **org) {
69 | union {
70 | T a;
71 | void *b;
72 | } hookUnion;
73 | hookUnion.a = hook;
74 | RegisterStaticHook(sym, hookUnion.b, org);
75 | }
76 | };
77 |
78 | #define _TInstanceHook(class_inh, pclass, iname, sym, ret, ...) \
79 | struct _TInstanceHook_##iname class_inh { \
80 | static ret (_TInstanceHook_##iname::*_original)(__VA_ARGS__); \
81 | template static ret original(pclass *_this, Params &&... params) { \
82 | return (((_TInstanceHook_##iname *)_this)->*_original)(std::forward(params)...); \
83 | } \
84 | ret _hook(__VA_ARGS__); \
85 | }; \
86 | static RegisterStaticHook _TRInstanceHook_##iname(sym, &_TInstanceHook_##iname::_hook, (void **)&_TInstanceHook_##iname::_original); \
87 | ret (_TInstanceHook_##iname::*_TInstanceHook_##iname::_original)(__VA_ARGS__); \
88 | ret _TInstanceHook_##iname::_hook(__VA_ARGS__)
89 | #define _TInstanceDefHook(iname, sym, ret, type, ...) _TInstanceHook( : public type, type, iname, sym, ret, __VA_ARGS__)
90 | #define _TInstanceNoDefHook(iname, sym, ret, ...) _TInstanceHook(, void, iname, sym, ret, __VA_ARGS__)
91 |
92 | #define _TStaticHook(pclass, iname, sym, ret, ...) \
93 | struct _TStaticHook_##iname pclass { \
94 | static ret (*_original)(__VA_ARGS__); \
95 | template static ret original(Params &&... params) { return (*_original)(std::forward(params)...); } \
96 | static ret _hook(__VA_ARGS__); \
97 | }; \
98 | static RegisterStaticHook _TRStaticHook_##iname(sym, &_TStaticHook_##iname::_hook, (void **)&_TStaticHook_##iname::_original); \
99 | ret (*_TStaticHook_##iname::_original)(__VA_ARGS__); \
100 | ret _TStaticHook_##iname::_hook(__VA_ARGS__)
101 | #define _TStaticDefHook(iname, sym, ret, type, ...) _TStaticHook( : public type, iname, sym, ret, __VA_ARGS__)
102 | #define _TStaticNoDefHook(iname, sym, ret, ...) _TStaticHook(, iname, sym, ret, __VA_ARGS__)
103 |
104 | #define THook2(iname, ret, sym, ...) _TStaticNoDefHook(iname, sym, ret, __VA_ARGS__)
105 | #define THook(ret, sym, ...) THook2(sym, ret, sym, __VA_ARGS__)
106 | #define TClasslessInstanceHook2(iname, ret, sym, ...) _TInstanceNoDefHook(iname, sym, ret, __VA_ARGS__)
107 | #define TClasslessInstanceHook(ret, sym, ...) TClasslessInstanceHook2(sym, ret, sym, args)
108 | #define TInstanceHook2(iname, ret, sym, type, ...) _TInstanceDefHook(iname, sym, ret, type, __VA_ARGS__)
109 | #define TInstanceHook(ret, sym, type, ...) TInstanceHook2(sym, ret, sym, type, __VA_ARGS__)
110 | #define TStaticHook2(iname, ret, sym, type, ...) _TStaticDefHook(iname, sym, ret, type, __VA_ARGS__)
111 | #define TStaticHook(ret, sym, type, ...) TStaticHook2(sym, ret, sym, type, __VA_ARGS__)
112 |
113 | #define FNTYPE_DEF(...) VA (*)(__VA_ARGS__)
114 | #define FNTYPE_DEF_0 FNTYPE_DEF()
115 | #define FNTYPE_DEF_1 FNTYPE_DEF(VA)
116 | #define FNTYPE_DEF_2 FNTYPE_DEF(VA,VA)
117 | #define FNTYPE_DEF_3 FNTYPE_DEF(VA,VA,VA)
118 | #define FNTYPE_DEF_4 FNTYPE_DEF(VA,VA,VA,VA)
119 | #define FNTYPE_DEF_5 FNTYPE_DEF(VA,VA,VA,VA,VA)
120 | #define FNTYPE_DEF_6 FNTYPE_DEF(VA,VA,VA,VA,VA,VA)
121 | #define FNTYPE_DEF_7 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA)
122 | #define FNTYPE_DEF_8 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA)
123 | #define FNTYPE_DEF_9 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA,VA)
124 | #define FNTYPE_DEF_10 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA,VA,VA)
125 | #define FNTYPE_DEF_11 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA)
126 | #define FNTYPE_DEF_12 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA)
127 | #define FNTYPE_DEF_13 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA)
128 | #define FNTYPE_DEF_14 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA)
129 | #define FNTYPE_DEF_15 FNTYPE_DEF(VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA,VA)
130 |
131 | #define SYM_PTR(TYPE, SYM_RVA) reinterpret_cast(reinterpret_cast(GetModuleHandle(NULL))+SYM_RVA)
132 | #define SYM_CALL(TYPE, SYM_RVA, ...) SYM_PTR(TYPE, SYM_RVA)(__VA_ARGS__)
133 | #define SYM_CALL_0(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_0, SYM_RVA, __VA_ARGS__)
134 | #define SYM_CALL_1(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_1, SYM_RVA, __VA_ARGS__)
135 | #define SYM_CALL_2(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_2, SYM_RVA, __VA_ARGS__)
136 | #define SYM_CALL_3(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_3, SYM_RVA, __VA_ARGS__)
137 | #define SYM_CALL_4(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_4, SYM_RVA, __VA_ARGS__)
138 | #define SYM_CALL_5(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_5, SYM_RVA, __VA_ARGS__)
139 | #define SYM_CALL_6(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_6, SYM_RVA, __VA_ARGS__)
140 | #define SYM_CALL_7(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_7, SYM_RVA, __VA_ARGS__)
141 | #define SYM_CALL_8(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_8, SYM_RVA, __VA_ARGS__)
142 | #define SYM_CALL_9(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_9, SYM_RVA, __VA_ARGS__)
143 | #define SYM_CALL_10(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_10, SYM_RVA, __VA_ARGS__)
144 | #define SYM_CALL_11(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_11, SYM_RVA, __VA_ARGS__)
145 | #define SYM_CALL_12(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_12, SYM_RVA, __VA_ARGS__)
146 | #define SYM_CALL_13(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_13, SYM_RVA, __VA_ARGS__)
147 | #define SYM_CALL_14(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_14, SYM_RVA, __VA_ARGS__)
148 | #define SYM_CALL_15(SYM_RVA, ...) SYM_CALL(FNTYPE_DEF_15, SYM_RVA, __VA_ARGS__)
149 |
150 |
151 |
--------------------------------------------------------------------------------
/mul_finder.txt:
--------------------------------------------------------------------------------
1 | -100 100 -100 100 200
2 |
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
1 | author: hhhxiao
2 | bilibili:_hhhxiao
3 | gihtub:https://github.com/hhhxiao/MCBEMulStructureFinder
4 | 使用方法
5 | 1. 准备一个1.16.4的BDS,一定不能有存档,在 server.properties 中设置种子
6 | 2. 把 mul_feature_finder.dll 和mul_finder.txt都移动到bedrock_server.exe所在文件夹
7 | 3. mul_finder.txt里面填写配置,一共五个数,分别是x最小值,x最大值,z最小值,z最大值,最大距离(zx是区块坐标)
8 | 4.用dll注入器把dll注入bedrock_server.exe并启动即可(方法和trapdoor (https://github.com/hhhxiao/TrapDoor) 相同)
9 | 5.登录服务器的瞬间BDS会自动开始计算并打印结果,理论上开始算后就能取消登录了
10 | 注
11 | 1.换种子的时候一定要删除存档!!!!!!!!!!!!!!
12 | 2.只能1.16.4使用,查找结果理论上全版本通用(只要不是太古老的版本)
--------------------------------------------------------------------------------
/src/Sample.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by xhy on 2020/11/27.
3 | //
4 |
5 | #include "../hook/SymHook.h"
6 | #include "../lib/mod.h"
7 | #include "Sample.h"
8 |
9 | #include
10 |
11 | using namespace SymHook;
12 | FILE *fp = nullptr;
13 | int minX = 0;
14 | int maxX = 0;
15 | int minZ = 0;
16 | int maxZ = 0;
17 | int maxDistance = 0;
18 |
19 | void initConfig() {
20 | printf("author: hhhxiao\nbilibili:_hhhxiao\n gihtub:https://github.com/hhhxiao/mcbe_mul_feature_finder\n");
21 | fp = fopen("mul_finder.txt", "rt+");
22 | if (!fp) {
23 | fprintf(stderr, "can't open config file mul_finder.txt\n");
24 | return;
25 | }
26 | size_t hasRead = fscanf(fp, "%d %d %d %d %d\n", &minX, &maxX, &minZ, &maxZ, &maxDistance);
27 | if (hasRead != 5) {
28 | fprintf(stderr, "can't not read config file,please check the config\n");
29 | fclose(fp);
30 | return;
31 | }
32 | printf("set config:\n minX=%d maxX=%d minZ=%d maxZ=%d maxDistance=%d\n", minX, maxX, minZ, maxZ, maxDistance);
33 | if (minX >= maxX || minZ >= maxZ || maxDistance <= 0) {
34 | fprintf(stderr, "invalid value(minX must < maxX ,minZ must < maxZ,maxDistance > 0)\n");
35 | fclose(fp);
36 | return;
37 | }
38 | printf("success set config file!!!!!!!!\n-------------------------------------------\n");
39 | fclose(fp);
40 | }
41 |
42 | std::string Biome::getBiomeName() {
43 | char *str = reinterpret_cast(this) + 8;
44 | return std::string(str);
45 | }
46 |
47 | int Biome::getBiomeType() {
48 | return SYM_CALL(
49 | int(*)(Biome * ),
50 | MSSYM_B1QE12getBiomeTypeB1AA5BiomeB2AAA4QEBAB1QE20AW4VanillaBiomeTypesB2AAA2XZ,
51 | this
52 | );
53 | }
54 |
55 | int findMUl(const std::vector> &list, long long int maxDis2) {
56 | size_t num = 0;
57 | size_t length = list.size();
58 | for (int i = 0; i < length - 1; ++i) {
59 | for (int j = i + 1; j < length; j++) {
60 | long long int dx = list[i].first - list[j].first;
61 | long long int dy = list[i].second - list[j].second;
62 | long long int d2 = dx * dx + dy * dy;
63 | if (d2 <= maxDis2) {
64 | printf("p1 :[%d %d] p2:[%d %d] ==> d: %.2f (/tp %d ~ %d)\n", list[i].first, list[i].second,
65 | list[j].first,
66 | list[j].second, sqrt(d2), list[i].first, list[i].second);
67 | ++num;
68 | }
69 | }
70 | }
71 | return num;
72 | }
73 |
74 | bool hasFindOceanMonument = false;
75 |
76 | THook(
77 | bool,
78 | MSSYM_B1QE14isFeatureChunkB1AE20OceanMonumentFeatureB2AAA4UEAAB1UE16NAEBVBiomeSourceB2AAE10AEAVRandomB2AAE12AEBVChunkPosB2AAA1IB1AA1Z,
79 | int32_t *structure,
80 | char *biomeSource,
81 | void *rand,
82 | ChunkPos *pos,
83 | unsigned int v3
84 | ) {
85 |
86 | bool result = original(structure, biomeSource, rand, pos, v3);
87 | if (hasFindOceanMonument)return result;
88 | printf("begin find OceanMonument\n");
89 | int blockSize = (maxX - minX) / 10 + 1;
90 | ChunkPos p = {0, 0};
91 | std::vector> list;
92 | for (int i = minX; i < maxX; ++i) {
93 | for (int j = minZ; j < maxZ; ++j) {
94 | p.x = i;
95 | p.z = j;
96 | if (original(structure, biomeSource, rand, &p, v3)) {
97 | list.emplace_back(i * 16, j * 16);
98 | }
99 | }
100 | if (i % blockSize == 0) {
101 | printf("%d0%% finished\n", 5 + i / blockSize);
102 | }
103 |
104 | }
105 |
106 | size_t length = list.size();
107 | printf("total %zu feature find\nbegin cal OceanMonument distance...\n", length);
108 | size_t num = findMUl(list, maxDistance * maxDistance);
109 | if (num == 0) {
110 | printf("no mul found\n");
111 | }
112 | hasFindOceanMonument = true;
113 | printf("finish\n---------------------------------------------------------\n");
114 | return result;
115 | }
116 |
117 | bool hasFindRandomScattered = false;
118 |
119 | THook(
120 | bool,
121 | MSSYM_B1QE14isFeatureChunkB1AE27RandomScatteredLargeFeatureB2AAA4MEAAB1UE16NAEBVBiomeSourceB2AAE10AEAVRandomB2AAE12AEBVChunkPosB2AAA1IB1AA1Z,
122 | int32_t *structure,
123 | char *biomeSource,
124 | void *rand,
125 | ChunkPos *pos,
126 | unsigned int v3
127 | ) {
128 |
129 | bool result = original(structure, biomeSource, rand, pos, v3);
130 | if (hasFindRandomScattered) return result;
131 | printf("begin finder randomScattered\n");
132 | int blockSize = (maxX - minX) / 10 + 1;
133 | ChunkPos p = {0, 0};
134 | std::vector> list;
135 | for (int i = minX; i < maxX; ++i) {
136 | for (int j = minZ; j < maxZ; ++j) {
137 | p.x = i;
138 | p.z = j;
139 | if (original(structure, biomeSource, rand, &p, v3)) {
140 | Biome *biome = SYM_CALL(
141 | Biome*(*)(void * , int, int),
142 | MSSYM_B1QA8getBiomeB1AE16LayerBiomeSourceB2AAE13UEBAPEBVBiomeB2AAA2HHB1AA1Z,
143 | biomeSource,
144 | p.x * 16, p.z * 16
145 | );
146 | if (biome->getBiomeType() == 15) {
147 | list.emplace_back(i * 16, j * 16);
148 | // printf("(%d %d) == %d %s\n", 16 * p.x, 16 * p.z, biome->getBiomeType(),biome->getBiomeName().c_str());
149 | }
150 | }
151 | }
152 | if (i % blockSize == 0) {
153 | printf("%d0%% finished\n", 5 + i / blockSize);
154 | }
155 | }
156 |
157 | size_t length = list.size();
158 | printf("total %zu feature find\nbegin cal ScatteredFeature distance...\n", length);
159 | size_t num = findMUl(list, maxDistance * maxDistance);
160 | if (num == 0) {
161 | printf("no mul found\n");
162 | }
163 | hasFindRandomScattered = true;
164 | printf("finish\n---------------------------------------------------------\n");
165 | return result;
166 | }
167 |
168 |
--------------------------------------------------------------------------------
/src/Sample.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by xhy on 2020/11/27.
3 | //
4 |
5 | #ifndef BDS_MOD_SAMPLE_SAMPLE_H
6 | #define BDS_MOD_SAMPLE_SAMPLE_H
7 |
8 | #include
9 |
10 | struct ChunkPos {
11 | int x;
12 | int z;
13 | };
14 |
15 | class Biome {
16 | public:
17 | int getBiomeType();
18 |
19 | std::string getBiomeName();
20 | };
21 |
22 | extern FILE *fp;
23 | extern int minX;
24 | extern int maxX;
25 | extern int minZ;
26 | extern int maxZ;
27 | extern int maxDistance;
28 |
29 | void initConfig();
30 |
31 | #endif //BDS_MOD_SAMPLE_SAMPLE_H
32 |
--------------------------------------------------------------------------------