├── LICENSE
├── MMMojoCall
├── 3rdparty
│ └── 3rdparty.7z
├── CMakeLists.txt
├── README.md
├── examples
│ ├── cpp
│ │ ├── childipc_test.cpp
│ │ ├── parentipc_test.cpp
│ │ ├── xplugin_ocr_test.cpp
│ │ ├── xplugin_player_test.cpp
│ │ ├── xplugin_test.cpp
│ │ └── xplugin_utility_test.cpp
│ ├── java
│ │ └── MMMojoCallUsage.java
│ └── python
│ │ └── mmmojo_call_usage.py
├── proto
│ ├── ocr_protobuf.proto
│ ├── player_protobuf.proto
│ └── utility_protobuf.proto
└── src
│ ├── dllmain.cpp
│ ├── include
│ ├── mmmojo_call.h
│ ├── mmmojo_ocr.h
│ ├── mmmojo_player.h
│ ├── mmmojo_source
│ │ ├── mmmojo.h
│ │ └── mmmojo_environment_callbacks.h
│ ├── mmmojo_utility.h
│ ├── mojo_call_export.h
│ ├── qq_mojoipc
│ │ ├── qq_ipc.h
│ │ └── qq_ipc_asm.h
│ ├── utils.h
│ └── xplugin_protobuf
│ │ ├── google.zip
│ │ ├── ocr_protobuf.pb.h
│ │ ├── player_protobuf.pb.h
│ │ └── utility_protobuf.pb.h
│ ├── mmmojocall
│ ├── mmmojo_call.cpp
│ ├── mojo_call_export.cpp
│ └── wrapper
│ │ ├── mmmojo_ocr.cpp
│ │ ├── mmmojo_player.cpp
│ │ ├── mmmojo_utility.cpp
│ │ ├── ocr_protobuf.pb.cc
│ │ ├── player_protobuf.pb.cc
│ │ └── utility_protobuf.pb.cc
│ ├── qq_mojoipc
│ ├── qq_ipc.cpp
│ └── qq_ipc_asm.asm
│ └── utils.cpp
├── README.md
├── parent-ipc-core-x64.dll
└── parent-ipc-core-x86.dll
/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 |
--------------------------------------------------------------------------------
/MMMojoCall/3rdparty/3rdparty.7z:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EEEEhex/QQImpl/3aac29788fc63d25665a0ae473b8b8c788ed20bb/MMMojoCall/3rdparty/3rdparty.7z
--------------------------------------------------------------------------------
/MMMojoCall/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required (VERSION 3.5)
2 |
3 | cmake_policy(SET CMP0091 NEW)
4 | cmake_policy(SET CMP0078 NEW)
5 | cmake_policy(SET CMP0086 NEW)
6 |
7 | project (MMMojoCall LANGUAGES CXX VERSION 2.0.0)
8 |
9 | # project use folder
10 | set_property(GLOBAL PROPERTY USE_FOLDERS ON)
11 |
12 | # set up option variable for cmake
13 | option(XPLUGIN_WRAPPER "Enable this to build the OCR/Utility/Player Wrapper Code" ON)
14 | option(BUILD_QQIPC "Enable this to build the QQ Mojo IPC code" OFF)
15 | option(BUILD_CPPEXAMPLE "Enable this to build the c++ usage example" OFF)
16 | option(EXAMPLE_USE_JSON "Example Code's callback function data using protobuf or json" ON)
17 | option(BUILD_PURE_C_MODE "Export Pure C Interface" OFF)
18 |
19 | # add mmmojo_call src file
20 | aux_source_directory(src SRC_FILES)
21 | aux_source_directory(src/mmmojocall SRC_FILES)
22 |
23 | # add xplugin wrapper src file
24 | if (XPLUGIN_WRAPPER)
25 | # check depend files
26 | if (NOT EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/libprotobuf_32_MT.lib")
27 | message(FATAL_ERROR "the depends lib is not exist!")
28 | endif()
29 |
30 | if (NOT EXISTS "${CMAKE_SOURCE_DIR}/src/include/xplugin_protobuf/google/protobuf")
31 | message(FATAL_ERROR "the google protobuf header file is not exist!")
32 | endif()
33 |
34 | aux_source_directory(src/mmmojocall/wrapper SRC_FILES)
35 | endif()
36 |
37 | # add qq mojo ipc src file
38 | if (BUILD_QQIPC)
39 | list(APPEND SRC_FILES src/qq_mojoipc/qq_ipc.cpp)
40 |
41 | # if x64 then need asm file
42 | if(CMAKE_SIZEOF_VOID_P EQUAL 8)
43 | list(APPEND SRC_FILES src/qq_mojoipc/qq_ipc_asm.asm)
44 | enable_language(C ASM_MASM) # enable masm
45 | endif()
46 | endif()
47 |
48 | # create library
49 | add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
50 |
51 | # add mmmojo_call include dir
52 | include_directories(src/include)
53 | include_directories(src/include/mmmojo_source)
54 |
55 | # add xplugin wrapper include dir
56 | if (XPLUGIN_WRAPPER)
57 | include_directories(src/include/xplugin_protobuf)
58 | endif()
59 |
60 | # add qq mojo ipc include dir
61 | if (BUILD_QQIPC)
62 | include_directories(src/include/qq_mojoipc)
63 | endif()
64 |
65 | # add xplugin wrapper marco
66 | if (XPLUGIN_WRAPPER)
67 | add_definitions(-DUSE_WRAPPER)
68 | endif()
69 |
70 | # add PURE_C_MODE marco
71 | if (BUILD_PURE_C_MODE)
72 | add_definitions(-DPURE_C_MODE)
73 | endif()
74 |
75 | # add protobuf link lib
76 | if (XPLUGIN_WRAPPER)
77 | # which arch
78 | if(CMAKE_SIZEOF_VOID_P EQUAL 8)
79 | set(ARCH_SUFFIX "64")
80 | else()
81 | set(ARCH_SUFFIX "32")
82 | endif()
83 |
84 | target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/libprotobuf_${ARCH_SUFFIX}_MT$<$:d>.lib)
85 | endif()
86 |
87 | # set /MT or /MTd
88 | # add 'd' to Debug output
89 | set_target_properties(${PROJECT_NAME} PROPERTIES
90 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>"
91 | DEBUG_POSTFIX _d
92 | )
93 |
94 | # build c++ usage example
95 | if (BUILD_CPPEXAMPLE)
96 | if (EXAMPLE_USE_JSON)
97 | add_definitions(-DEXAMPLE_USE_JSON)
98 | endif()
99 |
100 | # add xplugin (without wrapper) example
101 | set(XPLUGIN_USAGE xplugin_test)
102 | set(XPLUGIN_USAGE_SRC examples/cpp/xplugin_test.cpp)
103 | add_executable(${XPLUGIN_USAGE} ${XPLUGIN_USAGE_SRC})
104 | set_property(TARGET ${XPLUGIN_USAGE} PROPERTY FOLDER "EXAMPLE")
105 | set_target_properties(${XPLUGIN_USAGE} PROPERTIES
106 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>"
107 | DEBUG_POSTFIX _d)
108 | add_dependencies(${XPLUGIN_USAGE} ${PROJECT_NAME})
109 | target_link_libraries(${XPLUGIN_USAGE} PRIVATE $(SolutionDir)$,Debug,Release>/${PROJECT_NAME}$<$:_d>.lib)
110 |
111 | # add xplugin wrapper example
112 | if (XPLUGIN_WRAPPER)
113 | #OCR TEST
114 | set(XPLUGIN_OCR_USAGE xplugin_ocr_test)
115 | set(XPLUGIN_OCR_USAGE_SRC examples/cpp/xplugin_ocr_test.cpp)
116 |
117 | if (NOT EXAMPLE_USE_JSON)
118 | list(APPEND XPLUGIN_OCR_USAGE_SRC src/mmmojocall/wrapper/ocr_protobuf.pb.cc)
119 | endif()
120 |
121 | add_executable(${XPLUGIN_OCR_USAGE} ${XPLUGIN_OCR_USAGE_SRC})
122 | set_property(TARGET ${XPLUGIN_OCR_USAGE} PROPERTY FOLDER "EXAMPLE")
123 | set_target_properties(${XPLUGIN_OCR_USAGE} PROPERTIES
124 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>"
125 | DEBUG_POSTFIX _d)
126 | add_dependencies(${XPLUGIN_OCR_USAGE} ${PROJECT_NAME})
127 | target_link_libraries(${XPLUGIN_OCR_USAGE} PRIVATE $(SolutionDir)$,Debug,Release>/${PROJECT_NAME}$<$:_d>.lib)
128 | if (NOT EXAMPLE_USE_JSON)
129 | target_link_libraries(${XPLUGIN_OCR_USAGE} PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/libprotobuf_${ARCH_SUFFIX}_MT$<$:d>.lib)
130 | endif()
131 |
132 | #UTILITY TEST
133 | set(XPLUGIN_UTILITY_USAGE xplugin_utility_test)
134 | set(XPLUGIN_UTILITY_USAGE_SRC examples/cpp/xplugin_utility_test.cpp)
135 |
136 | if (NOT EXAMPLE_USE_JSON)
137 | list(APPEND XPLUGIN_UTILITY_USAGE_SRC src/mmmojocall/wrapper/utility_protobuf.pb.cc)
138 | endif()
139 |
140 | add_executable(${XPLUGIN_UTILITY_USAGE} ${XPLUGIN_UTILITY_USAGE_SRC})
141 | set_property(TARGET ${XPLUGIN_UTILITY_USAGE} PROPERTY FOLDER "EXAMPLE")
142 | set_target_properties(${XPLUGIN_UTILITY_USAGE} PROPERTIES
143 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>"
144 | DEBUG_POSTFIX _d)
145 | add_dependencies(${XPLUGIN_UTILITY_USAGE} ${PROJECT_NAME})
146 | target_link_libraries(${XPLUGIN_UTILITY_USAGE} PRIVATE $(SolutionDir)$,Debug,Release>/${PROJECT_NAME}$<$:_d>.lib)
147 | if (NOT EXAMPLE_USE_JSON)
148 | target_link_libraries(${XPLUGIN_UTILITY_USAGE} PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/libprotobuf_${ARCH_SUFFIX}_MT$<$:d>.lib)
149 | endif()
150 |
151 | #PLAYER TEST
152 | set(XPLUGIN_PLAYER_USAGE xplugin_player_test)
153 | set(XPLUGIN_PLAYER_USAGE_SRC examples/cpp/xplugin_player_test.cpp)
154 |
155 | add_executable(${XPLUGIN_PLAYER_USAGE} ${XPLUGIN_PLAYER_USAGE_SRC})
156 | set_property(TARGET ${XPLUGIN_PLAYER_USAGE} PROPERTY FOLDER "EXAMPLE")
157 | set_target_properties(${XPLUGIN_PLAYER_USAGE} PROPERTIES
158 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>"
159 | DEBUG_POSTFIX _d)
160 | add_dependencies(${XPLUGIN_PLAYER_USAGE} ${PROJECT_NAME})
161 | target_link_libraries(${XPLUGIN_PLAYER_USAGE} PRIVATE $(SolutionDir)$,Debug,Release>/${PROJECT_NAME}$<$:_d>.lib)
162 | endif()
163 |
164 | if (BUILD_QQIPC)
165 | set(QQIPC_PARENT_USAGE qqipc_parent_test)
166 | set(QQIPC_PARENT_USAGE_SRC examples/cpp/parentipc_test.cpp)
167 |
168 | add_executable(${QQIPC_PARENT_USAGE} ${QQIPC_PARENT_USAGE_SRC})
169 | set_property(TARGET ${QQIPC_PARENT_USAGE} PROPERTY FOLDER "EXAMPLE")
170 |
171 | set_target_properties(${QQIPC_PARENT_USAGE} PROPERTIES
172 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>"
173 | DEBUG_POSTFIX _d)
174 | add_dependencies(${QQIPC_PARENT_USAGE} ${PROJECT_NAME})
175 | target_link_libraries(${QQIPC_PARENT_USAGE} PRIVATE $(SolutionDir)$,Debug,Release>/${PROJECT_NAME}$<$:_d>.lib)
176 |
177 | set(QQIPC_CHILD_USAGE qqipc_child_test)
178 | set(QQIPC_CHILD_USAGE_SRC examples/cpp/childipc_test.cpp)
179 |
180 | add_executable(${QQIPC_CHILD_USAGE} ${QQIPC_CHILD_USAGE_SRC})
181 | set_property(TARGET ${QQIPC_CHILD_USAGE} PROPERTY FOLDER "EXAMPLE")
182 |
183 | set_target_properties(${QQIPC_CHILD_USAGE} PROPERTIES
184 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>"
185 | DEBUG_POSTFIX _d)
186 | add_dependencies(${QQIPC_CHILD_USAGE} ${PROJECT_NAME})
187 | target_link_libraries(${QQIPC_CHILD_USAGE} PRIVATE $(SolutionDir)$,Debug,Release>/${PROJECT_NAME}$<$:_d>.lib)
188 | endif()
189 | endif()
190 |
--------------------------------------------------------------------------------
/MMMojoCall/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/cpp/childipc_test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "qq_ipc.h"
4 |
5 | using namespace qqimpl;
6 |
7 | void __stdcall OnChildReceiveMsg32(void* pArg, char* msg, int arg3, int arg4, char* addition_msg, int addition_msg_size)
8 | {
9 | //std::cout << "[ " << __FUNCTION__ << "] | Arg: 0x" << std::hex << pArg << std::endl;
10 | std::string msg_str = msg, add_msg_str(addition_msg, addition_msg_size);
11 | std::cout << "[*] [C] [ " << __FUNCTION__ << "] | Msg: " << msg_str << std::endl;
12 | std::cout << "[*] [C] [ " << __FUNCTION__ << "] | Addition Msg Size: " << addition_msg_size << std::endl;
13 | if (addition_msg_size != 0)
14 | {
15 | std::cout << "[*] [C] [ " << __FUNCTION__ << "] | The Addition Msg: ";
16 | for (size_t i = 0; i < addition_msg_size; i++)
17 | printf_s("0x%02X ", (byte)(addition_msg[i]));
18 | printf_s("(%s)", addition_msg);
19 | puts("");
20 | }
21 | }
22 |
23 | void OnChildReceiveMsg64(void* pArg, char* msg, int arg3, char* addition_msg, int addition_msg_size)
24 | {
25 | //std::cout << "[ " << __FUNCTION__ << "] | Arg: 0x" << std::hex << pArg << std::endl;
26 |
27 | std::string msg_str = msg, add_msg_str(addition_msg, addition_msg_size);
28 | std::cout << "[*] [C] [ " << __FUNCTION__ << "] | Msg: " << msg_str << std::endl;
29 | std::cout << "[*] [C] [ " << __FUNCTION__ << "] | Addition Msg Size: " << addition_msg_size << std::endl;
30 | if (addition_msg_size != 0)
31 | {
32 | std::cout << "[*] [C] [ " << __FUNCTION__ << "] | The Addition Msg: ";
33 | for (size_t i = 0; i < addition_msg_size; i++)
34 | printf_s("0x%02X ", (byte)(addition_msg[i]));
35 | printf_s("(%s)", addition_msg);
36 | puts("");
37 | }
38 |
39 | //qqimpl::QQIpcParentWrapper::OnDefaultReceiveMsg(pArg, msg, arg3, addition_msg, addition_msg_size);
40 | }
41 |
42 | int main()
43 | {
44 | std::cout << "[+] [C] Child Begin!\n";
45 |
46 | qqipc::QQIpcChildWrapper child_ipc;
47 |
48 | if (!child_ipc.InitEnv())
49 | {
50 | std::cout << "[!] [C] Init Child Err: " << child_ipc.GetLastErrStr() << std::endl;
51 | getchar(); return 0;
52 | }
53 |
54 | child_ipc.InitLog();
55 | #ifdef _WIN64
56 | child_ipc.SetChildReceiveCallback(OnChildReceiveMsg64);
57 | #else
58 | child_ipc.SetChildReceiveCallback(OnChildReceiveMsg32);
59 | #endif // _WIN64
60 | child_ipc.InitChildIpc();
61 |
62 | std::cout << "[=] [C] Press any key to SendIpcMessage to Parent: \n";
63 | getchar();
64 |
65 | std::string addtion_msg = "addition_test_child";
66 | child_ipc.SendIpcMessage("child_test", addtion_msg.data(), addtion_msg.size());
67 |
68 | MSG msg;
69 | // 主消息循环:
70 | while (GetMessage(&msg, nullptr, 0, 0))
71 | {
72 | TranslateMessage(&msg);
73 | DispatchMessage(&msg);
74 | }
75 | return 0;
76 | }
77 |
78 |
79 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/cpp/parentipc_test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "qq_ipc.h"
5 |
6 | using namespace qqimpl;
7 |
8 | void __stdcall OnParentReceiveMsg32(void*, char*, int, int, char*, int);
9 | void OnParentReceiveMsg64(void*, char*, int, char*, int);
10 |
11 | int main()
12 | {
13 | std::cout << "[+] [P] Parent Ipc Begin!\n";
14 | int child_pid_1 = 0, child_pid_2 = 0;
15 |
16 | qqipc::QQIpcParentWrapper parent_ipc;
17 | //初始化环境
18 | if (!parent_ipc.InitEnv())
19 | {
20 | std::cout << "[!] [P] Init ParentIpc Err: " << parent_ipc.GetLastErrStr() << std::endl;
21 | getchar(); return 0;
22 | }
23 | parent_ipc.InitLog(5);
24 | parent_ipc.InitParentIpc();
25 |
26 | qqipc::callback_ipc cb_ptr;
27 | #ifdef _WIN64
28 | cb_ptr = OnParentReceiveMsg64;
29 | #else
30 | cb_ptr = OnParentReceiveMsg32;
31 | #endif // _WIN64
32 |
33 | const char* child_path;
34 | #ifdef _DEBUG
35 | child_path = "qqipc_child_test_d.exe";
36 | #else
37 | child_path = "qqipc_child_test.exe";
38 | #endif // _WIN64
39 |
40 |
41 | const char* cmd_args[] = {"-test1", "-test2"};//传递命令行参数
42 | child_pid_1 = parent_ipc.LaunchChildProcess(child_path, cb_ptr, (void*)"Child_1", (char**)cmd_args, 2);// "Child_1"为传递给OnUsrReceiveMsg的参数
43 | if (child_pid_1 == 0)
44 | {
45 | std::cout << "[!] [P] Launch CihldIpc.exe Err: " << parent_ipc.GetLastErrStr() << std::endl;
46 | getchar(); return 0;
47 | }
48 |
49 | std::cout << "[+] [P] Launch OK! Ready to Connect!\n";
50 | parent_ipc.ConnectedToChildProcess(child_pid_1);
51 |
52 | std::cout << "[=] [P] Press any key to SendIpcMessage to Child1: \n";
53 | getchar();
54 | std::string addtion_msg = "addition_parent";
55 | parent_ipc.SendIpcMessage(child_pid_1, "test_parent", addtion_msg.data(), addtion_msg.size());
56 |
57 |
58 | std::cout << "[=] [P] Press any key to Terminate Child1: \n";
59 | getchar();
60 | parent_ipc.TerminateChildProcess(child_pid_1, 0, true);
61 |
62 | std::cout << "[=] [P] Press any key to ReLaunchChildProcess Child1: \n";
63 | getchar();
64 | child_pid_1 = parent_ipc.ReLaunchChildProcess(child_pid_1);
65 | parent_ipc.ConnectedToChildProcess(child_pid_1);
66 |
67 | MSG msg;
68 | // 主消息循环:
69 | while (GetMessage(&msg, nullptr, 0, 0))
70 | {
71 | TranslateMessage(&msg);
72 | DispatchMessage(&msg);
73 | }
74 |
75 | return 0;
76 | }
77 |
78 | void __stdcall OnParentReceiveMsg32(void* pArg, char* msg, int arg3, int arg4, char* addition_msg, int addition_msg_size)
79 | {
80 | char* cb_arg = (char*)pArg;
81 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | Arg: " << cb_arg << std::endl;
82 |
83 | std::string msg_str = msg, add_msg_str(addition_msg, addition_msg_size);
84 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | Msg: " << msg_str << std::endl;
85 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | Addition Msg Size: " << addition_msg_size << std::endl;
86 | if (addition_msg_size != 0)
87 | {
88 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | The Addition Msg: ";
89 | for (size_t i = 0; i < addition_msg_size; i++)
90 | printf_s("0x%02X ", (byte)(addition_msg[i]));
91 | printf_s("(%s)", addition_msg);
92 | puts("");
93 | }
94 |
95 | if (msg_str == "IPC_CONNECTED")
96 | {
97 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | " << cb_arg << " : Alive!" << std::endl;
98 | }
99 | else if (msg_str == "IPC_DISCONNECTED")
100 | {
101 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | " << cb_arg << " : Dead!" << std::endl;
102 | }
103 |
104 | //qqimpl::QQIpcParentWrapper::OnDefaultReceiveMsg(pArg, msg, arg3, arg4, addition_msg, addition_msg_size);
105 | }
106 |
107 |
108 | void OnParentReceiveMsg64(void* pArg, char* msg, int arg3, char* addition_msg, int addition_msg_size)
109 | {
110 | char* cb_arg = (char*)pArg;
111 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | Arg: " << cb_arg << std::endl;
112 |
113 | std::string msg_str = msg, add_msg_str(addition_msg, addition_msg_size);
114 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | Msg: " << msg_str << std::endl;
115 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | Addition Msg Size: " << addition_msg_size << std::endl;
116 | if (addition_msg_size != 0)
117 | {
118 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | The Addition Msg: ";
119 | for (size_t i = 0; i < addition_msg_size; i++)
120 | printf_s("0x%02X ", (byte)(addition_msg[i]));
121 | printf_s("(%s)", addition_msg);
122 | puts("");
123 | }
124 |
125 | if (msg_str == "IPC_CONNECTED")
126 | {
127 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | " << cb_arg << " : Alive!" << std::endl;
128 | }
129 | else if (msg_str == "IPC_DISCONNECTED")
130 | {
131 | std::cout << "[*] [P] [ " << __FUNCTION__ << "] | " << cb_arg << " : Dead!" << std::endl;
132 | }
133 |
134 | //qqimpl::QQIpcParentWrapper::OnDefaultReceiveMsg(pArg, msg, arg3, addition_msg, addition_msg_size);
135 | }
136 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/cpp/xplugin_ocr_test.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************//**
2 | * @file xplugin_test.cpp
3 | * @brief 此文件代码是使用OCRManager类调用WeChatOCR.exe的示例
4 | *********************************************************************/
5 |
6 | #include
7 |
8 | #include "mmmojo_ocr.h"
9 |
10 | using namespace qqimpl;
11 |
12 | void OCRUsrReadOnPush(const char* pic_path, const void* data, int data_size)
13 | {
14 | std::cout << "[↓] " << __FUNCTION__ << ":\n[\n";
15 |
16 | #ifdef EXAMPLE_USE_JSON
17 | //此时参数data为json字符串
18 | std::cout << (char*)data << std::endl;
19 | #else
20 | ocr_protobuf::OcrResponse ocr_response;
21 | ocr_response.ParseFromArray(data, data_size);
22 |
23 | char out_buf[512] = { 0 };
24 | sprintf_s(out_buf, sizeof(out_buf), "\t[*] type: %d task id: %d errCode: %d\n", ocr_response.type(), ocr_response.task_id(), ocr_response.err_code());
25 | std::cout << out_buf;
26 |
27 | if (pic_path != nullptr)
28 | {
29 | sprintf_s(out_buf, sizeof(out_buf), "\t[*] TaskId: %d -> PicPath: %s\n", ocr_response.task_id(), pic_path);
30 | std::cout << out_buf;
31 | }
32 | else
33 | {
34 | std::cout << "\t[*] This is a type 1 Push that is called back only once at startup of WeChatOCR.exe";
35 | }
36 |
37 | if (ocr_response.type() == 0)
38 | {
39 | std::cout << "\t[*] OcrResult:\n\t[\n";
40 | for (int i = 0; i < ocr_response.ocr_result().single_result_size(); i++)
41 | {
42 | ocr_protobuf::OcrResponse::OcrResult::SingleResult single_result = ocr_response.ocr_result().single_result(i);
43 |
44 | sprintf_s(out_buf, sizeof(out_buf), "\t\tRECT:[left: %f, top: %f, right: %f, bottom: %f]\n", single_result.left(), single_result.top(), single_result.right(), single_result.bottom());
45 | std::cout << out_buf;
46 | std::string utf8str = single_result.single_str_utf8();
47 | std::cout << "\t\tUTF8STR:[";
48 | for (size_t j = 0; j < utf8str.size(); j++)
49 | {
50 | printf_s("0x%2X ", (BYTE)utf8str[j]);
51 | }
52 | std::cout << " (" << utf8str << ")]\n";
53 | }
54 | std::cout << "\t]";
55 | }
56 |
57 | std::cout << "\n]" << std::endl;
58 | #endif
59 | }
60 |
61 |
62 | int main()
63 | {
64 | SetConsoleOutputCP(CP_UTF8);
65 |
66 | std::string wechat_ocr_dir;//"C:\\Users\\{YourName}\\AppData\\Roaming\\Tencent\\WeChat\\XPlugin\\Plugins\\WeChatOCR\\7057\\extracted\\WeChatOCR.exe"
67 | std::string wechat_dir;//Such as "D:\\WeChat\\[3.9.7.29]"
68 |
69 | std::cout << "\033[34m[=] Enter WeChatOCR.exe Path:\n[>]\033[0m ";
70 | std::getline(std::cin, wechat_ocr_dir);
71 |
72 | std::cout << "\033[34m[=] Enter mmmojo(_64).dll Path:\n[>]\033[0m ";
73 | std::getline(std::cin, wechat_dir);
74 |
75 | // 加载mmmojo(_64).dll并获取导出函数, 只需要调用一次.
76 | if (!mmmojocall::InitMMMojoDLLFuncs(wechat_dir.c_str()))
77 | {
78 | std::cout << "\033[31m[!] mmmojocall::InitMMMojoDLLFuncs ERR!\033[0m\n";
79 | return 1;
80 | }
81 |
82 | // 初始化MMMojo (包括ThreadPool等), 只需要调用一次.
83 | mmmojocall::InitMMMojoGlobal(NULL, NULL);
84 |
85 | //------------------------
86 | //以下为使用封装好的OCRManager类调用WeChatOCR进行OCR的示例
87 | mmmojocall::OCRManager ocr_manager;
88 | if (!ocr_manager.SetExePath(wechat_ocr_dir.c_str()))
89 | {
90 | std::cout << "\033[31m[!] " << ocr_manager.GetLastErrStr() << "\033[0m\n";
91 | return 1;
92 | }
93 |
94 | if (!ocr_manager.SetUsrLibDir(wechat_dir.c_str()))
95 | {
96 | std::cout << "\033[31m[!] " << ocr_manager.GetLastErrStr() << "\033[0m\n";
97 | return 1;
98 | }
99 |
100 | #ifdef EXAMPLE_USE_JSON
101 | ocr_manager.SetCallbackDataMode(true);//回调函数的参数传入json
102 | #endif //EXAMPLE_USE_JSON
103 | ocr_manager.SetReadOnPush(OCRUsrReadOnPush);
104 |
105 | //启动WeChatOCR.exe
106 | if (!ocr_manager.StartWeChatOCR())
107 | {
108 | std::cout << "\033[31m[!] " << ocr_manager.GetLastErrStr() << "\033[0m\n";
109 | return 1;
110 | }
111 | std::cout << "\033[31m[+] StartWeChatOCR OK!\033[0m\n";
112 |
113 | //向其发送OCR请求
114 | std::cout << "[=] Press any key to send ocr request...\n"; getchar();
115 | if (!ocr_manager.DoOCRTask(".\\test.png"))
116 | {
117 | std::cout << "\033[31m[!] " << ocr_manager.GetLastErrStr() << "\033[0m\n";
118 | return 1;
119 | }
120 |
121 | //结束WeChatOCR.exe
122 | std::cout << "[=] Press any key to stop WeChatOCR Env...\n"; getchar();
123 | ocr_manager.KillWeChatOCR();
124 | std::cout << "\033[31m[-] KillWeChatOCR!\033[0m\n";
125 |
126 |
127 | mmmojocall::ShutdownMMMojoGlobal();
128 | return 0;
129 | }
130 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/cpp/xplugin_player_test.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************//**
2 | * @file xplugin_test.cpp
3 | * @brief 此文件代码是使用PlayerManager类调用WeChatPlayer.exe的示例
4 | *********************************************************************/
5 |
6 | #include
7 | #include
8 |
9 | #include "mmmojo_player.h"
10 |
11 | using namespace qqimpl;
12 |
13 | //简单Player播放窗口类名
14 | const char PLAYER_CLASS_NAME[] = "Simple Player Window Class";
15 |
16 | //简单Player播放窗口的消息处理事件
17 | LRESULT CALLBACK SimplePlayerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
18 | {
19 | return DefWindowProc(hWnd, message, wParam, lParam);
20 | }
21 |
22 | //注册窗口类 为TRUE则注册 FALSE则取消注册
23 | void RegisterSimplePlayerWin32(BOOL reg)
24 | {
25 | if (reg)
26 | {
27 | // Register the window class.
28 | WNDCLASS wc = { };
29 |
30 | wc.lpfnWndProc = SimplePlayerWndProc;
31 | wc.hInstance = GetModuleHandle(NULL);
32 | wc.lpszClassName = PLAYER_CLASS_NAME;
33 |
34 | RegisterClassA(&wc);
35 | }
36 | else
37 | {
38 | HINSTANCE hInst = GetModuleHandle(NULL);
39 | UnregisterClassA(PLAYER_CLASS_NAME, hInst);
40 | }
41 | }
42 |
43 | //创建窗口
44 | DWORD WINAPI CreateSimplePlayerWIN32(LPVOID lpParam)
45 | {
46 | //解析参数
47 | HWND* lpHwnd = (HWND*)(((DWORD64*)lpParam)[0]);
48 | HANDLE* lpEvent = (LPHANDLE)(((DWORD64*)lpParam)[1]);
49 |
50 | // Create the window.
51 | HWND hwnd = CreateWindowEx(
52 | 0, // Optional window styles.
53 | PLAYER_CLASS_NAME, // Window class
54 | "Simple Player Window", // Window text
55 | WS_OVERLAPPEDWINDOW, // Window style
56 |
57 | // Size and position
58 | CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
59 |
60 | NULL, // Parent window
61 | NULL, // Menu
62 | GetModuleHandle(NULL), // Instance handle
63 | NULL // Additional application data
64 | );
65 |
66 | if (hwnd == NULL)
67 | {
68 | SetEvent(*lpEvent);//设置Event
69 | return 0;
70 | }
71 |
72 | *lpHwnd = hwnd;//传递参数
73 | SetEvent(*lpEvent);//设置Event
74 |
75 | ShowWindow(hwnd, SW_SHOWNORMAL);
76 | UpdateWindow(hwnd);
77 |
78 | // 消息循环:
79 | MSG msg;
80 | while (GetMessage(&msg, nullptr, 0, 0))
81 | {
82 | TranslateMessage(&msg);
83 | DispatchMessage(&msg);
84 | }
85 | return (int)msg.wParam;
86 | }
87 |
88 |
89 | HWND CreateSimplePlayerWindow()
90 | {
91 | HWND winHwnd = NULL;
92 | HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
93 | //前8个字节为LPHWND, 后8个字节为LPEVENT, 最后8个字节为this类指针
94 | DWORD64* lpParam = (DWORD64*)calloc(16, 1);
95 | lpParam[0] = (DWORD64)(&winHwnd);
96 | lpParam[1] = (DWORD64)(&hEvent);
97 | CloseHandle(CreateThread(NULL, 0, CreateSimplePlayerWIN32, lpParam, 0, NULL));
98 | WaitForSingleObject(hEvent, INFINITE);
99 | free(lpParam);
100 | CloseHandle(hEvent);
101 | return winHwnd;
102 | }
103 |
104 | int main()
105 | {
106 | SetConsoleOutputCP(CP_UTF8);
107 |
108 | std::string wechat_player_dir;//"C:\\Users\\{YourName}\\AppData\Roaming\\Tencent\\WeChat\\XPlugin\\Plugins\\ThumbPlayer\\4063\\extracted\\WeChatPlayer.exe
109 | std::string wechat_dir;//Such as "D:\\WeChat\\[3.9.7.29]"
110 |
111 | std::cout << "\033[34m[=] Enter WeChatPlayer.exe Path:\n[>]\033[0m ";
112 | std::getline(std::cin, wechat_player_dir);
113 |
114 | std::cout << "\033[34m[=] Enter mmmojo(_64).dll Path:\n[>]\033[0m ";
115 | std::getline(std::cin, wechat_dir);
116 |
117 | // 加载mmmojo(_64).dll并获取导出函数, 只需要调用一次.
118 | if (!mmmojocall::InitMMMojoDLLFuncs(wechat_dir.c_str()))
119 | {
120 | std::cout << "\033[31m[!] mmmojocall::InitMMMojoDLLFuncs ERR!\033[0m\n";
121 | return 1;
122 | }
123 |
124 | // 初始化MMMojo (包括ThreadPool等), 只需要调用一次.
125 | mmmojocall::InitMMMojoGlobal(NULL, NULL);
126 |
127 |
128 | //注册窗口类
129 | RegisterSimplePlayerWin32(TRUE);
130 |
131 | mmmojocall::PlayerManager player_manager;
132 | mmmojocall::PlayerManager::CoreStatus* core_status;
133 |
134 | //设置启动所需参数
135 | player_manager.SetExePath(wechat_player_dir.c_str());
136 | player_manager.SetSwitchArgs(wechat_dir.c_str());
137 |
138 | //启动WeChatPlayer.exe
139 | player_manager.StartWeChatPlayer();
140 | std::cout << "\033[31m[+] StartWeChatPlayer OK!\033[0m\n";
141 |
142 |
143 | std::string video_path, file_name;
144 | std::cout << "\033[34m[=] Enter The Video Path:\n[>]\033[0m ";
145 | std::getline(std::cin, video_path);
146 |
147 | std::string::size_type iPos = video_path.find_last_of('\\') + 1;
148 | std::string filename_ = video_path.substr(iPos, video_path.length() - iPos);
149 | file_name = filename_.substr(0, filename_.rfind("."));
150 |
151 | std::cout << "[=] Press any key to Create Player Core...\n"; getchar();
152 | //创建一个播放器内核 (可以创建多个 一个内核就是一个视频)
153 | int player_id_1 = player_manager.CreatePlayerCore();
154 | std::cout << "[*] Player Core ID: " << player_id_1 << std::endl;
155 |
156 | //创建WIN32窗口
157 | HWND video_win_1 = CreateSimplePlayerWindow();
158 | std::cout << "[*] Create Player Window OK [HANDLE: " << video_win_1 << "]\n";
159 |
160 | player_manager.InitPlayerCore(player_id_1, video_win_1, file_name.c_str(), video_path.c_str());
161 | std::cout << "[*] Init Player [" << player_id_1 << "] Core OK!\n";
162 |
163 | std::cout << "[*] Player [" << player_id_1 << "] Core Status:\n{\n";
164 | core_status = player_manager.GetPlayerCoreStatus(player_id_1);
165 | std::cout << "\tSize: " << core_status->org_width << " | " << core_status->org_height << std::endl;
166 | std::cout << "\tDuration: " << core_status->duration << std::endl;
167 | std::cout << "}\n";
168 |
169 | std::cout << "[=] Press any key to Start Video...\n"; getchar();
170 | player_manager.StartVideo(player_id_1);
171 |
172 | std::cout << "[=] Press any key to Pause Video...\n"; getchar();
173 | player_manager.PauseVideo(player_id_1);
174 |
175 | std::cout << "[=] Press any key to Resume Video...\n"; getchar();
176 | player_manager.ResumeVideo(player_id_1);
177 |
178 | std::cout << "[=] Press any key to Get Video Current Pos(ms)...\n"; getchar();
179 | int pos_ms = player_manager.GetCurrentPosition(player_id_1);
180 | std::cout << "[*] Player [" << player_id_1 << "] Core Pos: [" << pos_ms << "]\n";
181 |
182 | std::cout << "[=] Press any key to Seek to pos 0(begin)...\n"; getchar();
183 | player_manager.SeekToVideo(player_id_1, 0.0);
184 |
185 | std::cout << "[=] Press any key to Mute Video...\n"; getchar();
186 | player_manager.MuteVideo(player_id_1, true);
187 |
188 | std::cout << "[=] Press any key to Cancel Mute Video...\n"; getchar();
189 | player_manager.MuteVideo(player_id_1, false);
190 |
191 | std::cout << "[=] Press any key to Set Video Speed Ratio x2...\n"; getchar();
192 | player_manager.SetSpeedVideo(player_id_1, 2.0);
193 |
194 | std::cout << "[=] Press any key to Stop Video...\n"; getchar();
195 | player_manager.StopVideo(player_id_1);
196 |
197 | std::cout << "[=] Press any key to Destroy Player Core...\n"; getchar();
198 | player_manager.DestroyPlayerCore(player_id_1);
199 |
200 | std::cout << "[=] Press any key to Kill WeChatPlayer.exe...\n"; getchar();
201 | player_manager.KillWeChatPlayer();
202 |
203 | //卸载窗口类
204 | RegisterSimplePlayerWin32(FALSE);
205 |
206 | mmmojocall::ShutdownMMMojoGlobal();
207 | return 0;
208 | }
209 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/cpp/xplugin_test.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************//**
2 | * @file xplugin_test.cpp
3 | * @brief 此文件代码是直接使用XPluginManager类调用微信XPlugin组件(WeChatOCR)的示例
4 | *********************************************************************/
5 |
6 | #include
7 | #include
8 |
9 | #include "mmmojo_call.h"
10 |
11 | using namespace qqimpl;
12 |
13 | //↓mmmojo::common::MMMojoReadOnPush;
14 | void UsrReadOnPush(uint32_t request_id, const void* request_info, void* user_data)
15 | {
16 | std::cout << "[↓] " << __FUNCTION__ << " [RequestID: " << request_id << "] :\n[\n";
17 |
18 | uint32_t pb_size;
19 | const void* pb_data = mmmojocall::GetPbSerializedData(request_info, pb_size);
20 |
21 | std::cout << "\t[*] Request ID: " << request_id << " | Protobuf Size: " << pb_size << std::endl;
22 | std::cout << "\t[*] Protobuf Data: ";
23 | for (size_t i = 0; i < pb_size; i++)
24 | {
25 | printf_s("0x%02X ", ((LPBYTE)pb_data)[i]);
26 | }
27 |
28 | mmmojocall::RemoveReadInfo(request_info);
29 |
30 | std::cout << "\n]" << std::endl;
31 | }
32 |
33 | int main()
34 | {
35 | SetConsoleOutputCP(CP_UTF8);
36 |
37 | std::string wechat_ocr_dir;//"C:\\Users\\{YourName}\\AppData\\Roaming\\Tencent\\WeChat\\XPlugin\\Plugins\\WeChatOCR\\7057\\extracted\\WeChatOCR.exe"
38 | std::string wechat_dir;//Such as "D:\\WeChat\\[3.9.7.29]"
39 |
40 | std::cout << "\033[34m[=] Enter WeChatOCR.exe Path:\n[>]\033[0m ";
41 | std::getline(std::cin, wechat_ocr_dir);
42 |
43 | std::cout << "\033[34m[=] Enter mmmojo(_64).dll Path:\n[>]\033[0m ";
44 | std::getline(std::cin, wechat_dir);
45 |
46 | // 加载mmmojo(_64).dll并获取导出函数, 只需要调用一次.
47 | if (!mmmojocall::InitMMMojoDLLFuncs(wechat_dir.c_str()))
48 | {
49 | std::cout << "\033[31m[!] mmmojocall::InitMMMojoDLLFuncs ERR!\033[0m\n";
50 | return 1;
51 | }
52 |
53 | // 初始化MMMojo (包括ThreadPool等), 只需要调用一次.
54 | mmmojocall::InitMMMojoGlobal(NULL, NULL);
55 |
56 | //-------------------------------
57 | //以下为直接使用XPluginManager类调用微信XPlugin组件(WeChatOCR)的示例
58 | mmmojocall::XPluginManager xplugin_manager;
59 | if (!xplugin_manager.SetExePath(wechat_ocr_dir.c_str()))//设置XPlugin组件路径
60 | {
61 | std::cout << "\033[31m[!] " << xplugin_manager.GetLastErrStr() << "\033[0m\n";
62 | return 1;
63 | }
64 | xplugin_manager.AppendSwitchNativeCmdLine("user-lib-dir", wechat_dir.c_str());//添加需要的Switch命令行
65 | xplugin_manager.SetOneCallback(MMMojoEnvironmentCallbackType::kMMReadPush, UsrReadOnPush);//设置ReadPush回调函数
66 | if (!xplugin_manager.StartMMMojoEnv())//启动环境和组件
67 | {
68 | std::cout << "\033[31m[!] " << xplugin_manager.GetLastErrStr() << "\033[0m\n";
69 | return 1;
70 | }
71 | std::cout << "\033[31m[+] InitMMMojoEnv OK!\033[0m\n";
72 | std::cout << "\033[31m[*] Will Use \'.\\test.png\' for test\033[0m\n";
73 |
74 | //以下为图片路径为:".\test.png"的序列化数据
75 | unsigned char pb_hex_data[16] = {
76 | 0x10, 0x01, 0x1A, 0x0C, 0x0A, 0x0A, 0x2E, 0x5C, 0x74, 0x65, 0x73, 0x74, 0x2E, 0x70, 0x6E, 0x67
77 | };
78 |
79 | std::cout << "[=] Press any key to send request...\n"; getchar();//发送请求
80 | xplugin_manager.SendPbSerializedData(pb_hex_data, sizeof(pb_hex_data), MMMojoInfoMethod::kMMPush, false, mmmojocall::RequestIdOCR::OCRPush);
81 |
82 | std::cout << "[=] Press any key to stop xplugin mmmojo env...\n"; getchar();//停止环境
83 | xplugin_manager.StopMMMojoEnv();
84 | std::cout << "\033[31m[-] StopMMMojoEnv...\033[0m\n";
85 |
86 |
87 | mmmojocall::ShutdownMMMojoGlobal();
88 | return 0;
89 | }
90 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/cpp/xplugin_utility_test.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************//**
2 | * @file xplugin_test.cpp
3 | * @brief 此文件代码是UtilityManager类调用WeChatUtility扫描二维码的示例
4 | *********************************************************************/
5 |
6 | #include
7 | #include
8 |
9 | #include "mmmojo_utility.h"
10 |
11 | using namespace qqimpl;
12 |
13 | void UtilityUsrReadOnPush(int type, const void* data, int data_size)
14 | {
15 | std::cout << "[↓] " << __FUNCTION__ << " [RequestID: " << type << "] :\n[\n";
16 |
17 | switch (type)
18 | {
19 | case mmmojocall::RequestIdUtility::UtilityTextScanPushResp:
20 | {
21 | #ifdef EXAMPLE_USE_JSON
22 | std::cout << (char*)data << std::endl;
23 | #else
24 | utility_protobuf::TextScanMessage text_scan_msg;
25 | text_scan_msg.ParseFromArray(data, data_size);
26 |
27 | char out_buf[512] = { 0 };
28 | sprintf_s(out_buf, sizeof(out_buf), "\t[*] TextScanResult: ID: [%d] | PicPath: [%s] | HaveText?: [%d] | UKN0: [%d] | Rate: [%f]\n",
29 | text_scan_msg.text_scan_id(), text_scan_msg.pic_path().c_str(), text_scan_msg.have_text(), text_scan_msg.unknown_0(), text_scan_msg.rate());
30 | std::cout << out_buf;
31 | #endif // EXAMPLE_USE_JSON
32 | }
33 | break;
34 | default:
35 | break;
36 | }
37 |
38 | std::cout << "\n]" << std::endl;
39 | }
40 |
41 | void UtilityUsrReadOnPull(int type, const void* data, int data_size)
42 | {
43 | std::cout << "[↓] " << __FUNCTION__ << " [RequestID: " << type << "] :\n[\n";
44 |
45 | switch (type)
46 | {
47 | case mmmojocall::RequestIdUtility::UtilityQRScanPullResp:
48 | {
49 | #ifdef EXAMPLE_USE_JSON
50 | std::cout << (char*)data << std::endl;
51 | #else
52 | utility_protobuf::QRScanRespMessage qrscan_response;
53 | qrscan_response.ParseFromArray(data, data_size);
54 |
55 | std::cout << "\t[*] QRScanResult UKN0: [" << qrscan_response.unknown_0() << "] :\n\t[\n";
56 | for (int i = 0; i < qrscan_response.qr_result_size(); i++)
57 | {
58 | utility_protobuf::QRScanRespMessage::QRScanResult qrscan_result = qrscan_response.qr_result(i);
59 | std::string result = qrscan_result.result();
60 | uint32_t unknown_0 = qrscan_result.unknow_0();
61 | double unknown_1 = qrscan_result.unknown_1();
62 | double unknown_2 = qrscan_result.unknown_2();
63 | uint32_t unknown_3 = qrscan_result.unknown_3();
64 |
65 | char out_buf[512] = { 0 };
66 | sprintf_s(out_buf, sizeof(out_buf), "\t\tResult: [%s] | UKN0: [%d] | UKN1: [%f] | UKN2: [%f] | UNK3: [%d]\n",
67 | result.c_str(), unknown_0, unknown_1, unknown_2, unknown_3);
68 | std::cout << out_buf;
69 | }
70 | std::cout << "\t]";
71 | #endif
72 | }
73 | break;
74 | default:
75 | break;
76 | }
77 |
78 | std::cout << "\n]" << std::endl;
79 | }
80 |
81 | int main()
82 | {
83 | SetConsoleOutputCP(CP_UTF8);
84 |
85 | std::string wechat_utility_dir;//"C:\\Users\\{YourName}\\AppData\\Roaming\\Tencent\\WeChat\\XPlugin\\Plugins\\WeChatUtility\\8077\\extracted\\WeChatUtility.exe"
86 | std::string wechat_dir;//Such as "D:\\WeChat\\[3.9.7.29]"
87 |
88 | std::cout << "\033[34m[=] Enter WeChatUtility.exe Path:\n[>]\033[0m ";
89 | std::getline(std::cin, wechat_utility_dir);
90 |
91 | std::cout << "\033[34m[=] Enter mmmojo(_64).dll Path:\n[>]\033[0m ";
92 | std::getline(std::cin, wechat_dir);
93 |
94 | // 加载mmmojo(_64).dll并获取导出函数, 只需要调用一次.
95 | if (!mmmojocall::InitMMMojoDLLFuncs(wechat_dir.c_str()))
96 | {
97 | std::cout << "\033[31m[!] mmmojocall::InitMMMojoDLLFuncs ERR!\033[0m\n";
98 | return 1;
99 | }
100 |
101 | // 初始化MMMojo (包括ThreadPool等), 只需要调用一次.
102 | mmmojocall::InitMMMojoGlobal(NULL, NULL);
103 |
104 |
105 | //UtilityManager类调用WeChatUtility扫描二维码的示例
106 | mmmojocall::UtilityManager utility_manager;
107 | if (!utility_manager.SetExePath(wechat_utility_dir.c_str()))
108 | {
109 | std::cout << "\033[31m[!] " << utility_manager.GetLastErrStr() << "\033[0m\n";
110 | return 1;
111 | }
112 |
113 | if (!utility_manager.SetUsrLibDir(wechat_dir.c_str()))
114 | {
115 | std::cout << "\033[31m[!] " << utility_manager.GetLastErrStr() << "\033[0m\n";
116 | return 1;
117 | }
118 |
119 | #ifdef EXAMPLE_USE_JSON
120 | utility_manager.SetCallbackDataMode(true);//回调函数的参数传入json
121 | #endif //EXAMPLE_USE_JSON
122 |
123 | //设置回调函数, Push用于接收TextScan的结果
124 | utility_manager.SetReadOnPull(UtilityUsrReadOnPull);
125 | utility_manager.SetReadOnPush(UtilityUsrReadOnPush);
126 |
127 | //启动WeChatUtility.exe
128 | if (!utility_manager.StartWeChatUtility())
129 | {
130 | std::cout << "\033[31m[!] " << utility_manager.GetLastErrStr() << "\033[0m\n";
131 | return 1;
132 | }
133 | std::cout << "\033[31m[+] StartWeChatUtility OK!\033[0m\n";
134 |
135 | //发起QRScan请求, 第二个参数为TextScan的任务ID
136 | std::cout << "[=] Press any key to send QRScan request...\n"; getchar();
137 | if (!utility_manager.DoPicQRScan(".\\test.png", 0xEE))
138 | {
139 | std::cout << "\033[31m[!] " << utility_manager.GetLastErrStr() << "\033[0m\n";
140 | }
141 |
142 | //结束WeChatUtility.exe
143 | std::cout << "[=] Press any key to stop WeChatUtility Env...\n"; getchar();
144 | utility_manager.KillWeChatUtility();
145 | std::cout << "\033[31m[-] KillWeChatUtility\033[0m\n";
146 |
147 |
148 | mmmojocall::ShutdownMMMojoGlobal();
149 | return 0;
150 | }
151 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/java/MMMojoCallUsage.java:
--------------------------------------------------------------------------------
1 | import com.sun.jna.Library;
2 | import com.sun.jna.Native;
3 | import com.sun.jna.Pointer;
4 |
5 | interface MMMojoCall extends Library {
6 | public static MMMojoCall MMMojoCallDLL = Native.load("./MMMojoCall.dll", MMMojoCall.class);
7 |
8 | // 声明DLL导出函数
9 | Pointer GetInstanceXPluginMgr(int mgr_type);
10 |
11 | int CallFuncXPluginMgr(Pointer class_ptr, int mgr_type, String func_name, Pointer ret_ptr, Object ... args);
12 |
13 | void ReleaseInstanceXPluginMgr(String mgr_ptr);
14 |
15 | }
16 |
17 | public class MMMojoCallUsage {
18 | public static void main(String[] args) {
19 | // 调用DLL导出函数
20 | Pointer cobj_ocr_mgr = MMMojoCall.MMMojoCallDLL.GetInstanceXPluginMgr(1);
21 | System.out.println("未完成");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/MMMojoCall/examples/python/mmmojo_call_usage.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import ctypes
4 | import sys
5 | import json
6 | import base64
7 |
8 | def PyOCRUsrReadOnPush(pic_path, data, data_size):
9 | print("[↓] OCRUsrReadOnPush:\n[")
10 |
11 | # 设置了Mode的use_json为True则data为json字符串
12 | if pic_path != None:
13 | chr_ptr = ctypes.cast(data, ctypes.c_char_p)
14 | json_string = chr_ptr.value.decode('utf-8')
15 | json_obj = json.loads(json_string)
16 |
17 | # 解析json
18 | print("\t[*] type:{} taskId:{} errCode:{}".format(json_obj['type'], json_obj['task_id'], json_obj['err_code']))
19 | print("\t[*] TaskId: {} -> PicPath: {}".format(json_obj['task_id'], pic_path.decode('utf-8')));
20 |
21 | print("\t[*] OcrResult:\n\t[")
22 | response_ocr_result = json_obj['ocr_result']
23 | for single_result in response_ocr_result['single_result']:
24 | print("\t\tRECT:[left: {}, top: {}, right: {}, bottom: {}]".format(single_result['left'], single_result['top'], single_result['right'], single_result['bottom']))
25 | b64str = single_result['single_str_utf8']
26 | single_str = base64.b64decode(b64str).decode('utf-8')
27 | print("\t\tUTF8STR:[{} | Rate: {}]".format(single_str, single_result['single_rate']))
28 | print("\t]", end="")
29 | print("\n]")
30 |
31 |
32 | def PyUtilityUsrReadOnPush(type_id, data, data_size):
33 | print("[↓] PyUtilityUsrReadOnPush [RequestID: {}] :\n[".format(type_id))
34 |
35 | UtilityTextScanPushResp = 10040
36 | # 设置了Mode的use_json为True则data为json字符串
37 | if type_id == UtilityTextScanPushResp:
38 | chr_ptr = ctypes.cast(data, ctypes.c_char_p)
39 | json_string = chr_ptr.value.decode('utf-8')
40 | json_obj = json.loads(json_string)
41 | print("\t[*] TextScanResult: ID: [{}] | PicPath: [{}] | HaveText?: [{}] | UKN0: [{}] | Rate: [{}]".format(\
42 | json_obj['text_scan_id'], json_obj['pic_path'], json_obj['have_text'], json_obj['unknown_0'], json_obj['rate']))
43 | print("\n]")
44 |
45 | def PyUtilityUsrReadOnPull(type_id, data, data_size):
46 | print("[↓] PyUtilityUsrReadOnPush [RequestID: {}] :\n[".format(type_id))
47 |
48 | UtilityInitPullResp = 10003
49 | UtilityQRScanPullResp = 10032
50 | if type_id == UtilityInitPullResp:
51 | print("\t[*] UtilityInitPullResp", end="")
52 | elif type_id == UtilityQRScanPullResp:
53 | chr_ptr = ctypes.cast(data, ctypes.c_char_p)
54 | json_string = chr_ptr.value.decode('utf-8')
55 | json_obj = json.loads(json_string)
56 |
57 | print("\t[*] QRScanResult UKN0: [{}] :\n\t[".format(json_obj['unknown_0']))
58 | for qrscan_result in json_obj['qr_result']:
59 | b64result = qrscan_result['result']
60 | result = base64.b64decode(b64result).decode('utf-8')
61 | unknown_0 = qrscan_result['unknow_0']
62 | unknown_1 = qrscan_result['unknown_1']
63 | unknown_2 = qrscan_result['unknown_2']
64 | unknown_3 = qrscan_result['unknown_3']
65 | print("\t\tResult: [{}] | UKN0: [{}] | UKN1: [{}] | UKN2: [{}] | UNK3: [{}]".format(result, unknown_0, unknown_1, unknown_2, unknown_3))
66 | print("\t]", end="")
67 |
68 | print("\n]")
69 |
70 | # 调用XPluginManager::GetLastErrStr
71 | def call_mmmojocall_getlasterrstr(cobj_mgr):
72 | call_ret = ctypes.c_ulonglong()
73 | method_get_last_err_str = ctypes.c_char_p("GetLastErrStr".encode('utf-8'))
74 | mmmojocall_call_func(cobj_mgr, 0, method_get_last_err_str, ctypes.byref(call_ret))
75 | chr_ptr = ctypes.cast(call_ret.value, ctypes.c_char_p)
76 | err_string = chr_ptr.value.decode('utf-8')
77 | return err_string
78 |
79 | if __name__ == '__main__':
80 | mmmojocall_dll = ctypes.cdll.LoadLibrary('./MMMojoCall.dll')
81 | print('[+] LoadLibrary MMMojoCall.dll OK!')
82 |
83 | #-------------------------
84 | #以下为DLL导出函数初始化操作
85 | mmmojocall_get_instance = mmmojocall_dll.GetInstanceXPluginMgr
86 | mmmojocall_get_instance.argtypes = [ctypes.c_int]
87 | mmmojocall_get_instance.restype = ctypes.c_void_p
88 |
89 | mmmojocall_call_func = mmmojocall_dll.CallFuncXPluginMgr
90 | mmmojocall_call_func.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_void_p]
91 | mmmojocall_call_func.restype = ctypes.c_int
92 |
93 | mmmojocall_release_instance = mmmojocall_dll.ReleaseInstanceXPluginMgr
94 | mmmojocall_release_instance.argtypes = [ctypes.c_void_p]
95 | mmmojocall_release_instance.restype = None
96 |
97 | mmmojocall_init_dll_funcs = mmmojocall_dll.InitMMMojoDLLFuncs
98 | mmmojocall_init_dll_funcs.argtypes = [ctypes.c_char_p]
99 | mmmojocall_init_dll_funcs.restype = ctypes.c_bool
100 |
101 | mmmojocall_init_mmmojo_global_func = mmmojocall_dll.InitMMMojoGlobal
102 | mmmojocall_init_mmmojo_global_func.argtypes = [ctypes.c_int, ctypes.c_char_p]
103 | mmmojocall_init_mmmojo_global_func.restype = ctypes.c_bool
104 |
105 | mmmojocall_shutdown_mmmojo_global_func = mmmojocall_dll.ShutdownMMMojoGlobal
106 | mmmojocall_shutdown_mmmojo_global_func.restype = ctypes.c_bool
107 |
108 | print('[+] Init Dll Export Funcs Over!')
109 |
110 | #----------------------------
111 | #以下为读入WeChat组件路径
112 | wechat_ocr_dir = input('\033[34m[=] Enter WeChatOCR.exe Path:\n[>]\033[0m ')
113 | if not wechat_ocr_dir:
114 | print('[!] WeChatOCR.exe Path can\'t be EMPTY!')
115 | sys.exit(1)
116 | wechat_ocr_dir_c = ctypes.c_char_p(wechat_ocr_dir.encode('utf-8'))
117 |
118 | wechat_dir = input('\033[34m[=] Enter mmmojo(_64).dll Path:\n[>]\033[0m ')
119 | if not wechat_ocr_dir:
120 | print('[!] mmmojo(_64).dll Path can\'t be EMPTY!')
121 | sys.exit(1)
122 | wechat_dir_c = ctypes.c_char_p(wechat_dir.encode('utf-8'))
123 |
124 | wechat_utility_dir = input('\033[34m[=] Enter WeChatUtility.exe Path:\n[>]\033[0m ')
125 | if not wechat_ocr_dir:
126 | print('[!] WeChatUtility.exe Path can\'t be EMPTY!')
127 | sys.exit(1)
128 | wechat_utility_dir_c = ctypes.c_char_p(wechat_utility_dir.encode('utf-8'))
129 |
130 | #-----------------------------
131 | #以下为定义回调函数
132 | CFUNC_PYOCRUSRREADONPUSH = ctypes.CFUNCTYPE(None, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_int)
133 | py_ocr_usr_read_on_push = CFUNC_PYOCRUSRREADONPUSH(PyOCRUsrReadOnPush)
134 |
135 | CFUNC_PYUTILITYUSRREADONPUSH = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.c_void_p, ctypes.c_int)
136 | py_utility_usr_read_on_push = CFUNC_PYUTILITYUSRREADONPUSH(PyUtilityUsrReadOnPush)
137 |
138 | CFUNC_PYUTILITYUSRREADONPULL = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.c_void_p, ctypes.c_int)
139 | py_utility_usr_read_on_pull = CFUNC_PYUTILITYUSRREADONPULL(PyUtilityUsrReadOnPull)
140 | print('\033[31m[+] Def Python Callback Funcs Over!\033[0m')
141 |
142 | '''
143 | 加载mmmojo(_64).dll并获取导出函数, 只需要调用一次.
144 | '''
145 | if not mmmojocall_init_dll_funcs(wechat_dir_c):
146 | print('\033[31m[!] mmmojocall::InitMMMojoDLLFuncs ERR!\033[0m')
147 | sys.exit(1)
148 | print('\033[31m[+] InitMMMojoDLLFuncs Over!\033[0m')
149 |
150 | # 初始化MMMojo (包括ThreadPool等), 只需要调用一次.
151 | mmmojocall_init_mmmojo_global_func(0, None);
152 |
153 | #------------------------
154 | #以下为使用封装好的OCRManager类调用WeChatOCR进行OCR的示例 与 UtilityManager类调用WeChatUtility扫描二维码的示例
155 | call_ret = ctypes.c_ulonglong()
156 |
157 | mgr_type_ocr = 1
158 | cobj_ocr_mgr = mmmojocall_get_instance(mgr_type_ocr)
159 |
160 | method_name = ctypes.c_char_p("SetExePath".encode('utf-8'))
161 | mmmojocall_call_func(cobj_ocr_mgr, mgr_type_ocr, method_name, ctypes.byref(call_ret), wechat_ocr_dir_c)
162 | if not call_ret.value:
163 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_ocr_mgr)))
164 | sys.exit(1)
165 |
166 | method_name = ctypes.c_char_p("SetUsrLibDir".encode('utf-8'))
167 | mmmojocall_call_func(cobj_ocr_mgr, mgr_type_ocr, method_name, ctypes.byref(call_ret), wechat_dir_c)
168 | if not call_ret:
169 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_ocr_mgr)))
170 | sys.exit(1)
171 |
172 | method_name = ctypes.c_char_p("SetCallbackDataMode".encode('utf-8'))
173 | mmmojocall_call_func(cobj_ocr_mgr, mgr_type_ocr, method_name, ctypes.byref(call_ret), True)
174 |
175 | method_name = ctypes.c_char_p("SetReadOnPush".encode('utf-8'))
176 | mmmojocall_call_func(cobj_ocr_mgr, mgr_type_ocr, method_name, ctypes.byref(call_ret), py_ocr_usr_read_on_push)
177 |
178 | method_name = ctypes.c_char_p("StartWeChatOCR".encode('utf-8'))
179 | mmmojocall_call_func(cobj_ocr_mgr, mgr_type_ocr, method_name, ctypes.byref(call_ret))
180 | if not call_ret:
181 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_ocr_mgr)))
182 | sys.exit(1)
183 |
184 | print("\033[31m[+] StartWeChatOCR OK!\033[0m")
185 |
186 | input("[=] Press any key to send ocr request...\n")
187 | method_name = ctypes.c_char_p("DoOCRTask".encode('utf-8'))
188 | pic_path_c = ctypes.c_char_p(".\\test.png".encode('utf-8'))
189 | mmmojocall_call_func(cobj_ocr_mgr, mgr_type_ocr, method_name, ctypes.byref(call_ret), pic_path_c)
190 | if not call_ret:
191 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_ocr_mgr)))
192 | sys.exit(1)
193 |
194 | input("[=] Press any key to stop WeChatOCR Env...\n")
195 | method_name = ctypes.c_char_p("KillWeChatOCR".encode('utf-8'))
196 | mmmojocall_call_func(cobj_ocr_mgr, mgr_type_ocr, method_name, None)
197 | print("\033[31m[-] KillWeChatOCR!\033[0m")
198 |
199 | mmmojocall_release_instance(cobj_ocr_mgr)
200 |
201 | #QRScan
202 | mgr_type_utility = 2
203 | cobj_utility_mgr = mmmojocall_get_instance(mgr_type_utility)
204 |
205 | method_name = ctypes.c_char_p("SetExePath".encode('utf-8'))
206 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, ctypes.byref(call_ret), wechat_utility_dir_c)
207 | if not call_ret.value:
208 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_utility_mgr)))
209 | sys.exit(1)
210 |
211 | method_name = ctypes.c_char_p("SetUsrLibDir".encode('utf-8'))
212 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, ctypes.byref(call_ret), wechat_dir_c)
213 | if not call_ret:
214 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_utility_mgr)))
215 | sys.exit(1)
216 |
217 | method_name = ctypes.c_char_p("SetCallbackDataMode".encode('utf-8'))
218 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, ctypes.byref(call_ret), True)
219 |
220 | method_name = ctypes.c_char_p("SetReadOnPull".encode('utf-8'))
221 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, ctypes.byref(call_ret), py_utility_usr_read_on_pull)
222 |
223 | method_name = ctypes.c_char_p("SetReadOnPush".encode('utf-8'))
224 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, ctypes.byref(call_ret), py_utility_usr_read_on_push)
225 |
226 | method_name = ctypes.c_char_p("StartWeChatUtility".encode('utf-8'))
227 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, ctypes.byref(call_ret))
228 | if not call_ret:
229 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_utility_mgr)))
230 | sys.exit(1)
231 |
232 | print("\033[31m[+] StartWeChatUtility OK!\033[0m")
233 |
234 | input("[=] Press any key to send OCRScan request...\n")
235 | method_name = ctypes.c_char_p("DoPicQRScan".encode('utf-8'))
236 | pic_path_c = ctypes.c_char_p(".\\test.png".encode('utf-8'))
237 | text_scan_id = 1
238 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, ctypes.byref(call_ret), pic_path_c, text_scan_id)
239 | if not call_ret:
240 | print('\033[31m[!] {}\033[0m'.format(call_mmmojocall_getlasterrstr(cobj_utility_mgr)))
241 | sys.exit(1)
242 |
243 | input("[=] Press any key to stop WeChatUtility Env...\n")
244 | method_name = ctypes.c_char_p("KillWeChatUtility".encode('utf-8'))
245 | mmmojocall_call_func(cobj_utility_mgr, mgr_type_utility, method_name, None)
246 | print("\033[31m[-] KillWeChatUtility!\033[0m")
247 |
248 | mmmojocall_release_instance(cobj_utility_mgr)
249 |
250 | mmmojocall_shutdown_mmmojo_global_func()
251 |
252 |
253 |
--------------------------------------------------------------------------------
/MMMojoCall/proto/ocr_protobuf.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package ocr_protobuf;
4 |
5 | message OcrResponse {
6 | int32 type = 1; //第一次运行OCR会有push一次type1, 正常OCR结束type0
7 | int32 task_id = 2;
8 | int32 err_code = 3;
9 |
10 | message OcrResult {
11 | message ResultPos { //四个角的坐标 左上 右上 右下 左下
12 | message PosXY {
13 | float x = 1;
14 | float y = 2;
15 | }
16 |
17 | repeated PosXY pos = 1;
18 | }
19 |
20 | message SingleResult { //SingleResult是一行结果 OneResult是单字的
21 | ResultPos single_pos = 1;
22 | bytes single_str_utf8 = 2; //UTF8格式的字符串
23 | float single_rate = 3; //单行的识别率
24 |
25 | message OneResult {
26 | ResultPos one_pos = 1;
27 | bytes one_str_utf8 = 2;
28 | }
29 |
30 | repeated OneResult one_result = 4;
31 | float left = 5; //识别矩形的left\top\right\bottom的坐标
32 | float top = 6;
33 | float right = 7;
34 | float bottom = 8;
35 | int32 unknown_0 = 9; //未知
36 | ResultPos unknown_pos = 10; //未知
37 | }
38 |
39 | repeated SingleResult single_result = 1; //repeated 每行的结果
40 | int32 unknown_1 = 2;
41 | int32 unknown_2 = 3;
42 | }
43 |
44 | OcrResult ocr_result = 4;
45 | }
46 |
47 |
48 | message OcrRequest {
49 | int32 unknow = 1; //必定为0
50 | int32 task_id = 2;
51 |
52 | message PicPaths {
53 | repeated string pic_path = 1; //不一定是repeadted 猜的
54 | }
55 |
56 | PicPaths pic_path = 3;
57 | }
--------------------------------------------------------------------------------
/MMMojoCall/proto/player_protobuf.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package player_protobuf;
4 |
5 | //WeChatWin: 10011(发) -> 10012(收) -> 10010(发) -> 10030(收) -> 10028(发) -> 10028(发) -> 10030(收) -> 10030(收) -> 10032(收) -> 10030(收) -> 10032(收) -> 10030(收) -> 10014(收) ->
6 | //WeChatPlayer: 1011(收) -> 10012(发) -> 10010(收) -> 10030(发) -> 10028(收) -> 10028(收) -> 10030(发) -> 10030(发) -> 10032(发) -> 10030(发) -> 10030(发) -> 10030(发) -> 10014(发) ->
7 | //所有int32都有可能是以下类型: int32,int64,uint32,uint64,sint32,sint64,bool,enum
8 |
9 | message InitReqMessage {
10 | int32 expire_timestamp = 1; //可能是过期时间
11 | int32 type = 2; //为1
12 | }
13 |
14 | message InitRespMessage {
15 | int32 status = 1; //为1
16 | }
17 |
18 | message CreatePlayerCoreReqMessage {
19 | int32 player_id = 1;
20 | int32 is_post_frame = 2; //为1
21 | }
22 |
23 | message CreatePlayerCoreRespMessage {
24 | int32 player_id = 1; //可能是 应该是返回1
25 | int32 is_suceess = 2; //可能是 应该是返回1
26 | }
27 |
28 | message InitPlayerCoreMessage {
29 | int32 player_id = 1; //Player ID
30 | string file_name = 2; //文件名 (不包括最后一个字母 不包括扩展名)
31 | string file_path = 3; //要播放的视频路径
32 | int64 file_size = 4; //网络视频的大小 本地时为0
33 | bool is_local = 5; //视频是来自本地还是网络 为1
34 | int32 placeholder_6 = 6; //为0
35 | int64 media_id = 7; //为1
36 | bool is_audio_mute = 8; //是否设置静音 为0
37 | int64 video_surface = 9; //窗口句柄
38 | float audio_volume = 10; //音量 为1.0
39 | int32 is_repeat = 11; //是否设置重复播放 为1
40 | float speed_ratio = 12; //播放速率 为1.0
41 | int32 max_frame_width = 13; //为0
42 | int32 max_frame_height = 14; //为0
43 | int32 codec_type = 15; //为-1
44 | int64 decoder_type = 16; //为-1
45 | }
46 |
47 | message InfoPlayerCoreMessage {
48 | int32 player_id = 1; //.
49 | string type = 2; //例如"video decoder type" "the first shard opened" "Unknow Player Msg" "read the first data packets" "read the key frame packet"... "whether to use p2p"
50 | int32 arg = 3; //未知 106 0 0 0 0... 1
51 | int32 unknown_2 = 4; //1或0 1 0 0 0 0... 0
52 | }
53 |
54 | //10014 10015 10016 10017 10018
55 | message PlayerIdMessage {
56 | int32 player_id = 1;
57 | }
58 |
59 | message CurrentPositionMsMessage {
60 | int32 unknown = 1; //为0
61 | }
62 |
63 | message CurrentPositionMsInfo {
64 | message MsInfo{
65 | int32 player_id = 1;
66 | int32 pos = 2;
67 | }
68 |
69 | repeated bytes ms_info = 1; //这里面是MsInfo序列化
70 | }
71 |
72 | message ResizePlayerCoreMessage {
73 | int32 player_id = 1;
74 | int32 new_width = 2;
75 | int32 new_height = 3;
76 | }
77 |
78 | message VideoSizeChangedPlayerCoreMessage {
79 | int32 player_id = 1;
80 | int32 org_width = 2; //可能是
81 | int32 org_height = 3; //可能是
82 | }
83 |
84 | message PreparePlayerCoreMessage {
85 | int32 player_id = 1;
86 | int32 duration = 2; //视频时长 时分秒
87 | }
88 |
89 | message StatePlayerCoreMessage {
90 | int32 player_id = 1;
91 | int32 state = 2; //4: 开始播放 8: 停止播放
92 | }
93 |
94 | //以下都可能是 没有验证
95 |
96 | message AudioMutePlayerCoreMessage {
97 | int32 player_id = 1;
98 | bool is_audio_mute = 2;
99 | }
100 |
101 | message SeekToPlayerCoreMessage {
102 | int32 player_id = 1;
103 | int32 pos_ms = 2;
104 | }
105 |
106 | message VideoSurfaceMessage {
107 | int32 player_id = 1;
108 | int32 window = 2; //窗口句柄
109 | }
110 |
111 | message AudioVolumePlayerCoreMessage {
112 | int32 player_id = 1;
113 | float audio_volume = 2;
114 | }
115 |
116 | message RepeatPlayerCoreMessage {
117 | int32 player_id = 1;
118 | int32 is_repeat = 2;
119 | }
120 |
121 | message SpeedRatioPlayerCoreMessage {
122 | int32 player_id = 1;
123 | float speed_ratio = 2;
124 | }
125 |
126 | message ReadyDataSourceCoreMessage {
127 | int32 player_id = 1;
128 | string file_name = 2;
129 | string file_path = 3;
130 | int64 media_id = 4;
131 | }
132 |
133 | message DownloadDataSourceCoreMessage {
134 | int32 player_id = 1;
135 | string file_name = 2;
136 | string file_path = 3;
137 | int64 file_size = 4;
138 | int64 media_id = 5;
139 | }
140 |
141 | message ErrorPlayerCoreMessage {
142 | int32 player_id = 1;
143 | string error = 2;
144 | int32 error_type = 3;
145 | int32 error_code = 4;
146 | }
147 |
148 | message StartTaskProxyMessage {
149 | int32 task_id = 1;
150 | int32 player_id = 2;
151 | }
152 |
153 | message StartRequestProxyMessage {
154 | int32 task_id = 1;
155 | int32 player_id = 2;
156 | int32 request_start = 3;
157 | int32 request_end = 4;
158 | }
159 |
160 | message CloseRequestProxyMessage {
161 | int32 task_id = 1;
162 | int32 player_id = 2;
163 | }
164 |
165 | message PollingDataProxyReqMessage {
166 | int32 task_id = 1;
167 | int32 player_id = 2;
168 | int32 offset = 3;
169 | int32 ready_size = 4;
170 | int32 download_size = 5;
171 | int32 read_size=6;
172 | }
173 |
174 | message PollingDataProxyRespMessage {
175 |
176 | }
--------------------------------------------------------------------------------
/MMMojoCall/proto/utility_protobuf.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package utility_protobuf;
4 |
5 | //所有int32都有可能是以下类型: int32,int64,uint32,uint64,sint32,sint64,bool,enum
6 |
7 | message InitReqMessage {
8 | int32 expire_timestamp = 1; //猜的
9 | int32 type = 2; //为1
10 | }
11 |
12 | message InitRespMessage {
13 | int32 status = 1; //是否初始化成功 WeChatWin.dll并没有处理这个消息
14 | }
15 |
16 | message ResampleImageReqMessage{
17 | string decode_pic = 1; //解码图片的路径
18 | string encode_pic = 2; //原始加密图片的路径
19 | int32 re_pic_x = 3; //图片长
20 | int32 re_pic_y = 4; //图片宽
21 | int32 unknown_0 = 5; //未知 一般为1
22 | }
23 |
24 | message ResampleImageRespMessage {
25 | int32 err_code = 1; //可能是 一般为0 错误为8
26 | }
27 |
28 | message TextScanMessage {
29 | int32 text_scan_id = 1; //可能是
30 | string pic_path = 2; //扫描的图片路径
31 | int32 have_text = 3; //是否有文字
32 | int32 unknown_0 = 4; //未知
33 | float rate = 5; //应该是浮点数 图上要是没文字这个字段肯定为0.0
34 | }
35 |
36 | //当使用图片时发送的是1 2(可为空) 3 7 8 9项
37 | //当在截图中框选时发送的是 4 5 6 7 8 9项
38 | message QRScanReqMessage {
39 | string origin_pic = 1; //原始图片路径 可选
40 | string decode_pic = 2; //解码后的图片路径 可选
41 | int32 unknown_0 = 3; //未知 可选 一般为0
42 | bytes encode_pic_data = 4; //某种编码后的图片数据 可选
43 | int32 encode_pic_x = 5; //编码图片长 可选
44 | int32 encode_pic_y = 6; //编码图片宽 可选
45 | int32 unknown_1 = 7; //未知 一般为1
46 | int32 text_scan_id = 8; //可能是
47 | int32 unknown_3 = 9; //未知 一般为1
48 | }
49 |
50 | message QRScanRespMessage {
51 | message QRScanResult{
52 | bytes result = 1; //二维码识别结果
53 | int32 unknow_0 = 2; //未知 一般为19
54 | double unknown_1 = 3; //未知 可能是浮点数
55 | double unknown_2 = 4; //未知 可能是浮点数
56 | int32 unknown_3 = 5; //未知 一般为1
57 | }
58 |
59 | repeated QRScanResult qr_result = 1;
60 | int32 unknown_0 = 2; //未知 一般为1
61 | }
--------------------------------------------------------------------------------
/MMMojoCall/src/dllmain.cpp:
--------------------------------------------------------------------------------
1 | #ifdef USE_WRAPPER
2 | #include "google/protobuf/stubs/common.h"
3 | #endif
4 |
5 | #include
6 |
7 | BOOL APIENTRY DllMain( HMODULE hModule,
8 | DWORD ul_reason_for_call,
9 | LPVOID lpReserved
10 | )
11 | {
12 | switch (ul_reason_for_call)
13 | {
14 | case DLL_PROCESS_ATTACH:
15 | break;
16 | case DLL_THREAD_ATTACH:
17 | break;
18 | case DLL_THREAD_DETACH:
19 | break;
20 | case DLL_PROCESS_DETACH:
21 | #ifdef USE_WRAPPER
22 | google::protobuf::ShutdownProtobufLibrary();
23 | #endif
24 | break;
25 | }
26 | return TRUE;
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/MMMojoCall/src/include/mmmojo_call.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************//**
2 | * @file mmmojo_call.h
3 | * @brief 实现调用mmmojo(微信XPlugin组件)的方法 根据mmmojo源码再次重构
4 | *
5 | * @author 0xEEEE
6 | * @date 2023.10.27
7 | *********************************************************************/
8 | #pragma once
9 |
10 | #include