diff --git a/LICENSE b/LICENSE
index 65c5ca88a67c30becee01c5a8816d964b03862f9..20d40b6bceca3a6c0237d7455ebf1820aeff3680 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,165 +1,674 @@
- GNU LESSER GENERAL PUBLIC LICENSE
+ GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
\ No newline at end of file
diff --git a/README.en.md b/README.en.md
index 56347dda066ad4c7ff97ad133aed267e56dcffc5..dc1ce9e1082b46d8753b5aa0850562cf5e1da964 100644
--- a/README.en.md
+++ b/README.en.md
@@ -1,37 +1,83 @@
# XEngine_Authorize
-#### Description
-c c++网络验证服务器 网络授权服务器
-c c++network Authorize service
+## Introduction
+c c++网络验证服务器 网络授权服务器
+c c++network Authorize service
+the server is network authorize verification service code library,This service mainly provides network authorization verification function.support local and network verification mode
+This is a cross-platform simple high-performance network authorization server that provides a complete demo code
-#### Software Architecture
-Software architecture description
+## Software feature
+The purpose of development and implementation based on libXEngine is a cross-platform network storage service
+This repository has a development and master branch. If you want to use it, please use the master branch
+feature list:
+1. use standard private protocol to handle network communication
+2. Support Encrypto communication
+3. Support User Management
+4. Support Serial Management
+5. Support Log Management
+6. Support Configure Management
+7. Support Serical Multie types(Minute card, day card, frequency card, custom card)
+8. Support Try,Support quick verification
+9. Support Retrieve password through email
+10. Support Verification for Local CDKey
-#### Installation
+## install
-1. xxxx
-2. xxxx
-3. xxxx
+#### Requirements
+support system above windows 7sp1 and linux(ubuntu20.04,centos8)
+XEngine need V7.17 or above
-#### Instructions
+#### Windows
+Just Run it.,use XEngine_AuthorizeApp
-1. xxxx
-2. xxxx
-3. xxxx
-#### Contribution
+#### Linux
+Run it on the terminal,use XEngine_AuthorizeService
-1. Fork the repository
-2. Create Feat_xxx branch
-3. Commit your code
-4. Create Pull Request
+## complie
+#### Windows
+use vs2019 x86(debug or release) x64(only release) open and complie
+You need to configure the environment in the following way, otherwise you may need to set the library directory in the project yourself
-#### Gitee Feature
+##### XEngine
+XEngine can be download with mine repository,whe you downloaded xengine,you have to add value to you user environment
+- XEngine_Include header file path
+- XEngine_Library library file path
-1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4. The most valuable open source project [GVP](https://gitee.com/gvp)
-5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
+#### Linux
+Linux use Makefile complie
+UBUNTU20.04 x64 or CENTOS8 x64
+
+##### XEngine环境
+you can install xengine env to your system by shell
+like this:sudo XEngine_RunEnv.sh -i 3
+
+##### Screenshot of the program
+execute command in XEngine_Source path
+make complie
+make FLAGS=InstallAll Install File
+make FLAGS=CleanAll Clear Complie
+
+## Screenshot of the program
+
+
+
+
+
+## Participate in contribution
+
+1. Fork this code
+2. Create new Feat_xxx branch
+3. Submit the code
+4. New Pull Request
+
+## Authorization instructions
+Use this software must be open source and indicate the source,If you want closed source and commercial,Then need to be authorized by the author.
+
+## Follow us
+If you think this software is helpful to you, please give us a START
+
+## post issues
+
+if you have eny quest.post issues...
\ No newline at end of file
diff --git a/README.md b/README.md
index 59d48482a75aaebf089c7cfda33fabb4b0887b0b..89b7bbc846e4044ab99b6bb297c9bc3488c43576 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,81 @@
# XEngine_Authorize
-#### 介绍
-c c++网络验证服务器 网络授权服务器
-c c++network Authorize service
+## 介绍
+c c++网络验证服务器 网络授权服务器
+c c++network Authorize service
+这是网络授权验证服务器的代码库,这个服务主要提供网络授权验证功能.支持本地和网络两种验证模式
+这是一个跨平台简单高性能网络授权服务器,提供了完整的演示代码
-#### 软件架构
-软件架构说明
+## 软件特性
+基于libXEngine开发并实现的一套简洁高性能跨平台网络存储服务
+本仓库有开发和主分支,如果要使用,请使用master分支下的代码
+软件特性:
+1. 采用标准私有协议来处理网络通信
+2. 支持加密通信
+3. 支持用户管理
+4. 支持序列卡管理
+5. 支持日志管理
+6. 支持配置管理
+7. 序列卡多种类型支持(分钟卡,天数卡,次数卡,自定义卡)
+8. 支持试用,支持快速验证
+9. 支持通过邮件找回密码
+10. 支持本地CDKEY注册验证
+## 安装教程
-#### 安装教程
+#### 版本需求
+支持WINDOWS 7SP1和LINUX(UBUNT20.04,CENTOS8)以上系统
+XEngine版本需要V7.17或者以上版本
-1. xxxx
-2. xxxx
-3. xxxx
+#### Windows
+直接运行即可,使用XEngine_AuthorizeApp
-#### 使用说明
-1. xxxx
-2. xxxx
-3. xxxx
+#### Linux
+在控制台运行,使用XEngine_AuthorizeService
-#### 参与贡献
+## 编译
+
+#### Windows
+使用VS2019 x86(debug release)打开并且编译 你需要按照下面的方式配置环境,不然你可能需要自己在项目中设置库目录
+
+##### XEngine环境
+XEngine可以直接下载,下载完毕后添加用户环境变量,需要下面两个
+- XEngine_Include 头文件目录地址
+- XEngine_Library 库文件目录地址
+
+#### Linux
+Linux使用Makefile编译
+UBUNTU20.04 x64或者CENTOS8 x64均可
+
+##### XEngine环境
+XEngine可以通过脚本文件安装sudo XEngine_RunEnv.sh -i 3
+
+##### 编译命令
+在XEngine_Source目录下执行命令
+make 编译
+make FLAGS=InstallAll 安装库程序
+make FLAGS=CleanAll 清理编译
+
+## 程序截图
+
+
+
+
+
+## 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
-4. 新建 Pull Request
+4. 新建 Pull Request
+
+## 授权说明
+使用此软件必须开源并且注明出处,如果想闭源商用,那么需要经过作者授权.
+## 关注我们
+如果你觉得这个软件对你有帮助,请你给我们一个START吧
-#### 特技
+## 提交问题
-1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
-2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
-3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
-4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
-5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
-6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
+如果你有问题,可以在issues中提交
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPClient.sln b/XEngine_Apps/Authorize_APPClient.sln
new file mode 100644
index 0000000000000000000000000000000000000000..239f262804909b2466dfcd0be813ccd337be51c1
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPClient.sln
@@ -0,0 +1,41 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31410.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPClient", "Authorize_APPClient\Authorize_APPClient.vcxproj", "{4F263EAF-A748-46AF-A10E-8A25626E0571}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPLocal", "Authorize_APPLocal\Authorize_APPLocal.vcxproj", "{82D0E5EB-42B7-4A68-9896-20146F13E91E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Debug|x64.ActiveCfg = Debug|x64
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Debug|x64.Build.0 = Debug|x64
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Debug|x86.ActiveCfg = Debug|Win32
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Debug|x86.Build.0 = Debug|Win32
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x64.ActiveCfg = Release|x64
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x64.Build.0 = Release|x64
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.ActiveCfg = Release|Win32
+ {4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.Build.0 = Release|Win32
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x64.ActiveCfg = Debug|x64
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x64.Build.0 = Debug|x64
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x86.ActiveCfg = Debug|Win32
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x86.Build.0 = Debug|Win32
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x64.ActiveCfg = Release|x64
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x64.Build.0 = Release|x64
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x86.ActiveCfg = Release|Win32
+ {82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {9829EC72-7C7A-4259-9ADE-8A879697B386}
+ EndGlobalSection
+EndGlobal
diff --git a/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2a873a32290b71e2c217fe7f4fbedbc5722e5b1d
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp
@@ -0,0 +1,448 @@
+#ifdef _WINDOWS
+#include
+#include
+#pragma comment(lib,"Ws2_32.lib")
+#pragma comment(lib,"x86//XEngine_Client/XClient_Socket.lib")
+#else
+#include
+#include
+#include
+#endif
+#include
+using namespace std;
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../../XEngine_Source/XAuth_Protocol.h"
+//g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_AuthorizeReg -lXEngine_BaseLib -lXClient_Socket -lXEngine_AuthRegClient -lpthread -Wl,-rpath=../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_AuthorizeReg,--disable-new-dtags
+
+BOOL bRun = TRUE;
+BOOL bRegiser = TRUE;
+BOOL bPay = TRUE;
+BOOL bLogin = TRUE;
+BOOL bPass = TRUE;
+BOOL bLeftTime = TRUE;
+BOOL bReadTxt = TRUE;
+BOOL bDelete = TRUE;
+BOOL bTry = TRUE;
+BOOL bTimeOut = TRUE;
+
+SOCKET m_Socket = 0;
+LPCTSTR lpszUser = _T("123123aa");
+LPCTSTR lpszPass = _T("123123");
+LPCTSTR lpszSerial = _T("XAUTH-XYRYM-ZAA10-59NKW-KOFLP-35838-ZXC36-ZOVTH");
+LPCTSTR lpszEmail = _T("486179@qq.com");
+__int64x nPhoneNumber = 1366666666;
+__int64x nIDNumber = 511025111111111111;
+
+XHTHREAD AuthClient_Thread()
+{
+ while (bRun)
+ {
+ int nMsgLen = 2048;
+ TCHAR tszMsgBuffer[2048];
+
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ if (XClient_TCPSelect_RecvMsg(m_Socket, tszMsgBuffer, &nMsgLen, TRUE))
+ {
+ XENGINE_PROTOCOLHDR st_ProtocolHdr;
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+ memcpy(&st_ProtocolHdr, tszMsgBuffer, sizeof(XENGINE_PROTOCOLHDR));
+
+ if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPDEL == st_ProtocolHdr.unOperatorCode)
+ {
+ bDelete = FALSE;
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ printf(_T("删除用户成功\n"));
+ }
+ else
+ {
+ printf(_T("删除用户失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPREGISTER == st_ProtocolHdr.unOperatorCode)
+ {
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ bRegiser = FALSE;
+ printf(_T("注册成功\n"));
+ }
+ else
+ {
+ printf(_T("注册失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPLOGIN == st_ProtocolHdr.unOperatorCode)
+ {
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ bLogin = FALSE;
+ printf(_T("登录成功\n"));
+ }
+ else
+ {
+ printf(_T("登录失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPPAY == st_ProtocolHdr.unOperatorCode)
+ {
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ bPay = FALSE;
+ printf(_T("充值成功\n"));
+ }
+ else
+ {
+ printf(_T("充值失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETPASS == st_ProtocolHdr.unOperatorCode)
+ {
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ XENGINE_PROTOCOL_USERAUTH st_AuthProtocol;
+ memset(&st_AuthProtocol, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
+ memcpy(&st_AuthProtocol, tszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), sizeof(XENGINE_PROTOCOL_USERAUTH));
+
+ bPass = FALSE;
+ printf(_T("找回密码成功,账号:%s,密码:%s\n"), st_AuthProtocol.tszUserName, st_AuthProtocol.tszUserPass);
+ }
+ else
+ {
+ printf(_T("找回密码失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETTIME == st_ProtocolHdr.unOperatorCode)
+ {
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ AUTHREG_PROTOCOL_TIME st_AuthTime;
+ memset(&st_AuthTime, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+ memcpy(&st_AuthTime, tszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), sizeof(AUTHREG_PROTOCOL_TIME));
+
+ bLeftTime = FALSE;
+ printf(_T("获取剩余时间成功,账号:%s,地址:%s,剩余时间:%lld 分钟,在线时间:%lld,过期日期:%s,类型:%d\n"), st_AuthTime.tszUserName, st_AuthTime.tszUserAddr, st_AuthTime.nTimeLeft, st_AuthTime.nTimeONLine, st_AuthTime.tszLeftTime, st_AuthTime.enSerialType);
+ }
+ else
+ {
+ printf(_T("获取时间失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_NOTIFYMSG == st_ProtocolHdr.unOperatorCode)
+ {
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ bReadTxt = FALSE;
+ TCHAR tszMsgInfo[2048];
+ memset(tszMsgInfo, '\0', sizeof(tszMsgInfo));
+ memcpy(tszMsgInfo, tszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), st_ProtocolHdr.unPacketSize);
+
+ printf(_T("读取到公告:%s\n"), tszMsgInfo);
+ }
+ else
+ {
+ printf(_T("获取数据失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPTRYVER == st_ProtocolHdr.unOperatorCode)
+ {
+ if (0 == st_ProtocolHdr.wReserve)
+ {
+ bTry = FALSE;
+ printf(_T("临时验证成功\n"));
+ }
+ else
+ {
+ printf(_T("临时验证失败,错误:%d\n"), st_ProtocolHdr.wReserve);
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_TIMEDOUT == st_ProtocolHdr.unOperatorCode)
+ {
+ bTimeOut = FALSE;
+ printf(_T("用户过期\n"));
+ }
+ else
+ {
+ printf(_T("不明白的类型\n"));
+ }
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
+ }
+ return 0;
+}
+
+BOOL AuthRegClient_Protocol_Send(LPCTSTR lpszMsgBuffer, TCHAR* ptszMsgBuffer, int* pInt_MsgLen, UINT en_AuthProtocol, BYTE byCrypto = 0)
+{
+ //填充协议
+ XENGINE_PROTOCOLHDR st_ProtocolHdr; //协议头
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+
+ st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
+ st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH;
+ st_ProtocolHdr.unOperatorCode = en_AuthProtocol;
+ st_ProtocolHdr.unPacketSize = *pInt_MsgLen;
+ st_ProtocolHdr.wCrypto = byCrypto;
+ st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
+
+ memcpy(ptszMsgBuffer, &st_ProtocolHdr, sizeof(XENGINE_PROTOCOLHDR));
+ if (*pInt_MsgLen > 0)
+ {
+ memcpy(ptszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), lpszMsgBuffer, st_ProtocolHdr.unPacketSize);
+ }
+ *pInt_MsgLen = sizeof(XENGINE_PROTOCOLHDR) + st_ProtocolHdr.unPacketSize;
+ return TRUE;
+}
+int AuthClient_Register()
+{
+ AUTHREG_USERTABLE st_UserTable;
+ TCHAR tszMsgBuffer[2048];
+
+ memset(&st_UserTable, '\0', sizeof(st_UserTable));
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ strcpy(st_UserTable.st_UserInfo.tszUserName, lpszUser);
+ strcpy(st_UserTable.st_UserInfo.tszUserPass, lpszPass);
+ strcpy(st_UserTable.st_UserInfo.tszEMailAddr, lpszEmail);
+ st_UserTable.st_UserInfo.nPhoneNumber = nPhoneNumber;
+ st_UserTable.st_UserInfo.nIDNumber = nIDNumber;
+ strcpy(st_UserTable.tszHardCode, "2FDWAD02JD2091");
+
+ int nMsgLen = sizeof(AUTHREG_USERTABLE);
+ AuthRegClient_Protocol_Send((LPCTSTR)&st_UserTable, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQREGISTER);
+ if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
+ {
+ printf(_T("注册协议发送失败!\n"));
+ return -1;
+ }
+ while (bRegiser)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+int AuthClient_Pay()
+{
+ AUTHREG_PROTOCOL_USERPAY st_SerialTable;
+ TCHAR tszMsgBuffer[2048];
+
+ memset(&st_SerialTable, '\0', sizeof(AUTHREG_PROTOCOL_USERPAY));
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ strcpy(st_SerialTable.tszSerialNumber, lpszSerial);
+ strcpy(st_SerialTable.tszUserName, lpszUser);
+
+ int nMsgLen = sizeof(AUTHREG_PROTOCOL_USERPAY);
+ AuthRegClient_Protocol_Send((LPCTSTR)&st_SerialTable, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQPAY);
+ if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
+ {
+ printf(_T("充值协议发送失败!\n"));
+ return -1;
+ }
+ while (bPay)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+int AuthClient_Login()
+{
+ XENGINE_PROTOCOL_USERAUTH st_AuthUser;
+ TCHAR tszMsgBuffer[2048];
+
+ memset(&st_AuthUser, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ strcpy(st_AuthUser.tszUserName, lpszUser);
+ strcpy(st_AuthUser.tszUserPass, lpszPass);
+
+ int nMsgLen = sizeof(XENGINE_PROTOCOL_USERAUTH);
+
+ /*使用加密发送
+ CHAR tszEnBuffer[2048];
+ memset(tszEnBuffer, '\0', sizeof(tszEnBuffer));
+
+ OPenSsl_XCrypto_Encoder((LPCTSTR)&st_AuthUser, &nMsgLen, (UCHAR*)tszMsgBuffer, "123123");
+ AuthRegClient_Protocol_Send(tszMsgBuffer, tszEnBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGIN, 4);
+ */
+ AuthRegClient_Protocol_Send((LPCTSTR)&st_AuthUser, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGIN);
+ if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
+ {
+ printf(_T("登录协议发送失败!\n"));
+ return -1;
+ }
+ while (bLogin)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+int AuthClient_GetPass()
+{
+ XENGINE_PROTOCOL_USERINFO st_UserTable;
+ TCHAR tszMsgBuffer[2048];
+
+ memset(&st_UserTable, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ strcpy(st_UserTable.tszUserName, lpszUser);
+ strcpy(st_UserTable.tszEMailAddr, lpszEmail);
+ st_UserTable.nIDNumber = nIDNumber;
+
+ int nMsgLen = sizeof(XENGINE_PROTOCOL_USERINFO);
+ AuthRegClient_Protocol_Send((LPCTSTR)&st_UserTable, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETPASS);
+ if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
+ {
+ printf(_T("找回密码协议发送失败!\n"));
+ return -1;
+ }
+ while (bPass)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+int AuthClient_GetTime()
+{
+ AUTHREG_PROTOCOL_TIME st_AuthTime;
+ TCHAR tszMsgBuffer[2048];
+
+ memset(&st_AuthTime, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ strcpy(st_AuthTime.tszUserName, lpszUser);
+ int nMsgLen = sizeof(AUTHREG_PROTOCOL_TIME);
+ AuthRegClient_Protocol_Send((LPCTSTR)&st_AuthTime, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETTIME);
+ if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
+ {
+ printf(_T("获取剩余时间协议发送失败!\n"));
+ return -1;
+ }
+ while (bLeftTime)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+int AuthClient_Delete()
+{
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+ TCHAR tszMsgBuffer[2048];
+
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ strcpy(st_UserInfo.tszUserName, lpszUser);
+ strcpy(st_UserInfo.tszUserPass, lpszPass);
+ strcpy(st_UserInfo.tszEMailAddr, lpszEmail);
+ st_UserInfo.nIDNumber = nIDNumber;
+
+ int nMsgLen = sizeof(XENGINE_PROTOCOL_USERINFO);
+ AuthRegClient_Protocol_Send((LPCTSTR)&st_UserInfo, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQDEL);
+ if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
+ {
+ printf(_T("注销协议发送失败!\n"));
+ return -1;
+ }
+ while (bDelete)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+
+int AuthClient_ReadTxt()
+{
+ while (bReadTxt)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+
+int AuthClient_Timeout()
+{
+ while (bTimeOut)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+
+int AuthClient_Try()
+{
+ TCHAR tszMsgBuffer[2048];
+ LPCTSTR lpszSerialNet = _T("cpuid:112233"); //通过此可以做临时网络验证,安全性比本地临时验证高
+
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+ int nMsgLen = strlen(lpszSerialNet);
+
+ AuthRegClient_Protocol_Send(lpszSerialNet, tszMsgBuffer, &nMsgLen, XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQTRYVER);
+ if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
+ {
+ printf(_T("登录协议发送失败!\n"));
+ return -1;
+ }
+ while (bTry)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ }
+ return 0;
+}
+
+int main()
+{
+#ifdef _WINDOWS
+ WSADATA st_WSAData;
+ WSAStartup(MAKEWORD(2, 2), &st_WSAData);
+#endif
+ int nPort = 5000;
+ LPCTSTR lpszAddr = _T("127.0.0.1");
+
+ if (!XClient_TCPSelect_Create(&m_Socket, lpszAddr, nPort))
+ {
+ printf("XClient_TCPSelect_Create:%lX", XClient_GetLastError());
+ return -1;
+ }
+ std::thread pSTDThread(AuthClient_Thread);
+
+ printf("AuthClient_Register\n");
+ AuthClient_Register();
+
+ printf("AuthClient_Pay\n");
+ AuthClient_Pay();
+
+ printf("AuthClient_Login\n");
+ AuthClient_Login();
+
+ printf("AuthClient_GetPass\n");
+ AuthClient_GetPass();
+
+ printf("AuthClient_GetTime\n");
+ AuthClient_GetTime();
+
+ printf("AuthClient_ReadTxt\n");
+ AuthClient_ReadTxt();
+
+ printf("AuthClient_Timeout\n");
+ AuthClient_Timeout();
+
+ printf("AuthClient_Delete\n");
+ AuthClient_Delete();
+
+ printf("AuthClient_Try\n");
+ AuthClient_Try();
+
+ bRun = FALSE;
+ XClient_TCPSelect_Close(m_Socket);
+ pSTDThread.join();
+
+#ifdef _WINDOWS
+ WSACleanup();
+#endif
+ return 0;
+}
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..458d7a821b22dda557a03443773ecccc6ad92400
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj
@@ -0,0 +1,149 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {4f263eaf-a748-46af-a10e-8a25626e0571}
+ AuthorizeAPPClient
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ MultiByte
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj.filters b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..f955b711b63566bb9560da489b906b588216daae
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj.filters
@@ -0,0 +1,22 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ 源文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj.user b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.cpp b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e9d03cfc30f9bcbd4cf5eba4289d5b76b1ea1f0c
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.cpp
@@ -0,0 +1,80 @@
+#ifdef _WINDOWS
+#include
+#include
+#pragma comment(lib,"x86/XEngine_Core/XEngine_OPenSsl")
+#pragma comment(lib,"x86/XEngine_SystemSdk/XEngine_SystemApi")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Authorize")
+#else
+#include
+#include
+#include
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../../XEngine_Source/XAuth_Protocol.h"
+
+#ifdef _WINDOWS
+LPCTSTR lpszFile = _T("D:\\XEngine_Authorize\\XEngine_Apps\\Debug\\XEngine_Authorize.key");
+#else
+LPCTSTR lpszFile = _T("XEngine_Authorize.key");
+#endif
+
+//#define _ENCRYPTO
+
+int main()
+{
+ //////////////////////////////////////////////////////////////////////////生成CDKEY
+ __int64x nLeftTime = 0;
+ UCHAR tszEnBuffer[2048];
+ TCHAR tszDeBuffer[2048];
+ XENGINE_AUTHORIZE_LOCAL st_AuthLocal;
+ SYSTEMAPI_SERIAL_INFOMATION st_SDKSerial;
+
+ memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
+ memset(tszEnBuffer, '\0', sizeof(tszEnBuffer));
+ memset(&st_AuthLocal, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));
+ memset(&st_SDKSerial, '\0', sizeof(SYSTEMAPI_SERIAL_INFOMATION));
+
+ strcpy(st_AuthLocal.tszAddr, _T("127.0.0.1"));
+ st_AuthLocal.nPort = 5000;
+
+ strcpy(st_AuthLocal.st_AuthAppInfo.tszAppName, "XEngine");
+ strcpy(st_AuthLocal.st_AuthAppInfo.tszAppVer, "7.17.0.1001");
+
+ st_AuthLocal.st_AuthRegInfo.enSerialType = ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME;
+ st_AuthLocal.st_AuthRegInfo.enRegType = ENUM_HELPCOMPONENTS_AUTHORIZE_REG_TYPE_TRY;
+ st_AuthLocal.st_AuthRegInfo.enHWType = ENUM_HELPCOMPONENTS_AUTHORIZE_HW_TYPE_CPU;
+ SystemApi_HardWare_GetSerial(&st_SDKSerial);
+ strcpy(st_AuthLocal.st_AuthRegInfo.tszHardware, st_SDKSerial.tszCpuSerial);
+
+ strcpy(st_AuthLocal.st_AuthUserInfo.tszUserName, "XEngine");
+ strcpy(st_AuthLocal.st_AuthUserInfo.tszUserContact, "486179@qq.com");
+ //生成完毕后可以交给服务端来对key本地验证进行授权
+ if (!Authorize_Local_WriteKey(lpszFile, &st_AuthLocal))
+ {
+ return -1;
+ }
+ //需要加密?
+#ifdef _ENCRYPTO
+ FILE* pSt_File = fopen(lpszFile, "rb");
+ int nRet = fread(tszDeBuffer, 1, sizeof(tszDeBuffer), pSt_File);
+ fclose(pSt_File);
+ if (!OPenSsl_Api_CryptEncodec(tszDeBuffer, tszEnBuffer, &nRet, "123123", XENGINE_OPENSSL_API_CRYPT_3DES))
+ {
+ return -1;
+ }
+ pSt_File = fopen(lpszFile, "wb");
+ fwrite(tszEnBuffer, 1, nRet, pSt_File);
+ fclose(pSt_File);
+#endif
+
+ return 0;
+}
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..165aea036fb8c15a73cbf8e13b5f2997d925125f
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj
@@ -0,0 +1,149 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {82d0e5eb-42b7-4a68-9896-20146f13e91e}
+ AuthorizeAPPLocal
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ MultiByte
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.filters b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..8ab0c7ad3776e31dbd0e7875e21e4c10d31c51fe
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.filters
@@ -0,0 +1,22 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ 源文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.user b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822
--- /dev/null
+++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx
new file mode 100644
index 0000000000000000000000000000000000000000..ced653934405cf9a55b8546b34eb8510b06514e1
Binary files /dev/null and b/XEngine_Docment/Docment_en.docx differ
diff --git a/XEngine_Docment/Docment_zh.docx b/XEngine_Docment/Docment_zh.docx
new file mode 100644
index 0000000000000000000000000000000000000000..81a9f62d7ef3f95f019e44e3d8b6c422e32126a1
Binary files /dev/null and b/XEngine_Docment/Docment_zh.docx differ
diff --git a/XEngine_Release/XEngine_Config/XEngine_Config.ini b/XEngine_Release/XEngine_Config/XEngine_Config.ini
new file mode 100644
index 0000000000000000000000000000000000000000..b4a056007e9285e3a7e3c0b4e30638ca9137c79c
--- /dev/null
+++ b/XEngine_Release/XEngine_Config/XEngine_Config.ini
@@ -0,0 +1,25 @@
+[ServiceConfig]
+ListenPort=5500
+ThreadPool=2
+UserVerTimed=30
+AutoStart=0
+[XSql]
+tszSQLite=./XEngine_Database/SQL_User.db
+[Verification]
+VerTime=5
+VerMode=1
+TryTime=5
+TryMode=1
+[Crypto]
+Enable=0
+Pass=123123
+[SmtpConfig]
+SmtpService=smtp.qq.com
+SmtpFromAddr=486179@qq.com
+SmtpUser=123123aa
+SmtpPass=123123
+[XLog]
+nMaxSize=1024000
+nMaxCount=10
+nLogLeave=32
+tszLogFile=./XEngine_XLog/XEngine_Authorize.log
\ No newline at end of file
diff --git a/XEngine_Release/XEngine_CryptKey/.gitignore b/XEngine_Release/XEngine_CryptKey/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/XEngine_Release/XEngine_DataBase/.gitignore b/XEngine_Release/XEngine_DataBase/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/XEngine_Release/XEngine_XLog/.gitignore b/XEngine_Release/XEngine_XLog/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.def b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.def
new file mode 100644
index 0000000000000000000000000000000000000000..12f326eaa13dcf8cd4e481d7534c67692ccb39de
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.def
@@ -0,0 +1,7 @@
+LIBRARY
+
+EXPORTS
+ Config_GetLastError
+
+ Configure_IniFile_Read
+ Configure_IniFile_Write
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..c5d9d40eebc11d475d27e1eda7393758c48c1f0d
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj
@@ -0,0 +1,185 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {1391b739-713b-4a3a-9233-feab92e0566c}
+ AuthorizeModuleConfigure
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v142
+ MultiByte
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ MultiByte
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ false
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;AUTHORIZEMODULECONFIGURE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+ 4819
+
+
+ Windows
+ true
+ false
+ AuthorizeModule_Configure.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;AUTHORIZEMODULECONFIGURE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthorizeModule_Configure.def
+
+
+
+
+ Level3
+ true
+ _DEBUG;AUTHORIZEMODULECONFIGURE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ false
+ AuthorizeModule_Configure.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;AUTHORIZEMODULECONFIGURE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthorizeModule_Configure.def
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj.filters b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..cb8bafa04ee13a217db93f922b08b8d0957f069d
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj.filters
@@ -0,0 +1,56 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {6ac124f6-fb66-4122-a556-46df6d6f6926}
+
+
+ {53e7588d-c345-417f-af2d-ea28d15f48fd}
+
+
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件\Configure_ini
+
+
+ 头文件
+
+
+ 头文件
+
+
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件\Configure_ini
+
+
+
+
+ 源文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj.user b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/AuthorizeModule_Configure.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/Config_Define.h b/XEngine_Source/AuthorizeModule_Configure/Config_Define.h
new file mode 100644
index 0000000000000000000000000000000000000000..de32670a8583f85d9d28b5c420eea0d93efac1c8
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/Config_Define.h
@@ -0,0 +1,98 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/26 09:55:11
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\Config_Define.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure
+// File Base: Config_Define
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: ĺ
+// History:
+*********************************************************************/
+//////////////////////////////////////////////////////////////////////////
+// ݽṹ
+//////////////////////////////////////////////////////////////////////////
+typedef struct
+{
+ int nPort; //˿
+ int nThreads; //̸߳
+ int nVerTimeout; //û֤ʱʱ
+ BOOL bAutoStart; //
+ BOOL bDeamon; //ػ,LINUX
+ struct
+ {
+ int nVerTime; //֤ʱ
+ int nVerMode; //֤ģʽ
+ int nTryTime; //֤ʱ
+ int nTryMode; //֤ģʽ
+ }st_Verification;
+ struct
+ {
+ BOOL bEnable; //Ƿüܴ
+ int nPassword; //
+ }st_Crypto;
+ struct
+ {
+ TCHAR tszSmtpAddr[MAX_PATH]; //SMTP
+ TCHAR tszSmtpFrom[MAX_PATH]; //ظַ
+ TCHAR tszSmtpUser[MAX_PATH]; //û
+ TCHAR tszSmtpPass[MAX_PATH]; //
+ }st_EMail;
+ struct
+ {
+ TCHAR tszSQLite[MAX_PATH];
+ }st_XSql;
+ struct
+ {
+ TCHAR tszLogFile[MAX_PATH];
+ int nMaxSize;
+ int nMaxCount;
+ int nLogLeave;
+ }st_XLog;
+}AUTHORIZE_CONFIGURE;
+//////////////////////////////////////////////////////////////////////////
+// ĺ
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD Config_GetLastError(int* pInt_SysError = NULL);
+/************************************************************************/
+/* ļ */
+/************************************************************************/
+/********************************************************************
+ƣConfigure_IniFile_Read
+ܣȡļϢ
+ .һlpszFile
+ In/OutIn
+ ַָͣ
+ ɿգN
+ ˼ļλ
+ .pSt_AuthConfig
+ In/OutOut
+ ͣݽṹָ
+ ɿգN
+ ˼ȡϢ
+ֵ
+ ͣ
+ ˼Ƿɹ
+ע
+*********************************************************************/
+extern "C" BOOL Configure_IniFile_Read(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE* pSt_AuthConfig);
+/********************************************************************
+ƣConfigure_IniFile_Write
+ܣдļϢ
+ .һlpszFile
+ In/OutIn
+ ַָͣ
+ ɿգN
+ ˼ļλ
+ .pSt_AuthConfig
+ In/OutIn
+ ͣݽṹָ
+ ɿգN
+ ˼дϢ
+ֵ
+ ͣ
+ ˼Ƿɹ
+ע
+*********************************************************************/
+extern "C" BOOL Configure_IniFile_Write(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE* pSt_AuthConfig);
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/Config_Error.h b/XEngine_Source/AuthorizeModule_Configure/Config_Error.h
new file mode 100644
index 0000000000000000000000000000000000000000..270f79be123ef7f5f4fda9c9633b4f02388c6a33
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/Config_Error.h
@@ -0,0 +1,13 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/26 09:58:59
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\Config_Error.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure
+// File Base: Config_Error
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: Ĵ
+// History:
+*********************************************************************/
+#define ERROR_AUTHORIZE_MODULE_CONFIGURE_PARAMENT 0x0020001
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/Configure_ini/Configure_ini.cpp b/XEngine_Source/AuthorizeModule_Configure/Configure_ini/Configure_ini.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3f75b7e679249aeffe570752449d583db70800f5
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/Configure_ini/Configure_ini.cpp
@@ -0,0 +1,147 @@
+#include "pch.h"
+#include "Configure_ini.h"
+/********************************************************************
+// Created: 2021/07/26 09:59:49
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\Configure_ini\Configure_ini.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\Configure_ini
+// File Base: Configure_ini
+// File Ext: cpp
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: ļ
+// History:
+*********************************************************************/
+CConfigure_IniFile::CConfigure_IniFile()
+{
+
+}
+CConfigure_IniFile::~CConfigure_IniFile()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+// к
+//////////////////////////////////////////////////////////////////////////
+/********************************************************************
+ƣConfigure_IniFile_Read
+ܣȡļϢ
+ .һlpszFile
+ In/OutIn
+ ַָͣ
+ ɿգN
+ ˼ļλ
+ .pSt_AuthConfig
+ In/OutOut
+ ͣݽṹָ
+ ɿգN
+ ˼ȡϢ
+ֵ
+ ͣ
+ ˼Ƿɹ
+ע
+*********************************************************************/
+BOOL CConfigure_IniFile::Configure_IniFile_Read(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE* pSt_AuthConfig)
+{
+ Config_IsErrorOccur = FALSE;
+
+ if ((NULL == lpszFile) || (NULL == pSt_AuthConfig))
+ {
+ Config_IsErrorOccur = TRUE;
+ Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_PARAMENT;
+ return FALSE;
+ }
+ pSt_AuthConfig->nPort = GetPrivateProfileInt(_T("ServiceConfig"), _T("ListenPort"), 0, lpszFile);
+ pSt_AuthConfig->nThreads = GetPrivateProfileInt(_T("ServiceConfig"), _T("ThreadPool"), 0, lpszFile);
+ pSt_AuthConfig->nVerTimeout = GetPrivateProfileInt(_T("ServiceConfig"), _T("UserVerTimed"), 0, lpszFile);
+ pSt_AuthConfig->bAutoStart = GetPrivateProfileInt(_T("ServiceConfig"), _T("AutoStart"), 0, lpszFile);
+
+ pSt_AuthConfig->st_Verification.nVerTime = GetPrivateProfileInt(_T("Verification"), _T("VerTime"), 0, lpszFile);
+ pSt_AuthConfig->st_Verification.nVerMode = GetPrivateProfileInt(_T("Verification"), _T("VerMode"), 0, lpszFile);
+ pSt_AuthConfig->st_Verification.nTryTime = GetPrivateProfileInt(_T("Verification"), _T("TryTime"), 0, lpszFile);
+ pSt_AuthConfig->st_Verification.nTryMode = GetPrivateProfileInt(_T("Verification"), _T("TryMode"), 0, lpszFile);
+
+ pSt_AuthConfig->st_Crypto.bEnable = GetPrivateProfileInt(_T("Crypto"), _T("Enable"), 0, lpszFile);
+ pSt_AuthConfig->st_Crypto.nPassword = GetPrivateProfileInt(_T("Crypto"), _T("Pass"), 0, lpszFile);
+
+ GetPrivateProfileString(_T("SmtpConfig"), _T("SmtpService"), NULL, pSt_AuthConfig->st_EMail.tszSmtpAddr, MAX_PATH, lpszFile);
+ GetPrivateProfileString(_T("SmtpConfig"), _T("SmtpFromAddr"), NULL, pSt_AuthConfig->st_EMail.tszSmtpFrom, MAX_PATH, lpszFile);
+ GetPrivateProfileString(_T("SmtpConfig"), _T("SmtpUser"), NULL, pSt_AuthConfig->st_EMail.tszSmtpUser, MAX_PATH, lpszFile);
+ GetPrivateProfileString(_T("SmtpConfig"), _T("SmtpPass"), NULL, pSt_AuthConfig->st_EMail.tszSmtpPass, MAX_PATH, lpszFile);
+
+ GetPrivateProfileString(_T("XSql"), _T("tszSQLite"), NULL, pSt_AuthConfig->st_XSql.tszSQLite, MAX_PATH, lpszFile);
+
+ pSt_AuthConfig->st_XLog.nLogLeave = GetPrivateProfileInt(_T("XLog"), _T("nLogLeave"), 0, lpszFile);
+ pSt_AuthConfig->st_XLog.nMaxCount = GetPrivateProfileInt(_T("XLog"), _T("nMaxCount"), 0, lpszFile);
+ pSt_AuthConfig->st_XLog.nMaxSize = GetPrivateProfileInt(_T("XLog"), _T("nMaxSize"), 0, lpszFile);
+ GetPrivateProfileString(_T("XLog"), _T("tszLogFile"), NULL, pSt_AuthConfig->st_XLog.tszLogFile, MAX_PATH, lpszFile);
+ return TRUE;
+}
+/********************************************************************
+ƣConfigure_IniFile_Write
+ܣдļϢ
+ .һlpszFile
+ In/OutIn
+ ַָͣ
+ ɿգN
+ ˼ļλ
+ .pSt_AuthConfig
+ In/OutIn
+ ͣݽṹָ
+ ɿգN
+ ˼дϢ
+ֵ
+ ͣ
+ ˼Ƿɹ
+ע
+*********************************************************************/
+BOOL CConfigure_IniFile::Configure_IniFile_Write(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE* pSt_AuthConfig)
+{
+ Config_IsErrorOccur = FALSE;
+ if ((NULL == lpszFile) || (NULL == pSt_AuthConfig))
+ {
+ Config_IsErrorOccur = TRUE;
+ Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_PARAMENT;
+ return FALSE;
+ }
+ TCHAR tszBuffer[MAX_PATH];
+
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->nPort);
+ WritePrivateProfileString(_T("ServiceConfig"), _T("ListenPort"), tszBuffer, lpszFile);
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->nThreads);
+ WritePrivateProfileString(_T("ServiceConfig"), _T("ThreadPool"), tszBuffer, lpszFile);
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->nVerTimeout);
+ WritePrivateProfileString(_T("ServiceConfig"), _T("UserVerTimed"), tszBuffer, lpszFile);
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->bAutoStart);
+ WritePrivateProfileString(_T("ServiceConfig"), _T("AutoStart"), tszBuffer, lpszFile);
+
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->st_Verification.nTryTime);
+ WritePrivateProfileString(_T("Verification"), _T("TryTime"), tszBuffer, lpszFile);
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->st_Verification.nTryMode);
+ WritePrivateProfileString(_T("Verification"), _T("TryMode"), tszBuffer, lpszFile);
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->st_Verification.nVerTime);
+ WritePrivateProfileString(_T("Verification"), _T("VerTime"), tszBuffer, lpszFile);
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->st_Verification.nVerMode);
+ WritePrivateProfileString(_T("Verification"), _T("VerMode"), tszBuffer, lpszFile);
+
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->st_Crypto.bEnable);
+ WritePrivateProfileString(_T("Crypto"), _T("Enable"), tszBuffer, lpszFile);
+ memset(tszBuffer, '\0', MAX_PATH);
+ _stprintf(tszBuffer, _T("%d"), pSt_AuthConfig->st_Crypto.nPassword);
+ WritePrivateProfileString(_T("Crypto"), _T("Pass"), tszBuffer, lpszFile);
+
+ WritePrivateProfileString(_T("SmtpConfig"), _T("SmtpService"), pSt_AuthConfig->st_EMail.tszSmtpAddr, lpszFile);
+ WritePrivateProfileString(_T("SmtpConfig"), _T("SmtpFromAddr"), pSt_AuthConfig->st_EMail.tszSmtpFrom, lpszFile);
+ WritePrivateProfileString(_T("SmtpConfig"), _T("SmtpUser"), pSt_AuthConfig->st_EMail.tszSmtpUser, lpszFile);
+ WritePrivateProfileString(_T("SmtpConfig"), _T("SmtpPassword"), pSt_AuthConfig->st_EMail.tszSmtpPass, lpszFile);
+
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/Configure_ini/Configure_ini.h b/XEngine_Source/AuthorizeModule_Configure/Configure_ini/Configure_ini.h
new file mode 100644
index 0000000000000000000000000000000000000000..0c0a7b088685f173142c765e8a410145636a7e98
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/Configure_ini/Configure_ini.h
@@ -0,0 +1,24 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/26 09:53:58
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\Configure_ini\Configure_ini.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\Configure_ini
+// File Base: Configure_ini
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: ļ
+// History:
+*********************************************************************/
+
+class CConfigure_IniFile
+{
+public:
+ CConfigure_IniFile();
+ ~CConfigure_IniFile();
+public:
+ BOOL Configure_IniFile_Read(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE* pSt_AuthConfig);
+ BOOL Configure_IniFile_Write(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE* pSt_AuthConfig);
+protected:
+private:
+};
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/Makefile b/XEngine_Source/AuthorizeModule_Configure/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..2071effce3e4ab453e8d2cc4f6279a27ad076681
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/Makefile
@@ -0,0 +1,45 @@
+CC = g++ -Wall -std=c++17 -fPIC
+RELEASE = 0
+UNICODE = 0
+INCLUDE = -I ./
+FILECENTOS = /etc/redhat-release
+LOADBIN = -L /usr/local/lib/XEngine_Release/XEngine_BaseLib
+LIB = -lXEngine_BaseLib
+LIBEX = -static-libgcc -lrt -ldl -lpthread
+LOADSO = -Wl,-rpath=
+LIBINCLUDE = Configure_ini.o pch.o
+
+ifeq ($(RELEASE),1)
+FLAGS = -c -O2
+DEBUG =
+else
+FLAGS = -c -lc_p
+DEBUG = -g -pg
+endif
+
+ifeq ($(UNICODE),1)
+UNICODE = -D _UNICODE
+else
+UNICODE =
+endif
+
+all:$(LIBINCLUDE)
+ $(CC) $(DEBUG) $(LIBINCLUDE) -o libAuthorizeModule_Configure.so -shared -fPIC $(LOADBIN) $(LIB) $(LIBEX) $(LOADSO)
+
+Configure_ini.o:./Configure_ini/Configure_ini.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(INCLUDE) ./Configure_ini/Configure_ini.cpp
+
+pch.o:pch.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) pch.cpp
+
+InstallAll:InstallSo
+InstallSo:./libAuthorizeModule_Configure.so
+ cp ./libAuthorizeModule_Configure.so ../../XEngine_Release/libAuthorizeModule_Configure.so
+
+
+
+CleanAll:CleanObj CleanMk
+CleanObj:
+ rm *.o
+CleanMk:
+ rm *.so
diff --git a/XEngine_Source/AuthorizeModule_Configure/dllmain.cpp b/XEngine_Source/AuthorizeModule_Configure/dllmain.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..daed8c8f7ac50ca1466016a0529648d18125a7e7
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/dllmain.cpp
@@ -0,0 +1,19 @@
+// dllmain.cpp : 定义 DLL 应用程序的入口点。
+#include "pch.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/XEngine_Source/AuthorizeModule_Configure/framework.h b/XEngine_Source/AuthorizeModule_Configure/framework.h
new file mode 100644
index 0000000000000000000000000000000000000000..80cbbc9b06a9b0141f92ee19eceaed71328caff4
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/framework.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
+// Windows 头文件
+#include
diff --git a/XEngine_Source/AuthorizeModule_Configure/pch.cpp b/XEngine_Source/AuthorizeModule_Configure/pch.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a2faf59ed96fb79bda04ce1f8a7a8b2f2be11e5a
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/pch.cpp
@@ -0,0 +1,39 @@
+#include "pch.h"
+#include "Configure_ini/Configure_ini.h"
+/********************************************************************
+// Created: 2021/07/26 10:20:03
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\pch.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure
+// File Base: pch
+// File Ext: cpp
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 导出实现
+// History:
+*********************************************************************/
+BOOL Config_IsErrorOccur = FALSE;
+DWORD Config_dwErrorCode = 0;
+//////////////////////////////////////////////////////////////////////////
+CConfigure_IniFile m_Config;
+//////////////////////////////////////////////////////////////////////////
+// 导出函数
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD Config_GetLastError(int* pInt_SysError)
+{
+ if (NULL != pInt_SysError)
+ {
+ *pInt_SysError = errno;
+ }
+ return Config_dwErrorCode;
+}
+/************************************************************************/
+/* 配置文件导出函数 */
+/************************************************************************/
+extern "C" BOOL Configure_IniFile_Read(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE * pSt_AuthConfig)
+{
+ return m_Config.Configure_IniFile_Read(lpszFile, pSt_AuthConfig);
+}
+extern "C" BOOL Configure_IniFile_Write(LPCTSTR lpszFile, AUTHORIZE_CONFIGURE * pSt_AuthConfig)
+{
+ return m_Config.Configure_IniFile_Write(lpszFile, pSt_AuthConfig);
+}
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Configure/pch.h b/XEngine_Source/AuthorizeModule_Configure/pch.h
new file mode 100644
index 0000000000000000000000000000000000000000..a8a78b3a136a128d920a13bea49d70b507a9dc11
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Configure/pch.h
@@ -0,0 +1,43 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+
+#ifdef _WINDOWS
+// 添加要在此处预编译的标头
+#include "framework.h"
+#include
+#endif
+
+#endif //PCH_H
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "Config_Define.h"
+#include "Config_Error.h"
+/********************************************************************
+// Created: 2021/07/26 10:00:36
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure\pch.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Configure
+// File Base: pch
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 公用头文件
+// History:
+*********************************************************************/
+extern BOOL Config_IsErrorOccur;
+extern DWORD Config_dwErrorCode;
+
+#ifdef _WINDOWS
+#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib")
+#endif
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def
new file mode 100644
index 0000000000000000000000000000000000000000..2115b215d7e6ee89a937ccf1257a917e536ab8ff
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def
@@ -0,0 +1,6 @@
+LIBRARY
+
+EXPORTS
+ Protocol_GetLastError
+
+ Protocol_Packet_SendPkt
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..a23574574f59e253dc16da3e3fe91583560efa96
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj
@@ -0,0 +1,186 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {6b926d00-dcd2-49e3-86a9-3230c9872e65}
+ AuthorizeModuleProtocol
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v142
+ MultiByte
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ MultiByte
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+
+
+ false
+ $(XEngine_Include);$(IncludePath)
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;AUTHORIZEMODULEPROTOCOL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ false
+ AuthorizeModule_Protocol.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;AUTHORIZEMODULEPROTOCOL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+ MultiThreaded
+ 4819
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthorizeModule_Protocol.def
+
+
+
+
+ Level3
+ true
+ _DEBUG;AUTHORIZEMODULEPROTOCOL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ false
+ AuthorizeModule_Protocol.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;AUTHORIZEMODULEPROTOCOL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthorizeModule_Protocol.def
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj.filters b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..a3c621c9893c8e552c551e75a02107133c57f5ad
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj.filters
@@ -0,0 +1,68 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {d632b93c-9d0a-4a96-be71-aaf28962cde6}
+
+
+ {51b0cb65-365c-42ea-b709-499ae03f9a8d}
+
+
+ {67a028ad-c937-41fd-9746-6886a0410bc2}
+
+
+ {d26708d0-4748-433e-8d16-5265edaf48b9}
+
+
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件\Protocol_Packet
+
+
+ 头文件\Protocol_Parse
+
+
+ 头文件
+
+
+ 头文件
+
+
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件\Protocol_Packet
+
+
+ 源文件\Protocol_Parse
+
+
+
+
+ 源文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj.user b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/Makefile b/XEngine_Source/AuthorizeModule_Protocol/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..cc63ff665141a110cbf454a91df28a77e4f25413
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/Makefile
@@ -0,0 +1,47 @@
+CC = g++ -Wall -std=c++17 -fPIC
+RELEASE = 0
+UNICODE = 0
+INCLUDE = -I ./
+FILECENTOS = /etc/redhat-release
+LOADBIN =
+LIB =
+LIBEX = -static-libgcc -lrt -ldl -lpthread
+LOADSO = -Wl,-rpath=
+LIBINCLUDE = Protocol_Packet.o Protocol_Parse.o pch.o
+
+ifeq ($(RELEASE),1)
+FLAGS = -c -O2
+DEBUG =
+else
+FLAGS = -c -lc_p
+DEBUG = -g -pg
+endif
+
+ifeq ($(UNICODE),1)
+UNICODE = -D _UNICODE
+else
+UNICODE =
+endif
+
+all:$(LIBINCLUDE)
+ $(CC) $(DEBUG) $(LIBINCLUDE) -o libAuthorizeModule_Protocol.so -shared -fPIC $(LOADBIN) $(LIB) $(LIBEX) $(LOADSO)
+
+Protocol_Packet.o:./Protocol_Packet/Protocol_Packet.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(INCLUDE) ./Protocol_Packet/Protocol_Packet.cpp
+Protocol_Parse.o:./Protocol_Parse/Protocol_Parse.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(INCLUDE) ./Protocol_Parse/Protocol_Parse.cpp
+
+pch.o:pch.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) pch.cpp
+
+InstallAll:InstallSo
+InstallSo:./libAuthorizeModule_Protocol.so
+ cp ./libAuthorizeModule_Protocol.so ../../XEngine_Release/libAuthorizeModule_Protocol.so
+
+
+
+CleanAll:CleanObj CleanMk
+CleanObj:
+ rm *.o
+CleanMk:
+ rm *.so
diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h
new file mode 100644
index 0000000000000000000000000000000000000000..99389607ff1078ebf8aebdbe85140e85c9d855fa
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h
@@ -0,0 +1,53 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/16 09:18:44
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Define.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol
+// File Base: Protocol_Define
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: Ķ
+// History:
+*********************************************************************/
+//////////////////////////////////////////////////////////////////////////
+//
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD Protocol_GetLastError(int *pInt_SysError = NULL);
+/************************************************************************/
+/* Э */
+/************************************************************************/
+/********************************************************************
+ƣProtocol_Packet_SendPkt
+ܣʹ
+ .һptszMsgBuffer
+ In/OutIn
+ ַָͣ
+ ɿգN
+ ˼ҪĻ
+ .pInt_MsgLen
+ In/OutIn
+ ָͣ
+ ɿգN
+ ˼С
+ .pSt_ProtocolHdr
+ In/OutIn
+ ͣݽṹָ
+ ɿգN
+ ˼Эͷ
+ .ģlpszMsgBuffer
+ In/OutIn
+ ַָͣ
+ ɿգY
+ ˼Ҫ͵
+ .壺nMsgLen
+ In/OutIn
+ ͣ
+ ɿգY
+ ˼ݴС
+ֵ
+ ͣ
+ ˼Ƿɹ
+ע
+*********************************************************************/
+extern "C" BOOL Protocol_Packet_SendPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0);
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Error.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Error.h
new file mode 100644
index 0000000000000000000000000000000000000000..0c5d9dcbe3d8071c8cb6083baceab9f1bcde52ec
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Error.h
@@ -0,0 +1,13 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/16 09:22:57
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Error.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol
+// File Base: Protocol_Error
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose:
+// History:
+*********************************************************************/
+#define XENGINE_AUTHORIZE_PROTOCOL_PARAMENT 0x0010001
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..15b97c9e28e4d0a561237a3e06b7ef40dd0d7b31
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp
@@ -0,0 +1,81 @@
+#include "pch.h"
+#include "Protocol_Packet.h"
+/********************************************************************
+// Created: 2021/07/16 09:10:52
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Packet\Protocol_Packet.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Packet
+// File Base: Protocol_Packet
+// File Ext: cpp
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: Э
+// History:
+*********************************************************************/
+CProtocol_Packet::CProtocol_Packet()
+{
+
+}
+CProtocol_Packet::~CProtocol_Packet()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+// к
+//////////////////////////////////////////////////////////////////////////
+/********************************************************************
+ƣProtocol_Packet_SendPkt
+ܣʹ
+ .һptszMsgBuffer
+ In/OutIn
+ ַָͣ
+ ɿգN
+ ˼ҪĻ
+ .pInt_MsgLen
+ In/OutIn
+ ָͣ
+ ɿգN
+ ˼С
+ .pSt_ProtocolHdr
+ In/OutIn
+ ͣݽṹָ
+ ɿգN
+ ˼Эͷ
+ .ģlpszMsgBuffer
+ In/OutIn
+ ַָͣ
+ ɿգY
+ ˼Ҫ͵
+ .壺nMsgLen
+ In/OutIn
+ ͣ
+ ɿգY
+ ˼ݴС
+ֵ
+ ͣ
+ ˼Ƿɹ
+ע
+*********************************************************************/
+BOOL CProtocol_Packet::Protocol_Packet_SendPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer /* = NULL */, int nMsgLen /* = 0 */)
+{
+ Protocol_IsErrorOccur = FALSE;
+
+ if ((NULL == ptszMsgBuffer) || (NULL == pInt_MsgLen))
+ {
+ Protocol_IsErrorOccur = TRUE;
+ Protocol_dwErrorCode = XENGINE_AUTHORIZE_PROTOCOL_PARAMENT;
+ return FALSE;
+ }
+ pSt_ProtocolHdr->unPacketSize = nMsgLen;
+
+ memcpy(ptszMsgBuffer, pSt_ProtocolHdr, sizeof(XENGINE_PROTOCOLHDR));
+ if (nMsgLen > 0)
+ {
+ *pInt_MsgLen = sizeof(XENGINE_PROTOCOLHDR) + nMsgLen;
+ memcpy(ptszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), lpszMsgBuffer, nMsgLen);
+ }
+ else
+ {
+ *pInt_MsgLen = sizeof(XENGINE_PROTOCOLHDR);
+ }
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8c5211ea46ef1a091f09f2c6c32bf721f01d82b
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.h
@@ -0,0 +1,23 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 14:24:11
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Packet\Protocol_Packet.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Packet
+// File Base: Protocol_Packet
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: Э
+// History:
+*********************************************************************/
+
+class CProtocol_Packet
+{
+public:
+ CProtocol_Packet();
+ ~CProtocol_Packet();
+public:
+ BOOL Protocol_Packet_SendPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0);
+protected:
+private:
+};
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..97233174f4dbf809573a0989959e9dc804206971
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp
@@ -0,0 +1,24 @@
+#include "pch.h"
+#include "Protocol_Parse.h"
+/********************************************************************
+// Created: 2021/07/14 14:27:27
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Parse\Protocol_Parse.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Parse
+// File Base: Protocol_Parse
+// File Ext: cpp
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: Э
+// History:
+*********************************************************************/
+CProtocol_Parse::CProtocol_Parse()
+{
+
+}
+CProtocol_Parse::~CProtocol_Parse()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+// к
+//////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h
new file mode 100644
index 0000000000000000000000000000000000000000..e5df41eb091a6c70385ae5fc92793a8e5184f2cf
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h
@@ -0,0 +1,22 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 14:26:26
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Parse\Protocol_Parse.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\Protocol_Parse
+// File Base: Protocol_Parse
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: Э
+// History:
+*********************************************************************/
+
+class CProtocol_Parse
+{
+public:
+ CProtocol_Parse();
+ ~CProtocol_Parse();
+public:
+protected:
+private:
+};
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/dllmain.cpp b/XEngine_Source/AuthorizeModule_Protocol/dllmain.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..daed8c8f7ac50ca1466016a0529648d18125a7e7
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/dllmain.cpp
@@ -0,0 +1,19 @@
+// dllmain.cpp : 定义 DLL 应用程序的入口点。
+#include "pch.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/XEngine_Source/AuthorizeModule_Protocol/framework.h b/XEngine_Source/AuthorizeModule_Protocol/framework.h
new file mode 100644
index 0000000000000000000000000000000000000000..80cbbc9b06a9b0141f92ee19eceaed71328caff4
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/framework.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
+// Windows 头文件
+#include
diff --git a/XEngine_Source/AuthorizeModule_Protocol/pch.cpp b/XEngine_Source/AuthorizeModule_Protocol/pch.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6f730a346a3fefc9511e252a21397449cce44e65
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/pch.cpp
@@ -0,0 +1,37 @@
+#include "pch.h"
+#include "Protocol_Parse/Protocol_Parse.h"
+#include "Protocol_Packet/Protocol_Packet.h"
+/********************************************************************
+// Created: 2021/07/16 09:21:37
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\pch.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol
+// File Base: pch
+// File Ext: cpp
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 导出实现
+// History:
+*********************************************************************/
+BOOL Protocol_IsErrorOccur = FALSE;
+DWORD Protocol_dwErrorCode = 0;
+//////////////////////////////////////////////////////////////////////////
+CProtocol_Packet m_ProtocolPacket;
+CProtocol_Parse m_ProtocolParse;
+//////////////////////////////////////////////////////////////////////////
+// 导出函数
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD Protocol_GetLastError(int* pInt_SysError)
+{
+ if (NULL != pInt_SysError)
+ {
+ *pInt_SysError = errno;
+ }
+ return Protocol_dwErrorCode;
+}
+/************************************************************************/
+/* 打包类协议 */
+/************************************************************************/
+extern "C" BOOL Protocol_Packet_SendPkt(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen)
+{
+ return m_ProtocolPacket.Protocol_Packet_SendPkt(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen);
+}
\ No newline at end of file
diff --git a/XEngine_Source/AuthorizeModule_Protocol/pch.h b/XEngine_Source/AuthorizeModule_Protocol/pch.h
new file mode 100644
index 0000000000000000000000000000000000000000..20b3162bb654618820c72818dfb67829a309da50
--- /dev/null
+++ b/XEngine_Source/AuthorizeModule_Protocol/pch.h
@@ -0,0 +1,36 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+
+#ifdef _WINDOWS
+// 添加要在此处预编译的标头
+#include "framework.h"
+#include
+#endif
+
+#endif //PCH_H
+#include
+#include
+#include
+#include
+#include
+#include "Protocol_Define.h"
+#include "Protocol_Error.h"
+/********************************************************************
+// Created: 2021/07/16 09:20:47
+// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol\pch.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Protocol
+// File Base: pch
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 公用头文件
+// History:
+*********************************************************************/
+extern BOOL Protocol_IsErrorOccur;
+extern DWORD Protocol_dwErrorCode;
\ No newline at end of file
diff --git a/XEngine_Source/Makefile b/XEngine_Source/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3a20a4cb5dccb6602f1111e57adc17f142f77714
--- /dev/null
+++ b/XEngine_Source/Makefile
@@ -0,0 +1,44 @@
+RELEASE = 0
+UNICODE = 0
+
+FLAGS = RELEASE=$(RELEASE)
+
+COMPONENTS_SESSION_PATH = ./XEngine_AuthComponents/AuthComponents_Session
+COMPONENTS_SQLPACKET_PATH = ./XEngine_AuthComponents/AuthComponents_SQLPacket
+
+AUTH_PROTOCOL_PATH = ./AuthorizeModule_Protocol
+AUTH_CONFIGURE_PATH = ./AuthorizeModule_Configure
+
+AUTH_APP_PATH = ./XEngine_APPService/XEngine_AuthorizeService
+
+XENGINE = libAuthComponents_Session.so libAuthComponents_SQLPacket.so \
+ libAuthorizeModule_Protocol.so libAuthorizeModule_Configure.so \
+ XEngine_AuthorizeApp.exe
+
+.PHONY:MakeAll
+MakeAll:$(XENGINE)
+
+libAuthComponents_Session.so:
+ make -C $(COMPONENTS_SESSION_PATH) $(FLAGS)
+libAuthComponents_SQLPacket.so:
+ make -C $(COMPONENTS_SQLPACKET_PATH) $(FLAGS)
+
+libAuthorizeModule_Protocol.so:
+ make -C $(AUTH_PROTOCOL_PATH) $(FLAGS)
+libAuthorizeModule_Configure.so:
+ make -C $(AUTH_CONFIGURE_PATH) $(FLAGS)
+
+XEngine_AuthorizeApp.exe:
+ make -C $(AUTH_APP_PATH) $(FLAGS)
+
+
+SetFlags_Install:
+ export FLAGS=InstallAll
+InstallAll:SetFlags_Install $(NETENGINE_LIB)
+
+SetFlags_Clean:
+ export FLAGS=CleanAll
+CleanAll:SetFlags_Clean $(NETENGINE_LIB)
+
+
+
diff --git a/XEngine_Source/VSClean.bat b/XEngine_Source/VSClean.bat
new file mode 100644
index 0000000000000000000000000000000000000000..bf8eca312f152fb046525e2cb0588095fec84b08
--- /dev/null
+++ b/XEngine_Source/VSClean.bat
@@ -0,0 +1,10 @@
+@echo Off
+del /s /a *.ncb *.so *.o *.db
+FOR /R . %%d IN (.) DO rd /s /q "%%d\Debug" 2>nul
+FOR /R . %%d IN (.) DO rd /s /q "%%d\Release" 2>nul
+FOR /R . %%d IN (.) DO rd /s /q "%%d\x64" 2>nul
+FOR /R . %%d IN (.) DO rd /s /q "%%d\Debug" 2>nul
+FOR /R . %%d IN (.) DO rd /s /q "%%d\ipch" 2>nul
+
+rem If the Properties directory is empty, remove it
+FOR /R . %%d in (.) do rd /q "%%d\Properties" 2> nul
diff --git a/XEngine_Source/VSCopy.bat b/XEngine_Source/VSCopy.bat
new file mode 100644
index 0000000000000000000000000000000000000000..bd2b3b5ef3284fb7eaf40d085e0069f1fee40f5b
--- /dev/null
+++ b/XEngine_Source/VSCopy.bat
@@ -0,0 +1,20 @@
+copy /y "%XEngine_Library%\x86\XEngine_BaseLib\XEngine_BaseLib.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_BaseLib\XEngine_Algorithm.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_Core\XEngine_Core.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_Core\XEngine_ManagePool.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_Core\XEngine_OPenSsl.dll" "./"
+
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\HelpComponents_DataBase.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\HelpComponents_Packets.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\HelpComponents_XLog.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\HelpComponents_Authorize.dll" "./"
+
+copy /y "%XEngine_Library%\x86\XEngine_SystemSdk\XEngine_SystemApi.dll" "./"
+
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\bson-1.0.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\mongoc-1.0.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\libmariadb.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\libpq.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_HelpComponents\libsqlite3.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_LibEx\libcrypto-1_1.dll" "./"
+copy /y "%XEngine_Library%\x86\XEngine_LibEx\libssl-1_1.dll" "./"
\ No newline at end of file
diff --git a/XEngine_Source/VSCopy_Debug.bat b/XEngine_Source/VSCopy_Debug.bat
new file mode 100644
index 0000000000000000000000000000000000000000..8bd68327ed070c692b95ac7ee4feb7b93ce6952b
--- /dev/null
+++ b/XEngine_Source/VSCopy_Debug.bat
@@ -0,0 +1,12 @@
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_BaseLib.dll" "./"
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Algorithm.dll" "./"
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Core.dll" "./"
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_ManagePool.dll" "./"
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_OPenSsl.dll" "./"
+
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_DataBase.dll" "./"
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_Packets.dll" "./"
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_XLog.dll" "./"
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_XLog.dll" "./"
+
+copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_SystemApi.dll" "./"
\ No newline at end of file
diff --git a/XEngine_Source/XAuth_Protocol.h b/XEngine_Source/XAuth_Protocol.h
new file mode 100644
index 0000000000000000000000000000000000000000..477e39a4f9e9ff27bf8f26191559f593aa3f0c55
--- /dev/null
+++ b/XEngine_Source/XAuth_Protocol.h
@@ -0,0 +1,58 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 13:27:45
+// File Name: D:\XEngine_Authorize\XEngine_Source\XAuth_Protocol.h
+// File Path: D:\XEngine_Authorize\XEngine_Source
+// File Base: XAuth_Protocol
+// File Ext: h
+// Project: XEngine(ͨ)
+// Author: qyt
+// Purpose: ֤Эͷ
+// History:
+*********************************************************************/
+#define XENGINE_AUTHREG_SERVICE_SQL_MAX_USERNAME 32
+//////////////////////////////////////////////////////////////////////////
+// ݽṹ
+//////////////////////////////////////////////////////////////////////////
+//ֵЭ
+typedef struct
+{
+ CHAR tszUserName[XENGINE_AUTHREG_SERVICE_SQL_MAX_USERNAME]; //û
+ CHAR tszSerialNumber[128]; //к
+}AUTHREG_PROTOCOL_USERPAY, * LPAUTHREG_PROTOCOL_USERPAY;
+//ʱϢЭ
+typedef struct
+{
+ CHAR tszUserAddr[XENGINE_AUTHREG_SERVICE_SQL_MAX_USERNAME]; //ַ
+ CHAR tszUserName[XENGINE_AUTHREG_SERVICE_SQL_MAX_USERNAME]; //û
+ CHAR tszLeftTime[64]; //
+ __int64x nTimeLeft; //ʣʱ
+ __int64x nTimeONLine; //ʱ
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enSerialType;
+}AUTHREG_PROTOCOL_TIME, * LPAUTHREG_PROTOCOL_TIME;
+//û
+typedef struct tag_AuthReg_UserTable
+{
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+ CHAR tszLeftTime[64]; //ʣ
+ CHAR tszHardCode[32]; //Ӳ
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthRegSerialType; //ֵ
+}AUTHREG_USERTABLE, * LPAUTHREG_USERTABLE;
+//עкű
+typedef struct tag_AuthReg_SerialTable
+{
+ CHAR tszUserName[XENGINE_AUTHREG_SERVICE_SQL_MAX_USERNAME]; //ʹ˭
+ CHAR tszSerialNumber[128]; //к
+ CHAR tszMaxTime[64]; //ʹʱ
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthRegSerialType; //ֵ
+ BOOL bIsUsed; //ǷѾʹ
+ CHAR tszCreateTime[64]; //ʱ
+}AUTHREG_SERIALTABLE, * LPAUTHREG_SERIALTABLE;
+//ʱ֤
+typedef struct tag_AuthReg_NetVer
+{
+ CHAR tszVerSerial[256]; //֤к
+ CHAR tszVerData[64]; //֤ʱ
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enVerMode; //֤ʽ
+ int nTryTime; //ʱ
+}AUTHREG_NETVER, * LPAUTHREG_NETVER;
\ No newline at end of file
diff --git a/XEngine_Source/XEngine.sln b/XEngine_Source/XEngine.sln
new file mode 100644
index 0000000000000000000000000000000000000000..4a524349b898ce89aaa052ae1174b0fbabbab7f8
--- /dev/null
+++ b/XEngine_Source/XEngine.sln
@@ -0,0 +1,96 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31410.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_AuthComponents", "XEngine_AuthComponents", "{F79B8560-7E00-4930-A61B-83BE6FB52599}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AuthComponents_SQLPacket", "XEngine_AuthComponents\AuthComponents_SQLPacket\AuthComponents_SQLPacket.vcxproj", "{84DE72B3-131E-4F30-9E73-152BDCA328EA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AuthComponents_Session", "XEngine_AuthComponents\AuthComponents_Session\AuthComponents_Session.vcxproj", "{65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_File", "XEngine_File", "{D3A33095-8584-4EFB-9411-EBC38407E7B9}"
+ ProjectSection(SolutionItems) = preProject
+ XAuth_Protocol.h = XAuth_Protocol.h
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AuthorizeModule_Protocol", "AuthorizeModule_Protocol\AuthorizeModule_Protocol.vcxproj", "{6B926D00-DCD2-49E3-86A9-3230C9872E65}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AuthorizeModule_Configure", "AuthorizeModule_Configure\AuthorizeModule_Configure.vcxproj", "{1391B739-713B-4A3A-9233-FEAB92E0566C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_APPService", "XEngine_APPService", "{2444CB54-6443-47F9-8D93-91237D0D05FB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_AuthorizeService", "XEngine_APPService\XEngine_AuthorizeService\XEngine_AuthorizeService.vcxproj", "{A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_AuthorizeApp", "XEngine_APPService\XEngine_AuthorizeApp\XEngine_AuthorizeApp.vcxproj", "{29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Debug|x64.ActiveCfg = Debug|x64
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Debug|x64.Build.0 = Debug|x64
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Debug|x86.ActiveCfg = Debug|Win32
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Debug|x86.Build.0 = Debug|Win32
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Release|x64.ActiveCfg = Release|x64
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Release|x64.Build.0 = Release|x64
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Release|x86.ActiveCfg = Release|Win32
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA}.Release|x86.Build.0 = Release|Win32
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Debug|x64.ActiveCfg = Debug|x64
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Debug|x64.Build.0 = Debug|x64
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Debug|x86.ActiveCfg = Debug|Win32
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Debug|x86.Build.0 = Debug|Win32
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Release|x64.ActiveCfg = Release|x64
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Release|x64.Build.0 = Release|x64
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Release|x86.ActiveCfg = Release|Win32
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF}.Release|x86.Build.0 = Release|Win32
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Debug|x64.ActiveCfg = Debug|x64
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Debug|x64.Build.0 = Debug|x64
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Debug|x86.ActiveCfg = Debug|Win32
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Debug|x86.Build.0 = Debug|Win32
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Release|x64.ActiveCfg = Release|x64
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Release|x64.Build.0 = Release|x64
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Release|x86.ActiveCfg = Release|Win32
+ {6B926D00-DCD2-49E3-86A9-3230C9872E65}.Release|x86.Build.0 = Release|Win32
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Debug|x64.ActiveCfg = Debug|x64
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Debug|x64.Build.0 = Debug|x64
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Debug|x86.ActiveCfg = Debug|Win32
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Debug|x86.Build.0 = Debug|Win32
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Release|x64.ActiveCfg = Release|x64
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Release|x64.Build.0 = Release|x64
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Release|x86.ActiveCfg = Release|Win32
+ {1391B739-713B-4A3A-9233-FEAB92E0566C}.Release|x86.Build.0 = Release|Win32
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Debug|x64.ActiveCfg = Debug|x64
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Debug|x64.Build.0 = Debug|x64
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Debug|x86.ActiveCfg = Debug|Win32
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Debug|x86.Build.0 = Debug|Win32
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Release|x64.ActiveCfg = Release|x64
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Release|x64.Build.0 = Release|x64
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Release|x86.ActiveCfg = Release|Win32
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9}.Release|x86.Build.0 = Release|Win32
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Debug|x64.ActiveCfg = Debug|x64
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Debug|x64.Build.0 = Debug|x64
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Debug|x86.ActiveCfg = Debug|Win32
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Debug|x86.Build.0 = Debug|Win32
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Release|x64.ActiveCfg = Release|x64
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Release|x64.Build.0 = Release|x64
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Release|x86.ActiveCfg = Release|Win32
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {84DE72B3-131E-4F30-9E73-152BDCA328EA} = {F79B8560-7E00-4930-A61B-83BE6FB52599}
+ {65CB84F8-8DAB-483D-A3C6-AD48FC7ACAEF} = {F79B8560-7E00-4930-A61B-83BE6FB52599}
+ {A29DFD8D-2818-4BE3-A2DB-07F241B4BFC9} = {2444CB54-6443-47F9-8D93-91237D0D05FB}
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16} = {2444CB54-6443-47F9-8D93-91237D0D05FB}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E1F1DDE3-8949-41AF-84D6-03CB7CAA03AB}
+ EndGlobalSection
+EndGlobal
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Configure.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Configure.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..aaa2622c2280f35f29202ed1faadb7077627fc82
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Configure.cpp
@@ -0,0 +1,222 @@
+// CDialog_Configure.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "../XEngine_AuthorizeApp.h"
+#include "CDialog_Configure.h"
+#include "afxdialogex.h"
+
+
+// CDialog_Configure 对话框
+
+IMPLEMENT_DYNAMIC(CDialog_Configure, CDialogEx)
+
+CDialog_Configure::CDialog_Configure(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG_CONFIG, pParent)
+{
+
+}
+
+CDialog_Configure::~CDialog_Configure()
+{
+}
+
+void CDialog_Configure::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_EDIT1, m_EditServicePort);
+ DDX_Control(pDX, IDC_EDIT3, m_EditThreadPool);
+ DDX_Control(pDX, IDC_EDIT2, m_EditVerTimedout);
+ DDX_Control(pDX, IDC_EDIT5, m_EditPass);
+ DDX_Control(pDX, IDC_RADIO3, m_BtnAutoStart);
+ DDX_Control(pDX, IDC_RADIO4, m_BtnAutoStop);
+ DDX_Control(pDX, IDC_COMBO1, m_ComboRegTry);
+ DDX_Control(pDX, IDC_COMBO2, m_ComboListAuth);
+ DDX_Control(pDX, IDC_RADIO1, m_RadioKeyPass);
+ DDX_Control(pDX, IDC_RADIO2, m_RadioKeyDisable);
+ DDX_Control(pDX, IDC_EDIT4, m_EditTryTime);
+ DDX_Control(pDX, IDC_EDIT6, m_EditAuthTime);
+ DDX_Control(pDX, IDC_EDIT7, m_EditSmtpAddr);
+ DDX_Control(pDX, IDC_EDIT8, m_EditFromAddr);
+ DDX_Control(pDX, IDC_EDIT9, m_EditSmtpUser);
+ DDX_Control(pDX, IDC_EDIT10, m_EditSmtpPass);
+}
+
+
+BEGIN_MESSAGE_MAP(CDialog_Configure, CDialogEx)
+ ON_BN_CLICKED(IDC_BUTTON1, &CDialog_Configure::OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, &CDialog_Configure::OnBnClickedButton2)
+ ON_BN_CLICKED(IDC_BUTTON3, &CDialog_Configure::OnBnClickedButton3)
+ ON_BN_CLICKED(IDC_RADIO2, &CDialog_Configure::OnBnClickedRadio2)
+ ON_BN_CLICKED(IDC_RADIO1, &CDialog_Configure::OnBnClickedRadio1)
+END_MESSAGE_MAP()
+
+
+// CDialog_Configure 消息处理程序
+
+
+BOOL CDialog_Configure::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // TODO: 在此添加额外的初始化
+ LPCTSTR lpszFile = _T("./XEngine_Config/XEngine_Config.ini");
+ memset(&st_AuthConfig, '\0', sizeof(AUTHORIZE_CONFIGURE));
+ Configure_IniFile_Read(lpszFile, &st_AuthConfig);
+
+ AuthorizeService_ReadConfigure();
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 异常: OCX 属性页应返回 FALSE
+}
+
+void CDialog_Configure::AuthorizeService_ReadConfigure()
+{
+ CString m_StrConfigPort; //服务器端口
+ CString m_StrConfigThread; //启动的线程个数
+ CString m_StrTimedOut; //用户验证超时时间
+
+ CString m_StrConfigTryMode; //验证模式
+ CString m_StrConfigTryTime; //验证时间
+ CString m_StrConfigAuthMode; //验证模式
+ CString m_StrConfigAuthTime; //验证时间
+
+ CString m_StrConfigCrypt; //是否启用加密传输
+ //配置
+ m_StrConfigPort.Format(_T("%d"), st_AuthConfig.nPort);
+ m_StrConfigThread.Format(_T("%d"), st_AuthConfig.nThreads);
+ m_StrTimedOut.Format(_T("%d"), st_AuthConfig.nVerTimeout);
+
+ m_EditServicePort.SetWindowText(m_StrConfigPort);
+ m_EditThreadPool.SetWindowText(m_StrConfigThread);
+ m_EditVerTimedout.SetWindowText(m_StrTimedOut);
+ if (st_AuthConfig.bAutoStart)
+ {
+ m_BtnAutoStart.SetCheck(1);
+ m_BtnAutoStop.SetCheck(0);
+ }
+ else
+ {
+ m_BtnAutoStart.SetCheck(0);
+ m_BtnAutoStop.SetCheck(1);
+ }
+
+ if (st_AuthConfig.st_Crypto.bEnable)
+ {
+ m_EditPass.EnableWindow(TRUE);
+ m_RadioKeyDisable.SetCheck(FALSE);
+ m_RadioKeyPass.SetCheck(TRUE);
+ }
+ else
+ {
+ m_EditPass.EnableWindow(FALSE);
+ m_RadioKeyDisable.SetCheck(TRUE);
+ m_RadioKeyPass.SetCheck(FALSE);
+ }
+ m_StrConfigCrypt.Format(_T("%d"), st_AuthConfig.st_Crypto.nPassword);
+ m_EditPass.SetWindowText(m_StrConfigCrypt.GetBuffer());
+
+ m_StrConfigTryTime.Format(_T("%d"), st_AuthConfig.st_Verification.nTryTime);
+ m_EditTryTime.SetWindowText(m_StrConfigTryTime);
+ m_ComboRegTry.AddString(_T("不支持"));
+ m_ComboRegTry.AddString(_T("分钟"));
+ m_ComboRegTry.AddString(_T("次数"));
+ m_ComboRegTry.SetCurSel(st_AuthConfig.st_Verification.nTryMode);
+
+ m_StrConfigAuthTime.Format(_T("%d"), st_AuthConfig.st_Verification.nVerTime);
+ m_EditAuthTime.SetWindowText(m_StrConfigAuthTime);
+ m_ComboListAuth.AddString(_T("不支持"));
+ m_ComboListAuth.AddString(_T("分钟"));
+ m_ComboListAuth.AddString(_T("天数"));
+ m_ComboListAuth.AddString(_T("次数"));
+ m_ComboListAuth.SetCurSel(st_AuthConfig.st_Verification.nVerMode);
+
+ m_EditSmtpAddr.SetWindowText(st_AuthConfig.st_EMail.tszSmtpAddr);
+ m_EditFromAddr.SetWindowText(st_AuthConfig.st_EMail.tszSmtpFrom);
+ m_EditSmtpUser.SetWindowText(st_AuthConfig.st_EMail.tszSmtpUser);
+ m_EditSmtpPass.SetWindowText(st_AuthConfig.st_EMail.tszSmtpPass);
+}
+void CDialog_Configure::AuthorizeService_WriteConfigure()
+{
+ CString m_StrConfigPort; //服务器端口
+ CString m_StrConfigThread; //启动的线程个数
+ CString m_StrTimedOut; //用户验证超时时间
+
+ CString m_StrConfigTryMode; //验证模式
+ CString m_StrConfigTryTime; //验证时间
+ CString m_StrConfigAuthMode; //验证模式
+ CString m_StrConfigAuthTime; //验证时间
+
+ CString m_StrConfigCrypt; //是否启用加密传输
+
+ CString m_StrConfigSmtpAddr; //SMTP服务器
+ CString m_StrConfigSmtpFrom; //SMTP回复地址
+ CString m_StrConfigSmtpUser; //用户名
+ CString m_StrConfigSmtpPass; //密码
+
+ m_EditServicePort.GetWindowText(m_StrConfigPort);
+ m_EditThreadPool.GetWindowText(m_StrConfigThread);
+ m_EditVerTimedout.GetWindowText(m_StrTimedOut);
+ st_AuthConfig.nPort = _ttoi(m_StrConfigPort.GetBuffer());
+ st_AuthConfig.nThreads = _ttoi(m_StrConfigThread.GetBuffer());
+ st_AuthConfig.nVerTimeout = _ttoi(m_StrTimedOut.GetBuffer());
+ st_AuthConfig.bAutoStart = m_BtnAutoStart.GetCheck();
+
+ m_EditTryTime.GetWindowText(m_StrConfigTryTime);
+ m_EditAuthTime.GetWindowText(m_StrConfigAuthTime);
+ st_AuthConfig.st_Verification.nTryMode = m_ComboRegTry.GetCurSel();
+ st_AuthConfig.st_Verification.nVerMode = m_ComboListAuth.GetCurSel();
+ st_AuthConfig.st_Verification.nTryTime = _ttoi(m_StrConfigTryTime.GetBuffer());
+ st_AuthConfig.st_Verification.nVerTime = _ttoi(m_StrConfigAuthTime.GetBuffer());
+
+ m_EditPass.GetWindowText(m_StrConfigCrypt);
+ st_AuthConfig.st_Crypto.bEnable = m_RadioKeyPass.GetCheck();
+ st_AuthConfig.st_Crypto.nPassword = _ttoi(m_StrConfigCrypt.GetBuffer());
+
+ m_EditSmtpAddr.GetWindowText(st_AuthConfig.st_EMail.tszSmtpAddr, MAX_PATH);
+ m_EditFromAddr.GetWindowText(st_AuthConfig.st_EMail.tszSmtpFrom, MAX_PATH);
+ m_EditSmtpUser.GetWindowText(st_AuthConfig.st_EMail.tszSmtpUser, MAX_PATH);
+ m_EditSmtpPass.GetWindowText(st_AuthConfig.st_EMail.tszSmtpPass, MAX_PATH);
+}
+
+void CDialog_Configure::OnBnClickedButton1()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ AuthorizeService_WriteConfigure();
+}
+
+
+void CDialog_Configure::OnBnClickedButton2()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ LPCTSTR lpszConfigFile = _T("./XEngine_Config/XEngine_Config.ini");
+ CopyFile(lpszConfigFile, _T("./XEngine_Config/XEngine_Config.bak"), FALSE);
+}
+
+
+void CDialog_Configure::OnBnClickedButton3()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ LPCTSTR lpszConfigFile = _T("./XEngine_Config/XEngine_Config.ini");
+ DeleteFile(lpszConfigFile);
+ CopyFile(_T("./XEngine_Config/XEngine_Config.bak"), lpszConfigFile, FALSE);
+}
+
+
+void CDialog_Configure::OnBnClickedRadio2()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ m_RadioKeyPass.SetCheck(0);
+ m_RadioKeyDisable.SetCheck(1);
+
+ m_EditPass.EnableWindow(FALSE);
+}
+
+
+void CDialog_Configure::OnBnClickedRadio1()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ m_RadioKeyPass.SetCheck(1);
+ m_RadioKeyDisable.SetCheck(0);
+
+ m_EditPass.EnableWindow(TRUE);
+}
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Configure.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Configure.h
new file mode 100644
index 0000000000000000000000000000000000000000..0ef054faa0661967251db48dc376472ecb1b8fc7
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Configure.h
@@ -0,0 +1,49 @@
+#pragma once
+
+
+// CDialog_Configure 对话框
+
+class CDialog_Configure : public CDialogEx
+{
+ DECLARE_DYNAMIC(CDialog_Configure)
+
+public:
+ CDialog_Configure(CWnd* pParent = nullptr); // 标准构造函数
+ virtual ~CDialog_Configure();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_DIALOG_CONFIG };
+#endif
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+ DECLARE_MESSAGE_MAP()
+public:
+ void AuthorizeService_ReadConfigure();
+ void AuthorizeService_WriteConfigure();
+public:
+ virtual BOOL OnInitDialog();
+ CEdit m_EditServicePort;
+ CEdit m_EditThreadPool;
+ CEdit m_EditVerTimedout;
+ CEdit m_EditPass;
+ CButton m_BtnAutoStart;
+ CButton m_BtnAutoStop;
+ CComboBox m_ComboRegTry;
+ CComboBox m_ComboListAuth;
+ CButton m_RadioKeyPass;
+ CButton m_RadioKeyDisable;
+ CEdit m_EditTryTime;
+ CEdit m_EditAuthTime;
+ CEdit m_EditSmtpAddr;
+ CEdit m_EditFromAddr;
+ CEdit m_EditSmtpUser;
+ CEdit m_EditSmtpPass;
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnBnClickedButton3();
+ afx_msg void OnBnClickedRadio2();
+ afx_msg void OnBnClickedRadio1();
+};
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Local.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Local.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4601e287fc38abc733167fdee02919f8b5fbc0af
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Local.cpp
@@ -0,0 +1,277 @@
+// CDialog_Local.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "../XEngine_AuthorizeApp.h"
+#include "CDialog_Local.h"
+#include "afxdialogex.h"
+
+
+// CDialog_Local 对话框
+
+IMPLEMENT_DYNAMIC(CDialog_Local, CDialogEx)
+
+CDialog_Local::CDialog_Local(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG_LOCAL, pParent)
+{
+
+}
+
+CDialog_Local::~CDialog_Local()
+{
+}
+
+void CDialog_Local::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_EDIT2, m_EditKeyFile);
+ DDX_Control(pDX, IDC_EDIT3, m_EditPass);
+ DDX_Control(pDX, IDC_EDIT1, m_EditAPPName);
+ DDX_Control(pDX, IDC_EDIT11, m_EditAPPVersion);
+ DDX_Control(pDX, IDC_COMBO1, m_ComboHWType);
+ DDX_Control(pDX, IDC_COMBO2, m_ComboRegType);
+ DDX_Control(pDX, IDC_COMBO4, m_ComboSerialType);
+ DDX_Control(pDX, IDC_EDIT4, m_EditMachineCode);
+ DDX_Control(pDX, IDC_EDIT5, m_EditRegTime);
+ DDX_Control(pDX, IDC_EDIT12, m_EditHaveTime);
+ DDX_Control(pDX, IDC_EDIT13, m_EditLeftTime);
+ DDX_Control(pDX, IDC_EDIT7, m_EditUser);
+ DDX_Control(pDX, IDC_EDIT8, m_EditContact);
+ DDX_Control(pDX, IDC_EDIT9, m_EditCustomInfo);
+ DDX_Control(pDX, IDC_EDIT10, m_EditPort);
+ DDX_Control(pDX, IDC_IPADDRESS1, m_EditIPAddr);
+ DDX_Control(pDX, IDC_EDIT14, m_EditCreateTime);
+}
+
+
+BEGIN_MESSAGE_MAP(CDialog_Local, CDialogEx)
+ ON_BN_CLICKED(IDC_BUTTON2, &CDialog_Local::OnBnClickedButton2)
+ ON_EN_CHANGE(IDC_EDIT4, &CDialog_Local::OnEnChangeEdit4)
+ ON_BN_CLICKED(IDC_BUTTON3, &CDialog_Local::OnBnClickedButton3)
+ ON_EN_CHANGE(IDC_EDIT12, &CDialog_Local::OnEnChangeEdit12)
+END_MESSAGE_MAP()
+
+
+// CDialog_Local 消息处理程序
+
+BOOL CDialog_Local::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // TODO: 在此添加额外的初始化
+ m_ComboHWType.InsertString(0, _T("未指定"));
+ m_ComboHWType.InsertString(1, _T("CPU"));
+ m_ComboHWType.InsertString(2, _T("硬盘"));
+ m_ComboHWType.InsertString(3, _T("主板"));
+ m_ComboHWType.InsertString(4, _T("网卡"));
+ m_ComboHWType.SetCurSel(0);
+
+ m_ComboSerialType.InsertString(0, _T("不支持"));
+ m_ComboSerialType.InsertString(1, _T("分钟"));
+ m_ComboSerialType.InsertString(2, _T("天数"));
+ m_ComboSerialType.InsertString(3, _T("次数"));
+ m_ComboSerialType.InsertString(4, _T("自定义"));
+ m_ComboSerialType.SetCurSel(0);
+
+ m_ComboRegType.InsertString(0, _T("未注册"));
+ m_ComboRegType.InsertString(1, _T("临时"));
+ m_ComboRegType.InsertString(2, _T("试用"));
+ m_ComboRegType.InsertString(3, _T("正式版"));
+ m_ComboRegType.InsertString(4, _T("无限制版"));
+ m_ComboRegType.SetCurSel(0);
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 异常: OCX 属性页应返回 FALSE
+}
+
+
+void CDialog_Local::OnBnClickedButton2()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ CString m_StrPass;
+ UCHAR tszEnBuffer[2048];
+ TCHAR tszDeBuffer[2048];
+ XENGINE_AUTHORIZE_LOCAL st_AuthLocal;
+
+ m_EditPass.GetWindowText(m_StrPass);
+
+ CFileDialog m_FileDlg(TRUE, _T(".CDKey"), NULL, NULL, _T("CDKey文件(*.key)|*.key|所有文件(*.*)|*.*||"));
+ if (IDCANCEL == m_FileDlg.DoModal())
+ {
+ return;
+ }
+ CString m_StrFile = m_FileDlg.GetPathName();
+ m_EditKeyFile.SetWindowText(m_StrFile);
+
+ memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
+ memset(tszEnBuffer, '\0', sizeof(tszEnBuffer));
+ memset(&st_AuthLocal, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));
+
+ if (!m_StrPass.IsEmpty())
+ {
+ FILE* pSt_File = fopen(m_StrFile.GetBuffer(), "rb");
+ if (NULL == pSt_File)
+ {
+ AfxMessageBox(_T("文件打开失败"));
+ return;
+ }
+ int nRet = fread(tszEnBuffer, 1, sizeof(tszEnBuffer), pSt_File);
+ fclose(pSt_File);
+ if (!OPenSsl_Api_CryptDecodec(tszEnBuffer, tszDeBuffer, &nRet, m_StrPass.GetBuffer(), XENGINE_OPENSSL_API_CRYPT_3DES))
+ {
+ AfxMessageBox(_T("解密失败"));
+ return;
+ }
+ pSt_File = fopen(m_StrFile.GetBuffer(), "wb");
+ fwrite(tszDeBuffer, 1, nRet, pSt_File);
+ fclose(pSt_File);
+ }
+ if (!Authorize_Local_ReadKey(m_StrFile.GetBuffer(), &st_AuthLocal))
+ {
+ AfxMessageBox(_T("读取CDKEY失败"));
+ return;
+ }
+ TCHAR tszTmp[64];
+ memset(tszTmp, '\0', sizeof(tszTmp));
+
+ _stprintf(tszTmp, _T("%d"), st_AuthLocal.nPort);
+ m_EditPort.SetWindowText(tszTmp);
+ m_EditIPAddr.SetWindowText(st_AuthLocal.tszAddr);
+
+ m_EditAPPName.SetWindowText(st_AuthLocal.st_AuthAppInfo.tszAppName);
+ m_EditAPPVersion.SetWindowText(st_AuthLocal.st_AuthAppInfo.tszAppVer);
+
+ m_ComboHWType.SetCurSel(st_AuthLocal.st_AuthRegInfo.enHWType);
+ m_ComboRegType.SetCurSel(st_AuthLocal.st_AuthRegInfo.enRegType);
+ m_ComboSerialType.SetCurSel(st_AuthLocal.st_AuthRegInfo.enSerialType);
+ m_EditMachineCode.SetWindowText(st_AuthLocal.st_AuthRegInfo.tszHardware);
+ m_EditRegTime.SetWindowText(st_AuthLocal.st_AuthRegInfo.tszRegisterTime);
+ m_EditCreateTime.SetWindowText(st_AuthLocal.st_AuthRegInfo.tszCreateTime);
+ m_EditLeftTime.SetWindowText(st_AuthLocal.st_AuthRegInfo.tszLeftTime);
+ memset(tszTmp, '\0', sizeof(tszTmp));
+ _stprintf(tszTmp, _T("%lld"), st_AuthLocal.st_AuthRegInfo.nHasTime);
+ m_EditHaveTime.SetWindowText(tszTmp);
+
+ m_EditUser.SetWindowText(st_AuthLocal.st_AuthUserInfo.tszUserName);
+ m_EditContact.SetWindowText(st_AuthLocal.st_AuthUserInfo.tszUserContact);
+ m_EditCustomInfo.SetWindowText(st_AuthLocal.st_AuthUserInfo.tszCustom);
+}
+
+
+
+void CDialog_Local::OnEnChangeEdit4()
+{
+ // TODO: 如果该控件是 RICHEDIT 控件,它将不
+ // 发送此通知,除非重写 CDialogEx::OnInitDialog()
+ // 函数并调用 CRichEditCtrl().SetEventMask(),
+ // 同时将 ENM_CHANGE 标志“或”运算到掩码中。
+
+ // TODO: 在此添加控件通知处理程序代码
+}
+
+void CDialog_Local::Dialog_Local_GetInfo(XENGINE_AUTHORIZE_LOCAL *pSt_AuthLocal)
+{
+ CString m_StrPort;
+ CString m_StrHaveTime;
+ XENGINE_AUTHORIZE_LOCAL st_AuthLocal;
+
+ memset(&st_AuthLocal, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));
+
+ st_AuthLocal.st_AuthAppInfo.bInit = TRUE;
+ m_EditAPPName.GetWindowText(st_AuthLocal.st_AuthAppInfo.tszAppName, sizeof(st_AuthLocal.st_AuthAppInfo.tszAppName));
+ m_EditAPPVersion.GetWindowText(st_AuthLocal.st_AuthAppInfo.tszAppVer, sizeof(st_AuthLocal.st_AuthAppInfo.tszAppVer));
+
+ m_EditIPAddr.GetWindowText(st_AuthLocal.tszAddr, sizeof(st_AuthLocal.tszAddr));
+ m_EditPort.GetWindowText(m_StrPort);
+ st_AuthLocal.nPort = _ttoi(m_StrPort.GetBuffer());
+
+ st_AuthLocal.st_AuthRegInfo.enHWType = (ENUM_HELPCOMPONENTS_AUTHORIZE_HW_TYPE)m_ComboHWType.GetCurSel();
+ st_AuthLocal.st_AuthRegInfo.enRegType = (ENUM_HELPCOMPONENTS_AUTHORIZE_REG_TYPE)m_ComboRegType.GetCurSel();
+ st_AuthLocal.st_AuthRegInfo.enSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)m_ComboSerialType.GetCurSel();
+ m_EditMachineCode.GetWindowText(st_AuthLocal.st_AuthRegInfo.tszHardware, sizeof(st_AuthLocal.st_AuthRegInfo.tszHardware));
+ m_EditRegTime.GetWindowText(st_AuthLocal.st_AuthRegInfo.tszRegisterTime, sizeof(st_AuthLocal.st_AuthRegInfo.tszRegisterTime));
+ m_EditCreateTime.GetWindowText(st_AuthLocal.st_AuthRegInfo.tszCreateTime, sizeof(st_AuthLocal.st_AuthRegInfo.tszCreateTime));
+ m_EditLeftTime.GetWindowText(st_AuthLocal.st_AuthRegInfo.tszLeftTime, sizeof(st_AuthLocal.st_AuthRegInfo.tszLeftTime));
+ m_EditHaveTime.GetWindowText(m_StrHaveTime);
+ st_AuthLocal.st_AuthRegInfo.nHasTime = _ttoi(m_StrHaveTime.GetBuffer());
+
+ m_EditUser.GetWindowText(st_AuthLocal.st_AuthUserInfo.tszUserName, sizeof(st_AuthLocal.st_AuthUserInfo.tszUserName));
+ m_EditContact.GetWindowText(st_AuthLocal.st_AuthUserInfo.tszUserContact, sizeof(st_AuthLocal.st_AuthUserInfo.tszUserContact));
+ m_EditCustomInfo.GetWindowText(st_AuthLocal.st_AuthUserInfo.tszCustom, sizeof(st_AuthLocal.st_AuthUserInfo.tszCustom));
+
+ memcpy(pSt_AuthLocal, &st_AuthLocal, sizeof(XENGINE_AUTHORIZE_LOCAL));
+}
+
+void CDialog_Local::OnBnClickedButton3()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ CFileDialog m_FileDlg(FALSE, _T(".CDKey"), NULL, NULL, _T("CDKey文件(*.key)|*.key|所有文件(*.*)|*.*||"));
+ if (IDCANCEL == m_FileDlg.DoModal())
+ {
+ return;
+ }
+ CString m_StrFile = m_FileDlg.GetPathName();
+ m_EditKeyFile.SetWindowText(m_StrFile);
+
+ CString m_StrPass;
+ UCHAR tszEnBuffer[2048];
+ TCHAR tszDeBuffer[2048];
+ XENGINE_AUTHORIZE_LOCAL st_AuthLocal;
+
+ memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
+ memset(tszEnBuffer, '\0', sizeof(tszEnBuffer));
+ memset(&st_AuthLocal, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));
+
+ m_EditPass.GetWindowText(m_StrPass);
+
+ Dialog_Local_GetInfo(&st_AuthLocal);
+ if (!Authorize_Local_WriteKey(m_StrFile.GetBuffer(), &st_AuthLocal))
+ {
+ AfxMessageBox(_T("写入CDKEY失败"));
+ return;
+ }
+ if (!m_StrPass.IsEmpty())
+ {
+ FILE* pSt_File = fopen(m_StrFile.GetBuffer(), "rb");
+ int nRet = fread(tszDeBuffer, 1, sizeof(tszDeBuffer), pSt_File);
+ fclose(pSt_File);
+ if (!OPenSsl_Api_CryptEncodec(tszDeBuffer, tszEnBuffer, &nRet, m_StrPass.GetBuffer(), XENGINE_OPENSSL_API_CRYPT_3DES))
+ {
+ AfxMessageBox(_T("加密失败"));
+ return;
+ }
+ pSt_File = fopen(m_StrFile.GetBuffer(), "wb");
+ fwrite(tszEnBuffer, 1, nRet, pSt_File);
+ fclose(pSt_File);
+ }
+}
+
+void CDialog_Local::OnEnChangeEdit12()
+{
+ // TODO: 如果该控件是 RICHEDIT 控件,它将不
+ // 发送此通知,除非重写 CDialogEx::OnInitDialog()
+ // 函数并调用 CRichEditCtrl().SetEventMask(),
+ // 同时将 ENM_CHANGE 标志“或”运算到掩码中。
+
+ // TODO: 在此添加控件通知处理程序代码
+ XENGINE_AUTHORIZE_LOCAL st_AuthLocal;
+ memset(&st_AuthLocal, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));
+
+ Dialog_Local_GetInfo(&st_AuthLocal);
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM == st_AuthLocal.st_AuthRegInfo.enSerialType)
+ {
+ CString m_StrHaveTime;
+ XENGINE_LIBTIMER st_LibTime;
+
+ memset(&st_LibTime, '\0', sizeof(XENGINE_LIBTIMER));
+ m_EditHaveTime.GetWindowText(m_StrHaveTime);
+
+ BaseLib_OperatorTime_StrToStuTime(m_StrHaveTime.GetBuffer(), &st_LibTime);
+ Authorize_Local_BuildKeyTime(&st_AuthLocal, NULL, &st_LibTime);
+ }
+ else
+ {
+ Authorize_Local_BuildKeyTime(&st_AuthLocal, st_AuthLocal.st_AuthRegInfo.nHasTime);
+ }
+ m_EditRegTime.SetWindowText(st_AuthLocal.st_AuthRegInfo.tszRegisterTime);
+ m_EditLeftTime.SetWindowText(st_AuthLocal.st_AuthRegInfo.tszLeftTime);
+}
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Local.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Local.h
new file mode 100644
index 0000000000000000000000000000000000000000..b5aa79352c47ad2df16a39230223df29f16f2729
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Local.h
@@ -0,0 +1,47 @@
+#pragma once
+
+
+// CDialog_Local 对话框
+
+class CDialog_Local : public CDialogEx
+{
+ DECLARE_DYNAMIC(CDialog_Local)
+
+public:
+ CDialog_Local(CWnd* pParent = nullptr); // 标准构造函数
+ virtual ~CDialog_Local();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_DIALOG_LOCAL };
+#endif
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnBnClickedButton2();
+ CEdit m_EditKeyFile;
+ CEdit m_EditPass;
+ CEdit m_EditAPPName;
+ CEdit m_EditAPPVersion;
+ CComboBox m_ComboHWType;
+ CComboBox m_ComboRegType;
+ virtual BOOL OnInitDialog();
+ CComboBox m_ComboSerialType;
+ afx_msg void OnEnChangeEdit4();
+ CEdit m_EditMachineCode;
+ CEdit m_EditRegTime;
+ CEdit m_EditHaveTime;
+ CEdit m_EditLeftTime;
+ CEdit m_EditUser;
+ CEdit m_EditContact;
+ CEdit m_EditCustomInfo;
+ CEdit m_EditPort;
+ CIPAddressCtrl m_EditIPAddr;
+ afx_msg void OnBnClickedButton3();
+ afx_msg void OnEnChangeEdit12();
+ void Dialog_Local_GetInfo(XENGINE_AUTHORIZE_LOCAL* pSt_AuthLocal);
+ CEdit m_EditCreateTime;
+};
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Serial.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Serial.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2cc263645fe8723935cf57ae4235827f7904e7e6
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Serial.cpp
@@ -0,0 +1,235 @@
+// CDialog_Serial.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "../XEngine_AuthorizeApp.h"
+#include "CDialog_Serial.h"
+#include "afxdialogex.h"
+
+
+// CDialog_Serial 对话框
+
+IMPLEMENT_DYNAMIC(CDialog_Serial, CDialogEx)
+
+CDialog_Serial::CDialog_Serial(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG_SERIAL, pParent)
+{
+
+}
+
+CDialog_Serial::~CDialog_Serial()
+{
+}
+
+void CDialog_Serial::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_ListSerial);
+ DDX_Control(pDX, IDC_COMBO1, m_ComboSerialType);
+ DDX_Control(pDX, IDC_COMBO3, m_ComboNumber);
+ DDX_Control(pDX, IDC_EDIT1, m_EditHowCard);
+ DDX_Control(pDX, IDC_EDIT11, m_EditCardTime);
+}
+
+
+BEGIN_MESSAGE_MAP(CDialog_Serial, CDialogEx)
+ ON_BN_CLICKED(IDC_BUTTON2, &CDialog_Serial::OnBnClickedButton2)
+ ON_BN_CLICKED(IDC_BUTTON3, &CDialog_Serial::OnBnClickedButton3)
+ ON_BN_CLICKED(IDC_BUTTON4, &CDialog_Serial::OnBnClickedButton4)
+END_MESSAGE_MAP()
+
+
+// CDialog_Serial 消息处理程序
+
+
+BOOL CDialog_Serial::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // TODO: 在此添加额外的初始化
+ m_ListSerial.InsertColumn(0, _T("使用者"), LVCFMT_LEFT, 80);
+ m_ListSerial.InsertColumn(1, _T("序列号"), LVCFMT_LEFT, 180);
+ m_ListSerial.InsertColumn(2, _T("使用时间/次数"), LVCFMT_LEFT, 100);
+ m_ListSerial.InsertColumn(3, _T("卡类型"), LVCFMT_LEFT, 80);
+ m_ListSerial.InsertColumn(4, _T("是否使用"), LVCFMT_LEFT, 60);
+ m_ListSerial.InsertColumn(5, _T("创建日期"), LVCFMT_LEFT, 100);
+ m_ListSerial.SetExtendedStyle(LVS_EX_FULLROWSELECT);
+
+ m_ComboSerialType.InsertString(0, _T("分钟卡"));
+ m_ComboSerialType.InsertString(1, _T("天卡"));
+ m_ComboSerialType.InsertString(2, _T("次数卡"));
+ m_ComboSerialType.InsertString(3, _T("自定义"));
+
+ m_ComboNumber.InsertString(0, _T("4"));
+ m_ComboNumber.InsertString(1, _T("5"));
+ m_ComboNumber.InsertString(2, _T("6"));
+ m_ComboNumber.InsertString(3, _T("7"));
+ m_ComboNumber.InsertString(4, _T("8"));
+ m_ComboNumber.InsertString(5, _T("9"));
+ m_ComboNumber.InsertString(6, _T("10"));
+
+ m_ComboNumber.SetCurSel(0);
+ m_ComboSerialType.SetCurSel(0);
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 异常: OCX 属性页应返回 FALSE
+}
+
+void CDialog_Serial::SerialManage_Flush()
+{
+ int nListCount = 0;
+ AUTHREG_SERIALTABLE** ppSt_SerialTable;
+ if (!AuthService_SQLPacket_SerialQueryAll(&ppSt_SerialTable, &nListCount))
+ {
+ if (ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_NONE == SQLPacket_GetLastError())
+ {
+ return;
+ }
+ AfxMessageBox(_T("获取失败!未知错误!"));
+ return;
+ }
+ m_ListSerial.DeleteAllItems();
+
+ for (int i = 0; i < nListCount; i++)
+ {
+ m_ListSerial.InsertItem(i, _T(""));
+ m_ListSerial.SetItemText(i, 0, ppSt_SerialTable[i]->tszUserName);
+ m_ListSerial.SetItemText(i, 1, ppSt_SerialTable[i]->tszSerialNumber);
+ m_ListSerial.SetItemText(i, 2, ppSt_SerialTable[i]->tszMaxTime);
+ switch (ppSt_SerialTable[i]->en_AuthRegSerialType)
+ {
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE:
+ {
+ LPCTSTR lpszCardName = _T("分钟卡");
+ m_ListSerial.SetItemText(i, 3, lpszCardName);
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_DAY:
+ {
+ LPCTSTR lpszCardName = _T("天数卡");
+ m_ListSerial.SetItemText(i, 3, lpszCardName);
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME:
+ {
+ LPCTSTR lpszCardName = _T("次数卡");
+ m_ListSerial.SetItemText(i, 3, lpszCardName);
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM:
+ {
+ LPCTSTR lpszCardName = _T("自定义卡");
+ m_ListSerial.SetItemText(i, 3, lpszCardName);
+ }
+ break;
+ default:
+ break;
+ }
+ if (ppSt_SerialTable[i]->bIsUsed)
+ {
+ m_ListSerial.SetItemText(i, 4, _T("是"));
+ }
+ else
+ {
+ m_ListSerial.SetItemText(i, 4, _T("否"));
+ }
+ m_ListSerial.SetItemText(i, 5, ppSt_SerialTable[i]->tszCreateTime);
+ }
+ BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_SerialTable, nListCount);
+}
+void CDialog_Serial::OnBnClickedButton2()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ LPCTSTR lpszUserHdr = _T("XAUTH");
+ CString m_StrHowCard;
+ CString m_StrTimeCard;
+ CString m_StrCardNumber;
+ XENGINE_LIBTIMER st_AuthTimer;
+ memset(&st_AuthTimer, '\0', sizeof(st_AuthTimer));
+
+ m_ComboNumber.GetLBText(m_ComboNumber.GetCurSel(), m_StrCardNumber);
+ m_EditHowCard.GetWindowText(m_StrHowCard);
+ m_EditCardTime.GetWindowText(m_StrTimeCard);
+
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)(m_ComboSerialType.GetCurSel() + 1);
+ //生成序列卡
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE == enSerialType)
+ {
+ st_AuthTimer.wMinute = _ttoi(m_StrTimeCard.GetBuffer());
+ }
+ else if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_DAY == enSerialType)
+ {
+ st_AuthTimer.wDay = _ttoi(m_StrTimeCard.GetBuffer());
+ }
+ else if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == enSerialType)
+ {
+ st_AuthTimer.wFlags = _ttoi(m_StrTimeCard.GetBuffer());
+ }
+ else if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM == enSerialType)
+ {
+ if (6 != _stscanf_s(m_StrTimeCard.GetBuffer(), _T("%04d-%02d-%02d %02d:%02d:%02d"), &st_AuthTimer.wYear, &st_AuthTimer.wMonth, &st_AuthTimer.wDay, &st_AuthTimer.wHour, &st_AuthTimer.wMinute, &st_AuthTimer.wSecond))
+ {
+ AfxMessageBox(_T("自定义日期格式错误"));
+ return;
+ }
+ }
+ else
+ {
+ AfxMessageBox(_T("生成失败!"));
+ return;
+ }
+ TCHAR** pptszSerialNumber;
+ if (!Authorize_Serial_Creator(&pptszSerialNumber, lpszUserHdr, _ttoi(m_StrHowCard.GetBuffer()), _ttoi(m_StrCardNumber.GetBuffer()), &st_AuthTimer, enSerialType))
+ {
+ AfxMessageBox(_T("生成失败!"));
+ return;
+ }
+ //导入序列卡
+ for (int i = 0; i < _ttoi(m_StrHowCard.GetBuffer()); i++)
+ {
+ TCHAR tszSerialCard[MAX_PATH];
+ memset(tszSerialCard, '\0', MAX_PATH);
+ AuthService_SQLPacket_SerialInsert(pptszSerialNumber[i]);
+ }
+ AfxMessageBox(_T("插入成功"));
+ SerialManage_Flush();
+}
+
+
+void CDialog_Serial::OnBnClickedButton3()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ POSITION pSt_Sition = m_ListSerial.GetFirstSelectedItemPosition();
+ int nSelect = m_ListSerial.GetNextSelectedItem(pSt_Sition);
+ if (nSelect < 0)
+ {
+ AfxMessageBox(_T("你没有选择序列号!"));
+ return;
+ }
+ CString m_Str = m_ListSerial.GetItemText(nSelect, 1);
+ if (!NetCore_PIPClipBoard_Set(m_Str.GetBuffer(), m_Str.GetLength()))
+ {
+ AfxMessageBox(_T("复制失败!"));
+ return;
+ }
+ AfxMessageBox(_T("复制成功!"));
+}
+
+
+void CDialog_Serial::OnBnClickedButton4()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ POSITION pSt_Sition = m_ListSerial.GetFirstSelectedItemPosition();
+ int nItemCount = m_ListSerial.GetNextSelectedItem(pSt_Sition);
+ if (nItemCount < 0)
+ {
+ AfxMessageBox(_T("你没有选择任何充值卡!"));
+ return;
+ }
+ CString m_StrSerial = m_ListSerial.GetItemText(nItemCount, 1);
+ if (!AuthService_SQLPacket_SerialDelete(m_StrSerial.GetBuffer()))
+ {
+ AfxMessageBox(_T("删除失败!"));
+ return;
+ }
+ m_ListSerial.DeleteItem(nItemCount);
+}
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Serial.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Serial.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a45ab4d7d9b20fd1975cc967d58e2852631ecd0
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_Serial.h
@@ -0,0 +1,35 @@
+#pragma once
+
+
+// CDialog_Serial 对话框
+
+class CDialog_Serial : public CDialogEx
+{
+ DECLARE_DYNAMIC(CDialog_Serial)
+
+public:
+ CDialog_Serial(CWnd* pParent = nullptr); // 标准构造函数
+ virtual ~CDialog_Serial();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_DIALOG_SERIAL };
+#endif
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+ DECLARE_MESSAGE_MAP()
+public:
+ void SerialManage_Flush();
+public:
+ CListCtrl m_ListSerial;
+ CComboBox m_ComboSerialType;
+ CComboBox m_ComboNumber;
+ CEdit m_EditHowCard;
+ CEdit m_EditCardTime;
+ virtual BOOL OnInitDialog();
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnBnClickedButton3();
+ afx_msg void OnBnClickedButton4();
+};
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_User.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_User.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4b0aa891158c9422c1813177eba95398daedfa9e
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_User.cpp
@@ -0,0 +1,241 @@
+// CDialog_User.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "../XEngine_AuthorizeApp.h"
+#include "CDialog_User.h"
+#include "afxdialogex.h"
+
+
+// CDialog_User 对话框
+
+IMPLEMENT_DYNAMIC(CDialog_User, CDialogEx)
+
+CDialog_User::CDialog_User(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_DIALOG_USER, pParent)
+{
+
+}
+
+CDialog_User::~CDialog_User()
+{
+}
+
+void CDialog_User::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_ListCtrlOnlineClient);
+ DDX_Control(pDX, IDC_EDIT1, m_EidtSendMsg);
+}
+
+
+BEGIN_MESSAGE_MAP(CDialog_User, CDialogEx)
+ ON_BN_CLICKED(IDC_BUTTON1, &CDialog_User::OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, &CDialog_User::OnBnClickedButton2)
+ ON_BN_CLICKED(IDC_BUTTON3, &CDialog_User::OnBnClickedButton3)
+ ON_BN_CLICKED(IDC_BUTTON4, &CDialog_User::OnBnClickedButton4)
+ ON_BN_CLICKED(IDC_BUTTON5, &CDialog_User::OnBnClickedButton5)
+END_MESSAGE_MAP()
+
+
+// CDialog_User 消息处理程序
+
+
+BOOL CDialog_User::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // TODO: 在此添加额外的初始化
+ m_ListCtrlOnlineClient.InsertColumn(0, _T("序号"), LVCFMT_LEFT, 60);
+ m_ListCtrlOnlineClient.InsertColumn(1, _T("用户名"), LVCFMT_LEFT, 100);
+ m_ListCtrlOnlineClient.InsertColumn(2, _T("地址"), LVCFMT_LEFT, 110);
+ m_ListCtrlOnlineClient.InsertColumn(3, _T("在线时间(分钟)"), LVCFMT_LEFT, 100);
+ m_ListCtrlOnlineClient.InsertColumn(4, _T("剩余时间/过期时间"), LVCFMT_LEFT, 120);
+ m_ListCtrlOnlineClient.InsertColumn(5, _T("充值类型"), LVCFMT_LEFT, 100);
+ m_ListCtrlOnlineClient.SetExtendedStyle(LVS_EX_FULLROWSELECT);
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 异常: OCX 属性页应返回 FALSE
+}
+
+void CDialog_User::Dialog_User_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszRecvMsg, int nMsgLen)
+{
+ AUTHREG_USERTABLE st_UserTable;
+ memset(&st_UserTable, '\0', sizeof(st_UserTable));
+
+ memcpy_s(&st_UserTable, sizeof(st_UserTable), lpszRecvMsg, sizeof(st_UserTable));
+
+ int nItemCount = m_ListCtrlOnlineClient.GetItemCount();
+ m_ListCtrlOnlineClient.InsertItem(nItemCount, _T(""));
+
+ TCHAR tszIndex[10];
+ memset(tszIndex, '\0', 10);
+ _itot_s(nItemCount, tszIndex, 10);
+ m_ListCtrlOnlineClient.SetItemText(nItemCount, 0, tszIndex);
+ m_ListCtrlOnlineClient.SetItemText(nItemCount, 1, st_UserTable.st_UserInfo.tszUserName);
+ m_ListCtrlOnlineClient.SetItemText(nItemCount, 2, lpszClientAddr);
+ m_ListCtrlOnlineClient.SetItemText(nItemCount, 3, st_UserTable.tszLeftTime);
+ m_ListCtrlOnlineClient.SetItemText(nItemCount, 4, _T("0"));
+}
+
+void CDialog_User::Dialog_User_Leave(LPCTSTR lpszClientAddr)
+{
+ CString m_StrAddr;
+ for (int i = 0; i < m_ListCtrlOnlineClient.GetItemCount(); i++)
+ {
+ m_StrAddr = m_ListCtrlOnlineClient.GetItemText(i, 2);
+ if (0 == _tcsncmp(m_StrAddr.GetBuffer(), lpszClientAddr, m_StrAddr.GetLength()))
+ {
+ m_ListCtrlOnlineClient.DeleteItem(i);
+ break;
+ }
+ }
+}
+
+void CDialog_User::Dialog_User_Set(LPCTSTR lpszClientAddr, LPAUTHREG_USERTABLE pSt_UserTable)
+{
+ CString m_StrAddr;
+ for (int i = 0; i < m_ListCtrlOnlineClient.GetItemCount(); i++)
+ {
+ m_StrAddr = m_ListCtrlOnlineClient.GetItemText(i, 2);
+ if (0 == _tcsncmp(m_StrAddr.GetBuffer(), lpszClientAddr, m_StrAddr.GetLength()))
+ {
+ m_ListCtrlOnlineClient.SetItemText(i, 3, pSt_UserTable->tszLeftTime);
+ break;
+ }
+ }
+}
+
+void CDialog_User::OnBnClickedButton1()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ POSITION pSt_Sition = m_ListCtrlOnlineClient.GetFirstSelectedItemPosition();
+ int nSelect = m_ListCtrlOnlineClient.GetNextSelectedItem(pSt_Sition);
+ if (nSelect < 0)
+ {
+ AfxMessageBox(_T("你没有选择任何客户!"));
+ return;
+ }
+ CString m_Str = m_ListCtrlOnlineClient.GetItemText(nSelect, 2);
+ if (XEngine_CloseClient(m_Str.GetBuffer(), this))
+ {
+ AfxMessageBox(_T("成功移除客户端"));
+ }
+ else
+ {
+ AfxMessageBox(_T("移除客户端失败"));
+ }
+}
+
+
+void CDialog_User::OnBnClickedButton2()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ POSITION pSt_Sition = m_ListCtrlOnlineClient.GetFirstSelectedItemPosition();
+ int nItemCount = m_ListCtrlOnlineClient.GetNextSelectedItem(pSt_Sition);
+ if (nItemCount < 0)
+ {
+ AfxMessageBox(_T("你没有选择任何用户!"));
+ return;
+ }
+ CString m_StrSerial = m_ListCtrlOnlineClient.GetItemText(nItemCount, 4);
+ if (nItemCount <= 0)
+ {
+ AfxMessageBox(_T("你没有选择任何用户!"));
+ return;
+ }
+ AfxMessageBox(_T("暂时不支持!"));
+}
+
+
+void CDialog_User::OnBnClickedButton3()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ POSITION pSt_Sition = m_ListCtrlOnlineClient.GetFirstSelectedItemPosition();
+ int nSelect = m_ListCtrlOnlineClient.GetNextSelectedItem(pSt_Sition);
+ CString m_StrMsg;
+ if (nSelect < 0)
+ {
+ AfxMessageBox(_T("你没有选择任何用户!"));
+ return;
+ }
+ if (IDOK != AfxMessageBox(_T("删除用户后此用户不可恢复,是否确定删除?"), MB_OKCANCEL))
+ {
+ return;
+ }
+ m_StrMsg = m_ListCtrlOnlineClient.GetItemText(nSelect, 2);
+
+ if (XEngine_CloseClient(m_StrMsg.GetBuffer(), this))
+ {
+ AfxMessageBox(_T("删除客户成功!"));
+ }
+ else
+ {
+ AfxMessageBox(_T("删除客户失败!"));
+ }
+}
+
+
+void CDialog_User::OnBnClickedButton4()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ POSITION pSt_Sition = m_ListCtrlOnlineClient.GetFirstSelectedItemPosition();
+ int nSelect = m_ListCtrlOnlineClient.GetNextSelectedItem(pSt_Sition);
+ CString m_StrMsg;
+ m_EidtSendMsg.GetWindowText(m_StrMsg);
+ if (nSelect < 0)
+ {
+ AfxMessageBox(_T("发送消息失败!未选择客户端"));
+ return;
+ }
+ else
+ {
+ int nMsgLen = 4096;
+ TCHAR tszMsgBuffer[4096];
+ XENGINE_PROTOCOLHDR st_ProtocolHdr;
+
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+
+ st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
+ st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH;
+ st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_NOTIFYMSG;
+ st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
+ st_ProtocolHdr.unPacketSize = m_StrMsg.GetLength();
+
+ CString m_StrAddr = m_ListCtrlOnlineClient.GetItemText(nSelect, 2);
+ if (XEngine_SendMsg(m_StrAddr.GetBuffer(), &st_ProtocolHdr, m_StrMsg.GetBuffer(), m_StrMsg.GetLength()))
+ {
+ AfxMessageBox(_T("发送消息成功!"));
+ }
+ }
+ m_EidtSendMsg.SetWindowText(_T(""));
+}
+
+
+void CDialog_User::OnBnClickedButton5()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ CString m_StrMsg;
+ int nMsgLen = 4096;
+ TCHAR tszMsgBuffer[4096];
+ XENGINE_PROTOCOLHDR st_ProtocolHdr;
+
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+
+ m_EidtSendMsg.GetWindowText(m_StrMsg);
+
+ st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
+ st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH;
+ st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_NOTIFYMSG;
+ st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
+ st_ProtocolHdr.unPacketSize = m_StrMsg.GetLength();
+
+ for (int i = 0; i < m_ListCtrlOnlineClient.GetItemCount(); i++)
+ {
+ CString m_StrAddr = m_ListCtrlOnlineClient.GetItemText(i, 2);
+ XEngine_SendMsg(m_StrAddr.GetBuffer(), &st_ProtocolHdr, m_StrMsg.GetBuffer(), m_StrMsg.GetLength());
+ }
+ m_EidtSendMsg.SetWindowText(_T(""));
+ AfxMessageBox(_T("发送消息成功!"));
+}
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_User.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_User.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2eeedef445d3fb8448e5642e81a634e11eaabb6
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/CDialog_User.h
@@ -0,0 +1,36 @@
+#pragma once
+
+
+// CDialog_User 对话框
+
+class CDialog_User : public CDialogEx
+{
+ DECLARE_DYNAMIC(CDialog_User)
+
+public:
+ CDialog_User(CWnd* pParent = nullptr); // 标准构造函数
+ virtual ~CDialog_User();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_DIALOG_USER };
+#endif
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+ DECLARE_MESSAGE_MAP()
+public:
+ void Dialog_User_Insert(LPCTSTR lpszClientAddr, LPCTSTR lpszRecvMsg, int nMsgLen);
+ void Dialog_User_Leave(LPCTSTR lpszClientAddr);
+ void Dialog_User_Set(LPCTSTR lpszClientAddr, LPAUTHREG_USERTABLE pSt_UserTable);
+public:
+ CListCtrl m_ListCtrlOnlineClient;
+ virtual BOOL OnInitDialog();
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnBnClickedButton3();
+ afx_msg void OnBnClickedButton4();
+ CEdit m_EidtSendMsg;
+ afx_msg void OnBnClickedButton5();
+};
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_Task.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_Task.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0b033b1409f3d01bb16e74081fe3ffbefb7a8258
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_Task.cpp
@@ -0,0 +1,437 @@
+#include "pch.h"
+
+XHTHREAD CALLBACK XEngine_AuthService_ThreadClient(LPVOID lParam)
+{
+ XENGINE_THREADINFO* pSt_ThreadInfo = (XENGINE_THREADINFO*)lParam;
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)pSt_ThreadInfo->lPClass;
+ int nThreadPos = pSt_ThreadInfo->nPoolIndex + 1;
+
+ while (pClass_This->bThread)
+ {
+ if (!HelpComponents_Datas_WaitEventEx(xhPacket, nThreadPos))
+ {
+ continue;
+ }
+ int nMsgLen = 2048;
+ TCHAR tszMsgBuffer[2048];
+ XENGINE_PROTOCOLHDR st_ProtocolHdr;
+
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+
+ int nListCount = 0;
+ HELPCOMPONENT_PACKET_CLIENT** ppSt_ListClient;
+ HelpComponents_Datas_GetPoolEx(xhPacket, nThreadPos, &ppSt_ListClient, &nListCount);
+ for (int i = 0; i < nListCount; i++)
+ {
+ if (!HelpComponents_Datas_GetEx(xhPacket, ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, &nMsgLen, &st_ProtocolHdr))
+ {
+ continue;
+ }
+ if ((BST_CHECKED == pClass_This->m_DlgConfig.m_RadioKeyPass.GetCheck()) && (ENUM_XENGINE_PROTOCOLHDR_CRYPTO_TYPE_XCRYPT == st_ProtocolHdr.wCrypto))
+ {
+ CString m_StrPass;
+ TCHAR tszDeBuffer[2048];
+ memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
+
+ pClass_This->m_DlgConfig.m_EditPass.GetWindowText(m_StrPass);
+ OPenSsl_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, m_StrPass.GetBuffer());
+ XEngine_Client_TaskHandle(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, &st_ProtocolHdr, pSt_ThreadInfo->lPClass);
+ }
+ else
+ {
+ XEngine_Client_TaskHandle(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, &st_ProtocolHdr, pSt_ThreadInfo->lPClass);
+ }
+ }
+ BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_ListClient, nListCount);
+ }
+ return 0;
+}
+
+BOOL XEngine_Client_TaskHandle(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPVOID lParam)
+{
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)lParam;
+ //жЭͷβ
+ if ((XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER != pSt_ProtocolHdr->wHeader) || (XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL != pSt_ProtocolHdr->wTail) || (ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH != pSt_ProtocolHdr->unOperatorType))
+ {
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sЭ"), lpszClientAddr);
+ return FALSE;
+ }
+ //ûɾ
+ if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQDEL == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPDEL;
+ if (!AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 211;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sû"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ return FALSE;
+ }
+ if ((st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber) || (0 != _tcsncmp(st_UserTable.st_UserInfo.tszEMailAddr, st_UserInfo.tszEMailAddr, _tcslen(st_UserTable.st_UserInfo.tszEMailAddr))) || (0 != _tcsncmp(st_UserTable.st_UserInfo.tszUserPass, st_UserInfo.tszUserPass, _tcslen(st_UserTable.st_UserInfo.tszUserPass))))
+ {
+ pSt_ProtocolHdr->wReserve = 212;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sעʧ,֤Ϣ"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ //ݿɾļ
+ if (!AuthService_SQLPacket_UserDelete(st_UserInfo.tszUserName))
+ {
+ pSt_ProtocolHdr->wReserve = 213;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sעʧ,ɾϢʧ"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ //עҪɾ¼û
+ AuthService_Session_CloseClient(st_UserInfo.tszUserName);
+ for (int i = 0; i < pClass_This->m_DlgUser.m_ListCtrlOnlineClient.GetItemCount(); i++)
+ {
+ CString m_StrAddr = pClass_This->m_DlgUser.m_ListCtrlOnlineClient.GetItemText(i, 2);
+ if (0 == _tcsnicmp(lpszClientAddr, m_StrAddr.GetBuffer(), _tcslen(lpszClientAddr)))
+ {
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.DeleteItem(i);
+ }
+ }
+
+ pSt_ProtocolHdr->unPacketSize = 0;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sעɹ"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQREGISTER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ //ûע
+ AUTHREG_USERTABLE st_UserTable;
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+
+ memcpy(&st_UserTable.st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPREGISTER;
+ //д
+ CString m_StrTryTime;
+ pClass_This->m_DlgConfig.m_EditTryTime.GetWindowText(m_StrTryTime);
+ //д
+ _tcscpy(st_UserTable.tszLeftTime, m_StrTryTime.GetBuffer());
+ st_UserTable.en_AuthRegSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)pClass_This->m_DlgConfig.m_ComboRegTry.GetCurSel();
+ if (AuthService_SQLPacket_UserRegister(&st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sעɹ"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 231;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sעʧܣ%X"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName, SQLPacket_GetLastError());
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGIN == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERAUTH st_AuthProtocol;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_AuthProtocol, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
+ memcpy(&st_AuthProtocol, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERAUTH));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPLOGIN;
+ if (!AuthService_SQLPacket_UserQuery(st_AuthProtocol.tszUserName, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 251;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%s¼ʧܣû"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ if (0 != _tcsncmp(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcslen(st_AuthProtocol.tszUserPass)))
+ {
+ pSt_ProtocolHdr->wReserve = 252;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%s¼ʧܣ"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ //ֵ
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW == st_UserTable.en_AuthRegSerialType)
+ {
+ pSt_ProtocolHdr->wReserve = 253;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%s¼ʧܣͻʹ"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ if ('0' == st_UserTable.tszLeftTime[0])
+ {
+ pSt_ProtocolHdr->wReserve = 254;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%s¼ʧܣûʣʱ"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ if (!AuthService_Session_Insert(lpszClientAddr, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 255;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%s¼ʧܣỰʧ,:%lX"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+
+ TCHAR tszUserId[64];
+ memset(tszUserId, '\0', sizeof(tszUserId));
+ int nItemCount = pClass_This->m_DlgUser.m_ListCtrlOnlineClient.GetItemCount();
+ if (0 == nItemCount)
+ {
+ _stprintf(tszUserId, _T("%d"), nItemCount);
+ }
+ else
+ {
+ _stprintf(tszUserId, _T("%d"), nItemCount + 1);
+ }
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.InsertItem(nItemCount, tszUserId);
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.SetItemText(nItemCount, 1, st_AuthProtocol.tszUserName);
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.SetItemText(nItemCount, 2, lpszClientAddr);
+
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%s¼ɹ"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQPAY == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_PROTOCOL_USERPAY st_UserPay;
+ memset(&st_UserPay, '\0', sizeof(AUTHREG_PROTOCOL_USERPAY));
+ memcpy(&st_UserPay, lpszMsgBuffer, sizeof(AUTHREG_PROTOCOL_USERPAY));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPPAY;
+ if (AuthService_SQLPacket_UserPay(st_UserPay.tszUserName, st_UserPay.tszSerialNumber))
+ {
+ AUTHREG_USERTABLE st_UserInfo;
+ memset(&st_UserInfo, '\0', sizeof(AUTHREG_USERTABLE));
+ if (AuthService_SQLPacket_UserQuery(st_UserPay.tszUserName, &st_UserInfo))
+ {
+ AuthService_Session_SetUser(&st_UserInfo);
+ }
+ pClass_This->m_DlgSerial.SerialManage_Flush();
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sֵɹкţ%s"), lpszClientAddr, st_UserPay.tszUserName, st_UserPay.tszSerialNumber);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 271;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sֵʧܣ%X"), lpszClientAddr, st_UserPay.tszUserName, SQLPacket_GetLastError());
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETPASS == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+ XENGINE_PROTOCOL_USERAUTH st_AuthProtocol;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+ memset(&st_AuthProtocol, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETPASS;
+ if (!AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 291;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sһʧܣû"), lpszClientAddr, st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ //ȫ֤ж
+ if ((0 != _tcsnicmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcslen(st_UserInfo.tszEMailAddr))) || (st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber))
+ {
+ pSt_ProtocolHdr->wReserve = 292;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sһʧܣ֤Ϣʧ"), lpszClientAddr, st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ _tcscpy(st_AuthProtocol.tszUserName, st_UserTable.st_UserInfo.tszUserName);
+ _tcscpy(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass);
+
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam, (LPCTSTR)&st_AuthProtocol, sizeof(XENGINE_PROTOCOL_USERAUTH));
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sһɹ"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETTIME == pSt_ProtocolHdr->unOperatorCode)
+ {
+ TCHAR tszUserName[128];
+ AUTHREG_PROTOCOL_TIME st_AuthTime;
+
+ memset(tszUserName, '\0', sizeof(tszUserName));
+ memset(&st_AuthTime, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETTIME;
+ AuthService_Session_GetUserForAddr(lpszClientAddr, tszUserName);
+ if (AuthService_Session_GetTimer(tszUserName, &st_AuthTime))
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam, (LPCTSTR)&st_AuthTime, sizeof(AUTHREG_PROTOCOL_TIME));
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sȡʱɹͣ%dʱ䣺%ldʣʱ䣺%ld"), lpszClientAddr, st_AuthTime.tszUserName, st_AuthTime.enSerialType, st_AuthTime.nTimeONLine, st_AuthTime.nTimeLeft);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 0x2B1;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sȡʱʧܣ%X"), lpszClientAddr, st_AuthTime.tszUserName, Session_GetLastError());
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_NOTIFYMSG == pSt_ProtocolHdr->unOperatorCode)
+ {
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sݣС%dݣ%s"), lpszClientAddr, pSt_ProtocolHdr->unPacketSize, lpszMsgBuffer);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQTRYVER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_NETVER st_AuthVer;
+ memset(&st_AuthVer, '\0', sizeof(AUTHREG_NETVER));
+
+ memcpy(st_AuthVer.tszVerSerial, lpszMsgBuffer, pSt_ProtocolHdr->unPacketSize);
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPTRYVER;
+ if (AuthService_SQLPacket_TryQuery(&st_AuthVer))
+ {
+ TCHAR tszEndTime[64];
+ __int64 nTimeSpan = 0;
+ memset(tszEndTime, '\0', sizeof(tszEndTime));
+ //ݷʽʣʱ
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == st_AuthVer.enVerMode)
+ {
+ nTimeSpan = st_AuthVer.nTryTime;
+ }
+ else
+ {
+ //ʱ
+ BaseLib_OperatorTime_ToStringTimer(tszEndTime);
+ BaseLib_OperatorTimeSpan_GetForStr(st_AuthVer.tszVerData, tszEndTime, &nTimeSpan, 2);
+ }
+
+ CString m_StrAuthTime;
+ pClass_This->m_DlgConfig.m_EditAuthTime.GetWindowText(m_StrAuthTime);
+ //Ƿ
+ if (nTimeSpan > _ttoi(m_StrAuthTime.GetBuffer()))
+ {
+ pSt_ProtocolHdr->wReserve = 0x2D1;
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_TIMEDOUT;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sкţ%sʱ֤ʧܣкѾõ"), lpszClientAddr, st_AuthVer.tszVerSerial);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sкţ%sʱ֤ɹʱ:%lld"), lpszClientAddr, st_AuthVer.tszVerSerial, nTimeSpan);
+
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == st_AuthVer.enVerMode)
+ {
+ //Ҫ²ſ
+ st_AuthVer.nTryTime++;
+ AuthService_SQLPacket_TrySet(&st_AuthVer);
+ }
+ }
+ }
+ else
+ {
+ CString m_StrAuthTime;
+ pClass_This->m_DlgConfig.m_EditAuthTime.GetWindowText(m_StrAuthTime);
+ //д
+ st_AuthVer.nTryTime = _ttoi(m_StrAuthTime.GetBuffer());
+ st_AuthVer.enVerMode = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)pClass_This->m_DlgConfig.m_ComboListAuth.GetCurSel();
+ //Ƿ˴˹
+ if ((ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW == st_AuthVer.enVerMode) || (st_AuthVer.nTryTime <= 0))
+ {
+ pSt_ProtocolHdr->wReserve = 0x2D2;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sкţ%sʱ֤ʧܣΪر˴˹"), lpszClientAddr, st_AuthVer.tszVerSerial);
+ }
+ else
+ {
+ if (AuthService_SQLPacket_TryInsert(&st_AuthVer))
+ {
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sкţ%sʱ֤ɹ"), lpszClientAddr, st_AuthVer.tszVerSerial);
+ pSt_ProtocolHdr->unPacketSize = 0;
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 0x2D3;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sкţ%sʱ֤ʧܣ%X"), lpszClientAddr, st_AuthVer.tszVerSerial, SQLPacket_GetLastError());
+ }
+ }
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETUSER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETUSER;
+ if (AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_UserTable))
+ {
+ if ((0 == _tcsncmp(st_UserInfo.tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcslen(st_UserInfo.tszUserPass))) && (0 != _tcsnicmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcslen(st_UserInfo.tszEMailAddr))) && (st_UserInfo.nIDNumber == st_UserTable.st_UserInfo.nIDNumber))
+ {
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sѯûϢɹ"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2100;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sѯûϢʧ,"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2101;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sѯûϢʧ,ʻ"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQSETUSER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_SQLTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+
+ memset(&st_SQLTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPSETUSER;
+ if (AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_SQLTable))
+ {
+ if ((0 == _tcsncmp(st_UserInfo.tszUserPass, st_SQLTable.st_UserInfo.tszUserPass, _tcslen(st_UserInfo.tszUserPass))) && (0 != _tcsnicmp(st_UserInfo.tszEMailAddr, st_SQLTable.st_UserInfo.tszEMailAddr, _tcslen(st_UserInfo.tszEMailAddr))) && (st_UserInfo.nIDNumber == st_SQLTable.st_UserInfo.nIDNumber))
+ {
+ memcpy(&st_SQLTable.st_UserInfo, &st_UserInfo, sizeof(XENGINE_PROTOCOL_USERINFO));
+ if (AuthService_SQLPacket_UserSet(&st_SQLTable))
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sûϢɹ\r\n"), lpszClientAddr, st_UserInfo.tszUserName);
+
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2120;
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%sûϢʧ,:%lX\r\n"), lpszClientAddr, st_UserInfo.tszUserName, SQLPacket_GetLastError());
+ }
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2121;
+ XEngine_Authorize_LogPrint(_T("ͻˣ%sû%sûϢʧ,Ϣƥ\r\n"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2122;
+ XEngine_Authorize_LogPrint(_T("ͻˣ%sû%sûϢʧ,:%lX\r\n"), lpszClientAddr, st_UserInfo.tszUserName, SQLPacket_GetLastError());
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, lParam);
+ }
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_Task.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_Task.h
new file mode 100644
index 0000000000000000000000000000000000000000..cb94bd6da49581324688f613fcf2eaff072becdc
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_Task.h
@@ -0,0 +1,10 @@
+#pragma once
+
+typedef struct
+{
+ int nPoolIndex;
+ LPVOID lPClass;
+}XENGINE_THREADINFO;
+
+XHTHREAD CALLBACK XEngine_AuthService_ThreadClient(LPVOID lParam);
+BOOL XEngine_Client_TaskHandle(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPVOID lParam);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskEvent.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskEvent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dace2592bfa82b3fe6723e2e0e4b4b946cc1921a
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskEvent.cpp
@@ -0,0 +1,58 @@
+#include "pch.h"
+
+LPCSTR lpszKeyType[] = { "δ֪","ӿ","","","Զ忨" };
+void __stdcall XEngine_TaskEvent_Client(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthRegSerialType, LPVOID lParam)
+{
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)lParam;
+ CString m_StrFormat;
+
+ for (int i = 0; i < pClass_This->m_DlgUser.m_ListCtrlOnlineClient.GetItemCount(); i++)
+ {
+ CString m_StrUser = pClass_This->m_DlgUser.m_ListCtrlOnlineClient.GetItemText(i, 1);
+ if (0 == _tcsncmp(lpszUserName, m_StrUser.GetBuffer(), _tcslen(lpszUserName)))
+ {
+ TCHAR tszTimeONLine[64];
+ TCHAR tszTimeLeft[64];
+
+ memset(tszTimeONLine, '\0', sizeof(tszTimeONLine));
+ memset(tszTimeLeft, '\0', sizeof(tszTimeLeft));
+
+ _i64tot(nOnlineTimer, tszTimeONLine, 10);
+ _i64tot(nLeftTimer, tszTimeLeft, 10);
+
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.SetItemText(i, 3, tszTimeONLine);
+ if ((ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE == en_AuthRegSerialType) || (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == en_AuthRegSerialType))
+ {
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.SetItemText(i, 4, tszTimeLeft);
+ }
+ else
+ {
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.SetItemText(i, 4, lpszLeftDate);
+ }
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.SetItemText(i, 5, lpszKeyType[en_AuthRegSerialType]);
+
+ if (nLeftTimer <= 0)
+ {
+ CString m_StrFmtLog;
+ CString m_StrPntLog;
+ XENGINE_PROTOCOLHDR st_ProtocolHdr;
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+
+ st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
+ st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH;
+ st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_TIMEDOUT;
+ st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
+
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.DeleteItem(i);
+
+ pClass_This->m_EditLog.GetWindowText(m_StrPntLog);
+ m_StrFmtLog.Format(_T("û:%s,ַ:%s,ûʣʱ,Ѿ֪ͨͻʱ\r\n"), lpszUserName, lpszUserAddr);
+ m_StrPntLog += m_StrFmtLog;
+ pClass_This->m_EditLog.SetWindowText(m_StrPntLog);
+
+ XEngine_Client_TaskSend(lpszUserAddr, &st_ProtocolHdr, lParam);
+ XEngine_CloseClient(lpszUserAddr, lParam);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskEvent.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskEvent.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8eeaccb4608f85d1f19a008e9858210738445fc
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskEvent.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void __stdcall XEngine_TaskEvent_Client(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthRegSerialType, LPVOID lParam);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskLog.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskLog.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..17e0bb23f1a69a4b6cb1fbd239e1a7f6f5819354
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskLog.cpp
@@ -0,0 +1,28 @@
+#include "pch.h"
+
+#define XLOG_BUFFER_SIZE 16384
+
+BOOL XEngine_Authorize_LogPrint(LPVOID lParam, LPCSTR lpszLog, ...)
+{
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)lParam;
+ CString m_StrLog;
+
+ TCHAR tszLogBuffer[XLOG_BUFFER_SIZE];
+ memset(tszLogBuffer, '\0', sizeof(tszLogBuffer));
+
+ va_list pArgList;
+ va_start(pArgList, lpszLog);
+ vsnprintf(tszLogBuffer, XLOG_BUFFER_SIZE, lpszLog, pArgList);
+ va_end(pArgList);
+
+ pClass_This->m_EditLog.GetWindowText(m_StrLog);
+ if (m_StrLog.GetLength() > 1024000)
+ {
+ m_StrLog.ReleaseBuffer();
+ pClass_This->m_EditLog.SetWindowText("");
+ }
+ m_StrLog += tszLogBuffer;
+ m_StrLog += _T("\r\n");
+ pClass_This->m_EditLog.SetWindowText(m_StrLog);
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskLog.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskLog.h
new file mode 100644
index 0000000000000000000000000000000000000000..a2d8e81d172f005bf591fd01eeaa4633ecc724f0
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskLog.h
@@ -0,0 +1,3 @@
+#pragma once
+
+BOOL XEngine_Authorize_LogPrint(LPVOID lParam, LPCSTR lpszLog, ...);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskNetwork.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskNetwork.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..59cdaa2b57ce2dbf130e41a6df2c246984cbb407
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskNetwork.cpp
@@ -0,0 +1,97 @@
+#include "pch.h"
+
+//////////////////////////////////////////////////////////////////////////
+BOOL __stdcall XEngine_Client_Accept(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam)
+{
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)lParam;
+ HelpComponents_Datas_CreateEx(xhPacket, lpszClientAddr, 0);
+ return TRUE;
+}
+void __stdcall XEngine_Client_Recv(LPCTSTR lpszClientAddr, SOCKET hSocket, LPCTSTR lpszRecvMsg, int nMsgLen, LPVOID lParam)
+{
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)lParam;
+ HelpComponents_Datas_PostEx(xhPacket, lpszClientAddr, lpszRecvMsg, nMsgLen);
+}
+void __stdcall XEngine_Client_Close(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam)
+{
+ XEngine_CloseClient(lpszClientAddr, lParam);
+}
+//////////////////////////////////////////////////////////////////////////
+BOOL XEngine_CloseClient(LPCTSTR lpszClientAddr, LPVOID lParam)
+{
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)lParam;
+
+ TCHAR tszClientUser[64];
+ memset(tszClientUser, '\0', sizeof(tszClientUser));
+
+ NetCore_TCPXCore_CloseForClientEx(xhSocket, lpszClientAddr);
+ if (AuthService_Session_GetUserForAddr(lpszClientAddr, tszClientUser))
+ {
+ for (int i = 0; i < pClass_This->m_DlgUser.m_ListCtrlOnlineClient.GetItemCount(); i++)
+ {
+ CString m_StrAddr = pClass_This->m_DlgUser.m_ListCtrlOnlineClient.GetItemText(i, 2);
+ if (0 == _tcsnicmp(lpszClientAddr, m_StrAddr.GetBuffer(), _tcslen(lpszClientAddr)))
+ {
+ pClass_This->m_DlgUser.m_ListCtrlOnlineClient.DeleteItem(i);
+ }
+ }
+ AUTHREG_PROTOCOL_TIME st_TimeProtocol;
+ memset(&st_TimeProtocol, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+
+ if (AuthService_Session_GetTimer(tszClientUser, &st_TimeProtocol))
+ {
+ AuthService_SQLPacket_UserLeave(&st_TimeProtocol);
+ }
+ AuthService_Session_CloseClient(tszClientUser);
+ }
+ HelpComponents_Datas_DeleteEx(xhPacket, lpszClientAddr);
+ XEngine_Authorize_LogPrint(lParam, _T("ͻˣ%sû%s뿪"), lpszClientAddr, tszClientUser);
+ return TRUE;
+}
+//////////////////////////////////////////////////////////////////////////
+BOOL XEngine_Client_TaskSend(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPVOID lParam, LPCTSTR lpszMsgBuffer, int nMsgLen)
+{
+ CXEngineAuthorizeAppDlg* pClass_This = (CXEngineAuthorizeAppDlg*)lParam;
+
+ if (BST_CHECKED == pClass_This->m_DlgConfig.m_RadioKeyPass.GetCheck())
+ {
+ CString m_StrPass;
+ pClass_This->m_DlgConfig.m_EditPass.GetWindowText(m_StrPass);
+ XEngine_SendMsg(lpszClientAddr, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen, m_StrPass.GetBuffer());
+ }
+ else
+ {
+ XEngine_SendMsg(lpszClientAddr, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen);
+ }
+ return TRUE;
+}
+BOOL XEngine_SendMsg(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen, LPCTSTR lpszPass)
+{
+ int nSDLen = 4096;
+ TCHAR tszMsgBuffer[4096];
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ if (NULL == lpszPass)
+ {
+ Protocol_Packet_SendPkt(tszMsgBuffer, &nSDLen, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen);
+ }
+ else
+ {
+ TCHAR tszEnBuffer[4096];
+ memset(tszEnBuffer, '\0', sizeof(tszEnBuffer));
+
+ pSt_ProtocolHdr->wCrypto = ENUM_XENGINE_PROTOCOLHDR_CRYPTO_TYPE_XCRYPT;
+ if (NULL == lpszMsgBuffer)
+ {
+ Protocol_Packet_SendPkt(tszMsgBuffer, &nSDLen, pSt_ProtocolHdr);
+ }
+ else
+ {
+ OPenSsl_XCrypto_Encoder(lpszMsgBuffer, &nMsgLen, (UCHAR*)tszEnBuffer, lpszPass);
+ Protocol_Packet_SendPkt(tszMsgBuffer, &nSDLen, pSt_ProtocolHdr, tszEnBuffer, nMsgLen);
+ nMsgLen = nSDLen;
+ }
+ }
+ NetCore_TCPXCore_SendEx(xhSocket, lpszClientAddr, tszMsgBuffer, nSDLen);
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskNetwork.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskNetwork.h
new file mode 100644
index 0000000000000000000000000000000000000000..90a4bf1723255b9887a63dd75e84dbade1e5c372
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Task/Authorize_TaskNetwork.h
@@ -0,0 +1,10 @@
+#pragma once
+
+BOOL __stdcall XEngine_Client_Accept(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam);
+void __stdcall XEngine_Client_Recv(LPCTSTR lpszClientAddr, SOCKET hSocket, LPCTSTR lpszRecvMsg, int nMsgLen, LPVOID lParam);
+void __stdcall XEngine_Client_Close(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam);
+
+BOOL XEngine_CloseClient(LPCTSTR lpszClientAddr, LPVOID lParam);
+
+BOOL XEngine_Client_TaskSend(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPVOID lParam, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0);
+BOOL XEngine_SendMsg(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0, LPCTSTR lpszPass = NULL);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.aps b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.aps
new file mode 100644
index 0000000000000000000000000000000000000000..37a32fbe93253ab85545a47bc6ac9279ad944d16
Binary files /dev/null and b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.aps differ
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.rc b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.rc
new file mode 100644
index 0000000000000000000000000000000000000000..6e6a8d9e9a0a3b6a6870fd64e878516366c62bae
Binary files /dev/null and b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.rc differ
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3891f8bd59787bdbd307aa11a6cb365db0ae060f
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.cpp
@@ -0,0 +1,107 @@
+
+// XEngine_AuthorizeApp.cpp: 定义应用程序的类行为。
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "XEngine_AuthorizeApp.h"
+#include "XEngine_AuthorizeAppDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CXEngineAuthorizeAppApp
+
+BEGIN_MESSAGE_MAP(CXEngineAuthorizeAppApp, CWinApp)
+ ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CXEngineAuthorizeAppApp 构造
+
+CXEngineAuthorizeAppApp::CXEngineAuthorizeAppApp()
+{
+ // 支持重新启动管理器
+ m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
+
+ // TODO: 在此处添加构造代码,
+ // 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的 CXEngineAuthorizeAppApp 对象
+
+CXEngineAuthorizeAppApp theApp;
+
+
+// CXEngineAuthorizeAppApp 初始化
+
+BOOL CXEngineAuthorizeAppApp::InitInstance()
+{
+ // 如果一个运行在 Windows XP 上的应用程序清单指定要
+ // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
+ //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
+ INITCOMMONCONTROLSEX InitCtrls;
+ InitCtrls.dwSize = sizeof(InitCtrls);
+ // 将它设置为包括所有要在应用程序中使用的
+ // 公共控件类。
+ InitCtrls.dwICC = ICC_WIN95_CLASSES;
+ InitCommonControlsEx(&InitCtrls);
+
+ CWinApp::InitInstance();
+
+
+ AfxEnableControlContainer();
+
+ // 创建 shell 管理器,以防对话框包含
+ // 任何 shell 树视图控件或 shell 列表视图控件。
+ CShellManager *pShellManager = new CShellManager;
+
+ // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
+ CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
+
+ // 标准初始化
+ // 如果未使用这些功能并希望减小
+ // 最终可执行文件的大小,则应移除下列
+ // 不需要的特定初始化例程
+ // 更改用于存储设置的注册表项
+ // TODO: 应适当修改该字符串,
+ // 例如修改为公司或组织名
+ SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
+
+ CXEngineAuthorizeAppDlg dlg;
+ m_pMainWnd = &dlg;
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: 在此放置处理何时用
+ // “确定”来关闭对话框的代码
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: 在此放置处理何时用
+ // “取消”来关闭对话框的代码
+ }
+ else if (nResponse == -1)
+ {
+ TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
+ TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
+ }
+
+ // 删除上面创建的 shell 管理器。
+ if (pShellManager != nullptr)
+ {
+ delete pShellManager;
+ }
+
+#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
+ ControlBarCleanUp();
+#endif
+
+ // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
+ // 而不是启动应用程序的消息泵。
+ return FALSE;
+}
+
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.h
new file mode 100644
index 0000000000000000000000000000000000000000..23a6eb603dd1488fdf1b47a3b05000e6a09a0fb8
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.h
@@ -0,0 +1,32 @@
+
+// XEngine_AuthorizeApp.h: PROJECT_NAME 应用程序的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error "在包含此文件之前包含 'pch.h' 以生成 PCH"
+#endif
+
+#include "resource.h" // 主符号
+
+
+// CXEngineAuthorizeAppApp:
+// 有关此类的实现,请参阅 XEngine_AuthorizeApp.cpp
+//
+
+class CXEngineAuthorizeAppApp : public CWinApp
+{
+public:
+ CXEngineAuthorizeAppApp();
+
+// 重写
+public:
+ virtual BOOL InitInstance();
+
+// 实现
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CXEngineAuthorizeAppApp theApp;
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..5721b9e5b323b1c92ae8c3f4b3b1980a2aedab8d
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj
@@ -0,0 +1,238 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {29DCAD3F-A70D-424A-BB5A-E99DAE9EEF16}
+ MFCProj
+ XEngineAuthorizeApp
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ MultiByte
+ Dynamic
+
+
+ Application
+ false
+ v142
+ true
+ MultiByte
+ Static
+
+
+ Application
+ true
+ v142
+ Unicode
+ Dynamic
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+ Dynamic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ true
+
+
+ false
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ false
+
+
+
+ Use
+ Level3
+ true
+ WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ pch.h
+ 4819
+
+
+ Windows
+
+
+ false
+ true
+ _DEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ _DEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+ Use
+ Level3
+ true
+ _WINDOWS;_DEBUG;%(PreprocessorDefinitions)
+ pch.h
+
+
+ Windows
+
+
+ false
+ true
+ _DEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ _DEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+ Use
+ Level3
+ true
+ true
+ true
+ WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ pch.h
+ MultiThreaded
+ 4819
+
+
+ Windows
+ true
+ true
+
+
+ false
+ true
+ NDEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ NDEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+ Use
+ Level3
+ true
+ true
+ true
+ _WINDOWS;NDEBUG;%(PreprocessorDefinitions)
+ pch.h
+
+
+ Windows
+ true
+ true
+
+
+ false
+ true
+ NDEBUG;%(PreprocessorDefinitions)
+
+
+ 0x0804
+ NDEBUG;%(PreprocessorDefinitions)
+ $(IntDir);%(AdditionalIncludeDirectories)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj.filters b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..429a7163cca40c403124853273574a93e9ce6149
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj.filters
@@ -0,0 +1,123 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {ab0d008f-3879-4761-b815-ff47eddd113d}
+
+
+ {3e0685fd-2319-4a3a-a8c3-e91a30a0f80f}
+
+
+ {06956eea-cfd3-4433-844b-3f27c761daa1}
+
+
+ {11110c09-15a0-4483-9f97-c097a8843404}
+
+
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件\Authorize_Dialog
+
+
+ 头文件\Authorize_Task
+
+
+ 头文件\Authorize_Task
+
+
+ 头文件\Authorize_Dialog
+
+
+ 头文件\Authorize_Dialog
+
+
+ 头文件\Authorize_Task
+
+
+ 头文件\Authorize_Task
+
+
+ 头文件\Authorize_Dialog
+
+
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件\Authorize_Dialog
+
+
+ 源文件\Authorize_Task
+
+
+ 源文件\Authorize_Task
+
+
+ 源文件\Authorize_Dialog
+
+
+ 源文件\Authorize_Dialog
+
+
+ 源文件\Authorize_Task
+
+
+ 源文件\Authorize_Task
+
+
+ 源文件\Authorize_Dialog
+
+
+
+
+ 资源文件
+
+
+
+
+ 资源文件
+
+
+
+
+ 资源文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj.user b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..ce9a0bb5d256aa858026661beea9832e7ef33fdb
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeApp.vcxproj.user
@@ -0,0 +1,6 @@
+
+
+
+ XEngineAuthorizeApp.rc
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeAppDlg.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeAppDlg.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0bc6c5e834379dfcac56bf58da585f0f35a4522d
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeAppDlg.cpp
@@ -0,0 +1,300 @@
+
+// XEngine_AuthorizeAppDlg.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "XEngine_AuthorizeApp.h"
+#include "XEngine_AuthorizeAppDlg.h"
+#include "afxdialogex.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CXEngineAuthorizeAppDlg 对话框
+
+
+
+CXEngineAuthorizeAppDlg::CXEngineAuthorizeAppDlg(CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_XENGINE_AUTHORIZEAPP_DIALOG, pParent)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void CXEngineAuthorizeAppDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_EDIT1, m_EditLog);
+ DDX_Control(pDX, IDC_BUTTON3, m_BtnStartService);
+ DDX_Control(pDX, IDC_BUTTON4, m_BtnStopService);
+ DDX_Control(pDX, IDC_TAB1, m_TabCtrl);
+}
+
+BEGIN_MESSAGE_MAP(CXEngineAuthorizeAppDlg, CDialogEx)
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_BN_CLICKED(IDC_BUTTON3, &CXEngineAuthorizeAppDlg::OnBnClickedButton3)
+ ON_BN_CLICKED(IDC_BUTTON1, &CXEngineAuthorizeAppDlg::OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, &CXEngineAuthorizeAppDlg::OnBnClickedButton2)
+ ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, &CXEngineAuthorizeAppDlg::OnTcnSelchangeTab1)
+ ON_BN_CLICKED(IDC_BUTTON4, &CXEngineAuthorizeAppDlg::OnBnClickedButton4)
+ ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+
+// CXEngineAuthorizeAppDlg 消息处理程序
+
+BOOL CXEngineAuthorizeAppDlg::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
+ // 执行此操作
+ SetIcon(m_hIcon, TRUE); // 设置大图标
+ SetIcon(m_hIcon, FALSE); // 设置小图标
+
+ // TODO: 在此添加额外的初始化代码
+ WSADATA st_WSAData;
+ WSAStartup(MAKEWORD(2, 2), &st_WSAData);
+
+ HANDLE hMutex = CreateMutex(NULL, TRUE, _T("XEngine_AuthorizeApp"));
+ if (NULL != hMutex)
+ {
+ if (GetLastError() == ERROR_ALREADY_EXISTS)
+ {
+ AfxMessageBox(_T("程序已经运行!"));
+ CloseHandle(hMutex);
+ return FALSE;
+ }
+ }
+ CloseHandle(hMutex);
+
+ m_TabCtrl.InsertItem(0, _T("服务配置"));
+ m_TabCtrl.InsertItem(1, _T("用户管理"));
+ m_TabCtrl.InsertItem(2, _T("序列号管理"));
+ m_TabCtrl.InsertItem(3, _T("本地注册验证"));
+
+ m_DlgConfig.Create(IDD_DIALOG_CONFIG, &m_TabCtrl);
+ m_DlgUser.Create(IDD_DIALOG_USER, &m_TabCtrl);
+ m_DlgSerial.Create(IDD_DIALOG_SERIAL, &m_TabCtrl);
+ m_DlgLocal.Create(IDD_DIALOG_LOCAL, &m_TabCtrl);
+ //调整子对话框在父窗口中的位置
+ CRect st_Rect;
+ m_TabCtrl.GetClientRect(&st_Rect);
+ st_Rect.top += 20;
+ st_Rect.bottom -= 1;
+ st_Rect.left += 1;
+ st_Rect.right -= 1;
+ //设置子对话框尺寸并移动到指定位置
+ m_DlgConfig.MoveWindow(&st_Rect);
+ m_DlgUser.MoveWindow(&st_Rect);
+ m_DlgSerial.MoveWindow(&st_Rect);
+ m_DlgLocal.MoveWindow(&st_Rect);
+ //分别设置隐藏和显示
+ m_DlgConfig.ShowWindow(TRUE);
+ m_DlgUser.ShowWindow(FALSE);
+ m_DlgSerial.ShowWindow(FALSE);
+ m_DlgLocal.ShowWindow(FALSE);
+ m_TabCtrl.SetCurSel(0);
+
+ if (!SystemApi_Skin_CreateTrayTip(m_hWnd, _T("XEngine网络验证服务"), WINSDK_SKIN_USERMSG_TRAY, IDR_MAINFRAME))
+ {
+ AfxMessageBox(_T("添加托盘失败"));
+ return FALSE;
+ }
+ m_BtnStartService.EnableWindow(TRUE);
+ m_BtnStopService.EnableWindow(FALSE);
+
+ if (st_AuthConfig.bAutoStart)
+ {
+ OnBnClickedButton1();
+ ShowWindow(SW_HIDE);
+ }
+ return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
+}
+
+// 如果向对话框添加最小化按钮,则需要下面的代码
+// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
+// 这将由框架自动完成。
+
+void CXEngineAuthorizeAppDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // 用于绘制的设备上下文
+
+ SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0);
+
+ // 使图标在工作区矩形中居中
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // 绘制图标
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CDialogEx::OnPaint();
+ }
+}
+
+//当用户拖动最小化窗口时系统调用此函数取得光标
+//显示。
+HCURSOR CXEngineAuthorizeAppDlg::OnQueryDragIcon()
+{
+ return static_cast(m_hIcon);
+}
+
+
+
+void CXEngineAuthorizeAppDlg::OnBnClickedButton3()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ CString m_StrPort;
+ CString m_StrNumber;
+ CString m_StrThreads;
+
+ m_DlgConfig.m_EditServicePort.GetWindowText(m_StrPort);
+ m_DlgConfig.m_EditVerTimedout.GetWindowText(m_StrNumber);
+ m_DlgConfig.m_EditThreadPool.GetWindowText(m_StrThreads);
+
+ nThreadCount = _ttoi(m_StrThreads.GetBuffer());
+ if (!AuthService_SQLPacket_Init(st_AuthConfig.st_XSql.tszSQLite))
+ {
+ AfxMessageBox(_T("初始化数据库失败!"));
+ return;
+ }
+ if (!AuthService_Session_Init(XEngine_TaskEvent_Client, this))
+ {
+ AfxMessageBox(_T("初始化网络失败!"));
+ return;
+ }
+ if (!HelpComponents_Datas_Init(&xhPacket, 10000, 0, nThreadCount))
+ {
+ AfxMessageBox(_T("启动服务器失败,初始化包管理器失败"));
+ return;
+ }
+ if (!NetCore_TCPXCore_StartEx(&xhSocket, _ttoi(m_StrPort.GetBuffer()), 10000, nThreadCount))
+ {
+ CString m_StrEror;
+ m_StrEror.Format(_T("启动服务器失败,启动验证网络服务失败:%lX %d"), NetCore_GetLastError(), WSAGetLastError());
+ AfxMessageBox(m_StrEror);
+ return;
+ }
+ NetCore_TCPXCore_RegisterCallBackEx(xhSocket, XEngine_Client_Accept, XEngine_Client_Recv, XEngine_Client_Close, this, this, this);
+
+ bThread = TRUE;
+ BaseLib_OperatorMemory_Malloc((XPPPMEM)&ppSt_ThreadParament, nThreadCount, sizeof(THREADPOOL_PARAMENT));
+ for (int i = 0; i < nThreadCount; i++)
+ {
+ XENGINE_THREADINFO* pSt_AuthThread = new XENGINE_THREADINFO;
+
+ pSt_AuthThread->nPoolIndex = i;
+ pSt_AuthThread->lPClass = this;
+ ppSt_ThreadParament[i]->lParam = pSt_AuthThread;
+ ppSt_ThreadParament[i]->fpCall_ThreadsTask = XEngine_AuthService_ThreadClient;
+ }
+ ManagePool_Thread_NQCreate(&xhPool, &ppSt_ThreadParament, nThreadCount);
+
+ m_DlgSerial.SerialManage_Flush();
+ m_BtnStartService.EnableWindow(FALSE);
+ m_BtnStopService.EnableWindow(TRUE);
+}
+
+
+void CXEngineAuthorizeAppDlg::OnBnClickedButton1()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ m_EditLog.SetWindowText(_T(""));
+}
+
+
+void CXEngineAuthorizeAppDlg::OnBnClickedButton2()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ CFileDialog m_FileDlg(FALSE, _T(".log"), NULL, NULL, _T("Log日志文件(*.log)|*.log|文本文件(*.txt)|(*.txt)||"));//生成一个对话框
+ if (IDCANCEL == m_FileDlg.DoModal())
+ {
+ return;
+ }
+ CString m_StrSaveFile = m_FileDlg.GetPathName();
+ CFile m_File;
+ m_File.Open(m_StrSaveFile.GetBuffer(), CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate);
+
+ CString m_StrMsg;
+ m_EditLog.GetWindowText(m_StrMsg);
+ m_File.Write(m_StrMsg.GetBuffer(), m_StrMsg.GetLength());
+ m_File.Close();
+}
+
+
+void CXEngineAuthorizeAppDlg::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ // TODO: 在此添加控件通知处理程序代码
+ switch (m_TabCtrl.GetCurSel())
+ {
+ case 0:
+ m_DlgConfig.ShowWindow(TRUE);
+ m_DlgUser.ShowWindow(FALSE);
+ m_DlgSerial.ShowWindow(FALSE);
+ m_DlgLocal.ShowWindow(FALSE);
+ break;
+ case 1:
+ m_DlgConfig.ShowWindow(FALSE);
+ m_DlgUser.ShowWindow(TRUE);
+ m_DlgSerial.ShowWindow(FALSE);
+ m_DlgLocal.ShowWindow(FALSE);
+ break;
+ case 2:
+ m_DlgConfig.ShowWindow(FALSE);
+ m_DlgUser.ShowWindow(FALSE);
+ m_DlgSerial.ShowWindow(TRUE);
+ m_DlgLocal.ShowWindow(FALSE);
+ break;
+ case 3:
+ m_DlgConfig.ShowWindow(FALSE);
+ m_DlgUser.ShowWindow(FALSE);
+ m_DlgSerial.ShowWindow(FALSE);
+ m_DlgLocal.ShowWindow(TRUE);
+ break;
+ default:
+ break;
+ }
+
+ *pResult = 0;
+}
+
+
+void CXEngineAuthorizeAppDlg::OnBnClickedButton4()
+{
+ // TODO: 在此添加控件通知处理程序代码
+ m_BtnStartService.EnableWindow(TRUE);
+ m_BtnStopService.EnableWindow(FALSE);
+ bThread = FALSE;
+
+ HelpComponents_Datas_Destory(xhPacket);
+ NetCore_TCPXCore_DestroyEx(xhSocket);
+ ManagePool_Thread_NQDestroy(xhPool);
+ BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_ThreadParament, st_AuthConfig.nThreads);
+
+ AuthService_Session_Destroy();
+ AuthService_SQLPacket_Destroy();
+
+ m_DlgSerial.m_ListSerial.DeleteAllItems();
+ m_DlgUser.m_ListCtrlOnlineClient.DeleteAllItems();
+}
+
+
+void CXEngineAuthorizeAppDlg::OnDestroy()
+{
+ CDialogEx::OnDestroy();
+ // TODO: 在此处添加消息处理程序代码
+ SystemApi_Skin_CreateTrayTip(m_hWnd, _T("血与荣誉网络验证服务"), WINSDK_SKIN_USERMSG_TRAY, IDR_MAINFRAME, FALSE);
+ WSACleanup();
+}
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeAppDlg.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeAppDlg.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a6d8691fd40364e8d1bd52c79df06382ba84e21
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngine_AuthorizeAppDlg.h
@@ -0,0 +1,51 @@
+
+// XEngine_AuthorizeAppDlg.h: 头文件
+//
+
+#pragma once
+// CXEngineAuthorizeAppDlg 对话框
+class CXEngineAuthorizeAppDlg : public CDialogEx
+{
+// 构造
+public:
+ CXEngineAuthorizeAppDlg(CWnd* pParent = nullptr); // 标准构造函数
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_XENGINE_AUTHORIZEAPP_DIALOG };
+#endif
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
+
+
+// 实现
+protected:
+ HICON m_hIcon;
+
+ // 生成的消息映射函数
+ virtual BOOL OnInitDialog();
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ DECLARE_MESSAGE_MAP()
+public:
+ CDialog_Configure m_DlgConfig;
+ CDialog_Serial m_DlgSerial;
+ CDialog_User m_DlgUser;
+ CDialog_Local m_DlgLocal;
+public:
+ BOOL bThread;
+ int nThreadCount;
+ THREADPOOL_PARAMENT** ppSt_ThreadParament;
+public:
+ CEdit m_EditLog;
+ afx_msg void OnBnClickedButton3();
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton2();
+ CButton m_BtnStartService;
+ CButton m_BtnStopService;
+ CTabCtrl m_TabCtrl;
+ afx_msg void OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnBnClickedButton4();
+ afx_msg void OnDestroy();
+};
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/framework.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/framework.h
new file mode 100644
index 0000000000000000000000000000000000000000..5672fb5c4ad5444e4e24c84018033525a8b535b9
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/framework.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
+
+// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
+#define _AFX_ALL_WARNINGS
+
+#include // MFC 核心组件和标准组件
+#include // MFC 扩展
+
+
+#include // MFC 自动化类
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include // MFC 支持功能区和控制条
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f617b162905bc133ebf9f16136084daec7898fe7
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.cpp
@@ -0,0 +1,9 @@
+// pch.cpp: 与预编译标头对应的源文件
+
+#include "pch.h"
+
+// 当使用预编译的头时,需要使用此源文件,编译才能成功。
+XNETHANDLE xhSocket = 0;
+XNETHANDLE xhPacket = 0;
+XNETHANDLE xhPool = 0;
+AUTHORIZE_CONFIGURE st_AuthConfig;
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.h
new file mode 100644
index 0000000000000000000000000000000000000000..18197d5ccfa51333a6cfad4433cf9e3d4654ecaf
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.h
@@ -0,0 +1,82 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+
+// 添加要在此处预编译的标头
+#include "framework.h"
+
+#endif //PCH_H
+
+
+#define WINSDK_SKIN_USERMSG_TRAY (WM_USER + 10012)
+#include
+#include
+
+using namespace std;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "../../XAuth_Protocol.h"
+#include "../../XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Define.h"
+#include "../../XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Error.h"
+#include "../../XEngine_AuthComponents/AuthComponents_Session/Session_Define.h"
+#include "../../XEngine_AuthComponents/AuthComponents_Session/Session_Error.h"
+#include "../../AuthorizeModule_Protocol/Protocol_Define.h"
+#include "../../AuthorizeModule_Protocol/Protocol_Error.h"
+#include "../../AuthorizeModule_Configure/Config_Define.h"
+#include "../../AuthorizeModule_Configure/Config_Error.h"
+
+#include "Authorize_Dialog/CDialog_Configure.h"
+#include "Authorize_Dialog/CDialog_Serial.h"
+#include "Authorize_Dialog/CDialog_User.h"
+#include "Authorize_Dialog/CDialog_Local.h"
+#include "XEngine_AuthorizeAppDlg.h"
+#include "Authorize_Task/Authorize_Task.h"
+#include "Authorize_Task/Authorize_TaskLog.h"
+#include "Authorize_Task/Authorize_TaskNetwork.h"
+#include "Authorize_Task/Authorize_TaskEvent.h"
+
+extern XNETHANDLE xhSocket;
+extern XNETHANDLE xhPacket;
+extern XNETHANDLE xhPool;
+extern AUTHORIZE_CONFIGURE st_AuthConfig;
+
+#ifdef _DEBUG
+#pragma comment(lib,"../../Debug/AuthComponents_SQLPacket")
+#pragma comment(lib,"../../Debug/AuthComponents_Session")
+#pragma comment(lib,"../../Debug/AuthorizeModule_Configure")
+#pragma comment(lib,"../../Debug/AuthorizeModule_Protocol")
+#else
+#pragma comment(lib,"../../Release/AuthComponents_SQLPacket")
+#pragma comment(lib,"../../Release/AuthComponents_Session")
+#pragma comment(lib,"../../Release/AuthorizeModule_Configure")
+#pragma comment(lib,"../../Release/AuthorizeModule_Protocol")
+#endif
+
+#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_Core.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_ManagePool.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_OPenSsl.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Packets.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Authorize.lib")
+#pragma comment(lib,"x86/XEngine_SystemSdk/XEngine_SystemApi.lib")
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/res/XEngineAuthorizeApp.rc2 b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/res/XEngineAuthorizeApp.rc2
new file mode 100644
index 0000000000000000000000000000000000000000..27075bf45c1b763eb280033aba57db0f96ea3f74
Binary files /dev/null and b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/res/XEngineAuthorizeApp.rc2 differ
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/res/XEngine_AuthorizeApp.ico b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/res/XEngine_AuthorizeApp.ico
new file mode 100644
index 0000000000000000000000000000000000000000..d56fbcdfdf6eac0f4727c34770c26689271d96af
Binary files /dev/null and b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/res/XEngine_AuthorizeApp.ico differ
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/resource.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/resource.h
new file mode 100644
index 0000000000000000000000000000000000000000..d06eb9e6b56793ede6f5159b92ce6dfc1cc3b579
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/resource.h
@@ -0,0 +1,51 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ 生成的包含文件。
+// 供 XEngineAuthorizeApp.rc 使用
+//
+#define IDD_XENGINE_AUTHORIZEAPP_DIALOG 102
+#define IDR_MAINFRAME 128
+#define IDD_DIALOG_CONFIG 130
+#define IDD_DIALOG_SERIAL 132
+#define IDD_DIALOG_USER 134
+#define IDD_DIALOG_LOCAL 136
+#define IDC_TAB1 1000
+#define IDC_EDIT1 1001
+#define IDC_BUTTON1 1002
+#define IDC_EDIT11 1002
+#define IDC_BUTTON2 1003
+#define IDC_BUTTON3 1004
+#define IDC_BUTTON4 1005
+#define IDC_EDIT2 1005
+#define IDC_EDIT3 1006
+#define IDC_BUTTON5 1006
+#define IDC_EDIT4 1007
+#define IDC_COMBO1 1008
+#define IDC_RADIO1 1009
+#define IDC_COMBO3 1009
+#define IDC_EDIT12 1009
+#define IDC_RADIO2 1010
+#define IDC_EDIT13 1010
+#define IDC_EDIT5 1011
+#define IDC_COMBO2 1012
+#define IDC_EDIT6 1013
+#define IDC_COMBO4 1013
+#define IDC_EDIT7 1014
+#define IDC_EDIT8 1015
+#define IDC_EDIT9 1016
+#define IDC_EDIT10 1017
+#define IDC_RADIO3 1018
+#define IDC_EDIT14 1018
+#define IDC_RADIO4 1019
+#define IDC_LIST1 1019
+#define IDC_IPADDRESS1 1021
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 138
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1022
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/targetver.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/targetver.h
new file mode 100644
index 0000000000000000000000000000000000000000..79934a35bbf968109eed9561759dab8770f2eb2f
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5618369e671b97aa04734bd2a48492774210b4cb
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.cpp
@@ -0,0 +1,51 @@
+#include "Authorize_Hdr.h"
+
+BOOL Authorize_Service_Parament(int argc, char** argv)
+{
+ LPCTSTR lpszFile = _T("./XEngine_Config/XEngine_Config.ini");
+
+ if (!Configure_IniFile_Read(lpszFile, &st_AuthConfig))
+ {
+ printf("解析配置文件失败,Configure_IniFile_Read:%lX\n", Config_GetLastError());
+ return FALSE;
+ }
+
+ for (int i = 0;i < argc;i++)
+ {
+ if ((0 == _tcscmp("-h", argv[i])) || (0 == _tcscmp("-H", argv[i])))
+ {
+ Authorize_Service_ParamentHelp();
+ return FALSE;
+ }
+ if ((0 == _tcscmp("-v", argv[i])) || (0 == _tcscmp("-V", argv[i])))
+ {
+ printf("Version:V2.1.0\n");
+ return FALSE;
+ }
+ else if (0 == _tcscmp("-p", argv[i]))
+ {
+ st_AuthConfig.nPort = _ttoi(argv[i + 1]);
+ }
+ else if (0 == _tcscmp("-t", argv[i]))
+ {
+ st_AuthConfig.nThreads = _ttoi(argv[i + 1]);
+ }
+ else if (0 == _tcscmp("-d", argv[i]))
+ {
+ st_AuthConfig.bDeamon = _ttoi(argv[i + 1]);
+ }
+ }
+
+ return TRUE;
+}
+
+void Authorize_Service_ParamentHelp()
+{
+ printf(_T("--------------------------启动参数帮助开始--------------------------\n"));
+ printf(_T("网络授权服务启动参数:程序 参数 参数值,参数是区分大小写的。如果不指定将会加载默认的ini配置文件里面的参数\n"));
+ printf(_T("-h or -H:启动参数帮助提示信息\n"));
+ printf(_T("-p:设置TCP服务端口号\n"));
+ printf(_T("-t:设置线程个数\n"));
+ printf(_T("-d:1 启用守护进程,2不启用\n"));
+ printf(_T("--------------------------启动参数帮助结束--------------------------\n"));
+}
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.h
new file mode 100644
index 0000000000000000000000000000000000000000..85902980287c40f6cee04e386eeaac24427e0cb7
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.h
@@ -0,0 +1,4 @@
+#pragma once
+
+BOOL Authorize_Service_Parament(int argc, char** argv);
+void Authorize_Service_ParamentHelp();
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h
new file mode 100644
index 0000000000000000000000000000000000000000..4520d1a725cd0005c4b867ab6949b728e13a9f8f
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h
@@ -0,0 +1,101 @@
+#pragma once
+#ifdef _WINDOWS
+#include
+#include
+#else
+#include
+#include
+#include
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+using namespace std;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../../XAuth_Protocol.h"
+#include "../../XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Define.h"
+#include "../../XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Error.h"
+#include "../../XEngine_AuthComponents/AuthComponents_Session/Session_Define.h"
+#include "../../XEngine_AuthComponents/AuthComponents_Session/Session_Error.h"
+#include "../../AuthorizeModule_Protocol/Protocol_Define.h"
+#include "../../AuthorizeModule_Protocol/Protocol_Error.h"
+#include "../../AuthorizeModule_Configure/Config_Define.h"
+#include "../../AuthorizeModule_Configure/Config_Error.h"
+
+extern BOOL bIsRun;
+extern XLOG xhLog;
+extern XNETHANDLE xhSocket;
+extern XNETHANDLE xhPacket;
+extern XNETHANDLE xhPool;
+extern AUTHORIZE_CONFIGURE st_AuthConfig;
+
+void ServiceApp_Stop(int signo);
+
+#include "Authorize_Config.h"
+#include "Authorize_Net.h"
+#include "Authorize_Task.h"
+#include "Authorize_TCPTask.h"
+
+#ifdef _WINDOWS
+#ifdef _DEBUG
+#pragma comment(lib,"../../Debug/AuthorizeModule_Configure.lib")
+#pragma comment(lib,"../../Debug/AuthorizeModule_Protocol.lib")
+#pragma comment(lib,"../../Debug/AuthComponents_Session.lib")
+#pragma comment(lib,"../../Debug/AuthComponents_SQLPacket.lib")
+#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_Core.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_ManagePool.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_OPenSsl.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_XLog.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Packets.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Authorize.lib")
+#else
+#ifdef WIN64
+#pragma comment(lib,"../../x64/Release/AuthorizeModule_Configure.lib")
+#pragma comment(lib,"../../x64/Release/AuthorizeModule_Protocol.lib")
+#pragma comment(lib,"../../x64/Release/AuthComponents_Session.lib")
+#pragma comment(lib,"../../x64/Release/AuthComponents_SQLPacket.lib")
+#pragma comment(lib,"x64/XEngine_BaseLib/XEngine_BaseLib.lib")
+#pragma comment(lib,"x64/XEngine_Core/XEngine_Core.lib")
+#pragma comment(lib,"x64/XEngine_Core/XEngine_ManagePool.lib")
+#pragma comment(lib,"x64/XEngine_Core/XEngine_OPenSsl.lib")
+#pragma comment(lib,"x64/XEngine_HelpComponents/HelpComponents_XLog.lib")
+#pragma comment(lib,"x64/XEngine_HelpComponents/HelpComponents_Packets.lib")
+#pragma comment(lib,"x64/XEngine_HelpComponents/HelpComponents_Authorize.lib")
+#else
+#pragma comment(lib,"../../Release/AuthorizeModule_Configure.lib")
+#pragma comment(lib,"../../Release/AuthorizeModule_Protocol.lib")
+#pragma comment(lib,"../../Release/AuthComponents_Session.lib")
+#pragma comment(lib,"../../Release/AuthComponents_SQLPacket.lib")
+#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_Core.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_ManagePool.lib")
+#pragma comment(lib,"x86/XEngine_Core/XEngine_OPenSsl.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_XLog.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Packets.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Authorize.lib")
+#endif
+#endif
+#pragma comment(lib,"Ws2_32.lib")
+#endif
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..99970b08f37660da4c5a6bc0ffd4143793fb895b
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp
@@ -0,0 +1,87 @@
+#include "Authorize_Hdr.h"
+//////////////////////////////////////////////////////////////////////////
+BOOL __stdcall XEngine_Client_Accept(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam)
+{
+ HelpComponents_Datas_CreateEx(xhPacket, lpszClientAddr, 0);
+ return TRUE;
+}
+void __stdcall XEngine_Client_Recv(LPCTSTR lpszClientAddr, SOCKET hSocket, LPCTSTR lpszRecvMsg, int nMsgLen, LPVOID lParam)
+{
+ if (!HelpComponents_Datas_PostEx(xhPacket, lpszClientAddr, lpszRecvMsg, nMsgLen))
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,投递数据包失败,大小:%d,错误:%lX"), lpszClientAddr, nMsgLen, Packets_GetLastError());
+ }
+}
+void __stdcall XEngine_Client_Close(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam)
+{
+ XEngine_CloseClient(lpszClientAddr);
+}
+//////////////////////////////////////////////////////////////////////////
+BOOL XEngine_CloseClient(LPCTSTR lpszClientAddr)
+{
+ TCHAR tszClientUser[64];
+ memset(tszClientUser, '\0', sizeof(tszClientUser));
+
+ if (AuthService_Session_GetUserForAddr(lpszClientAddr, tszClientUser))
+ {
+ AUTHREG_PROTOCOL_TIME st_TimeProtocol;
+ memset(&st_TimeProtocol, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+
+ if (AuthService_Session_GetTimer(tszClientUser, &st_TimeProtocol))
+ {
+ AuthService_SQLPacket_UserLeave(&st_TimeProtocol);
+ }
+ AuthService_Session_CloseClient(tszClientUser);
+ }
+ HelpComponents_Datas_DeleteEx(xhPacket, lpszClientAddr);
+ NetCore_TCPXCore_CloseForClientEx(xhSocket, lpszClientAddr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,离开服务器"), lpszClientAddr, tszClientUser);
+ return TRUE;
+}
+//////////////////////////////////////////////////////////////////////////
+BOOL XEngine_Client_TaskSend(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen)
+{
+ if (st_AuthConfig.st_Crypto.bEnable)
+ {
+ TCHAR tszPassword[64];
+ memset(tszPassword, '\0', sizeof(tszPassword));
+
+ _stprintf(tszPassword, _T("%d"), st_AuthConfig.st_Crypto.nPassword);
+ XEngine_SendMsg(lpszClientAddr, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen, tszPassword);
+ }
+ else
+ {
+ XEngine_SendMsg(lpszClientAddr, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen);
+ }
+ return TRUE;
+}
+BOOL XEngine_SendMsg(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen, LPCTSTR lpszPass)
+{
+ int nSDLen = 4096;
+ TCHAR tszMsgBuffer[4096];
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+
+ if (NULL == lpszPass)
+ {
+ Protocol_Packet_SendPkt(tszMsgBuffer, &nSDLen, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen);
+ }
+ else
+ {
+ TCHAR tszEnBuffer[4096];
+ memset(tszEnBuffer, '\0', sizeof(tszEnBuffer));
+
+ pSt_ProtocolHdr->wCrypto = ENUM_XENGINE_PROTOCOLHDR_CRYPTO_TYPE_XCRYPT;
+ if (NULL == lpszMsgBuffer)
+ {
+ Protocol_Packet_SendPkt(tszMsgBuffer, &nSDLen, pSt_ProtocolHdr);
+ }
+ else
+ {
+ OPenSsl_XCrypto_Encoder(lpszMsgBuffer, &nMsgLen, (UCHAR*)tszEnBuffer, lpszPass);
+ Protocol_Packet_SendPkt(tszMsgBuffer, &nSDLen, pSt_ProtocolHdr, tszEnBuffer, nMsgLen);
+ nMsgLen = nSDLen;
+ }
+ }
+ NetCore_TCPXCore_SendEx(xhSocket, lpszClientAddr, tszMsgBuffer, nSDLen);
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.h
new file mode 100644
index 0000000000000000000000000000000000000000..0976c1dd4fda22f7ca5b8b28c46042b57dc0a5d9
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.h
@@ -0,0 +1,10 @@
+#pragma once
+
+BOOL __stdcall XEngine_Client_Accept(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam);
+void __stdcall XEngine_Client_Recv(LPCTSTR lpszClientAddr, SOCKET hSocket, LPCTSTR lpszRecvMsg, int nMsgLen, LPVOID lParam);
+void __stdcall XEngine_Client_Close(LPCTSTR lpszClientAddr, SOCKET hSocket, LPVOID lParam);
+
+BOOL XEngine_CloseClient(LPCTSTR lpszClientAddr);
+
+BOOL XEngine_Client_TaskSend(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0);
+BOOL XEngine_SendMsg(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0, LPCTSTR lpszPass = NULL);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..df792ed44fac2d994e6cf09dd0c4e2182f86ae67
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp
@@ -0,0 +1,400 @@
+#include "Authorize_Hdr.h"
+
+XHTHREAD CALLBACK XEngine_AuthService_TCPThread(LPVOID lParam)
+{
+ XENGINE_THREADINFO* pSt_ThreadInfo = (XENGINE_THREADINFO*)lParam;
+ int nThreadPos = pSt_ThreadInfo->nPoolIndex + 1;
+
+ while (bIsRun)
+ {
+ if (!HelpComponents_Datas_WaitEventEx(xhPacket, nThreadPos))
+ {
+ continue;
+ }
+ int nMsgLen = 2048;
+ TCHAR tszMsgBuffer[2048];
+ XENGINE_PROTOCOLHDR st_ProtocolHdr;
+
+ memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+
+ int nListCount = 0;
+ HELPCOMPONENT_PACKET_CLIENT** ppSt_ListClient;
+ HelpComponents_Datas_GetPoolEx(xhPacket, nThreadPos, &ppSt_ListClient, &nListCount);
+ for (int i = 0; i < nListCount; i++)
+ {
+ if (!HelpComponents_Datas_GetEx(xhPacket, ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, &nMsgLen, &st_ProtocolHdr))
+ {
+ continue;
+ }
+ if (st_AuthConfig.st_Crypto.bEnable && (ENUM_XENGINE_PROTOCOLHDR_CRYPTO_TYPE_XCRYPT == st_ProtocolHdr.wCrypto))
+ {
+ TCHAR tszPassword[64];
+ TCHAR tszDeBuffer[2048];
+
+ memset(tszPassword, '\0', sizeof(tszPassword));
+ memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
+
+ _stprintf(tszPassword, _T("%d"), st_AuthConfig.st_Crypto.nPassword);
+ OPenSsl_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, tszPassword);
+ XEngine_Client_TCPTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, &st_ProtocolHdr);
+ }
+ else
+ {
+ XEngine_Client_TCPTask(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, &st_ProtocolHdr);
+ }
+ }
+ BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_ListClient, nListCount);
+ }
+ return 0;
+}
+
+BOOL XEngine_Client_TCPTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr)
+{
+ //判断协议头和尾部
+ if ((XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER != pSt_ProtocolHdr->wHeader) || (XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL != pSt_ProtocolHdr->wTail) || (ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH != pSt_ProtocolHdr->unOperatorType))
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,协议错误"), lpszClientAddr);
+ return FALSE;
+ }
+ //用户删除
+ if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQDEL == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPDEL;
+ if (!AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 211;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,用户不存在"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ if ((st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber) || (0 != _tcsncmp(st_UserTable.st_UserInfo.tszEMailAddr, st_UserInfo.tszEMailAddr, _tcslen(st_UserTable.st_UserInfo.tszEMailAddr))) || (0 != _tcsncmp(st_UserTable.st_UserInfo.tszUserPass, st_UserInfo.tszUserPass, _tcslen(st_UserTable.st_UserInfo.tszUserPass))))
+ {
+ pSt_ProtocolHdr->wReserve = 212;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,注销失败,验证信息错误"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ //从数据库删除文件
+ if (!AuthService_SQLPacket_UserDelete(st_UserInfo.tszUserName))
+ {
+ pSt_ProtocolHdr->wReserve = 213;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,注销失败,删除信息失败"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ pSt_ProtocolHdr->unPacketSize = 0;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,注销成功"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQREGISTER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ //用户注册
+ AUTHREG_USERTABLE st_UserTable;
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+
+ memcpy(&st_UserTable.st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPREGISTER;
+ //填充写入数据
+ _stprintf(st_UserTable.tszLeftTime, _T("%d"), st_AuthConfig.st_Verification.nTryTime);
+ st_UserTable.en_AuthRegSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)st_AuthConfig.st_Verification.nTryMode;
+ if (AuthService_SQLPacket_UserRegister(&st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,注册成功"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 231;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,注册失败,无法继续,错误:%X"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName, SQLPacket_GetLastError());
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGIN == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERAUTH st_AuthProtocol;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_AuthProtocol, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
+ memcpy(&st_AuthProtocol, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERAUTH));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPLOGIN;
+ if (!AuthService_SQLPacket_UserQuery(st_AuthProtocol.tszUserName, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 251;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,登录失败,用户名不存在"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ if (0 != _tcsncmp(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcslen(st_AuthProtocol.tszUserPass)))
+ {
+ pSt_ProtocolHdr->wReserve = 252;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,登录失败,密码错误"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ //分析充值类型
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW == st_UserTable.en_AuthRegSerialType)
+ {
+ pSt_ProtocolHdr->wReserve = 253;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,登录失败,客户端类型错误"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ if ('0' == st_UserTable.tszLeftTime[0])
+ {
+ pSt_ProtocolHdr->wReserve = 254;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,登录失败,没有剩余时间了"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ if (!AuthService_Session_Insert(lpszClientAddr, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 255;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,登录失败,插入会话管理失败,错误:%lX"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ return FALSE;
+ }
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,登录成功"), lpszClientAddr, st_AuthProtocol.tszUserName);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQPAY == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_PROTOCOL_USERPAY st_UserPay;
+ memset(&st_UserPay, '\0', sizeof(AUTHREG_PROTOCOL_USERPAY));
+ memcpy(&st_UserPay, lpszMsgBuffer, sizeof(AUTHREG_PROTOCOL_USERPAY));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPPAY;
+ if (AuthService_SQLPacket_UserPay(st_UserPay.tszUserName, st_UserPay.tszSerialNumber))
+ {
+ AUTHREG_USERTABLE st_UserInfo;
+ memset(&st_UserInfo, '\0', sizeof(AUTHREG_USERTABLE));
+ if (AuthService_SQLPacket_UserQuery(st_UserPay.tszUserName, &st_UserInfo))
+ {
+ AuthService_Session_SetUser(&st_UserInfo);
+ }
+ pSt_ProtocolHdr->wReserve = 0;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,充值成功,序列号:%s"), lpszClientAddr, st_UserPay.tszUserName, st_UserPay.tszSerialNumber);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 271;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,充值失败,无法继续,错误:%X"), lpszClientAddr, st_UserPay.tszUserName, SQLPacket_GetLastError());
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETPASS == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+ XENGINE_PROTOCOL_USERAUTH st_AuthProtocol;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+ memset(&st_AuthProtocol, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETPASS;
+ if (!AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_UserTable))
+ {
+ pSt_ProtocolHdr->wReserve = 291;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,找回密码失败,用户不存在"), lpszClientAddr, st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ //安全验证判断
+ if ((0 != _tcsnicmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcslen(st_UserInfo.tszEMailAddr))) || (st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber))
+ {
+ pSt_ProtocolHdr->wReserve = 292;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,找回密码失败,验证信息失败"), lpszClientAddr, st_UserInfo.tszUserName);
+ return FALSE;
+ }
+ _tcscpy(st_AuthProtocol.tszUserName, st_UserTable.st_UserInfo.tszUserName);
+ _tcscpy(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass);
+
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, (LPCTSTR)&st_AuthProtocol, sizeof(XENGINE_PROTOCOL_USERAUTH));
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,找回密码成功"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETTIME == pSt_ProtocolHdr->unOperatorCode)
+ {
+ TCHAR tszUserName[128];
+ AUTHREG_PROTOCOL_TIME st_AuthTime;
+
+ memset(tszUserName, '\0', sizeof(tszUserName));
+ memset(&st_AuthTime, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETTIME;
+ AuthService_Session_GetUserForAddr(lpszClientAddr, tszUserName);
+ if (AuthService_Session_GetTimer(tszUserName, &st_AuthTime))
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr, (LPCTSTR)&st_AuthTime, sizeof(AUTHREG_PROTOCOL_TIME));
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,获取时间成功,类型:%d,在线时间:%ld,剩余时间:%ld"), lpszClientAddr, st_AuthTime.tszUserName, st_AuthTime.enSerialType, st_AuthTime.nTimeONLine, st_AuthTime.nTimeLeft);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 0x2B1;
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,获取时间失败,无法继续,错误:%X"), lpszClientAddr, st_AuthTime.tszUserName, Session_GetLastError());
+ }
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_NOTIFYMSG == pSt_ProtocolHdr->unOperatorCode)
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,发送数据,大小:%d,内容:%s"), lpszClientAddr, pSt_ProtocolHdr->unPacketSize, lpszMsgBuffer);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQTRYVER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_NETVER st_AuthVer;
+ memset(&st_AuthVer, '\0', sizeof(AUTHREG_NETVER));
+
+ memcpy(st_AuthVer.tszVerSerial, lpszMsgBuffer, pSt_ProtocolHdr->unPacketSize);
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPTRYVER;
+ if (AuthService_SQLPacket_TryQuery(&st_AuthVer))
+ {
+ TCHAR tszEndTime[64];
+ __int64x nTimeSpan = 0;
+ memset(tszEndTime, '\0', sizeof(tszEndTime));
+ //根据方式来计算剩余时间
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == st_AuthVer.enVerMode)
+ {
+ nTimeSpan = st_AuthVer.nTryTime;
+ }
+ else
+ {
+ //计算时间差
+ BaseLib_OperatorTime_ToStringTimer(tszEndTime);
+ BaseLib_OperatorTimeSpan_GetForStr(st_AuthVer.tszVerData, tszEndTime, &nTimeSpan, 2);
+ }
+ //是否超过
+ if (nTimeSpan > st_AuthConfig.st_Verification.nVerTime)
+ {
+ pSt_ProtocolHdr->wReserve = 0x2D1;
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_TIMEDOUT;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,序列号:%s,临时验证失败,此序列号已经试用到期"), lpszClientAddr, st_AuthVer.tszVerSerial);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == st_AuthVer.enVerMode)
+ {
+ //次数卡需要更新才可以
+ st_AuthVer.nTryTime++;
+ AuthService_SQLPacket_TrySet(&st_AuthVer);
+ }
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,序列号:%s,临时验证成功,已用时间:%lld"), lpszClientAddr, st_AuthVer.tszVerSerial, nTimeSpan);
+ }
+ }
+ else
+ {
+ //填充写入数据
+ st_AuthVer.nTryTime = st_AuthConfig.st_Verification.nVerTime;
+ st_AuthVer.enVerMode = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)st_AuthConfig.st_Verification.nVerMode;
+ //看下是否启用了此功能
+ if ((ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW == st_AuthVer.enVerMode) || (st_AuthVer.nTryTime <= 0))
+ {
+ pSt_ProtocolHdr->wReserve = 0x2D2;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("客户端:%s,序列号:%s,临时验证插入失败,因为服务器关闭了此功能"), lpszClientAddr, st_AuthVer.tszVerSerial);
+ }
+ else
+ {
+ if (AuthService_SQLPacket_TryInsert(&st_AuthVer))
+ {
+ pSt_ProtocolHdr->unPacketSize = 0;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,序列号:%s,临时验证插入成功"), lpszClientAddr, st_AuthVer.tszVerSerial);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 0x2D3;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,序列号:%s,临时验证插入失败,无法继续,错误:%X"), lpszClientAddr, st_AuthVer.tszVerSerial, SQLPacket_GetLastError());
+ }
+ }
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQGETUSER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_UserTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+
+ memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPGETUSER;
+ if (AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_UserTable))
+ {
+ if ((0 == _tcsncmp(st_UserInfo.tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcslen(st_UserInfo.tszUserPass))) && (0 != _tcsnicmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcslen(st_UserInfo.tszEMailAddr))) && (st_UserInfo.nIDNumber == st_UserTable.st_UserInfo.nIDNumber))
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,请求查询用户信息成功"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2100;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,请求查询用户信息失败,密码错误"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2101;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,请求查询用户信息失败,帐户不存在"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ }
+ else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQSETUSER == pSt_ProtocolHdr->unOperatorCode)
+ {
+ AUTHREG_USERTABLE st_SQLTable;
+ XENGINE_PROTOCOL_USERINFO st_UserInfo;
+
+ memset(&st_SQLTable, '\0', sizeof(AUTHREG_USERTABLE));
+ memset(&st_UserInfo, '\0', sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ memcpy(&st_UserInfo, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERINFO));
+
+ pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPSETUSER;
+ if (AuthService_SQLPacket_UserQuery(st_UserInfo.tszUserName, &st_SQLTable))
+ {
+ if ((0 == _tcsncmp(st_UserInfo.tszUserPass, st_SQLTable.st_UserInfo.tszUserPass, _tcslen(st_UserInfo.tszUserPass))) && (0 != _tcsnicmp(st_UserInfo.tszEMailAddr, st_SQLTable.st_UserInfo.tszEMailAddr, _tcslen(st_UserInfo.tszEMailAddr))) && (st_UserInfo.nIDNumber == st_SQLTable.st_UserInfo.nIDNumber))
+ {
+ memcpy(&st_SQLTable.st_UserInfo, &st_UserInfo, sizeof(XENGINE_PROTOCOL_USERINFO));
+ if (AuthService_SQLPacket_UserSet(&st_SQLTable))
+ {
+ pSt_ProtocolHdr->wReserve = 0;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("客户端:%s,用户名:%s,请求设置用户信息成功\r\n"), lpszClientAddr, st_UserInfo.tszUserName);
+
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2120;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,请求设置用户信息失败,错误:%lX\r\n"), lpszClientAddr, st_UserInfo.tszUserName, SQLPacket_GetLastError());
+ }
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2121;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,请求设置用户信息失败,信息不匹配\r\n"), lpszClientAddr, st_UserInfo.tszUserName);
+ }
+ }
+ else
+ {
+ pSt_ProtocolHdr->wReserve = 2122;
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("客户端:%s,用户名:%s,请求设置用户信息失败,错误:%lX\r\n"), lpszClientAddr, st_UserInfo.tszUserName, SQLPacket_GetLastError());
+ }
+ XEngine_Client_TaskSend(lpszClientAddr, pSt_ProtocolHdr);
+ }
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.h
new file mode 100644
index 0000000000000000000000000000000000000000..99862f4c84f1b40b06f45a7a22b18463fa742b33
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.h
@@ -0,0 +1,9 @@
+#pragma once
+
+typedef struct
+{
+ int nPoolIndex;
+}XENGINE_THREADINFO;
+
+XHTHREAD CALLBACK XEngine_AuthService_TCPThread(LPVOID lParam);
+BOOL XEngine_Client_TCPTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b8e63843790e171ba75e0e83512ef9a8f6f93c1d
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.cpp
@@ -0,0 +1,19 @@
+#include "Authorize_Hdr.h"
+
+LPCSTR lpszKeyType[] = { "未知类型","分钟卡","天数卡","次数卡","自定义卡" };
+void __stdcall XEngine_TaskEvent_Client(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthRegSerialType, LPVOID lParam)
+{
+ if (nLeftTimer <= 0)
+ {
+ XENGINE_PROTOCOLHDR st_ProtocolHdr;
+ memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
+
+ st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
+ st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH;
+ st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_TIMEDOUT;
+ st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
+
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("用户:%s,地址:%s,没有剩余时间,已经通知客户单超时\r\n"), lpszUserName, lpszUserAddr);
+ XEngine_Client_TaskSend(lpszUserAddr, &st_ProtocolHdr);
+ }
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8eeaccb4608f85d1f19a008e9858210738445fc
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void __stdcall XEngine_TaskEvent_Client(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthRegSerialType, LPVOID lParam);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..0f5e31092312d4144c7462ed68e00eba034d9c62
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile
@@ -0,0 +1,48 @@
+CC = g++ -Wall
+RELEASE = 0
+UNICODE = 0
+LOADBIN = -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_Core -L /usr/local/lib/XEngine_Release/XEngine_HelpComponents -L /usr/local/lib/XEngine_Release/XEngine_SystemSdk -L ../../XEngine_AuthComponents/AuthComponents_Session -L ../../XEngine_AuthComponents/AuthComponents_SQLPacket -L ../../AuthorizeModule_Protocol -L ../../AuthorizeModule_Configure
+LIB = -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXEngine_OPenSsl -lHelpComponents_Packets -lHelpComponents_DataBase -lHelpComponents_XLog -lHelpComponents_Authorize -lXEngine_ProcSdk -lXEngine_SystemApi -lAuthComponents_Session -lAuthComponents_SQLPacket -lAuthorizeModule_Protocol -lAuthorizeModule_Configure
+LIBEX = -static-libgcc -ldl -lrt -lpthread
+LOADSO = -Wl,-rpath=./,--disable-new-dtags
+LIBINCLUDE = Authorize_Config.o Authorize_Net.o Authorize_Task.o Authorize_TCPTask.o XEngine_AuthorizeService.o
+
+ifeq ($(RELEASE),1)
+FLAGS = -c -O2
+DEBUG =
+else
+FLAGS = -c -lc_p
+DEBUG = -g -pg
+endif
+
+ifeq ($(UNICODE),1)
+UNICODE = -D _UNICODE
+else
+UNICODE =
+endif
+
+all:$(LIBINCLUDE)
+ $(CC) $(DEBUG) $(LIBINCLUDE) -o XEngine_AuthorizeService $(LOADBIN) $(LIB) $(LIBEX) $(LOADSO)
+
+Authorize_Config.o:./Authorize_Config.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./Authorize_Config.cpp
+Authorize_Net.o:./Authorize_Net.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./Authorize_Net.cpp
+Authorize_Task.o:./Authorize_Task.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./Authorize_Task.cpp
+Authorize_TCPTask.o:./Authorize_TCPTask.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./Authorize_TCPTask.cpp
+
+XEngine_AuthorizeService.o:./XEngine_AuthorizeService.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./XEngine_AuthorizeService.cpp
+
+
+InstallAll:InstallApp
+InstallApp:./XEngine_AuthorizeService
+ cp -f ./XEngine_AuthorizeService ../../../XEngine_Release/XEngine_AuthorizeService
+
+CleanAll:CleanObj CleanMk
+CleanObj:
+ rm *.o
+CleanMk:
+ rm XEngine_AuthorizeService
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..eb491c02112138cea85d90cb6857a43d65842b43
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp
@@ -0,0 +1,167 @@
+#include "Authorize_Hdr.h"
+
+BOOL bIsRun = FALSE;
+XLOG xhLog = NULL;
+XNETHANDLE xhSocket = 0;
+XNETHANDLE xhPacket = 0;
+XNETHANDLE xhPool = 0;
+AUTHORIZE_CONFIGURE st_AuthConfig;
+
+void ServiceApp_Stop(int signo)
+{
+ if (bIsRun)
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("网络验证服务器退出..."));
+ bIsRun = FALSE;
+
+ HelpComponents_Datas_Destory(xhPacket);
+ NetCore_TCPXCore_DestroyEx(xhSocket);
+ ManagePool_Thread_NQDestroy(xhPool);
+ HelpComponents_XLog_Destroy(xhLog);
+
+ AuthService_Session_Destroy();
+ AuthService_SQLPacket_Destroy();
+ exit(0);
+ }
+}
+static int ServiceApp_Deamon(int wait)
+{
+#ifndef _WINDOWS
+ pid_t pid = 0;
+ int status;
+ pid = fork();
+ if (pid > 0)
+ {
+ exit(0);
+ }
+
+ close(2);
+ while (1)
+ {
+
+ pid = fork();
+ if (pid < 0)
+ exit(1);
+ if (pid == 0)
+ {
+ return 0;
+ }
+ waitpid(pid, &status, 0);
+
+ if (wait > 0)
+ sleep(wait);
+ }
+#endif
+ return 0;
+}
+
+int main(int argc, char** argv)
+{
+#ifdef _WINDOWS
+ WSADATA st_WSAData;
+ WSAStartup(MAKEWORD(2, 2), &st_WSAData);
+#endif
+ bIsRun = TRUE;
+ HELPCOMPONENTS_XLOG_CONFIGURE st_XLogConfig;
+ THREADPOOL_PARAMENT** ppSt_ListThread;
+
+ memset(&st_XLogConfig, '\0', sizeof(HELPCOMPONENTS_XLOG_CONFIGURE));
+ memset(&st_AuthConfig, '\0', sizeof(AUTHORIZE_CONFIGURE));
+
+ if (!Authorize_Service_Parament(argc, argv))
+ {
+ return -1;
+ }
+ st_XLogConfig.XLog_MaxBackupFile = st_AuthConfig.st_XLog.nMaxCount;
+ st_XLogConfig.XLog_MaxSize = st_AuthConfig.st_XLog.nMaxSize;
+ _tcscpy(st_XLogConfig.tszFileName, st_AuthConfig.st_XLog.tszLogFile);
+
+ xhLog = HelpComponents_XLog_Init(HELPCOMPONENTS_XLOG_OUTTYPE_FILE | HELPCOMPONENTS_XLOG_OUTTYPE_STD, &st_XLogConfig);
+ if (NULL == xhLog)
+ {
+ printf("启动服务器失败,启动日志失败,错误:%lX", XLog_GetLastError());
+ goto XENGINE_EXITAPP;
+ }
+ HelpComponents_XLog_SetLogPriority(xhLog, st_AuthConfig.st_XLog.nLogLeave);
+
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,初始化日志系统成功,日志文件:%s"), st_AuthConfig.st_XLog.tszLogFile);
+ if (st_AuthConfig.bDeamon)
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,使用守护进程启动服务..."));
+ ServiceApp_Deamon(1);
+ }
+
+ signal(SIGINT, ServiceApp_Stop);
+ signal(SIGTERM, ServiceApp_Stop);
+ signal(SIGABRT, ServiceApp_Stop);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,初始化服务器信号管理成功"));
+
+ if (!AuthService_SQLPacket_Init(st_AuthConfig.st_XSql.tszSQLite))
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("启动服务中,初始化数据库服务失败,错误:%lX"), SQLPacket_GetLastError());
+ goto XENGINE_EXITAPP;
+ }
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,初始化数据库服务成功,数据库:%s"), st_AuthConfig.st_XSql.tszSQLite);
+
+ if (!AuthService_Session_Init(XEngine_TaskEvent_Client))
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("启动服务中,初始化会话服务失败,错误:%lX"), Session_GetLastError());
+ goto XENGINE_EXITAPP;
+ }
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,初始化会话服务成功"));
+
+ if (!HelpComponents_Datas_Init(&xhPacket, 10000, 0, st_AuthConfig.nThreads))
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("启动服务中,初始化组包器失败,错误:%lX"), Packets_GetLastError());
+ goto XENGINE_EXITAPP;
+ }
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,初始化组包器成功,句柄:%llu,任务池个数:%d"), xhPacket, st_AuthConfig.nThreads);
+
+ if (!NetCore_TCPXCore_StartEx(&xhSocket, st_AuthConfig.nPort, 10000, st_AuthConfig.nThreads))
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("启动服务中,启动验证网络服务失败,错误:%lX"), NetCore_GetLastError());
+ goto XENGINE_EXITAPP;
+ }
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,初始化验证网络服务成功,句柄:%llu,端口:%d,网络池个数:%d"), xhSocket, st_AuthConfig.nPort, st_AuthConfig.nThreads);
+ NetCore_TCPXCore_RegisterCallBackEx(xhSocket, XEngine_Client_Accept, XEngine_Client_Recv, XEngine_Client_Close);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,初始化验证网络事件成功"));
+
+ BaseLib_OperatorMemory_Malloc((XPPPMEM)&ppSt_ListThread, st_AuthConfig.nThreads, sizeof(THREADPOOL_PARAMENT));
+ for (int i = 0; i < st_AuthConfig.nThreads; i++)
+ {
+ XENGINE_THREADINFO* pSt_AuthThread = new XENGINE_THREADINFO;
+
+ pSt_AuthThread->nPoolIndex = i;
+ ppSt_ListThread[i]->lParam = pSt_AuthThread;
+ ppSt_ListThread[i]->fpCall_ThreadsTask = XEngine_AuthService_TCPThread;
+ }
+ ManagePool_Thread_NQCreate(&xhPool, &ppSt_ListThread, st_AuthConfig.nThreads);
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("启动服务中,启动线程池成功,线程个数:%d"), st_AuthConfig.nThreads);
+
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("所有服务成功启动,网络验证服务运行中,当前运行版本:2.2.0.1001。。。"));
+ while (bIsRun)
+ {
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ }
+
+XENGINE_EXITAPP:
+
+ if (bIsRun)
+ {
+ XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("网络验证服务器退出..."));
+ bIsRun = FALSE;
+
+ HelpComponents_Datas_Destory(xhPacket);
+ NetCore_TCPXCore_DestroyEx(xhSocket);
+ ManagePool_Thread_NQDestroy(xhPool);
+ HelpComponents_XLog_Destroy(xhLog);
+
+ AuthService_Session_Destroy();
+ AuthService_SQLPacket_Destroy();
+ exit(0);
+ }
+#ifdef _WINDOWS
+ WSACleanup();
+#endif
+ return 0;
+}
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..20138233d21f17ba3270ab1c1b0db5ae5e6bd441
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj
@@ -0,0 +1,164 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {a29dfd8d-2818-4be3-a2db-07f241b4bfc9}
+ XEngineAuthorizeService
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ MultiByte
+
+
+ Application
+ false
+ v142
+ true
+ MultiByte
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ false
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ 4819
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ 4819
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..5913cba66d9faee4330f25f7c7f8c4af2549f302
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters
@@ -0,0 +1,51 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件
+
+
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.user b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822
--- /dev/null
+++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.def b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.def
new file mode 100644
index 0000000000000000000000000000000000000000..f9f4e4745e1c5958c9a851c44620b24144f6dc0b
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.def
@@ -0,0 +1,22 @@
+LIBRARY
+
+EXPORTS
+ SQLPacket_GetLastError
+
+ AuthService_SQLPacket_Init
+ AuthService_SQLPacket_Destroy
+ AuthService_SQLPacket_UserDelete
+ AuthService_SQLPacket_UserRegister
+ AuthService_SQLPacket_UserQuery
+ AuthService_SQLPacket_UserPay
+ AuthService_SQLPacket_UserLeave
+ AuthService_SQLPacket_UserSet
+ AuthService_SQLPacket_SerialInsert
+ AuthService_SQLPacket_SerialDelete
+ AuthService_SQLPacket_SerialQuery
+ AuthService_SQLPacket_SerialQueryAll
+ AuthService_SQLPacket_TryInsert
+ AuthService_SQLPacket_TryQuery
+ AuthService_SQLPacket_TryDelete
+ AuthService_SQLPacket_TryClear
+ AuthService_SQLPacket_TrySet
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..8d76c5886e5f40415953539edfe97183dc339e9c
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj
@@ -0,0 +1,187 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {84de72b3-131e-4f30-9e73-152bdca328ea}
+ AuthComponentsSQLPacket
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v142
+ MultiByte
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ MultiByte
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ false
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;AUTHCOMPONENTSSQLPACKET_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+ 4819
+
+
+ Windows
+ true
+ false
+ AuthComponents_SQLPacket.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;AUTHCOMPONENTSSQLPACKET_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+ MultiThreaded
+ 4819
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthComponents_SQLPacket.def
+
+
+
+
+ Level3
+ true
+ _DEBUG;AUTHCOMPONENTSSQLPACKET_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ false
+ AuthComponents_SQLPacket.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;AUTHCOMPONENTSSQLPACKET_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthComponents_SQLPacket.def
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj.filters b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..0e225ce2b8fb8aa18eefdd0776ae4a16a500a730
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj.filters
@@ -0,0 +1,56 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {981c92b7-f85d-46f7-bca9-9900ec72e104}
+
+
+ {b3b538fe-d943-422e-b188-32ec875e355c}
+
+
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件\AuthService_SQLPacket
+
+
+ 头文件
+
+
+ 头文件
+
+
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件\AuthService_SQLPacket
+
+
+
+
+ 源文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj.user b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthComponents_SQLPacket.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthService_SQLPacket/AuthService_SQLPacket.cpp b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthService_SQLPacket/AuthService_SQLPacket.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5a05afc5dcb93f7dca1bfadd830f26efd84893cc
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthService_SQLPacket/AuthService_SQLPacket.cpp
@@ -0,0 +1,1143 @@
+#include "pch.h"
+#include "AuthService_SQLPacket.h"
+/********************************************************************
+// Created: 2021/07/14 11:40:37
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\AuthService_SQLPacket\AuthService_SQLPacket.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\AuthService_SQLPacket
+// File Base: AuthService_SQLPacket
+// File Ext: cpp
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 数据库管理器
+// History:
+*********************************************************************/
+CAuthService_SQLPacket::CAuthService_SQLPacket()
+{
+ m_bChange = FALSE;
+}
+CAuthService_SQLPacket::~CAuthService_SQLPacket()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+// 公有函数
+//////////////////////////////////////////////////////////////////////////
+/********************************************************************
+函数名称:AuthService_SQLPacket_Init
+函数功能:初始化数据库服务
+ 参数.一:lpszSQLFile
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:数据库文件路径
+ 参数.二:bIsChange
+ In/Out:In
+ 类型:逻辑型
+ 可空:Y
+ 意思:是否允许更改用户充值类型
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:先初始化数据库服务,在初始化网络服务,才可以使用本验证服务器!
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_Init(LPCTSTR lpszSQLFile, BOOL bIsChange /* = TRUE */)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+ BOOL bIsCreate = FALSE;
+ //创建数据库
+ if (!DataBase_SQLite_Create(lpszSQLFile))
+ {
+ //如果不是这个错误,说明创建数据库失败了
+ if (ERROR_HELPCOMPONENTS_DATABASE_SQLITE_CREATE_ISEXIST != DataBase_GetLastError())
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ }
+ else
+ {
+ bIsCreate = TRUE;
+ }
+ m_bChange = bIsChange;
+ //打开数据库
+ if (!DataBase_SQLite_Open(&xhData,lpszSQLFile))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ //如果是否创建数据库为真,那么我们需要创建数据库
+ if (bIsCreate)
+ {
+ //如果创建成功了,说明需要创建表
+ if (!DataBase_SQLite_Exec(xhData,_T("CREATE TABLE AuthReg_User(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,UserName TEXT,Password TEXT,LeftTime TEXT,EmailAddr TEXT,HardCode TEXT,CardSerialType integer,PhoneNumber integer,IDCard integer,CreateTime TEXT NOT NULL)")))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE;
+ return FALSE;
+ }
+ if (!DataBase_SQLite_Exec(xhData,_T("CREATE TABLE AuthReg_Serial(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,UserName TEXT,SerialNumber TEXT,MaxTime TEXT,CardSerialType integer,bIsUsed boolean,CreateTime TEXT NOT NULL)")))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE;
+ return FALSE;
+ }
+ if (!DataBase_SQLite_Exec(xhData, _T("CREATE TABLE AuthReg_NetVer(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,VerSerial TEXT NOT NULL,VerMode integer NOT NULL,TryTime integer NOT NULL,CreateTime TEXT NOT NULL)")))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_Destroy
+函数功能:销毁数据库服务
+返回值
+ 类型:逻辑型
+ 意思:是否销毁成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_Destroy()
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ if (!DataBase_SQLite_Close(xhData))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserDelete
+函数功能:删除一个用户从数据库中
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要删除的用户
+返回值
+ 类型:逻辑型
+ 意思:是否删除成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_UserDelete(LPCTSTR lpszUserName)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ memset(tszSQLStatement,'\0',1024);
+ _stprintf_s(tszSQLStatement,_T("delete from AuthReg_User where UserName = '%s'"),lpszUserName);
+ //执行
+ if (!DataBase_SQLite_Exec(xhData,tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_DELETE_EXEC;
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserRegister
+函数功能:用户注册处理数据库语句函数
+ 参数.一:pSt_UserInfo
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:要插入的用户数据
+返回值
+ 类型:逻辑型
+ 意思:是否插入成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_UserRegister(AUTHREG_USERTABLE* pSt_UserInfo)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ memset(tszSQLStatement,'\0',1024);
+
+ if (AuthService_SQLPacket_UserQuery(pSt_UserInfo->st_UserInfo.tszUserName))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_EXIST;
+ return FALSE;
+ }
+ _stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_User(UserName, Password, LeftTime, EmailAddr, HardCode, CardSerialType, PhoneNumber, IDCard, CreateTime) values('%s','%s','%s','%s','%s','%d',%lld,%lld,datetime('now', 'localtime'))"), pSt_UserInfo->st_UserInfo.tszUserName, pSt_UserInfo->st_UserInfo.tszUserPass, pSt_UserInfo->tszLeftTime, pSt_UserInfo->st_UserInfo.tszEMailAddr, pSt_UserInfo->tszHardCode, pSt_UserInfo->en_AuthRegSerialType, pSt_UserInfo->st_UserInfo.nPhoneNumber, pSt_UserInfo->st_UserInfo.nIDNumber);
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_INSERT;
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserQuery
+函数功能:查询用户相对应的值
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要查询的指定用户
+ 参数.二:pSt_UserInfo
+ In/Out:Out
+ 类型:数据结构指针
+ 可空:Y
+ 意思:如果为空NULL,那么将只判断此用户是否存在
+返回值
+ 类型:逻辑型
+ 意思:是否查询成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_UserQuery(LPCTSTR lpszUserName, AUTHREG_USERTABLE* pSt_UserInfo /* = NULL */)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ char **ppszResult = NULL;
+ int nRow = 0;
+ int nColumn = 0;
+ memset(tszSQLStatement,'\0',1024);
+
+ _stprintf_s(tszSQLStatement,_T("select * from AuthReg_User where UserName = '%s'"),lpszUserName);
+ if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_GETTABLE;
+ return FALSE;
+ }
+ if ((0 == nRow) || (0 == nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_NOTUSER;
+ return FALSE;
+ }
+ //如果是NULL,表示不想知道结果
+ if (NULL != pSt_UserInfo)
+ {
+ memset(pSt_UserInfo, '\0', sizeof(AUTHREG_USERTABLE));
+ //ID
+ int nFliedValue = nColumn;
+ //用户名
+ nFliedValue++;
+ _tcscpy(pSt_UserInfo->st_UserInfo.tszUserName, ppszResult[nFliedValue]);
+ //密码
+ nFliedValue++;
+ _tcscpy(pSt_UserInfo->st_UserInfo.tszUserPass, ppszResult[nFliedValue]);
+ //过期时间
+ nFliedValue++;
+ _tcscpy(pSt_UserInfo->tszLeftTime, ppszResult[nFliedValue]);
+ //电子邮件
+ nFliedValue++;
+ _tcscpy(pSt_UserInfo->st_UserInfo.tszEMailAddr, ppszResult[nFliedValue]);
+ //硬件码
+ nFliedValue++;
+ _tcscpy(pSt_UserInfo->tszHardCode, ppszResult[nFliedValue]);
+ //充值卡类型
+ nFliedValue++;
+ pSt_UserInfo->en_AuthRegSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]);
+ //QQ号
+ nFliedValue++;
+ pSt_UserInfo->st_UserInfo.nPhoneNumber = _tcstoi64(ppszResult[nFliedValue], NULL, 10);
+ //身份证ID
+ nFliedValue++;
+ pSt_UserInfo->st_UserInfo.nIDNumber = _tcstoi64(ppszResult[nFliedValue], NULL, 10);
+ //注册日期
+ nFliedValue++;
+ _tcscpy(pSt_UserInfo->st_UserInfo.tszCreateTime, ppszResult[nFliedValue]);
+ }
+
+ DataBase_SQLite_FreeTable(ppszResult);
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserPay
+函数功能:用户充值函数
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要充值的用户名
+ 参数.二:lpszSerialName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:充值使用的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否成功充值
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_UserPay(LPCTSTR lpszUserName,LPCTSTR lpszSerialName)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ AUTHREG_SERIALTABLE st_SerialTable;
+ AUTHREG_USERTABLE st_UserTable;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+
+ memset(tszSQLStatement,'\0',1024);
+ memset(&st_SerialTable,'\0',sizeof(st_SerialTable));
+ memset(&st_UserTable,'\0',sizeof(st_UserTable));
+ //参数检查
+ if ((NULL == lpszUserName) || (NULL == lpszSerialName))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_PARAMENT;
+ return FALSE;
+ }
+ //查询充值卡是否存在
+ if (!AuthService_SQLPacket_SerialQuery(lpszSerialName,&st_SerialTable))
+ {
+ return FALSE;
+ }
+ //充值卡是否被使用
+ if (st_SerialTable.bIsUsed)
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_ISUSED;
+ return FALSE;
+ }
+ //查询用户信息
+ if (!AuthService_SQLPacket_UserQuery(lpszUserName,&st_UserTable))
+ {
+ return FALSE;
+ }
+ //分析插入方式
+ switch (st_SerialTable.en_AuthRegSerialType)
+ {
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE:
+ if (!AuthService_SQLPacket_UserPayTime(lpszUserName, st_UserTable.tszLeftTime, st_SerialTable.tszMaxTime, st_SerialTable.en_AuthRegSerialType, st_UserTable.en_AuthRegSerialType))
+ {
+ return FALSE;
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_DAY:
+ if (!AuthService_SQLPacket_UserPayTime(lpszUserName, st_UserTable.tszLeftTime, st_SerialTable.tszMaxTime, st_SerialTable.en_AuthRegSerialType, st_UserTable.en_AuthRegSerialType))
+ {
+ return FALSE;
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME:
+ if (!AuthService_SQLPacket_UserPayTime(lpszUserName, st_UserTable.tszLeftTime, st_SerialTable.tszMaxTime, st_SerialTable.en_AuthRegSerialType, st_UserTable.en_AuthRegSerialType))
+ {
+ return FALSE;
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM:
+ if (!AuthService_SQLPacket_UserPayTime(lpszUserName, st_UserTable.tszLeftTime, st_SerialTable.tszMaxTime, st_SerialTable.en_AuthRegSerialType, st_UserTable.en_AuthRegSerialType))
+ {
+ return FALSE;
+ }
+ break;
+ default:
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_NOTSUPPORT;
+ return FALSE;
+ }
+ _stprintf_s(tszSQLStatement,_T("UPDATE AuthReg_Serial SET UserName = '%s',bIsUsed = '1' WHERE SerialNumber = '%s'"),lpszUserName,lpszSerialName);
+ if (!DataBase_SQLite_Exec(xhData,tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_UPDATAUSEDNAME;
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserLeave
+函数功能:用户离开处理事件
+ 参数.一:pSt_TimeProtocol
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:离开的用户信息
+返回值
+ 类型:逻辑型
+ 意思:是否处理成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_UserLeave(AUTHREG_PROTOCOL_TIME* pSt_TimeProtocol)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ memset(tszSQLStatement, '\0', 1024);
+
+ if ((ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_DAY == pSt_TimeProtocol->enSerialType) || (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM == pSt_TimeProtocol->enSerialType))
+ {
+ //天数卡只有剩余时间没有的时候才需要做处理
+ if (pSt_TimeProtocol->nTimeLeft <= 0)
+ {
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '0' WHERE UserName = '%s'"), pSt_TimeProtocol->tszUserName);
+ }
+ }
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE == pSt_TimeProtocol->enSerialType)
+ {
+ //分钟卡必须要有在线时间才能计算
+ if (pSt_TimeProtocol->nTimeLeft <= 0)
+ {
+ pSt_TimeProtocol->nTimeLeft = 0;
+ }
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%lld' WHERE UserName = '%s'"), pSt_TimeProtocol->nTimeLeft, pSt_TimeProtocol->tszUserName);
+ }
+ else if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == pSt_TimeProtocol->enSerialType)
+ {
+ //次数卡不需要在线时间,直接减去一次就可以了
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%lld' WHERE UserName = '%s'"), _ttoi64(pSt_TimeProtocol->tszLeftTime) - 1, pSt_TimeProtocol->tszUserName);
+ }
+ else
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UNKNOWTYPE;
+ return FALSE;
+ }
+ //更新用户剩余时间
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UPDATA;
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserSet
+函数功能:设置用户信息
+ 参数.一:pSt_UserTable
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要设置的信息
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_UserSet(AUTHREG_USERTABLE* pSt_UserTable)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ memset(tszSQLStatement, '\0', 1024);
+
+
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET Password = '%s',EmailAddr = '%s',PhoneNumber = '%lld',IDCard = '%lld',LeftTime = '%s',CardSerialType = '%d' WHERE UserName = '%s'"), pSt_UserTable->st_UserInfo.tszUserPass, pSt_UserTable->st_UserInfo.tszEMailAddr, pSt_UserTable->st_UserInfo.nPhoneNumber, pSt_UserTable->st_UserInfo.nIDNumber, pSt_UserTable->tszLeftTime, pSt_UserTable->en_AuthRegSerialType, pSt_UserTable->st_UserInfo.tszUserName);
+ //更新用户剩余时间
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_SerialInsert
+函数功能:插入一个序列号到数据库
+ 参数.一:lpszSerialNumber
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要插入的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否插入成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_SerialInsert(LPCTSTR lpszSerialNumber)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ memset(tszSQLStatement,'\0',1024);
+
+ if (AuthService_SQLPacket_SerialQuery(lpszSerialNumber))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_EXIST;
+ return FALSE;
+ }
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enAuthSerialType;
+ XENGINE_LIBTIMER st_AuthTimer;
+ memset(&st_AuthTimer,'\0',sizeof(st_AuthTimer));
+
+ if (!Authorize_Serial_GetType(lpszSerialNumber, &enAuthSerialType, &st_AuthTimer))
+ {
+ return FALSE;
+ }
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE == enAuthSerialType)
+ {
+ _stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_Serial values(NULL,'NOT','%s','%d','%d',0,datetime('now', 'localtime'))"), lpszSerialNumber, st_AuthTimer.wMinute, enAuthSerialType);
+ }
+ else if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_DAY == enAuthSerialType)
+ {
+ _stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_Serial values(NULL,'NOT','%s','%d','%d',0,datetime('now', 'localtime'))"), lpszSerialNumber, st_AuthTimer.wDay, enAuthSerialType);
+ }
+ else if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME == enAuthSerialType)
+ {
+ _stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_Serial values(NULL,'NOT','%s','%d','%d',0,datetime('now', 'localtime'))"), lpszSerialNumber, st_AuthTimer.wFlags, enAuthSerialType);
+ }
+ else if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM == enAuthSerialType)
+ {
+ TCHAR tszLeftTime[MAX_PATH];
+ memset(tszLeftTime, '\0', MAX_PATH);
+ _stprintf_s(tszLeftTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), st_AuthTimer.wYear, st_AuthTimer.wMonth, st_AuthTimer.wDay, st_AuthTimer.wHour, st_AuthTimer.wMinute, st_AuthTimer.wSecond);
+ _stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_Serial values(NULL,'NOT','%s','%s','%d',0,datetime('now', 'localtime'))"), lpszSerialNumber, tszLeftTime, enAuthSerialType);
+ }
+ else
+ {
+ _stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_Serial values(NULL,'NOT','%s',0,'%d',0,datetime('now', 'localtime'))"), lpszSerialNumber, enAuthSerialType);
+ }
+
+ if (!DataBase_SQLite_Exec(xhData,tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_ISFAILED;
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_SerialDelete
+函数功能:从数据库删除指定序列号
+ 参数.一:lpszSerialNumber
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要删除的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否删除成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_SerialDelete(LPCTSTR lpszSerialNumber)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ memset(tszSQLStatement,'\0',1024);
+ _stprintf_s(tszSQLStatement,_T("delete from AuthReg_Serial where SerialNumber = '%s'"),lpszSerialNumber);
+ //执行
+ if (!DataBase_SQLite_Exec(xhData,tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALDEL_ISFAILED;
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_SerialQuery
+函数功能:查询一个指定的序列号信息
+ 参数.一:lpszSerialNumber
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要查询的序列号
+ 参数.二:pSt_SerialTable
+ In/Out:Out
+ 类型:数据结构指针
+ 可空:Y
+ 意思:导出查询到的信息,如果为NULL,此参数将不起作用
+返回值
+ 类型:逻辑型
+ 意思:是否查询成功,如果第二个参数为NULL,那么将只返回是否有这个序列号
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_SerialQuery(LPCTSTR lpszSerialNumber,LPAUTHREG_SERIALTABLE pSt_SerialTable /* = NULL */)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+ char **ppszResult = NULL;
+ int nRow = 0;
+ int nColumn = 0;
+ memset(tszSQLStatement,'\0',1024);
+
+ _stprintf_s(tszSQLStatement,_T("select * from AuthReg_Serial where SerialNumber = '%s'"),lpszSerialNumber);
+ if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_GETTABLE;
+ return FALSE;
+ }
+ if ((0 == nRow) || (0 == nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_SERIAL;
+ return FALSE;
+ }
+ if (NULL != pSt_SerialTable)
+ {
+ memset(pSt_SerialTable, '\0', sizeof(AUTHREG_SERIALTABLE));
+ //ID
+ int nFliedValue = nColumn;
+ //使用者
+ nFliedValue++;
+ _tcscpy(pSt_SerialTable->tszUserName,ppszResult[nFliedValue]);
+ //序列号
+ nFliedValue++;
+ _tcscpy(pSt_SerialTable->tszSerialNumber,ppszResult[nFliedValue]);
+ //超时时间
+ nFliedValue++;
+ _tcscpy(pSt_SerialTable->tszMaxTime,ppszResult[nFliedValue]);
+ //序列卡类型
+ nFliedValue++;
+ pSt_SerialTable->en_AuthRegSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]);
+ //是否已经使用
+ nFliedValue++;
+ pSt_SerialTable->bIsUsed = _ttoi(ppszResult[nFliedValue]);
+ //超时时间
+ nFliedValue++;
+ _tcscpy(pSt_SerialTable->tszCreateTime, ppszResult[nFliedValue]);
+ }
+
+ DataBase_SQLite_FreeTable(ppszResult);
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_SerialQueryAll
+函数功能:查询序列卡表中的所有序列号
+ 参数.一:pppSt_SerialTable
+ In/Out:Out
+ 类型:三级指针
+ 可空:N
+ 意思:输出序列卡列表
+ 参数.二:pInt_ListCount
+ In/Out:Out
+ 类型:整数型指针
+ 可空:Y
+ 意思:输出多少张卡
+返回值
+ 类型:逻辑型
+ 意思:是否查询成功
+备注:参数一需要调用基础库的释放内存函数进行内存释放
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_SerialQueryAll(AUTHREG_SERIALTABLE ***pppSt_SerialTable,int *pInt_ListCount)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ int nRow = 0;
+ int nColumn = 0;
+ char** ppszResult = NULL;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+
+ memset(tszSQLStatement,'\0',1024);
+
+ _stprintf_s(tszSQLStatement,_T("select * from AuthReg_Serial"));
+ if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_GETTABLE;
+ return FALSE;
+ }
+ if ((0 == nRow) || (0 == nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_NONE;
+ return FALSE;
+ }
+ BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_SerialTable, nRow, sizeof(AUTHREG_SERIALTABLE));
+
+ *pInt_ListCount = nRow;
+ int nFliedValue = nColumn;
+ for (int i = 0;i < nRow;i++)
+ {
+ //ID
+ nFliedValue++;
+ //使用者
+ _tcscpy((*pppSt_SerialTable)[i]->tszUserName,ppszResult[nFliedValue]);
+ nFliedValue++;
+ //序列号
+ _tcscpy((*pppSt_SerialTable)[i]->tszSerialNumber,ppszResult[nFliedValue]);
+ nFliedValue++;
+ //超时时间
+ _tcscpy((*pppSt_SerialTable)[i]->tszMaxTime,ppszResult[nFliedValue]);
+ nFliedValue++;
+ //序列卡类型
+ (*pppSt_SerialTable)[i]->en_AuthRegSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]);
+ nFliedValue++;
+ //是否已经使用
+ (*pppSt_SerialTable)[i]->bIsUsed = _ttoi(ppszResult[nFliedValue]);
+ nFliedValue++;
+ //创建时间
+ _tcscpy((*pppSt_SerialTable)[i]->tszCreateTime, ppszResult[nFliedValue]);
+ nFliedValue++;
+ }
+ DataBase_SQLite_FreeTable(ppszResult);
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryInsert
+函数功能:网络使用模式插入一条数据
+ 参数.一:pSt_AuthVer
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要插入的数据
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_TryInsert(AUTHREG_NETVER* pSt_AuthVer)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ if (NULL == pSt_AuthVer)
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_PARAMENT;
+ return FALSE;
+ }
+ TCHAR tszSQLStatement[1024];
+ AUTHREG_NETVER st_AuthVer;
+
+ memset(tszSQLStatement, '\0', 1024);
+ memset(&st_AuthVer, '\0', sizeof(AUTHREG_NETVER));
+
+ //验证是否存在
+ _tcscpy(st_AuthVer.tszVerSerial, pSt_AuthVer->tszVerSerial);
+ if (AuthService_SQLPacket_TryQuery(&st_AuthVer))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_EXIST;
+ return FALSE;
+ }
+ //插入数据库
+ _stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_NetVer(VerSerial,VerMode,TryTime,CreateTime) VALUES('%s',%d,%d,datetime('now', 'localtime'))"), pSt_AuthVer->tszVerSerial, pSt_AuthVer->enVerMode, pSt_AuthVer->nTryTime);
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryQuery
+函数功能:试用序列号查询函数
+ 参数.一:pSt_AuthVer
+ In/Out:In/Out
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入序列号,输出获取到的内容
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_TryQuery(AUTHREG_NETVER* pSt_AuthVer)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ if (NULL == pSt_AuthVer)
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_PARAMENT;
+ return FALSE;
+ }
+ int nRow = 0;
+ int nColumn = 0;
+ CHAR** ppszResult = NULL;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+
+ memset(tszSQLStatement, '\0', 1024);
+ _stprintf_s(tszSQLStatement, _T("SELECT * FROM AuthReg_NetVer WHERE VerSerial = '%s'"), pSt_AuthVer->tszVerSerial);
+
+ if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ if ((0 == nRow) || (0 == nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_NONE;
+ return FALSE;
+ }
+ //ID
+ int nFliedValue = nColumn;
+ nFliedValue++;
+ //序列号
+ nFliedValue++;
+ //试用类型
+ pSt_AuthVer->enVerMode = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]);
+ nFliedValue++;
+ //试用时间
+ pSt_AuthVer->nTryTime = _ttoi(ppszResult[nFliedValue]);
+ nFliedValue++;
+ //注册时间
+ _tcscpy(pSt_AuthVer->tszVerData, ppszResult[nFliedValue]);
+ DataBase_SQLite_FreeTable(ppszResult);
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryDelete
+函数功能:删除一条指定的试用数据
+ 参数.一:lpszSerial
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入要删除的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_TryDelete(LPCTSTR lpszSerial)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ if (NULL == lpszSerial)
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYDELETE_PARAMENT;
+ return FALSE;
+ }
+ TCHAR tszSQLStatement[1024];
+ memset(tszSQLStatement, '\0', 1024);
+
+ _stprintf_s(tszSQLStatement, _T("DELETE * FROM AuthReg_NetVer WHERE VerSerial = '%s'"), lpszSerial);
+
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryClear
+函数功能:清理函数,自动清理过期数据
+ 参数.一:nThanValue
+ In/Out:In
+ 类型:整数型
+ 可空:N
+ 意思:清理用于判断需要大于此的值
+ 参数.二:enVerMode
+ In/Out:In
+ 类型:枚举型
+ 可空:Y
+ 意思:判断注册类型,默认不判断全部执行
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_TryClear(int nThanValue, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enVerMode /* = ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW */)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ int nRow = 0;
+ int nColumn = 0;
+ CHAR** ppszResult = NULL;
+ TCHAR tszSQLStatement[1024]; //SQL语句
+
+ memset(tszSQLStatement, '\0', 1024);
+ _stprintf_s(tszSQLStatement, _T("SELECT * FROM AuthReg_NetVer"));
+
+ if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ int nFliedValue = nColumn;
+ list stl_ListVer;
+ //轮训所有内容
+ for (int i = 0; i < nRow; i++)
+ {
+ AUTHREG_NETVER st_AuthVer;
+ memset(&st_AuthVer, '\0', sizeof(AUTHREG_NETVER));
+ //ID
+ nFliedValue++;
+ //序列号
+ _tcscpy(st_AuthVer.tszVerSerial, ppszResult[nFliedValue]);
+ nFliedValue++;
+ //模式
+ st_AuthVer.enVerMode = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]);
+ nFliedValue++;
+ //测试时间
+ st_AuthVer.nTryTime = _ttoi(ppszResult[nFliedValue]);
+ nFliedValue++;
+ //注册时间
+ _tcscpy(st_AuthVer.tszVerData, ppszResult[nFliedValue]);
+
+ stl_ListVer.push_back(st_AuthVer);
+ }
+ DataBase_SQLite_FreeTable(ppszResult);
+ //清理
+ list::const_iterator stl_ListIterator = stl_ListVer.begin();
+ for (; stl_ListIterator != stl_ListVer.end(); stl_ListIterator++)
+ {
+ //判断是不是不关心注册的模式直接清理
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW == enVerMode)
+ {
+ if (nThanValue > stl_ListIterator->nTryTime)
+ {
+ memset(tszSQLStatement, '\0', 1024);
+ _stprintf_s(tszSQLStatement, _T("DELETE * FROM AuthReg_NetVer WHERE VerSerial = '%s'"), stl_ListIterator->tszVerSerial);
+
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ if (enVerMode == stl_ListIterator->enVerMode)
+ {
+ memset(tszSQLStatement, '\0', 1024);
+ _stprintf_s(tszSQLStatement, _T("DELETE * FROM AuthReg_NetVer WHERE VerSerial = '%s'"), stl_ListIterator->tszVerSerial);
+
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ }
+ }
+ }
+ stl_ListVer.clear();
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_SQLPacket_TrySet
+函数功能:设置用户信息函数
+ 参数.一:pSt_AuthVer
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要更新的用户信息
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_TrySet(AUTHREG_NETVER* pSt_AuthVer)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ TCHAR tszSQLStatement[1024];
+ memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
+
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_NetVer SET VerMode = '%d',TryTime = '%d',CreateTime = '%s' WHERE VerSerial = '%s'"), pSt_AuthVer->enVerMode, pSt_AuthVer->nTryTime, pSt_AuthVer->tszVerData, pSt_AuthVer->tszVerSerial);
+ //更新用户表
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = DataBase_GetLastError();
+ return FALSE;
+ }
+ return TRUE;
+}
+//////////////////////////////////////////////////////////////////////////
+// 保护函数
+//////////////////////////////////////////////////////////////////////////
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserPayTime
+函数功能:日期方式充值方式
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:充值的用户
+ 参数.二:lpszUserTime
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:用户以前的超时时间
+ 参数.三:lpszCardTime
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:充值卡时间
+ 参数.四:en_AuthSerialType
+ In/Out:In
+ 类型:枚举型
+ 可空:N
+ 意思:充值卡的充值类型
+ 参数.五:en_AuthUserType
+ In/Out:In
+ 类型:枚举型
+ 可空:N
+ 意思:用户表中以前的充值卡类型
+返回值
+ 类型:逻辑型
+ 意思:是否成功充值
+备注:
+*********************************************************************/
+BOOL CAuthService_SQLPacket::AuthService_SQLPacket_UserPayTime(LPCTSTR lpszUserName, LPCTSTR lpszUserTime, LPCTSTR lpszCardTime, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthSerialType, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthUserType)
+{
+ SQLPacket_IsErrorOccur = FALSE;
+
+ TCHAR tszSQLStatement[1024];
+ TCHAR tszTimer[128];
+
+ memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
+ memset(tszTimer, '\0', sizeof(tszTimer));
+ //判断和以前的充值卡是否匹配。
+ if (en_AuthSerialType != en_AuthUserType)
+ {
+ //如果不等于,需要重写
+ if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW != en_AuthUserType)
+ {
+ //判断是否允许改写。
+ if (!m_bChange)
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_NOTMATCH;
+ return FALSE;
+ }
+ }
+ //更新用户表的充值卡类型
+ memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET CardSerialType = '%d' WHERE UserName = '%s'"), en_AuthSerialType, lpszUserName);
+ //执行用户表更新,因为序列卡类型被改变,所以需要更新。
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATATYPE;
+ return FALSE;
+ }
+ //处理卡类型
+ switch (en_AuthSerialType)
+ {
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE:
+ {
+ //如果是分钟卡
+ //如果当前的充值卡类型不匹配,那么他以前的充值内容全部都会被删除!
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%d' WHERE UserName = '%s'"), _ttoi(lpszCardTime), lpszUserName); //更新用户表的过期时间
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_DAY:
+ {
+ //如果是天数卡
+ XENGINE_LIBTIMER st_StartTimer;
+ XENGINE_LIBTIMER st_EndTimer;
+
+ memset(&st_StartTimer, '\0', sizeof(XENGINE_LIBTIMER));
+ memset(&st_EndTimer, '\0', sizeof(XENGINE_LIBTIMER));
+
+ BaseLib_OperatorTime_GetSysTime(&st_StartTimer);
+
+ st_EndTimer.wDay += _ttoi(lpszCardTime);
+ BaseLib_OperatorTimeSpan_CalForStu(&st_StartTimer, &st_EndTimer);
+ //格式化时间,到超时的时间
+ _stprintf_s(tszTimer, _T("%04d-%02d-%02d %02d:%02d:%02d"), st_EndTimer.wYear, st_EndTimer.wMonth, st_EndTimer.wDay, st_EndTimer.wHour, st_EndTimer.wMinute, st_EndTimer.wSecond);
+ //更新用户表的过期时间
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%s' WHERE UserName = '%s'"), tszTimer, lpszUserName); //更新用户表的过期时间
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME:
+ {
+ //如果是次数卡
+ //更新用户表的过期时间
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%d' WHERE UserName = '%s'"), _ttoi(lpszCardTime), lpszUserName);
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM:
+ {
+ TCHAR tszTime[128];
+ XENGINE_LIBTIMER st_AuthTime;
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_GeneraterSerialType;
+
+ memset(tszTime, '\0', sizeof(tszTime));
+ memset(&st_AuthTime, '\0', sizeof(XENGINE_LIBTIMER));
+ //获取重置卡类型和时间
+ if (!Authorize_Serial_GetType(lpszCardTime, &en_GeneraterSerialType, &st_AuthTime))
+ {
+ return FALSE;
+ }
+ _stprintf_s(tszTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), st_AuthTime.wYear, st_AuthTime.wMonth, st_AuthTime.wDay, st_AuthTime.wHour, st_AuthTime.wMinute, st_AuthTime.wSecond);
+ //更新用户表的过期时间
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%s' WHERE UserName = '%s'"), tszTimer, lpszUserName);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (en_AuthSerialType)
+ {
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE:
+ {
+ int nCardTime = _ttoi(lpszCardTime);
+ nCardTime += _ttoi(lpszUserTime); //我们把用户以前的时间也加上
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%d' WHERE UserName = '%s'"), nCardTime, lpszUserName); //更新用户表的过期时间
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_DAY:
+ {
+ XENGINE_LIBTIMER st_EndTimer;
+ XENGINE_LIBTIMER st_AuthTimer;
+
+ memset(&st_EndTimer, '\0', sizeof(XENGINE_LIBTIMER));
+ memset(&st_AuthTimer, '\0', sizeof(st_AuthTimer));
+ //获取用户拥有的时间
+ if (6 != _stscanf_s(lpszUserTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), &st_AuthTimer.wYear, &st_AuthTimer.wMonth, &st_AuthTimer.wDay, &st_AuthTimer.wHour, &st_AuthTimer.wMinute, &st_AuthTimer.wSecond))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_GETTIME;
+ return FALSE;
+ }
+ st_EndTimer.wDay += _ttoi(lpszCardTime);
+
+ BaseLib_OperatorTimeSpan_CalForStu(&st_AuthTimer, &st_EndTimer);
+ //格式化时间,到超时的时间
+ _stprintf_s(tszTimer, _T("%04d-%02d-%02d %02d:%02d:%02d"), st_EndTimer.wYear, st_EndTimer.wMonth, st_EndTimer.wDay, st_EndTimer.wHour, st_EndTimer.wMinute, st_EndTimer.wSecond);
+ //更新用户表的过期时间
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%s' WHERE UserName = '%s'"), tszTimer, lpszUserName);
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME:
+ {
+ //如果是次数卡
+ int nCardTime = _ttoi(lpszCardTime);
+ nCardTime += _ttoi(lpszUserTime); //我们把用户以前的时间也加上
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%d' WHERE UserName = '%s'"), nCardTime, lpszUserName); //更新用户表的过期时间
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM:
+ {
+ //自定义卡,无法相加
+ TCHAR tszTime[128];
+ XENGINE_LIBTIMER st_AuthTime;
+ ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_GeneraterSerialType;
+
+ memset(tszTime, '\0', sizeof(tszTime));
+ memset(&st_AuthTime, '\0', sizeof(XENGINE_LIBTIMER));
+ //获取重置卡类型和时间
+ if (!Authorize_Serial_GetType(lpszCardTime, &en_GeneraterSerialType, &st_AuthTime))
+ {
+ return FALSE;
+ }
+ _stprintf_s(tszTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), st_AuthTime.wYear, st_AuthTime.wMonth, st_AuthTime.wDay, st_AuthTime.wHour, st_AuthTime.wMinute, st_AuthTime.wSecond);
+ //更新用户表的过期时间
+ _stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_User SET LeftTime = '%s' WHERE UserName = '%s'"), tszTimer, lpszUserName);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ //更新用户表的过期时间
+ if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
+ {
+ SQLPacket_IsErrorOccur = TRUE;
+ SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATA;
+ return FALSE;
+ }
+ return TRUE;
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthService_SQLPacket/AuthService_SQLPacket.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthService_SQLPacket/AuthService_SQLPacket.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a65cfe4c3bcbd7f9e55726504d3160c18173377
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/AuthService_SQLPacket/AuthService_SQLPacket.h
@@ -0,0 +1,48 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 11:40:09
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\AuthService_SQLPacket\AuthService_SQLPacket.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\AuthService_SQLPacket
+// File Base: AuthService_SQLPacket
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 数据库管理器
+// History:
+*********************************************************************/
+//////////////////////////////////////////////////////////////////////////
+// AuthReg_UserTable内容:ID 用户名 密码 注册日期 剩余时间 硬件码 注册文件密码 QQ 身份证
+// AuthReg_SerialTable内容:ID 使用者 序列号 使用时间 最大可允许时间 是否使用
+//////////////////////////////////////////////////////////////////////////
+class CAuthService_SQLPacket
+{
+public:
+ CAuthService_SQLPacket();
+ ~CAuthService_SQLPacket();
+public:
+ BOOL AuthService_SQLPacket_Init(LPCTSTR lpszSQLFile, BOOL bIsChange = TRUE); //初始化
+ BOOL AuthService_SQLPacket_Destroy(); //销毁
+public:
+ BOOL AuthService_SQLPacket_UserDelete(LPCTSTR lpszUserName); //删除用户
+ BOOL AuthService_SQLPacket_UserRegister(AUTHREG_USERTABLE*pSt_UserInfo); //用户注册
+ BOOL AuthService_SQLPacket_UserQuery(LPCTSTR lpszUserName, AUTHREG_USERTABLE* pSt_UserInfo = NULL); //用户查询
+ BOOL AuthService_SQLPacket_UserPay(LPCTSTR lpszUserName,LPCTSTR lpszSerialName); //充值卡充值
+ BOOL AuthService_SQLPacket_UserLeave(AUTHREG_PROTOCOL_TIME* pSt_TimeProtocol); //用户离开更新表
+ BOOL AuthService_SQLPacket_UserSet(AUTHREG_USERTABLE* pSt_UserTable);
+public:
+ BOOL AuthService_SQLPacket_SerialInsert(LPCTSTR lpszSerialNumber); //插入序列卡
+ BOOL AuthService_SQLPacket_SerialDelete(LPCTSTR lpszSerialNumber); //删除一个序列号
+ BOOL AuthService_SQLPacket_SerialQuery(LPCTSTR lpszSerialNumber,LPAUTHREG_SERIALTABLE pSt_SerialTable = NULL); //按照卡号或者用户查询
+ BOOL AuthService_SQLPacket_SerialQueryAll(AUTHREG_SERIALTABLE ***pppSt_SerialTable,int *pInt_ListCount); //查询所有序列卡
+public:
+ BOOL AuthService_SQLPacket_TryInsert(AUTHREG_NETVER* pSt_AuthVer);
+ BOOL AuthService_SQLPacket_TryQuery(AUTHREG_NETVER* pSt_AuthVer);
+ BOOL AuthService_SQLPacket_TryDelete(LPCTSTR lpszSerial);
+ BOOL AuthService_SQLPacket_TryClear(int nThanValue, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enVerMode = ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW);
+ BOOL AuthService_SQLPacket_TrySet(AUTHREG_NETVER* pSt_AuthVer);
+protected:
+ BOOL AuthService_SQLPacket_UserPayTime(LPCTSTR lpszUserName, LPCTSTR lpszUserTime, LPCTSTR lpszCardTime, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthSerialType, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthUserType);
+private:
+ BOOL m_bChange;
+ XHDATA xhData; //数据库句柄
+};
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/Makefile b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..c7a51ed4e24c94a4a5da805e0eb8f86bd67329e6
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/Makefile
@@ -0,0 +1,45 @@
+CC = g++ -Wall -std=c++17 -fPIC
+RELEASE = 0
+UNICODE = 0
+INCLUDE = -I ./
+FILECENTOS = /etc/redhat-release
+LOADBIN = -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_HelpComponents
+LIB = -lXEngine_BaseLib -lHelpComponents_DataBase -lHelpComponents_Authorize
+LIBEX = -static-libgcc -lrt -ldl -lpthread
+LOADSO = -Wl,-rpath=
+LIBINCLUDE = AuthService_SQLPacket.o pch.o
+
+ifeq ($(RELEASE),1)
+FLAGS = -c -O2
+DEBUG =
+else
+FLAGS = -c -lc_p
+DEBUG = -g -pg
+endif
+
+ifeq ($(UNICODE),1)
+UNICODE = -D _UNICODE
+else
+UNICODE =
+endif
+
+all:$(LIBINCLUDE)
+ $(CC) $(DEBUG) $(LIBINCLUDE) -o libAuthComponents_SQLPacket.so -shared -fPIC $(LOADBIN) $(LIB) $(LIBEX) $(LOADSO)
+
+AuthService_SQLPacket.o:./AuthService_SQLPacket/AuthService_SQLPacket.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(INCLUDE) ./AuthService_SQLPacket/AuthService_SQLPacket.cpp
+
+pch.o:pch.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) pch.cpp
+
+InstallAll:InstallSo
+InstallSo:./libAuthComponents_SQLPacket.so
+ cp ./libAuthComponents_SQLPacket.so ../../../XEngine_Release/libAuthComponents_SQLPacket.so
+
+
+
+CleanAll:CleanObj CleanMk
+CleanObj:
+ rm *.o
+CleanMk:
+ rm *.so
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Define.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Define.h
new file mode 100644
index 0000000000000000000000000000000000000000..83ee456533d19f1bc446e41a40d2af6756535394
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Define.h
@@ -0,0 +1,282 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 13:14:43
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\SQLPacket_Define.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket
+// File Base: SQLPacket_Define
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 导出定义和函数
+// History:
+*********************************************************************/
+//////////////////////////////////////////////////////////////////////////
+// 导出的函数
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD SQLPacket_GetLastError(int *pInt_SysError = NULL);
+/************************************************************************/
+/* 数据库服务导出函数 */
+/************************************************************************/
+/********************************************************************
+函数名称:AuthService_SQLPacket_Init
+函数功能:初始化数据库服务
+ 参数.一:lpszSQLFile
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:数据库文件路径
+ 参数.二:bIsChange
+ In/Out:In
+ 类型:逻辑型
+ 可空:Y
+ 意思:是否允许更改用户充值类型
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:先初始化数据库服务,在初始化网络服务,才可以使用本验证服务器!
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_Init(LPCSTR lpszSQLFile, BOOL bIsChange = TRUE);
+/********************************************************************
+函数名称:AuthService_SQLPacket_Destroy
+函数功能:销毁数据库服务
+返回值
+ 类型:逻辑型
+ 意思:是否销毁成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_Destroy();
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserDelete
+函数功能:删除一个用户从数据库中
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要删除的用户
+返回值
+ 类型:逻辑型
+ 意思:是否删除成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_UserDelete(LPCSTR lpszUserName);
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserRegister
+函数功能:用户注册处理数据库语句函数
+ 参数.一:pSt_UserInfo
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:要插入的用户数据
+返回值
+ 类型:逻辑型
+ 意思:是否插入成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_UserRegister(AUTHREG_USERTABLE * pSt_UserInfo);
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserQuery
+函数功能:查询用户相对应的值
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要查询的指定用户
+ 参数.二:pSt_UserInfo
+ In/Out:Out
+ 类型:数据结构指针
+ 可空:Y
+ 意思:如果为空NULL,那么将只判断此用户是否存在
+返回值
+ 类型:逻辑型
+ 意思:是否查询成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_UserQuery(LPCSTR lpszUserName,AUTHREG_USERTABLE *pSt_UserInfo);
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserPay
+函数功能:用户充值函数
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要充值的用户名
+ 参数.二:lpszSerialName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:充值使用的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否成功充值
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_UserPay(LPCSTR lpszUserName,LPCSTR lpszSerialName);
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserLeave
+函数功能:用户离开处理事件
+ 参数.一:pSt_TimeProtocol
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:离开的用户信息
+返回值
+ 类型:逻辑型
+ 意思:是否处理成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_UserLeave(AUTHREG_PROTOCOL_TIME * pSt_TimeProtocol);
+/********************************************************************
+函数名称:AuthService_SQLPacket_UserSet
+函数功能:设置用户信息
+ 参数.一:pSt_UserTable
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要设置的信息
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_UserSet(AUTHREG_USERTABLE* pSt_UserTable);
+/********************************************************************
+函数名称:AuthService_SQLPacket_SerialInsert
+函数功能:插入一个序列号到数据库
+ 参数.一:lpszSerialNumber
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要插入的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否插入成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_SerialInsert(LPCSTR lpszSerialNumber);
+/********************************************************************
+函数名称:AuthService_SQLPacket_SerialDelete
+函数功能:从数据库删除指定序列号
+ 参数.一:lpszSerialNumber
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要删除的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否删除成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_SerialDelete(LPCSTR lpszSerialNumber);
+ /********************************************************************
+函数名称:AuthService_SQLPacket_SerialQuery
+函数功能:查询一个指定的序列号信息
+ 参数.一:lpszSerialNumber
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要查询的序列号
+ 参数.二:pSt_SerialTable
+ In/Out:Out
+ 类型:数据结构指针
+ 可空:Y
+ 意思:导出查询到的信息,如果为NULL,此参数将不起作用
+返回值
+ 类型:逻辑型
+ 意思:是否查询成功,如果第二个参数为NULL,那么将只返回是否有这个序列号
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_SerialQuery(LPCSTR lpszSerialNumber,LPAUTHREG_SERIALTABLE pSt_SerialTable);
+/********************************************************************
+函数名称:AuthService_SQLPacket_SerialQueryAll
+函数功能:查询序列卡表中的所有序列号
+ 参数.一:pppSt_SerialTable
+ In/Out:Out
+ 类型:三级指针
+ 可空:N
+ 意思:输出序列卡列表
+ 参数.二:pInt_ListCount
+ In/Out:Out
+ 类型:整数型指针
+ 可空:Y
+ 意思:输出多少张卡
+返回值
+ 类型:逻辑型
+ 意思:是否查询成功
+备注:参数一需要调用基础库的释放内存函数进行内存释放
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_SerialQueryAll(AUTHREG_SERIALTABLE * **pppSt_SerialTable, int* pInt_ListCount);
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryInsert
+函数功能:网络使用模式插入一条数据
+ 参数.一:pSt_AuthVer
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要插入的数据
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_TryInsert(AUTHREG_NETVER* pSt_AuthVer);
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryQuery
+函数功能:试用序列号查询函数
+ 参数.一:pSt_AuthVer
+ In/Out:In/Out
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入序列号,输出获取到的内容
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_TryQuery(AUTHREG_NETVER* pSt_AuthVer);
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryDelete
+函数功能:删除一条指定的试用数据
+ 参数.一:lpszSerial
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入要删除的序列号
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_TryDelete(LPCSTR lpszSerial);
+/********************************************************************
+函数名称:AuthService_SQLPacket_TryClear
+函数功能:清理函数,自动清理过期数据
+ 参数.一:nThanValue
+ In/Out:In
+ 类型:整数型
+ 可空:N
+ 意思:清理用于判断需要大于此的值
+ 参数.二:enVerMode
+ In/Out:In
+ 类型:枚举型
+ 可空:Y
+ 意思:判断注册类型,默认不判断全部执行
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_TryClear(int nThanValue, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enVerMode = ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_UNKNOW);
+/********************************************************************
+函数名称:AuthService_SQLPacket_TrySet
+函数功能:设置用户信息函数
+ 参数.一:pSt_AuthVer
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要更新的用户信息
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_SQLPacket_TrySet(AUTHREG_NETVER* pSt_AuthVer);
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Error.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Error.h
new file mode 100644
index 0000000000000000000000000000000000000000..7aa895672a2a34672f9f1b57fc3536c559473396
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/SQLPacket_Error.h
@@ -0,0 +1,45 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 13:14:57
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\SQLPacket_Error.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket
+// File Base: SQLPacket_Error
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 错误表
+// History:
+*********************************************************************/
+//////////////////////////////////////////////////////////////////////////
+// 导出的错误表
+//////////////////////////////////////////////////////////////////////////
+/************************************************************************/
+/* 数据库错误 */
+/************************************************************************/
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE 0x30D1001 //创建表失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_EXIST 0x30D1010 //用户已经存在
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_INSERT 0x30D1011 //插入内容失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_NOTUSER 0x30D1020 //用户不存在
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_GETTABLE 0x30D1021 //获取表失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_SERIAL 0x30DAA22 //不存在的序列号
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_DELETE_EXEC 0x30D1030 //删除执行失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_ISFAILED 0x30D1040 //序列号插入失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_EXIST 0x30D1041 //序列卡已经存在
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALDEL_ISFAILED 0x30D1042 //序列号删除失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_PARAMENT 0x30D1050 //充值失败,参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_NOTSUPPORT 0x30D1051 //不支持的充值卡
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_UPDATAUSEDNAME 0x30D1052 //更新序列卡使用者失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_ISUSED 0x30D1053 //充值卡已经被使用
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_NOTMATCH 0x30D1060 //充值方式不匹配
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATATYPE 0x30D1061 //更新用户充值卡类型失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_GETTIME 0x30D1062 //获取时间结构失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATA 0x30D1063 //更新数据库失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UPDATA 0x30D10A0 //离开处理失败,更新数据库失败
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UNKNOWTYPE 0x30D10A1 //无法识别的卡的类型,无法正确处理离开消息
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_GETTABLE 0x30D10B0 //获取表失败,内部数据库错误
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_NONE 0x30D10B1 //获取失败,没有任何记录
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_PARAMENT 0x30D10C0 //试用插入失败,参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_EXIST 0x30D10C1 //此序列号存在,无法继续
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_PARAMENT 0x30D10D0 //查询试用序列号失败,参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_NONE 0x30D10D1 //查询的内容为空
+#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYDELETE_PARAMENT 0x30D10E0 //删除失败,参数错误
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/dllmain.cpp b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/dllmain.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..daed8c8f7ac50ca1466016a0529648d18125a7e7
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/dllmain.cpp
@@ -0,0 +1,19 @@
+// dllmain.cpp : 定义 DLL 应用程序的入口点。
+#include "pch.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/framework.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/framework.h
new file mode 100644
index 0000000000000000000000000000000000000000..80cbbc9b06a9b0141f92ee19eceaed71328caff4
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/framework.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
+// Windows 头文件
+#include
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/pch.cpp b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/pch.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f36e510f5fd124a02c80ef8f4ba521449ed29845
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/pch.cpp
@@ -0,0 +1,99 @@
+#include "pch.h"
+#include "AuthService_SQLPacket/AuthService_SQLPacket.h"
+/********************************************************************
+// Created: 2021/07/14 13:09:15
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\pch.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket
+// File Base: pch
+// File Ext: cpp
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 导出函数实现
+// History:
+*********************************************************************/
+BOOL SQLPacket_IsErrorOccur = FALSE;
+DWORD SQLPacket_dwErrorCode = 0;
+//////////////////////////////////////////////////////////////////////////
+CAuthService_SQLPacket m_SQLAuth;
+//////////////////////////////////////////////////////////////////////////
+// 导出的函数
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD SQLPacket_GetLastError(int* pInt_SysError)
+{
+ if (NULL != pInt_SysError)
+ {
+ *pInt_SysError = errno;
+ }
+ return SQLPacket_dwErrorCode;
+}
+/************************************************************************/
+/* 数据库服务导出函数 */
+/************************************************************************/
+extern "C" BOOL AuthService_SQLPacket_Init(LPCTSTR lpszSQLFile, BOOL bIsChange)
+{
+ return m_SQLAuth.AuthService_SQLPacket_Init(lpszSQLFile, bIsChange);
+}
+extern "C" BOOL AuthService_SQLPacket_Destroy()
+{
+ return m_SQLAuth.AuthService_SQLPacket_Destroy();
+}
+extern "C" BOOL AuthService_SQLPacket_UserDelete(LPCTSTR lpszUserName)
+{
+ return m_SQLAuth.AuthService_SQLPacket_UserDelete(lpszUserName);
+}
+extern "C" BOOL AuthService_SQLPacket_UserRegister(AUTHREG_USERTABLE *pSt_UserInfo)
+{
+ return m_SQLAuth.AuthService_SQLPacket_UserRegister(pSt_UserInfo);
+}
+extern "C" BOOL AuthService_SQLPacket_UserQuery(LPCTSTR lpszUserName, AUTHREG_USERTABLE * pSt_UserInfo)
+{
+ return m_SQLAuth.AuthService_SQLPacket_UserQuery(lpszUserName, pSt_UserInfo);
+}
+extern "C" BOOL AuthService_SQLPacket_UserPay(LPCTSTR lpszUserName, LPCTSTR lpszSerialName)
+{
+ return m_SQLAuth.AuthService_SQLPacket_UserPay(lpszUserName, lpszSerialName);
+}
+extern "C" BOOL AuthService_SQLPacket_UserLeave(AUTHREG_PROTOCOL_TIME * pSt_TimeProtocol)
+{
+ return m_SQLAuth.AuthService_SQLPacket_UserLeave(pSt_TimeProtocol);
+}
+extern "C" BOOL AuthService_SQLPacket_UserSet(AUTHREG_USERTABLE * pSt_UserTable)
+{
+ return m_SQLAuth.AuthService_SQLPacket_UserSet(pSt_UserTable);
+}
+extern "C" BOOL AuthService_SQLPacket_SerialInsert(LPCTSTR lpszSerialNumber)
+{
+ return m_SQLAuth.AuthService_SQLPacket_SerialInsert(lpszSerialNumber);
+}
+extern "C" BOOL AuthService_SQLPacket_SerialDelete(LPCTSTR lpszSerialNumber)
+{
+ return m_SQLAuth.AuthService_SQLPacket_SerialDelete(lpszSerialNumber);
+}
+extern "C" BOOL AuthService_SQLPacket_SerialQuery(LPCTSTR lpszSerialNumber, LPAUTHREG_SERIALTABLE pSt_SerialTable)
+{
+ return m_SQLAuth.AuthService_SQLPacket_SerialQuery(lpszSerialNumber, pSt_SerialTable);
+}
+extern "C" BOOL AuthService_SQLPacket_SerialQueryAll(AUTHREG_SERIALTABLE * **pppSt_SerialTable, int* pInt_ListCount)
+{
+ return m_SQLAuth.AuthService_SQLPacket_SerialQueryAll(pppSt_SerialTable, pInt_ListCount);
+}
+extern "C" BOOL AuthService_SQLPacket_TryInsert(AUTHREG_NETVER * pSt_AuthVer)
+{
+ return m_SQLAuth.AuthService_SQLPacket_TryInsert(pSt_AuthVer);
+}
+extern "C" BOOL AuthService_SQLPacket_TryQuery(AUTHREG_NETVER * pSt_AuthVer)
+{
+ return m_SQLAuth.AuthService_SQLPacket_TryQuery(pSt_AuthVer);
+}
+extern "C" BOOL AuthService_SQLPacket_TryDelete(LPCTSTR lpszSerial)
+{
+ return m_SQLAuth.AuthService_SQLPacket_TryDelete(lpszSerial);
+}
+extern "C" BOOL AuthService_SQLPacket_TryClear(int nThanValue, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enVerMode)
+{
+ return m_SQLAuth.AuthService_SQLPacket_TryClear(nThanValue, enVerMode);
+}
+extern "C" BOOL AuthService_SQLPacket_TrySet(AUTHREG_NETVER * pSt_AuthVer)
+{
+ return m_SQLAuth.AuthService_SQLPacket_TrySet(pSt_AuthVer);
+}
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/pch.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/pch.h
new file mode 100644
index 0000000000000000000000000000000000000000..23dc84352190fd403d6b2fb195ba5e9c5f3fcd6f
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_SQLPacket/pch.h
@@ -0,0 +1,65 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+
+#ifdef _WINDOWS
+// 添加要在此处预编译的标头
+#include "framework.h"
+#include
+#endif
+
+#endif //PCH_H
+#include
+#include
+#include
+using namespace std;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../../XAuth_Protocol.h"
+#include "SQLPacket_Define.h"
+#include "SQLPacket_Error.h"
+/********************************************************************
+// Created: 2021/07/14 11:41:40
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket\pch.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_SQLPacket
+// File Base: pch
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 公有头文件
+// History:
+*********************************************************************/
+extern BOOL SQLPacket_IsErrorOccur;
+extern DWORD SQLPacket_dwErrorCode;
+
+#ifdef _UNICODE
+typedef std::wstring tstring;
+#else
+typedef std::string tstring;
+#endif
+
+#ifdef _WINDOWS
+#ifdef _WIN64
+#pragma comment(lib,"x64/XEngine_BaseLib/XEngine_BaseLib.lib")
+#pragma comment(lib,"x64/XEngine_HelpComponents/HelpComponents_DataBase.lib")
+#pragma comment(lib,"x64/XEngine_HelpComponents/HelpComponents_Authorize.lib")
+#else
+#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_DataBase.lib")
+#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Authorize.lib")
+#endif // _WIN64
+#else
+
+#endif
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.def b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.def
new file mode 100644
index 0000000000000000000000000000000000000000..311899570748b23ed1e0f22bdaca0d7e6a844b84
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.def
@@ -0,0 +1,14 @@
+LIBRARY
+
+EXPORTS
+ Session_GetLastError
+
+ AuthService_Session_Init
+ AuthService_Session_GetClient
+ AuthService_Session_GetTimer
+ AuthService_Session_GetAddrForUser
+ AuthService_Session_GetUserForAddr
+ AuthService_Session_CloseClient
+ AuthService_Session_Destroy
+ AuthService_Session_Insert
+ AuthService_Session_SetUser
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..07c4078d9f2e1dbfe174b783a220744f510d4544
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj
@@ -0,0 +1,187 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {65cb84f8-8dab-483d-a3c6-ad48fc7acaef}
+ AuthComponentsSession
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v142
+ MultiByte
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ MultiByte
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ false
+ $(XEngine_Include);$(IncludePath)
+ $(XEngine_Library);$(LibraryPath)
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;AUTHCOMPONENTSSESSION_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+ 4819
+
+
+ Windows
+ true
+ false
+ AuthComponents_Session.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;AUTHCOMPONENTSSESSION_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+ MultiThreaded
+ 4819
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthComponents_Session.def
+
+
+
+
+ Level3
+ true
+ _DEBUG;AUTHCOMPONENTSSESSION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ false
+ AuthComponents_Session.def
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;AUTHCOMPONENTSSESSION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ Use
+ pch.h
+
+
+ Windows
+ true
+ true
+ true
+ false
+ AuthComponents_Session.def
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj.filters b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj.filters
new file mode 100644
index 0000000000000000000000000000000000000000..85b1aabb9b53909725b0cd1941a5c2b3345c4fea
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj.filters
@@ -0,0 +1,56 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {9c7041ab-4416-406f-9f21-d0af231e664f}
+
+
+ {e8bd85ca-3126-434b-91b0-1f6068652f1c}
+
+
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件\AuthService_Session
+
+
+
+
+ 源文件
+
+
+ 源文件
+
+
+ 源文件\AuthService_Session
+
+
+
+
+ 源文件
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj.user b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj.user
new file mode 100644
index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthComponents_Session.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthService_Session/AuthService_Session.cpp b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthService_Session/AuthService_Session.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..23bf235c5090a6751a0723436923da64b915c111
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthService_Session/AuthService_Session.cpp
@@ -0,0 +1,521 @@
+#include "pch.h"
+#include "AuthService_Session.h"
+/********************************************************************
+// Created: 2021/07/14 13:20:34
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\AuthService_Session\AuthService_Session.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\AuthService_Session
+// File Base: AuthService_Session
+// File Ext: cpp
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 会话管理器
+// History:
+*********************************************************************/
+CAuthService_Session::CAuthService_Session()
+{
+ bIsRun = FALSE;
+}
+CAuthService_Session::~CAuthService_Session()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+// 公有函数
+//////////////////////////////////////////////////////////////////////////
+/********************************************************************
+函数名称:AuthService_Session_Init
+函数功能:初始化会话
+ 参数.一:fpCall_AuthEvent
+ In/Out:In/Out
+ 类型:回调函数
+ 可空:N
+ 意思:验证服务器事件时间回调函数,通过此来通知上层用户时间更新
+ 参数.二:lParam
+ In/Out:In/Out
+ 类型:无类型指针
+ 可空:Y
+ 意思:回调函数自定义参数
+返回值
+ 类型:逻辑型
+ 意思:是否初始化成功
+备注:
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent,LPVOID lParam /* = NULL */)
+{
+ Session_IsErrorOccur = FALSE;
+
+ if (NULL == fpCall_AuthEvent)
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_PARAMENT;
+ return FALSE;
+ }
+ m_lParam = lParam;
+ lpCall_AuthregEvents = fpCall_AuthEvent;
+
+ bIsRun = TRUE;
+ //创建线程
+ pSTDThread_hActive = make_shared(AuthService_Session_ActiveThread, this);
+ if (!pSTDThread_hActive->joinable())
+ {
+ bIsRun = FALSE;
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_CREATETHREAD;
+ return FALSE;
+ }
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_GetClient
+函数功能:获取客户端信息
+ 参数.一:pppSt_ListClient
+ In/Out:Out
+ 类型:三级指针
+ 可空:N
+ 意思:导出获取到的客户端信息
+ 参数.二:pInt_ListCount
+ In/Out:In
+ 类型:常量字符指针
+ 可空:Y
+ 意思:输出列表个数
+ 参数.三:lpszClientAddr
+ In/Out:In
+ 类型:常量字符指针
+ 可空:Y
+ 意思:要获取的客户端地址,为空表示获取所有
+返回值
+ 类型:逻辑型
+ 意思:是否获取成功
+备注:参数一必须通过基础库的内存释放函数BaseLib_OperatorMemory_Free进行释放内存
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_GetClient(AUTHREG_USERTABLE*** pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr /* = NULL */)
+{
+ Session_IsErrorOccur = FALSE;
+
+ if ((NULL == pppSt_ListClient) || (NULL == pInt_ListCount))
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_PARAMENT;
+ return FALSE;
+ }
+ st_Locker.lock_shared();
+ if (NULL == lpszClientAddr)
+ {
+ BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_ListClient, stl_MapNetClient.size(), sizeof(AUTHREG_USERTABLE));
+
+ unordered_map::const_iterator stl_MapIterator = stl_MapNetClient.begin();
+ for (int i = 0; stl_MapIterator != stl_MapNetClient.cend(); stl_MapIterator++, i++)
+ {
+ *(*pppSt_ListClient)[i] = stl_MapIterator->second.st_AuthUser;
+ }
+ *pInt_ListCount = stl_MapNetClient.size();
+ }
+ else
+ {
+ unordered_map::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszClientAddr);
+ if (stl_MapIterator == stl_MapNetClient.cend())
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_NOTFOUND;
+ st_Locker.unlock_shared();
+ return FALSE;
+ }
+ BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_ListClient, stl_MapNetClient.size(), sizeof(AUTHREG_USERTABLE));
+
+ *(*pppSt_ListClient)[0] = stl_MapIterator->second.st_AuthUser;
+ *pInt_ListCount = 1;
+ }
+ st_Locker.unlock_shared();
+
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_GetTimer
+函数功能:获取客户端时间信息
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入要查找用户名
+ 参数.二:pSt_AuthTime
+ In/Out:Out
+ 类型:数据结构指针
+ 可空:N
+ 意思:用户时间信息结构体
+返回值
+ 类型:逻辑型
+ 意思:是否获取成功
+备注:通过卡类型来判断导出的时间是分钟还是天
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_GetTimer(LPCTSTR lpszUserName,AUTHREG_PROTOCOL_TIME *pSt_AuthTime)
+{
+ Session_IsErrorOccur = FALSE;
+
+ if ((NULL == lpszUserName) || (NULL == pSt_AuthTime))
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_PARAMENT;
+ return FALSE;
+ }
+ st_Locker.lock_shared();
+ unordered_map::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszUserName);
+ if (stl_MapIterator == stl_MapNetClient.end())
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_NOTFOUND;
+ st_Locker.unlock_shared();
+ return FALSE;
+ }
+ pSt_AuthTime->nTimeLeft = stl_MapIterator->second.nLeftTime;
+ pSt_AuthTime->nTimeONLine = stl_MapIterator->second.nOnlineTime;
+ pSt_AuthTime->enSerialType = stl_MapIterator->second.st_AuthUser.en_AuthRegSerialType;
+
+ _tcscpy(pSt_AuthTime->tszUserName, lpszUserName);
+ _tcscpy(pSt_AuthTime->tszLeftTime, stl_MapIterator->second.tszLeftTime);
+ _tcscpy(pSt_AuthTime->tszUserAddr, stl_MapIterator->second.tszClientAddr);
+ st_Locker.unlock_shared();
+
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_GetAddrForUser
+函数功能:通过用户名获取对应地址
+ 参数.一:lpszClientUser
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入用户名
+ 参数.二:ptszClientAddr
+ In/Out:Out
+ 类型:字符指针
+ 可空:N
+ 意思:导出获取到的用户套接字地址
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_GetAddrForUser(LPCTSTR lpszClientUser, TCHAR *ptszClientAddr)
+{
+ Session_IsErrorOccur = FALSE;
+
+ if ((NULL == lpszClientUser) || (NULL == ptszClientAddr))
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_PARAMENT;
+ return FALSE;
+ }
+ st_Locker.lock_shared();
+ unordered_map::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszClientUser);
+ if (stl_MapIterator == stl_MapNetClient.end())
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_NOTFOUND;
+ st_Locker.unlock_shared();
+ return FALSE;
+ }
+ _tcscpy(ptszClientAddr,stl_MapIterator->second.tszClientAddr);
+ st_Locker.unlock_shared();
+
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_GetUserForAddr
+函数功能:通过IP地址获取对应用户名
+ 参数.一:lpszClientAddr
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入IP地址端口
+ 参数.二:ptszClientUser
+ In/Out:Out
+ 类型:字符指针
+ 可空:N
+ 意思:导出获取到的用户名
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_GetUserForAddr(LPCTSTR lpszClientAddr, TCHAR *ptszClientUser)
+{
+ Session_IsErrorOccur = FALSE;
+
+ if ((NULL == lpszClientAddr) || (NULL == ptszClientUser))
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_PARAMENT;
+ return FALSE;
+ }
+ BOOL bIsFound = FALSE;
+ st_Locker.lock_shared();
+ unordered_map::const_iterator stl_MapIterator = stl_MapNetClient.begin();
+ for (;stl_MapIterator != stl_MapNetClient.end();stl_MapIterator++)
+ {
+ if (0 == _tcsncmp(lpszClientAddr, stl_MapIterator->second.tszClientAddr, _tcslen(lpszClientAddr)))
+ {
+ bIsFound = TRUE;
+ break;
+ }
+ }
+ if (!bIsFound)
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_NOTFOUND;
+ st_Locker.unlock_shared();
+ return FALSE;
+ }
+ _tcscpy(ptszClientUser, stl_MapIterator->first.c_str());
+ st_Locker.unlock_shared();
+
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_CloseClient
+函数功能:移除一个客户端
+ 参数.一:lpszClientUser
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要移除的用户名
+返回值
+ 类型:逻辑型
+ 意思:是否移除成功
+备注:
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_CloseClient(LPCTSTR lpszClientAddr)
+{
+ Session_IsErrorOccur = FALSE;
+
+ st_Locker.lock();
+ unordered_map::iterator stl_MapIterator = stl_MapNetClient.find(lpszClientAddr);
+ if (stl_MapIterator != stl_MapNetClient.end())
+ {
+ //移除元素
+ stl_MapNetClient.erase(stl_MapIterator);
+ }
+ st_Locker.unlock();
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_Destroy
+函数功能:销毁网络服务
+返回值
+ 类型:逻辑型
+ 意思:是否销毁成功
+备注:
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_Destroy()
+{
+ Session_IsErrorOccur = FALSE;
+
+ bIsRun = FALSE;
+ //结束线程
+ if (NULL != pSTDThread_hActive)
+ {
+ pSTDThread_hActive->join();
+ }
+ //释放客户端资源
+ st_Locker.lock();
+ stl_MapNetClient.clear();
+ st_Locker.unlock();
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_Insert
+函数功能:用户登陆协议分析
+ 参数.一:lpszClientAddr
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:用户地址
+ 参数.二:pSt_AuthProtocol
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:用户传递的协议数据
+返回值
+ 类型:逻辑型
+ 意思:是否允许登陆
+备注:如果成功,服务器会自动进行计时
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_Insert(LPCTSTR lpszClientAddr, AUTHREG_USERTABLE *pSt_UserTable)
+{
+ Session_IsErrorOccur = FALSE;
+
+ if ((NULL == lpszClientAddr) || (NULL == pSt_UserTable))
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_PARAMENT;
+ return FALSE;
+ }
+ //验证是否登陆
+ st_Locker.lock_shared();
+ unordered_map::iterator stl_MapIterator = stl_MapNetClient.find(pSt_UserTable->st_UserInfo.tszUserName);
+ if (stl_MapIterator != stl_MapNetClient.end())
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_ISLOGIN;
+ st_Locker.unlock_shared();
+ return FALSE;
+ }
+ st_Locker.unlock_shared();
+
+ AUTHREGSERVICE_NETCLIENT st_Client;
+ memset(&st_Client,'\0',sizeof(AUTHREGSERVICE_NETCLIENT));
+
+ BaseLib_OperatorTime_GetSysTime(&st_Client.st_LibTimer);
+ _tcscpy(st_Client.tszClientAddr,lpszClientAddr);
+ memcpy(&st_Client.st_AuthUser, pSt_UserTable, sizeof(AUTHREG_USERTABLE));
+
+ st_Locker.lock();
+ stl_MapNetClient.insert(make_pair(pSt_UserTable->st_UserInfo.tszUserName, st_Client));
+ st_Locker.unlock();
+ return TRUE;
+}
+/********************************************************************
+函数名称:AuthService_Session_SetUser
+函数功能:设置用户信息
+ 参数.一:pSt_UserTable
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要设置的用户信息
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+BOOL CAuthService_Session::AuthService_Session_SetUser(AUTHREG_USERTABLE* pSt_UserTable)
+{
+ Session_IsErrorOccur = FALSE;
+
+ if (NULL == pSt_UserTable)
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_PARAMENT;
+ return FALSE;
+ }
+ //验证是否登陆
+ st_Locker.lock_shared();
+ unordered_map::iterator stl_MapIterator = stl_MapNetClient.find(pSt_UserTable->st_UserInfo.tszUserName);
+ if (stl_MapIterator == stl_MapNetClient.end())
+ {
+ Session_IsErrorOccur = TRUE;
+ Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_NOTFOUND;
+ st_Locker.unlock_shared();
+ return FALSE;
+ }
+ memcpy(&stl_MapIterator->second.st_AuthUser, pSt_UserTable, sizeof(AUTHREG_USERTABLE));
+ st_Locker.unlock_shared();
+ return TRUE;
+}
+//////////////////////////////////////////////////////////////////////////
+// 线程函数
+//////////////////////////////////////////////////////////////////////////
+XHTHREAD CAuthService_Session::AuthService_Session_ActiveThread(LPVOID lParam)
+{
+ CAuthService_Session *pClass_This = (CAuthService_Session *)lParam;
+ XENGINE_LIBTIMER st_LibTimer;
+ AUTHREG_PROTOCOL_TIME st_ProtocolTimer;
+ list stl_ListNotify;
+
+ while (pClass_This->bIsRun)
+ {
+ //开始轮训用户
+ pClass_This->st_Locker.lock_shared();
+ unordered_map::iterator stl_MapIterator = pClass_This->stl_MapNetClient.begin();
+ for (; stl_MapIterator != pClass_This->stl_MapNetClient.end(); stl_MapIterator++)
+ {
+ memset(&st_ProtocolTimer, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+ BaseLib_OperatorTime_GetSysTime(&st_LibTimer); //获取现在的系统时间
+ __int64x nOnlineSpan = 0; //在线时间
+ //用户登录了多少分钟
+ BaseLib_OperatorTimeSpan_GetForStu(&stl_MapIterator->second.st_LibTimer, &st_LibTimer, &nOnlineSpan, ENUM_XENGINE_BASELIB_TIME_SPAN_TYPE_MINUTE);
+ //登陆成功的。我们要处理他过期
+ switch (stl_MapIterator->second.st_AuthUser.en_AuthRegSerialType)
+ {
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE:
+ {
+ //分钟处理
+ __int64x nLeftTimer = _tcstoi64(stl_MapIterator->second.st_AuthUser.tszLeftTime, NULL, 10);
+ //获得过期日期
+ XENGINE_LIBTIMER st_TimeCal;
+ memset(&st_TimeCal, '\0', sizeof(XENGINE_LIBTIMER));
+
+ st_TimeCal.wMinute = (int)nLeftTimer;
+ BaseLib_OperatorTimeSpan_CalForStu(&stl_MapIterator->second.st_LibTimer, &st_TimeCal);
+ BaseLib_OperatorTime_ToStringTimer(stl_MapIterator->second.tszLeftTime, &st_TimeCal);
+ //赋值给管理器
+ stl_MapIterator->second.nLeftTime = nLeftTimer - nOnlineSpan;
+ stl_MapIterator->second.nOnlineTime = nOnlineSpan;
+ //赋值给回调函数
+ st_ProtocolTimer.nTimeONLine = nOnlineSpan;
+ st_ProtocolTimer.nTimeLeft = stl_MapIterator->second.nLeftTime;
+ st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_AuthUser.en_AuthRegSerialType;
+ _tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.tszLeftTime);
+ _tcscpy(st_ProtocolTimer.tszUserAddr, stl_MapIterator->second.tszClientAddr);
+ _tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_AuthUser.st_UserInfo.tszUserName);
+ stl_ListNotify.push_back(st_ProtocolTimer);
+ }
+ break;
+ case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME:
+ {
+ //次数处理
+ stl_MapIterator->second.nOnlineTime = nOnlineSpan;
+ stl_MapIterator->second.nLeftTime = _tcstoi64(stl_MapIterator->second.st_AuthUser.tszLeftTime, NULL, 10);
+ _stprintf(stl_MapIterator->second.tszLeftTime, _T("%lld"), stl_MapIterator->second.nLeftTime);
+ //次数处理不做任何时间操作
+ st_ProtocolTimer.nTimeONLine = nOnlineSpan;
+ st_ProtocolTimer.nTimeLeft = stl_MapIterator->second.nLeftTime;
+ st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_AuthUser.en_AuthRegSerialType;
+ _tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.st_AuthUser.tszLeftTime);
+ _tcscpy(st_ProtocolTimer.tszUserAddr, stl_MapIterator->second.tszClientAddr);
+ _tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_AuthUser.st_UserInfo.tszUserName);
+ stl_ListNotify.push_back(st_ProtocolTimer);
+ }
+ break;
+ default:
+ //天卡,自定义 都是用相同的函数处理
+ __int64x nLeftTime = 0; //剩余时间
+ XENGINE_LIBTIMER st_TimeLeft;
+ memset(&st_TimeLeft, '\0', sizeof(XENGINE_LIBTIMER));
+ //获取指定过期日期
+ if (6 != _stscanf_s(stl_MapIterator->second.st_AuthUser.tszLeftTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), &st_TimeLeft.wYear, &st_TimeLeft.wMonth, &st_TimeLeft.wDay, &st_TimeLeft.wHour, &st_TimeLeft.wMinute, &st_TimeLeft.wSecond))
+ {
+ break;
+ }
+ //剩余天数,通过分钟来处理
+ BaseLib_OperatorTimeSpan_GetForStu(&st_LibTimer, &st_TimeLeft, &nLeftTime, ENUM_XENGINE_BASELIB_TIME_SPAN_TYPE_MINUTE);
+ //获取过期时间
+ stl_MapIterator->second.nLeftTime = nLeftTime;
+ stl_MapIterator->second.nOnlineTime = nOnlineSpan;
+ _tcscpy(stl_MapIterator->second.tszLeftTime, stl_MapIterator->second.st_AuthUser.tszLeftTime);
+ //计算时间是否超过!
+ AUTHREG_PROTOCOL_TIME st_ProtocolTimer;
+ memset(&st_ProtocolTimer, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
+
+ st_ProtocolTimer.nTimeONLine = nOnlineSpan;
+ st_ProtocolTimer.nTimeLeft = nLeftTime;
+ st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_AuthUser.en_AuthRegSerialType;
+ _tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.st_AuthUser.tszLeftTime);
+ _tcscpy(st_ProtocolTimer.tszUserAddr, stl_MapIterator->second.tszClientAddr);
+ _tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_AuthUser.st_UserInfo.tszUserName);
+ stl_ListNotify.push_back(st_ProtocolTimer);
+ break;
+ }
+ }
+ pClass_This->st_Locker.unlock_shared();
+ //判断是否有需要关闭的客户端
+ if (!stl_ListNotify.empty())
+ {
+ list::iterator stl_ListIterator = stl_ListNotify.begin();
+ for (; stl_ListIterator != stl_ListNotify.end(); stl_ListIterator++)
+ {
+ pClass_This->lpCall_AuthregEvents(stl_ListIterator->tszUserAddr, stl_ListIterator->tszUserName, stl_ListIterator->nTimeONLine, stl_ListIterator->nTimeLeft, stl_ListIterator->tszLeftTime, stl_ListIterator->enSerialType, pClass_This->m_lParam);
+ }
+ stl_ListNotify.clear(); //清理元素
+ }
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ }
+ return 0;
+}
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthService_Session/AuthService_Session.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthService_Session/AuthService_Session.h
new file mode 100644
index 0000000000000000000000000000000000000000..514fcaf629ee4301474a64903258df6aba4ac919
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/AuthService_Session/AuthService_Session.h
@@ -0,0 +1,51 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 13:20:24
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\AuthService_Session\AuthService_Session.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\AuthService_Session
+// File Base: AuthService_Session
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 会话管理器
+// History:
+*********************************************************************/
+typedef struct
+{
+ AUTHREG_USERTABLE st_AuthUser; //用户表
+ XENGINE_LIBTIMER st_LibTimer; //登录时间结构
+ TCHAR tszClientAddr[64];
+ TCHAR tszLeftTime[64]; //过期日期
+ __int64x nOnlineTime; //在线时间
+ __int64x nLeftTime; //剩余时间
+}AUTHREGSERVICE_NETCLIENT,*LPAUTHREGSERVICE_NETCLIENT;
+//////////////////////////////////////////////////////////////////////////
+class CAuthService_Session
+{
+public:
+ CAuthService_Session();
+ ~CAuthService_Session();
+public:
+ BOOL AuthService_Session_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent,LPVOID lParam = NULL);
+ BOOL AuthService_Session_GetClient(AUTHREG_USERTABLE*** pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr = NULL);
+ BOOL AuthService_Session_GetTimer(LPCTSTR lpszUserName, AUTHREG_PROTOCOL_TIME* pSt_AuthTime);
+ BOOL AuthService_Session_GetAddrForUser(LPCTSTR lpszClientUser,TCHAR *ptszClientAddr);
+ BOOL AuthService_Session_GetUserForAddr(LPCTSTR lpszClientAddr, TCHAR *ptszClientUser);
+ BOOL AuthService_Session_CloseClient(LPCTSTR lpszClientAddr);
+ BOOL AuthService_Session_Destroy();
+public:
+ BOOL AuthService_Session_Insert(LPCTSTR lpszClientAddr, AUTHREG_USERTABLE* pSt_UserTable);
+ BOOL AuthService_Session_SetUser(AUTHREG_USERTABLE* pSt_UserTable);
+protected:
+ static XHTHREAD AuthService_Session_ActiveThread(LPVOID lParam); //计时器线程
+private:
+ BOOL bIsRun; //运行标志
+ shared_ptr pSTDThread_hActive; //时间计算器线程句柄
+private:
+ LPVOID m_lParam;
+ CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS lpCall_AuthregEvents;
+private:
+ shared_mutex st_Locker;
+private:
+ unordered_map stl_MapNetClient;
+};
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Makefile b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..543024805f438827accdeda9d89d153972110f30
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Makefile
@@ -0,0 +1,44 @@
+CC = g++ -Wall -std=c++17 -fPIC
+RELEASE = 0
+UNICODE = 0
+INCLUDE = -I ./
+FILECENTOS = /etc/redhat-release
+LOADBIN = -L /usr/local/lib/XEngine_Release/XEngine_BaseLib
+LIB = -lXEngine_BaseLib
+LIBEX = -static-libgcc -lrt -ldl -lpthread
+LOADSO = -Wl,-rpath=
+LIBINCLUDE = AuthService_Session.o pch.o
+
+ifeq ($(RELEASE),1)
+FLAGS = -c -O2
+DEBUG =
+else
+FLAGS = -c -lc_p
+DEBUG = -g -pg
+endif
+
+ifeq ($(UNICODE),1)
+UNICODE = -D _UNICODE
+else
+UNICODE =
+endif
+
+all:$(LIBINCLUDE)
+ $(CC) $(DEBUG) $(LIBINCLUDE) -o libAuthComponents_Session.so -shared -fPIC $(LOADBIN) $(LIB) $(LIBEX) $(LOADSO)
+
+AuthService_Session.o:./AuthService_Session/AuthService_Session.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(INCLUDE) ./AuthService_Session/AuthService_Session.cpp
+
+pch.o:pch.cpp
+ $(CC) $(DEBUG) $(FLAGS) $(UNICODE) pch.cpp
+
+InstallAll:InstallSo
+InstallSo:./libAuthComponents_Session.so
+ cp ./libAuthComponents_Session.so ../../../XEngine_Release/libAuthComponents_Session.so
+
+
+CleanAll:CleanObj CleanMk
+CleanObj:
+ rm *.o
+CleanMk:
+ rm *.so
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Session_Define.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Session_Define.h
new file mode 100644
index 0000000000000000000000000000000000000000..613affe984bcc25030c17333b5740d3e9daa1d0b
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Session_Define.h
@@ -0,0 +1,180 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 13:24:33
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\Session_Define.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session
+// File Base: Session_Define
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 导出定义和函数
+// History:
+*********************************************************************/
+//////////////////////////////////////////////////////////////////////////
+// 导出的回调函数
+//////////////////////////////////////////////////////////////////////////
+//用户在线时间事件回调处理函数,用户名 在线时间 剩余时间(分,天) 注册的卡类型 自定义参数
+typedef void(CALLBACK* CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS)(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthRegSerialType, LPVOID lParam);
+//////////////////////////////////////////////////////////////////////////
+// 导出的函数
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD Session_GetLastError(int *pInt_SysError = NULL);
+/************************************************************************/
+/* 网络服务导出函数 */
+/************************************************************************/
+/********************************************************************
+函数名称:AuthService_Session_Init
+函数功能:初始化会话
+ 参数.一:fpCall_AuthEvent
+ In/Out:In/Out
+ 类型:回调函数
+ 可空:N
+ 意思:验证服务器事件时间回调函数,通过此来通知上层用户时间更新
+ 参数.二:lParam
+ In/Out:In/Out
+ 类型:无类型指针
+ 可空:Y
+ 意思:回调函数自定义参数
+返回值
+ 类型:逻辑型
+ 意思:是否初始化成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_Session_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent,LPVOID lParam = NULL);
+/********************************************************************
+函数名称:AuthService_Session_GetClient
+函数功能:获取客户端信息
+ 参数.一:pppSt_ListClient
+ In/Out:Out
+ 类型:三级指针
+ 可空:N
+ 意思:导出获取到的客户端信息
+ 参数.二:pInt_ListCount
+ In/Out:In
+ 类型:常量字符指针
+ 可空:Y
+ 意思:输出列表个数
+ 参数.三:lpszClientAddr
+ In/Out:In
+ 类型:常量字符指针
+ 可空:Y
+ 意思:要获取的客户端地址,为空表示获取所有
+返回值
+ 类型:逻辑型
+ 意思:是否获取成功
+备注:参数一必须通过基础库的内存释放函数BaseLib_OperatorMemory_Free进行释放内存
+*********************************************************************/
+extern "C" BOOL AuthService_Session_GetClient(AUTHREG_USERTABLE * **pppSt_ListClient, int* pInt_ListCount, LPCSTR lpszClientAddr);
+/********************************************************************
+函数名称:AuthService_Session_GetTimer
+函数功能:获取客户端时间信息
+ 参数.一:lpszUserName
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入要查找用户名
+ 参数.二:pSt_AuthTime
+ In/Out:Out
+ 类型:数据结构指针
+ 可空:N
+ 意思:用户时间信息结构体
+返回值
+ 类型:逻辑型
+ 意思:是否获取成功
+备注:通过卡类型来判断导出的时间是分钟还是天
+*********************************************************************/
+extern "C" BOOL AuthService_Session_GetTimer(LPCSTR lpszUserName,AUTHREG_PROTOCOL_TIME *pSt_AuthTime);
+/********************************************************************
+函数名称:AuthService_Session_GetAddrForUser
+函数功能:通过用户名获取对应地址
+ 参数.一:lpszClientUser
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入用户名
+ 参数.二:ptszClientAddr
+ In/Out:Out
+ 类型:字符指针
+ 可空:N
+ 意思:导出获取到的用户套接字地址
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_Session_GetAddrForUser(LPCSTR lpszClientUser,CHAR *ptszClientAddr);
+/********************************************************************
+函数名称:AuthService_Session_GetUserForAddr
+函数功能:通过IP地址获取对应用户名
+ 参数.一:lpszClientAddr
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:输入IP地址端口
+ 参数.二:ptszClientUser
+ In/Out:Out
+ 类型:字符指针
+ 可空:N
+ 意思:导出获取到的用户名
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_Session_GetUserForAddr(LPCSTR lpszClientAddr, CHAR *ptszClientUser);
+/********************************************************************
+函数名称:AuthService_Session_CloseClient
+函数功能:移除一个客户端
+ 参数.一:lpszClientUser
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:要移除的用户名
+返回值
+ 类型:逻辑型
+ 意思:是否移除成功
+备注:此函数会自动调用AuthRegService_Sql_UserLeave来处理离开时间
+*********************************************************************/
+extern "C" BOOL AuthService_Session_CloseClient(LPCSTR lpszClientUser);
+/********************************************************************
+函数名称:AuthService_Session_Destroy
+函数功能:销毁网络服务
+返回值
+ 类型:逻辑型
+ 意思:是否销毁成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_Session_Destroy();
+/********************************************************************
+函数名称:AuthService_Session_Insert
+函数功能:用户登陆协议分析
+ 参数.一:lpszClientAddr
+ In/Out:In
+ 类型:常量字符指针
+ 可空:N
+ 意思:用户的IP地址加端口
+ 参数.二:pSt_AuthProtocol
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:用户传递的协议数据
+返回值
+ 类型:逻辑型
+ 意思:是否允许登陆
+备注:如果成功,服务器会自动进行计时
+*********************************************************************/
+extern "C" BOOL AuthService_Session_Insert(LPCSTR lpszClientAddr, AUTHREG_USERTABLE * pSt_UserTable);
+/********************************************************************
+函数名称:AuthService_Session_SetUser
+函数功能:设置用户信息
+ 参数.一:pSt_UserTable
+ In/Out:In
+ 类型:数据结构指针
+ 可空:N
+ 意思:输入要设置的用户信息
+返回值
+ 类型:逻辑型
+ 意思:是否成功
+备注:
+*********************************************************************/
+extern "C" BOOL AuthService_Session_SetUser(AUTHREG_USERTABLE* pSt_UserTable);
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Session_Error.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Session_Error.h
new file mode 100644
index 0000000000000000000000000000000000000000..df2478810010388ca3be1662f7cb3307a1d931b4
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/Session_Error.h
@@ -0,0 +1,34 @@
+#pragma once
+/********************************************************************
+// Created: 2021/07/14 13:24:38
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\Session_Error.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session
+// File Base: Session_Error
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 错误表
+// History:
+*********************************************************************/
+//////////////////////////////////////////////////////////////////////////
+// 导出的错误表
+//////////////////////////////////////////////////////////////////////////
+/************************************************************************/
+/* 网络协议错误 */
+/************************************************************************/
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_PARAMENT 0x30D0000 //参数错误,无法继续
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_CREATETHREAD 0x30D0001 //创建线程失败
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_PARAMENT 0x30D0010 //参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_NOTFOUND 0x30D0011 //没有找到客户端
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_PARAMENT 0x30D0020 //参数错误,获取失败
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_NOTFOUND 0x30D0021 //没有找到制定的客户端
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_PARAMENT 0x30D0050 //参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_ISLOGIN 0x30D0051 //用户已经登陆,无法第二次登陆
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETPASS_PARAMENT 0x30D0070 //参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETPASS_MATCH 0x30D0071 //找回密码失败,匹配资料错误
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_PARAMENT 0x30D0080 //获取失败,参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_NOTFOUND 0x30D0081 //没有找到
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_PARAMENT 0x30D0090 //获取失败,参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_NOTFOUND 0x30D0091 //没有找到
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_PARAMENT 0x30D00A0 //参数错误
+#define ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_NOTFOUND 0x30D00A1 //没有找到
\ No newline at end of file
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/dllmain.cpp b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/dllmain.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..daed8c8f7ac50ca1466016a0529648d18125a7e7
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/dllmain.cpp
@@ -0,0 +1,19 @@
+// dllmain.cpp : 定义 DLL 应用程序的入口点。
+#include "pch.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/framework.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/framework.h
new file mode 100644
index 0000000000000000000000000000000000000000..80cbbc9b06a9b0141f92ee19eceaed71328caff4
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/framework.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
+// Windows 头文件
+#include
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/pch.cpp b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/pch.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..828a65f9ff3207f17e8e770d44c9c95aea3e88a1
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/pch.cpp
@@ -0,0 +1,67 @@
+#include "pch.h"
+#include "AuthService_Session/AuthService_Session.h"
+/********************************************************************
+// Created: 2021/07/14 13:23:35
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\pch.cpp
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session
+// File Base: pch
+// File Ext: cpp
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 导出函数实现
+// History:
+*********************************************************************/
+BOOL Session_IsErrorOccur = FALSE;
+DWORD Session_dwErrorCode = 0;
+//////////////////////////////////////////////////////////////////////////
+CAuthService_Session m_Session;
+//////////////////////////////////////////////////////////////////////////
+// 导出的函数
+//////////////////////////////////////////////////////////////////////////
+extern "C" DWORD Session_GetLastError(int* pInt_SysError)
+{
+ if (NULL != pInt_SysError)
+ {
+ *pInt_SysError = errno;
+ }
+ return Session_dwErrorCode;
+}
+/************************************************************************/
+/* 网络服务导出函数 */
+/************************************************************************/
+extern "C" BOOL AuthService_Session_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent, LPVOID lParam)
+{
+ return m_Session.AuthService_Session_Init(fpCall_AuthEvent, lParam);
+}
+extern "C" BOOL AuthService_Session_GetClient(AUTHREG_USERTABLE * **pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr)
+{
+ return m_Session.AuthService_Session_GetClient(pppSt_ListClient, pInt_ListCount, lpszClientAddr);
+}
+extern "C" BOOL AuthService_Session_GetTimer(LPCTSTR lpszUserName, AUTHREG_PROTOCOL_TIME * pSt_AuthTime)
+{
+ return m_Session.AuthService_Session_GetTimer(lpszUserName, pSt_AuthTime);
+}
+extern "C" BOOL AuthService_Session_GetAddrForUser(LPCTSTR lpszClientUser, TCHAR * ptszClientAddr)
+{
+ return m_Session.AuthService_Session_GetAddrForUser(lpszClientUser, ptszClientAddr);
+}
+extern "C" BOOL AuthService_Session_GetUserForAddr(LPCTSTR lpszClientAddr, TCHAR * ptszClientUser)
+{
+ return m_Session.AuthService_Session_GetUserForAddr(lpszClientAddr, ptszClientUser);
+}
+extern "C" BOOL AuthService_Session_CloseClient(LPCTSTR lpszClientUser)
+{
+ return m_Session.AuthService_Session_CloseClient(lpszClientUser);
+}
+extern "C" BOOL AuthService_Session_Destroy()
+{
+ return m_Session.AuthService_Session_Destroy();
+}
+extern "C" BOOL AuthService_Session_Insert(LPCTSTR lpszClientAddr, AUTHREG_USERTABLE * pSt_UserTable)
+{
+ return m_Session.AuthService_Session_Insert(lpszClientAddr, pSt_UserTable);
+}
+extern "C" BOOL AuthService_Session_SetUser(AUTHREG_USERTABLE * pSt_UserTable)
+{
+ return m_Session.AuthService_Session_SetUser(pSt_UserTable);
+}
diff --git a/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/pch.h b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/pch.h
new file mode 100644
index 0000000000000000000000000000000000000000..8625f6b3a567904cea81329f9278ca38e729a060
--- /dev/null
+++ b/XEngine_Source/XEngine_AuthComponents/AuthComponents_Session/pch.h
@@ -0,0 +1,63 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+
+#ifdef _WINDOWS
+// 添加要在此处预编译的标头
+#include "framework.h"
+#include
+#endif
+
+#endif //PCH_H
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+using namespace std;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "../../XAuth_Protocol.h"
+#include "Session_Define.h"
+#include "Session_Error.h"
+/********************************************************************
+// Created: 2021/07/14 13:22:08
+// File Name: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session\pch.h
+// File Path: D:\XEngine_Authorize\XEngine_Source\XEngine_AuthComponents\AuthComponents_Session
+// File Base: pch
+// File Ext: h
+// Project: XEngine(网络通信引擎)
+// Author: qyt
+// Purpose: 公有头文件
+// History:
+*********************************************************************/
+extern BOOL Session_IsErrorOccur;
+extern DWORD Session_dwErrorCode;
+
+#ifdef _UNICODE
+typedef std::wstring tstring;
+#else
+typedef std::string tstring;
+#endif
+
+#ifdef _WINDOWS
+#ifdef _WIN64
+#pragma comment(lib,"x64/XEngine_BaseLib/XEngine_BaseLib.lib")
+#else
+#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib.lib")
+#endif // _WIN64
+#else
+
+#endif
\ No newline at end of file