diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 51e41b6..0000000 --- a/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -jacob.dll -jacob.jar -jacobdll.jar -*.zip -RELEASE.txt -.project -.cproject -.classpath -compilation_tools.properties -version.properties -release -.externalToolBuilders -.cdtproject -foo.foo -foo.ser -JacobVersion.properties -.settings diff --git a/LICENSE.TXT b/LICENSE.TXT deleted file mode 100644 index a2a1d92..0000000 --- a/LICENSE.TXT +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -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 this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. 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 not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the 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 -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "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 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY 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 -LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey 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 library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF deleted file mode 100644 index 90f14d9..0000000 --- a/META-INF/MANIFEST.MF +++ /dev/null @@ -1,897 +0,0 @@ -Manifest-Version: 1.0 - -Name: ./com/jacob/activeX/ActiveXComponent.class -Digest-Algorithms: SHA MD5 -SHA-Digest: qqewKW8c2W7aSvB4Ob/bMbCPeFI= -MD5-Digest: EZs0WpbDBV5Id5XRw2tbtg== - -Name: ./com/jacob/activeX/ActiveXComponent.java -Digest-Algorithms: SHA MD5 -SHA-Digest: IeJoOZ9U4LtHuqyqJGKG24nDTYw= -MD5-Digest: Qqf2RAOc0xBTG8dGIyA2+w== - -Name: ./com/jacob/com/ComException.class -Digest-Algorithms: SHA MD5 -SHA-Digest: fuWzbhsBKLBjPtk5pvgVzskMFz4= -MD5-Digest: vwLlwRM/J9NYONB/UVw1AA== - -Name: ./com/jacob/com/ComException.java -Digest-Algorithms: SHA MD5 -SHA-Digest: 9HsO+/DGzYdZtFDK+Yi6SyEo29I= -MD5-Digest: tHiTxIfngQHjEXPzVC31pA== - -Name: ./com/jacob/com/ComFailException.class -Digest-Algorithms: SHA MD5 -SHA-Digest: dghV0kFmeXaebK73wRAyBNZsfeM= -MD5-Digest: EmfTcOZd7lFdNX+ZZIGufA== - -Name: ./com/jacob/com/ComFailException.java -Digest-Algorithms: SHA MD5 -SHA-Digest: yIS8kOUyyl2ymTHxb/8Za4ktjsw= -MD5-Digest: sdqsHsk9p4XXX5kfvQOQNg== - -Name: ./com/jacob/com/ComThread.class -Digest-Algorithms: SHA MD5 -SHA-Digest: J+KEmDJYSMA2VXg8smZpLFQYAuc= -MD5-Digest: wnPiLbEgp7GC4sMVsQ1eWg== - -Name: ./com/jacob/com/ComThread.java -Digest-Algorithms: SHA MD5 -SHA-Digest: q0K2wuQ+be8Qrrai/Ui1BTMeFeo= -MD5-Digest: eH6GkFkD3A3PrX1cZJWr6w== - -Name: ./com/jacob/com/Dispatch.class -Digest-Algorithms: SHA MD5 -SHA-Digest: tYSc84+VUMMWYt7hrLDtcnINNUI= -MD5-Digest: etVQxCE1JEN1rYCc5ZA79A== - -Name: ./com/jacob/com/Dispatch.java -Digest-Algorithms: SHA MD5 -SHA-Digest: Q95eP1KW/Z/ICzzeaNDCFUIG408= -MD5-Digest: IovIOD5G/XY7qFAHViNeng== - -Name: ./com/jacob/com/DispatchEvents.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 7cgrmVJc18T/hRvT3931tQzVa5s= -MD5-Digest: CtihQf0ka9OChKX+OnKucQ== - -Name: ./com/jacob/com/DispatchEvents.java -Digest-Algorithms: SHA MD5 -SHA-Digest: 5MwAZmktJFp7rq23Lz/VG1/ULk4= -MD5-Digest: 2haKHCBa7UXfl8HCSPEyQQ== - -Name: ./com/jacob/com/DispatchProxy.class -Digest-Algorithms: SHA MD5 -SHA-Digest: xDGCGyw+8G/kxFFOQtQo3rbhDN8= -MD5-Digest: +5n2WPrM0Jj0FauyuctPMQ== - -Name: ./com/jacob/com/DispatchProxy.java -Digest-Algorithms: SHA MD5 -SHA-Digest: 4NGdFabt0CZL8y56A1x/AEat6/o= -MD5-Digest: Wd9zhjmACcUxZ3gqdWtB2w== - -Name: ./com/jacob/com/EnumVariant.class -Digest-Algorithms: SHA MD5 -SHA-Digest: ft/EfZ1xwI/J07yz6oxla2jKZFM= -MD5-Digest: zRYy+0tuDsAQ7SCOJxgx5A== - -Name: ./com/jacob/com/EnumVariant.java -Digest-Algorithms: SHA MD5 -SHA-Digest: 3biekksAd50gb6GRfpefO2PpS6c= -MD5-Digest: zlu6oH2HFI//sGTexAv9GQ== - -Name: ./com/jacob/com/JacobObject.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 9uw+e0Wxha1A6tp6PFQE1JMJkvQ= -MD5-Digest: D37EFI7kTv9NEnsyQcsXsA== - -Name: ./com/jacob/com/JacobObject.java -Digest-Algorithms: SHA MD5 -SHA-Digest: TqJDUM7Ujxt5/zAGSG9uCoKcJ4U= -MD5-Digest: oD0tL8WPPCN3jF59jfd/yA== - -Name: ./com/jacob/com/MainSTA.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 3WKAHdSq2yTa/lqHgyOTo6vqvnk= -MD5-Digest: h0kY/3xCUs0uCyhWUL+DWQ== - -Name: ./com/jacob/com/MainSTA.java -Digest-Algorithms: SHA MD5 -SHA-Digest: pDIgNuK9H9KhKQEZIMIgM44nDo8= -MD5-Digest: p/CDI6V3KgdOViQQ6/oR0g== - -Name: ./com/jacob/com/ROT.class -Digest-Algorithms: SHA MD5 -SHA-Digest: bEQuGPBbOn8HlXMmcLQCRh0BlYs= -MD5-Digest: rCXiBlficXaJbCoFMCeoJg== - -Name: ./com/jacob/com/ROT.java -Digest-Algorithms: SHA MD5 -SHA-Digest: K6WVkJuFZNjgow/o4/1pTyKu2Tk= -MD5-Digest: eOCwqvCPVk+haZ7WFzEJOg== - -Name: ./com/jacob/com/SafeArray.class -Digest-Algorithms: SHA MD5 -SHA-Digest: AIqtFq0miAVrMUY0HZUnXuhl284= -MD5-Digest: TiPLaOJAMTzTVP2a2AsX0A== - -Name: ./com/jacob/com/SafeArray.java -Digest-Algorithms: SHA MD5 -SHA-Digest: CGBlCL952tC//MTG+XxqSOQh/hI= -MD5-Digest: pf25bH4uo0LZOzz7utDa8Q== - -Name: ./com/jacob/com/STA.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 6cqSEZm+8kVkAO4Vnc5G04qCrCE= -MD5-Digest: 7O16Je2NaryCebJZ28U20A== - -Name: ./com/jacob/com/STA.java -Digest-Algorithms: SHA MD5 -SHA-Digest: S0EbhtSPEAv9fGOaTNBymxmZthM= -MD5-Digest: 9fcj8YmMFCCfB8M5eF7lPA== - -Name: ./com/jacob/com/Variant.class -Digest-Algorithms: SHA MD5 -SHA-Digest: ea5nat308Pg7cxcJdywpqL++HiM= -MD5-Digest: 6/TukZAwtC9UOUArjcpTXg== - -Name: ./com/jacob/com/Variant.java -Digest-Algorithms: SHA MD5 -SHA-Digest: psnbnw0M+2egeuqpbf2u1C7I/EY= -MD5-Digest: iuuq5W1sFXeT269RJC7U6w== - -Name: ./com/jacob/com/WrongThreadException.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 55DxaZjMfzYE9MTCKZ8VPgpjVLc= -MD5-Digest: 9uygPT4WdJg8N6Yo/t0tkA== - -Name: ./com/jacob/com/WrongThreadException.java -Digest-Algorithms: SHA MD5 -SHA-Digest: PPQzELKIkTeQJfGTBUfUonPdSnc= -MD5-Digest: bNwuGE+cW1Z9+pWnI3r/Bg== - -Name: ./jacob.dll -Digest-Algorithms: SHA MD5 -SHA-Digest: 3LlRg0frUqmTW8HjSXm2tGZi9og= -MD5-Digest: MgUWKEmjKUX4hFTLoSyeCA== - -Name: ./jacob.jar -Digest-Algorithms: SHA MD5 -SHA-Digest: xLY8bhITrVUd+Ft+++piDVNh+lc= -MD5-Digest: 5MOSXL4nEeEAdO40bNd3oA== - -Name: ./JacobComLifetime.html -Digest-Algorithms: SHA MD5 -SHA-Digest: uGRYLP2xhOaPGbunFQ7cxZcUvaw= -MD5-Digest: 3RU8RW+2/liuGpkyYbTPHg== - -Name: ./jacobSrc_18.zip -Digest-Algorithms: SHA MD5 -SHA-Digest: 2jmj7l5rSw0yVb/vlWAYkK/YBwk= -MD5-Digest: 1B2M2Y8AsgTpgAmY7PhCfg== - -Name: ./JacobThreading.html -Digest-Algorithms: SHA MD5 -SHA-Digest: IQs2MYpplp8guNE7nFWcnsEJLt8= -MD5-Digest: MuRQ3uXcEMeB5msQ/oYyTQ== - -Name: ./jni/ComThread.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: pfEIKsR11Doq3+Dmwpyf6tscRCY= -MD5-Digest: RDG15eEa+FxZtSmn1sadSg== - -Name: ./jni/ComThread.h -Digest-Algorithms: SHA MD5 -SHA-Digest: JtBBBpPcOqjBm4o10ui48TOgkps= -MD5-Digest: z3ocf5BOusRSSdB8madNlA== - -Name: ./jni/ComThread.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: Z05DKyL+S6GI3w0GhhkoeWRS+Ss= -MD5-Digest: wUSJQhroulYl2cZ+eLnu7Q== - -Name: ./jni/Dispatch.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: FH0YWD3RyD9CR1fHkGiIzJLh0tk= -MD5-Digest: VAjOj5ZPrBCbqvd15um09w== - -Name: ./jni/Dispatch.h -Digest-Algorithms: SHA MD5 -SHA-Digest: N74Cx8buqtuTUkLbg604pgcRGmE= -MD5-Digest: bX1snnEyrNBwexgVNtasCg== - -Name: ./jni/Dispatch.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: saxklkHmLIdMVLdKj4vmYRtBHVo= -MD5-Digest: 0Y6c1VfYLJuQWlm6MI9UuA== - -Name: ./jni/DispatchEvents.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: UHLjKXAwbPlVN8hQoexl38jv1lM= -MD5-Digest: lL07d5A5AIxqphOxetIiLg== - -Name: ./jni/DispatchEvents.h -Digest-Algorithms: SHA MD5 -SHA-Digest: VKWhIhXOim7LLhyLGJclVlkilfI= -MD5-Digest: s4huR7K3gZu5qfQQTTRcGg== - -Name: ./jni/DispatchEvents.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: 0I3opm1/14UCERfLZqUkoAnqObI= -MD5-Digest: Kd6mTsrifhRCmOT2rUkLHw== - -Name: ./jni/DispatchProxy.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: sEo5fo91hMQ0k+XVaZk5TCkC0NM= -MD5-Digest: tsX0rWU+eL5pKaBRhANZIw== - -Name: ./jni/DispatchProxy.h -Digest-Algorithms: SHA MD5 -SHA-Digest: FCqZSwrPy5rOPWeiioNcxz9ooj8= -MD5-Digest: IfhrIzu/elu0CFTU/+FH0A== - -Name: ./jni/DispatchProxy.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: yN/dtGG4um+SuuQrTo5+1uLSiiY= -MD5-Digest: FTdU29Tt31Zr+v/uF+Exlg== - -Name: ./jni/EnumVariant.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: UqE3XEqyuSOqCey9y6NtgO56vlk= -MD5-Digest: MjoER1irRaeyqAouQJLnaw== - -Name: ./jni/EnumVariant.h -Digest-Algorithms: SHA MD5 -SHA-Digest: rHJQr1J+8v4371BuFvhLifmyXRg= -MD5-Digest: 0ShO6APjAlzrxpL1VHtp4Q== - -Name: ./jni/EnumVariant.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: SBD1O7LN4s4xoYdYX8HMutBkIno= -MD5-Digest: q05v4Kbf3xXr6TTKFSJh+g== - -Name: ./jni/EventProxy.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: tQM4T5PxwKGiWIe7WAr7OUCZn88= -MD5-Digest: xH3pvJqZW5utS9K2jPDkog== - -Name: ./jni/EventProxy.h -Digest-Algorithms: SHA MD5 -SHA-Digest: 25r17CcIBLdEIoHXKp65NyTmVQk= -MD5-Digest: 2CpIIkRfJSfZQpkvpbBenQ== - -Name: ./jni/EventProxy.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: gShJkleKBewW8MrzUC0/XvRQWNw= -MD5-Digest: zpim8NXVV7RfD/xk2mJW6w== - -Name: ./jni/jacob.dll -Digest-Algorithms: SHA MD5 -SHA-Digest: 3LlRg0frUqmTW8HjSXm2tGZi9og= -MD5-Digest: MgUWKEmjKUX4hFTLoSyeCA== - -Name: ./jni/jacob.exp -Digest-Algorithms: SHA MD5 -SHA-Digest: 72e/gQTKiE1r9Uslz4vYRQ0PHmQ= -MD5-Digest: 5mklGz6sCKSgVrjey6YL5g== - -Name: ./jni/jacob.lib -Digest-Algorithms: SHA MD5 -SHA-Digest: m8ZbuTExo3Un0O7MWBc5o9WJ6g8= -MD5-Digest: ybxMyVrwSNUnuhbGLQnYkw== - -Name: ./jni/makefile -Digest-Algorithms: SHA MD5 -SHA-Digest: n/Ol9YQ2klBEFhF8C7gM37Q85go= -MD5-Digest: 5gkJFwMCbAAZAEyb/OWKPw== - -Name: ./jni/README.txt -Digest-Algorithms: SHA MD5 -SHA-Digest: lHYa7laejzkdRZkjyk5hh01Nh70= -MD5-Digest: 6YannUlp3XpNr7bZP6i5Bg== - -Name: ./jni/SafeArray.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: +u64HvTcLPDEuGHsH7ydYMNmROI= -MD5-Digest: 1C3cuqY05UZF4Kh28Vc3Bw== - -Name: ./jni/SafeArray.h -Digest-Algorithms: SHA MD5 -SHA-Digest: g5KEynNNTCV/0+TtLSrgtBGIVB8= -MD5-Digest: W6TK/CsQYfRRrCsn1vlf8A== - -Name: ./jni/SafeArray.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: HcWyMrmnhyYxKsIO8GfrtEFgHC0= -MD5-Digest: saSZ5dtWYxMPDzN6svD+lg== - -Name: ./jni/STA.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: nEJ3iujtVaHY41S00J/KQSp6MTc= -MD5-Digest: N3O7B829ib75rCZgY1lifw== - -Name: ./jni/STA.h -Digest-Algorithms: SHA MD5 -SHA-Digest: +VwuhNMGYzZ9aGjZX/YPppDdO1A= -MD5-Digest: G+RltDyKn4lfuOR9XSQxUA== - -Name: ./jni/STA.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: KUDmvPyX3TI/FlQlk/7NLmZVHZs= -MD5-Digest: kBJEBoZm/30B9aHP7jAxhg== - -Name: ./jni/StdAfx.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: QXk1fqHJAYChd8X7CH73V6EJqgU= -MD5-Digest: rkapC0u6Da9N3BzEShh5uA== - -Name: ./jni/StdAfx.h -Digest-Algorithms: SHA MD5 -SHA-Digest: i9b1viSLE73TdBRHyEYqCQnHdok= -MD5-Digest: O9mOBXwgjNSj0cF5bibF3g== - -Name: ./jni/stdafx.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: WY6n8VAjHD+D+8yfca65Lv2Yanc= -MD5-Digest: 1ZNNwyP06I7kkDqF1oWmYA== - -Name: ./jni/util.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: svps5GbrBIhBersEfXdVDaRxwdM= -MD5-Digest: V3cYxfy/UdMYgPE4LU2jQw== - -Name: ./jni/util.h -Digest-Algorithms: SHA MD5 -SHA-Digest: If9oIOxyhA0rL44GJlLkrc1IDPg= -MD5-Digest: A7UlJkDnsxJEKCtn6G1UOw== - -Name: ./jni/util.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: Eycr3pdkbM6wpCusv6ppEtXavQQ= -MD5-Digest: HiuPDNWBFDdn7X4DutL/mw== - -Name: ./jni/Variant.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: ZVW7VPsmlHWKjuTpZKs08XlS320= -MD5-Digest: faCR0N6dP5W+bxzgvblpsA== - -Name: ./jni/Variant.h -Digest-Algorithms: SHA MD5 -SHA-Digest: xEKVgKNM1RnfDIKpP01mHj+3SqU= -MD5-Digest: jeRydyEBbi2E+WLhuKANIg== - -Name: ./jni/Variant.obj -Digest-Algorithms: SHA MD5 -SHA-Digest: VkpRSFzVd3DOh5l14/Ohhf3+FBM= -MD5-Digest: 0A4By2V6SdUdFYoNaELkSA== - -Name: ./LICENSE.TXT -Digest-Algorithms: SHA MD5 -SHA-Digest: f6pMV3+4WoA2adisGIy1Rax2W8o= -MD5-Digest: fCYjCTNV8MYNNuW3i2aTFw== - -Name: ./makefile -Digest-Algorithms: SHA MD5 -SHA-Digest: 8fbp+qFE+YwIwHcapQbHKyq6QE8= -MD5-Digest: /37LTLMPhiaLolS1X1k1HQ== - -Name: ./README.TXT -Digest-Algorithms: SHA MD5 -SHA-Digest: NCWTHs86RAcfK917rbotr81sExc= -MD5-Digest: +KTt8W0TCJsei2AxVFpQFQ== - -Name: ./samples/ado/ADO_README.txt -Digest-Algorithms: SHA MD5 -SHA-Digest: vyqm9URm65OyGqdOiWCuk67W94I= -MD5-Digest: gP7U0PwFXCXojgEkzzXYIg== - -Name: ./samples/ado/Command.class -Digest-Algorithms: SHA MD5 -SHA-Digest: VYX5u7DXdbMzqsFPgv5yox5adKs= -MD5-Digest: ZISCJalFcRGqxRX+172meg== - -Name: ./samples/ado/Command.java -Digest-Algorithms: SHA MD5 -SHA-Digest: u/GPTs8U4XUh8qsXCYrkGpmAq58= -MD5-Digest: hru+Ns3kuh7ukNMEo7UYlw== - -Name: ./samples/ado/CommandTypeEnum.class -Digest-Algorithms: SHA MD5 -SHA-Digest: hegtG5C8KdUCTpjqfsU30otxd3Y= -MD5-Digest: aBVcQnMQtpARZsSJcrxoPg== - -Name: ./samples/ado/CommandTypeEnum.java -Digest-Algorithms: SHA MD5 -SHA-Digest: 7fa7uxQ9WMUFB6ms7rEi3nKyM/s= -MD5-Digest: Ey7VKrr+74MTFlyJRdK1WQ== - -Name: ./samples/ado/Connection.class -Digest-Algorithms: SHA MD5 -SHA-Digest: jmve106WOcmbLHhPKwQolgOEl0c= -MD5-Digest: TGjR6vuVVJkepeC8Bkx0Mw== - -Name: ./samples/ado/Connection.java -Digest-Algorithms: SHA MD5 -SHA-Digest: aIz0OGEkKM5qhfqGPDaizgSQH6o= -MD5-Digest: uKdIqNEb0fQW6/F54+ULyg== - -Name: ./samples/ado/Field.class -Digest-Algorithms: SHA MD5 -SHA-Digest: jxR9z2XYejS/LMekS66Slmc7/Wc= -MD5-Digest: sGuUfiZ0YbwCsSmI6mrHCQ== - -Name: ./samples/ado/Field.java -Digest-Algorithms: SHA MD5 -SHA-Digest: yXzIXtij0oGqhOpZViy+2GzMqgA= -MD5-Digest: gjaIquVdHvBcVczuTZjqMQ== - -Name: ./samples/ado/Fields.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 1qWM9CqE5xj2nH7qFOJ6MGY8CjI= -MD5-Digest: 9rkQ0Cdn32mX+NkIr6JiQg== - -Name: ./samples/ado/Fields.java -Digest-Algorithms: SHA MD5 -SHA-Digest: blVsEdbjJxuW4X4jO9CWgQirOm4= -MD5-Digest: As+B/G3vm+k5pzQWXTAsdw== - -Name: ./samples/ado/ms/README -Digest-Algorithms: SHA MD5 -SHA-Digest: WYL+bmWW1nkqEGoOHgf4E5+80Lw= -MD5-Digest: VPd6NUQNQ5kJOgMbpyCd4A== - -Name: ./samples/ado/ms/testms.class -Digest-Algorithms: SHA MD5 -SHA-Digest: RoKESkqQJiR1k9PRG0VbhdjRChE= -MD5-Digest: GHy6MwcQVWfuBMTWFX3tdg== - -Name: ./samples/ado/ms/testms.java -Digest-Algorithms: SHA MD5 -SHA-Digest: GW9uXFNDW4pTPSjZHo2D5lFc/zU= -MD5-Digest: +6iJfY4I6HB/eA8LcgKB6A== - -Name: ./samples/ado/Recordset.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 7DOBgOnKy6VMFm7V59fULgPEfio= -MD5-Digest: M5HhfmAKFb/b/C6csy69wA== - -Name: ./samples/ado/Recordset.java -Digest-Algorithms: SHA MD5 -SHA-Digest: WSFzf787gED6BkN3vSVGhXxb/XU= -MD5-Digest: aOk5BtJdTTJuJpGyWUpRIg== - -Name: ./samples/ado/test.class -Digest-Algorithms: SHA MD5 -SHA-Digest: AEXzmSw0nhniEgEgcHEqSAIY6cs= -MD5-Digest: nQp4MdGvsHDnkVG1CzDRrA== - -Name: ./samples/ado/test.java -Digest-Algorithms: SHA MD5 -SHA-Digest: u59LMxRc+XIhuM/vHtznkCLC0IE= -MD5-Digest: b4q8u/F+GYhyWIr1cM8EdA== - -Name: ./samples/applet/AppTest.class -Digest-Algorithms: SHA MD5 -SHA-Digest: n56Is99dBgC8tQ6K9IqwYnALkmI= -MD5-Digest: FdQ7a7vx1CXpNinMKQEveQ== - -Name: ./samples/applet/AppTest.html -Digest-Algorithms: SHA MD5 -SHA-Digest: 2pGYv1dUavvaMY+1b0hBhS9mv3Y= -MD5-Digest: rZWQxtKOziVCquj5M6GFFw== - -Name: ./samples/applet/AppTest.java -Digest-Algorithms: SHA MD5 -SHA-Digest: pC2PW5TpOHZuAYJGm9B1Od/BRw4= -MD5-Digest: qMKmotn7i7fzaPgoBD6gdQ== - -Name: ./samples/README.txt -Digest-Algorithms: SHA MD5 -SHA-Digest: 9kyVx/ey8MxEfF1HATrDZlg9Rxk= -MD5-Digest: gRXrNz3NEKFy7fasoujArg== - -Name: ./samples/servlet/JacobScript.class -Digest-Algorithms: SHA MD5 -SHA-Digest: NY4hemo3uGEIBCWTyyyzm7a0CzQ= -MD5-Digest: MUuHIxHh6F98jE0YH7P+bg== - -Name: ./samples/servlet/JacobScript.java -Digest-Algorithms: SHA MD5 -SHA-Digest: dvp/KSXGqV6gC2s9NPzTvAbm0uc= -MD5-Digest: JUP2vLcS7M4pe9uWJsIOWw== - -Name: ./samples/servlet/readme.txt -Digest-Algorithms: SHA MD5 -SHA-Digest: GE4VxwDk3uAEQDBvvWBoOe4KKXw= -MD5-Digest: 1MSy/NVW2EyTybpjuagEIQ== - -Name: ./samples/test/Access.class -Digest-Algorithms: SHA MD5 -SHA-Digest: YJ8ho+ID8ugfEDWCPxYbNoiNpsE= -MD5-Digest: QInWVJKkR9hjDynEpHjVOQ== - -Name: ./samples/test/Access.java -Digest-Algorithms: SHA MD5 -SHA-Digest: uqv9slXCqv98mTceAxd95Y7Vrh0= -MD5-Digest: fpK035MccuE2h/Z01omyOA== - -Name: ./samples/test/atl/MultiFace/dlldata.c -Digest-Algorithms: SHA MD5 -SHA-Digest: HWTbDhfSULe5RQibEUEI830BLuE= -MD5-Digest: 0+48R+h0ivE4WGRJFfPJDA== - -Name: ./samples/test/atl/MultiFace/Face.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: OhddW2y86e39z4U0TPDtqmB+MmA= -MD5-Digest: 4dTrCiRHhORZk4BnDf7z3w== - -Name: ./samples/test/atl/MultiFace/Face.h -Digest-Algorithms: SHA MD5 -SHA-Digest: y0gekndtQPP58IyEFliYdG37qns= -MD5-Digest: GTxFB6uT1X5vEGI0WcrL/Q== - -Name: ./samples/test/atl/MultiFace/Face.rgs -Digest-Algorithms: SHA MD5 -SHA-Digest: F8u+qbVSCFIKnUMKvvy5UYQ+HLs= -MD5-Digest: S4ANAdXVLXbCPN2x7uD5pQ== - -Name: ./samples/test/atl/MultiFace/MultiFace.aps -Digest-Algorithms: SHA MD5 -SHA-Digest: lQbTvrX5Vvm9994+oYa+l9zCrMI= -MD5-Digest: u2p9rqJFCAD8E0y/GBYa9w== - -Name: ./samples/test/atl/MultiFace/MultiFace.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: k3Fh0X2Zf2P5HFYX0XBC3cr8F8U= -MD5-Digest: dgadf5J+z2FmRkZrARoVhw== - -Name: ./samples/test/atl/MultiFace/MultiFace.def -Digest-Algorithms: SHA MD5 -SHA-Digest: 2LcCcz80Nw99Cplvy56LVfKj4AQ= -MD5-Digest: u/wev8ycCsOtBXjq4koWsA== - -Name: ./samples/test/atl/MultiFace/MultiFace.dsp -Digest-Algorithms: SHA MD5 -SHA-Digest: EP934454nHfECg4uMbMpi2qSiBg= -MD5-Digest: BpITlBALRWf1UnbtvqJ1tw== - -Name: ./samples/test/atl/MultiFace/MultiFace.dsw -Digest-Algorithms: SHA MD5 -SHA-Digest: HPkFe3R5aG/7zdtwSpPIvCoJrX8= -MD5-Digest: JwOWHmGnfAJWodLnqiA4ig== - -Name: ./samples/test/atl/MultiFace/MultiFace.h -Digest-Algorithms: SHA MD5 -SHA-Digest: NzYDi990PqhD0pyW/XswKUHiQGI= -MD5-Digest: I4SDltcfIyyBFfg71dSKoA== - -Name: ./samples/test/atl/MultiFace/MultiFace.idl -Digest-Algorithms: SHA MD5 -SHA-Digest: rE8NyFJgJFgoxHYEFJRFTwIGTjA= -MD5-Digest: Yf3mnqG5Jx/iSE5S/1N3QA== - -Name: ./samples/test/atl/MultiFace/MultiFace.ncb -Digest-Algorithms: SHA MD5 -SHA-Digest: 7GDt/Nx4jef09B5ACmv+1xqcQt4= -MD5-Digest: zyxbqfMC8PmDrMRA4VvVcA== - -Name: ./samples/test/atl/MultiFace/MultiFace.opt -Digest-Algorithms: SHA MD5 -SHA-Digest: 9KOiwG4QxIFaNgVtYosl9rn4F5Q= -MD5-Digest: Ai1X3ztSmyZneaivsOIhgA== - -Name: ./samples/test/atl/MultiFace/MultiFace.plg -Digest-Algorithms: SHA MD5 -SHA-Digest: GgHEYrPCgoTvQJbLVkGSucuJI84= -MD5-Digest: fzXVPatmqIW5BKWNn20x1w== - -Name: ./samples/test/atl/MultiFace/MultiFace.rc -Digest-Algorithms: SHA MD5 -SHA-Digest: cKcPvkLwFvr2SpNabMVU4LRCHQQ= -MD5-Digest: B81k6bAmMI8mY9pywHyQ9Q== - -Name: ./samples/test/atl/MultiFace/MultiFace.tlb -Digest-Algorithms: SHA MD5 -SHA-Digest: 45izBsDG1ouPhqTvH8IDPK9oNlY= -MD5-Digest: 5smfNJ6a5a/r3EBBmZN/Yw== - -Name: ./samples/test/atl/MultiFace/MultiFaceps.def -Digest-Algorithms: SHA MD5 -SHA-Digest: BZnsV6gPHLCjBY1gkyjg/SCOw+4= -MD5-Digest: nAyFg5jxyfxmfe2MD3C1vA== - -Name: ./samples/test/atl/MultiFace/MultiFaceps.mk -Digest-Algorithms: SHA MD5 -SHA-Digest: bJNeboLTRvXTAOuiiEboGEW6s/8= -MD5-Digest: L+Fei2KII1dnTm5Goszing== - -Name: ./samples/test/atl/MultiFace/MultiFace_i.c -Digest-Algorithms: SHA MD5 -SHA-Digest: L+orpCaMGOQ+onrBja2eUcqCkZg= -MD5-Digest: EMEes+f0GfZuWG1TY8iItg== - -Name: ./samples/test/atl/MultiFace/MultiFace_p.c -Digest-Algorithms: SHA MD5 -SHA-Digest: qhXfLrVwc3+a2zQh3nqfuMMXJj4= -MD5-Digest: PddZdwiG4GABL2pFOgRWjg== - -Name: ./samples/test/atl/MultiFace/resource.h -Digest-Algorithms: SHA MD5 -SHA-Digest: ltVpL0yIoPqNP533PfXz0Mz3or0= -MD5-Digest: 67snAuAXM2aTH3ZXCjkOsg== - -Name: ./samples/test/atl/MultiFace/StdAfx.cpp -Digest-Algorithms: SHA MD5 -SHA-Digest: rRcr4BUiUcSuC9HT6rQc5MToiHk= -MD5-Digest: I/3OLbvTOW7wzD1mshUuuQ== - -Name: ./samples/test/atl/MultiFace/StdAfx.h -Digest-Algorithms: SHA MD5 -SHA-Digest: q4qcVRmFU7LYISdjJeW4CgEE9Xg= -MD5-Digest: jPsHuOvPDPZYxq1xxcvLsg== - -Name: ./samples/test/atl/MultiFace.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 68ZRr3nlrxp7xvgB8QtPLvBXkB0= -MD5-Digest: +E/sNJRVhdK9DvCHDKyeKA== - -Name: ./samples/test/atl/MultiFace.java -Digest-Algorithms: SHA MD5 -SHA-Digest: RD5SVQAbELsukdxLSrAlVraY5Rw= -MD5-Digest: O0/kAOqvz9Y1Gow65MmdJQ== - -Name: ./samples/test/atl/readme.txt -Digest-Algorithms: SHA MD5 -SHA-Digest: EHBHwONmkXMZLgpTRc6m8pORye0= -MD5-Digest: D+oj7h9BOskXCcBQuBSFdw== - -Name: ./samples/test/DispatchTest.class -Digest-Algorithms: SHA MD5 -SHA-Digest: b+R4oUyy/tugq7jgd+ZKEzqd5pI= -MD5-Digest: Uf5nmYcYZrCNk/YSYyUpcA== - -Name: ./samples/test/DispatchTest.java -Digest-Algorithms: SHA MD5 -SHA-Digest: W0BY50++uyVxEmDh8soynVg6lwI= -MD5-Digest: A6oIyzfJUCR1M6k3fQQz8Q== - -Name: ./samples/test/errEvents.class -Digest-Algorithms: SHA MD5 -SHA-Digest: EzYY0sXl18eP1HDctmCpgEWXxxI= -MD5-Digest: 2ZH6Pcx49W7FYL9aF1qiPQ== - -Name: ./samples/test/foo.foo -Digest-Algorithms: SHA MD5 -SHA-Digest: hKLRQFDind7Bt/el/UA0bOILVEc= -MD5-Digest: LfWLkubtUd37afJ4Ctu48A== - -Name: ./samples/test/foo.ser -Digest-Algorithms: SHA MD5 -SHA-Digest: lmeuI3I317iY2RKqZL40s3zMkZA= -MD5-Digest: D73llNfjRNWi6/yEfqjcZg== - -Name: ./samples/test/IEEvents.class -Digest-Algorithms: SHA MD5 -SHA-Digest: MzKjQ9LnBvcLGqb4eIoYX3pbWro= -MD5-Digest: rLvMvumb3zT+lmpnH12/0g== - -Name: ./samples/test/IETest.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 7wOaFqd2TvqatunZ8cgjkuwvAmc= -MD5-Digest: +Jlit06yZxTmsaTAGLjR8A== - -Name: ./samples/test/IETest.java -Digest-Algorithms: SHA MD5 -SHA-Digest: t3BKHw/pqw5198/fE3ttMMBijbE= -MD5-Digest: oBRVGqLdSZSxD6Acpne9mA== - -Name: ./samples/test/jacobtest.xls -Digest-Algorithms: SHA MD5 -SHA-Digest: iPakwQbwO78iKOXAnKi7J1vzvEs= -MD5-Digest: n07pNBLHIG662l3KfsZWdg== - -Name: ./samples/test/math.class -Digest-Algorithms: SHA MD5 -SHA-Digest: Z4QCBzw8I8743G2bsANsMvYvQjU= -MD5-Digest: oAuf3ElYdBR3Lmrq0+d9Og== - -Name: ./samples/test/math.java -Digest-Algorithms: SHA MD5 -SHA-Digest: n8YiT1GFbeaWXLMy+INu2Wfl7/k= -MD5-Digest: h1G6CVTiAFjm7Re1f64NEA== - -Name: ./samples/test/MathProj/Math.cls -Digest-Algorithms: SHA MD5 -SHA-Digest: CZJcmhZCs1+1p4NO71dggowWNc8= -MD5-Digest: +gkN44UHyxn83JeQVf+E6Q== - -Name: ./samples/test/MathProj/MathTest.dll -Digest-Algorithms: SHA MD5 -SHA-Digest: hoUwAKBHCK55cn7JdsA3wBf/Bn0= -MD5-Digest: 3BcNgFO5perWuHx79V0mXg== - -Name: ./samples/test/MathProj/MathTest.exp -Digest-Algorithms: SHA MD5 -SHA-Digest: ff9RS0k+cu2JO360qYqMoA1oJuA= -MD5-Digest: FNmayjvq8mTjLcIUbX5Zkw== - -Name: ./samples/test/MathProj/MathTest.lib -Digest-Algorithms: SHA MD5 -SHA-Digest: 62KdZxK15c8CLHZXYnJxbrjuBIc= -MD5-Digest: Is8yCaURP4hrKCZbNWmW7Q== - -Name: ./samples/test/MathProj/MathTest.vbp -Digest-Algorithms: SHA MD5 -SHA-Digest: I/k59CxSo5KBb/Mj0zLXnB/gpDU= -MD5-Digest: Iil+Tidd/5EWFe5TnPwhiA== - -Name: ./samples/test/MathProj/MathTest.vbw -Digest-Algorithms: SHA MD5 -SHA-Digest: h3dc5rr6p7aV45U26F4DyFTJM7I= -MD5-Digest: LudpvbnfPRzD0GwfkSjRdg== - -Name: ./samples/test/MathProj/README -Digest-Algorithms: SHA MD5 -SHA-Digest: nPVI0dpp+w5yLvy/p9le2e4BwiY= -MD5-Digest: S8VlUENr3X79v9OFAUljyQ== - -Name: ./samples/test/Outlook.class -Digest-Algorithms: SHA MD5 -SHA-Digest: DbN+VE/zRE6P+R2qIph048KmCl8= -MD5-Digest: Sxs8kOpskGsoOpwnSJxX2g== - -Name: ./samples/test/Outlook.java -Digest-Algorithms: SHA MD5 -SHA-Digest: OBV8N5rPxKJliq2DSDxLlJe8+2c= -MD5-Digest: 1ZgPwE5lkgetta1TElh2Iw== - -Name: ./samples/test/safearray.class -Digest-Algorithms: SHA MD5 -SHA-Digest: C9m0td07CI3WCNqMvDgCReVBk4U= -MD5-Digest: 3sWM1BZ/M6XrqeIJCSnIfw== - -Name: ./samples/test/safearray.java -Digest-Algorithms: SHA MD5 -SHA-Digest: /F4AvsA0zZN/I7cJAr1sHRsw+Fc= -MD5-Digest: oKA2jfEuphjZf30RyxJsvQ== - -Name: ./samples/test/sample2.mdb -Digest-Algorithms: SHA MD5 -SHA-Digest: Wp2D73waAFiEmDPw8ji7q+jZgFQ= -MD5-Digest: ZKs2YBS5XVEK9iDtHnGUpw== - -Name: ./samples/test/sa_dispatch.class -Digest-Algorithms: SHA MD5 -SHA-Digest: nCuBxiPc21pt7CnmxD+TIV4x1FI= -MD5-Digest: IhuUwtw0m6RfONvXtqvSAw== - -Name: ./samples/test/sa_dispatch.java -Digest-Algorithms: SHA MD5 -SHA-Digest: tIIx4FMZGe7k6+GH4ajRoWPJvyY= -MD5-Digest: DWknkLquVVJKRyKYSfXSOA== - -Name: ./samples/test/sa_test.class -Digest-Algorithms: SHA MD5 -SHA-Digest: NhQ8ICD0BX3upJ3yhPox7D4OrYw= -MD5-Digest: 2J2GkyWd+qfgf7Fjs8JnwA== - -Name: ./samples/test/sa_test.java -Digest-Algorithms: SHA MD5 -SHA-Digest: R682jIXe76aB9kJyNM0wtbZqtxU= -MD5-Digest: qLpQzDlRNgHUMSNvW9F9Vw== - -Name: ./samples/test/ScriptTest.bat -Digest-Algorithms: SHA MD5 -SHA-Digest: bxoaT2EWQv5FYtCWB0e9T89wJ2c= -MD5-Digest: iQQJtrBB1MZ6ljtIXoqIxQ== - -Name: ./samples/test/ScriptTest.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 9McitGPdEWuF+klNFu9Op2dcOuk= -MD5-Digest: SzDmf+iH5s/E1EmYPh208w== - -Name: ./samples/test/ScriptTest.java -Digest-Algorithms: SHA MD5 -SHA-Digest: yo2azi6j2xgIDKymZGO5l4FEdjE= -MD5-Digest: P/DSKEt74WRFIgJqRVHVtw== - -Name: ./samples/test/ScriptTest2.class -Digest-Algorithms: SHA MD5 -SHA-Digest: LktPbcouI60ec7wmvfmurGSFaT4= -MD5-Digest: OygfOlXJlkqn1x4TM8eI7g== - -Name: ./samples/test/ScriptTest2.java -Digest-Algorithms: SHA MD5 -SHA-Digest: HTrcf7IR3Og5i0xIw1mB7F4i0AY= -MD5-Digest: cyeOvZyeb0ZMjYFwAuCvRw== - -Name: ./samples/test/ScriptTest3.class -Digest-Algorithms: SHA MD5 -SHA-Digest: ZdD9Uar1kiYkiiOrOG5/Zs/gKHQ= -MD5-Digest: JP8N1C1bKhlZUzjNWjtfMw== - -Name: ./samples/test/ScriptTest3.java -Digest-Algorithms: SHA MD5 -SHA-Digest: Q0QxUzUMaIEUiuSiCYFDh8tPWzk= -MD5-Digest: 2JjocMlhddWcUXsKb3Arlw== - -Name: ./samples/test/speed.class -Digest-Algorithms: SHA MD5 -SHA-Digest: DdOhaT+V3Gz8lUFpTjkNHU8yUHI= -MD5-Digest: 10C0cOv36ugsmjtRdWiYeQ== - -Name: ./samples/test/speed.java -Digest-Algorithms: SHA MD5 -SHA-Digest: VRRtx5ebOKZ9w9i7zr5tjiGHtSA= -MD5-Digest: fW3+AiO4odk/dPP8QRwP7g== - -Name: ./samples/test/test.class -Digest-Algorithms: SHA MD5 -SHA-Digest: 0F3HoVHLRbxeIftBk5xSiayuruw= -MD5-Digest: xmgAS3ZMreVcVetw+Emz6w== - -Name: ./samples/test/test.java -Digest-Algorithms: SHA MD5 -SHA-Digest: fDgQ7roF5yECQWDgqE/H7hMS9lY= -MD5-Digest: C+R1qFuy0KYA6+NpE6lcMw== - -Name: ./samples/test/testEvents.class -Digest-Algorithms: SHA MD5 -SHA-Digest: VgQZMlTDKdXwHwnO+pg34FVxe+s= -MD5-Digest: pxOGqcHhcNCgpLrq961CYA== - -Name: ./samples/test/variant_test.class -Digest-Algorithms: SHA MD5 -SHA-Digest: rhCKxgFsnz4DCR3V6ZCnGZMKHNc= -MD5-Digest: U6IqRLGkVKIi6GYMVfQaJQ== - -Name: ./samples/test/variant_test.java -Digest-Algorithms: SHA MD5 -SHA-Digest: 7NFXoGskiCa/ZL7U8Acx/uZkdTE= -MD5-Digest: xPiJ1/PwMsYlUPlAiR+wkg== - -Name: ./samples/test/varSerTest.class -Digest-Algorithms: SHA MD5 -SHA-Digest: EyK1bvd0fQXevbJJfukQqFSTq+0= -MD5-Digest: ceVxF+Oz7CJF5whitqs7IA== - -Name: ./samples/test/varSerTest.java -Digest-Algorithms: SHA MD5 -SHA-Digest: 1kR1a6FqMGKYgazH8ZllBmTxWN4= -MD5-Digest: E+9UQHIkQN/XII2libkWXw== - -Name: ./todo.txt -Digest-Algorithms: SHA MD5 -SHA-Digest: GuE6XLByuSmPs4Q3TX8Qs2JRSro= -MD5-Digest: KtiB8O69ft5CCxNs+T9zZQ== - -Name: ./vstudio/jacob/jacob.dsp -Digest-Algorithms: SHA MD5 -SHA-Digest: nreCezgQ/DKa7TQ4Cj28cRzKQzM= -MD5-Digest: GOjDddOu1ZU5r0iGcEZzaw== - -Name: ./vstudio/jacob/jacob.dsw -Digest-Algorithms: SHA MD5 -SHA-Digest: yB8Hhn1M6jX7cOBloxUL2pAFf7Y= -MD5-Digest: hGWX78QoGIXxJed6eeTbAQ== - -Name: ./vstudio/jacob/jacob.ncb -Digest-Algorithms: SHA MD5 -SHA-Digest: xSDLS4QUbjm8RHNL/Qzq70zkYlk= -MD5-Digest: PK8cmkqwvTT9ECgqFhpdVQ== - -Name: ./vstudio/jacob/jacob.opt -Digest-Algorithms: SHA MD5 -SHA-Digest: ZI/dl8LS/Sp5vpLdODDNox8LfMc= -MD5-Digest: 90HtjVn8YtapmRMC9MAp0g== - -Name: ./vstudio/jacob/jacob.plg -Digest-Algorithms: SHA MD5 -SHA-Digest: 6D62etCgUdwooRVezsQCR5GG79M= -MD5-Digest: FEkATqvQLJeVQzpfboND4A== - -Name: ./WhatsNew.html -Digest-Algorithms: SHA MD5 -SHA-Digest: WZmYYAE5PedacDkqwqNPFlp4vSE= -MD5-Digest: WVceOUyV6DUWlncvAuqzpw== - diff --git a/README.txt b/README.txt deleted file mode 100644 index 0039ff6..0000000 --- a/README.txt +++ /dev/null @@ -1,11 +0,0 @@ -JACOB (Java-COM bridge) is hosted on Sourceforge http://sourceforge.net/project/jacob-project - -Information about what's new in this release can be found in docs/ReleaseNotes.html - -Instructions on building this project can be found in docs/HowToBuild.html -Detailed instructions on creating a build configuration file are in build.xml - -Put the appropriate DLL for your platform into your runtime library path. -jacob for 32 bit windows is located in /x86. - -There is no good usage guide at this time. \ No newline at end of file diff --git a/build.xml b/build.xml deleted file mode 100644 index e920840..0000000 --- a/build.xml +++ /dev/null @@ -1,481 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Building Jacob classes in ${release.dir.java} - - Building sample classes in ${release.dir.java} - - Building Jacob test classes in ${release.dir.java} using junit jar ${junit.jar} - - - - - - Removing old jars - - Packaging java classes... - Version File is ${release.dir.java.meta.inf}/${generated.filename.version} - - - - - - - - - - - -
- - - - -
-
-
-
- - - Clean up the (X86) target folders and file, for safety - - Compiling (X86) C++ classes with JDK JNI library ${JDK} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Clean up the (x64) target folders and file, for safety - - Compiling C++ (x64) classes with JDK JNI library ${JDK} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Clean up the target folders and file, for safety - Using ${library.x86} - - Creating ${release.file.x86.dll} - - - - - - - - - - - - - - - - - - - - - - - - Clean up the target folders and file, for safety - - Creating {$release.file.x64.dll} - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${application.title}]]> - ${application.vendor}]]> - - - - - - - - - - - - - Packaging release... ${release.file.jar} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/docs/BuildingJacobFromSource.html b/docs/BuildingJacobFromSource.html deleted file mode 100644 index 03cfbf2..0000000 --- a/docs/BuildingJacobFromSource.html +++ /dev/null @@ -1,144 +0,0 @@ - - -

Overview

-JACOB is built on windows machines using ANT, most commonly from inside of Eclipse. -The main steps for getting a working Jacob build are: -
    -
  1. Check out the source code or unpack the source zip file from sourceforge
  2. -
  3. Install the Development Environment
  4. -
  5. Configure the build by creating a compilation_tools.properties file.
  6. -
  7. Run Eclipse and load the project into eclipse
  8. -
  9. Open the build.xml file in Eclipse and run the default ant target
  10. -
-

-

Repository Organization

-

-Unpack the source archive zip file or check the files out of CVS into d:\jacob -or some other familiar place. Source Java and JNI files are located in seperate -packages from the unit tests and the samples. -

-

    -
  • docs: documentation -
  • jni: c++ code -
  • lib: libraries needed to compile unit tests -
  • release: a directory built by the ant script where jacob is constructed -
  • samples: sample programs -
  • src: Jacob Java source files -
  • unittest: JUnit 3.8.1 unit test programs. Run from the test target in build.xml -
  • vstudio: some out of date VC++ project files -
  • bulid.xml: the ant build script. It can be run from inside Eclipse -
-

-The Servlet examples that required j2ee libraries to compile have temporarily -been removed. -

-

Development Environment

-The simplest build environment includes MS Visual C++ 8.0 (Studio 2005), -Eclipse 3.3 with the C/C++ module and JDK 1.5. -In that situation, you would just create the compilation_tools.properties -using the example build.xml as a template. -
    -
  • Microsoft Visual C++ 8.0 and it's included library. (to C:\ProgramFiles in my case) -
  • Eclipse 3.4 or later from www.eclipse.org as the Java IDE. -
  • Eclipse 3.4 or later with the C/C++ plugin can be used for C coding in place of VC++ IDE. -
  • Java JDK 1.5 (1.15 was built using 1.5.0.16) -
-

-

- - - - - - - - - - - - -
ReleaseC VersionJava VersionANT VersionEclipse Version Usedgenerated DLLs
up to 1.6VC 98 (6.0)?MAKE?32 bit
1.7VC 98 (6.0)1.41.??32 bit
1.8VC 98 (6.0)1.41.??32 bit
1.9VC 98 (6.0)1.41.??32 bit
1.10VC 98 (6.0)1.41.?3.??32 bit
1.11VC 98 (6.0) & 2003 64bit libs1.4.?1.6.?3.2.132 and 64 bit
1.12VC 98 (6.0) & 2003 64bit libs1.4.21.6.53.2.232 and 64 bit
1.13VC 20051.4.21.7.03.332 and 64 bit
1.14VC 20051.5.01.7.03.332 and 64 bit
1.15VC 20051.5.01.7.03.432 and 64 bit
-Microsoft Visual C++ 8.0 supports 64 bit builds. so no additional tools are required. - -

- -

Build Process

-The build process is based on ANT. -You can run ANT from inside of eclipse or from the command line. -The ant process is driven off of a configuration file named -compilation_tools.properties that describes the locations of the JDK and Microsoft -C++ tools. The build.xml file in the root directory contains examples of the contents -of this file. - -

-There are two main ant targets. -

    -
  • "default" executes the following steps when using the default target. -
      -
    • Build the Java code -
    • Build the jni code -
    • create the dll -
    • create jar file -
    -
  • "package" runs the above listed steps and then - -
      -
    • builds the javadoc -
    • builds a source zip -
    • builds a binary zip with the javadoc -
    -
-

-

Eclipse Java IDE

-

-Eclipse users have to do some minor tweaks to their project if they -want to use the integrated build process. This is because the unit -tests are files located in the "unittest" directory while -the project source files themselves are in "src" the root directory. -By default, eclipse will add the entire project as source. This -messes up the package naming. In addition, the build directory should be -set to be the same place the ANT build puts the compiled java classes. -A couple small tweaks to the build path fix these problems: -

-Open up the project properties and go to the "Java Build Path" properties panel. -

    -
  • Remove the root of the project from the build path
  • -
  • Add folders samples, src and unittest - to the build path in the Source tab.
  • -
  • Exclude *.txt from each of the newly added folders.
  • -
  • Set the default build output directory to jacob-project/release/java
  • -
- -

Troubleshooting Build Problems

-
    -
  • -Symptom: The jar is built but no dlls were compiled.

    -Problem: compilation_tools.properties does not have the correct location for the Microsoft tools.

    -

  • -
  • -Sympton: Can't find jni.h or can't find C++ compiler

    -Problem: compilation_tools.properties configured incorrectly. Either -paths are wrong or the separator is wrong. It requires two backslashes for a separator.

    -

  • -
- -

Running Samples and Tests

-Samples and JUnit test programs can be found in the source jar or in CVS. The programs -can be run from a bat file or from inside the Eclipse IDE. The java library -path variable must be set to include the directory the jacob.dll is in. The -simplest way to do that is to add it as a command line option. The following -assume that your jacob development area is located in c:\dev\jacob: -
-	-Djava.library.path=c:/dev/jacob/release/x86 
-	-Dcom.jacob.autogc=false 
-	-Dcom.jacob.debug=false 
-	-Xcheck:jni
-
-

-JUnit test programs can be individually run from inside eclipse or en-masse -via the ant test target. - -Last Modified 10/2008 1.15 - - - \ No newline at end of file diff --git a/docs/EventCallbacks.html b/docs/EventCallbacks.html deleted file mode 100644 index bc7b836..0000000 --- a/docs/EventCallbacks.html +++ /dev/null @@ -1,88 +0,0 @@ - - - -Jacob can register Java classes for MS application events or callbacks - -

Overview

-Jacob can register Java classes for MS application events or callbacks. - -

Sequence of Events

-The normal flow for this is: -
    -
  1. Application thread creates an instance of the event handler and registers it with Jacob -
  2. The application continues on doing other work. -
  3. Some time later, the MS application takes some action and initiates the event callback. -
  4. The Java VM receives the event and spins up a new thread to handle it. -
  5. The Jacob jni EventProxy in the dll is called by the VM. -
  6. The Jacob jni EventProxy creates Variant objects to handle the parameters of the passed in event. -
  7. The Jacob jni EventProxy sends the name of the callback and the array of Variant objects to the Java InvocationProxy that was registered to catch events. -
  8. The Java InvocationProxy uses reflection to map the event name to a method name with the exact same name. -
  9. The Java InvocationProxy sends the message to the registered event handler and returns if the event handler is of type void (standard behavior). -
  10. The Java InvocationProxy sends the message to the registered event handler and returns the Variant that resulted from the call back to the Jacob jni EventProxy that then returns it to the windows calling program. -
- -

SWING Issues

-Swing developers should note that this message comes in on a thread other than the event thread. -All objects receiving events that require user intervention or drawing in the UI should use -invokeLater() to post requests for actions onto the event queue. Failure to do so will -insure random failures in the GUI. -Java Web Start (JWS) and other launchers can have additional issues related to the class loader. -The Jacob C++ library uses FindClass() to find the Variant class when building the parameter list. -FindClass() uses the system class loader which includes only the classes specified at run time or -in the CLASSPATH. Most of the application classes in this situation live in an alternate set of -class loaders that were created when the launcher located and ran the application classes. This -means that the search for Variant will fail usually with the silent and immediate termination of -the Java application. The thread classloader probably can’t be used to try and find the class -because this new thread does not have a classloader associated with it other than the system class -loader. The end result is that the Variant class needs to be located via other means and that the -thread classloader should be set to be the context class loader of the event handler class. - -

1.8 and 1.9 behavior

-The Jacob EventProxy class has been modified (off of the 1.8 tree) so that it takes a two step approach towards fixing these problems. -
    -
  1. The EventProxy constructor now accepts an extra object, an instance of the Variant class. This gives the EventProxy a way to get to the Variant class and thus to its classloader. All of the callers of the constructor have been modified to pass a Variant object to the EventProxy without programmer intervention. -
  2. EventProxy first attempts to locate the Variant class using FindClass() -
  3. Failing that, it looks to see if a variant object had been passed in. If so, it calls class() and goes from there. -
  4. If all that fails, it logs a message and then fails in the spectacular fashion of the previous versions. -
-

-

1.10 behavior

-The Jacob EventProxy class has been modified so that it takes a different approach towards fixing this problem. -
    -
  1. All objects that request event notification are now wrapped in a Java InvocationProxy - so that a standard interface is always presented to the JNI EventProxy object. -
  2. The EventProxy constructor accepts any Java class. It wraps the class if it is not an - InvocationProxy or uses just the passed in object if it is an InvocationProxy. - The JNI layer talks to the InvocationProxy instead of talking directly to the event listener - as in previous releases. -
  3. The Java InvocationProxy has a method on it that will return the Variant class that the - EventProxy. The JNI code uses this method to acquire the class so that it can call newInstance(). -
-Developers can receive call back events in JWS other Java launching programs without implementing any additional code. They should be aware that their callback methods may need to set the class loader. If they expect to create any objects.: -
-      Public xxx someHandler(Variant[] foo){
-            Thread.currentThread().setContextClassLoader(
-                  this.getClass().getClassLoader());
-            // do something
-      }
-
-There may still be a dual event queue issue in JWS applications that needs to be looked at. - -

-

1.12 Experimental Behavior

-Release 1.12 adds experimental support for event handlers that accept java objects as parameters -to closer match the signature of the windows callback. New ActiveXDispatchEvents and -ActiveXInvocationProxy operate in tandem in the same way as DispatchEvents and InvocationProxy. -DispatchEvents overrides getInvocationProxy() to create a new ActiveXInvocationProxy in place -of the normal InvocationProxy. ActiveXInvocationProxy has its own invoke() method that uses -reflection to call back using java objects as parameters. -

-Issues with this approach -

    -
  • Event callbacks that use java signatures do not support parameter modification. Many -windows callbacks let a user reject an event that is about to happen by modifying one of the -parameters. In this situation, the old DispatchEvents/InvocationProxy pair must be used instead -of the new handlers. -
- - diff --git a/docs/JacobComLifetime.html b/docs/JacobComLifetime.html deleted file mode 100644 index 69de796..0000000 --- a/docs/JacobComLifetime.html +++ /dev/null @@ -1,51 +0,0 @@ -

COM Object Lifetime in JACOB

-

-

introduction

-

-JACOB Version 1.7 implements a new -Threading Model that is more -compatible with COM apartments. There is also an incompatibility -between the Java object lifetime model and that of COM objects. -COM Objects live and die by their reference count, whereas Java -objects are collected by the Garbage Collector (GC) based on algortihms -that are hidden from the user. -

COM Object Lifetime in JACOB Prior to Version 1.7

-

-In version 1.6 and earlier, JACOB objects which wrapped COM objects -had finalize() methods that would call a native -release method which would call a COM Release. -

-This has many problems. For one thing, the GC may take a long time to -kick in and resource consumption may grow. However, the more problematic -issue is that finalizers are called from a separate thread, and, as was -discussed in the Threading Model -document, this can result in COM errors if the object is running in an -STA. Even if the object is running in an MTA, the finalizer may decide -to run after we have terminated the thread that holds the component, in -which case we would get fatal errors and crashes. -

COM Object Lifetime in JACOB in Version 1.7

-

-In Version 1.7, all JACOB objects which wrap COM objects extend -com.jacob.com.JacobObject. This object has some special -code to register itself with a com.jacob.com.ROT object -which represents a Running Object Table (ROT). This table maps a -Thread to the set of JacobObjects created in that thread. Therefore, -when you call ComThread.Release(), the ROT checks whether -that thread has created any objects, and these objects are released -by calling their native release method (which is public). -

-This lifetime management method ties the lifecycle to the thread's -lifecycle rather than the GC. The JacobObject's still have finalizers, -but they will typically not perform the native release -since that has already been called. The native release -methods were written such that you can call them multiple times without -worrying - since they zero out the native pointer when called the first -time. -

-If you choose to call release methods on your objects -yourself, that is allowed. In that case, when the thread is released -the release calls will be no-ops. -

-It becomes important for you to call ComThread.Release() -on any thread before you allow it to exit, otherwise you may get -some random crashes later on in your code. diff --git a/docs/JacobThreading.html b/docs/JacobThreading.html deleted file mode 100644 index 8ae3e3e..0000000 --- a/docs/JacobThreading.html +++ /dev/null @@ -1,410 +0,0 @@ -

COM Apartments in JACOB

-

-

introduction

-

-The COM model for Threading differs from the Java model. -In COM, each component can declare whether or not it support -multi-threading. - -You can find some basic information about COM threading at: -

- -http://www.execpc.com/~gopalan/com/com_threading.html -

- -www.microsoft.com/msj/0297/apartment/apartment.htm -

- -http://www.cswl.com/whiteppr/white/multithreading.html - -

-The term Single Threaded Apartment (STA) refers to a thread -where all COM objects created in that thread are -single-threaded. This can manifest itself in two ways: -
-Either all calls into that component are made from the same thread -that created the component -
-OR any call that is made from another thread gets serialized by COM. -This serialization of calls is done by using a Windows message loop and -posting messages to a hidden window (I'm not kidding). The way COM -achieves this is by requiring any other thread to make calls through -a local Proxy object rather than the original object (more on this -when we discuss the JACOB DispatchProxy class). -

-What does this mean for a Java application? If you are using a component -that declares itself as ThreadingModel "Apartment" (you can -find this out by looking in the registry under its CLSID), and you plan -to create, use and destroy this component in one thread - then you are -following the rules of an STA and you can declare the thread as an -STA thread. -

-On the other hand, if you need to make method calls from another thread -(e.g. in a servlet) then you have a few choices. Either you -create the component in its own STA, by extending -com.jacob.com.STA, and use the -com.jacob.com.DispatchProxy class to pass the Dispatch -pointer between threads, or you can declare your thread as an MTA -thread. In that case, COM will make -the cross-thread calls into the STA that is running your component. -If you create an Apartment threaded component in the MTA, -COM will automatically create an STA for you and put your -component in there, and then marshall all the calls. -

-This brings us to the notion of a Main STA. COM requires that -if there is any Apartment threaded component in your application, then -the first STA created is tagged as the Main STA. COM uses the -Main STA to create all the Apartment threaded components that are -created from an MTA thread. The problem is that if you have already -created an STA, then COM will pick that as the Main STA, and if you -ever exit that thread - the whole application will exit. - -

COM Threads in JACOB Prior to Version 1.7

-

-Up until version 1.7 of JACOB, there was only one model available -in JACOB: -

    -
  • -Before version 1.6: All threads were automatically initialized as STAs. -
  • -
  • -In version 1.6: All threads were automatically initialized as MTAs. -
  • -
-

-The reason for the change in default was that tagging a Java thread -as an STA can cause problems. Any Java Swing application, as well as -servlets and applets need to be able to make calls from multiple -threads. If you try to make COM method calls across STA threads - it -will fail! -

-In most cases, the default chosen by JACOB 1.6 (MTA) works fine, however -there are some notable exceptions that have caused people grief. One -such exception is in the case of MAPI. It turns out that if you try to -create a MAPI object from an MTA thread - it simply fails and exits. -This has caused some people to recompile JACOB 1.6 back with the STA -default. -

-There is another problem with MTA threads: when you are using Apartment -threaded components, we already noted that COM will create the -components in the Main STA. If one doesn't exist, COM will create it. -However, this means that all Apartment threaded components will -be created in the same STA. This creates a bottleneck, and a -dependency between unrelated components. Also, if that STA exits, then -all components are destroyed and the application will likely crash. - -

COM Threads in JACOB Version 1.7

-

-In Version 1.7 we have added finer grained control to allow the -Java programmer to control how COM creates its components. -Unfortunately, this means that you need to have a pretty good -understanding of the dark and mystical subject of COM Apartments. -There are a few different cases you need to consider: -

Default

-

-If you simply run code that was created in Version 1.6 and ignore -the COM threading issue, then you will get the same behavior as in 1.6: -Each java thread will be an MTA thread, and all Apartment threaded -components will be created by COM in its own Main STA. This typically -works for most applications (exceptions noted above). -

Create Your Own Apartment

-

-To declare an MTA thread use the following template: -
-

-
-ComThread.InitMTA();
-...
-...
-ComThread.Release();
-
- -
-If you want JACOB to create its own Main STA (rather than having COM -choose an STA for you), then you should use: -
- -
-Thread 1:
-ComThread.InitMTA(true); // a true tells JACOB to create a Main STA
-...
-...
-ComThread.Release();
-...
-Thread 2:
-ComThread.InitMTA(); 
-...
-...
-ComThread.Release();
-...
-...
-ComThread.quitMainSTA();
-
-
-
-In this case, you can also create the Main STA explicitly: -
- -
-ComThread.startMainSTA();
-...
-...
-Thread 1:
-ComThread.InitMTA();
-...
-...
-ComThread.Release();
-...
-Thread 2:
-ComThread.InitMTA(); 
-...
-...
-ComThread.Release();
-...
-...
-ComThread.quitMainSTA();
-
-
-
-In the latter case, all Apartment threaded components will be created in -JACOB's main STA. This still has all the problems of components -sharing the same Main STA and creating a bottleneck. To avoid that, -you can also create STA threads yourself: -
- -
-ComThread.startMainSTA();
-...
-...
-Thread 1:
-ComThread.InitSTA();
-...
-...
-ComThread.Release();
-...
-Thread 2:
-ComThread.InitMTA(); 
-...
-...
-ComThread.Release();
-...
-...
-ComThread.quitMainSTA();
-
-
-
-In this example, thread 1 is an STA and thread 2 is an MTA. You could -omit the call to ComThread.startMainSTA(), but if you do, then COM will -make the first STA your main one, and then if you exit that thread, -the application will crash. -

-Actually, Thread 1 is almost an STA. It's lacking a windows -message loop. So, this type of STA is fine as long as you are creating -a component and using it in the same thread, and not makind event -callbacks. -

JACOB's STA Class

-

-If you want to create an true STA where you can create a component and -then let other threads call methods on it, then you need a windows -message loop. JACOB provides a class called: -com.jacob.com.STA which does exactly this. - -

-public class com.jacob.com.STA extends java.lang.Thread 
-{
-    public com.jacob.com.STA();
-    public boolean OnInit(); // you override this
-    public void OnQuit(); // you override this
-    public void quit();  // you can call this from ANY thread
-}
-
- -

-The STA class extends -java.lang.Thread and it provides you with two methods -that you can override: OnInit and OnQuit. -These methods are called from the thread's run method -so they will execute in the new thread. These methods allow you to -create COM components (Dispatch objects) and release them. -To create an STA, you subclass it and override the OnInit. -

-The quit method is the only other method that -can be called from any thread. This method uses the Win32 function -PostThreadMessage to force the STA's windows message loop -to exit, thereby terminating the thread. -

-You will then need to make calls into the component that is running -in the STA thread. If you simply try to make calls from another thread -on a Dispatch object created in the STA thread, you will get a COM -Exception. For more details see: - -Don Box 'Effective COM' Rule 29: Don't Access raw -interface pointers across apartment boundaries. -

The DispatchProxy Class

-Since you cannot call methods directly on a Dispatch object created -in another STA JACOB provides a method for the class that created -the Dispatch object to marshal it to your thread. This is done via -the com.jacob.com.DispatchProxy class. - -
-public class DispatchProxy extends JacobObject {
-    public DispatchProxy(Dispatch);
-    public Dispatch toDispatch();
-
-    public native void release();
-    public void finalize();
-}
-
-
-

-This class works as follows: the thread that created the Dispatch -object constructs an instance of DispatchProxy(Dispatch) with the -Dispatch as a parameter. This instance can then be accessed from -another thread, which will invoke its toDispatch method -proxy as if it were local to your thread. COM will do the inter-thread -marshalling transparently. -

-The following example is part of samples/test/ScriptTest2.java in the -JACOB distribution. It shows how you can create the ScriptControl -in one STA thread and make method calls on it from another: - -

-import com.jacob.com.*;
-import com.jacob.activeX.*;
-
-class ScriptTest2 extends STA
-{
-  public static ActiveXComponent sC;
-  public static Dispatch sControl = null;
-  public static DispatchProxy sCon = null;
-
-  public boolean OnInit()
-  {
-     try
-     {
-       System.out.println("OnInit");
-       System.out.println(Thread.currentThread());
-       String lang = "VBScript";
-
-       sC = new ActiveXComponent("ScriptControl");
-       sControl = (Dispatch)sC.getObject();
-
-       // sCon can be called from another thread
-       sCon = new DispatchProxy(sControl);
-
-       Dispatch.put(sControl, "Language", lang);
-       return true;
-     }
-     catch (Exception e)
-     {
-       e.printStackTrace();
-       return false;
-     }
-  }
-
-  public void OnQuit()
-  {
-     System.out.println("OnQuit");
-  }
-
-  public static void main(String args[]) throws Exception
-  {
-    try {
-      ComThread.InitSTA();
-      ScriptTest2 script = new ScriptTest2();
-      Thread.sleep(1000);
-
-      // get a thread-local Dispatch from sCon
-      Dispatch sc = sCon.toDispatch();
-
-      // call a method on the thread-local Dispatch obtained
-      // from the DispatchProxy. If you try to make the same
-      // method call on the sControl object - you will get a
-      // ComException.
-      Variant result = Dispatch.call(sc, "Eval", args[0]);
-      System.out.println("eval("+args[0]+") = "+ result);
-      script.quit();
-      System.out.println("called quit");
-    } catch (ComException e) {
-      e.printStackTrace();
-    }
-    finally
-    {
-      ComThread.Release();
-    }
-  }
-}
-
- -

-You can try to modify the Dispatch.call invocation in -the main thread to use sControl directly, and you will see -that it fails. Notice that once we construct the ScriptTest2 object -in the main thread, we sleep for a second to allow the other thread -time to initialize itself. -

-The STA thread calls sCon = new DispatchProxy(sControl); -to save a global reference to the DispatchProxy that represents the -sControl object. The main thread then calls: -Dispatch sc = sCon.toDispatch(); to get a local Dispatch -proxy out of the DispatchProxy object. -

-At most one(!) -thread can call toDispatch(), and the call can be made only once. -This is because a IStream object is used to pass the proxy, and -it is only written once and closed when you read it. -If you need multiple threads to access a Dispatch pointer, then -create that many DispatchProxy objects. For more details please -refer to the Don Box reference above. - - -

Recommended Procedure

-
    -
  • -It is recommended that you always allow JACOB to manage the main STA -rather than letting COM create one on its own or tag one of yours. -
  • -
  • -Declare an STA thread using ComThread.InitSTA() -if all your -method calls for that component are going to come from the same thread. -
  • -
  • -If you want an STA thread that allows other threads to call into it, -use the com.jacob.com.STA class as outlined above. -
  • -
  • -If you have a COM component that declares its ThreadingModel as -"Free" or "Both", then use the MTA. -
  • -
  • -In most cases, if you need to make method calls from multiple threads, -you can simply -use MTA threads, and allow COM to create the components in -the Main STA. You should only create your own STA's and DispatchProxy -if you understand COM well enough to know when the MTA solution -will fail or have other shortcomings. -

    -There are 3 examples in the samples/test directory that demonstrate -these cases: -

    -ScriptTest.java - creates an STA for the ScriptControl component and -runs all its method calls from that STA. -

    -ScriptTest2.java - creates a separate STA thread, and makes -method calls into the component from another thread using DispatchProxy. -

    -ScriptTest3.java - creates a separate MTA thread, and makes method -calls into the component from another MTA thread. This is simpler -than ScriptTest2 for most applications. -

    -

    Default Threading Model

    -If you create a new thread, and don't call -ComThread.InitSTA() or ComThread.InitMTA() -on it, then the first time your java code creates a JacobObject, it -will try to register itself with the ROT, and when it sees that the -current thread is not initialized, it will initialize it as MTA. -This means that the code to do this is no longer inside the native -jni code - it is now in the com.jacob.com.ROT class. -For more details on the ROT, see the -Object Lifetime document. diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html deleted file mode 100644 index e77f3df..0000000 --- a/docs/ReleaseNotes.html +++ /dev/null @@ -1,1186 +0,0 @@ - - - -

    JACOB 1.15 M2

    -

    What's New

    -
      -
    • - MS Libraries are now statically linked using /MT instead of /MD to - reduce issues library compatibility issues, especially on older platforms. - The VC++ redistributable library no longer needs to be installed - as a stand alone product. -
    • -
    -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    2819445SafeArray.fromLongArray fails when using VariantLongInt (M3)
    2847577SafeArray#setString(*) incorrectly handles unicode strings (M3)
    2721937System.getProperties call caused security exception in applet. - com.jacob.includeAllClassesInROT now acts as master switch for class/ROT control. - This change also has the side benefit that the PutInROT property is not - checked on every object creation for users who run in the standard - all classes in ROT mode. (M2)
      
    Patches
    2762275 Support conversion of primitive arrays to Variant arrays. (M1)
    2171967 VariantUtils.populateVariant can cause VM crash with unrecognized type.(M1)
      
    Feature Requests
      
    Known Issues
    - - -

    JACOB 1.14.3

    -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    2011706Fixed windows memory corruption unhooking - call back proxy
    1986987 Possible deadlock when multiple threads starting - and stopping that rely on implicit ComThread.InitMTA
      
    Patches
      
    Feature Requests
      
    Known Issues
    - - - -

    JACOB 1.14.1

    -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1919441Type: loading 64 bit jacob.dll. Computed dll - name includes space that is not in name of actual dll
      
    Patches
      
    Feature Requests
      
    Known Issues
    - - - -

    JACOB 1.14

    -

    What's New

    -
      -
    • - Binaries are now compiled with Java 5. JDK 1.4 support dropped. -
    • -
    • - Jacob now loads dlls based on platform (32 bit /64 bit) and version number. -
    • -
    - -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1857439(M7) version.properties renamed to META-INF/JacobVersion.properties - to remove collision with WebSphere version.properties.
    1840487(M6) toJavaObject() converting to SafeArray - did shallow copy that left two objects pointing at the same windows memory.
    1829201(M5) DECIMAL rounding behavior externalized - and old Variant decimal API restored.
    1829201(M5) DECIMAL rounding behavior externalized - and old Variant decimal API restored.
    1829201(M4) Decimal type now throws IllegalArgumentException - when more than 12 bytes worth the digits exist in BigDecimal. Rounding - support added to reduce precision of BigDecimals when converting into VT_DECIMAL
    1815163(M2) Double and Decimal conversion to Int fails for negative values
      
    Patches
      
    Feature Requests
    1845039 (M7) Jacob DLL name can now be customized to - support bundling of Jacob in other products.
    1845039 (M6) Jacob DLL names are now qualified by platform and - release. The JacobLibraryLoader now determines the correct 32bit or 64bit - dll based on the system architecture. Jacob.jar now also knows the version - of the dll it is looking for (by name) and loads the correct one. JWS clients - will have to modify their dll loaders. See: The JWS classloader sample
    1828371 (M4) Added VT_I8 support to SafeArray.
    1813458(M3) Expand type support. Changed currency support - to use new Currency class. Added VT_I8 64 bit support. VT_I8 support - requires Windows XP or later. VT_I8 not supported by windows in - Windows 2000 and earlier. Added more primitive constructors to Variant.
    1816863(M1) Migrate Jacob to JDK 5
      
    Known Issues
    This is now built with Java 5 compiler and - Java 5 syntax. This release is not compatible with JDK 1.4.x and earlier.
    This release requires the Visual C++ 2005 - libraries. See 1.13 Known Issues for more information.
    - - -

    JACOB 1.13

    -

    What's New

    -
      -
    • - Binaries compiled with with Visual Studio 2005 in place of VC98. -
    • -
    • - Changed milestone release naming convention from "pre..." to "M..." -
    • -
    • - The unittest directory now a JUnit 3.8.1 test repository -
    • -
    - -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1793362(M5) ERROR_MORE_DATA causes failures. Fix submitted for defect found while porting - Jameleon to use current release of Jacob.
    1775889(M4) Fixed leak SafeArray setString(int[],value) and other setString() methods
      
    Patches
    1794811 (M5) Support Unicode strings in COM failure messages
    1793346(M5) Replaced use of deprecated API and removed unused variables.
    1701995 (M2) Added option to exclude classes from ROT to - try and manage memory in heavy event callback programs. Feature is 100% - backwards compatible by default. -
    1709841 (M1) Compiled with Visual Studio 2005. Jacob now requires - 2005 or later libraries. - See the UsingJacob.html file for impact this has on NT, 2000 and Server 2003 users. -
      
    Feature Requests
    1772783 (M4) Added VT_DECIMAL support for BigDecimals whose scale less than 28
    1761727(M3) unittest directory test programs - converted to JUnit 3.8.1. New ANT target created to run all unit tests.
      
    Known Issues
    Jacob 1.13 is built using VC++ 2005. - That creates a dependency on the Visual C++ 2005 libraries and msvcr80.dll. - This library is normally installed on XP systems but may have to be manually - installed on older systems. The pagackage, often referred to as vcredist.exe - can be obtained from the MS downloads site. - If you are getting loader errors on this release or later when loading the - dll then you may be missing this library.
    - - -

    JACOB 1.12

    -

    What's New

    -
      -
    • - Now compiles with with Visual versions later than VC 98 -
    • -
    - -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1651926 (pre-release 1) ActiveXComponent: getPropertyAsString should call getString() instead of toString()
    1569864 (pre-release 1) IEnumVariant leak fixed in patch 1674179
    1112667(pre-release 1) IEnumVariant leak fixed in patch 1674179
    1465539(pre-release 1) IEnumVariant leak fixed in patch 1674179
    1699946 (pre-release 5) Unrecognized event callback id leaves thread attached to VM when ComFailException is thrown.
    1699965 (pre-release 5) toJavaObject() fails for Dispatch because getDispatchRef() called instead of getDispatch().
      
    Patches
    1674015(pre-release 1) ROT hashmap key generation when autogc=no (default) - can lead to key collisions in hashmap. This causes objects to be garbage finalized - when they shouldn't be resulting in vm failures with large (large) numbers of objects.
    1674179(pre-release 1) Fixed Enum leaks with EnumVariants in Variant.cpp and EnumVariant.cpp
    1687419(pre-release 3) Corrected calls to AttachCurrentThread in EventProxy
    1689061 (pre-release 4) C code changes to fix VC2003 compiler warnings.
    1690420(pre-release 4) Incorrect memcpy lengths for Currency Variants
    1650134(pre-release 6) Beta support for VT_VARIANT (VariantVariant). - Includes support for putVariant, getVariant, toJavaObject, Variant(Object,flag). - Enclosed variants are retreived as Java objects.
      
    Feature Requests
    1662887(pre-release 1) Dispatch static methods should throw runtime exceptions when - null is passed in for the Dispatch object and when the Dispatch object is in an invalid state.
    1702604 (pre-release 6) Support java semantics in event callbacks. Create - ActiveXInvocationProxy and ActiveXDispatchEvents that provide the supplemental API. - See IETestActiveXProxy.java for an example. -
      
    Known Issues
    1504120Identified 1.11.1 Microsoft 2003 Server crashes. Server crashes on MS 2003 Server have been reported over time. - Some users have had say that Jacob must be built on MS2003 Server to run reliably. - The Jacob distribution on Sourceforge is built on Windows XP SP2
    1677933Identified 1.11.1 Process affinity may have to be set on - dual core machines to avoid com exceptions.
    no ticketIdentified 1.11.1 Versions of JDK 1.5 prior to 1.5_10 are known to leak JNI handles. - See the Sun bug tracking system http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399321 for more details. -
    - - -

    JACOB 1.11.1

    -

    What's New

    -Bug fix release -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1602188Variant toString() causes stack overflow for byRef() Variants - (This show stopper defect forced the 1.11.1 release)
    1611487Variant toJavaObject() doesn't work for byRef Variables and - returned the wrong value for unrecognized Variant types.
    1607878Variant getJavaDateRef() fails.
      
    Patches
    SF1603631Concurrent modification of ROT causes VM crashes. Access - to the ROT has been sychronized. No performance impact analysis has been done
      
    Feature Requests
      
    - - -

    JACOB 1.11

    -

    What's New

    -
      -
    • - Build -
        -
      • Build process now notifies developer if version property missing
      • -
      • Build process now compiles 32 bit and/or 64 bit DLLs as appropriate - for the build environment.
      • -
      -
    • -
    • - API Changes -
        -
      • Variant.noParam() changed to Variant.putNoParam() -
      • Variant.toString() now follows normal java semantics. - This conflicted with the jacob toXXX() standard. -
      • Many Variant.toXXX() did type conversion in addition to a get. The - methods have deprecated because folks didn't realize - they were doing type conversion. - Most calls to toXXX() methods should actually be getXXX() calls. - This also allowed toString() to follow Java conventions -
      • Variant native methods are wrapped with java methods that do parameter and - state checking to better armor the Variant -
      -
    • -
    - -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1550604Build process died with confusing error if version not set in properties file(pre1)
    1511033Fix array index out of bounds problem due to coding error (pre1)
    1570270 ~Event method in EventProxy may unhook java thread from VM. - Can get JNI error because unhooking listner detatched Java VM thread (pre1)
    1538011 toString() non compliant with java standards. The toString() method - converted the underlying data to a string and it shouldn't. This caused - a rethinking of all toXXX() methods other than toDispatch(). Most of the - toXXX() methods have now been deprecated and should be replaced with getXXX() methods. - (pre1)
    1478162Variant does not warn user if methods called after released. - All putXXX() and getXXX() methods now check to see if they've been released - prior to calling the JNI code. toXXX() methods are deprecated but protected - in the same way.(pre1)
      
    Patches
    SF1493647Support command line parameter dll location specification. - Applets and other tools can now specificy the dll location that - is fed to a System.load() rather than System.loadLibrary for the - situation where the app can't write the dll to a library path directory.(pre1)
      
    Feature Requests
    1580993Modify the build process to support 64 bit dll construction(pre2)
    1550628Moved all LoadLibrary requests into LibraryLoader. Classes not subclassed - off of JacobObject make calls to a static method on LibraryLoader to make sure - DLL is loaded(pre1)
    - - - -

    JACOB 1.10.1

    -

    What's New

    -
      -
    • - Variants -
        -
      • Static constnats are no longer released -
      • obj2variant on Dispatch now supports passing a java.util.Date -
      -
    • -
    - -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1474474Static constants in the Variant class can no longer have SafeRelease() called on them.
    1477793obj2variant should accept java.util.Date the same way the Variant constructor does
      
    Patches
      
    Feature Requests
    - - - -

    JACOB 1.10

    -

    What's New

    -
      -
    • - Windows Processes -
        -
      • New proposed API to support ActiveXComponent connections to already running applications. - Factory methods have been added to the ActiveXComponent to support this. - (Feedback wanted) -
      -
    • -
    • - Variants -
        -
      • Variant now accept Java Dates in the constructor. -
      • Redundant constructors removed -
      • Experimental toJavaObject() method added that automatically - converts to appropriate java type -
      • Support added for "NOTHING", a Variant of type Dispatch with no value -
      • Non functional getNull() and getEmpty() methods deprecated. They were void methods -
      -
    • -
    • - Event Callbacks -
        -
      • Jacob normally uses information in the registry to find the connection - information needed to set up event callbacks. Excel and other programs - don't put that information in the registry. A new optional parameter - has been added to the DispatchEvents constructors that lets a user provide - the location of the OLB or EXE that contains the information required to - retrieve the events. -
      • Event handlers can now return a Variant to calling MS Windows program. - Event handlers that do not return an object should still be defined - as being of type "void". This means that support for event handler's returning - values should be backwards compatible with previous releases. -
      -
    • -
    - -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1340233Null Program Id in Dispatch Constructor does bad things to VM(pre1)
    1341763Removed Variant serializable interface because it is not - actually serializable on 2000/xp(pre1)
    1435215Incorrect memory release in SafeArray.cpp (pre4) -
    1224219Memory leak in SafeArray.GetString() - Olivier Laurent, Software AG Luxembourg and David Pierron, Software AG Luxembourg (pre3)
    1224219Change from UTF to UNICODE SafeArray.fromStringArray() - Olivier Laurent, Software AG Luxembourg and David Pierron, Software AG Luxembourg (pre3)
      
    Patches
    1386454Return values from event callbacks (pre3)
    1394001Missing variable initialization (pre3)
    1208570Support Excel and other objects events(pre1)
      
    Feature Requests
    1241037Support NULL VT_DISPATCH.(pre2)
    1169851 Support of VB's Nothing.(pre2)
    1185167Provide methods to connect to running instance.(pre1)
    959381Auto variant to object conversion method method added to Variant.(pre1)
    1341779Variant should accept java.util.Date in Variant(Object) constructor(pre1)
    - - - -

    JACOB 1.9.1

    -

    What's New

    -
      -
    • - License -
        -
      • License standardized on LGPL. See LICENSE.TXT for more information -
      -
    • -
    • - Event Callbacks -
        -
      • Event handlers are now wrapped in an InvocationProxy. The COM/JNI event - code knows only about InvocationProxies and calls the appropriate methods - on the Invocation proxy to get needed Variant instances and to forward - events to the Java layer. -
      -
    • -
    • - Variants -
        -
      • Automatic conversion between Windows Time and Java Date is now supported - in Variant object. -
      -
    • -
    • - SafeArray -
        -
      • Multi-dimensional (greater than 2) support -
      -
    • -
    - -

    Tracked Changes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Bugs
    1335897 SafeArray() called toString() on objects when debug was turned on
      
    Patches
    1314116 putString UNICODE string length not detected
      
    Feature Requests
    1264850Custom Event Dispatching
    959382Time Conversion
    1313892 Multi-Dimensional SafeArray
    - - - - -

    JACOB 1.9

    -

    What's New

    -
      - -
    • -Event Callbacks -
        -
      • Variant parameters can now be modified by the receiver to be passed -back to the COM caller
      • -
      • Callbacks now create objects of class VariantViaEvent rather than Variant. -This was aided to add debugging and tracing
      • -
      • Callbacks can now be received when running in JWS other launchers where -JACOB.jar is not in the system classloader's path.
      • -
      -
    • - - -
    • -Dispatch API Clarifications -
        -
      • All static method's first parameters have been more strongly typed -to the Dispatch class, rather than Object. This may call for code -changes in the cases of code that just asigned Dispatch objects -to variables of type Object rather than Dispatch or one of its subclasses
      • -
      -
    • - -
    • -Dispatch subclasses are now supported with pointer modifying constructor -
        -
      • Dispatch and ActiveXComponent now includes a constructor to be used by Dispatch subclasses -that swaps the pointers around. This eliminates the need for every Dispatch subclass -to have a constructor that swapped and nulled out the pointers to the COM layer. -All samples have updated to use the new api
      • -
      -
    • - -
    • -ActiveXComponent has been upgraded
        -
      • ActiveXComponent methods return ActiveXComponets
      • -
      • Methods have been added to the ActiveXComponents to retrieve -parameters as Dispatch objects or ActiveX components. The -Script Tests have been updated to show the same programs in Dispatch -format or ActiveXComponentFormat
      • -
      -
    • - -
    • -Memory Management -
        -
      • Beta test option that lets an application use automatic object object -removal through the use of weak reference hash maps in the ROT class.  The -default behavior of manual release via the COMThread class has been retained as -the default behavior.  Developers can test automatic memory collection by -using the command line option -Dcom.JACOB.autogc=true
      • -
      -
    • - -
    • -JNI Changes -
        -
      • Erroneous Array dimension checking fixed for certain boolean set and get functions -
      • -
      • Alternative method for finding Variant class for callbacks in JWS -or other application lanchers where the system classloader does not -know about JACOB classes.
      • -
      • Unicode is supported for putString and putStringRef
      • -
      • EventProxy zeros out the com object reference in the Variant objects -that are created by EventProxy so that they are not double released, -by both the Java VM and calling code from the COM side. The caller -is supposed to be responsible for releasing the memory it created. -This fix only applies to Variants created in callbacks.
      • - -
      - -
    • - -
    • -Logging Additions
        -
      • Debugging logging to standard out for JACOB can be turned on by using the -command line option -Dcom.JACOB.debug=true
      • -
      -
    • - -
    • -Visual Studio
        -
      • The VisualStudio directory in the CVS repository will be removed in the next -release
      • -
      -
    • - -
    • -Documentation
        -
      • API documentation via Javadoc  is now being generated for all classes.
      • -
      • The development team is looking for help in upgrading the quality of the -class documentation
      • -
      -
    • - -
    • -Build Changes -
        -
      • A static method has been added to JacobObject that returns the build version
      • -
      • The project is now being built using ANT.  Most of the developers are -running this from inside of Eclipse
      • -
      • All makefiles have been purged
      • -
      - -

      Tracked Changes

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Bugs
      1116101jacob-msg 0284 : Access Violation while garbage collecting
      1114159Problem with COM Error Trapping in JACOB DLL
      1113610Bad error check in SafeArray.cpp
      1066698Minor Memory leak in Dispatch.cpp
      1065533Problem with unicode conversion
      1053871solution for memory leak in 1.7
      1053870JACOB0msg 2019 - Safe Array
      1053866getHResult only returns 80020009
      960646But in SafeArray:: getBoolean for 2D arrays
        
      Patches
      1115187EventCallbacks fail w/Variant ClassNotFoundException in JWS
      1105915Fix for event handling memory corruption
      1090104Weak Reference in teh ROT
      1068544in/out parameter support for event handlers
      981540jre 1.4.2 fix as patch
        
      Feature Requests
      1049390static Version information
      1049224Javadocs or at least script to generate it
      1049158API to get ProgId of ActiveXComponent
        
      - -
    • - -
    - -

    JACOB 1.8

    -

    What's New

    -
      - -
    • -Move To SourceForge -The project is not housed at -Sourceforge.net. -
    • - -
    • -Licensing Change -All limitations on commercial use of JACOB have been removed and it -is now being developed under a BSD license at -Sourceforge.net. -
    • - -
    • -Compiled with Java 1.4.2 -Version 1.8 was compiled with JSEE 1.4.2 and fixes the compilation bug -that was remnant of compilation with JDK 1.1. -
    • - -
    • -Baseline For Change -This version is the baseline for the first CVS checkin and we encourage -people to start contributing to the project with this version. -
    • - -
    - -
  • -

    JACOB 1.7

    -

    What's New

    -
      - -
    • -Explicit COM Threading Model Support: -See a detailed discussion of -COM Apartments in JACOB -
    • - -
    • -New COM Object Lifetime model: -See a detailed discussion of -COM Object Lifetime in JACOB. -
    • - -
    • -Improved Event Handling: -Thanks to code contributed by - -Niels Olof Bouvin -and Henning Jae JACOB 1.7 can -read the type information of a Connection Point interface by looking -it up in the registry. This makes it possible to use events with IE as -well as office products. -
    • - - -
    • -Improved Dispatch: -Error messages from Invoke failures are now printed out as well as -allowing the passing in of arguments to a Get method. -
    • - -
    • -EnumVariant Implementation: -Makes it easier to iterate over COM collections. Thanks to code -contributed by -Thomas Hallgren. -
    • - -
    • -SafeArray leaks: -SafeArrays were not being properly freed prior to version 1.7, many -other memory leaks were fixed as well. -
    • - -
    • -Visual Studio Project: -For those who want to debug: vstudio/JACOB. At the moment all the -native code is replicated there from the jni directory... -
    • - -
    -

    Related Links

    -
      -
    • -The best way to get support or the latest version of JACOB is on - -http://sourceforge.net/projects/jacob-project -This is the preferred way to get support for JACOB. It also -includes an extensive archive. If you are doing any development with -JACOB, please join sourceforge. -
    • -Massimiliano Bigatti has developed - -JACOBgen - a generator that automatically creates JACOB code from -Type Libraries, now available on sourceforge -
    • -
    • -Steven Lewis is developing a version of Java2Com that supports JACOB -code generation. See: - -http://www.lordjoe.com/Java2Com/index.html. -
    • -To find documentation on the com.ms.com package, go to: - -http://www.microsoft.com/java/download/dl_sdk40.htm -and at the bottom of the page is a link that says: -Microsoft SDK for Java 4.0 Documentation Only. You should download -that file and install it. Then, view sdkdocs.chm and look for -"Microsoft Packages Reference". Hopefully, the next release of -JACOB will include full javadoc (volunteers?)...
    • - - - \ No newline at end of file diff --git a/docs/UsingJacob.html b/docs/UsingJacob.html deleted file mode 100644 index 0171a68..0000000 --- a/docs/UsingJacob.html +++ /dev/null @@ -1,263 +0,0 @@ - - -Jacob is a Java library that lets Java applications communicate with Microsoft Windows -DLLs or COM libraries. It does this through the use of a custom DLL that the Jacob -Java classes communicate with via JNI. The library and dll isolate the Java developer -from the underlying windows libraries so that the Java developer does not have to write -custom JNI code. -

      -Jacob is not used for creating ActiveX plugins or other modules that -live inside of Microsoft Windows applications. -


      - -

      The Jacob Packages

      -

      -The JACOB jar contains two main packages: the com.jacob.com.*> package and -the com.jacob.activeX package. The com.jacob.com.* package contains classes -map very closely to the com dispatch model with the com.jacob.com.Dispatch -acting as the primary communication class. Dispatch operate as a function library with -a set of static methods that map very closely to the C++ Dispatch APIs provided -to the COM layer. -

      com.jacob.activex.ActiveXComponent can be used in place of Dispatch -to provide a more object like API. -The only exception to this guideline is that the ActiveXComponent class is always -used to make the initial connection to the target dll/COM component. - - -


      -

      Considerations when doing server side automation of office

      -

      -Most office and many windows client type applications are not written to be used -in high volume or multi-threaded server environment. There is a - -support note -on the Microsoft web site that discusses some of the issues. -

      -


      -

      Determining the API of the target application

      -

      -Section not yet written. -

      -


      -

      The Jacob DLL

      -

      -Jacob.jar relies on a DLL file that it loads off of the library path or classpath. -This means that you must either copy the appropriate jacob ddll into your path or -use VM options to add directory holding jacob dll to the path. Prior to 1.14M6, -the jacob DLL name was always "jacob.dll". This made it hard to verify jacob -was loading the correct dll when multiple copies of jacob were installed on a -single system. It also was confusing on 64 bit systems where the 32 bit and 64 bit -dlls have the same tames. -Starting in 1.14M6, Jacob's library -loader selects a dll with the appropriate name based on the jacob release and platform. -The dll naming convention is:
      -jacob<platform>.<version.>.dll -

      -

      Classloader issues

      -The code is written so that the jacob.dll is only loaded one time per classloader. -This works fine in the standard application but can cause problems if jacob.jar -is loaded from more than one class loader. This can happen in the situation where multiple -jacob dependent web applications run in the same container like a web server or JWS runtime. -In the case of a web server, Jacob is normally put in the application specific WEB-INF/lib directory. -This is the "right" way to do it and works in most situations. -But, if Jacob is put in the WEB-INF/lib directory of each application's war file for more than -one application then a problem occurs. -In this situation, the web server uses a different classloader for each application. -This means that each application will attempt to load the jacob.dll and errors -are generated. The only way around this at this time (1.11) is to put the jacob.jar -in the common/lib because that classloader is inherited by all of the applications -so the DLLs will only get loaded once. This problem is described in SF 1645463 and -should be fixed in some future release, fix method and time not yet determined. -

      -


      -

      Microsoft Visual C++ library dependencies.

      -

      - Jacob 1.15 is build with VC++ 2005 statically linked into the DLL. This - removes the need for a separate msvcr80.dll installation. -

      -

      - Jacob 1.13 is built with VC++ 2005 that creates a dependency on msvcr80.dll. - Windows XP and later seem to already include the necessary components. - NT/2000 and Server/2003 require that you download the Visual C 2005 redistributable - package, vcredist_x86.exe from the Microsoft web site. - Microsoft has a download available that supplies the necessary components. - It is distributed as a redistributable package. -

      -

      -If you see the following message then you probably don't have the right C++ libraries. -

      -
      -Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\apps\...\jacob.dll: This application has 
      -failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem 
      -
      -
      -
      -Visual C redistributable installer SP1
      -
      - -

      -
      -

      Jacob Command Line Settings

      -This library supports several different command line options: - - - - - - - - - - - - - - - - - - -
      -

      dll path location and dll name customization

      -
          -

      java.library.path

      -
      - Standard Java property used to add the location of the jacob dll to the JVM's library path. - (Added 1.11) -

      - Example: -Djava.library.path=d:/jacob/release/x86 -

          -

      jacob.dll.name

      -
      - Override the standard DLL name with a custom one. This stops jacob from - using its 32bit/64bit detection and dll rendezvous logic. - Sometimes used when - Jacob is bundled with another application and the application wishes - to tie the jacob dll version number to the application version number. - (Added 1.14M7) -

      - Example: -Djacob.dll.name=MyFunkyDllName.dll -

          -

      jacob.dll.name.x86 & jacob.dll.name.x64

      -
      - Override the standard 32 bit DLL name with custom ones. - Sometimes used when - Jacob is bundled with another application and the application wishes - to tie the jacob dll version number to the application version number. - (Added 1.14M7) -

      - Example to override 32 bit dll name: -Djacob.dll.name.x86=MyFunkyDllName-32bit.dll -

      -

      Memory Management

      -
          -

      com.jacob.autogc

      -
      - Determines if automatic garbage collection is enabled. This is the - only way to free up objects created in event callbacks. Automatic garbage collection , - based on Java gc rules, garbage collection can be enabled via the - com.java.autogc command line option. - This feature was added in release 1.9 is not fully debugged. -

      - There are real reasons for managing the - lifetime of JacobObjects on a per thread basis. - Jacob normally manages the the com/Java object lifetime as described in the - JacobComLifetime.html document. - Some users have run into situations where they wish to try and let the Java - GC lifetime manage the lifetime of objects. This seems to usually be tied - to long running threads or to objects created as part of event callbacks. - Code was added to let users try and let the JVM manage the object life cycles - even though the JacobComLifetime.html document - says this is a bad idea. Added 1.9. -

      -

      - This value is cached at startup and cannot be changed on-the-fly via System.setProperty(); -

      - The default value is false -

      - Example: -Dcom.jacob.autogc=false - -

          -

      com.jacob.includeAllClassesInROT

      -
      - Acts as master switch for and <class_name>.PutInROT. - This property determines if the (experimental) PutInROT property is even - checked. It was added in version 1.15 because the property check in - PutInROT brok applets because they are not allowed to check system properties - at run time. com.jacob.includeAllClassesInROT is checked at class initialization - which is allowed. -

      The default value of this flag is true which matches all behavior - prior to 1.13 and the default behavior for 1.13 on

      -

      Setting this flag to false causes Jacob to check the and <class_name>.PutInROT - property for every Jacob object that is created.

      -
          -

      <class_name>.PutInROT

      -
      - Lets a program specify that instances of certain classes are to not be inserted - into the ROT. This experimental (1.13) feature provides a mechanism for freeing - VariantViaEvent objects that are created in Event threads. There is normally no - way to free those objects because the thread terminates outside of any normally MTA/STA - Startup/Teardown code. Each event occurs in a new thread and creates a new ROT entry - so they grow without bounds. -

      - This option may cause VM crashes in certain situations where windows memory is freed - outside of the thread it was created in but empirical evidence shows there are - situations where this great reduces the long running memory footprint of applications - that process a lot of events. This function is still experimental. - The functionality was added 1.13. Some of this overlaps the experimental com.jacob.autogc introduced - in 1.9. - See the ROT.java test program for an example of the effects of this option. -

      - This value is checked every time and can be changed on-the-fly via System.setProperty(); -

      - - Example: System.setProperty("com.jacob.com.VariantViaVariant.PutInROT","false"); -
      - Example: -Dcom.jacob.com.VariantViaVariant.PutInROT=false -

      -

      Debugging and Troubleshooting

      -
          -

      com.jacob.debug

      -
      - Determines if debug output is enabled to standard out. -

      - This value is cached at startup and cannot be changed on-the-fly via System.setProperty(); -

      - The default value is false -

      - - Example: -Dcom.jacob.debug=false -

          - -

      -XCheck:jni

      -
      - This turns on additional JVM checking for JNI issues. This is - not an actual JACOB system property but a property used by the JVM. -

      - The default is "no additional checking" - Example: -XCheck:jni -

      - -

      -
      -

      Finding the DLL version using windows command line

      -The jacob.dll file includes the jacob release number in the version field. -Run the following from the command prompt dumpbin /version jacob.dll . -The dll version number is stored in the "image version" field of the -"OPTIONAL HEADER VALUES" section. -This information from -The Microsoft msdn web site - -
      -

      Unit Tests

      -Jacob must know the location of the DLL when running the unit tests in Eclipse. -The simplest way to do this is to add the dll path to the unit as a VM argument. -The argument should be specified based on where you installed the jacob source package. -If you have jacob unpacked in c:/dev/jacob and built using build.xml, -then the vm arguments would be: -
      -Djava.library.path=c:/dev/jacob/release/x86 . - -

      -Last Modified 4/2008 1.15 - - - \ No newline at end of file diff --git a/jni/.cvsignore b/jni/.cvsignore deleted file mode 100644 index 34bec88..0000000 --- a/jni/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -jacob.dll -jacob.lib -jacob.exp - diff --git a/jni/ComThread.cpp b/jni/ComThread.cpp deleted file mode 100644 index 4c1b710..0000000 --- a/jni/ComThread.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "stdafx.h" -#include -#include "ComThread.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include "util.h" - -extern "C" -{ - -JNIEXPORT void JNICALL Java_com_jacob_com_ComThread_doCoInitialize - (JNIEnv *env, jclass cls, jint mode) -{ - int threadModel = mode; - CoInitializeEx(NULL, threadModel); -} - -JNIEXPORT void JNICALL Java_com_jacob_com_ComThread_doCoUninitialize - (JNIEnv *env, jclass cls) -{ - CoUninitialize(); -} - -} diff --git a/jni/ComThread.h b/jni/ComThread.h deleted file mode 100644 index a601c2d..0000000 --- a/jni/ComThread.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -/* Header for class com_jacob_com_ComThread */ - -#ifndef _Included_com_jacob_com_ComThread -#define _Included_com_jacob_com_ComThread -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: com_jacob_com_ComThread - * Method: doCoInitialize - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_ComThread_doCoInitialize - (JNIEnv *, jclass, jint); - -/* - * Class: com_jacob_com_ComThread - * Method: doCoUninitialize - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_ComThread_doCoUninitialize - (JNIEnv *, jclass); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/jni/Dispatch.cpp b/jni/Dispatch.cpp deleted file mode 100644 index 81868e6..0000000 --- a/jni/Dispatch.cpp +++ /dev/null @@ -1,560 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "stdafx.h" -#include -#include "Dispatch.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include "util.h" - -extern "C" -{ - -#define DISP_FLD "m_pDispatch" - -// extract a IDispatch from a jobject -IDispatch *extractDispatch(JNIEnv *env, jobject arg) -{ - jclass argClass = env->GetObjectClass(arg); - jfieldID ajf = env->GetFieldID( argClass, DISP_FLD, "I"); - jint anum = env->GetIntField(arg, ajf); - IDispatch *v = (IDispatch *)anum; - return v; -} - -/** - * This method finds an interface rooted on the passed in dispatch object. - * This creates a new Dispatch object so it is NOT reliable - * in the event callback thread of a JWS client where the root class loader - * does not have com.jacob.com.Dispatch in its classpath - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface - (JNIEnv *env, jobject _this, jstring _iid) -{ - // get the current IDispatch - IDispatch *pIDispatch = extractDispatch(env, _this); - if (!pIDispatch) return NULL; - // if we used env->GetStringChars() would that let us drop the conversion? - const char *siid = env->GetStringUTFChars(_iid, NULL); - USES_CONVERSION; - LPOLESTR bsIID = A2W(siid); - env->ReleaseStringUTFChars(_iid, siid); - IID iid; - HRESULT hr = IIDFromString(bsIID, &iid); - if (FAILED(hr)) { - ThrowComFail(env, "Can't get IID from String", hr); - return NULL; - } - - // try to call QI on the passed IID - IDispatch *disp; - hr = pIDispatch->QueryInterface(iid, (void **)&disp); - if (FAILED(hr)) { - ThrowComFail(env, "QI on IID from String Failed", hr); - return NULL; - } - - jclass autoClass = env->FindClass("com/jacob/com/Dispatch"); - jmethodID autoCons = env->GetMethodID(autoClass, "", "(I)V"); - // construct a Dispatch object to return - // I am copying the pointer to java - // jacob-msg 1817 - SF 1053871 : QueryInterface already called AddRef!! - //if (disp) disp->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, disp); - return newAuto; -} - -/** - * starts up a new instance of the requested program (progId) - * and connects to it. does special code if the progid - * is of the alternate format (with ":") - **/ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_createInstanceNative - (JNIEnv *env, jobject _this, jstring _progid) -{ - jclass clazz = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); - - // if we used env->GetStringChars() would that let us drop the conversion? - const char *progid = env->GetStringUTFChars(_progid, NULL); - CLSID clsid; - HRESULT hr; - IUnknown *punk = NULL; - IDispatch *pIDispatch; - USES_CONVERSION; - LPOLESTR bsProgId = A2W(progid); - if (strchr(progid,':')) - { - env->ReleaseStringUTFChars(_progid, progid); - // it's a moniker - hr = CoGetObject(bsProgId, NULL, IID_IUnknown, (LPVOID *)&punk); - if (FAILED(hr)) { - ThrowComFail(env, "Can't find moniker", hr); - return; - } - IClassFactory *pIClass; - // if it was a clsid moniker, I may have a class factory - hr = punk->QueryInterface(IID_IClassFactory, (void **)&pIClass); - if (!SUCCEEDED(hr)) goto doDisp; - punk->Release(); - // try to create an instance - hr = pIClass->CreateInstance(NULL, IID_IUnknown, (void **)&punk); - if (FAILED(hr)) { - ThrowComFail(env, "Can't create moniker class instance", hr); - return; - } - pIClass->Release(); - goto doDisp; - } - env->ReleaseStringUTFChars(_progid, progid); - // Now, try to find an IDispatch interface for progid - hr = CLSIDFromProgID(bsProgId, &clsid); - if (FAILED(hr)) { - ThrowComFail(env, "Can't get object clsid from progid", hr); - return; - } - // standard creation - hr = CoCreateInstance(clsid,NULL,CLSCTX_LOCAL_SERVER|CLSCTX_INPROC_SERVER,IID_IUnknown, (void **)&punk); - if (!SUCCEEDED(hr)) { - ThrowComFail(env, "Can't co-create object", hr); - return; - } -doDisp: - - // now get an IDispatch pointer from the IUnknown - hr = punk->QueryInterface(IID_IDispatch, (void **)&pIDispatch); - if (!SUCCEEDED(hr)) { - ThrowComFail(env, "Can't QI object for IDispatch", hr); - return; - } - // CoCreateInstance called AddRef - punk->Release(); - env->SetIntField(_this, jf, (unsigned int)pIDispatch); -} - -/** - * attempts to connect to an running instance of the requested program - * This exists solely for the factory method connectToActiveInstance. - **/ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_getActiveInstanceNative - (JNIEnv *env, jobject _this, jstring _progid) -{ - jclass clazz = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); - - // if we used env->GetStringChars() would that let us drop the conversion? - const char *progid = env->GetStringUTFChars(_progid, NULL); - CLSID clsid; - HRESULT hr; - IUnknown *punk = NULL; - IDispatch *pIDispatch; - USES_CONVERSION; - LPOLESTR bsProgId = A2W(progid); - env->ReleaseStringUTFChars(_progid, progid); - // Now, try to find an IDispatch interface for progid - hr = CLSIDFromProgID(bsProgId, &clsid); - if (FAILED(hr)) { - ThrowComFail(env, "Can't get object clsid from progid", hr); - return; - } - // standard connection - //printf("trying to connect to running %ls\n",bsProgId); - hr = GetActiveObject(clsid,NULL, &punk); - if (!SUCCEEDED(hr)) { - ThrowComFail(env, "Can't get active object", hr); - return; - } - // now get an IDispatch pointer from the IUnknown - hr = punk->QueryInterface(IID_IDispatch, (void **)&pIDispatch); - if (!SUCCEEDED(hr)) { - ThrowComFail(env, "Can't QI object for IDispatch", hr); - return; - } - // GetActiveObject called AddRef - punk->Release(); - env->SetIntField(_this, jf, (unsigned int)pIDispatch); -} - -/** - * starts up a new instance of the requested program (progId). - * This exists solely for the factory method connectToActiveInstance. - **/ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_coCreateInstanceNative - (JNIEnv *env, jobject _this, jstring _progid) -{ - jclass clazz = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); - - // if we used env->GetStringChars() would that let us drop the conversion? - const char *progid = env->GetStringUTFChars(_progid, NULL); - CLSID clsid; - HRESULT hr; - IUnknown *punk = NULL; - IDispatch *pIDispatch; - USES_CONVERSION; - LPOLESTR bsProgId = A2W(progid); - env->ReleaseStringUTFChars(_progid, progid); - // Now, try to find an IDispatch interface for progid - hr = CLSIDFromProgID(bsProgId, &clsid); - if (FAILED(hr)) { - ThrowComFail(env, "Can't get object clsid from progid", hr); - return; - } - // standard creation - hr = CoCreateInstance(clsid,NULL,CLSCTX_LOCAL_SERVER|CLSCTX_INPROC_SERVER,IID_IUnknown, (void **)&punk); - if (!SUCCEEDED(hr)) { - ThrowComFail(env, "Can't co-create object", hr); - return; - } - // now get an IDispatch pointer from the IUnknown - hr = punk->QueryInterface(IID_IDispatch, (void **)&pIDispatch); - if (!SUCCEEDED(hr)) { - ThrowComFail(env, "Can't QI object for IDispatch", hr); - return; - } - // CoCreateInstance called AddRef - punk->Release(); - env->SetIntField(_this, jf, (unsigned int)pIDispatch); -} - -/** - * release method - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_release - (JNIEnv *env, jobject _this) -{ - jclass clazz = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); - jint num = env->GetIntField(_this, jf); - - IDispatch *disp = (IDispatch *)num; - if (disp) { - disp->Release(); - env->SetIntField(_this, jf, (unsigned int)0); - } -} - -static HRESULT -name2ID(IDispatch *pIDispatch, const char *prop, DISPID *dispid, long lcid) -{ - HRESULT hresult; - USES_CONVERSION; - LPOLESTR propOle = A2W(prop); - hresult = pIDispatch->GetIDsOfNames(IID_NULL,(LPOLESTR*)&propOle,1,lcid,dispid); - return hresult; -} - -JNIEXPORT jintArray JNICALL Java_com_jacob_com_Dispatch_getIDsOfNames - (JNIEnv *env, jclass clazz, jobject disp, jint lcid, jobjectArray names) -{ - IDispatch *pIDispatch = extractDispatch(env, disp); - if (!pIDispatch) return NULL; - - int l = env->GetArrayLength(names); - int i; - LPOLESTR *lps = (LPOLESTR *)CoTaskMemAlloc(l * sizeof(LPOLESTR)); - DISPID *dispid = (DISPID *)CoTaskMemAlloc(l * sizeof(DISPID)); - for(i=0;iGetObjectArrayElement(names, i); - // if we used env->GetStringChars() would that let us drop the conversion? - const char *nm = env->GetStringUTFChars(s, NULL); - LPOLESTR nmos = A2W(nm); - env->ReleaseStringUTFChars(s, nm); - lps[i] = nmos; - env->DeleteLocalRef(s); - } - HRESULT hr = pIDispatch->GetIDsOfNames(IID_NULL,lps,l,lcid,dispid); - if (FAILED(hr)) { - CoTaskMemFree(lps); - CoTaskMemFree(dispid); - char buf[1024]; - strcpy_s(buf, "Can't map names to dispid:"); - for(i=0;iGetObjectArrayElement(names, i); - const char *nm = env->GetStringUTFChars(s, NULL); - strcat_s(buf, nm); - env->ReleaseStringUTFChars(s, nm); - env->DeleteLocalRef(s); - } - ThrowComFail(env, buf, hr); - return NULL; - } - jintArray iarr = env->NewIntArray(l); - // SF 1511033 -- the 2nd parameter should be 0 and not i! - env->SetIntArrayRegion(iarr, 0, l, dispid); - CoTaskMemFree(lps); - CoTaskMemFree(dispid); - return iarr; -} - -static char* BasicToCharString(const BSTR inBasicString) -{ - char* charString = NULL; - const size_t charStrSize = ::SysStringLen(inBasicString) + 1; - if (charStrSize > 1) - { - charString = new char[charStrSize]; - size_t convertedSize; - ::wcstombs_s(&convertedSize, charString, charStrSize, inBasicString, charStrSize); - } - else - { - charString = ::_strdup(""); - } - return charString; -} - -static wchar_t* CreateErrorMsgFromResult(HRESULT inResult) -{ - wchar_t* msg = NULL; - ::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, NULL, inResult,MAKELANGID(LANG_NEUTRAL, - SUBLANG_DEFAULT), (LPWSTR) &msg, 0, NULL); - if (msg == NULL) - { - const wchar_t* message_text = L"An unknown COM error has occured."; - size_t bufferLength = (wcslen(message_text) + 1) * sizeof(wchar_t); - msg = (wchar_t*) ::LocalAlloc(LPTR, bufferLength); - wcscpy_s(msg, bufferLength, message_text); - } - - return msg; -} - -static wchar_t* CreateErrorMsgFromInfo(HRESULT inResult, EXCEPINFO* ioInfo, - const char* methName) -{ - wchar_t* msg = NULL; - size_t methNameWSize = 0; - - mbstowcs_s(&methNameWSize, NULL, 0, methName, _TRUNCATE); - - wchar_t* methNameW = new wchar_t[methNameWSize]; - - mbstowcs_s(NULL, methNameW, methNameWSize, methName, _TRUNCATE); - - // If this is a dispatch exception (triggered by an Invoke message), - // then we have to take some additional steps to process the error - // message. - if (inResult == DISP_E_EXCEPTION) - { - // Check to see if the server deferred filling in the exception - // information. If so, make the call to populate the structure. - if (ioInfo->pfnDeferredFillIn != NULL) - (*(ioInfo->pfnDeferredFillIn))(ioInfo); - - // Build the error message from exception information content. - int sourceLen = SysStringLen(ioInfo->bstrSource); - int descLen = SysStringLen(ioInfo->bstrDescription); - const size_t MSG_LEN = ::wcslen(methNameW) + sourceLen + descLen + 128; - msg = new wchar_t[MSG_LEN]; - ::wcsncpy_s(msg, MSG_LEN, L"Invoke of: ", wcslen(L"Invoke of: ")); - ::wcsncat_s(msg, MSG_LEN, methNameW, wcslen(methNameW)); - ::wcsncat_s(msg, MSG_LEN, L"\nSource: ", wcslen(L"\nSource: ")); - ::wcsncat_s(msg, MSG_LEN, ioInfo->bstrSource, sourceLen); - ::wcsncat_s(msg, MSG_LEN, L"\nDescription: ", wcslen(L"\nDescription: ")); - ::wcsncat_s(msg, MSG_LEN, ioInfo->bstrDescription, descLen); - ::wcsncat_s(msg, MSG_LEN, L"\n", wcslen(L"\n")); - } - else - { - wchar_t* msg2 = CreateErrorMsgFromResult(inResult); - const size_t MSG_LEN = ::wcslen(methNameW) + ::wcslen(msg2) + 256; - msg = new wchar_t[MSG_LEN]; - ::wcsncpy_s(msg, MSG_LEN, - L"A COM exception has been encountered:\nAt Invoke of: ", - wcslen(L"A COM exception has been encountered:\nAt Invoke of: ")); - ::wcsncat_s(msg, MSG_LEN, methNameW, wcslen(methNameW)); - ::wcsncat_s(msg, MSG_LEN, L"\nDescription: ", wcslen(L"\nDescription: ")); - ::wcsncat_s(msg, MSG_LEN, msg2, wcslen(msg2)); - // jacob-msg 1075 - SF 1053872 : Documentation says "use LocalFree"!! - //delete msg2; - LocalFree(msg2); - } - delete methNameW; - return msg; -} - - -#define SETDISPPARAMS(dp, numArgs, pvArgs, numNamed, pNamed) \ - {\ - (dp).cArgs = numArgs; \ - (dp).rgvarg = pvArgs; \ - (dp).cNamedArgs = numNamed; \ - (dp).rgdispidNamedArgs = pNamed; \ - } - -#define SETNOPARAMS(dp) SETDISPPARAMS(dp, 0, NULL, 0, NULL) - -JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_invokev - (JNIEnv *env, jclass clazz, - jobject disp, jstring name, jint dispid, - jint lcid, jint wFlags, jobjectArray vArg, jintArray uArgErr) -{ - DISPPARAMS dispparams; - EXCEPINFO excepInfo; - - IDispatch *pIDispatch = extractDispatch(env, disp); - if (!pIDispatch) return NULL; - - int dispID = dispid; - if (name != NULL) - { - const char *nm = env->GetStringUTFChars(name, NULL); - HRESULT hr; - if (FAILED(hr = name2ID(pIDispatch, nm, (long *)&dispID, lcid))) { - char buf[1024]; - sprintf_s(buf, 1024, "Can't map name to dispid: %s", nm); - ThrowComFail(env, buf, -1); - return NULL; - } - env->ReleaseStringUTFChars(name, nm); - } - - int num_args = env->GetArrayLength(vArg); - int i, j; - VARIANT *varr = NULL; - if (num_args) - { - varr = (VARIANT *)CoTaskMemAlloc(num_args*sizeof(VARIANT)); - /* reverse args for dispatch */ - for(i=num_args-1,j=0;0<=i;i--,j++) - { - VariantInit(&varr[j]); - jobject arg = env->GetObjectArrayElement(vArg, i); - VARIANT *v = extractVariant(env, arg); - // no escape from copy? - VariantCopy(&varr[j], v); - env->DeleteLocalRef(arg); - } - } - // prepare a new return value - jclass variantClass = env->FindClass("com/jacob/com/Variant"); - jmethodID variantCons = - env->GetMethodID(variantClass, "", "()V"); - // construct a variant to return - jobject newVariant = env->NewObject(variantClass, variantCons); - // get the VARIANT from the newVariant - VARIANT *v = extractVariant(env, newVariant); - DISPID dispidPropertyPut = DISPID_PROPERTYPUT; - - // determine how to dispatch - switch (wFlags) - { - case DISPATCH_PROPERTYGET: // GET - case DISPATCH_METHOD: // METHOD - case DISPATCH_METHOD|DISPATCH_PROPERTYGET: - { - SETDISPPARAMS(dispparams, num_args, varr, 0, NULL); - break; - } - case DISPATCH_PROPERTYPUT: - case DISPATCH_PROPERTYPUTREF: // jacob-msg 1075 - SF 1053872 - { - SETDISPPARAMS(dispparams, num_args, varr, 1, &dispidPropertyPut); - break; - } - } - - HRESULT hr = 0; - jint count = env->GetArrayLength(uArgErr); - if ( count != 0 ) - { - jint *uAE = env->GetIntArrayElements(uArgErr, NULL); - hr = pIDispatch->Invoke(dispID,IID_NULL, - lcid,(WORD)wFlags,&dispparams,v,&excepInfo,(unsigned int *)uAE); // SF 1689061 - env->ReleaseIntArrayElements(uArgErr, uAE, 0); - } - else - { - hr = pIDispatch->Invoke(dispID,IID_NULL, - lcid,(WORD)wFlags,&dispparams,v,&excepInfo, NULL); // SF 1689061 - } - if (num_args) - { - // to account for inouts, I need to copy the inputs back to - // the java array after the method returns - // this occurs, for example, in the ADO wrappers - for(i=num_args-1,j=0;0<=i;i--,j++) - { - jobject arg = env->GetObjectArrayElement(vArg, i); - VARIANT *v = extractVariant(env, arg); - // reverse copy - VariantCopy(v, &varr[j]); - // clear out the temporary variant - VariantClear(&varr[j]); - env->DeleteLocalRef(arg); - } - } - - if (varr) CoTaskMemFree(varr); - - // check for error and display a somewhat verbose error message - if (!SUCCEEDED(hr)) { - // two buffers that may have to be freed later - wchar_t *buf = NULL; - char *dispIdAsName = NULL; - // this method can get called with a name or a dispatch id - // we need to handle both SF 1114159 - if (name != NULL){ - const char *nm = env->GetStringUTFChars(name, NULL); - buf = CreateErrorMsgFromInfo(hr, &excepInfo, nm); - env->ReleaseStringUTFChars(name, nm); - } else { - dispIdAsName = new char[256]; - // get the id string - _itoa_s (dispID, dispIdAsName, 256,10); - //continue on mostly as before - buf = CreateErrorMsgFromInfo(hr,&excepInfo,dispIdAsName); - } - - // jacob-msg 3696 - SF 1053866 - if(hr == DISP_E_EXCEPTION) - { - if(excepInfo.scode != 0) - { - hr = excepInfo.scode; - } - else - { - hr = _com_error::WCodeToHRESULT(excepInfo.wCode); - } - } - - ThrowComFailUnicode(env, buf, hr); - if (buf) delete buf; - if (dispIdAsName) delete dispIdAsName; - return NULL; - } - - return newVariant; -} - -} - - diff --git a/jni/Dispatch.h b/jni/Dispatch.h deleted file mode 100644 index 861f22e..0000000 --- a/jni/Dispatch.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -/* Header for class Dispatch */ - -#ifndef _Included_Dispatch -#define _Included_Dispatch -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: com_jacob_com_Dispatch - * Method: QueryInterface - * Signature: (Ljava/lang/String;)Lcom/jacob/com/Dispatch; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface - (JNIEnv *, jobject, jstring); - -/* - * Class: Dispatch - * Method: createInstance - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_createInstanceNative - (JNIEnv *, jobject, jstring); - -/* - * Class: Dispatch - * Method: getActiveInstance - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_getActiveInstanceNative - (JNIEnv *, jobject, jstring); - -/* - * Class: Dispatch - * Method: coCreateInstance - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_coCreateInstanceNative - (JNIEnv *, jobject, jstring); - -/* - * Class: Dispatch - * Method: release - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_release - (JNIEnv *, jobject); - -/* - * Class: Dispatch - * Method: getIDsOfNames - * Signature: (Ljava/lang/Object;I[Ljava/lang/String;)[I - */ -JNIEXPORT jintArray JNICALL Java_com_jacob_com_Dispatch_getIDsOfNames - (JNIEnv *, jclass, jobject, jint, jobjectArray); - -/* - * Class: Dispatch - * Method: invokev - * Signature: (Ljava/lang/Object;Ljava/lang/String;III[LVariant;[I)LVariant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_invokev - (JNIEnv *, jclass, jobject, jstring, jint, jint, jint, jobjectArray, jintArray); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/jni/DispatchEvents.cpp b/jni/DispatchEvents.cpp deleted file mode 100644 index 082a041..0000000 --- a/jni/DispatchEvents.cpp +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "DispatchEvents.h" -#include "EventProxy.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include - -#include "util.h" - -extern "C" -{ - -#define PROXY_FLD "m_pConnPtProxy" - -// defined below -BOOL GetEventIID(IUnknown*, IID*, CComBSTR **, DISPID **, int *,LPOLESTR); -BOOL GetEventIIDForTypeLib(BSTR, IID*, CComBSTR **, DISPID **, int *,LPOLESTR); -BOOL getClassInfoFromProgId(LPOLESTR bsProgId,LPTYPEINFO *pClassInfo); -BOOL MapEventIIDs(IID*, CComBSTR **, DISPID **, int *, LPOLESTR , LPTYPEINFO ); - -// extract a EventProxy* from a jobject -EventProxy *extractProxy(JNIEnv *env, jobject arg) -{ - jclass argClass = env->GetObjectClass(arg); - jfieldID ajf = env->GetFieldID( argClass, PROXY_FLD, "I"); - jint anum = env->GetIntField(arg, ajf); - EventProxy *v = (EventProxy *)anum; - return v; -} - -/* - * pushes the EventProxy (*ep) into tje jobject in the PROXY_FLD location - */ -void putProxy(JNIEnv *env, jobject arg, EventProxy *ep) -{ - jclass argClass = env->GetObjectClass(arg); - jfieldID ajf = env->GetFieldID( argClass, PROXY_FLD, "I"); - jint anum = env->GetIntField(arg, ajf); - env->SetIntField(arg, ajf, (jint)ep); -} - - -/* - * Class: com_jacob_com_DispatchEvents - * Method: init3 - * Signature: (Lcom/jacob/com/Dispatch;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init3 - (JNIEnv *env, - jobject _this, jobject src, - jobject sink, - jstring _progid, - jstring _typelib) -{ - USES_CONVERSION; - - if (_typelib != NULL && _progid == NULL){ - // both are required if typelib exists - ThrowComFail(env,"TypeLib was specified but no program id was",-1); - return; - } - - BSTR typeLib = NULL; - if (_typelib != NULL){ - // why is this UTF instead of unicode? Then we could probably drop the A2W - const char *typelib = env->GetStringUTFChars(_typelib, NULL); - typeLib = A2W(typelib); - // should we call env->ReleaseStringUTFChars(,) to free the memory like we do everywhere lese? - - //printf("we have a type lib %ls\n",typeLib); - } - - // find progid if any - LPOLESTR bsProgId = NULL; - if (_progid!=NULL) { - // why is this UTF instead of unicode? Then we could probably drop the A2W - const char *progid = env->GetStringUTFChars(_progid, NULL); - bsProgId = A2W(progid); - // should we call env->ReleaseStringUTFChars(,) to free the memory like we do everywhere lese? - //printf("we have an applicaton %ls\n",bsProgId); - } - - // get the IDispatch for the source object - IDispatch *pDisp = extractDispatch(env, src); - CComQIPtr pUnk(pDisp); - // see if it implements connection points - CComQIPtr pCPC(pUnk); - if (!pCPC) - { - // no events, throw something - ThrowComFail(env, "Can't find IConnectionPointContainer", -1); - return; - } - - IID eventIID; - CComBSTR *mNames; - DISPID *mIDs; - int n_EventMethods; - if (_typelib == NULL){ - if (!GetEventIID(pUnk, &eventIID, &mNames, &mIDs, &n_EventMethods,bsProgId)) { - ThrowComFail(env, "Can't find event iid", -1); - return; - } - } else { - if (!GetEventIIDForTypeLib(typeLib, &eventIID, &mNames, &mIDs, &n_EventMethods,bsProgId)) { - ThrowComFail(env, "Can't find event iid for type lib", -1); - return; - } - } - - // hook up to the default source iid - CComPtr pCP; - HRESULT hr = pCPC->FindConnectionPoint(eventIID, &pCP); - if (SUCCEEDED(hr)) - { - EventProxy *ep = new EventProxy(env, sink, pCP, eventIID, mNames, mIDs, n_EventMethods); - // need to store ep on _this, in case it gets collected - putProxy(env, _this, ep); - } else { - ThrowComFail(env, "Can't FindConnectionPoint", hr); - } -} - -/* - * Class: DispatchEvents - * Method: release - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_release - (JNIEnv *env, jobject _this) -{ - EventProxy *ep = extractProxy(env, _this); - if (ep) { - // this is the line that blows up in IETest - ep->Release(); - putProxy(env, _this, NULL); - } -} - -/* - * I need a reverse map from the event interface's dispids to - * function names so that we can reflect them to java - */ -void -LoadNameCache(LPTYPEINFO pTypeInfo, LPTYPEATTR pta, - CComBSTR **mNames, DISPID **mIDs, int *nmeth) -{ - CComBSTR *names = NULL; - DISPID *ids = NULL; - int m_nCount; - - m_nCount = pta->cFuncs; - *nmeth = m_nCount; - names = m_nCount == 0 ? NULL : new CComBSTR[m_nCount]; - ids = m_nCount == 0 ? NULL : new DISPID[m_nCount]; - for (int i=0; iGetFuncDesc(i, &pfd))) - { - CComBSTR bstrName; - if (SUCCEEDED(pTypeInfo->GetDocumentation(pfd->memid, &bstrName, NULL, NULL, NULL))) - { - names[i].Attach(bstrName.Detach()); - ids[i] = pfd->memid; - /* - USES_CONVERSION; - printf("map:%d -> %s\n", ids[i], W2A((OLECHAR *)names[i])); - */ - } - pTypeInfo->ReleaseFuncDesc(pfd); - } - } - *mNames = names; - *mIDs = ids; -} - -#define IMPLTYPE_MASK \ - (IMPLTYPEFLAG_FDEFAULT | IMPLTYPEFLAG_FSOURCE | IMPLTYPEFLAG_FRESTRICTED) - -#define IMPLTYPE_DEFAULTSOURCE \ - (IMPLTYPEFLAG_FDEFAULT | IMPLTYPEFLAG_FSOURCE) - -BOOL GetEventIID(IUnknown *m_pObject, IID* piid, - CComBSTR **mNames, DISPID **mIDs, int *nmeth,LPOLESTR bsProgId) -{ - *piid = GUID_NULL; - ATLASSERT(m_pObject != NULL); - // I Always use IProvideClassInfo rather than IProvideClassInfo2 - // since I also need to create a mapping from dispid to name - LPPROVIDECLASSINFO pPCI = NULL; - LPTYPEINFO pClassInfo = NULL; - if (SUCCEEDED(m_pObject->QueryInterface(IID_IProvideClassInfo, (LPVOID*)&pPCI))) - { - //printf("got IProvideClassInfo\n"); - ATLASSERT(pPCI != NULL); - HRESULT hr = pPCI->GetClassInfo(&pClassInfo); - pPCI->Release(); - if (!SUCCEEDED(hr)) return false; - } - else if (getClassInfoFromProgId(bsProgId,&pClassInfo)) { - } - else { - printf("GetEventIID: couldn't get IProvideClassInfo\n"); - return false; - } - - return MapEventIIDs(piid, mNames, mIDs, nmeth, bsProgId, pClassInfo); -} - -BOOL MapEventIIDs(IID* piid, - CComBSTR **mNames, DISPID **mIDs, int *nmeth, LPOLESTR bsProgId, LPTYPEINFO pClassInfo) -{ - ATLASSERT(pClassInfo != NULL); - //printf("MapEventIIDs: got past ClassInfo assert\n"); - LPTYPEATTR pClassAttr; - if (SUCCEEDED(pClassInfo->GetTypeAttr(&pClassAttr))) - { - //printf("MapEventIIDs: got TypeAttr\n"); - ATLASSERT(pClassAttr != NULL); - ATLASSERT(pClassAttr->typekind == TKIND_COCLASS); - - // Search for typeinfo of the default events interface. - int nFlags; - HREFTYPE hRefType; - - //printf("MapEventIIDs: looking at %d class attribute impl types \n"); - for (unsigned int i = 0; i < pClassAttr->cImplTypes; i++) - { - if (SUCCEEDED(pClassInfo->GetImplTypeFlags(i, &nFlags)) && - ((nFlags & IMPLTYPE_MASK) == IMPLTYPE_DEFAULTSOURCE)) - { - // Found it. Now look at its attributes to get IID. - LPTYPEINFO pEventInfo = NULL; - if (SUCCEEDED(pClassInfo->GetRefTypeOfImplType(i, - &hRefType)) && - SUCCEEDED(pClassInfo->GetRefTypeInfo(hRefType, - &pEventInfo))) - { - ATLASSERT(pEventInfo != NULL); - LPTYPEATTR pEventAttr; - if (SUCCEEDED(pEventInfo->GetTypeAttr(&pEventAttr))) - { - ATLASSERT(pEventAttr != NULL); - - // create a mapping from dispid to string - LoadNameCache(pEventInfo, pEventAttr, - mNames, mIDs, nmeth); - - *piid = pEventAttr->guid; - pEventInfo->ReleaseTypeAttr(pEventAttr); - } - pEventInfo->Release(); - } - break; - } - } - pClassInfo->ReleaseTypeAttr(pClassAttr); - } - pClassInfo->Release(); - - return (!IsEqualIID(*piid, GUID_NULL)); -} - -BOOL getClassInfoFromProgId(LPOLESTR bsProgId,LPTYPEINFO *pClassInfo) -{ - USES_CONVERSION; - CLSID clsid; - GUID libid; - if (FAILED(CLSIDFromProgID(bsProgId, &clsid))) return false; - if (FAILED(StringFromCLSID(clsid,&bsProgId))) return false; - HKEY keySoftware, keyClasses, keyCLSID, keyXXXX, keyTypeLib; - DWORD dwType, dwCountData=50; - BYTE abData[50]; - LONG lVal; - lVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE"),0,KEY_READ,&keySoftware); - if (lVal==ERROR_SUCCESS) { - lVal = RegOpenKeyEx(keySoftware,_T("Classes"),0,KEY_READ,&keyClasses); - if (lVal==ERROR_SUCCESS) { - lVal = RegOpenKeyEx(keyClasses,_T("CLSID"),0,KEY_READ,&keyCLSID); - if (lVal==ERROR_SUCCESS) { - _TCHAR *tsProgId = W2T(bsProgId); - lVal = RegOpenKeyEx(keyCLSID,tsProgId,0,KEY_READ,&keyXXXX); - if (lVal==ERROR_SUCCESS) { - lVal = RegOpenKeyEx(keyXXXX,_T("TypeLib"),0,KEY_READ,&keyTypeLib); - if (lVal==ERROR_SUCCESS) { - lVal = RegQueryValueExA(keyTypeLib,NULL,NULL,&dwType,abData,&dwCountData); - RegCloseKey(keyTypeLib); - } - RegCloseKey(keyXXXX); - } - RegCloseKey(keyCLSID); - } - RegCloseKey(keyClasses); - } - RegCloseKey(keySoftware); - } - if (lVal!=ERROR_SUCCESS) return false; - BSTR bsLibId = A2BSTR((char*)abData); - if (FAILED(CLSIDFromString(bsLibId,&libid))) return false; - //Try loading from registry information. - ITypeLib* pITypeLib; - if (FAILED(LoadRegTypeLib(libid,1,0, LANG_NEUTRAL, &pITypeLib))) return false; - //Find ITypeInfo for coclass. - pITypeLib->GetTypeInfoOfGuid(clsid, pClassInfo); - pITypeLib->Release(); - return true; -} - -/* - * Get the class info from the progId using the given typeLib. - */ -BOOL getClassInfoFromProgIdTypeLib(BSTR typeLib, LPOLESTR bsProgId, LPTYPEINFO *pClassInfo) -{ - USES_CONVERSION; - CLSID clsid; - - if (FAILED(CLSIDFromProgID(bsProgId, &clsid))) return false; - if (FAILED(StringFromCLSID(clsid,&bsProgId))) return false; - - ITypeLib* pITypeLib; - if (FAILED(LoadTypeLib(typeLib, &pITypeLib))) return false; - - //Find ITypeInfo for coclass. - pITypeLib->GetTypeInfoOfGuid(clsid, pClassInfo); - pITypeLib->Release(); - return true; -} - -BOOL GetEventIIDForTypeLib(BSTR typeLib, IID* piid, - CComBSTR **mNames, DISPID **mIDs, int *nmeth,LPOLESTR bsProgId) -{ - LPTYPEINFO pClassInfo = NULL; - if(getClassInfoFromProgIdTypeLib(typeLib, bsProgId,&pClassInfo)) - { - if (pClassInfo == NULL){ - printf("we had a successful return but pClassInfo is null\n"); - } - return MapEventIIDs(piid, mNames, mIDs, nmeth, bsProgId, pClassInfo); - } - else - { - printf("GetEventIIDForTypeLib: couldn't get IProvideClassInfo\n"); - return false; - } -} - -} diff --git a/jni/DispatchEvents.h b/jni/DispatchEvents.h deleted file mode 100644 index ce02ea5..0000000 --- a/jni/DispatchEvents.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -/* Header for class DispatchEvents */ - -#ifndef _Included_DispatchEvents -#define _Included_DispatchEvents -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Class: com_jacob_com_DispatchEvents - * Method: init3 - * Signature: (Lcom/jacob/com/Dispatch;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_init3 - (JNIEnv *, jobject, jobject, jobject, jstring, jstring); - -/* - * Class: DispatchEvents - * Method: release - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_release - (JNIEnv *, jobject); - -#ifdef __cplusplus -} -#endif -#endif - - diff --git a/jni/DispatchProxy.cpp b/jni/DispatchProxy.cpp deleted file mode 100644 index 7c5007a..0000000 --- a/jni/DispatchProxy.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "stdafx.h" -#include -#include "ComThread.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include "util.h" - -extern "C" -{ - -// extract a IStream from a jobject -IStream *extractStream(JNIEnv *env, jobject arg) -{ - jclass argClass = env->GetObjectClass(arg); - jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); - jint anum = env->GetIntField(arg, ajf); - IStream *v = (IStream *)anum; - return v; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchProxy_MarshalIntoStream - (JNIEnv *env, jobject _this, jobject disp) -{ - IDispatch *pIDispatch = extractDispatch(env, disp); - if (!pIDispatch) return; - IStream *ps; // this is the stream we will marshall into - HRESULT hr = CoMarshalInterThreadInterfaceInStream( - IID_IDispatch, pIDispatch, &ps); - if (!SUCCEEDED(hr)) - { - ThrowComFail(env, "Could not Marshal Dispatch into IStream", hr); - return; - } - // store the stream pointer on the object - jclass argClass = env->GetObjectClass(_this); - jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); - env->SetIntField(_this, ajf, (jint)ps); -} - -JNIEXPORT jobject JNICALL Java_com_jacob_com_DispatchProxy_MarshalFromStream - (JNIEnv *env, jobject _this) -{ - IStream *ps = extractStream(env, _this); - if (!ps) - { - ThrowComFail(env, "Could not get IStream from DispatchProxy", -1); - return NULL; - } - IDispatch *pD; - HRESULT hr = CoGetInterfaceAndReleaseStream(ps, IID_IDispatch, (void **)&pD); - // zero out the stream pointer on the object - // since the stream can only be read once - jclass argClass = env->GetObjectClass(_this); - jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); - env->SetIntField(_this, ajf, (unsigned int)0); - - if (!SUCCEEDED(hr)) - { - ThrowComFail(env, "Could not Marshal Dispatch from IStream", hr); - return NULL; - } - jclass autoClass = env->FindClass("com/jacob/com/Dispatch"); - jmethodID autoCons = env->GetMethodID(autoClass, "", "(I)V"); - // construct a Dispatch object to return - // I am copying the pointer to java - if (pD) pD->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, pD); - return newAuto; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchProxy_release - (JNIEnv *env, jobject _this) -{ - IStream *ps = extractStream(env, _this); - if (ps) { - ps->Release(); - jclass argClass = env->GetObjectClass(_this); - jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); - env->SetIntField(_this, ajf, (unsigned int)0); - } -} - -} diff --git a/jni/DispatchProxy.h b/jni/DispatchProxy.h deleted file mode 100644 index 65a2c22..0000000 --- a/jni/DispatchProxy.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -/* Header for class com_jacob_com_DispatchProxy */ - -#ifndef _Included_com_jacob_com_DispatchProxy -#define _Included_com_jacob_com_DispatchProxy -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: com_jacob_com_DispatchProxy - * Method: MarshalIntoStream - * Signature: (Lcom/jacob/com/Dispatch;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchProxy_MarshalIntoStream - (JNIEnv *, jobject, jobject); - -/* - * Class: com_jacob_com_DispatchProxy - * Method: MarshalFromStream - * Signature: ()Lcom/jacob/com/Dispatch; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_DispatchProxy_MarshalFromStream - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_DispatchProxy - * Method: release - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_DispatchProxy_release - (JNIEnv *, jobject); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/jni/EnumVariant.cpp b/jni/EnumVariant.cpp deleted file mode 100644 index 25fb226..0000000 --- a/jni/EnumVariant.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "stdafx.h" -#include -#include "Dispatch.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include "util.h" - -/** - * An implementation of IEnumVariant based on code submitted by - * Thomas Hallgren (mailto:Thomas.Hallgren@eoncompany.com) - */ -extern "C" -{ - -// extract a IDispatch from a jobject -IEnumVARIANT* extractEnumVariant(JNIEnv* env, jobject arg) -{ - jfieldID FID_pIEnumVARIANT = 0; - jclass clazz = env->GetObjectClass(arg); - FID_pIEnumVARIANT = env->GetFieldID(clazz, "m_pIEnumVARIANT", "I"); - return (IEnumVARIANT*)env->GetIntField(arg, FID_pIEnumVARIANT); -} - -JNIEXPORT jint JNICALL -Java_com_jacob_com_EnumVariant_Next(JNIEnv* env, jobject _this, jobjectArray vars) -{ - IEnumVARIANT* self = extractEnumVariant(env, _this); - //printf("self=%x\n", self); - if(self == NULL) - return 0; - - ULONG count = (ULONG)env->GetArrayLength(vars); - if(count == 0) - return 0; - - VARIANT* sink = (VARIANT*)CoTaskMemAlloc(count * sizeof(VARIANT)); - ULONG fetchCount = 0; - - HRESULT hr = self->Next(count, sink, &fetchCount); - if(FAILED(hr)) - { - CoTaskMemFree(sink); - ThrowComFail(env, "IEnumVARIANT::Next", hr); - return 0; - } - - // prepare a new return value array - // - jclass clazz = env->FindClass("com/jacob/com/Variant"); - jmethodID ctor = env->GetMethodID(clazz, "", "()V"); - - for(ULONG idx = 0; idx < fetchCount; ++idx) - { - // construct a variant to return - // - jobject newVariant = env->NewObject(clazz, ctor); - VARIANT* v = extractVariant(env, newVariant); - VariantCopy(v, sink + idx); - env->SetObjectArrayElement(vars, idx, newVariant); - env->DeleteLocalRef(newVariant); - //Sourceforge-1674179 fix memory leak - // Variants received while iterating IEnumVARIANT must be cleared when no longer needed - // The variant has been copied so no longer needed - VariantClear(sink); - } - CoTaskMemFree(sink); - return (jint)fetchCount; -} - -JNIEXPORT void JNICALL -Java_com_jacob_com_EnumVariant_release(JNIEnv* env, jobject _this) -{ - IEnumVARIANT* self = extractEnumVariant(env, _this); - if(self != NULL) - { - self->Release(); - jfieldID FID_pIEnumVARIANT = 0; - jclass clazz = env->GetObjectClass(_this); - FID_pIEnumVARIANT = env->GetFieldID(clazz, "m_pIEnumVARIANT", "I"); - env->SetIntField(_this, FID_pIEnumVARIANT, (unsigned int)0); - } -} - -JNIEXPORT void JNICALL -Java_com_jacob_com_EnumVariant_Reset(JNIEnv* env, jobject _this) -{ - IEnumVARIANT* self = extractEnumVariant(env, _this); - if(self == NULL) - return; - - HRESULT hr = self->Reset(); - if(FAILED(hr)) - ThrowComFail(env, "IEnumVARIANT::Reset", hr); -} - -JNIEXPORT void JNICALL -Java_com_jacob_com_EnumVariant_Skip(JNIEnv* env, jobject _this, jint count) -{ - IEnumVARIANT* self = extractEnumVariant(env, _this); - if(self == NULL) - return; - - HRESULT hr = self->Skip((ULONG)count); - if(FAILED(hr)) - ThrowComFail(env, "IEnumVARIANT::Skip", hr); -} - -} diff --git a/jni/EnumVariant.h b/jni/EnumVariant.h deleted file mode 100644 index 7f939cf..0000000 --- a/jni/EnumVariant.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef _Included_EnumVariant -#define _Included_EnumVariant - -#include - -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: com_jacob_com_EnumVariant - * Method: Next - * Signature: ([Lcom/jacob/com/Variant;)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_EnumVariant_Next - (JNIEnv *, jobject, jobjectArray); - -/* - * Class: com_jacob_com_EnumVariant - * Method: Release - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_EnumVariant_release - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_EnumVariant - * Method: Reset - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_EnumVariant_Reset - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_EnumVariant - * Method: Skip - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_EnumVariant_Skip - (JNIEnv *, jobject, jint); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/jni/EventProxy.cpp b/jni/EventProxy.cpp deleted file mode 100644 index 496e8fc..0000000 --- a/jni/EventProxy.cpp +++ /dev/null @@ -1,870 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "EventProxy.h" -#include "Variant.h" - -// hook myself up as a listener for delegate -EventProxy::EventProxy(JNIEnv *env, - jobject aSinkObj, - CComPtr pConn, - IID eid, - CComBSTR mName[], - DISPID mID[], - int mNum) : - // initialize some variables - m_cRef(0), pCP(pConn), - eventIID(eid), MethNum(mNum), MethName(mName), - MethID(mID) -{ - // keep a pointer to the sink - javaSinkObj = env->NewGlobalRef(aSinkObj); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - - // we need this to attach to the event invocation thread - env->GetJavaVM(&jvm); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - AddRef(); - Connect(env); -} - -void EventProxy::Connect(JNIEnv *env) { - HRESULT hr = pCP->Advise(this, &dwEventCookie); - if (SUCCEEDED(hr)) { - connected = 1; - } else { - connected = 0; - ThrowComFail(env, "Advise failed", hr); - } -} - -// unhook myself up as a listener and get rid of delegate -EventProxy::~EventProxy() -{ - JNIEnv *env; - Disconnect(); - jint vmConnectionStatus = JNI_EVERSION ; - jint attachReturnStatus = -1; // AttachCurrentThread return status.. negative numbers are failure return codes. - - // attach to the current running thread -- JDK 1.4 jni.h has two param cover for 3 param call - vmConnectionStatus = jvm->GetEnv((void **)&env, JNI_VERSION_1_2); - if ((env != NULL)&& env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - if (vmConnectionStatus == JNI_EDETACHED){ - //printf("Unhook: Attaching to current thread using JNI Version 1.2 (%d)\n",vmConnectionStatus); - JavaVMAttachArgs attachmentArgs; - attachmentArgs.version = JNI_VERSION_1_2; - attachmentArgs.name = NULL; - attachmentArgs.group = NULL; - attachReturnStatus = jvm->AttachCurrentThread((void **)&env, &attachmentArgs); - if ((env != NULL) && env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - } else { - // should really look for JNI_OK versus an error because it could have been JNI_EVERSION - // started method with thread hooked to VM so no need to attach again - //printf("Unhook: No need to attach because already attached %d\n",vmConnectionStatus); - } - - // we should always have an env by this point but lets be paranoid and check - if (env != NULL){ - env->DeleteGlobalRef(javaSinkObj); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - } - if (MethNum) { - delete [] MethName; - delete [] MethID; - } - // detach from thread only if we attached to it in this function - if (attachReturnStatus == 0){ - jvm->DetachCurrentThread(); - //printf("Unhook: Detached\n"); - } else { - //printf("Unhook: No need to detatch because attached prior to method\n"); - } - //fflush(stdout); -} - -void EventProxy::Disconnect() { - if (connected) { - pCP->Unadvise(dwEventCookie); - } -} - -// I only support the eventIID interface which was passed in -// by the DispatchEvent wrapper who looked it up as the -// source object's default source interface -STDMETHODIMP EventProxy::QueryInterface(REFIID rid, void **ppv) -{ - if (rid == IID_IUnknown || rid == eventIID || rid == IID_IDispatch) - { - *ppv = this; - AddRef(); - return S_OK; - } - return E_NOINTERFACE; -} - -// This should never get called - the event source fires events -// by dispid's, not by name -STDMETHODIMP EventProxy::GetIDsOfNames(REFIID riid, - OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgDispID) -{ - return E_UNEXPECTED; -} - -// The actual callback from the connection point arrives here -STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid, - LCID lcid, unsigned short wFlags, DISPPARAMS *pDispParams, - VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) -{ - const char *eventMethodName = NULL; //Sourceforge report 1394001 - JNIEnv *env = NULL; - - // map dispID to jmethodID - for(int i=0;iAttachCurrentThread((void **)&env, &attachmentArgs); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - - if (!eventMethodName) - { - // could not find this signature in list - // printf("Invoke: didn't find method name for dispatch id %d\n",dispID); - // this probably leaves a native thread attached to the vm when we don't want it - ThrowComFail(env, "Event method received was not defined as part of callback interface", -1); - - // should we detatch before returning?? We probably never get here if we ThrowComFail() - // jvm->DetachCurrentThread(); - return S_OK; - } - - // find the class of the InvocationHandler - jclass javaSinkClass = env->GetObjectClass(javaSinkObj); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - //printf("Invoke: Got sink class\n"); - jmethodID invokeMethod; - invokeMethod = env->GetMethodID(javaSinkClass, "invoke", "(Ljava/lang/String;[Lcom/jacob/com/Variant;)Lcom/jacob/com/Variant;"); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - jstring eventMethodNameAsString = env->NewStringUTF(eventMethodName); - //printf("Invoke: Got method name\n"); - // now do what we need for the variant - jmethodID getVariantMethod = env->GetMethodID(javaSinkClass, "getVariant", "()Lcom/jacob/com/Variant;"); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - //printf("Invoke: Found way too getVariant\n"); - jobject aVariantObj = env->CallObjectMethod(javaSinkObj, getVariantMethod); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - //printf("Invoke: Made Variant\n"); - jclass variantClass = env->GetObjectClass(aVariantObj); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - - // create the variant parameter array - // how many params - int numVariantParams = pDispParams->cArgs; - // make an array of them - jobjectArray varr = env->NewObjectArray(numVariantParams, variantClass, 0); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - //printf("Invoke: Created Array\n"); - int i,j; - for(i=numVariantParams-1,j=0;i>=0;i--,j++) - { - // construct a java variant holder - jobject arg = env->CallObjectMethod(javaSinkObj, getVariantMethod); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - // get the empty variant from it - VARIANT *va = extractVariant(env, arg); - // copy the value - VariantCopy(va, &pDispParams->rgvarg[i]); - // put it in the array - env->SetObjectArrayElement(varr, j, arg); - env->DeleteLocalRef(arg); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - } - //printf("Invoke: Filled Array\n"); - // Set up the return value - jobject ret; - - ret = env->CallObjectMethod(javaSinkObj, invokeMethod, - eventMethodNameAsString, varr); - //printf("Invoke: Invoked callback\n"); - if (!env->ExceptionOccurred() && ret != NULL) { - VariantCopy(pVarResult, extractVariant(env,ret)); - } - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - // don't need the first variant we created to get the class - // SF 1689061 change not accepted but put in as comment for later reminder - //Java_com_jacob_com_Variant_release(env, aVariantObj); - env->DeleteLocalRef(aVariantObj); - if (env->ExceptionOccurred()) { env->ExceptionDescribe(); env->ExceptionClear();} - - // Begin code from Jiffie team that copies parameters back from java to COM - for(i=numVariantParams-1,j=0;i>=0;i--,j++) - { - jobject arg = env->GetObjectArrayElement(varr, j); - VARIANT *java = extractVariant(env, arg); - VARIANT *com = &pDispParams->rgvarg[i]; - convertJavaVariant(java, com); - // SF 1689061 change not accepted but put in as comment for later reminder - //Java_com_jacob_com_Variant_release(env, arg); - zeroVariant(env, arg); - env->DeleteLocalRef(arg); - } - // End code from Jiffie team that copies parameters back from java to COM - // detach from thread - //printf("Invoke: Detatching\n"); - jvm->DetachCurrentThread(); - //fflush(stdout); - return S_OK; - } - return E_NOINTERFACE; -} - -void EventProxy::convertJavaVariant(VARIANT *java, VARIANT *com) { - - switch (com->vt) - { - case VT_DISPATCH: - { - switch (java->vt) - { - case VT_DISPATCH: - { - V_DISPATCH(com) = V_DISPATCH(java); - break; - } - - case VT_DISPATCH | VT_BYREF: - { - V_DISPATCH(com) = *V_DISPATCHREF(java); - break; - } - } - break; - } - - case VT_DISPATCH | VT_BYREF: - { - switch (java->vt) - { - case VT_DISPATCH: - { - *V_DISPATCHREF(com) = V_DISPATCH(java); - break; - } - - case VT_DISPATCH | VT_BYREF: - { - *V_DISPATCHREF(com) = *V_DISPATCHREF(java); - break; - } - } - break; - } - - case VT_BOOL: - { - switch (java->vt) - { - case VT_BOOL: - { - V_BOOL(com) = V_BOOL(java); - break; - } - - case VT_BOOL | VT_BYREF: - { - V_BOOL(com) = *V_BOOLREF(java); - break; - } - } - break; - } - - case VT_BOOL | VT_BYREF: - { - switch (java->vt) - { - case VT_BOOL: - { - *V_BOOLREF(com) = V_BOOL(java); - break; - } - - case VT_BOOL | VT_BYREF: - { - *V_BOOLREF(com) = *V_BOOLREF(java); - break; - } - } - break; - } - - case VT_UI1: - { - switch (java->vt) - { - case VT_UI1: - { - V_UI1(com) = V_UI1(java); - break; - } - - case VT_UI1 | VT_BYREF: - { - V_UI1(com) = *V_UI1REF(java); - break; - } - } - break; - } - - case VT_UI1 | VT_BYREF: - { - switch (java->vt) - { - case VT_UI1: - { - *V_UI1REF(com) = V_UI1(java); - break; - } - - case VT_UI1 | VT_BYREF: - { - *V_UI1REF(com) = *V_UI1REF(java); - break; - } - } - break; - } - - - case VT_I2: - { - switch (java->vt) - { - case VT_I2: - { - V_I2(com) = V_I2(java); - break; - } - - case VT_I2 | VT_BYREF: - { - V_I2(com) = *V_I2REF(java); - break; - } - } - break; - } - - case VT_I2 | VT_BYREF: - { - switch (java->vt) - { - case VT_I2: - { - *V_I2REF(com) = V_I2(java); - break; - } - - case VT_I2 | VT_BYREF: - { - *V_I2REF(com) = *V_I2REF(java); - break; - } - } - break; - } - - case VT_I4: - { - switch (java->vt) - { - case VT_I4: - { - V_I4(com) = V_I4(java); - break; - } - - case VT_I4 | VT_BYREF: - { - V_I4(com) = *V_I4REF(java); - break; - } - } - break; - } - - case VT_I4 | VT_BYREF: - { - switch (java->vt) - { - case VT_I4: - { - *V_I4REF(com) = V_I4(java); - break; - } - - case VT_I4 | VT_BYREF: - { - *V_I4REF(com) = *V_I4REF(java); - break; - } - } - break; - } - - case VT_R4: - { - switch (java->vt) - { - case VT_R4: - { - V_R4(com) = V_R4(java); - break; - } - - case VT_R4 | VT_BYREF: - { - V_R4(com) = *V_R4REF(java); - break; - } - } - break; - } - - case VT_R4 | VT_BYREF: - { - switch (java->vt) - { - case VT_R4: - { - *V_R4REF(com) = V_R4(java); - break; - } - - case VT_R4 | VT_BYREF: - { - *V_R4REF(com) = *V_R4REF(java); - break; - } - } - break; - } - - case VT_R8: - { - switch (java->vt) - { - case VT_R8: - { - V_R8(com) = V_R8(java); - break; - } - - case VT_R8 | VT_BYREF: - { - V_R8(com) = *V_R8REF(java); - break; - } - } - break; - } - - case VT_R8 | VT_BYREF: - { - switch (java->vt) - { - case VT_R8: - { - *V_R8REF(com) = V_R8(java); - break; - } - - case VT_R8 | VT_BYREF: - { - *V_R8REF(com) = *V_R8REF(java); - break; - } - } - break; - } - - case VT_I1: - { - switch (java->vt) - { - case VT_I1: - { - V_I1(com) = V_I1(java); - break; - } - - case VT_I1 | VT_BYREF: - { - V_I1(com) = *V_I1REF(java); - break; - } - } - break; - } - - case VT_I1 | VT_BYREF: - { - switch (java->vt) - { - case VT_I1: - { - *V_I1REF(com) = V_I1(java); - break; - } - - case VT_I1 | VT_BYREF: - { - *V_I1REF(com) = *V_I1REF(java); - break; - } - } - break; - } - - case VT_UI2: - { - switch (java->vt) - { - case VT_UI2: - { - V_UI2(com) = V_UI2(java); - break; - } - - case VT_UI2 | VT_BYREF: - { - V_UI2(com) = *V_UI2REF(java); - break; - } - } - break; - } - - case VT_UI2 | VT_BYREF: - { - switch (java->vt) - { - case VT_UI2: - { - *V_UI2REF(com) = V_UI2(java); - break; - } - - case VT_UI2 | VT_BYREF: - { - *V_UI2REF(com) = *V_UI2REF(java); - break; - } - } - break; - } - - case VT_UI4: - { - switch (java->vt) - { - case VT_UI4: - { - V_UI4(com) = V_UI4(java); - break; - } - - case VT_UI4 | VT_BYREF: - { - V_UI4(com) = *V_UI4REF(java); - break; - } - } - break; - } - - case VT_UI4 | VT_BYREF: - { - switch (java->vt) - { - case VT_UI4: - { - *V_UI4REF(com) = V_UI4(java); - break; - } - - case VT_UI4 | VT_BYREF: - { - *V_UI4REF(com) = *V_UI4REF(java); - break; - } - } - break; - } - - case VT_INT: - { - switch (java->vt) - { - case VT_INT: - { - V_INT(com) = V_INT(java); - break; - } - - case VT_INT | VT_BYREF: - { - V_INT(com) = *V_INTREF(java); - break; - } - } - break; - } - - case VT_INT | VT_BYREF: - { - switch (java->vt) - { - case VT_INT: - { - *V_INTREF(com) = V_INT(java); - break; - } - - case VT_INT | VT_BYREF: - { - *V_INTREF(com) = *V_INTREF(java); - break; - } - } - break; - } - - case VT_UINT: - { - switch (java->vt) - { - case VT_UINT: - { - V_UINT(com) = V_UINT(java); - break; - } - - case VT_UINT | VT_BYREF: - { - V_UINT(com) = *V_UINTREF(java); - break; - } - } - break; - } - - case VT_UINT | VT_BYREF: - { - switch (java->vt) - { - case VT_UINT: - { - *V_UINTREF(com) = V_UINT(java); - break; - } - - case VT_UINT | VT_BYREF: - { - *V_UINTREF(com) = *V_UINTREF(java); - break; - } - } - break; - } - - case VT_CY: - { - switch (java->vt) - { - case VT_CY: - { - V_CY(com) = V_CY(java); - break; - } - - case VT_CY | VT_BYREF: - { - V_CY(com) = *V_CYREF(java); - break; - } - } - break; - } - - case VT_CY | VT_BYREF: - { - switch (java->vt) - { - case VT_CY: - { - *V_CYREF(com) = V_CY(java); - break; - } - - case VT_CY | VT_BYREF: - { - *V_CYREF(com) = *V_CYREF(java); - break; - } - } - break; - } - - case VT_DATE: - { - switch (java->vt) - { - case VT_DATE: - { - V_DATE(com) = V_DATE(java); - break; - } - - case VT_DATE | VT_BYREF: - { - V_DATE(com) = *V_DATEREF(java); - break; - } - } - break; - } - - case VT_DATE | VT_BYREF: - { - switch (java->vt) - { - case VT_DATE: - { - *V_DATEREF(com) = V_DATE(java); - break; - } - - case VT_DATE | VT_BYREF: - { - *V_DATEREF(com) = *V_DATEREF(java); - break; - } - } - break; - } - - case VT_BSTR: - { - switch (java->vt) - { - case VT_BSTR: - { - V_BSTR(com) = V_BSTR(java); - break; - } - - case VT_BSTR | VT_BYREF: - { - V_BSTR(com) = *V_BSTRREF(java); - break; - } - } - break; - } - - case VT_BSTR | VT_BYREF: - { - switch (java->vt) - { - case VT_BSTR: - { - *V_BSTRREF(com) = V_BSTR(java); - break; - } - - case VT_BSTR | VT_BYREF: - { - *V_BSTRREF(com) = *V_BSTRREF(java); - break; - } - } - break; - } - - case VT_DECIMAL: - { - switch (java->vt) - { - case VT_DECIMAL: - { - V_DECIMAL(com) = V_DECIMAL(java); - break; - } - - case VT_DECIMAL | VT_BYREF: - { - V_DECIMAL(com) = *V_DECIMALREF(java); - break; - } - } - break; - } - - case VT_DECIMAL | VT_BYREF: - { - switch (java->vt) - { - case VT_DECIMAL: - { - *V_DECIMALREF(com) = V_DECIMAL(java); - break; - } - - case VT_DECIMAL | VT_BYREF: - { - *V_DECIMALREF(com) = *V_DECIMALREF(java); - break; - } - } - break; - } - - - } -} diff --git a/jni/EventProxy.h b/jni/EventProxy.h deleted file mode 100644 index e0c79ac..0000000 --- a/jni/EventProxy.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -#include -#include -#include -#include -#include "stdafx.h" -#include "util.h" - -/* - * An instance of this class stands between a connection point - * and a java object. When it gets invoked from the cp, it reflects - * the call into the java object dynamically. The eventIID is passed - * in as are the valid dispids and the corresponding names. A map - * is created between the dispids and the java object's method in - * the constructor. For now, all the java event methods have to have - * the same signature: (Variant[]) - */ -class EventProxy : public IDispatch -{ -private: - int connected; - LONG m_cRef; // a reference counter - CComPtr pCP; // the connection point - DWORD dwEventCookie; // connection point cookie - jobject javaSinkObj; // the java object to delegate calls - - IID eventIID; // the interface iid passed in - int MethNum; // number of methods in the callback interface - CComBSTR *MethName; // Array of method names - DISPID *MethID; // Array of method ids, used to match invokations to method names - JavaVM *jvm; // The java vm we are running - void convertJavaVariant(VARIANT *java, VARIANT *com); - void Connect(JNIEnv *env); - void Disconnect(); -public: - // constuct with a global JNI ref to a sink object - // to which we will delegate event callbacks - EventProxy(JNIEnv *jenv, - jobject aSinkObj, - CComPtr pConn, - IID eventIID, - CComBSTR *mName, - DISPID *mID, - int mNum); - ~EventProxy(); - - // IUnknown methods - STDMETHODIMP_(ULONG) AddRef(void) - { - LONG res = InterlockedIncrement(&m_cRef); - return res; - } - - STDMETHODIMP_(ULONG) Release(void) - { - LONG res = InterlockedDecrement(&m_cRef); - if (res == 0) { - delete this; - } - return res; - - } - - STDMETHODIMP QueryInterface(REFIID rid, void **ppv); - - // IDispatch methods - STDMETHODIMP GetTypeInfoCount(UINT *num) - { - *num = 0; - return S_OK; - } - - STDMETHODIMP GetTypeInfo(UINT, LCID, ITypeInfo **pptInfo) - { - *pptInfo=NULL; - return E_NOTIMPL; - } - - // These are the actual supported methods - STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR **, UINT, LCID , DISPID *); - STDMETHODIMP Invoke(DISPID, REFIID, LCID, WORD , DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *); -}; diff --git a/jni/STA.cpp b/jni/STA.cpp deleted file mode 100644 index 8b48807..0000000 --- a/jni/STA.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "stdafx.h" -#include -#include "ComThread.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include "util.h" - -extern "C" -{ - -JNIEXPORT void JNICALL Java_com_jacob_com_STA_doMessagePump - (JNIEnv *env, jobject obj) -{ - // store the current thread id so we can kill it - jclass argClass = env->GetObjectClass(obj); - jfieldID ajf = env->GetFieldID( argClass, "threadID", "I"); - jint threadID = (jint)GetCurrentThreadId(); - env->SetIntField(obj, ajf, threadID); - - MSG msg; - - ZeroMemory(&msg, sizeof(msg)); - msg.wParam = S_OK; - - while (GetMessage(&msg, NULL, 0, 0)) - { - DispatchMessage(&msg); - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_STA_quitMessagePump - (JNIEnv *env, jobject obj) -{ - jclass argClass = env->GetObjectClass(obj); - jfieldID ajf = env->GetFieldID( argClass, "threadID", "I"); - jint threadID = env->GetIntField(obj, ajf); - PostThreadMessage((DWORD)threadID, WM_QUIT, 0, 0); -} - -} diff --git a/jni/STA.h b/jni/STA.h deleted file mode 100644 index 52190db..0000000 --- a/jni/STA.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -/* Header for class STA */ - -#ifndef _Included_com_jacob_com_STA -#define _Included_com_jacob_com_STA -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: com_jacob_com_STA - * Method: doMessagePump - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_STA_doMessagePump - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_STA - * Method: quitMessagePump - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_STA_quitMessagePump - (JNIEnv *, jobject); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/jni/SafeArray.cpp b/jni/SafeArray.cpp deleted file mode 100644 index 29077a3..0000000 --- a/jni/SafeArray.cpp +++ /dev/null @@ -1,3177 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "SafeArray.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include -#include "util.h" - -extern "C" -{ - -#define V_FLD "m_pV" - -static SAFEARRAY *makeArray(int vt, int nDims, long *lb, long *cel) -{ - if (nDims == 1) { - // no need to alloc - SAFEARRAYBOUND sab; - sab.lLbound = lb[0]; - sab.cElements = cel[0]; - SAFEARRAY *sa = SafeArrayCreate(vt,1,&sab); - return sa; - } else { - SAFEARRAYBOUND* rgsaBounds = new SAFEARRAYBOUND[nDims]; - for(int i=0;iGetObjectClass(arg); - jfieldID vf = env->GetFieldID( argClass, V_FLD, "I"); - jint vnum = env->GetIntField(arg, vf); - if (vnum != NULL) - { - // if vnum is not NULL, then there is a Variant wrapper present - VARIANT *v = (VARIANT *)vnum; - return v; - } - return NULL; -} - -// extract a SAFEARRAY from a SafeArray object -SAFEARRAY *extractSA(JNIEnv *env, jobject arg) -{ - VARIANT *v = extractWrapper(env, arg); - if (v != NULL) - { - SAFEARRAY *sa = V_ARRAY(v); - return sa; - } - return NULL; -} - -// deep copy a SAFEARRAY -SAFEARRAY *copySA(SAFEARRAY *psa) -{ - // easiest way to make a deep copy is to use VariantCopy - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - VARIANT v1, v2; - - VariantInit(&v1); - VariantInit(&v2); - V_VT(&v1) = VT_ARRAY | vt; - V_ARRAY(&v1) = psa; - VariantCopy(&v2, &v1); - SAFEARRAY *sa = V_ARRAY(&v2); - VariantInit(&v2); // make sure it's not owned by this variant - VariantClear(&v2); - VariantInit(&v1); - VariantClear(&v1); - - return sa; -} - -// create a VARIANT wrapper for the safearray -void setSA(JNIEnv *env, jobject arg, SAFEARRAY *sa, int copy) -{ - // construct a variant to hold the result - // the variant then owns the array - jclass argClass = env->GetObjectClass(arg); - jfieldID ajf = env->GetFieldID( argClass, V_FLD, "I"); - jint vnum = env->GetIntField(arg, ajf); - VARIANT *v = (VARIANT *)vnum; - if (v == NULL) - { - v = new VARIANT(); - VariantInit(v); - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - V_VT(v) = VT_ARRAY | vt; - V_ARRAY(v) = copy ? copySA(sa) : sa; - env->SetIntField(arg, ajf, (unsigned int)v); -} - -/* - * Class: SafeArray - * Method: init - * Signature: (I[I[I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_init - (JNIEnv *env, jobject _this, jint vt, jintArray lb, jintArray cel) -{ - jint *lbounds = env->GetIntArrayElements(lb, NULL); - jint *celems = env->GetIntArrayElements(cel, NULL); - int nDims = env->GetArrayLength(lb); - // array lengths must match - if (nDims != env->GetArrayLength(cel)) return; - // build the sa according to params - if ( nDims > 0 ) - { - SAFEARRAY *sa = makeArray(vt, nDims, lbounds, celems); - env->ReleaseIntArrayElements(lb, lbounds, 0); - env->ReleaseIntArrayElements(cel, celems, 0); - jclass clazz = env->GetObjectClass(_this); - setSA(env, _this, sa, 0); - } -} - -/* - * Class: SafeArray - * Method: clone - * Signature: ()Ljava/lang/Object; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_clone - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) - { - // prepare a new return value - jclass saClass = env->GetObjectClass(_this); - jmethodID saCons = env->GetMethodID(saClass, "", "()V"); - // construct an SA to return - jobject newSA = env->NewObject(saClass, saCons); - // wrap in a Variant - setSA(env, newSA, psa, 1); - return newSA; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: destroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_destroy - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractWrapper(env, _this); - if (v) { - // this is the case where a Variant wrapper exists, in that - // case free the variant, but if there is just a raw SA, then - // the owning variant will free it - jclass saClass = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID(saClass, V_FLD, "I"); - VariantClear(v); - delete v; - env->SetIntField(_this, jf, (unsigned int)0); - } -} - -/* - * Class: SafeArray - * Method: getvt - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getvt - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - return (jint)vt; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: reinit - * Signature: (LSafeArray;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_reinit - (JNIEnv *env, jobject _this, jobject sa) -{ - // what to do here? -} - -/* - * Class: SafeArray - * Method: reinterpretType - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_reinterpretType - (JNIEnv *env, jobject _this, jint vt) -{ -} - -/* - * Class: SafeArray - * Method: getLBound - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getLBound__ - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - jint lb; - SafeArrayGetLBound(psa, 1, &lb); - return lb; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: getLBound - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getLBound__I - (JNIEnv *env, jobject _this, jint dim) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - jint lb; - SafeArrayGetLBound(psa, dim, &lb); - return lb; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: getUBound - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getUBound__ - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - jint lb; - SafeArrayGetUBound(psa, 1, &lb); - return lb; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: getUBound - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getUBound__I - (JNIEnv *env, jobject _this, jint dim) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - jint lb; - SafeArrayGetUBound(psa, dim, &lb); - return lb; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: getNumDim - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getNumDim - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - return SafeArrayGetDim(psa); - } - return NULL; -} - -/* - * Class: SafeArray - * Method: getFeatures - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getFeatures - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - SafeArrayLock(psa); - jint features = psa->fFeatures; - SafeArrayUnlock(psa); - return features; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: getElemSize - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getElemSize - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (psa) { - jint siz = SafeArrayGetElemsize(psa); - return siz; - } - return NULL; -} - -static int numElements(SAFEARRAY *psa) -{ - int nDims = SafeArrayGetDim(psa); - int elems = 0; - for(int i=1;i<=nDims;i++) { - long lb, ub; - SafeArrayGetLBound(psa, i, &lb); - SafeArrayGetUBound(psa, i, &ub); - elems += ub - lb + 1; - } - return elems; -} - -/* - * Class: SafeArray - * Method: fromCharArray - * Signature: ([C)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromCharArray - (JNIEnv *env, jobject _this, jcharArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the double array - don't make a copy - jchar *arrayElements = env->GetCharArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_UI2; - for(int i=0;iReleaseCharArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromIntArray - * Signature: ([I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromIntArray - (JNIEnv *env, jobject _this, jintArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the int array - don't make a copy - jint *arrayElements = env->GetIntArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_I4; - for(int i=0;iReleaseIntArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromLongArray - * Signature: ([L)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromLongArray - (JNIEnv *env, jobject _this, jlongArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the long array - don't make a copy - jlong *arrayElements = env->GetLongArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_I8; - for(int i=0;iReleaseLongArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromShortArray - * Signature: ([S)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromShortArray - (JNIEnv *env, jobject _this, jshortArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the short array - don't make a copy - jshort *arrayElements = env->GetShortArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_I2; - for(int i=0;iReleaseShortArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromDoubleArray - * Signature: ([D)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromDoubleArray - (JNIEnv *env, jobject _this, jdoubleArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the double array - don't make a copy - jdouble *arrayElements = env->GetDoubleArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_R8; - for(int i=0;iReleaseDoubleArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromStringArray - * Signature: ([Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromStringArray - (JNIEnv *env, jobject _this, jobjectArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_BSTR; - for(int i=0;iGetObjectArrayElement(a, i); - // jacob report 1224219 should use unicode and not UTF-8 - // GetStringUTFChars() replaced with GetStringChars() - // (Variant modified in previous report) - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); // SR cast SF 1689061 - V_VT(&v) = VT_BSTR; - V_BSTR(&v) = bs.Copy(); - long x = i; - SafeArrayPutElement(psa,&x,&v); - env->ReleaseStringChars(s, str); - VariantClear(&v); - } - } else if (vt == VT_BSTR) { - for(int i=0;iGetObjectArrayElement(a, i); - // jacob report 1224219 should use unicode and not UTF-8 - // GetStringUTFChars() replaced with GetStringChars() - // (Variant modified in previous report) - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); // SR cast SF 1689061 - BSTR bstr = bs.Detach(); - long x = i; - SafeArrayPutElement(psa,&x,bstr); - env->ReleaseStringChars(s, str); - } - } else { - ThrowComFail(env, "safearray cannot be assigned from string\n", 0); - } -} - -/* - * Class: SafeArray - * Method: fromByteArray - * Signature: ([B)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromByteArray - (JNIEnv *env, jobject _this, jbyteArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the byte array - don't make a copy - jbyte *arrayElements = env->GetByteArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_UI1; - for(int i=0;iReleaseByteArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromFloatArray - * Signature: ([F)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromFloatArray - (JNIEnv *env, jobject _this, jfloatArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the float array - don't make a copy - jfloat *arrayElements = env->GetFloatArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_R4; - for(int i=0;iReleaseFloatArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromBooleanArray - * Signature: ([Z)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromBooleanArray - (JNIEnv *env, jobject _this, jbooleanArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - // get the boolean array - don't make a copy - jboolean *arrayElements = env->GetBooleanArrayElements(a, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_BOOL; - for(int i=0;iReleaseBooleanArrayElements(a, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: fromVariantArray - * Signature: ([LVariant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromVariantArray - (JNIEnv *env, jobject _this, jobjectArray a) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(a); - if (len > numElements(psa)) - { - // max size of memcpy - len = numElements(psa); - } - if (vt == VT_VARIANT) { - for(int i=0;iGetObjectArrayElement(a, i); - VARIANT *v = extractVariant(env, var); - long x = i; - if (v) SafeArrayPutElement(psa,&x,v); - } - } else { - ThrowComFail(env, "safearray cannot be assigned from variant", -1); - } -} - -/* - * Class: SafeArray - * Method: toCharArray - * Signature: ()[C - */ -JNIEXPORT jcharArray JNICALL Java_com_jacob_com_SafeArray_toCharArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_UI2 || vt == VT_I2) { - jcharArray arrayElements = env->NewCharArray(num); - void *pData; - SafeArrayAccessData(sa, &pData); - env->SetCharArrayRegion(arrayElements, 0, num, (jchar *)pData); - SafeArrayUnaccessData(sa); - return arrayElements; - } else if (vt == VT_VARIANT) { - jcharArray arrayElements = env->NewCharArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_UI2))) { - return NULL; - } - jchar val = V_UI2(&v); - env->SetCharArrayRegion(arrayElements, i, 1, &val); - } - return arrayElements; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: toIntArray - * Signature: ()[I - */ -JNIEXPORT jintArray JNICALL Java_com_jacob_com_SafeArray_toIntArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_I4) { - jintArray arrayElements = env->NewIntArray(num); - void *pData; - SafeArrayAccessData(sa, &pData); - env->SetIntArrayRegion(arrayElements, 0, num, (jint *)pData); - SafeArrayUnaccessData(sa); - return arrayElements; - } else if (vt == VT_VARIANT) { - jintArray arrayElements = env->NewIntArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_I4))) { - return NULL; - } - jint val = V_I4(&v); - env->SetIntArrayRegion(arrayElements, i, 1, &val); - } - return arrayElements; - } - return NULL; -} - - -/* - * Class: SafeArray - * Method: toLongArray - * Signature: ()[L - */ -JNIEXPORT jlongArray JNICALL Java_com_jacob_com_SafeArray_toLongArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_I8) { - jlongArray arrayElements = env->NewLongArray(num); - void *pData; - SafeArrayAccessData(sa, &pData); - env->SetLongArrayRegion(arrayElements, 0, num, (jlong *)pData); - SafeArrayUnaccessData(sa); - return arrayElements; - } else if (vt == VT_VARIANT) { - jlongArray arrayElements = env->NewLongArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_I8))) { - return NULL; - } - jlong val = V_I8(&v); - env->SetLongArrayRegion(arrayElements, i, 1, &val); - } - return arrayElements; - } - return NULL; -} - - -/* - * Class: SafeArray - * Method: toShortArray - * Signature: ()[S - */ -JNIEXPORT jshortArray JNICALL Java_com_jacob_com_SafeArray_toShortArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_I2) { - jshortArray arrayElements = env->NewShortArray(num); - void *pData; - SafeArrayAccessData(sa, &pData); - env->SetShortArrayRegion(arrayElements, 0, num, (jshort *)pData); - SafeArrayUnaccessData(sa); - return arrayElements; - } else if (vt == VT_VARIANT) { - jshortArray arrayElements = env->NewShortArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_I2))) { - return NULL; - } - jshort val = V_I2(&v); - env->SetShortArrayRegion(arrayElements, i, 1, &val); - } - return arrayElements; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: toDoubleArray - * Signature: ()[D - */ -JNIEXPORT jdoubleArray JNICALL Java_com_jacob_com_SafeArray_toDoubleArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_R8) { - jdoubleArray arrayElements = env->NewDoubleArray(num); - void *pData; - SafeArrayAccessData(sa, &pData); - env->SetDoubleArrayRegion(arrayElements, 0, num, (jdouble *)pData); - SafeArrayUnaccessData(sa); - return arrayElements; - } else if (vt == VT_VARIANT) { - jdoubleArray arrayElements = env->NewDoubleArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_R8))) { - return NULL; - } - jdouble val = V_R8(&v); - env->SetDoubleArrayRegion(arrayElements, i, 1, &val); - } - return arrayElements; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: toStringArray - * Signature: ()[Ljava/lang/String; - */ -JNIEXPORT jobjectArray JNICALL Java_com_jacob_com_SafeArray_toStringArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) - { - jclass sClass = env->FindClass("java/lang/String"); - jobjectArray arrayElements = env->NewObjectArray(num, sClass, NULL); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BSTR))) { - return NULL; - } - BSTR bs = V_BSTR(&v); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - env->SetObjectArrayElement(arrayElements, i, js); - } - return arrayElements; - } else if (vt == VT_BSTR) { - jclass sClass = env->FindClass("java/lang/String"); - jobjectArray arrayElements = env->NewObjectArray(num, sClass, NULL); - for(int i=lb;i<=ub;i++) { - BSTR bs = NULL; - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &bs); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - env->SetObjectArrayElement(arrayElements, i, js); - } - return arrayElements; - } - ThrowComFail(env, "safearray cannot be converted to string[]", 0); - return NULL; -} - -/* - * Class: SafeArray - * Method: toByteArray - * Signature: ()[B - */ -JNIEXPORT jbyteArray JNICALL Java_com_jacob_com_SafeArray_toByteArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_I1 || vt == VT_UI1) { - jbyteArray arrayElements = env->NewByteArray(num); - jbyte *pData; - SafeArrayAccessData(sa, (void **)&pData); - env->SetByteArrayRegion(arrayElements, 0, num, pData); - SafeArrayUnaccessData(sa); - return arrayElements; - } else if (vt == VT_VARIANT) { - jbyteArray arrayElements = env->NewByteArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb,j=0;i<=ub;i++,j++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_UI1))) { - return NULL; - } - jbyte val = V_UI1(&v); - env->SetByteArrayRegion(arrayElements, j, 1, &val); - } - return arrayElements; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: toFloatArray - * Signature: ()[F - */ -JNIEXPORT jfloatArray JNICALL Java_com_jacob_com_SafeArray_toFloatArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_R4) { - jfloatArray arrayElements = env->NewFloatArray(num); - void *pData; - SafeArrayAccessData(sa, &pData); - env->SetFloatArrayRegion(arrayElements, 0, num, (jfloat *)pData); - SafeArrayUnaccessData(sa); - return arrayElements; - } else if (vt == VT_VARIANT) { - jfloatArray arrayElements = env->NewFloatArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_R4))) { - return NULL; - } - jfloat val = V_R4(&v); - env->SetFloatArrayRegion(arrayElements, i, 1, &val); - } - return arrayElements; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: toBooleanArray - * Signature: ()[Z - */ -JNIEXPORT jbooleanArray JNICALL Java_com_jacob_com_SafeArray_toBooleanArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_BOOL) { - // need to loop because jboolean=1 byte and VARIANT_BOOL=2 bytes - jbooleanArray arrayElements = env->NewBooleanArray(num); - VARIANT_BOOL v; - for(int i=lb,j=0;i<=ub;i++,j++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - jboolean val = v == VARIANT_TRUE ? JNI_TRUE : JNI_FALSE; - env->SetBooleanArrayRegion(arrayElements, j, 1, &val); - } - return arrayElements; - } else if (vt == VT_VARIANT) { - jbooleanArray arrayElements = env->NewBooleanArray(num); - VARIANT v; - VariantInit(&v); - for(int i=lb;i<=ub;i++) { - long ix = i; - SafeArrayGetElement(sa, &ix, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BOOL))) { - return NULL; - } - jboolean val = V_BOOL(&v) == VARIANT_TRUE ? JNI_TRUE : JNI_FALSE; - env->SetBooleanArrayRegion(arrayElements, i, 1, &val); - } - return arrayElements; - } - return NULL; -} - -/* - * Class: SafeArray - * Method: toVariantArray - * Signature: ()[LVariant; - */ -JNIEXPORT jobjectArray JNICALL Java_com_jacob_com_SafeArray_toVariantArray - (JNIEnv *env, jobject _this) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - int num = ub - lb + 1; - jclass vClass = env->FindClass("com/jacob/com/Variant"); - // create an array of Variant's - jobjectArray varr = env->NewObjectArray(num, vClass, 0); - // fill them in - jmethodID variantCons = - env->GetMethodID(vClass, "", "()V"); - for(int i=lb;i<=ub;i++) { - long ix = i; - // construct a variant to return - jobject newVariant = env->NewObject(vClass, variantCons); - // get the VARIANT from the newVariant - VARIANT *v = extractVariant(env, newVariant); - SafeArrayGetElement(sa, &ix, (void*) v); - // put in object array - env->SetObjectArrayElement(varr, i, newVariant); - } - return varr; -} - -// this is an ugly way to avoid copy/pasting the same code - -// returns a value extracted from a 1 dimensional SafeArray -// uses the idx variable in the object this macro is included in -#define GET1DCODE(varType, varAccess, jtyp) \ - SAFEARRAY *sa = extractSA(env, _this); \ - if (!sa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return NULL; \ - } \ - if (SafeArrayGetDim(sa) != 1) { \ - ThrowComFail(env, "safearray is not 1D", -1); \ - return NULL; \ - } \ - VARTYPE vt; \ - SafeArrayGetVartype(sa, &vt); \ - if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - SafeArrayGetElement(sa, &idx, (void*) &v); \ - if (FAILED(VariantChangeType(&v, &v, 0, varType))) { \ - ThrowComFail(env, "VariantChangeType failed", -1); \ - return NULL; \ - } \ - return (jtyp)varAccess(&v); \ - } else if (vt == varType) { \ - jtyp jc; \ - SafeArrayGetElement(sa, &idx, (void*) &jc); \ - return jc; \ - } else { \ - return NULL; \ - } - -// returns a value extracted from a 2 dimensional SafeArray -// uses i and j from the method that this macro is included in as indexes -#define GET2DCODE(varType, varAccess, jtyp) \ - SAFEARRAY *sa = extractSA(env, _this); \ - if (!sa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return NULL; \ - } \ - if (SafeArrayGetDim(sa) != 2) { \ - ThrowComFail(env, "safearray is not 2D", -1); \ - return NULL; \ - } \ - long idx[2] = {i, j}; \ - VARTYPE vt; \ - SafeArrayGetVartype(sa, &vt); \ - if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - SafeArrayGetElement(sa, idx, (void*) &v); \ - if (FAILED(VariantChangeType(&v, &v, 0, varType))) { \ - ThrowComFail(env, "VariantChangeType failed", -1); \ - return NULL; \ - } \ - return (jtyp)varAccess(&v); \ - } else if (vt == varType) { \ - jtyp jc; \ - SafeArrayGetElement(sa, idx, (void*) &jc); \ - return jc; \ - } else { \ - return NULL; \ - } - - -// sets the values on a one dimensional array -#define SET1DCODE(varType, varAccess) \ - SAFEARRAY *sa = extractSA(env, _this); \ - if (!sa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return; \ - } \ - if (SafeArrayGetDim(sa) != 1) { \ - ThrowComFail(env, "safearray is not 1D", -1); \ - return; \ - } \ - VARTYPE vt; \ - SafeArrayGetVartype(sa, &vt); \ - if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - V_VT(&v) = varType; \ - varAccess(&v) = c; \ - SafeArrayPutElement(sa,&idx,&v); \ - } else if (vt == varType) { \ - SafeArrayPutElement(sa,&idx,&c); \ - } else { \ - ThrowComFail(env, "safearray type mismatch", -1); \ - } \ - -// sets the values into a 2 dimensional array -#define SET2DCODE(varType, varAccess) \ - SAFEARRAY *sa = extractSA(env, _this); \ - if (!sa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return; \ - } \ - if (SafeArrayGetDim(sa) != 2) { \ - ThrowComFail(env, "safearray is not 2D", -1); \ - return; \ - } \ - VARTYPE vt; \ - SafeArrayGetVartype(sa, &vt); \ - long idx[2] = {i,j}; \ - if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - V_VT(&v) = varType; \ - varAccess(&v) = c; \ - SafeArrayPutElement(sa,idx,&v); \ - } else if (vt == varType) { \ - SafeArrayPutElement(sa,idx,&c); \ - } else { \ - ThrowComFail(env, "safearray type mismatch", -1); \ - } - -#define GETARRAYCODE(varType, varType2, varAccess, jtyp, jsetArr) \ - SAFEARRAY *sa = extractSA(env, _this); \ - if (!sa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return; \ - } \ - VARTYPE vt; \ - SafeArrayGetVartype(sa, &vt); \ - if (vt == varType || vt == varType2) { \ - jtyp *pData; \ - SafeArrayAccessData(sa, (void **)&pData); \ - env->jsetArr(ja, ja_start, nelem, &pData[idx]); \ - SafeArrayUnaccessData(sa); \ - return; \ - } else if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - for(int i=idx, j=ja_start;ijsetArr(ja, j, 1, &val); \ - } \ - } - -#define SETARRAYCODE(varType, varType2, varAccess, jtyp, jgetArr, jrelArr) \ - SAFEARRAY *psa = extractSA(env, _this); \ - if (!psa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return; \ - } \ - VARTYPE vt; \ - SafeArrayGetVartype(psa, &vt); \ - jtyp *arrayElements = env->jgetArr(ja, 0); \ - if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - V_VT(&v) = varType; \ - for(int i=ja_start,j=idx;ijrelArr(ja, arrayElements, 0); - -/* - * Class: SafeArray - * Method: getChar - * Signature: (I)C - */ -JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar__I - (JNIEnv *env, jobject _this, jint idx) -{ - GET1DCODE(VT_UI2, V_UI2, jchar) -} - -/* - * Class: SafeArray - * Method: getChar - * Signature: (II)C - */ -JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - GET2DCODE(VT_UI2, V_UI2, jchar) -} - - -/* - * Class: SafeArray - * Method: setChar - * Signature: (IC)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar__IC - (JNIEnv *env, jobject _this, jint idx, jchar c) -{ - SET1DCODE(VT_UI2, V_UI2); -} - -/* - * Class: SafeArray - * Method: setChar - * Signature: (IIC)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar__IIC - (JNIEnv *env, jobject _this, jint i, jint j, jchar c) -{ - SET2DCODE(VT_UI2, V_UI2); -} - -/* - * Class: SafeArray - * Method: getChars - * Signature: (II[CI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getChars - (JNIEnv *env, jobject _this, jint idx, jint nelem, jcharArray ja, jint ja_start) -{ - GETARRAYCODE(VT_UI2, VT_I2, V_UI2, jchar, SetCharArrayRegion); -} - -/* - * Class: SafeArray - * Method: setChars - * Signature: (II[CI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChars - (JNIEnv *env, jobject _this, jint idx, jint nelem, jcharArray ja, jint ja_start) -{ - SETARRAYCODE(VT_UI2, VT_I2, V_UI2, jchar, - GetCharArrayElements, ReleaseCharArrayElements); -} - -/*----------------------- INTS ----------------------------------*/ - -/* - * Class: SafeArray - * Method: getInt - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt__I - (JNIEnv *env, jobject _this, jint idx) -{ - GET1DCODE(VT_I4, V_I4, jint) -} - -/* - * Class: SafeArray - * Method: getInt - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - GET2DCODE(VT_I4, V_I4, jint) -} - -/* - * Class: SafeArray - * Method: setInt - * Signature: (II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt__II - (JNIEnv *env, jobject _this, jint idx, jint c) -{ - SET1DCODE(VT_I4, V_I4); -} - -/* - * Class: SafeArray - * Method: setInt - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt__III - (JNIEnv *env, jobject _this, jint i, jint j, jint c) -{ - SET2DCODE(VT_I4, V_I4); -} - -/* - * Class: SafeArray - * Method: getInts - * Signature: (II[II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getInts - (JNIEnv *env, jobject _this, jint idx, jint nelem, jintArray ja, jint ja_start) -{ - GETARRAYCODE(VT_I4, VT_I4, V_I4, jint, SetIntArrayRegion); -} - -/* - * Class: SafeArray - * Method: setInts - * Signature: (II[II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInts - (JNIEnv *env, jobject _this, jint idx, jint nelem, jintArray ja, jint ja_start) -{ - SETARRAYCODE(VT_I4, VT_I4, V_I4, jint, - GetIntArrayElements, ReleaseIntArrayElements); -} - -/*----------------------- END INTS ----------------------------------*/ -/*----------------------- LONGS ----------------------------------*/ - -/* - * Class: SafeArray - * Method: getLong - * Signature: (I)J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_SafeArray_getLong__I - (JNIEnv *env, jobject _this, jint idx) -{ - GET1DCODE(VT_I8, V_I8, jlong) -} - -/* - * Class: SafeArray - * Method: getLong - * Signature: (II)J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_SafeArray_getLong__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - GET2DCODE(VT_I8, V_I8, jlong) -} - -/* - * Class: SafeArray - * Method: setLong - * Signature: (IJ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLong__IJ - (JNIEnv *env, jobject _this, jint idx, jlong c) -{ - SET1DCODE(VT_I8, V_I8); -} - -/* - * Class: SafeArray - * Method: setLong - * Signature: (IIJ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLong__IIJ - (JNIEnv *env, jobject _this, jint i, jint j, jlong c) -{ - SET2DCODE(VT_I8, V_I8); -} - -/* - * Class: SafeArray - * Method: getLongs - * Signature: (II[JI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getLongs - (JNIEnv *env, jobject _this, jint idx, jint nelem, jlongArray ja, jint ja_start) -{ - GETARRAYCODE(VT_I8, VT_I8, V_I8, jlong, SetLongArrayRegion); -} - -/* - * Class: SafeArray - * Method: setLongs - * Signature: (II[JI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLongs - (JNIEnv *env, jobject _this, jint idx, jint nelem, jlongArray ja, jint ja_start) -{ - SETARRAYCODE(VT_I8, VT_I8, V_I8, jlong, - GetLongArrayElements, ReleaseLongArrayElements); -} - -/*------------------------ END LONGS -----------------------------*/ - - -/* - * Class: SafeArray - * Method: getShort - * Signature: (I)S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort__I - (JNIEnv *env, jobject _this, jint idx) -{ - GET1DCODE(VT_I2, V_I2, jshort) -} - -/* - * Class: SafeArray - * Method: getShort - * Signature: (II)S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - GET2DCODE(VT_I2, V_I2, jshort) -} - -/* - * Class: SafeArray - * Method: setShort - * Signature: (IS)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort__IS - (JNIEnv *env, jobject _this, jint idx, jshort c) -{ - SET1DCODE(VT_I2, V_I2); -} - -/* - * Class: SafeArray - * Method: setShort - * Signature: (IIS)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort__IIS - (JNIEnv *env, jobject _this, jint i, jint j, jshort c) -{ - SET2DCODE(VT_I2, V_I2); -} - -/* - * Class: SafeArray - * Method: getShorts - * Signature: (II[SI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getShorts - (JNIEnv *env, jobject _this, jint idx, jint nelem, jshortArray ja, jint ja_start) -{ - GETARRAYCODE(VT_I2, VT_I2, V_I2, jshort, SetShortArrayRegion); -} - -/* - * Class: SafeArray - * Method: setShorts - * Signature: (II[SI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShorts - (JNIEnv *env, jobject _this, jint idx, jint nelem, jshortArray ja, jint ja_start) -{ - SETARRAYCODE(VT_I2, VT_I2, V_I2, jshort, - GetShortArrayElements, ReleaseShortArrayElements); -} - -/* - * Class: SafeArray - * Method: getDouble - * Signature: (I)D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble__I - (JNIEnv *env, jobject _this, jint idx) -{ - GET1DCODE(VT_R8, V_R8, jdouble) -} - -/* - * Class: SafeArray - * Method: getDouble - * Signature: (II)D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - GET2DCODE(VT_R8, V_R8, jdouble) -} - -/* - * Class: SafeArray - * Method: setDouble - * Signature: (ID)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble__ID - (JNIEnv *env, jobject _this, jint idx, jdouble c) -{ - SET1DCODE(VT_R8, V_R8); -} - -/* - * Class: SafeArray - * Method: setDouble - * Signature: (IID)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble__IID - (JNIEnv *env, jobject _this, jint i, jint j, jdouble c) -{ - SET2DCODE(VT_R8, V_R8); -} - -/* - * Class: SafeArray - * Method: getDoubles - * Signature: (II[DI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getDoubles - (JNIEnv *env, jobject _this, jint idx, jint nelem, jdoubleArray ja, jint ja_start) -{ - GETARRAYCODE(VT_R8, VT_R8, V_R8, jdouble, SetDoubleArrayRegion); -} - -/* - * Class: SafeArray - * Method: setDoubles - * Signature: (II[DI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDoubles - (JNIEnv *env, jobject _this, jint idx, jint nelem, jdoubleArray ja, jint ja_start) -{ - SETARRAYCODE(VT_R8, VT_R8, V_R8, jdouble, - GetDoubleArrayElements, ReleaseDoubleArrayElements); -} - -/* - * Class: SafeArray - * Method: getString - * Signature: (I)Ljava/lang/String; - * - * There is supposed to be a leak in here, SourceForge 1224219 - * that should be fixed with a call to - * "StrFree, Release or VariantClear to release the memory" - * waiting on the actual patch the submitter used before modifying this - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString__I - (JNIEnv *env, jobject _this, jint idx) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); \ - return NULL; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - SafeArrayGetElement(psa, &idx, &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BSTR))) { - return NULL; - } - BSTR bs = V_BSTR(&v); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - // jacob report 1224219 - // SafeArrayGetElement memory must be freed http://www.canaimasoft.com/f90VB/OnlineManuals/Reference/TH_31.htm - VariantClear(&v); - return js; - } else if (vt == VT_BSTR) { - BSTR bs = NULL; - SafeArrayGetElement(psa, &idx, &bs); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - // jacob report 1224219 - // SafeArrayGetElement memory must be freed http://www.canaimasoft.com/f90VB/OnlineManuals/Reference/TH_31.htm - if (bs) SysFreeString(bs); - return js; - } - ThrowComFail(env, "safearray cannot get string", 0); - return NULL; -} - -/* - * Class: SafeArray - * Method: getString - * Signature: (II)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); \ - return NULL; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - long idx[2] = {i, j}; - SafeArrayGetElement(psa, idx, &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BSTR))) { - return NULL; - } - BSTR bs = V_BSTR(&v); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - return js; - } else if (vt == VT_BSTR) { - long idx[2] = {i, j}; - BSTR bs = NULL; - SafeArrayGetElement(psa, idx, &bs); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - return js; - } - ThrowComFail(env, "safearray cannot get string", 0); - return NULL; -} - -/* - * Class: SafeArray - * Method: setString - * Signature: (ILjava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString__ILjava_lang_String_2 - (JNIEnv *env, jobject _this, jint idx, jstring s) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); \ - return; - } - if (SafeArrayGetDim(sa) != 1) { - ThrowComFail(env, "safearray not 1D", -1); \ - return; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - V_VT(&v) = VT_BSTR; - V_BSTR(&v) = bs.Copy(); - SafeArrayPutElement(sa,&idx,&v); \ - env->ReleaseStringChars(s, str); - VariantClear(&v); - } else if (vt == VT_BSTR) { - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - SafeArrayPutElement(sa,&idx,bs.Detach()); - env->ReleaseStringChars(s, str); - } else { - ThrowComFail(env, "safearray cannot set string", 0); - } -} - -/* - * Class: SafeArray - * Method: setString - * Signature: (IILjava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString__IILjava_lang_String_2 - (JNIEnv *env, jobject _this, jint i, jint j, jstring s) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - if (SafeArrayGetDim(sa) != 2) { - ThrowComFail(env, "safearray is not 2D", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - V_VT(&v) = VT_BSTR; - V_BSTR(&v) = bs.Copy(); - long idx[2] = {i,j}; - SafeArrayPutElement(sa,idx,&v); - env->ReleaseStringChars(s, str); - VariantClear(&v); - } else if (vt == VT_BSTR) { - long idx[2] = {i,j}; - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - SafeArrayPutElement(sa,idx,bs.Detach()); - env->ReleaseStringChars(s, str); - } else { - ThrowComFail(env, "safearray cannot set string", 0); - } -} - -/* - * Class: SafeArray - * Method: getStrings - * Signature: (II[Ljava/lang/String;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getStrings - (JNIEnv *env, jobject _this, jint idx, jint nelem, jobjectArray ja, jint ja_start) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) - { - VARIANT v; - for(int i=idx, j=ja_start;iNewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - env->SetObjectArrayElement(ja, j, js); - VariantClear(&v); - } - } - else if (vt == VT_BSTR) - { - BSTR bs = NULL; - for(int i=idx, j=ja_start;iNewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - env->SetObjectArrayElement(ja, j, js); - } - } else { - ThrowComFail(env, "safearray cannot get strings", 0); - } -} - -/* - * Class: SafeArray - * Method: setStrings - * Signature: (II[Ljava/lang/String;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setStrings - (JNIEnv *env, jobject _this, jint idx, jint nelem, jobjectArray ja, jint ja_start) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(ja); - if (len > numElements(psa)) - { - len = numElements(psa); - } - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - for(int i=ja_start,j=idx;iGetObjectArrayElement(ja, i); - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - V_VT(&v) = VT_BSTR; - V_BSTR(&v) = bs.Copy(); - long x = j; - SafeArrayPutElement(psa,&x,&v); - VariantClear(&v); - env->ReleaseStringChars(s, str); - } - } else if (vt == VT_BSTR) { - for(int i=ja_start,j=idx;iGetObjectArrayElement(ja, i); - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - long x = j; - SafeArrayPutElement(psa,&x,bs.Detach()); - env->ReleaseStringChars(s, str); - } - } else { - ThrowComFail(env, "safearray cannot set strings", 0); - } -} - -/* - * Class: SafeArray - * Method: getByte - * Signature: (I)B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte__I - (JNIEnv *env, jobject _this, jint idx) -{ - GET1DCODE(VT_UI1, V_UI1, jbyte) -} - -/* - * Class: SafeArray - * Method: getByte - * Signature: (II)B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - GET2DCODE(VT_UI1, V_UI1, jbyte) -} - -/* - * Class: SafeArray - * Method: setByte - * Signature: (IB)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte__IB - (JNIEnv *env, jobject _this, jint idx, jbyte c) -{ - SET1DCODE(VT_UI1, V_UI1); -} - -/* - * Class: SafeArray - * Method: setByte - * Signature: (IIB)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte__IIB - (JNIEnv *env, jobject _this, jint i, jint j, jbyte c) -{ - SET2DCODE(VT_UI1, V_UI1); -} - -/* - * Class: SafeArray - * Method: getBytes - * Signature: (II[BI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getBytes - (JNIEnv *env, jobject _this, jint idx, jint nelem, jbyteArray ja, jint ja_start) -{ - GETARRAYCODE(VT_UI1, VT_I1, V_UI1, jbyte, SetByteArrayRegion); -} - -/* - * Class: SafeArray - * Method: setBytes - * Signature: (II[BI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBytes - (JNIEnv *env, jobject _this, jint idx, jint nelem, jbyteArray ja, jint ja_start) -{ - SETARRAYCODE(VT_UI1, VT_I1, V_UI1, jbyte, - GetByteArrayElements, ReleaseByteArrayElements); -} - -/* - * Class: SafeArray - * Method: getFloat - * Signature: (I)F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat__I - (JNIEnv *env, jobject _this, jint idx) -{ - GET1DCODE(VT_R4, V_R4, jfloat) -} - -/* - * Class: SafeArray - * Method: getFloat - * Signature: (II)F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - GET2DCODE(VT_R4, V_R4, jfloat) -} - -/* - * Class: SafeArray - * Method: setFloat - * Signature: (IF)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat__IF - (JNIEnv *env, jobject _this, jint idx, jfloat c) -{ - SET1DCODE(VT_R4, V_R4); -} - -/* - * Class: SafeArray - * Method: setFloat - * Signature: (IIF)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat__IIF - (JNIEnv *env, jobject _this, jint i, jint j, jfloat c) -{ - SET2DCODE(VT_R4, V_R4); -} - -/* - * Class: SafeArray - * Method: getFloats - * Signature: (II[FI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getFloats - (JNIEnv *env, jobject _this, jint idx, jint nelem, jfloatArray ja, jint ja_start) -{ - GETARRAYCODE(VT_R4, VT_R4, V_R4, jfloat, SetFloatArrayRegion); -} - -/* - * Class: SafeArray - * Method: setFloats - * Signature: (II[FI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloats - (JNIEnv *env, jobject _this, jint idx, jint nelem, jfloatArray ja, jint ja_start) -{ - SETARRAYCODE(VT_R4, VT_R4, V_R4, jfloat, - GetFloatArrayElements, ReleaseFloatArrayElements); -} - -/* - * Class: SafeArray - * Method: getBoolean - * Signature: (I)Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean__I - (JNIEnv *env, jobject _this, jint idx) -{ - // code is inline because of size mismatch - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - if (SafeArrayGetDim(sa) != 1) { - ThrowComFail(env, "safearray not 1D", -1); \ - return NULL; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - SafeArrayGetElement(sa, &idx, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BOOL))) { - ThrowComFail(env, "safearray change type failed", -1); \ - return NULL; - } - jboolean jb = V_BOOL(&v) == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE; - return jb; - } else if (vt == VT_BOOL) { - VARIANT_BOOL vb; - SafeArrayGetElement(sa, &idx, (void*) &vb); - jboolean jb = vb == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE; - return jb; - } else { - return NULL; - } -} - -/* - * Class: SafeArray - * Method: getBoolean - * Signature: (II)Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - // code is inline because of size mismatch - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - if (SafeArrayGetDim(sa) != 2) { - ThrowComFail(env, "safearray is not 2D", -1); - return NULL; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - long idx[2] = {i,j}; - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - SafeArrayGetElement(sa, idx, (void*) &v); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BOOL))) { - ThrowComFail(env, "safearray change type failed", -1); - return NULL; - } - jboolean jb = V_BOOL(&v) == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE; - return jb; - } else if (vt == VT_BOOL) { - VARIANT_BOOL vb; - SafeArrayGetElement(sa, idx, (void*) &vb); - jboolean jb = vb == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE; - return jb; - } else { - return NULL; - } -} - -/* - * Class: SafeArray - * Method: setBoolean - * Signature: (IZ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean__IZ - (JNIEnv *env, jobject _this, jint idx, jboolean c) -{ - // code is inline because of size mismatch - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - if (SafeArrayGetDim(sa) != 1) { - ThrowComFail(env, "safearray is not 1D", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_BOOL; - V_BOOL(&v) = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE; - SafeArrayPutElement(sa,&idx,&v); - } else if (vt == VT_BOOL) { - VARIANT_BOOL vb = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE; - SafeArrayPutElement(sa,&idx,&vb); - } else { - ThrowComFail(env, "safearray type mismatch", -1); - } -} - -/* - * Class: SafeArray - * Method: setBoolean - * Signature: (IIZ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean__IIZ - (JNIEnv *env, jobject _this, jint i, jint j, jboolean c) -{ - // code is inline because of size mismatch - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - if (SafeArrayGetDim(sa) != 2) { - ThrowComFail(env, "safearray is not 2D", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - long idx[2] = {i,j}; - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_BOOL; - V_BOOL(&v) = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE; - SafeArrayPutElement(sa,idx,&v); - } else if (vt == VT_BOOL) { - VARIANT_BOOL vb = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE; - SafeArrayPutElement(sa,idx,&vb); - } else { - ThrowComFail(env, "safearray type mismatch", -1); - } -} - -/* - * Class: SafeArray - * Method: getBooleans - * Signature: (II[ZI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getBooleans - (JNIEnv *env, jobject _this, jint idx, jint nelem, jbooleanArray ja, jint ja_start) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_BOOL) { - VARIANT_BOOL v; - for(int i=idx, j=ja_start;iSetBooleanArrayRegion(ja, j, 1, &val); - } - } else if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - for(int i=idx, j=ja_start;iSetBooleanArrayRegion(ja, j, 1, &val); - } - } -} - -/* - * Class: SafeArray - * Method: setBooleans - * Signature: (II[ZI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBooleans - (JNIEnv *env, jobject _this, jint idx, jint nelem, jbooleanArray ja, jint ja_start) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(ja); - if (len > numElements(psa)) - { - len = numElements(psa); - } - jboolean *arrayElements = env->GetBooleanArrayElements(ja, 0); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_BOOL; - for(int i=ja_start,j=idx;iReleaseBooleanArrayElements(ja, arrayElements, 0); -} - -/* - * Class: SafeArray - * Method: getVariant - * Signature: (I)LVariant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__I - (JNIEnv *env, jobject _this, jint idx) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - // prepare a new return value - jclass variantClass = env->FindClass("com/jacob/com/Variant"); - jmethodID variantCons = - env->GetMethodID(variantClass, "", "()V"); - // construct a variant to return - jobject newVariant = env->NewObject(variantClass, variantCons); - // get the VARIANT from the newVariant - VARIANT *v = extractVariant(env, newVariant); - if (vt == VT_VARIANT) { - SafeArrayGetElement(psa, &idx, v); - } else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) { - IDispatch *disp; - SafeArrayGetElement(psa, &idx, (void *)&disp); - VariantClear(v); // whatever was there before - V_VT(v) = VT_DISPATCH; - V_DISPATCH(v) = disp; - // I am handing the pointer to COM - disp->AddRef(); - } else { - ThrowComFail(env, "safearray type is not variant/dispatch", -1); - } - return newVariant; -} - -/* - * Class: SafeArray - * Method: getVariant - * Signature: (II)LVariant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__II - (JNIEnv *env, jobject _this, jint i, jint j) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - // prepare a new return value - jclass variantClass = env->FindClass("com/jacob/com/Variant"); - jmethodID variantCons = - env->GetMethodID(variantClass, "", "()V"); - // construct a variant to return - jobject newVariant = env->NewObject(variantClass, variantCons); - // get the VARIANT from the newVariant - VARIANT *v = extractVariant(env, newVariant); - long idx[2] = {i,j}; - if (vt == VT_VARIANT) { - SafeArrayGetElement(psa, idx, v); - } else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) { - IDispatch *disp; - SafeArrayGetElement(psa, idx, (void *)&disp); - VariantClear(v); // whatever was there before - V_VT(v) = VT_DISPATCH; - V_DISPATCH(v) = disp; - // I am handing the pointer to COM - disp->AddRef(); - } else { - ThrowComFail(env, "safearray type is not variant/dispatch", -1); - } - return newVariant; -} - -/* - * Class: SafeArray - * Method: setVariant - * Signature: (ILVariant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant__ILcom_jacob_com_Variant_2 - (JNIEnv *env, jobject _this, jint idx, jobject s) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - if (SafeArrayGetDim(sa) != 1) { - ThrowComFail(env, "safearray is not 1D", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - VARIANT *v = extractVariant(env, s); - if (vt == VT_VARIANT) { - SafeArrayPutElement(sa,&idx,v); - } else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) { - if (V_VT(v) != VT_DISPATCH) { - ThrowComFail(env, "variant is not dispatch", -1); - return; - } - IDispatch *disp = V_DISPATCH(v); - disp->AddRef(); - SafeArrayPutElement(sa,&idx,disp); - } else { - ThrowComFail(env, "safearray type is not variant/dispatch", -1); - } -} - -/* - * Class: SafeArray - * Method: setVariant - * Signature: (IILVariant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant__IILcom_jacob_com_Variant_2 - (JNIEnv *env, jobject _this, jint i, jint j, jobject s) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - if (SafeArrayGetDim(sa) != 2) { - ThrowComFail(env, "safearray is not 2D", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - long idx[2] = {i, j}; - if (vt == VT_VARIANT) { - VARIANT *v = extractVariant(env, s); - SafeArrayPutElement(sa,idx,v); - } else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) { - VARIANT *v = extractVariant(env, s); - if (V_VT(v) != VT_DISPATCH) { - ThrowComFail(env, "variant is not dispatch", -1); - return; - } - IDispatch *disp = V_DISPATCH(v); - SafeArrayPutElement(sa,idx,disp); - } else { - ThrowComFail(env, "safearray type is not variant/dispatch", -1); - } -} - -/* - * Class: SafeArray - * Method: getVariants - * Signature: (II[LVariant;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getVariants - (JNIEnv *env, jobject _this, jint idx, jint nelem, jobjectArray ja, jint ja_start) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - long lb, ub; - SafeArrayGetLBound(sa, 1, &lb); - SafeArrayGetUBound(sa, 1, &ub); - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) - { - jclass variantClass = env->FindClass("com/jacob/com/Variant"); - jmethodID variantCons = - env->GetMethodID(variantClass, "", "()V"); - for(int i=idx, j=ja_start;iNewObject(variantClass, variantCons); - // get the VARIANT from the newVariant - VARIANT *v = extractVariant(env, newVariant); - SafeArrayGetElement(sa, &ix, (void*) v); - env->SetObjectArrayElement(ja, j, newVariant); - } - } else { - ThrowComFail(env, "safearray type is not variant", -1); - } -} - -/* - * Class: SafeArray - * Method: setVariants - * Signature: (II[LVariant;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariants - (JNIEnv *env, jobject _this, jint idx, jint nelem, jobjectArray ja, jint ja_start) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - int len = env->GetArrayLength(ja); - if (len > numElements(psa)) - { - len = numElements(psa); - } - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - for(int i=ja_start,j=idx;iGetObjectArrayElement(ja, i); - VARIANT *v = extractVariant(env, var); - long x = j; - SafeArrayPutElement(psa,&x,v); - } - } else { - ThrowComFail(env, "safearray type is not variant", -1); - } -} - -/* PLEASE NOTE THE LINE: - jint *jIndices = env->GetIntArrayElements(indices, NULL); - which I added to replace "long idx[2] = {i,j};" from the 2D case. - Not sure if this is correct. Also, check that I am doing the null test and - dimension test correctly. - Would really like to call env->ReleaseIntArrayElements(indices, jIndices, NULL); - in here but I can't get it to work -*/ - -#define GETNDCODE(varType, varAccess, jtyp) \ - SAFEARRAY *sa = extractSA(env, _this); \ - if (!sa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return NULL; \ - } \ - jint *jIndices = env->GetIntArrayElements(indices, NULL); \ - if (!jIndices) { \ - ThrowComFail(env, "null indices array", -1); \ - return NULL; \ - } \ - if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { \ - ThrowComFail(env, "safearray and indices array have different dimensions", -1); \ - return NULL; \ - } \ - VARTYPE vt; \ - SafeArrayGetVartype(sa, &vt); \ - if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - SafeArrayGetElement(sa, jIndices, (void*) &v); \ - if (FAILED(VariantChangeType(&v, &v, 0, varType))) { \ - ThrowComFail(env, "VariantChangeType failed", -1); \ - return NULL; \ - } \ - return (jtyp)varAccess(&v); \ - } else if (vt == varType) { \ - jtyp jc; \ - SafeArrayGetElement(sa, jIndices, (void*) &jc); \ - return jc; \ - } else { \ - return NULL; \ - } - - -//--------------------------------- - -/* PLEASE NOTE THE LINE: - jint *jIndices = env->GetIntArrayElements(indices, NULL); - which I added to replace "long idx[2] = {i,j};" from the 2D case. - Not sure if this is correct. Also, check that I am doing the null test and - dimension test correctly. - Would really like to call env->ReleaseIntArrayElements(indices, jIndices, NULL); - in here but I can't get it to work - */ - -#define SETNDCODE(varType, varAccess) \ - SAFEARRAY *sa = extractSA(env, _this); \ - if (!sa) { \ - ThrowComFail(env, "safearray object corrupted", -1); \ - return; \ - } \ - jint *jIndices = env->GetIntArrayElements(indices, NULL); \ - if (!jIndices) { \ - ThrowComFail(env, "null indices array", -1); \ - return; \ - } \ - if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { \ - ThrowComFail(env, "safearray and indices array have different dimensions", -1); \ - return; \ - } \ - VARTYPE vt; \ - SafeArrayGetVartype(sa, &vt); \ - if (vt == VT_VARIANT) { \ - VARIANT v; \ - VariantInit(&v); \ - V_VT(&v) = varType; \ - varAccess(&v) = c; \ - SafeArrayPutElement(sa,jIndices,&v); \ - } else if (vt == varType) { \ - SafeArrayPutElement(sa, jIndices,&c); \ - } else { \ - ThrowComFail(env, "safearray type mismatch", -1); \ - } - -/* - * Class: com_jacob_com_SafeArray - * Method: getVariant - * Signature: ([I)Lcom/jacob/com/Variant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - - // ??? Not sure if this is correct type for call to SafeArrayGetElement() - jint *jIndices = env->GetIntArrayElements(indices, NULL); - - if (!jIndices) { - ThrowComFail(env, "null indices array", -1); - return NULL; - } - if (SafeArrayGetDim(psa) != env->GetArrayLength(indices)) { - ThrowComFail(env, "safearray and indices array have different dimensions", -1); - return NULL; - } - - - // prepare a new return value - jclass variantClass = env->FindClass("com/jacob/com/Variant"); - jmethodID variantCons = - env->GetMethodID(variantClass, "", "()V"); - // construct a variant to return - jobject newVariant = env->NewObject(variantClass, variantCons); - // get the VARIANT from the newVariant - VARIANT *v = extractVariant(env, newVariant); - if (vt == VT_VARIANT) { - SafeArrayGetElement(psa, jIndices, v); - } else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) { - IDispatch *disp; - SafeArrayGetElement(psa, jIndices, (void *)&disp); - VariantClear(v); // whatever was there before - V_VT(v) = VT_DISPATCH; - V_DISPATCH(v) = disp; - // I am handing the pointer to COM - disp->AddRef(); - } else { - ThrowComFail(env, "safearray type is not variant/dispatch", -1); - } - env->ReleaseIntArrayElements(indices, jIndices, NULL); - return newVariant; -} - -/* - * Class: com_jacob_com_SafeArray - * Method: setVariant - * Signature: ([ILcom/jacob/com/Variant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant___3ILcom_jacob_com_Variant_2 - (JNIEnv *env, jobject _this, jintArray indices, jobject s) -{ - - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - - // ??? Not sure if this is correct type for call to SafeArrayGetElement() - jint *jIndices = env->GetIntArrayElements(indices, NULL); - - if (!jIndices) { - ThrowComFail(env, "null indices array", -1); - return; - } - if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { - ThrowComFail(env, "safearray and indices array have different dimensions", -1); - return; - } - - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - - if (vt == VT_VARIANT) { - VARIANT *v = extractVariant(env, s); - SafeArrayPutElement(sa, jIndices, v); - } else if (vt == VT_DISPATCH || vt == VT_UNKNOWN) { - VARIANT *v = extractVariant(env, s); - if (V_VT(v) != VT_DISPATCH) { - ThrowComFail(env, "variant is not dispatch", -1); - return; - } - IDispatch *disp = V_DISPATCH(v); - SafeArrayPutElement(sa, jIndices, disp); - } else { - ThrowComFail(env, "safearray type is not variant/dispatch", -1); - } - env->ReleaseIntArrayElements(indices, jIndices, NULL); -} - -/* - * Class: com_jacob_com_SafeArray - * Method: getChar - * Signature: ([I)C - */ -JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - GETNDCODE(VT_UI2, V_UI2, jchar) -} - -/* - * Class: com_jacob_com_SafeArray - * Method: setChar - * Signature: ([IC)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar___3IC - (JNIEnv *env, jobject _this, jintArray indices, jchar c) -{ - SETNDCODE(VT_UI2, V_UI2); -} - -/*----------------------- INTS ----------------------------------*/ - -/* - * Class: com_jacob_com_SafeArray - * Method: getInt - * Signature: ([I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - GETNDCODE(VT_I4, V_I4, jint) -} - - -/* - * Class: com_jacob_com_SafeArray - * Method: setInt - * Signature: ([II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt___3II - (JNIEnv *env, jobject _this, jintArray indices, jint c) -{ - SETNDCODE(VT_I4, V_I4); -} - -/*----------------------- END INTS ----------------------------------*/ -/*----------------------- LONGS ----------------------------------*/ - -/* - * Class: com_jacob_com_SafeArray - * Method: getLong - * Signature: ([I)J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_SafeArray_getLong___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - GETNDCODE(VT_I8, V_I8, jlong) -} - - -/* - * Class: com_jacob_com_SafeArray - * Method: setLong - * Signature: ([IJ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLong___3IJ - (JNIEnv *env, jobject _this, jintArray indices, jlong c) -{ - SETNDCODE(VT_I8, V_I8); -} - -/*----------------------- END LONGS ----------------------------------*/ - -/* - * Class: com_jacob_com_SafeArray - * Method: getShort - * Signature: ([I)S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - GETNDCODE(VT_I2, V_I2, jshort) -} - -/* - * Class: com_jacob_com_SafeArray - * Method: setShort - * Signature: ([IS)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort___3IS - (JNIEnv *env, jobject _this, jintArray indices, jshort c) -{ - SETNDCODE(VT_I2, V_I2); -} - -/* - * Class: com_jacob_com_SafeArray - * Method: getDouble - * Signature: ([I)D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - GETNDCODE(VT_R8, V_R8, jdouble) -} - -/* - * Class: com_jacob_com_SafeArray - * Method: setDouble - * Signature: ([ID)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble___3ID - (JNIEnv *env, jobject _this, jintArray indices, jdouble c) -{ - SETNDCODE(VT_R8, V_R8); -} - -/* - * Class: com_jacob_com_SafeArray - * Method: getString - * Signature: ([I)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - SAFEARRAY *psa = extractSA(env, _this); - if (!psa) { - ThrowComFail(env, "safearray object corrupted", -1); \ - return NULL; - } - - // ??? Not sure if this is correct type for call to SafeArrayGetElement() - jint *jIndices = env->GetIntArrayElements(indices, NULL); - - if (!jIndices) { - ThrowComFail(env, "null indices array", -1); - return NULL; - } - if (SafeArrayGetDim(psa) != env->GetArrayLength(indices)) { - ThrowComFail(env, "safearray and indices array have different dimensions", -1); - return NULL; - } - - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - SafeArrayGetElement(psa, jIndices, &v); - env->ReleaseIntArrayElements(indices, jIndices, NULL); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BSTR))) { - return NULL; - } - BSTR bs = V_BSTR(&v); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - return js; - } else if (vt == VT_BSTR) { - BSTR bs = NULL; - SafeArrayGetElement(psa, jIndices, &bs); - env->ReleaseIntArrayElements(indices, jIndices, NULL); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs)); // SR cast SF 1689061 - return js; - } else { - ThrowComFail(env, "safearray cannot get string", 0); - env->ReleaseIntArrayElements(indices, jIndices, NULL); - return NULL; - } -} - - -/* - * Class: com_jacob_com_SafeArray - * Method: setStringjIndices, NULL);ILjava/lang/String;)V - * - * This method has a leak in it somewhere. - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString___3ILjava_lang_String_2 - (JNIEnv *env, jobject _this, jintArray indices, jstring s) -{ - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - - // ??? Not sure if this is correct type for call to SafeArrayGetElement() - // could have individually retrieved the indicies - jint *jIndices = env->GetIntArrayElements(indices, NULL); - - if (!jIndices) { - ThrowComFail(env, "null indices array", -1); - return; - } - if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { - ThrowComFail(env, "safearray and indices array have different dimensions", -1); - return; - } - - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - V_VT(&v) = VT_BSTR; - V_BSTR(&v) = bs.Copy(); - SafeArrayPutElement(sa, jIndices,&v); - env->ReleaseStringChars(s, str); - VariantClear(&v); - } else if (vt == VT_BSTR) { - // SF 2847577 support unicode move from GetStringUTFChars() to GetStringChars() - const jchar *str = env->GetStringChars(s, NULL); - CComBSTR bs((LPCOLESTR)str); - SafeArrayPutElement(sa, jIndices,bs.Detach()); - env->ReleaseStringChars(s, str); - } else { - ThrowComFail(env, "safearray cannot set string", 0); - } - // need to unpin the copied array SF: 1775889 - env->ReleaseIntArrayElements(indices, jIndices, NULL); -} - -/* - * Class: com_jacob_com_SafeArray - * Method: getByte - * Signature: ([I)B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - GETNDCODE(VT_UI1, V_UI1, jbyte) -} - -/* - * Class: com_jacob_com_SafeArray - * Method: setByte - * Signature: ([IB)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte___3IB - (JNIEnv *env, jobject _this, jintArray indices, jbyte c) -{ - SETNDCODE(VT_UI1, V_UI1); -} - -/* - * Class: com_jacob_com_SafeArray - * Method: getFloat - * Signature: ([I)F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - GETNDCODE(VT_R4, V_R4, jfloat) -} - - -/* - * Class: com_jacob_com_SafeArray - * Method: setFloat - * Signature: ([IF)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat___3IF - (JNIEnv *env, jobject _this, jintArray indices, jfloat c) -{ - SETNDCODE(VT_R4, V_R4); -} - -/* - * Class: com_jacob_com_SafeArray - * Method: getBoolean - * Signature: ([I)Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean___3I - (JNIEnv *env, jobject _this, jintArray indices) -{ - // code is inline because of size mismatch - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return NULL; - } - // ??? Not sure if this is correct type for call to SafeArrayGetElement() - jint *jIndices = env->GetIntArrayElements(indices, NULL); - - if (!jIndices) { - ThrowComFail(env, "null indices array", -1); - return NULL; - } - if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { - ThrowComFail(env, "safearray and indices array have different dimensions", -1); - return NULL; - } - - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - SafeArrayGetElement(sa, jIndices, (void*) &v); - env->ReleaseIntArrayElements(indices, jIndices, NULL); - if (FAILED(VariantChangeType(&v, &v, 0, VT_BOOL))) { - ThrowComFail(env, "safearray change type failed", -1); - return NULL; - } - jboolean jb = V_BOOL(&v) == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE; - return jb; - } else if (vt == VT_BOOL) { - VARIANT_BOOL vb; - SafeArrayGetElement(sa, jIndices, (void*) &vb); - env->ReleaseIntArrayElements(indices, jIndices, NULL); - jboolean jb = vb == VARIANT_TRUE ? JNI_TRUE: JNI_FALSE; - return jb; - } else { - env->ReleaseIntArrayElements(indices, jIndices, NULL); - return NULL; - } -} - -/* - * Class: com_jacob_com_SafeArray - * Method: setBoolean - * Signature: ([IZ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean___3IZ - (JNIEnv *env, jobject _this, jintArray indices, jboolean c) -{ - // code is inline because of size mismatch - SAFEARRAY *sa = extractSA(env, _this); - if (!sa) { - ThrowComFail(env, "safearray object corrupted", -1); - return; - } - // ??? Not sure if this is correct type for call to SafeArrayGetElement() - jint *jIndices = env->GetIntArrayElements(indices, NULL); - - if (!jIndices) { - ThrowComFail(env, "null indices array", -1); - return; - } - if (SafeArrayGetDim(sa) != env->GetArrayLength(indices)) { - ThrowComFail(env, "safearray and indices array have different dimensions", -1); - return; - } - - VARTYPE vt; - SafeArrayGetVartype(sa, &vt); - if (vt == VT_VARIANT) { - VARIANT v; - VariantInit(&v); - V_VT(&v) = VT_BOOL; - V_BOOL(&v) = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE; - SafeArrayPutElement(sa,jIndices,&v); - } else if (vt == VT_BOOL) { - VARIANT_BOOL vb = c == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE; - SafeArrayPutElement(sa,jIndices,&vb); - } else { - ThrowComFail(env, "safearray type mismatch", -1); - } - env->ReleaseIntArrayElements(indices, jIndices, NULL); -} - - -} diff --git a/jni/SafeArray.h b/jni/SafeArray.h deleted file mode 100644 index a20038e..0000000 --- a/jni/SafeArray.h +++ /dev/null @@ -1,940 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -/* Header for class com_jacob_com_SafeArray */ - -#ifndef _Included_com_jacob_com_SafeArray -#define _Included_com_jacob_com_SafeArray -#ifdef __cplusplus -extern "C" { -#endif -/* Inaccessible static: buildVersion */ -/* Inaccessible static: buildDate */ -/* Inaccessible static: DEBUG */ -/* Inaccessible static: class_00024com_00024jacob_00024com_00024JacobObject */ -/* - * Class: com_jacob_com_SafeArray - * Method: init - * Signature: (I[I[I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_init - (JNIEnv *, jobject, jint, jintArray, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: clone - * Signature: ()Ljava/lang/Object; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_clone - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: destroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_destroy - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getvt - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getvt - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: reinit - * Signature: (Lcom/jacob/com/SafeArray;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_reinit - (JNIEnv *, jobject, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: reinterpretType - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_reinterpretType - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getLBound - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getLBound__ - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getLBound - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getLBound__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getUBound - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getUBound__ - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getUBound - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getUBound__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getNumDim - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getNumDim - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getFeatures - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getFeatures - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getElemSize - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getElemSize - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromCharArray - * Signature: ([C)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromCharArray - (JNIEnv *, jobject, jcharArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromIntArray - * Signature: ([I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromIntArray - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromLongArray - * Signature: ([L)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromLongArray - (JNIEnv *, jobject, jlongArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromShortArray - * Signature: ([S)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromShortArray - (JNIEnv *, jobject, jshortArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromDoubleArray - * Signature: ([D)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromDoubleArray - (JNIEnv *, jobject, jdoubleArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromStringArray - * Signature: ([Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromStringArray - (JNIEnv *, jobject, jobjectArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromByteArray - * Signature: ([B)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromByteArray - (JNIEnv *, jobject, jbyteArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromFloatArray - * Signature: ([F)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromFloatArray - (JNIEnv *, jobject, jfloatArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromBooleanArray - * Signature: ([Z)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromBooleanArray - (JNIEnv *, jobject, jbooleanArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: fromVariantArray - * Signature: ([Lcom/jacob/com/Variant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_fromVariantArray - (JNIEnv *, jobject, jobjectArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: toCharArray - * Signature: ()[C - */ -JNIEXPORT jcharArray JNICALL Java_com_jacob_com_SafeArray_toCharArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toIntArray - * Signature: ()[I - */ -JNIEXPORT jintArray JNICALL Java_com_jacob_com_SafeArray_toIntArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toLongArray - * Signature: ()[L - */ -JNIEXPORT jlongArray JNICALL Java_com_jacob_com_SafeArray_toLongArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toShortArray - * Signature: ()[S - */ -JNIEXPORT jshortArray JNICALL Java_com_jacob_com_SafeArray_toShortArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toDoubleArray - * Signature: ()[D - */ -JNIEXPORT jdoubleArray JNICALL Java_com_jacob_com_SafeArray_toDoubleArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toStringArray - * Signature: ()[Ljava/lang/String; - */ -JNIEXPORT jobjectArray JNICALL Java_com_jacob_com_SafeArray_toStringArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toByteArray - * Signature: ()[B - */ -JNIEXPORT jbyteArray JNICALL Java_com_jacob_com_SafeArray_toByteArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toFloatArray - * Signature: ()[F - */ -JNIEXPORT jfloatArray JNICALL Java_com_jacob_com_SafeArray_toFloatArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toBooleanArray - * Signature: ()[Z - */ -JNIEXPORT jbooleanArray JNICALL Java_com_jacob_com_SafeArray_toBooleanArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: toVariantArray - * Signature: ()[Lcom/jacob/com/Variant; - */ -JNIEXPORT jobjectArray JNICALL Java_com_jacob_com_SafeArray_toVariantArray - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getChar - * Signature: (I)C - */ -JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getChar - * Signature: (II)C - */ -JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setChar - * Signature: (IC)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar__IC - (JNIEnv *, jobject, jint, jchar); - -/* - * Class: com_jacob_com_SafeArray - * Method: setChar - * Signature: (IIC)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar__IIC - (JNIEnv *, jobject, jint, jint, jchar); - -/* - * Class: com_jacob_com_SafeArray - * Method: getChars - * Signature: (II[CI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getChars - (JNIEnv *, jobject, jint, jint, jcharArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setChars - * Signature: (II[CI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChars - (JNIEnv *, jobject, jint, jint, jcharArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getInt - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getInt - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setInt - * Signature: (II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setInt - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt__III - (JNIEnv *, jobject, jint, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getInts - * Signature: (II[II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getInts - (JNIEnv *, jobject, jint, jint, jintArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setInts - * Signature: (II[II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInts - (JNIEnv *, jobject, jint, jint, jintArray, jint); - -/* - * Class: SafeArray - * Method: getLong - * Signature: (I)J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_SafeArray_getLong__I - (JNIEnv *env, jobject _this, jint idx); - -/* - * Class: SafeArray - * Method: getLong - * Signature: (II)J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_SafeArray_getLong__II - (JNIEnv *env, jobject _this, jint i, jint j); - -/* - * Class: SafeArray - * Method: setLong - * Signature: (IJ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLong__IJ - (JNIEnv *env, jobject _this, jint idx, jlong c); - -/* - * Class: SafeArray - * Method: setLong - * Signature: (IIJ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLong__IIJ - (JNIEnv *env, jobject _this, jint i, jint j, jlong c); - -/* - * Class: SafeArray - * Method: getLongs - * Signature: (II[JI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getLongs - (JNIEnv *env, jobject _this, jint idx, jint nelem, jlongArray ja, jint ja_start); - -/* - * Class: SafeArray - * Method: setLongs - * Signature: (II[JI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLongs - (JNIEnv *env, jobject _this, jint idx, jint nelem, jlongArray ja, jint ja_start); - -/* - * Class: com_jacob_com_SafeArray - * Method: getShort - * Signature: (I)S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getShort - * Signature: (II)S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setShort - * Signature: (IS)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort__IS - (JNIEnv *, jobject, jint, jshort); - -/* - * Class: com_jacob_com_SafeArray - * Method: setShort - * Signature: (IIS)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort__IIS - (JNIEnv *, jobject, jint, jint, jshort); - -/* - * Class: com_jacob_com_SafeArray - * Method: getShorts - * Signature: (II[SI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getShorts - (JNIEnv *, jobject, jint, jint, jshortArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setShorts - * Signature: (II[SI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShorts - (JNIEnv *, jobject, jint, jint, jshortArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getDouble - * Signature: (I)D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getDouble - * Signature: (II)D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setDouble - * Signature: (ID)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble__ID - (JNIEnv *, jobject, jint, jdouble); - -/* - * Class: com_jacob_com_SafeArray - * Method: setDouble - * Signature: (IID)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble__IID - (JNIEnv *, jobject, jint, jint, jdouble); - -/* - * Class: com_jacob_com_SafeArray - * Method: getDoubles - * Signature: (II[DI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getDoubles - (JNIEnv *, jobject, jint, jint, jdoubleArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setDoubles - * Signature: (II[DI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDoubles - (JNIEnv *, jobject, jint, jint, jdoubleArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getString - * Signature: (I)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getString - * Signature: (II)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setString - * Signature: (ILjava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString__ILjava_lang_String_2 - (JNIEnv *, jobject, jint, jstring); - -/* - * Class: com_jacob_com_SafeArray - * Method: setString - * Signature: (IILjava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString__IILjava_lang_String_2 - (JNIEnv *, jobject, jint, jint, jstring); - -/* - * Class: com_jacob_com_SafeArray - * Method: getStrings - * Signature: (II[Ljava/lang/String;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getStrings - (JNIEnv *, jobject, jint, jint, jobjectArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setStrings - * Signature: (II[Ljava/lang/String;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setStrings - (JNIEnv *, jobject, jint, jint, jobjectArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getByte - * Signature: (I)B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getByte - * Signature: (II)B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setByte - * Signature: (IB)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte__IB - (JNIEnv *, jobject, jint, jbyte); - -/* - * Class: com_jacob_com_SafeArray - * Method: setByte - * Signature: (IIB)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte__IIB - (JNIEnv *, jobject, jint, jint, jbyte); - -/* - * Class: com_jacob_com_SafeArray - * Method: getBytes - * Signature: (II[BI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getBytes - (JNIEnv *, jobject, jint, jint, jbyteArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setBytes - * Signature: (II[BI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBytes - (JNIEnv *, jobject, jint, jint, jbyteArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getFloat - * Signature: (I)F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getFloat - * Signature: (II)F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setFloat - * Signature: (IF)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat__IF - (JNIEnv *, jobject, jint, jfloat); - -/* - * Class: com_jacob_com_SafeArray - * Method: setFloat - * Signature: (IIF)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat__IIF - (JNIEnv *, jobject, jint, jint, jfloat); - -/* - * Class: com_jacob_com_SafeArray - * Method: getFloats - * Signature: (II[FI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getFloats - (JNIEnv *, jobject, jint, jint, jfloatArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setFloats - * Signature: (II[FI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloats - (JNIEnv *, jobject, jint, jint, jfloatArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getBoolean - * Signature: (I)Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getBoolean - * Signature: (II)Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setBoolean - * Signature: (IZ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean__IZ - (JNIEnv *, jobject, jint, jboolean); - -/* - * Class: com_jacob_com_SafeArray - * Method: setBoolean - * Signature: (IIZ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean__IIZ - (JNIEnv *, jobject, jint, jint, jboolean); - -/* - * Class: com_jacob_com_SafeArray - * Method: getBooleans - * Signature: (II[ZI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getBooleans - (JNIEnv *, jobject, jint, jint, jbooleanArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setBooleans - * Signature: (II[ZI)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBooleans - (JNIEnv *, jobject, jint, jint, jbooleanArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getVariant - * Signature: (I)Lcom/jacob/com/Variant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__I - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getVariant - * Signature: (II)Lcom/jacob/com/Variant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant__II - (JNIEnv *, jobject, jint, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setVariant - * Signature: (ILcom/jacob/com/Variant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant__ILcom_jacob_com_Variant_2 - (JNIEnv *, jobject, jint, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: setVariant - * Signature: (IILcom/jacob/com/Variant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant__IILcom_jacob_com_Variant_2 - (JNIEnv *, jobject, jint, jint, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getVariants - * Signature: (II[Lcom/jacob/com/Variant;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_getVariants - (JNIEnv *, jobject, jint, jint, jobjectArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: setVariants - * Signature: (II[Lcom/jacob/com/Variant;I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariants - (JNIEnv *, jobject, jint, jint, jobjectArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getVariant - * Signature: ([I)Lcom/jacob/com/Variant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_SafeArray_getVariant___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setVariant - * Signature: ([ILcom/jacob/com/Variant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setVariant___3ILcom_jacob_com_Variant_2 - (JNIEnv *, jobject, jintArray, jobject); - -/* - * Class: com_jacob_com_SafeArray - * Method: getChar - * Signature: ([I)C - */ -JNIEXPORT jchar JNICALL Java_com_jacob_com_SafeArray_getChar___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setChar - * Signature: ([IC)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setChar___3IC - (JNIEnv *, jobject, jintArray, jchar); - -/* - * Class: com_jacob_com_SafeArray - * Method: getInt - * Signature: ([I)I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_SafeArray_getInt___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setInt - * Signature: ([II)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setInt___3II - (JNIEnv *, jobject, jintArray, jint); - -/* - * Class: com_jacob_com_SafeArray - * Method: getLong - * Signature: ([I)J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_SafeArray_getLong___3I - (JNIEnv *env, jobject _this, jintArray indices); - -/* - * Class: com_jacob_com_SafeArray - * Method: setLong - * Signature: ([IJ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setLong___3IJ - (JNIEnv *env, jobject _this, jintArray indices, jlong c); - - -/* - * Class: com_jacob_com_SafeArray - * Method: getShort - * Signature: ([I)S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_SafeArray_getShort___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setShort - * Signature: ([IS)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setShort___3IS - (JNIEnv *, jobject, jintArray, jshort); - -/* - * Class: com_jacob_com_SafeArray - * Method: getDouble - * Signature: ([I)D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_SafeArray_getDouble___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setDouble - * Signature: ([ID)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setDouble___3ID - (JNIEnv *, jobject, jintArray, jdouble); - -/* - * Class: com_jacob_com_SafeArray - * Method: getString - * Signature: ([I)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_SafeArray_getString___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setString - * Signature: ([ILjava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setString___3ILjava_lang_String_2 - (JNIEnv *, jobject, jintArray, jstring); - -/* - * Class: com_jacob_com_SafeArray - * Method: getByte - * Signature: ([I)B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_SafeArray_getByte___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setByte - * Signature: ([IB)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setByte___3IB - (JNIEnv *, jobject, jintArray, jbyte); - -/* - * Class: com_jacob_com_SafeArray - * Method: getFloat - * Signature: ([I)F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_SafeArray_getFloat___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setFloat - * Signature: ([IF)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setFloat___3IF - (JNIEnv *, jobject, jintArray, jfloat); - -/* - * Class: com_jacob_com_SafeArray - * Method: getBoolean - * Signature: ([I)Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_SafeArray_getBoolean___3I - (JNIEnv *, jobject, jintArray); - -/* - * Class: com_jacob_com_SafeArray - * Method: setBoolean - * Signature: ([IZ)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_setBoolean___3IZ - (JNIEnv *, jobject, jintArray, jboolean); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/jni/StdAfx.h b/jni/StdAfx.h deleted file mode 100644 index 3d1a2d2..0000000 --- a/jni/StdAfx.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__9988E984_6789_11D3_A646_000000000000__INCLUDED_) -#define AFX_STDAFX_H__9988E984_6789_11D3_A646_000000000000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef STRICT -#define STRICT -#endif -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -//#define _ATL_APARTMENT_THREADED -#include -#include -#include -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -//#include - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__9988E984_6789_11D3_A646_000000000000__INCLUDED) diff --git a/jni/Variant.cpp b/jni/Variant.cpp deleted file mode 100644 index 7f13de0..0000000 --- a/jni/Variant.cpp +++ /dev/null @@ -1,1274 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "stdafx.h" -#include "Variant.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include -#include "util.h" - -extern "C" -{ - -#define VARIANT_FLD "m_pVariant" - -// extract a VARIANT from a Variant object -VARIANT *extractVariant(JNIEnv *env, jobject arg) -{ - jclass argClass = env->GetObjectClass(arg); - jfieldID ajf = env->GetFieldID( argClass, VARIANT_FLD, "I"); - jint anum = env->GetIntField(arg, ajf); - VARIANT *v = (VARIANT *)anum; - return v; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_release - (JNIEnv *env, jobject _this) -{ - jclass clazz = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID(clazz, VARIANT_FLD, "I"); - VARIANT *v = extractVariant(env, _this); - if (v) { - // fix byref leak - if (V_VT(v) & VT_BYREF) // is this a reference - { - void *pMem = V_BSTRREF(v); // get allocated memory - if (pMem) - { - if (V_VT(v) == (VT_BYREF|VT_BSTR)) - { - BSTR *pBstr = (BSTR*)pMem; - if (*pBstr) - SysFreeString(*pBstr);// release bstr - } - CoTaskMemFree(pMem); - } - } - VariantClear(v); - delete v; - env->SetIntField(_this, jf, (unsigned int)0); - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_init - (JNIEnv *env, jobject _this) -{ - jclass clazz = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID( clazz, VARIANT_FLD, "I"); - VARIANT *v = new VARIANT(); - VariantInit(v); - env->SetIntField(_this, jf, (unsigned int)v); -} - - -/* - * Class: com_jacob_com_Variant - * Method: zeroVariant - * Signature: ()V - * - * This should only be used on variant objects created by the - * com layer as part of a call through EventProxy. - * This zeros out the variant pointer in the Variant object - * so that the calling COM program can free the memory. - * instead of both the COM program and the Java GC doing it. - */ -void zeroVariant(JNIEnv *env, jobject _this) -{ - jclass clazz = env->GetObjectClass(_this); - jfieldID jf = env->GetFieldID(clazz, VARIANT_FLD, "I"); - env->SetIntField(_this, jf, (unsigned int)0); -} - - -/** - * This is the core of the old Save method. - * It copies this variant to a byte stream. - * The unmarshalling part of this doesn't work but it was left in - * with the hope that someone will want to fix this later - **/ -JNIEXPORT jbyteArray JNICALL Java_com_jacob_com_Variant_SerializationWriteToBytes - (JNIEnv *env, jobject _this){ - VARIANT *v = extractVariant(env, _this); - if (v) - { - DWORD flags = MSHCTX_LOCAL; - jint size = VARIANT_UserSize(&flags, 0L, v); - // allocate a byte array of the right length - jbyte* pBuf = new jbyte[size]; - // clear it out - ZeroMemory(pBuf, size); - // marshall the Variant into the buffer - VARIANT_UserMarshal(&flags, (unsigned char *)pBuf, v); - // need to convert the buffer to a java byte ba[] - jbyteArray ba = env->NewByteArray(size); - env->SetByteArrayRegion(ba, 0, size, pBuf); - // and delete the original memory - delete [] pBuf; - return ba; - } else { - jbyteArray ba = env->NewByteArray(0); - return ba; - } - } - -/** - * This is the core of the old Load method. It is broken because the - * unmarshalling code doesn't work under 2000/XP. - * - * It probably needs a custom handler. - **/ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_SerializationReadFromBytes - (JNIEnv *env, jobject _this, jbyteArray ba){ - - VARIANT *v = extractVariant(env, _this); - if (v){ - // get a buffer from it - jbyte *pBuf = env->GetByteArrayElements(ba, 0); - // unmarshall the Variant from the buffer - DWORD flags = MSHCTX_LOCAL; - printf("about to unmarshall array elements\n"); - VARIANT_UserUnmarshal(&flags, (unsigned char *)pBuf, v); - // release the byte array - printf("about to release array elements\n"); - env->ReleaseByteArrayElements(ba, pBuf, 0); - } - } - -/** - * Converts the data to a Enum Variant object and then returns it as a Dispatch - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) - { - HRESULT hr; - if (FAILED(hr = VariantChangeType(v, v, 0, VT_UNKNOWN))) { - ThrowComFail(env, "VariantChangeType failed", hr); - return NULL; - } - jclass autoClass = env->FindClass("com/jacob/com/EnumVariant"); - jmethodID autoCons = - env->GetMethodID(autoClass, "", "(I)V"); - // construct an Unknown object to return - IUnknown *unk = V_UNKNOWN(v); - IEnumVARIANT *ie; - hr = unk->QueryInterface(IID_IEnumVARIANT, (void **)&ie); - if (FAILED(hr)) { - ThrowComFail(env, "[toEnumVariant]: Object does not implement IEnumVariant", hr); - return NULL; - } - // I am copying the pointer to java - // SF-1674179 fix EnumVariants memory leak - // AJ: yes, but the QueryInterface call above already incremented the reference - //if (ie) ie->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, ie); - return newAuto; - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNull - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_NULL; - } -} - -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_cloneIndirect - (JNIEnv *env, jobject _this) -{ - return NULL; -} - - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShortRef - (JNIEnv *env, jobject _this, jshort s) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - short *ps = (short *)CoTaskMemAlloc(sizeof(short)); - *ps = s; - V_VT(v) = VT_I2|VT_BYREF; - V_I2REF(v) = ps; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantIntRef - (JNIEnv *env, jobject _this, jint s) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - long *ps = (long *)CoTaskMemAlloc(sizeof(long)); - *ps = s; - V_VT(v) = VT_I4|VT_BYREF; - V_I4REF(v) = ps; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDoubleRef - (JNIEnv *env, jobject _this, jdouble s) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - double *ps = (double *)CoTaskMemAlloc(sizeof(double)); - *ps = s; - V_VT(v) = VT_R8|VT_BYREF; - V_R8REF(v) = ps; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDateRef - (JNIEnv *env, jobject _this, jdouble s) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - double *ps = (double *)CoTaskMemAlloc(sizeof(double)); - *ps = s; - V_VT(v) = VT_DATE|VT_BYREF; - V_DATEREF(v) = ps; - } -} - -// SF 1065533 added unicode support -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantStringRef - (JNIEnv *env, jobject _this, jstring s) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - - const jchar *cStr = env->GetStringChars(s,NULL); - // SF 1314116 - // DBeck: 2005-09-23: changed CComBSTR c-tor to accept - // Unicode string (no terminating NULL) provided by GetStringChars - const jsize numChars = env->GetStringLength(s); - //CComBSTR bs(cStr); - CComBSTR bs( numChars, (LPCOLESTR)cStr ); // SR cast SF 1689061 - - BSTR *pbs = (BSTR *)CoTaskMemAlloc(sizeof(BSTR)); - bs.CopyTo(pbs); - V_VT(v) = VT_BSTR|VT_BYREF; - V_BSTRREF(v) = pbs; - - env->ReleaseStringChars(s,cStr); } -} - -JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShortRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_I2|VT_BYREF)) { - return NULL; - } - return (jshort)*V_I2REF(v); - } - return NULL; -} - -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantIntRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_I4|VT_BYREF)) { - return NULL; - } - return (jint)*V_I4REF(v); - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShort - (JNIEnv *env, jobject _this, jshort s) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_I2; - V_I2(v) = (short)s; - } -} - -JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShort - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_I2) { - return NULL; - } - return (jshort)V_I2(v); - } - return NULL; -} - -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDoubleRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_R8|VT_BYREF)) { - return NULL; - } - return (jdouble)*V_R8REF(v); - } - return NULL; -} - -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDateRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_DATE|VT_BYREF)) { - return NULL; - } - return (jdouble)*V_DATEREF(v); - } - return NULL; -} - -JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantStringRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_BSTR|VT_BYREF)) { - return NULL; - } - BSTR *bs = V_BSTRREF(v); - jstring js = env->NewString((jchar*)*bs, SysStringLen(*bs)); // SR cast SF 1689061 - return js; - } - return NULL; -} - -/** - * cover for underlying C VariantClear function - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_VariantClear - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); - } -} - -/** - * Converts the data to a Dispatch object and then returns it as a Dispatch - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantDispatch - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - HRESULT hr; - if (FAILED(hr = VariantChangeType(v, v, 0, VT_DISPATCH))) { - ThrowComFail(env, "VariantChangeType failed", hr); - return NULL; - } - jclass autoClass = env->FindClass("com/jacob/com/Dispatch"); - jmethodID autoCons = - env->GetMethodID(autoClass, "", "(I)V"); - // construct a Dispatch object to return - IDispatch *disp = V_DISPATCH(v); - // I am copying the pointer to java - if (disp) disp->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, disp); - return newAuto; - } - return NULL; -} - -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_clone - (JNIEnv *env, jobject _this) -{ - return NULL; -} - -/** - * Returns the value of this int as a Boolea if it is of that type. - * Otherwise it will return null (no conversion done) - */ - -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantInt - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_I4) { - return NULL; - } - return (jint)V_I4(v); - } - return NULL; -} - -/** - * Returns the value of this Date as a Boolea if it is of that type. - * Otherwise it will return null (no conversion done) - */ - -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDate - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_DATE) { - return NULL; - } - return (jdouble)V_DATE(v); - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantInt - (JNIEnv *env, jobject _this, jint i) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_I4; - V_I4(v) = (int)i; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDate - (JNIEnv *env, jobject _this, jdouble date) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_DATE; - V_DATE(v) = date; - } -} - -/** - * Returns the value of this Variant as a Boolea if it is of that type. - * Otherwise it will return null (no conversion done) - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBoolean - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_BOOL)) { - return NULL; - } - return (jboolean)V_BOOL(v); - } - return NULL; -} - -/** - * Returns the value of this Variant as a Byte if it is of that type. - * Otherwise it will return null (no conversion done) - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByte - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_UI1)) { - return NULL; - } - return (jbyte)V_UI1(v); - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBoolean - (JNIEnv *env, jobject _this, jboolean b) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_BOOL; - V_BOOL(v) = b == JNI_TRUE ? VARIANT_TRUE : VARIANT_FALSE; - } - else ThrowComFail(env, "putVariantBoolean failed", -1); -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByte - (JNIEnv *env, jobject _this, jbyte b) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_UI1; - V_UI1(v) = b; - } - else ThrowComFail(env, "putVariantByte failed", -1); -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantEmpty - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_EMPTY; - } -} - -/** - * Sets the variant type to dispatch with no value object - **/ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNothing - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_DISPATCH; - } -} - -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantError - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_ERROR) { - return NULL; - } - return (jint)V_ERROR(v); - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantError - (JNIEnv *env, jobject _this, jint i) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_ERROR; - V_ERROR(v) = (int)i; - } -} - - -/** - * Returns the value of this Variant as a double if it is of that type. - * Otherwise it will return null (no conversion done) - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDouble - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_R8) { - return NULL; - } - return (jdouble)V_R8(v); - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrency - (JNIEnv *env, jobject _this, jlong cur) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - CY pf; - pf.int64 = (LONGLONG)cur; - V_VT(v) = VT_CY; - V_CY(v) = pf; - } else ThrowComFail(env, "putVariantCurrency failed", -1); -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantLong - (JNIEnv *env, jobject _this, jlong longValue) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_I8; - V_I8(v) = (LONGLONG)longValue; - } else ThrowComFail(env, "putVariantLong failed", -1); -} - -/** - * Accepts a dispatch object and sets the type to VT_DISPATCH. - * There is currently no way to pass NULL into this method - * to create something like "NOTHING" from VB - * */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDispatch - (JNIEnv *env, jobject _this, jobject _that) -{ - VARIANT *v = extractVariant(env, _this); - IDispatch *disp = extractDispatch(env, _that); - if (disp && v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_DISPATCH; - V_DISPATCH(v) = disp; - // I am handing the pointer to COM - disp->AddRef(); - } else ThrowComFail(env, "putObject failed", -1); -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDouble - (JNIEnv *env, jobject _this, jdouble d) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_R8; - V_R8(v) = (double)d; - } -} - -/** - * Returns the value of this Variant as a long if it is of that type. - * Otherwise it will return null (no conversion done) - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrency - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_CY) { - return NULL; - } - CY cy; - cy = V_CY(v); - jlong jl; - memcpy(&jl, &cy, sizeof(jl)); // was 64. should be sizeof(x) SF 1690420 - return jl; - } - return NULL; -} - -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantLong - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_I8) { - return NULL; - } - return (jlong)V_I8(v); - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloatRef - (JNIEnv *env, jobject _this, jfloat val) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - float *pf = (float *)CoTaskMemAlloc(sizeof(float)); - *pf = val; - V_VT(v) = VT_R4|VT_BYREF; - V_R4REF(v) = pf; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrencyRef - (JNIEnv *env, jobject _this, jlong cur) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - CY *pf = (CY *)CoTaskMemAlloc(sizeof(CY)); - memcpy(pf, &cur, sizeof(*pf)); // was 64. should be sizeof(x) SF 1690420 - V_VT(v) = VT_BYREF|VT_CY; - V_CYREF(v) = pf; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantLongRef - (JNIEnv *env, jobject _this, jlong longValue) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - LONGLONG *ps = (LONGLONG *)CoTaskMemAlloc(sizeof(LONGLONG)); - *ps = longValue; - V_VT(v) = VT_I8|VT_BYREF; - V_I8REF(v) = ps; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantErrorRef - (JNIEnv *env, jobject _this, jint i) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_ERROR|VT_BYREF; - V_ERROR(v) = (int)i; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBooleanRef - (JNIEnv *env, jobject _this, jboolean b) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - VARIANT_BOOL *br = (VARIANT_BOOL *)CoTaskMemAlloc(sizeof(VARIANT_BOOL)); - *br = b ? VARIANT_TRUE : VARIANT_FALSE; - V_VT(v) = VT_BOOL|VT_BYREF; - V_BOOLREF(v) = br; - } -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByteRef - (JNIEnv *env, jobject _this, jbyte b) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - unsigned char *br = (unsigned char *)CoTaskMemAlloc(sizeof(char)); - *br = b; - V_VT(v) = VT_UI1|VT_BYREF; - V_UI1REF(v) = br; - } -} - -/** - * Returns the value of this Variant as a String if it is of that type. - * Otherwise it will return null (no conversion done) - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantString - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_BSTR) { - return NULL; - } - BSTR bs = V_BSTR(v); - jstring js = env->NewString((jchar*)bs, SysStringLen(bs));// SR cast SF 1689061 - return js; - } - return NULL; -} - -/** - * SF 1065533 added unicode support - * */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantString - (JNIEnv *env, jobject _this, jstring s) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_BSTR; - - const jchar *cStr = env->GetStringChars(s,NULL); - // SF 1314116 - // DBeck: 2005-09-23: changed CComBSTR c-tor to accept - // Unicode string (no terminating NULL) provided by GetStringChars - const jsize numChars = env->GetStringLength(s); - //CComBSTR bs(cStr); - CComBSTR bs( numChars, (LPCOLESTR)cStr ); // SR cast SF 1689061 - - V_VT(v) = VT_BSTR; - V_BSTR(v) = bs.Copy(); - - env->ReleaseStringChars(s,cStr); - } -} - -JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloatRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_R4|VT_BYREF)) { - return NULL; - } - return (jfloat)*V_R4REF(v); - } - return NULL; -} - -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrencyRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_CY|VT_BYREF)) { - return NULL; - } - CY *cy; - cy = V_CYREF(v); - jlong jl; - memcpy(&jl, cy, sizeof(jl)); // was 64. should be sizeof(x) SF 1690420 - return jl; - } - return NULL; -} - -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantLongRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_I8|VT_BYREF)) { - return NULL; - } - return (jlong)*V_I8REF(v); - } - return NULL; -} - -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantErrorRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_ERROR|VT_BYREF)) { - return NULL; - } - return (jint)V_ERROR(v); - } - return NULL; -} - -JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBooleanRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_BOOL|VT_BYREF)) { - return NULL; - } - return (jboolean)*V_BOOLREF(v); - } - return NULL; -} - - -JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByteRef - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_UI1|VT_BYREF)) { - return NULL; - } - return (jbyte)*V_UI1REF(v); - } - return NULL; -} - -/** - * Converts the data to a Safe Array object and then returns it as a Dispatch - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantSafeArray - (JNIEnv *env, jobject _this, jboolean deepCopy) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if ((V_VT(v) & VT_ARRAY) == 0) - { - ThrowComFail(env, "Variant not array", -1); - return NULL; - } - // prepare a new sa obj - jclass saClass = env->FindClass("com/jacob/com/SafeArray"); - jmethodID saCons = env->GetMethodID(saClass, "", "()V"); - // construct an SA to return - jobject newSA = env->NewObject(saClass, saCons); - // pass in the deep copy indicator - setSA(env, newSA, V_ARRAY(v), deepCopy == JNI_TRUE ? 1 : 0); - return newSA; - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArrayRef - (JNIEnv *env, jobject _this, jobject sa) -{ - SAFEARRAY *psa = extractSA(env, sa); - if (psa) - { - VARIANT *v = extractVariant(env, _this); - if (v) { - VARTYPE vt; - SAFEARRAY **sa = (SAFEARRAY **)CoTaskMemAlloc(sizeof(SAFEARRAY*)); - *sa = psa; - SafeArrayGetVartype(psa, &vt); - V_VT(v) = VT_ARRAY | vt | VT_BYREF; - V_ARRAYREF(v) = sa; - return; - } - ThrowComFail(env, "Can't get variant pointer", -1); - return; - } - ThrowComFail(env, "Can't get sa pointer", -1); - return; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArray - (JNIEnv *env, jobject _this, jobject sa) -{ - SAFEARRAY *psa = extractSA(env, sa); - if (psa) - { - VARIANT *v = extractVariant(env, _this); - if (v) { - VARTYPE vt; - SafeArrayGetVartype(psa, &vt); - V_VT(v) = VT_ARRAY | vt; - V_ARRAY(v) = copySA(psa); - return; - } - ThrowComFail(env, "Can't get variant pointer", -1); - return; - } - ThrowComFail(env, "Can't get sa pointer", -1); - return; -} - -/** - * sets the type to VT_ERROR and the error message to DISP_E_PARAMNOTFOIUND - * */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNoParam - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - V_VT(v) = VT_ERROR; - V_ERROR(v) = DISP_E_PARAMNOTFOUND; - } -} - -/** - * Returns the value of this Variant as a Float if it is of that type. - * Otherwise it will return null (no conversion done) - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloat - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_R4)) { - return NULL; - } - return (jfloat)V_R4(v); - } - return NULL; -} - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloat - (JNIEnv *env, jobject _this, jfloat val) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - V_VT(v) = VT_R4; - V_R4(v) = val; - } -} - -/** - * changes the type of the underlying variant data - * */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeVariantType - (JNIEnv *env, jobject _this, jshort t) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantChangeType(v, v, 0, t); - } -} - -/** - * returns the variant type if it is set, otherwise - * returns null - * */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantType - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (v) { - return (jshort)V_VT(v); - } - return NULL; -} - -// removed Java_com_jacob_com_Variant_putSafeArrayRefHelper - -/** - * this is a big cover method that returns TRUE if - * the variant type is - * VT_EMPTY, VT_NULL, VT_ERROR or VT_DISPATCH with no dispatch object - * */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_isVariantConsideredNull - (JNIEnv *env, jobject _this) -{ - VARIANT *v = extractVariant(env, _this); - if (!v) return JNI_TRUE; - if ((V_VT(v) & VT_ARRAY)) - { - // is it a null safearray - // prior to 4 Dec 2005 the squiggle brackets were missing - // so this did the wrong thing for the else statement - if ((V_VT(v) & VT_BYREF)) { - if (!V_ARRAYREF(v)) return JNI_TRUE; - } else { - if (!V_ARRAY(v)) return JNI_TRUE; - } - } - switch (V_VT(v)) - { - case VT_EMPTY: - case VT_NULL: - case VT_ERROR: - return JNI_TRUE; - // is it a null dispatch (Nothing in VB) - case VT_DISPATCH: - if (!V_DISPATCH(v)) return JNI_TRUE; - } - return JNI_FALSE; -} - -/** - * Puts a variant into a the Variant as its data and sets the type - * to VT_VARIANT|VT_BYREF. - * Added 1.12 pre 6 - * - * */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantVariant - (JNIEnv *env, jobject _this, jobject var) -{ - - VARIANT *vVar = extractVariant(env, var); - VARIANT *v = extractVariant(env, _this); - - if (v) { - VariantClear(v); // whatever was there before - - V_VT(v) = VT_VARIANT|VT_BYREF; - V_VARIANTREF(v) = vVar; - } - -} - -/** - * retrieves the enclosed variant when they are of type VT_VARIANT - * Added 1.12 pre 6 - * - * */ -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantVariant -(JNIEnv *env, jobject _this) -{ - - VARIANT *v = extractVariant(env, _this); - if (v) { - - if (V_VT(v) != (VT_VARIANT|VT_BYREF)) { - return NULL; - } - - VARIANT *refVar = V_VARIANTREF(v); - - // we could have made a copy of refV here but we aren't every going to free - // it outside of the scope of the enclosing context so we will just used the - // enclosed. This relies on the java layer to zero out its ref to this - // enclosed variant before the gc can come along and free the memory out from - // under this enclosing variant. - return (unsigned int)refVar; - } - - return NULL; -} - - /** - * puts a VT_DECIMAL by reference - * Added 1.13M4 - * */ - JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDecRef - (JNIEnv *env, jobject _this, jint signum, jbyte scale, jint lo, jint mid, jint hi) - { - VARIANT *v = extractVariant(env, _this); - if (v) { - VariantClear(v); // whatever was there before - DECIMAL *pd = (DECIMAL *)CoTaskMemAlloc(sizeof(DECIMAL)); - pd->scale = scale; - if (signum == 1 || signum == 0){ - pd->sign = 0; - } else { - pd->sign = 0x80; - } - pd->Hi32 = hi; - pd->Mid32 = mid; - pd->Lo32 = lo; - V_VT(v) = VT_DECIMAL | VT_BYREF; - V_DECIMALREF(v) = pd; - } - } - - - /** - * puts a VT_DECIMAL - * Added 1.13M4 - * */ - JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDec - (JNIEnv *env, jobject _this, jint signum, jbyte scale, jint lo, jint mid, jint hi) - { - VARIANT *v = extractVariant(env, _this); - DECIMAL *d; - if (v) { - VariantClear(v); // whatever was there before - d = (DECIMAL*)v; - d->scale = scale; - if (signum == 1 || signum == 0){ - d->sign = 0; - } else { - d->sign = 0x80; - } - d->Hi32 = hi; - d->Mid32 = mid; - d->Lo32 = lo; - V_VT(v) = VT_DECIMAL; - } - } - -/** - * utility method used by the getVariantXXX() methods to convert VT_DECIMAL to BigDecimal - * */ -jobject extractDecimal - (JNIEnv *env, DECIMAL* d) - { - jclass bigIntegerClass; - jclass bigDecimalClass; - jobject integer; - jmethodID bigIntegerConstructor; - jmethodID bigDecimalConstructor; - jbyteArray bArray; - jobject result = NULL; - jbyte* buffer; - - bigIntegerClass = env->FindClass("java/math/BigInteger"); - if (bigIntegerClass == NULL) - return NULL; - bigDecimalClass = env->FindClass("java/math/BigDecimal"); - if (bigDecimalClass == NULL) { - env->DeleteLocalRef(bigIntegerClass); - return NULL; - } - - bigIntegerConstructor = env->GetMethodID(bigIntegerClass, "", "(I[B)V"); - if (bigIntegerConstructor == NULL) { - env->DeleteLocalRef(bigIntegerClass); - env->DeleteLocalRef(bigDecimalClass); - return NULL; - } - bigDecimalConstructor = env->GetMethodID(bigDecimalClass, "", "(Ljava/math/BigInteger;I)V"); - if (bigIntegerConstructor == NULL) { - env->DeleteLocalRef(bigIntegerClass); - env->DeleteLocalRef(bigDecimalClass); - return NULL; - } - bArray = env->NewByteArray(12); - if (bArray == NULL) { - env->DeleteLocalRef(bigIntegerClass); - env->DeleteLocalRef(bigDecimalClass); - return NULL; - } - /* Unfortunately the byte ordering is completely wrong, so we remap it into buffer */ - buffer = (jbyte*)malloc(12); - buffer[11] = (byte)(d->Lo32 & 255); - buffer[10] = (byte)((d->Lo32 >> 8) & 255); - buffer[9] = (byte)((d->Lo32 >> 16) & 255); - buffer[8] = (byte)((d->Lo32 >> 24) & 255); - buffer[7] = (byte)((d->Mid32) & 255); - buffer[6] = (byte)((d->Mid32 >> 8) & 255); - buffer[5] = (byte)((d->Mid32 >> 16) & 255); - buffer[4] = (byte)((d->Mid32 >> 24) & 255); - buffer[3] = (byte)((d->Hi32) & 255); - buffer[2] = (byte)((d->Hi32 >> 8) & 255); - buffer[1] = (byte)((d->Hi32 >> 16) & 255); - buffer[0] = (byte)((d->Hi32 >> 24) & 255); - /* Load buffer into the actual array */ - env->SetByteArrayRegion(bArray, 0, 12, buffer); - /* then clean up the C array */ - free(buffer); - - /* instantiate the BigInteger */ - integer = env->NewObject(bigIntegerClass, bigIntegerConstructor, d->sign == 0x80?-1:1, bArray); - - result = env->NewObject(bigDecimalClass, bigDecimalConstructor, integer, (jint)(d->scale)); - - /* Clean up the Java global references */ - env->DeleteLocalRef(bArray); - env->DeleteLocalRef(integer); - env->DeleteLocalRef(bigIntegerClass); - return result; - } - -/** - * gets a VT_DECIMAL by ref as a BigDecimal - * Added 1.13M4 - * */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_getVariantDecRef - (JNIEnv *env, jobject _this) - { - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != (VT_DECIMAL|VT_BYREF)) { - return NULL; - } - return extractDecimal(env, v->pdecVal); - } - return NULL; - } - -/** - * gets a VT_DECIMAL as a BigDecimal - * Added 1.13M4 - * */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_getVariantDec - (JNIEnv *env, jobject _this) - { - VARIANT *v = extractVariant(env, _this); - if (v) { - if (V_VT(v) != VT_DECIMAL) { - return NULL; - } - return extractDecimal(env, (DECIMAL*)v); - } - return NULL; - } - -} diff --git a/jni/Variant.h b/jni/Variant.h deleted file mode 100644 index 1383e75..0000000 --- a/jni/Variant.h +++ /dev/null @@ -1,605 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -/* Header for class com_jacob_com_Variant */ - -#ifndef _Included_com_jacob_com_Variant -#define _Included_com_jacob_com_Variant -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Class: com_jacob_com_Variant - * Method: toEnumVariant - * Signature: ()Lcom/jacob/com/EnumVariant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantNull - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNull - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: cloneIndirect - * Signature: ()Lcom_jacob_com_Variant; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_cloneIndirect - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantShortRef - * Signature: (S)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShortRef - (JNIEnv *, jobject, jshort); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantIntRef - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantIntRef - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantDoubleRef - * Signature: (D)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDoubleRef - (JNIEnv *, jobject, jdouble); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantDateRef - * Signature: (D)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDateRef - (JNIEnv *, jobject, jdouble); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantStringRef - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantStringRef - (JNIEnv *, jobject, jstring); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantShortRef - * Signature: ()S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShortRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantIntRef - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantIntRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantShort - * Signature: (S)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantShort - (JNIEnv *, jobject, jshort); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantShort - * Signature: ()S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantShort - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantDoubleRef - * Signature: ()D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDoubleRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantDateRef - * Signature: ()D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDateRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getStringRef - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantStringRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: com_jacob_com_VariantClear - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_VariantClear - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: toDispatch - * Signature: ()LDispatch; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantDispatch - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: clone - * Signature: ()Ljava/lang/Object; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_clone - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantInt - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantInt - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantDate - * Signature: ()D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDate - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantInt - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantInt - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantDate - * Signature: (D)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDate - (JNIEnv *, jobject, jdouble); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantBoolean - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBoolean - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantByte - * Signature: ()B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByte - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantBoolean - * Signature: (Z)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBoolean - (JNIEnv *, jobject, jboolean); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantByte - * Signature: (B)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByte - (JNIEnv *, jobject, jbyte); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantEmpty - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantEmpty - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantNothing - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNothing - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantError - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantError - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantError - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantError - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantDouble - * Signature: ()D - */ -JNIEXPORT jdouble JNICALL Java_com_jacob_com_Variant_getVariantDouble - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantCurrency - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrency - (JNIEnv *, jobject, jlong); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantLong - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantLong - (JNIEnv *, jobject, jlong); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantDispatch - * Signature: (Ljava/lang/Object;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDispatch - (JNIEnv *, jobject, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantDouble - * Signature: (D)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDouble - (JNIEnv *, jobject, jdouble); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantCurrency - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrency - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantLong - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantLong - (JNIEnv *, jobject); -/* - * Class: com_jacob_com_Variant - * Method: putVariantFloatRef - * Signature: (F)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloatRef - (JNIEnv *, jobject, jfloat); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantCurrencyRef - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantCurrencyRef - (JNIEnv *, jobject, jlong); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantLongRef - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantLongRef - (JNIEnv *, jobject, jlong); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantErrorRef - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantErrorRef - (JNIEnv *, jobject, jint); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantBooleanRef - * Signature: (Z)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantBooleanRef - (JNIEnv *, jobject, jboolean); - -/* - * Class: com_jacob_com_Variant - * Method: putObjectRef - * Signature: (Ljava/lang/Object;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putObjectRef - (JNIEnv *, jobject, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantByteRef - * Signature: (B)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantByteRef - (JNIEnv *, jobject, jbyte); - -/* - * Class: com_jacob_com_Variant - * Method: getString - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_getVariantString - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantString - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantString - (JNIEnv *, jobject, jstring); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantFloatRef - * Signature: ()F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloatRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantCurrencyRef - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantCurrencyRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantLongRef - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantLongRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantErrorRef - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantErrorRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantBooleanRef - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_getVariantBooleanRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantByteRef - * Signature: ()B - */ -JNIEXPORT jbyte JNICALL Java_com_jacob_com_Variant_getVariantByteRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: toVariantSafeArray - * Signature: (Z)Lcom/jacob/com/SafeArray; - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantSafeArray - (JNIEnv *, jobject, jboolean); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantSafeArrayRef - * Signature: (LSafeArray;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArrayRef - (JNIEnv *, jobject, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantSafeArray - * Signature: (LSafeArray;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantSafeArray - (JNIEnv *, jobject, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantNoParam - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantNoParam - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantFloat - * Signature: ()F - */ -JNIEXPORT jfloat JNICALL Java_com_jacob_com_Variant_getVariantFloat - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantFloat - * Signature: (F)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantFloat - (JNIEnv *, jobject, jfloat); - -/* - * Class: com_jacob_com_Variant - * Method: changeVariantType - * Signature: (S)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeVariantType - (JNIEnv *, jobject, jshort); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantType - * Signature: ()S - */ -JNIEXPORT jshort JNICALL Java_com_jacob_com_Variant_getVariantType - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: release - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_release - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_init - (JNIEnv *, jobject); - -JNIEXPORT jbyteArray JNICALL Java_com_jacob_com_Variant_SerializationWriteToBytes - (JNIEnv *, jobject); - -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_SerializationReadFromBytes - (JNIEnv *, jobject, jbyteArray); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantVariant - * Signature: (Lcom/jacob/com/Variant;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantVariant - (JNIEnv *, jobject, jobject); - - -/* - * Class: com_jacob_com_Variant - * Method: getVariantVariant - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantVariant - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: putVariantDecRef - * Signature: (Ljava.math.BigDecimal;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDecRef - (JNIEnv *env, jobject _this, jint signum, jbyte scale, jint lo, jint mid, jint hi); - - -/* - * Class: com_jacob_com_Variant - * Method: putVariantDec - * Signature: (Ljava.math.BigDecimal;)V - */ -JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantDec - (JNIEnv *env, jobject _this, jint signum, jbyte scale, jint lo, jint mid, jint hi); - - -/* - * Class: com_jacob_com_Variant - * Method: getVariantDecRef - * Signature: ()Ljava.math.BigDecimal - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_getVariantDecRef - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: getVariantDec - * Signature: ()Ljava.math.BigDecimal - */ -JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_getVariantDec - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: isVariantConsideredNull - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_com_jacob_com_Variant_isVariantConsideredNull - (JNIEnv *, jobject); - -/* - * Class: com_jacob_com_Variant - * Method: zeroVariant - * Signature: ()V - * - * This should only be used on variant objects created by the - * com layer as part of a call through EventProxy. - * This zeros out the variant pointer in the Variant object - * so that the calling COM program can free the memory. - * instead of both the COM program and the Java GC doing it. - */ -void zeroVariant (JNIEnv *, jobject); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/jni/util.cpp b/jni/util.cpp deleted file mode 100644 index 3ef1e5c..0000000 --- a/jni/util.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "Dispatch.h" -// Win32 support for Ole Automation -#include -#include -#include -#include -#include -#include -#include "util.h" - -extern "C" -{ - -void ThrowComFail(JNIEnv *env, const char* desc, jint hr) -{ - jclass failClass = env->FindClass("com/jacob/com/ComFailException"); - // call the constructor that takes hr and message - jmethodID failCons = - env->GetMethodID(failClass, "", "(ILjava/lang/String;)V"); - if (!desc) { - desc = "Java/COM Error"; - } - jstring js = env->NewStringUTF(desc); - jthrowable fail = (jthrowable)env->NewObject(failClass, failCons, hr, js); - env->Throw(fail); -} - -void ThrowComFailUnicode(JNIEnv *env, const wchar_t* desc, jint hr) -{ - if (!desc) { - ThrowComFail(env, "Java/COM Error", hr); - } - jclass failClass = env->FindClass("com/jacob/com/ComFailException"); - // call the constructor that takes hr and message - jmethodID failCons = - env->GetMethodID(failClass, "", "(ILjava/lang/String;)V"); - jstring js = env->NewString((const jchar *) desc, wcslen(desc)); - jthrowable fail = (jthrowable)env->NewObject(failClass, failCons, hr, js); - env->Throw(fail); -} - -// if env's are different throw on the 1st env -int CheckEnv(JNIEnv *env1, JNIEnv *env2) -{ - if (env1 != env2) { - jclass failClass = env1->FindClass("com/jacob/com/WrongThreadException"); - // call the constructor that takes hr and message - jmethodID failCons = - env1->GetMethodID(failClass, "", "()V"); - env1->ThrowNew(failClass, "Wrong Thread"); - return 0; - } - return 1; -} - -} diff --git a/jni/util.h b/jni/util.h deleted file mode 100644 index 863ef0e..0000000 --- a/jni/util.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -extern "C" { - VARIANT *extractVariant(JNIEnv *env, jobject arg); - void ThrowComFail(JNIEnv *env, const char* desc, jint hr); - void ThrowComFailUnicode(JNIEnv *env, const wchar_t* desc, jint hr); - IDispatch *extractDispatch(JNIEnv *env, jobject arg); - SAFEARRAY *extractSA(JNIEnv *env, jobject arg); - void setSA(JNIEnv *env, jobject arg, SAFEARRAY *sa, int copy); - SAFEARRAY *copySA(SAFEARRAY *psa); -} diff --git a/lib/README.txt b/lib/README.txt deleted file mode 100644 index a38542d..0000000 --- a/lib/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -Placeholder class to retain directory in CVS so build scripts will work. -Part of directory standardization effort with jacobgen \ No newline at end of file diff --git a/lib/junit3.8.1/junit.jar b/lib/junit3.8.1/junit.jar deleted file mode 100644 index 674d71e..0000000 Binary files a/lib/junit3.8.1/junit.jar and /dev/null differ diff --git a/samples/README.txt b/samples/README.txt deleted file mode 100644 index e546231..0000000 --- a/samples/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -The ADO sample is a wrapper for the ADO classes. This demonstrates how -to write JACOB wrappers. - -The applet sample shows how to use JACOB in an applet. The trick is to -initialize and use the COM object in the same thread. - -The test directory has numerous tests that test various features -of the JACOB functionality. diff --git a/samples/com/jacob/samples/JavaWebStart/DLLFromJARClassLoader.java b/samples/com/jacob/samples/JavaWebStart/DLLFromJARClassLoader.java deleted file mode 100644 index f888dc7..0000000 --- a/samples/com/jacob/samples/JavaWebStart/DLLFromJARClassLoader.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.jacob.samples.JavaWebStart; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; - -import com.jacob.com.LibraryLoader; - -/** - * It is sometimes necessary to run Jacob without being able to install the dll - * on the client machine. This is true in JavaWebStart (JWS) and possibly Applet - * (assuming security allows access to the file system). The obvious thing to do - * here is to jar up the Jacob.dll so that it can be downloaded the client along - * with the rest of the resources. This is simple except that the System.Load() - * function does not search jar files for DLLs. It searches the classpath. The - * work around to this problem is to write the DLL to a temporary file and then - * explicitly load the DLL calling passing the full path to the temporary file. - * - * The following code demonstrates this idea. - * - * @author joe - * - */ -public class DLLFromJARClassLoader { - - /** - * Load the DLL from the classpath rather than from the java path. This code - * uses this class's class loader to find the dell in one of the jar files - * in this class's class path. It then writes the file as a temp file and - * calls Load() on the temp file. The temporary file is marked to be deleted - * on exit so the dll is deleted from the system when the application exits. - *

      - * Derived from ample code found in Sun's java forums - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -class MathTest { - /** - * standard main program to run the sample - * - * @param args - * command line parameters - */ - public static void main(String[] args) { - MathTest me = new MathTest(); - me.runTest(); - } - - /** default constructor */ - public MathTest() { - } - - /** - * not clear why we need a class and run method but that's the way it was - * written - */ - public void runTest() { - // deprecated - // System.runFinalizersOnExit(true); - Dispatch test = new ActiveXComponent("MathTest.Math"); - TestEvents te = new TestEvents(); - DispatchEvents de = new DispatchEvents(test, te); - if (de == null) { - System.out - .println("null returned when trying to create DispatchEvents"); - } - System.out.println(Dispatch.call(test, "Add", new Variant(1), - new Variant(2))); - System.out.println(Dispatch.call(test, "Mult", new Variant(2), - new Variant(2))); - Variant v = Dispatch.call(test, "Mult", new Variant(2), new Variant(2)); - // this should return false - System.out.println("v.isNull=" + v.isNull()); - v = Dispatch.call(test, "getNothing"); - // these should return nothing - System.out.println("v.isNull=" + v.isNull()); - System.out.println("v.toDispatch=" + v.toDispatch()); - } - - /** - * - * sample class to catch the events - * - */ - public class TestEvents { - /** - * catches the DoneAdd event - * - * @param args - */ - public void DoneAdd(Variant[] args) { - System.out.println("DoneAdd called in java"); - } - - /** - * catches the DoneMult event - * - * @param args - */ - public void DoneMult(Variant[] args) { - System.out.println("DoneMult called in java"); - } - } - -} diff --git a/samples/com/jacob/samples/MathProj/MathTest.lib b/samples/com/jacob/samples/MathProj/MathTest.lib deleted file mode 100644 index 8415105..0000000 Binary files a/samples/com/jacob/samples/MathProj/MathTest.lib and /dev/null differ diff --git a/samples/com/jacob/samples/MathProj/MathTest.vbp b/samples/com/jacob/samples/MathProj/MathTest.vbp deleted file mode 100644 index f845ba3..0000000 --- a/samples/com/jacob/samples/MathProj/MathTest.vbp +++ /dev/null @@ -1,35 +0,0 @@ -Type=OleDll -Class=Math; Math.cls -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\StdOle2.Tlb#OLE Automation -Startup="(None)" -HelpFile="" -Title="MathTest" -ExeName32="MathTest.dll" -Command32="" -Name="MathTest" -HelpContextID="0" -CompatibleMode="1" -CompatibleEXE32="MathTest.dll" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="Inventure America, Inc." -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=1 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -ThreadingModel=1 -DebugStartupOption=0 diff --git a/samples/com/jacob/samples/MathProj/MathTest.vbw b/samples/com/jacob/samples/MathProj/MathTest.vbw deleted file mode 100644 index 31e7a59..0000000 --- a/samples/com/jacob/samples/MathProj/MathTest.vbw +++ /dev/null @@ -1 +0,0 @@ -Math = 75, 13, 656, 554, diff --git a/samples/com/jacob/samples/MathProj/README.txt b/samples/com/jacob/samples/MathProj/README.txt deleted file mode 100644 index b79277e..0000000 --- a/samples/com/jacob/samples/MathProj/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -A Simple VB COM DLL that exposes two methods and raises events. - -The dll must be registered with your system - -Run --> regsvr32 \com\jacob\test\MathProj\MathTest.dll \ No newline at end of file diff --git a/samples/com/jacob/samples/access/Access.java b/samples/com/jacob/samples/access/Access.java deleted file mode 100644 index c99bb73..0000000 --- a/samples/com/jacob/samples/access/Access.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1999-2004 Sourceforge JACOB Project. - * All rights reserved. Originator: Dan Adler (http://danadler.com). - * Get more information about JACOB at http://sourceforge.net/projects/jacob-project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -package com.jacob.samples.access; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - * - */ -class Access { - /** - * the main loop for the test - * - * @param args - * @throws Exception - */ - public static void main(String[] args) throws Exception { - ComThread.InitSTA(); - // original test used this - // ActiveXComponent ax = new ActiveXComponent("DAO.PrivateDBEngine"); - // my xp box with a later release of access needed this - ActiveXComponent ax = new ActiveXComponent("DAO.PrivateDBEngine.35"); - // this only works for access files pre-access-2000 - // this line doesn't work on my xp box in Eclipse - // Dispatch db = open(ax, ".\\sample2.mdb"); - // this works when running in eclipse because the test cases run pwd - // project root - Dispatch db = open(ax, "samples/com/jacob/samples/access/sample2.mdb"); - String sql = "select * from MainTable"; - // make a temporary querydef - Dispatch qd = Dispatch.call(db, "CreateQueryDef", "").toDispatch(); - // set the SQL string on it - Dispatch.put(qd, "SQL", sql); - Variant result = getByQueryDef(qd); - // the 2-d safearray is transposed from what you might expect - System.out.println("resulting array is " + result.toSafeArray()); - close(db); - System.out.println("about to call ComThread.Release()"); - ComThread.Release(); - } - - /** - * Open a database - * - * @param ax - * @param fileName - * @return dispatch object that was opened - */ - public static Dispatch open(ActiveXComponent ax, String fileName) { - Variant f = new Variant(false); - // open the file in read-only mode - Variant[] args = new Variant[] { new Variant(fileName), f, f }; - Dispatch openDB = ax.invoke("OpenDatabase", args).toDispatch(); - return openDB; - } - - /** - * Close a database - * - * @param openDB - * db to be closed - */ - public static void close(Dispatch openDB) { - Dispatch.call(openDB, "Close"); - } - - /** - * Extract the values from the recordset - * - * @param recset - * @return Variant that is the returned values - */ - public static Variant getValues(Dispatch recset) { - Dispatch.callSub(recset, "moveFirst"); - Variant vi = new Variant(4096); - Variant v = Dispatch.call(recset, "GetRows", vi); - return v; - } - - /** - * should return ?? for the passed in ?? - * - * @param qd - * @return Variant results of query? - */ - public static Variant getByQueryDef(Dispatch qd) { - // get a reference to the recordset - Dispatch recset = Dispatch.call(qd, "OpenRecordset").toDispatch(); - // get the values as a safe array - String[] cols = getColumns(recset); - for (int i = 0; i < cols.length; i++) { - System.out.print(cols[i] + " "); - } - System.out.println(""); - Variant vals = getValues(recset); - return vals; - } - - /** - * gets the columns form the rec set - * - * @param recset - * @return list of column names - */ - public static String[] getColumns(Dispatch recset) { - Dispatch flds = Dispatch.get(recset, "Fields").toDispatch(); - int n_flds = Dispatch.get(flds, "Count").getInt(); - String[] s = new String[n_flds]; - Variant vi = new Variant(); - for (int i = 0; i < n_flds; i++) { - vi.putInt(i); - // must use the invoke method because this is a method call - // that wants to have a Dispatch.Get flag... - Dispatch fld = Dispatch.invoke(recset, "Fields", Dispatch.Get, - new Object[] { vi }, new int[1]).toDispatch(); - Variant name = Dispatch.get(fld, "Name"); - s[i] = name.toString(); - } - return s; - } -} diff --git a/samples/com/jacob/samples/access/sample2.mdb b/samples/com/jacob/samples/access/sample2.mdb deleted file mode 100644 index a887549..0000000 Binary files a/samples/com/jacob/samples/access/sample2.mdb and /dev/null differ diff --git a/samples/com/jacob/samples/ado/ADO_README.txt b/samples/com/jacob/samples/ado/ADO_README.txt deleted file mode 100644 index 46b7278..0000000 --- a/samples/com/jacob/samples/ado/ADO_README.txt +++ /dev/null @@ -1,88 +0,0 @@ -- ADO Wrapper for JACOB - Copyright 1999, Dan Adler - -This sample shows how to generate more strongly typed wrapper classes -for the JACOB automation classes. These are pure java classes which -extend com.jacob.com.Dispatch and delegate all the methods to the -unedrlying IDispatch pointer. This methodology is similar to the way -MFC does automation wrappers, rather than using the @com directives -to invisibly delegate the calls, as the Microsoft VM does. - -The ADO wrappers in this directory are not a part of the JACOB -distribution, however, they demonstrate the preferred way to create -wrappers around the core functionality. The wrappers included here are -not a complete set, but they could easily be extended to provide all -the functionality of the com.ms.wfc.data classes. - -The code in test.java demonstrates two ways to get a Recordset -from SQL Server. In this case, I query for the authors in the 'pubs' -database once by opening a Recordset object directly, and once by -using the Command and Connection objects. The same code, using the WFC -wrappers can be found in ms\testms.java in case you want to compare -the performace. You can run the test.java demo in the MS VM as well. - -The constructor of the wrapper is used to create an instance. -For example, the user can write: - - Connection c = new Connection(); - -The code for the Connection constructor is shown here: - - public Connection() - { - super("ADODB.Connection"); - } - -it simply delegates to the com.jacob.com.Dispatch constructor which -takes a ProgID. - -Since I don't have a tool like JACTIVEX yet to create the wrappers -automatically from the type library, I created them by hand by using -the JACTIVEX'ed version as a starting point, and replacing the @com -calls with delegated calls to JACOB classes. A simple PERL program -could probably be used to automate this step. - -In order to return strongly typed wrappers from method calls, I had to -create a special constructor which constructs the wrapper class instance -and copies over the IDispatch pointer. This is because I can't cast a -java Dispatch object to a super class object. - -For example, the Command class has a method like this: - - public Connection getActiveConnection(); - -Ideally, I would like the wrapper code to say: - - public Connection getActiveConnection() - { - // this doesn't work - return (Connection)Dispatch.get(this, "ActiveConnection").toDispatch()); - } - -Thereby wrapping the returned Dispatch pointer in a Connection object. -But, since I can't cast in this way, I use the following construct: - - public Connection getActiveConnection() - { - // this works - return new Connection(Dispatch.get(this, "ActiveConnection").toDispatch()); - } - -Which uses a special constructor inserted into the Connection class: - - /** - * This constructor is used instead of a case operation to - * turn a Dispatch object into a wider object - it must exist - * in every wrapper class whose instances may be returned from - * method calls wrapped in VT_DISPATCH Variants. - */ - public Connection(Dispatch d) - { - // take over the IDispatch pointer - m_pDispatch = d.m_pDispatch; - // null out the input's pointer - d.m_pDispatch = 0; - } - -I have to add this constructor to any class whose instances I want -to return from wrapped calls. - diff --git a/samples/com/jacob/samples/ado/Command.java b/samples/com/jacob/samples/ado/Command.java deleted file mode 100644 index ca5add8..0000000 --- a/samples/com/jacob/samples/ado/Command.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.jacob.samples.ado; - -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * Custom dispatch object to make it easy for us to provide application specific - * API. - * - */ -public class Command extends Dispatch { - /** - * standard constructor - */ - public Command() { - super("ADODB.Command"); - } - - /** - * This constructor is used instead of a case operation to turn a Dispatch - * object into a wider object - it must exist in every wrapper class whose - * instances may be returned from method calls wrapped in VT_DISPATCH - * Variants. - * - * @param dispatchTarget - */ - public Command(Dispatch dispatchTarget) { - super(dispatchTarget); - } - - /** - * runs the "Properties" command - * - * @return the properties - */ - public Variant getProperties() { - return Dispatch.get(this, "Properties"); - } - - /** - * runs the "ActiveConnection" command - * - * @return a Connection object - */ - public Connection getActiveConnection() { - return new Connection(Dispatch.get(this, "ActiveConnection") - .toDispatch()); - } - - /** - * Sets the "ActiveConnection" object - * - * @param ppvObject - * the new connection - */ - public void setActiveConnection(Connection ppvObject) { - Dispatch.put(this, "ActiveConnection", ppvObject); - } - - /** - * - * @return the results from "CommandText" - */ - public String getCommandText() { - return Dispatch.get(this, "CommandText").toString(); - } - - /** - * - * @param pbstr - * the new "CommandText" - */ - public void setCommandText(String pbstr) { - Dispatch.put(this, "CommandText", pbstr); - } - - /** - * - * @return the results of "CommandTimeout" - */ - public int getCommandTimeout() { - return Dispatch.get(this, "CommandTimeout").getInt(); - } - - /** - * - * @param plTimeout - * the new "CommandTimeout" - */ - public void setCommandTimeout(int plTimeout) { - Dispatch.put(this, "CommandTimeout", new Variant(plTimeout)); - } - - /** - * - * @return results from "Prepared" - */ - public boolean getPrepared() { - return Dispatch.get(this, "Prepared").getBoolean(); - } - - /** - * - * @param pfPrepared - * the new value for "Prepared" - */ - public void setPrepared(boolean pfPrepared) { - Dispatch.put(this, "Prepared", new Variant(pfPrepared)); - } - - /** - * "Execute"s a command - * - * @param RecordsAffected - * @param Parameters - * @param Options - * @return - */ - public Recordset Execute(Variant RecordsAffected, Variant Parameters, - int Options) { - return (Recordset) Dispatch.call(this, "Execute", RecordsAffected, - Parameters, new Variant(Options)).toDispatch(); - } - - /** - * "Execute"s a command - * - * @return - */ - public Recordset Execute() { - Variant dummy = new Variant(); - return new Recordset(Dispatch.call(this, "Execute", dummy).toDispatch()); - } - - /** - * creates a parameter - * - * @param Name - * @param Type - * @param Direction - * @param Size - * @param Value - * @return - */ - public Variant CreateParameter(String Name, int Type, int Direction, - int Size, Variant Value) { - return Dispatch.call(this, "CreateParameter", Name, new Variant(Type), - new Variant(Direction), new Variant(Size), Value); - } - - // need to wrap Parameters - /** - * @return "Parameters" - */ - public Variant getParameters() { - return Dispatch.get(this, "Parameters"); - } - - /** - * - * @param plCmdType - * new "CommandType" - */ - public void setCommandType(int plCmdType) { - Dispatch.put(this, "CommandType", new Variant(plCmdType)); - } - - /** - * - * @return current "CommandType" - */ - public int getCommandType() { - return Dispatch.get(this, "CommandType").getInt(); - } - - /** - * - * @return "Name" - */ - public String getName() { - return Dispatch.get(this, "Name").toString(); - } - - /** - * - * @param pbstrName - * new "Name" - */ - public void setName(String pbstrName) { - Dispatch.put(this, "Name", pbstrName); - } - - /** - * - * @return curent "State" - */ - public int getState() { - return Dispatch.get(this, "State").getInt(); - } - - /** - * cancel whatever it is we're doing - */ - public void Cancel() { - Dispatch.call(this, "Cancel"); - } -} diff --git a/samples/com/jacob/samples/ado/CommandTypeEnum.java b/samples/com/jacob/samples/ado/CommandTypeEnum.java deleted file mode 100644 index 2afd585..0000000 --- a/samples/com/jacob/samples/ado/CommandTypeEnum.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.jacob.samples.ado; - -// Enum: CommandTypeEnum - -public interface CommandTypeEnum { - public static final int adCmdUnspecified = -1; - public static final int adCmdUnknown = 8; - public static final int adCmdText = 1; - public static final int adCmdTable = 2; - public static final int adCmdStoredProc = 4; - public static final int adCmdFile = 256; - public static final int adCmdTableDirect = 512; -} diff --git a/samples/com/jacob/samples/ado/Connection.java b/samples/com/jacob/samples/ado/Connection.java deleted file mode 100644 index 8e0c9a6..0000000 --- a/samples/com/jacob/samples/ado/Connection.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.jacob.samples.ado; - -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -public class Connection extends Dispatch { - public Connection() { - super("ADODB.Connection"); - } - - /** - * This constructor is used instead of a case operation to turn a Dispatch - * object into a wider object - it must exist in every wrapper class whose - * instances may be returned from method calls wrapped in VT_DISPATCH - * Variants. - */ - public Connection(Dispatch d) { - super(d); - } - - // need to wrap Properties - public Variant getProperties() { - return Dispatch.get(this, "Properties"); - } - - public String getConnectionString() { - return Dispatch.get(this, "ConnectionString").toString(); - } - - public void setConnectionString(String pbstr) { - Dispatch.put(this, "ConnectionString", pbstr); - } - - public int getCommandTimeout() { - return Dispatch.get(this, "CommandTimeout").getInt(); - } - - public void setCommandTimeout(int plTimeout) { - Dispatch.put(this, "CommandTimeout", new Variant(plTimeout)); - } - - public int getConnectionTimeout() { - return Dispatch.get(this, "ConnectionTimeout").getInt(); - } - - public void setConnectionTimeout(int plTimeout) { - Dispatch.put(this, "ConnectionTimeout", new Variant(plTimeout)); - } - - public String getVersion() { - return Dispatch.get(this, "Version").toString(); - } - - public void Close() { - Dispatch.call(this, "Close"); - } - - // how to deal with RecordsAffected being output? - public Variant Execute(String CommandText, Variant RecordsAffected, - int Options) { - return Dispatch.call(this, CommandText, RecordsAffected, new Variant( - Options)); - } - - public int BeginTrans() { - return Dispatch.call(this, "BeginTrans").getInt(); - } - - public void CommitTrans() { - Dispatch.call(this, "CommitTrans"); - } - - public void RollbackTrans() { - Dispatch.call(this, "RollbackTrans"); - } - - public void Open(String ConnectionString, String UserID, String Password, - int Options) { - Dispatch.call(this, "Open", ConnectionString, UserID, Password, - new Variant(Options)); - } - - public void Open() { - Dispatch.call(this, "Open"); - } - - public Variant getErrors() { - return Dispatch.get(this, "Errors"); - } - - public String getDefaultDatabase() { - return Dispatch.get(this, "DefaultDatabase").toString(); - } - - public void setDefaultDatabase(String pbstr) { - Dispatch.put(this, "DefaultDatabase", pbstr); - } - - public int getIsolationLevel() { - return Dispatch.get(this, "IsolationLevel").getInt(); - } - - public void setIsolationLevel(int Level) { - Dispatch.put(this, "IsolationLevel", new Variant(Level)); - } - - public int getAttributes() { - return Dispatch.get(this, "Attributes").getInt(); - } - - public void setAttributes(int plAttr) { - Dispatch.put(this, "Attributes", new Variant(plAttr)); - } - - public int getCursorLocation() { - return Dispatch.get(this, "CursorLocation").getInt(); - } - - public void setCursorLocation(int plCursorLoc) { - Dispatch.put(this, "CursorLocation", new Variant(plCursorLoc)); - } - - public int getMode() { - return Dispatch.get(this, "Mode").getInt(); - } - - public void setMode(int plMode) { - Dispatch.put(this, "Mode", new Variant(plMode)); - } - - public String getProvider() { - return Dispatch.get(this, "Provider").toString(); - } - - public void setProvider(String pbstr) { - Dispatch.put(this, "Provider", pbstr); - } - - public int getState() { - return Dispatch.get(this, "State").getInt(); - } - - public Variant OpenSchema(int Schema, Variant Restrictions, Variant SchemaID) { - return Dispatch.call(this, "OpenSchema", new Variant(Schema), - Restrictions, SchemaID); - } - - public void Cancel() { - Dispatch.call(this, "Cancel"); - } -} diff --git a/samples/com/jacob/samples/ado/Field.java b/samples/com/jacob/samples/ado/Field.java deleted file mode 100644 index abb8588..0000000 --- a/samples/com/jacob/samples/ado/Field.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.jacob.samples.ado; - -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -public class Field extends Dispatch { - /** - * This constructor is used instead of a case operation to turn a Dispatch - * object into a wider object - it must exist in every wrapper class whose - * instances may be returned from method calls wrapped in VT_DISPATCH - * Variants. - */ - public Field(Dispatch d) { - super(d); - } - - public Variant getProperties() { - return Dispatch.get(this, "Properties"); - } - - public int getActualSize() { - return Dispatch.get(this, "ActualSize").getInt(); - } - - public int getAttributes() { - return Dispatch.get(this, "Attributes").getInt(); - } - - public int getDefinedSize() { - return Dispatch.get(this, "DefinedSize").getInt(); - } - - public String getName() { - return Dispatch.get(this, "Name").toString(); - } - - public int getType() { - return Dispatch.get(this, "Type").getInt(); - } - - public Variant getValue() { - return Dispatch.get(this, "Value"); - } - - public void setValue(Variant pvar) { - Dispatch.put(this, "Value", pvar); - } - - public byte getPrecision() { - return Dispatch.get(this, "Precision").getByte(); - } - - public byte getNumericScale() { - return Dispatch.get(this, "NumericScale").getByte(); - } - - public void AppendChunk(Variant Data) { - Dispatch.call(this, "AppendChunk", Data); - } - - public Variant GetChunk(int Length) { - return Dispatch.call(this, "GetChunk", new Variant(Length)); - } - - public Variant getOriginalValue() { - return Dispatch.get(this, "OriginalValue"); - } - - public Variant getUnderlyingValue() { - return Dispatch.get(this, "UnderlyingValue"); - } - - public Variant getDataFormat() { - return Dispatch.get(this, "DataFormat"); - } - - public void setDataFormat(Variant ppiDF) { - Dispatch.put(this, "DataFormat", ppiDF); - } - - public void setPrecision(byte pb) { - Dispatch.put(this, "Precision", new Variant(pb)); - } - - public void setNumericScale(byte pb) { - Dispatch.put(this, "NumericScale", new Variant(pb)); - } - - public void setType(int pDataType) { - Dispatch.put(this, "Type", new Variant(pDataType)); - } - - public void setDefinedSize(int pl) { - Dispatch.put(this, "DefinedSize", new Variant(pl)); - } - - public void setAttributes(int pl) { - Dispatch.put(this, "Attributes", new Variant(pl)); - } - -} diff --git a/samples/com/jacob/samples/ado/Fields.java b/samples/com/jacob/samples/ado/Fields.java deleted file mode 100644 index 8676327..0000000 --- a/samples/com/jacob/samples/ado/Fields.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.jacob.samples.ado; - -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -public class Fields extends Dispatch { - /** - * This constructor is used instead of a case operation to turn a Dispatch - * object into a wider object - it must exist in every wrapper class whose - * instances may be returned from method calls wrapped in VT_DISPATCH - * Variants. - */ - public Fields(Dispatch d) { - super(d); - } - - public int getCount() { - return Dispatch.get(this, "Count").getInt(); - } - - public Variant _NewEnum() { - return Dispatch.call(this, "_NewEnum"); - } - - public void Refresh() { - Dispatch.call(this, "Refresh"); - } - - public Field getItem(int Index) { - return new Field(Dispatch.call(this, "Item", new Variant(Index)) - .toDispatch()); - } - - public void Append(String Name, int Type, int DefinedSize, int Attrib) { - Dispatch.call(this, "Append", Name, new Variant(Type), new Variant( - DefinedSize), new Variant(Attrib)); - } - - public void Delete(Variant Index) { - Dispatch.call(this, "Delete", Index); - } - -} diff --git a/samples/com/jacob/samples/ado/Recordset.java b/samples/com/jacob/samples/ado/Recordset.java deleted file mode 100644 index d0b3019..0000000 --- a/samples/com/jacob/samples/ado/Recordset.java +++ /dev/null @@ -1,342 +0,0 @@ -package com.jacob.samples.ado; - -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -public class Recordset extends Dispatch { - public Recordset() { - super("ADODB.Recordset"); - } - - /** - * This constructor is used instead of a case operation to turn a Dispatch - * object into a wider object - it must exist in every wrapper class whose - * instances may be returned from method calls wrapped in VT_DISPATCH - * Variants. - */ - public Recordset(Dispatch d) { - super(d); - } - - public Variant getProperties() { - return Dispatch.get(this, "Properties"); - } - - public int getAbsolutePosition() { - return Dispatch.get(this, "AbsolutePosition").getInt(); - } - - public void setAbsolutePosition(int pl) { - Dispatch.put(this, "AbsolutePosition", new Variant(pl)); - } - - public Connection getActiveConnection() { - return new Connection(Dispatch.get(this, "ActiveConnection") - .toDispatch()); - } - - public void setActiveConnection(Connection ppvObject) { - Dispatch.put(this, "ActiveConnection", ppvObject); - } - - public void setActiveConnection(Variant ppvObject) { - Dispatch.put(this, "ActiveConnection", ppvObject); - } - - public boolean getBOF() { - return Dispatch.get(this, "BOF").getBoolean(); - } - - public Variant getBookmark() { - return Dispatch.get(this, "Bookmark"); - } - - public void setBookmark(Variant pvBookmark) { - Dispatch.put(this, "Bookmark", pvBookmark); - } - - public int getCacheSize() { - return Dispatch.get(this, "CacheSize").getInt(); - } - - public void setCacheSize(int pl) { - Dispatch.put(this, "CacheSize", new Variant(pl)); - } - - public int getCursorType() { - return Dispatch.get(this, "CursorType").getInt(); - } - - public void setCursorType(int pl) { - Dispatch.put(this, "CursorType", new Variant(pl)); - } - - public boolean getEOF() { - return Dispatch.get(this, "EOF").getBoolean(); - } - - public Fields getFields() { - return new Fields(Dispatch.get(this, "Fields").toDispatch()); - } - - public int getLockType() { - return Dispatch.get(this, "LockType").getInt(); - } - - public void setLockType(int plLockType) { - Dispatch.put(this, "LockType", new Variant(plLockType)); - } - - public int getMaxRecords() { - return Dispatch.get(this, "MaxRecords").getInt(); - } - - public void setMaxRecords(int pl) { - Dispatch.put(this, "MaxRecords", new Variant(pl)); - } - - public int getRecordCount() { - return Dispatch.get(this, "RecordCount").getInt(); - } - - public void setSource(Object pvSource) { - Dispatch.put(this, "Source", pvSource); - } - - public void setSource(String pvSource) { - Dispatch.put(this, "Source", pvSource); - } - - public Variant getSource() { - return Dispatch.get(this, "Source"); - } - - public void AddNew(Variant FieldList, Variant Values) { - Dispatch.call(this, "AddNew", FieldList, Values); - } - - public void CancelUpdate() { - Dispatch.call(this, "CancelUpdate"); - } - - public void Close() { - Dispatch.call(this, "Close"); - } - - public void Delete(int AffectRecords) { - Dispatch.call(this, "Delete", new Variant(AffectRecords)); - } - - public Variant GetRows(int Rows, Variant Start, Variant Fields) { - return Dispatch.call(this, "GetRows", new Variant(Rows), Start, Fields); - } - - // get all rows - public Variant GetRows() { - return Dispatch.call(this, "GetRows"); - } - - public void Move(int NumRecords, Variant Start) { - Dispatch.call(this, "Move", new Variant(NumRecords), Start); - } - - public void MoveNext() { - Dispatch.call(this, "MoveNext"); - } - - public void MovePrevious() { - Dispatch.call(this, "MovePrevious"); - } - - public void MoveFirst() { - Dispatch.call(this, "MoveFirst"); - } - - public void MoveLast() { - Dispatch.call(this, "MoveLast"); - } - - public void Open(Variant Source, Variant ActiveConnection, int CursorType, - int LockType, int Options) { - Dispatch.call(this, "Open", Source, ActiveConnection, new Variant( - CursorType), new Variant(LockType), new Variant(Options)); - } - - public void Open(Variant Source, Variant ActiveConnection) { - Dispatch.call(this, "Open", Source, ActiveConnection); - } - - public void Requery(int Options) { - Dispatch.call(this, "Requery", new Variant(Options)); - } - - public void Update(Variant Fields, Variant Values) { - Dispatch.call(this, "Update", Fields, Values); - } - - public int getAbsolutePage() { - return Dispatch.get(this, "AbsolutePage").getInt(); - } - - public void setAbsolutePage(int pl) { - Dispatch.put(this, "AbsolutePage", new Variant(pl)); - } - - public int getEditMode() { - return Dispatch.get(this, "EditMode").getInt(); - } - - public Variant getFilter() { - return Dispatch.get(this, "Filter"); - } - - public void setFilter(Variant Criteria) { - Dispatch.put(this, "Filter", Criteria); - } - - public int getPageCount() { - return Dispatch.get(this, "PageCount").getInt(); - } - - public int getPageSize() { - return Dispatch.get(this, "PageSize").getInt(); - } - - public void setPageSize(int pl) { - Dispatch.put(this, "PageSize", new Variant(pl)); - } - - public String getSort() { - return Dispatch.get(this, "Sort").toString(); - } - - public void setSort(String Criteria) { - Dispatch.put(this, "Sort", Criteria); - } - - public int getStatus() { - return Dispatch.get(this, "Status").getInt(); - } - - public int getState() { - return Dispatch.get(this, "State").getInt(); - } - - public void UpdateBatch(int AffectRecords) { - Dispatch.call(this, "UpdateBatch", new Variant(AffectRecords)); - } - - public void CancelBatch(int AffectRecords) { - Dispatch.call(this, "CancelBatch", new Variant(AffectRecords)); - } - - public int getCursorLocation() { - return Dispatch.get(this, "CursorLocation").getInt(); - } - - public void setCursorLocation(int pl) { - Dispatch.put(this, "CursorLocation", new Variant(pl)); - } - - public Recordset NextRecordset(Variant RecordsAffected) { - return new Recordset(Dispatch.call(this, "NextRecordset", - RecordsAffected).toDispatch()); - } - - public boolean Supports(int CursorOptions) { - return Dispatch.call(this, "Supports", new Variant(CursorOptions)) - .getBoolean(); - } - - public Variant getCollect(Variant Index) { - return Dispatch.get(this, "Collect"); - } - - public void setCollect(Variant Index, Variant pvar) { - Dispatch.call(this, "Collect", Index, pvar); - } - - public int getMarshalOptions() { - return Dispatch.get(this, "MarshalOptions").getInt(); - } - - public void setMarshalOptions(int pl) { - Dispatch.put(this, "MarshalOptions", new Variant(pl)); - } - - public void Find(String Criteria, int SkipRecords, int SearchDirection, - Variant Start) { - Dispatch.call(this, "Find", Criteria, new Variant(SkipRecords), - new Variant(SearchDirection), Start); - } - - public void Cancel() { - Dispatch.call(this, "Cancel"); - } - - public Variant getDataSource() { - return Dispatch.get(this, "DataSource"); - } - - public void setDataSource(Variant ppunkDataSource) { - Dispatch.put(this, "DataSource", ppunkDataSource); - } - - public void Save(String FileName, int PersistFormat) { - Dispatch.call(this, "Save", FileName, new Variant(PersistFormat)); - } - - public Variant getActiveCommand() { - return Dispatch.get(this, "ActiveCommand"); - } - - public void setStayInSync(boolean pb) { - Dispatch.put(this, "StayInSync", new Variant(pb)); - } - - public boolean getStayInSync() { - return Dispatch.get(this, "StayInSync").getBoolean(); - } - - public String GetString(int StringFormat, int NumRows, - String ColumnDelimeter, String RowDelimeter, String NullExpr) { - return Dispatch.call(this, "GetString", new Variant(StringFormat), - new Variant(NumRows), ColumnDelimeter, RowDelimeter, NullExpr) - .toString(); - } - - public String getDataMember() { - return Dispatch.get(this, "DataMember").toString(); - } - - public void setDataMember(String pl) { - Dispatch.put(this, "DataMember", new Variant(pl)); - } - - public int CompareBookmarks(Variant Bookmark1, Variant Bookmark2) { - return Dispatch.call(this, "CompareBookmarks", Bookmark1, Bookmark2) - .getInt(); - } - - public Recordset Clone(int LockType) { - return new Recordset(Dispatch - .call(this, "Clone", new Variant(LockType)).toDispatch()); - } - - public void Resync(int AffectRecords, int ResyncValues) { - Dispatch.call(this, "Resync", new Variant(AffectRecords), new Variant( - ResyncValues)); - } - - public void Seek(Variant KeyValues, int SeekOption) { - Dispatch.call(this, "Seek", KeyValues, new Variant(SeekOption)); - } - - public void setIndex(String pl) { - Dispatch.put(this, "Index", new Variant(pl)); - } - - public String getIndex() { - return Dispatch.get(this, "Index)").toString(); - } -} diff --git a/samples/com/jacob/samples/ado/ms/README.txt b/samples/com/jacob/samples/ado/ms/README.txt deleted file mode 100644 index cc76d1c..0000000 --- a/samples/com/jacob/samples/ado/ms/README.txt +++ /dev/null @@ -1,9 +0,0 @@ -This is the WFC equivalent of the JACOB ADO example. - -This code must be compiled with JVC and run with JVIEW. - -The file testms.java has been renamed to tesetms.java.txt -because most folks building this application will -not have the MS JVM installed and will get compiler -warnings. The MS JVM is going away eventually -so this whole test will eventually go away. \ No newline at end of file diff --git a/samples/com/jacob/samples/ado/ms/testms.java.txt b/samples/com/jacob/samples/ado/ms/testms.java.txt deleted file mode 100644 index 1d6bd52..0000000 --- a/samples/com/jacob/samples/ado/ms/testms.java.txt +++ /dev/null @@ -1,66 +0,0 @@ -package samples.ado.ms; - -import com.ms.com.*; -import com.ms.wfc.data.*; - -// an ms-only version of test.java -public class testms -{ - public static void printRS(Recordset rs) - { - Fields fs = rs.getFields(); - - for (int i=0;i Recordset"); - Connection c = new Connection(); - c.setConnectionString(con); - c.open(); - Command comm = new Command(); - comm.setActiveConnection(c); - comm.setCommandType(AdoEnums.CommandType.TEXT); - comm.setCommandText(query); - Recordset rs = comm.execute(); - printRS(rs); - c.close(); - } - - public static void main(String[] args) - { - String connectStr = "DRIVER=SQL Server;SERVER=DANADLER;UID=sa;PWD=;WSID=DANADLER;DATABASE=pubs"; - String queryStr = "select * from authors"; - getCommand(connectStr, queryStr); - getRS(connectStr, queryStr); - } -} diff --git a/samples/com/jacob/samples/ado/test.java b/samples/com/jacob/samples/ado/test.java deleted file mode 100644 index 7a96568..0000000 --- a/samples/com/jacob/samples/ado/test.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.jacob.samples.ado; - -import com.jacob.com.Variant; - -public class test { - public static void printRS(Recordset rs) { - Fields fs = rs.getFields(); - - for (int i = 0; i < fs.getCount(); i++) { - System.out.print(fs.getItem(i).getName() + " "); - } - System.out.println(""); - - rs.MoveFirst(); - while (!rs.getEOF()) { - for (int i = 0; i < fs.getCount(); i++) { - Field f = fs.getItem(i); - Variant v = f.getValue(); - System.out.print(v + " "); - } - System.out.println(""); - rs.MoveNext(); - } - } - - // open a recordset directly - public static void getRS(String con, String query) { - System.out.println("Recordset Open"); - Recordset rs = new Recordset(); - rs.Open(new Variant(query), new Variant(con)); - printRS(rs); - } - - // create connection and command objects and use them - // to get a recordset - public static void getCommand(String con, String query) { - System.out.println("Command+Connection -> Recordset"); - Connection c = new Connection(); - c.setConnectionString(con); - c.Open(); - Command comm = new Command(); - comm.setActiveConnection(c); - comm.setCommandType(CommandTypeEnum.adCmdText); - comm.setCommandText(query); - Recordset rs = comm.Execute(); - printRS(rs); - c.Close(); - } - - public static void main(String[] args) { - String connectStr = "DRIVER=SQL Server;SERVER=DANADLER;UID=sa;PWD=;WSID=DANADLER;DATABASE=pubs"; - String queryStr = "select * from authors"; - getCommand(connectStr, queryStr); - getRS(connectStr, queryStr); - } -} diff --git a/samples/com/jacob/samples/applet/AppTest.html b/samples/com/jacob/samples/applet/AppTest.html deleted file mode 100644 index 0e084aa..0000000 --- a/samples/com/jacob/samples/applet/AppTest.html +++ /dev/null @@ -1,8 +0,0 @@ -Applet Test (1.1) -

      Applet Test (1.1)

      -
      - - -
      -The source. -
      diff --git a/samples/com/jacob/samples/applet/AppTest.java b/samples/com/jacob/samples/applet/AppTest.java deleted file mode 100644 index ca9cc82..0000000 --- a/samples/com/jacob/samples/applet/AppTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.jacob.samples.applet; - -import java.applet.Applet; -import java.awt.Button; -import java.awt.FlowLayout; -import java.awt.TextField; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * Applet test case - */ -public class AppTest extends Applet implements ActionListener { - /** - * unique identifier added by Eclipse because this class is serializable - */ - private static final long serialVersionUID = -6676420357823607065L; - - TextField in; - - TextField out; - - Button calc; - - ActiveXComponent sC = null; - - /** - * startup method - */ - public void init() { - setLayout(new FlowLayout()); - add(in = new TextField("1+1", 16)); - add(out = new TextField("?", 16)); - add(calc = new Button("Calculate")); - calc.addActionListener(this); - - } - - /** - * action method that receives button actions - * - * @param ev - * the event - */ - public void actionPerformed(ActionEvent ev) { - if (sC == null) { - String lang = "VBScript"; - sC = new ActiveXComponent("ScriptControl"); - Dispatch.put(sC, "Language", lang); - } - Variant v = Dispatch.call(sC, "Eval", in.getText()); - out.setText(v.toString()); - } -} diff --git a/samples/com/jacob/samples/atl/MultiFace/Face.cpp b/samples/com/jacob/samples/atl/MultiFace/Face.cpp deleted file mode 100644 index 836fbbd..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/Face.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Face.cpp : Implementation of CMultiFaceApp and DLL registration. - -#include "stdafx.h" -#include "MultiFace.h" -#include "Face.h" - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP Face::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_IFace1, - &IID_IFace2, - &IID_IFace3, - }; - - for (int i=0;i 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// Face - -class Face : - public IDispatchImpl, - public IDispatchImpl, - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ -// IFace1 -private: - CComBSTR name1; - -// IFace2 - CComBSTR name2; - -// IFace3 - CComBSTR name3; - -public: - Face() {} -BEGIN_COM_MAP(Face) - COM_INTERFACE_ENTRY2(IDispatch, IFace1) - COM_INTERFACE_ENTRY(IFace1) - COM_INTERFACE_ENTRY(IFace2) - COM_INTERFACE_ENTRY(IFace3) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -//DECLARE_NOT_AGGREGATABLE(Face) -// Remove the comment from the line above if you don't want your object to -// support aggregation. - -DECLARE_REGISTRY_RESOURCEID(IDR_Face) -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - - - -public: - STDMETHOD(get_Face3Name)(/*[out, retval]*/ BSTR *pVal); - STDMETHOD(put_Face3Name)(/*[in]*/ BSTR newVal); - STDMETHOD(get_Face2Nam)(/*[out, retval]*/ BSTR *pVal); - STDMETHOD(put_Face2Nam)(/*[in]*/ BSTR newVal); - STDMETHOD(get_Face1Name)(/*[out, retval]*/ BSTR *pVal); - STDMETHOD(put_Face1Name)(/*[in]*/ BSTR newVal); -}; - -#endif // !defined(AFX_FACE_H__9BF24413_B2E0_11D4_A695_00104BFF3241__INCLUDED_) diff --git a/samples/com/jacob/samples/atl/MultiFace/Face.rgs b/samples/com/jacob/samples/atl/MultiFace/Face.rgs deleted file mode 100644 index 70682d3..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/Face.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - MultiFace.Face.1 = s 'Face Class' - { - CLSID = s '{9BF24412-B2E0-11D4-A695-00104BFF3241}' - } - MultiFace.Face = s 'Face Class' - { - CLSID = s '{9BF24412-B2E0-11D4-A695-00104BFF3241}' - } - NoRemove CLSID - { - ForceRemove {9BF24412-B2E0-11D4-A695-00104BFF3241} = s 'Face Class' - { - ProgID = s 'MultiFace.Face.1' - VersionIndependentProgID = s 'MultiFace.Face' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.aps b/samples/com/jacob/samples/atl/MultiFace/MultiFace.aps deleted file mode 100644 index cb604ec..0000000 Binary files a/samples/com/jacob/samples/atl/MultiFace/MultiFace.aps and /dev/null differ diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.cpp b/samples/com/jacob/samples/atl/MultiFace/MultiFace.cpp deleted file mode 100644 index 295f5b5..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// MultiFace.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f MultiFaceps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include -#include "MultiFace.h" - -#include "MultiFace_i.c" -#include "Face.h" - - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_Face, Face) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_MULTIFACELib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.def b/samples/com/jacob/samples/atl/MultiFace/MultiFace.def deleted file mode 100644 index 3a720ec..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.def +++ /dev/null @@ -1,9 +0,0 @@ -; MultiFace.def : Declares the module parameters. - -LIBRARY "MultiFace.DLL" - -EXPORTS - DllCanUnloadNow @1 PRIVATE - DllGetClassObject @2 PRIVATE - DllRegisterServer @3 PRIVATE - DllUnregisterServer @4 PRIVATE diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.dsp b/samples/com/jacob/samples/atl/MultiFace/MultiFace.dsp deleted file mode 100644 index 8bf5a50..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.dsp +++ /dev/null @@ -1,323 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MultiFace" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=MultiFace - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "MultiFace.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "MultiFace.mak" CFG="MultiFace - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "MultiFace - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MultiFace - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MultiFace - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MultiFace - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MultiFace - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MultiFace - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "MultiFace - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\Debug -TargetPath=.\Debug\MultiFace.dll -InputPath=.\Debug\MultiFace.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "MultiFace - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\DebugU -TargetPath=.\DebugU\MultiFace.dll -InputPath=.\DebugU\MultiFace.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "MultiFace - Win32 Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinSize" -# PROP BASE Intermediate_Dir "ReleaseMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinSize" -# PROP Intermediate_Dir "ReleaseMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinSize -TargetPath=.\ReleaseMinSize\MultiFace.dll -InputPath=.\ReleaseMinSize\MultiFace.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "MultiFace - Win32 Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinDependency" -# PROP BASE Intermediate_Dir "ReleaseMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinDependency" -# PROP Intermediate_Dir "ReleaseMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinDependency -TargetPath=.\ReleaseMinDependency\MultiFace.dll -InputPath=.\ReleaseMinDependency\MultiFace.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "MultiFace - Win32 Unicode Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinSize" -# PROP BASE Intermediate_Dir "ReleaseUMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinSize" -# PROP Intermediate_Dir "ReleaseUMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinSize -TargetPath=.\ReleaseUMinSize\MultiFace.dll -InputPath=.\ReleaseUMinSize\MultiFace.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "MultiFace - Win32 Unicode Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinDependency" -# PROP BASE Intermediate_Dir "ReleaseUMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinDependency" -# PROP Intermediate_Dir "ReleaseUMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinDependency -TargetPath=.\ReleaseUMinDependency\MultiFace.dll -InputPath=.\ReleaseUMinDependency\MultiFace.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ENDIF - -# Begin Target - -# Name "MultiFace - Win32 Debug" -# Name "MultiFace - Win32 Unicode Debug" -# Name "MultiFace - Win32 Release MinSize" -# Name "MultiFace - Win32 Release MinDependency" -# Name "MultiFace - Win32 Unicode Release MinSize" -# Name "MultiFace - Win32 Unicode Release MinDependency" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\Face.cpp -# End Source File -# Begin Source File - -SOURCE=.\MultiFace.cpp -# End Source File -# Begin Source File - -SOURCE=.\MultiFace.def -# End Source File -# Begin Source File - -SOURCE=.\MultiFace.idl -# ADD MTL /tlb ".\MultiFace.tlb" /h "MultiFace.h" /iid "MultiFace_i.c" /Oicf -# End Source File -# Begin Source File - -SOURCE=.\MultiFace.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\Face.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\Face.rgs -# End Source File -# End Group -# End Target -# End Project diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.dsw b/samples/com/jacob/samples/atl/MultiFace/MultiFace.dsw deleted file mode 100644 index 4d6beb1..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "MultiFace"=.\MultiFace.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.h b/samples/com/jacob/samples/atl/MultiFace/MultiFace.h deleted file mode 100644 index 7b976ee..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.h +++ /dev/null @@ -1,571 +0,0 @@ -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - -/* File created by MIDL compiler version 5.01.0164 */ -/* at Sun Nov 05 01:12:47 2000 - */ -/* Compiler settings for D:\jacob_15\samples\test\atl\MultiFace\MultiFace.idl: - Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext - error checks: allocation ref bounds_check enum stub_data -*/ -//@@MIDL_FILE_HEADING( ) - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 440 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __MultiFace_h__ -#define __MultiFace_h__ - -#ifdef __cplusplus -extern "C"{ -#endif - -/* Forward Declarations */ - -#ifndef __IFace1_FWD_DEFINED__ -#define __IFace1_FWD_DEFINED__ -typedef interface IFace1 IFace1; -#endif /* __IFace1_FWD_DEFINED__ */ - - -#ifndef __IFace2_FWD_DEFINED__ -#define __IFace2_FWD_DEFINED__ -typedef interface IFace2 IFace2; -#endif /* __IFace2_FWD_DEFINED__ */ - - -#ifndef __IFace3_FWD_DEFINED__ -#define __IFace3_FWD_DEFINED__ -typedef interface IFace3 IFace3; -#endif /* __IFace3_FWD_DEFINED__ */ - - -#ifndef __Face_FWD_DEFINED__ -#define __Face_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class Face Face; -#else -typedef struct Face Face; -#endif /* __cplusplus */ - -#endif /* __Face_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" - -void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); -void __RPC_USER MIDL_user_free( void __RPC_FAR * ); - -#ifndef __IFace1_INTERFACE_DEFINED__ -#define __IFace1_INTERFACE_DEFINED__ - -/* interface IFace1 */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IFace1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9BF2440F-B2E0-11D4-A695-00104BFF3241") - IFace1 : public IDispatch - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Face1Name( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Face1Name( - /* [in] */ BSTR newVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IFace1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( - IFace1 __RPC_FAR * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( - IFace1 __RPC_FAR * This); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( - IFace1 __RPC_FAR * This); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( - IFace1 __RPC_FAR * This, - /* [out] */ UINT __RPC_FAR *pctinfo); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( - IFace1 __RPC_FAR * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( - IFace1 __RPC_FAR * This, - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( - IFace1 __RPC_FAR * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Face1Name )( - IFace1 __RPC_FAR * This, - /* [retval][out] */ BSTR __RPC_FAR *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Face1Name )( - IFace1 __RPC_FAR * This, - /* [in] */ BSTR newVal); - - END_INTERFACE - } IFace1Vtbl; - - interface IFace1 - { - CONST_VTBL struct IFace1Vtbl __RPC_FAR *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFace1_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IFace1_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IFace1_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define IFace1_GetTypeInfoCount(This,pctinfo) \ - (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) - -#define IFace1_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) - -#define IFace1_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) - -#define IFace1_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) - - -#define IFace1_get_Face1Name(This,pVal) \ - (This)->lpVtbl -> get_Face1Name(This,pVal) - -#define IFace1_put_Face1Name(This,newVal) \ - (This)->lpVtbl -> put_Face1Name(This,newVal) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE IFace1_get_Face1Name_Proxy( - IFace1 __RPC_FAR * This, - /* [retval][out] */ BSTR __RPC_FAR *pVal); - - -void __RPC_STUB IFace1_get_Face1Name_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE IFace1_put_Face1Name_Proxy( - IFace1 __RPC_FAR * This, - /* [in] */ BSTR newVal); - - -void __RPC_STUB IFace1_put_Face1Name_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IFace1_INTERFACE_DEFINED__ */ - - -#ifndef __IFace2_INTERFACE_DEFINED__ -#define __IFace2_INTERFACE_DEFINED__ - -/* interface IFace2 */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IFace2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9BF24410-B2E0-11D4-A695-00104BFF3241") - IFace2 : public IDispatch - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Face2Nam( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Face2Nam( - /* [in] */ BSTR newVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IFace2Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( - IFace2 __RPC_FAR * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( - IFace2 __RPC_FAR * This); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( - IFace2 __RPC_FAR * This); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( - IFace2 __RPC_FAR * This, - /* [out] */ UINT __RPC_FAR *pctinfo); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( - IFace2 __RPC_FAR * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( - IFace2 __RPC_FAR * This, - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( - IFace2 __RPC_FAR * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Face2Nam )( - IFace2 __RPC_FAR * This, - /* [retval][out] */ BSTR __RPC_FAR *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Face2Nam )( - IFace2 __RPC_FAR * This, - /* [in] */ BSTR newVal); - - END_INTERFACE - } IFace2Vtbl; - - interface IFace2 - { - CONST_VTBL struct IFace2Vtbl __RPC_FAR *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFace2_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IFace2_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IFace2_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define IFace2_GetTypeInfoCount(This,pctinfo) \ - (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) - -#define IFace2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) - -#define IFace2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) - -#define IFace2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) - - -#define IFace2_get_Face2Nam(This,pVal) \ - (This)->lpVtbl -> get_Face2Nam(This,pVal) - -#define IFace2_put_Face2Nam(This,newVal) \ - (This)->lpVtbl -> put_Face2Nam(This,newVal) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE IFace2_get_Face2Nam_Proxy( - IFace2 __RPC_FAR * This, - /* [retval][out] */ BSTR __RPC_FAR *pVal); - - -void __RPC_STUB IFace2_get_Face2Nam_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE IFace2_put_Face2Nam_Proxy( - IFace2 __RPC_FAR * This, - /* [in] */ BSTR newVal); - - -void __RPC_STUB IFace2_put_Face2Nam_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IFace2_INTERFACE_DEFINED__ */ - - -#ifndef __IFace3_INTERFACE_DEFINED__ -#define __IFace3_INTERFACE_DEFINED__ - -/* interface IFace3 */ -/* [unique][helpstring][dual][uuid][object] */ - - -EXTERN_C const IID IID_IFace3; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9BF24411-B2E0-11D4-A695-00104BFF3241") - IFace3 : public IDispatch - { - public: - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Face3Name( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Face3Name( - /* [in] */ BSTR newVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IFace3Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( - IFace3 __RPC_FAR * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( - IFace3 __RPC_FAR * This); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( - IFace3 __RPC_FAR * This); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( - IFace3 __RPC_FAR * This, - /* [out] */ UINT __RPC_FAR *pctinfo); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( - IFace3 __RPC_FAR * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( - IFace3 __RPC_FAR * This, - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( - IFace3 __RPC_FAR * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr); - - /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Face3Name )( - IFace3 __RPC_FAR * This, - /* [retval][out] */ BSTR __RPC_FAR *pVal); - - /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Face3Name )( - IFace3 __RPC_FAR * This, - /* [in] */ BSTR newVal); - - END_INTERFACE - } IFace3Vtbl; - - interface IFace3 - { - CONST_VTBL struct IFace3Vtbl __RPC_FAR *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFace3_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IFace3_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IFace3_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define IFace3_GetTypeInfoCount(This,pctinfo) \ - (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) - -#define IFace3_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) - -#define IFace3_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) - -#define IFace3_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) - - -#define IFace3_get_Face3Name(This,pVal) \ - (This)->lpVtbl -> get_Face3Name(This,pVal) - -#define IFace3_put_Face3Name(This,newVal) \ - (This)->lpVtbl -> put_Face3Name(This,newVal) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE IFace3_get_Face3Name_Proxy( - IFace3 __RPC_FAR * This, - /* [retval][out] */ BSTR __RPC_FAR *pVal); - - -void __RPC_STUB IFace3_get_Face3Name_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE IFace3_put_Face3Name_Proxy( - IFace3 __RPC_FAR * This, - /* [in] */ BSTR newVal); - - -void __RPC_STUB IFace3_put_Face3Name_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IFace3_INTERFACE_DEFINED__ */ - - - -#ifndef __MULTIFACELib_LIBRARY_DEFINED__ -#define __MULTIFACELib_LIBRARY_DEFINED__ - -/* library MULTIFACELib */ -/* [helpstring][version][uuid] */ - - -EXTERN_C const IID LIBID_MULTIFACELib; - -EXTERN_C const CLSID CLSID_Face; - -#ifdef __cplusplus - -class DECLSPEC_UUID("9BF24412-B2E0-11D4-A695-00104BFF3241") -Face; -#endif -#endif /* __MULTIFACELib_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * ); -unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); -unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); -void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.idl b/samples/com/jacob/samples/atl/MultiFace/MultiFace.idl deleted file mode 100644 index 37b07aa..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.idl +++ /dev/null @@ -1,70 +0,0 @@ -// MultiFace.idl : IDL source for MultiFace.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (MultiFace.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; - - [ - object, - uuid(9BF2440F-B2E0-11D4-A695-00104BFF3241), - dual, - helpstring("IFace1 Interface"), - pointer_default(unique) - ] - interface IFace1 : IDispatch - { - [propget, id(1), helpstring("property Face1Name")] HRESULT Face1Name([out, retval] BSTR *pVal); - [propput, id(1), helpstring("property Face1Name")] HRESULT Face1Name([in] BSTR newVal); - }; - - [ - object, - uuid(9BF24410-B2E0-11D4-A695-00104BFF3241), - dual, - helpstring("IFace2 Interface"), - pointer_default(unique) - ] - interface IFace2 : IDispatch - { - [propget, id(1), helpstring("property Face2Nam")] HRESULT Face2Nam([out, retval] BSTR *pVal); - [propput, id(1), helpstring("property Face2Nam")] HRESULT Face2Nam([in] BSTR newVal); - }; - - [ - object, - uuid(9BF24411-B2E0-11D4-A695-00104BFF3241), - dual, - helpstring("IFace3 Interface"), - pointer_default(unique) - ] - interface IFace3 : IDispatch - { - [propget, id(1), helpstring("property Face3Name")] HRESULT Face3Name([out, retval] BSTR *pVal); - [propput, id(1), helpstring("property Face3Name")] HRESULT Face3Name([in] BSTR newVal); - }; - -[ - uuid(9BF24403-B2E0-11D4-A695-00104BFF3241), - version(1.0), - helpstring("MultiFace 1.0 Type Library") -] -library MULTIFACELib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - - [ - uuid(9BF24412-B2E0-11D4-A695-00104BFF3241), - helpstring("Face Class") - ] - coclass Face - { - [default] interface IFace1; - interface IFace2; - interface IFace3; - }; -}; diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.ncb b/samples/com/jacob/samples/atl/MultiFace/MultiFace.ncb deleted file mode 100644 index 2e46496..0000000 Binary files a/samples/com/jacob/samples/atl/MultiFace/MultiFace.ncb and /dev/null differ diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.opt b/samples/com/jacob/samples/atl/MultiFace/MultiFace.opt deleted file mode 100644 index 38ebdd2..0000000 Binary files a/samples/com/jacob/samples/atl/MultiFace/MultiFace.opt and /dev/null differ diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.plg b/samples/com/jacob/samples/atl/MultiFace/MultiFace.plg deleted file mode 100644 index 5ade7bc..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.plg +++ /dev/null @@ -1,48 +0,0 @@ - - -
      -

      Build Log

      -

      ---------------------Configuration: MultiFace - Win32 Debug-------------------- -

      -

      Command Lines

      -Creating temporary file "C:\TEMP\RSP335.tmp" with contents -[ -/nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fp"Debug/MultiFace.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"D:\jacob_15\samples\test\atl\MultiFace\MultiFace.cpp" -"D:\jacob_15\samples\test\atl\MultiFace\Face.cpp" -] -Creating command line "cl.exe @C:\TEMP\RSP335.tmp" -Creating temporary file "C:\TEMP\RSP336.tmp" with contents -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"Debug/MultiFace.pdb" /debug /machine:I386 /def:".\MultiFace.def" /out:"Debug/MultiFace.dll" /implib:"Debug/MultiFace.lib" /pdbtype:sept -.\Debug\StdAfx.obj -.\Debug\MultiFace.obj -.\Debug\MultiFace.res -.\Debug\Face.obj -] -Creating command line "link.exe @C:\TEMP\RSP336.tmp" -Creating temporary file "C:\TEMP\RSP337.bat" with contents -[ -@echo off -regsvr32 /s /c ".\Debug\MultiFace.dll" -echo regsvr32 exec. time > ".\Debug\regsvr32.trg" -] -Creating command line "C:\TEMP\RSP337.bat" -Compiling... -MultiFace.cpp -Face.cpp -Generating Code... -Linking... -

      Output Window

      -Performing registration -RegSvr32: DllRegisterServer in .\Debug\MultiFace.dll succeeded. - - - - -

      Results

      -MultiFace.dll - 0 error(s), 0 warning(s) -
      - - diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.rc b/samples/com/jacob/samples/atl/MultiFace/MultiFace.rc deleted file mode 100644 index db11272..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace.rc +++ /dev/null @@ -1,125 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""MultiFace.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "MultiFace Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "MultiFace\0" - VALUE "LegalCopyright", "Copyright 2000\0" - VALUE "OriginalFilename", "MultiFace.DLL\0" - VALUE "ProductName", "MultiFace Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_Face REGISTRY DISCARDABLE "Face.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "MultiFace" - IDS_FACE_DESC "Face Class" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "MultiFace.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace.tlb b/samples/com/jacob/samples/atl/MultiFace/MultiFace.tlb deleted file mode 100644 index 6186694..0000000 Binary files a/samples/com/jacob/samples/atl/MultiFace/MultiFace.tlb and /dev/null differ diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace_i.c b/samples/com/jacob/samples/atl/MultiFace/MultiFace_i.c deleted file mode 100644 index 6fb00ca..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace_i.c +++ /dev/null @@ -1,56 +0,0 @@ -/* this file contains the actual definitions of */ -/* the IIDs and CLSIDs */ - -/* link this file in with the server and any clients */ - - -/* File created by MIDL compiler version 5.01.0164 */ -/* at Sun Nov 05 01:12:47 2000 - */ -/* Compiler settings for D:\jacob_15\samples\test\atl\MultiFace\MultiFace.idl: - Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext - error checks: allocation ref bounds_check enum stub_data -*/ -//@@MIDL_FILE_HEADING( ) -#ifdef __cplusplus -extern "C"{ -#endif - - -#ifndef __IID_DEFINED__ -#define __IID_DEFINED__ - -typedef struct _IID -{ - unsigned long x; - unsigned short s1; - unsigned short s2; - unsigned char c[8]; -} IID; - -#endif // __IID_DEFINED__ - -#ifndef CLSID_DEFINED -#define CLSID_DEFINED -typedef IID CLSID; -#endif // CLSID_DEFINED - -const IID IID_IFace1 = {0x9BF2440F,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}}; - - -const IID IID_IFace2 = {0x9BF24410,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}}; - - -const IID IID_IFace3 = {0x9BF24411,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}}; - - -const IID LIBID_MULTIFACELib = {0x9BF24403,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}}; - - -const CLSID CLSID_Face = {0x9BF24412,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}}; - - -#ifdef __cplusplus -} -#endif - diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFace_p.c b/samples/com/jacob/samples/atl/MultiFace/MultiFace_p.c deleted file mode 100644 index 58b87e7..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFace_p.c +++ /dev/null @@ -1,570 +0,0 @@ -/* this ALWAYS GENERATED file contains the proxy stub code */ - - -/* File created by MIDL compiler version 5.01.0164 */ -/* at Sun Nov 05 01:12:47 2000 - */ -/* Compiler settings for D:\jacob_15\samples\test\atl\MultiFace\MultiFace.idl: - Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext - error checks: allocation ref bounds_check enum stub_data -*/ -//@@MIDL_FILE_HEADING( ) - -#define USE_STUBLESS_PROXY - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REDQ_RPCPROXY_H_VERSION__ -#define __REQUIRED_RPCPROXY_H_VERSION__ 440 -#endif - - -#include "rpcproxy.h" -#ifndef __RPCPROXY_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCPROXY_H_VERSION__ - - -#include "MultiFace.h" - -#define TYPE_FORMAT_STRING_SIZE 55 -#define PROC_FORMAT_STRING_SIZE 57 - -typedef struct _MIDL_TYPE_FORMAT_STRING - { - short Pad; - unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; - } MIDL_TYPE_FORMAT_STRING; - -typedef struct _MIDL_PROC_FORMAT_STRING - { - short Pad; - unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; - } MIDL_PROC_FORMAT_STRING; - - -extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString; -extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString; - - -/* Object interface: IUnknown, ver. 0.0, - GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ - - -/* Object interface: IDispatch, ver. 0.0, - GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ - - -/* Object interface: IFace1, ver. 0.0, - GUID={0x9BF2440F,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}} */ - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IFace1_ServerInfo; - -#pragma code_seg(".orpc") -static const unsigned short IFace1_FormatStringOffsetTable[] = - { - (unsigned short) -1, - (unsigned short) -1, - (unsigned short) -1, - (unsigned short) -1, - 0, - 28 - }; - -static const MIDL_SERVER_INFO IFace1_ServerInfo = - { - &Object_StubDesc, - 0, - __MIDL_ProcFormatString.Format, - &IFace1_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0 - }; - -static const MIDL_STUBLESS_PROXY_INFO IFace1_ProxyInfo = - { - &Object_StubDesc, - __MIDL_ProcFormatString.Format, - &IFace1_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - -CINTERFACE_PROXY_VTABLE(9) _IFace1ProxyVtbl = -{ - &IFace1_ProxyInfo, - &IID_IFace1, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - 0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ , - 0 /* (void *)-1 /* IDispatch::GetTypeInfo */ , - 0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ , - 0 /* IDispatch_Invoke_Proxy */ , - (void *)-1 /* IFace1::get_Face1Name */ , - (void *)-1 /* IFace1::put_Face1Name */ -}; - - -static const PRPC_STUB_FUNCTION IFace1_table[] = -{ - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - NdrStubCall2, - NdrStubCall2 -}; - -CInterfaceStubVtbl _IFace1StubVtbl = -{ - &IID_IFace1, - &IFace1_ServerInfo, - 9, - &IFace1_table[-3], - CStdStubBuffer_DELEGATING_METHODS -}; - - -/* Object interface: IFace2, ver. 0.0, - GUID={0x9BF24410,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}} */ - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IFace2_ServerInfo; - -#pragma code_seg(".orpc") -static const unsigned short IFace2_FormatStringOffsetTable[] = - { - (unsigned short) -1, - (unsigned short) -1, - (unsigned short) -1, - (unsigned short) -1, - 0, - 28 - }; - -static const MIDL_SERVER_INFO IFace2_ServerInfo = - { - &Object_StubDesc, - 0, - __MIDL_ProcFormatString.Format, - &IFace2_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0 - }; - -static const MIDL_STUBLESS_PROXY_INFO IFace2_ProxyInfo = - { - &Object_StubDesc, - __MIDL_ProcFormatString.Format, - &IFace2_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - -CINTERFACE_PROXY_VTABLE(9) _IFace2ProxyVtbl = -{ - &IFace2_ProxyInfo, - &IID_IFace2, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - 0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ , - 0 /* (void *)-1 /* IDispatch::GetTypeInfo */ , - 0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ , - 0 /* IDispatch_Invoke_Proxy */ , - (void *)-1 /* IFace2::get_Face2Nam */ , - (void *)-1 /* IFace2::put_Face2Nam */ -}; - - -static const PRPC_STUB_FUNCTION IFace2_table[] = -{ - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - NdrStubCall2, - NdrStubCall2 -}; - -CInterfaceStubVtbl _IFace2StubVtbl = -{ - &IID_IFace2, - &IFace2_ServerInfo, - 9, - &IFace2_table[-3], - CStdStubBuffer_DELEGATING_METHODS -}; - - -/* Object interface: IFace3, ver. 0.0, - GUID={0x9BF24411,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}} */ - - -extern const MIDL_STUB_DESC Object_StubDesc; - - -extern const MIDL_SERVER_INFO IFace3_ServerInfo; - -#pragma code_seg(".orpc") -extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[1]; - -static const MIDL_STUB_DESC Object_StubDesc = - { - 0, - NdrOleAllocate, - NdrOleFree, - 0, - 0, - 0, - 0, - 0, - __MIDL_TypeFormatString.Format, - 1, /* -error bounds_check flag */ - 0x20000, /* Ndr library version */ - 0, - 0x50100a4, /* MIDL Version 5.1.164 */ - 0, - UserMarshalRoutines, - 0, /* notify & notify_flag routine table */ - 1, /* Flags */ - 0, /* Reserved3 */ - 0, /* Reserved4 */ - 0 /* Reserved5 */ - }; - -static const unsigned short IFace3_FormatStringOffsetTable[] = - { - (unsigned short) -1, - (unsigned short) -1, - (unsigned short) -1, - (unsigned short) -1, - 0, - 28 - }; - -static const MIDL_SERVER_INFO IFace3_ServerInfo = - { - &Object_StubDesc, - 0, - __MIDL_ProcFormatString.Format, - &IFace3_FormatStringOffsetTable[-3], - 0, - 0, - 0, - 0 - }; - -static const MIDL_STUBLESS_PROXY_INFO IFace3_ProxyInfo = - { - &Object_StubDesc, - __MIDL_ProcFormatString.Format, - &IFace3_FormatStringOffsetTable[-3], - 0, - 0, - 0 - }; - -CINTERFACE_PROXY_VTABLE(9) _IFace3ProxyVtbl = -{ - &IFace3_ProxyInfo, - &IID_IFace3, - IUnknown_QueryInterface_Proxy, - IUnknown_AddRef_Proxy, - IUnknown_Release_Proxy , - 0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ , - 0 /* (void *)-1 /* IDispatch::GetTypeInfo */ , - 0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ , - 0 /* IDispatch_Invoke_Proxy */ , - (void *)-1 /* IFace3::get_Face3Name */ , - (void *)-1 /* IFace3::put_Face3Name */ -}; - - -static const PRPC_STUB_FUNCTION IFace3_table[] = -{ - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - STUB_FORWARDING_FUNCTION, - NdrStubCall2, - NdrStubCall2 -}; - -CInterfaceStubVtbl _IFace3StubVtbl = -{ - &IID_IFace3, - &IFace3_ServerInfo, - 9, - &IFace3_table[-3], - CStdStubBuffer_DELEGATING_METHODS -}; - -#pragma data_seg(".rdata") - -static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[1] = - { - - { - BSTR_UserSize - ,BSTR_UserMarshal - ,BSTR_UserUnmarshal - ,BSTR_UserFree - } - - }; - - -#if !defined(__RPC_WIN32__) -#error Invalid build platform for this stub. -#endif - -#if !(TARGET_IS_NT40_OR_LATER) -#error You need a Windows NT 4.0 or later to run this stub because it uses these features: -#error -Oif or -Oicf, [wire_marshal] or [user_marshal] attribute, more than 32 methods in the interface. -#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems. -#error This app will die there with the RPC_X_WRONG_STUB_VERSION error. -#endif - - -static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString = - { - 0, - { - - /* Procedure get_Face3Name */ - - - /* Procedure get_Face2Nam */ - - - /* Procedure get_Face1Name */ - - 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 2 */ NdrFcLong( 0x0 ), /* 0 */ -/* 6 */ NdrFcShort( 0x7 ), /* 7 */ -#ifndef _ALPHA_ -/* 8 */ NdrFcShort( 0xc ), /* x86, MIPS, PPC Stack size/offset = 12 */ -#else - NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */ -#endif -/* 10 */ NdrFcShort( 0x0 ), /* 0 */ -/* 12 */ NdrFcShort( 0x8 ), /* 8 */ -/* 14 */ 0x5, /* Oi2 Flags: srv must size, has return, */ - 0x2, /* 2 */ - - /* Parameter pVal */ - - - /* Parameter pVal */ - - - /* Parameter pVal */ - -/* 16 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ -#ifndef _ALPHA_ -/* 18 */ NdrFcShort( 0x4 ), /* x86, MIPS, PPC Stack size/offset = 4 */ -#else - NdrFcShort( 0x8 ), /* Alpha Stack size/offset = 8 */ -#endif -/* 20 */ NdrFcShort( 0x1e ), /* Type Offset=30 */ - - /* Return value */ - - - /* Return value */ - - - /* Return value */ - -/* 22 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -#ifndef _ALPHA_ -/* 24 */ NdrFcShort( 0x8 ), /* x86, MIPS, PPC Stack size/offset = 8 */ -#else - NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */ -#endif -/* 26 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - /* Procedure put_Face3Name */ - - - /* Procedure put_Face2Nam */ - - - /* Procedure put_Face1Name */ - -/* 28 */ 0x33, /* FC_AUTO_HANDLE */ - 0x6c, /* Old Flags: object, Oi2 */ -/* 30 */ NdrFcLong( 0x0 ), /* 0 */ -/* 34 */ NdrFcShort( 0x8 ), /* 8 */ -#ifndef _ALPHA_ -/* 36 */ NdrFcShort( 0xc ), /* x86, MIPS, PPC Stack size/offset = 12 */ -#else - NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */ -#endif -/* 38 */ NdrFcShort( 0x0 ), /* 0 */ -/* 40 */ NdrFcShort( 0x8 ), /* 8 */ -/* 42 */ 0x6, /* Oi2 Flags: clt must size, has return, */ - 0x2, /* 2 */ - - /* Parameter newVal */ - - - /* Parameter newVal */ - - - /* Parameter newVal */ - -/* 44 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ -#ifndef _ALPHA_ -/* 46 */ NdrFcShort( 0x4 ), /* x86, MIPS, PPC Stack size/offset = 4 */ -#else - NdrFcShort( 0x8 ), /* Alpha Stack size/offset = 8 */ -#endif -/* 48 */ NdrFcShort( 0x2c ), /* Type Offset=44 */ - - /* Return value */ - - - /* Return value */ - - - /* Return value */ - -/* 50 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -#ifndef _ALPHA_ -/* 52 */ NdrFcShort( 0x8 ), /* x86, MIPS, PPC Stack size/offset = 8 */ -#else - NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */ -#endif -/* 54 */ 0x8, /* FC_LONG */ - 0x0, /* 0 */ - - 0x0 - } - }; - -static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString = - { - 0, - { - NdrFcShort( 0x0 ), /* 0 */ -/* 2 */ - 0x11, 0x4, /* FC_RP [alloced_on_stack] */ -/* 4 */ NdrFcShort( 0x1a ), /* Offset= 26 (30) */ -/* 6 */ - 0x13, 0x0, /* FC_OP */ -/* 8 */ NdrFcShort( 0xc ), /* Offset= 12 (20) */ -/* 10 */ - 0x1b, /* FC_CARRAY */ - 0x1, /* 1 */ -/* 12 */ NdrFcShort( 0x2 ), /* 2 */ -/* 14 */ 0x9, /* Corr desc: FC_ULONG */ - 0x0, /* */ -/* 16 */ NdrFcShort( 0xfffc ), /* -4 */ -/* 18 */ 0x6, /* FC_SHORT */ - 0x5b, /* FC_END */ -/* 20 */ - 0x17, /* FC_CSTRUCT */ - 0x3, /* 3 */ -/* 22 */ NdrFcShort( 0x8 ), /* 8 */ -/* 24 */ NdrFcShort( 0xfffffff2 ), /* Offset= -14 (10) */ -/* 26 */ 0x8, /* FC_LONG */ - 0x8, /* FC_LONG */ -/* 28 */ 0x5c, /* FC_PAD */ - 0x5b, /* FC_END */ -/* 30 */ 0xb4, /* FC_USER_MARSHAL */ - 0x83, /* 131 */ -/* 32 */ NdrFcShort( 0x0 ), /* 0 */ -/* 34 */ NdrFcShort( 0x4 ), /* 4 */ -/* 36 */ NdrFcShort( 0x0 ), /* 0 */ -/* 38 */ NdrFcShort( 0xffffffe0 ), /* Offset= -32 (6) */ -/* 40 */ - 0x12, 0x0, /* FC_UP */ -/* 42 */ NdrFcShort( 0xffffffea ), /* Offset= -22 (20) */ -/* 44 */ 0xb4, /* FC_USER_MARSHAL */ - 0x83, /* 131 */ -/* 46 */ NdrFcShort( 0x0 ), /* 0 */ -/* 48 */ NdrFcShort( 0x4 ), /* 4 */ -/* 50 */ NdrFcShort( 0x0 ), /* 0 */ -/* 52 */ NdrFcShort( 0xfffffff4 ), /* Offset= -12 (40) */ - - 0x0 - } - }; - -const CInterfaceProxyVtbl * _MultiFace_ProxyVtblList[] = -{ - ( CInterfaceProxyVtbl *) &_IFace1ProxyVtbl, - ( CInterfaceProxyVtbl *) &_IFace2ProxyVtbl, - ( CInterfaceProxyVtbl *) &_IFace3ProxyVtbl, - 0 -}; - -const CInterfaceStubVtbl * _MultiFace_StubVtblList[] = -{ - ( CInterfaceStubVtbl *) &_IFace1StubVtbl, - ( CInterfaceStubVtbl *) &_IFace2StubVtbl, - ( CInterfaceStubVtbl *) &_IFace3StubVtbl, - 0 -}; - -PCInterfaceName const _MultiFace_InterfaceNamesList[] = -{ - "IFace1", - "IFace2", - "IFace3", - 0 -}; - -const IID * _MultiFace_BaseIIDList[] = -{ - &IID_IDispatch, - &IID_IDispatch, - &IID_IDispatch, - 0 -}; - - -#define _MultiFace_CHECK_IID(n) IID_GENERIC_CHECK_IID( _MultiFace, pIID, n) - -int __stdcall _MultiFace_IID_Lookup( const IID * pIID, int * pIndex ) -{ - IID_BS_LOOKUP_SETUP - - IID_BS_LOOKUP_INITIAL_TEST( _MultiFace, 3, 2 ) - IID_BS_LOOKUP_NEXT_TEST( _MultiFace, 1 ) - IID_BS_LOOKUP_RETURN_RESULT( _MultiFace, 3, *pIndex ) - -} - -const ExtendedProxyFileInfo MultiFace_ProxyFileInfo = -{ - (PCInterfaceProxyVtblList *) & _MultiFace_ProxyVtblList, - (PCInterfaceStubVtblList *) & _MultiFace_StubVtblList, - (const PCInterfaceName * ) & _MultiFace_InterfaceNamesList, - (const IID ** ) & _MultiFace_BaseIIDList, - & _MultiFace_IID_Lookup, - 3, - 2, - 0, /* table of [async_uuid] interfaces */ - 0, /* Filler1 */ - 0, /* Filler2 */ - 0 /* Filler3 */ -}; diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFaceps.def b/samples/com/jacob/samples/atl/MultiFace/MultiFaceps.def deleted file mode 100644 index 6c1fe81..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFaceps.def +++ /dev/null @@ -1,11 +0,0 @@ - -LIBRARY "MultiFacePS" - -DESCRIPTION 'Proxy/Stub DLL' - -EXPORTS - DllGetClassObject @1 PRIVATE - DllCanUnloadNow @2 PRIVATE - GetProxyDllInfo @3 PRIVATE - DllRegisterServer @4 PRIVATE - DllUnregisterServer @5 PRIVATE diff --git a/samples/com/jacob/samples/atl/MultiFace/MultiFaceps.mk b/samples/com/jacob/samples/atl/MultiFace/MultiFaceps.mk deleted file mode 100644 index 1a47615..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/MultiFaceps.mk +++ /dev/null @@ -1,16 +0,0 @@ - -MultiFaceps.dll: dlldata.obj MultiFace_p.obj MultiFace_i.obj - link /dll /out:MultiFaceps.dll /def:MultiFaceps.def /entry:DllMain dlldata.obj MultiFace_p.obj MultiFace_i.obj \ - kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \ - -.c.obj: - cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \ - $< - -clean: - @del MultiFaceps.dll - @del MultiFaceps.lib - @del MultiFaceps.exp - @del dlldata.obj - @del MultiFace_p.obj - @del MultiFace_i.obj diff --git a/samples/com/jacob/samples/atl/MultiFace/StdAfx.cpp b/samples/com/jacob/samples/atl/MultiFace/StdAfx.cpp deleted file mode 100644 index a5eea17..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/StdAfx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#include diff --git a/samples/com/jacob/samples/atl/MultiFace/StdAfx.h b/samples/com/jacob/samples/atl/MultiFace/StdAfx.h deleted file mode 100644 index 4a542ef..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/StdAfx.h +++ /dev/null @@ -1,27 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__9BF24406_B2E0_11D4_A695_00104BFF3241__INCLUDED_) -#define AFX_STDAFX_H__9BF24406_B2E0_11D4_A695_00104BFF3241__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#define _ATL_APARTMENT_THREADED - -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__9BF24406_B2E0_11D4_A695_00104BFF3241__INCLUDED) diff --git a/samples/com/jacob/samples/atl/MultiFace/dlldata.c b/samples/com/jacob/samples/atl/MultiFace/dlldata.c deleted file mode 100644 index 4671279..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/dlldata.c +++ /dev/null @@ -1,38 +0,0 @@ -/********************************************************* - DllData file -- generated by MIDL compiler - - DO NOT ALTER THIS FILE - - This file is regenerated by MIDL on every IDL file compile. - - To completely reconstruct this file, delete it and rerun MIDL - on all the IDL files in this DLL, specifying this file for the - /dlldata command line option - -*********************************************************/ - -#define PROXY_DELEGATION - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -EXTERN_PROXY_FILE( MultiFace ) - - -PROXYFILE_LIST_START -/* Start of list */ - REFERENCE_PROXY_FILE( MultiFace ), -/* End of list */ -PROXYFILE_LIST_END - - -DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) - -#ifdef __cplusplus -} /*extern "C" */ -#endif - -/* end of generated dlldata file */ diff --git a/samples/com/jacob/samples/atl/MultiFace/resource.h b/samples/com/jacob/samples/atl/MultiFace/resource.h deleted file mode 100644 index 926d27a..0000000 --- a/samples/com/jacob/samples/atl/MultiFace/resource.h +++ /dev/null @@ -1,18 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by MultiFace.rc -// -#define IDS_PROJNAME 100 -#define IDS_FACE_DESC 101 -#define IDR_Face 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 103 -#endif -#endif diff --git a/samples/com/jacob/samples/atl/MultiFaceTest.java b/samples/com/jacob/samples/atl/MultiFaceTest.java deleted file mode 100644 index fc64923..0000000 --- a/samples/com/jacob/samples/atl/MultiFaceTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.jacob.samples.atl; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -class MultiFaceTest { - - /** - * standard main() test program - * - * @param args - * the command line arguments - */ - public static void main(String[] args) { - // this method has been deprecated as being unreliable. - // shutdown should be done through other means - // whoever wrote this example should explain what this was intended to - // do - // System.runFinalizersOnExit(true); - - ActiveXComponent mf = new ActiveXComponent("MultiFace.Face"); - try { - // I am now dealing with the default interface (IFace1) - Dispatch.put(mf, "Face1Name", new Variant("Hello Face1")); - System.out.println(Dispatch.get(mf, "Face1Name")); - - // get to IFace2 through the IID - Dispatch f2 = mf - .QueryInterface("{9BF24410-B2E0-11D4-A695-00104BFF3241}"); - // I am now dealing with IFace2 - Dispatch.put(f2, "Face2Nam", new Variant("Hello Face2")); - System.out.println(Dispatch.get(f2, "Face2Nam")); - - // get to IFace3 through the IID - Dispatch f3 = mf - .QueryInterface("{9BF24411-B2E0-11D4-A695-00104BFF3241}"); - // I am now dealing with IFace3 - Dispatch.put(f3, "Face3Name", new Variant("Hello Face3")); - System.out.println(Dispatch.get(f3, "Face3Name")); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/samples/com/jacob/samples/atl/readme.txt b/samples/com/jacob/samples/atl/readme.txt deleted file mode 100644 index e71e350..0000000 --- a/samples/com/jacob/samples/atl/readme.txt +++ /dev/null @@ -1,14 +0,0 @@ -This example demonstrates how to access multiple interfaces. - -To run it, chdir to MultiFace\Debug and run: -regsvr32 MultiFace.dll - -Then, run (in this dir): -java MultiFace - -As you can see from MultiFace\MultiFace.idl - there are 3 interfaces. - -By default JACOB attaches to the default interface. - -The file MultiFace.java shows how to use the new Dispatch.QueryInterface -to get access to the other interfaces. diff --git a/samples/com/jacob/samples/office/ExcelDispatchTest.java b/samples/com/jacob/samples/office/ExcelDispatchTest.java deleted file mode 100644 index fea6229..0000000 --- a/samples/com/jacob/samples/office/ExcelDispatchTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.jacob.samples.office; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * Sample test program snagged out of a question on the sun discussion area. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ExcelDispatchTest { - - /** - * main run loop for test program - * - * @param args - * standard command line arguments - */ - public static void main(String[] args) { - ComThread.InitSTA(); - - ActiveXComponent xl = new ActiveXComponent("Excel.Application"); - try { - System.out.println("version=" + xl.getProperty("Version")); - System.out.println("version=" + Dispatch.get(xl, "Version")); - Dispatch.put(xl, "Visible", new Variant(true)); - Dispatch workbooks = xl.getProperty("Workbooks").toDispatch(); - Dispatch workbook = Dispatch.get(workbooks, "Add").toDispatch(); - Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch(); - Dispatch a1 = Dispatch.invoke(sheet, "Range", Dispatch.Get, - new Object[] { "A1" }, new int[1]).toDispatch(); - Dispatch a2 = Dispatch.invoke(sheet, "Range", Dispatch.Get, - new Object[] { "A2" }, new int[1]).toDispatch(); - Dispatch.put(a1, "Value", "123.456"); - Dispatch.put(a2, "Formula", "=A1*2"); - System.out.println("a1 from excel:" + Dispatch.get(a1, "Value")); - System.out.println("a2 from excel:" + Dispatch.get(a2, "Value")); - Variant f = new Variant(false); - Dispatch.call(workbook, "Close", f); - } catch (Exception e) { - e.printStackTrace(); - } finally { - xl.invoke("Quit", new Variant[] {}); - ComThread.Release(); - } - } - -} diff --git a/samples/com/jacob/samples/office/VisioPrintTest.java b/samples/com/jacob/samples/office/VisioPrintTest.java deleted file mode 100644 index 94c0b00..0000000 --- a/samples/com/jacob/samples/office/VisioPrintTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.jacob.samples.office; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComFailException; -import com.jacob.com.Dispatch; - -/** - * Snippet to show Visio print dialog - *

      - * Sample submitted by fatbuttlarry in SourceForge 1803140 as part of bug report - *

      - * Tested with Java 6.0SE and MS Office 2003 ** Note: 1010 = VB's - * visCmdFilePrint constant - */ -public class VisioPrintTest { - - /** - * Runs the print ant lets the user say ok or cancel. Note the funky Visio - * behavior if someone hits the cancel button - * - */ - public void testPrintDialog() { - ActiveXComponent oActiveX = new ActiveXComponent("Visio.Application"); - Dispatch oDocuments = oActiveX.getProperty("Documents").toDispatch(); - // create a blank document - Dispatch.call(oDocuments, "Add", ""); - try { - Dispatch.call(oActiveX, "DoCmd", new Integer(1010)).getInt(); - System.out.println("User hit the ok button."); - } catch (ComFailException e) { - System.out.println("User hit the cancel button: " + e); - } finally { - oActiveX.invoke("Quit"); - } - return; - } - - /** - * quick main() to test this - * - * @param args - * standard command line arguments - */ - public static void main(String[] args) { - VisioPrintTest testObject = new VisioPrintTest(); - testObject.testPrintDialog(); - } -} diff --git a/samples/com/jacob/samples/office/WordDocumentProperties.java b/samples/com/jacob/samples/office/WordDocumentProperties.java deleted file mode 100644 index 8bb090d..0000000 --- a/samples/com/jacob/samples/office/WordDocumentProperties.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.jacob.samples.office; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * Submitted to the Jacob SourceForge web site as a sample 3/2005 - * - * @author Date Created Description Jason Twist 04 Mar 2005 Code opens a locally - * stored Word document and extracts the Built In properties and Custom - * properties from it. This code just gives an intro to JACOB and there - * are sections that could be enhanced - */ -public class WordDocumentProperties { - // Declare word object - private ActiveXComponent objWord; - - // Declare Word Properties - private Dispatch custDocprops; - - private Dispatch builtInDocProps; - - // the doucments object is important in any real app but this demo doesn't - // use it - // private Dispatch documents; - - private Dispatch document; - - private Dispatch wordObject; - - /** - * Empty Constructor - * - */ - public WordDocumentProperties() { - } - - /** - * Opens a document - * - * @param filename - */ - public void open(String filename) { - // Instantiate objWord - objWord = new ActiveXComponent("Word.Application"); - - // Assign a local word object - wordObject = objWord.getObject(); - - // Create a Dispatch Parameter to hide the document that is opened - Dispatch.put(wordObject, "Visible", new Variant(false)); - - // Instantiate the Documents Property - Dispatch documents = objWord.getProperty("Documents").toDispatch(); - - // Open a word document, Current Active Document - document = Dispatch.call(documents, "Open", filename).toDispatch(); - } - - /** - * Creates an instance of the VBA CustomDocumentProperties property - * - */ - public void selectCustomDocumentProperitiesMode() { - // Create CustomDocumentProperties and BuiltInDocumentProperties - // properties - custDocprops = Dispatch.get(document, "CustomDocumentProperties") - .toDispatch(); - } - - /** - * Creates an instance of the VBA BuiltInDocumentProperties property - * - */ - public void selectBuiltinPropertiesMode() { - // Create CustomDocumentProperties and BuiltInDocumentProperties - // properties - builtInDocProps = Dispatch.get(document, "BuiltInDocumentProperties") - .toDispatch(); - } - - /** - * Closes a document - * - */ - public void close() { - // Close object - Dispatch.call(document, "Close"); - } - - /** - * Custom Property Name is passed in - * - * @param cusPropName - * @return String - Custom property value - */ - public String getCustomProperty(String cusPropName) { - try { - cusPropName = Dispatch.call(custDocprops, "Item", cusPropName) - .toString(); - } catch (ComException e) { - // Do nothing - cusPropName = null; - } - - return cusPropName; - } - - /** - * Built In Property Name is passed in - * - * @param builtInPropName - * @return String - Built in property value - */ - public String getBuiltInProperty(String builtInPropName) { - try { - builtInPropName = Dispatch.call(builtInDocProps, "Item", - builtInPropName).toString(); - } catch (ComException e) { - // Do nothing - builtInPropName = null; - } - - return builtInPropName; - } - - /** - * simple main program that gets some properties and prints them out - * - * @param args - */ - public static void main(String[] args) { - try { - // Instantiate the class - WordDocumentProperties jacTest = new WordDocumentProperties(); - - // Open the word doc - jacTest.open("\\\\Saturn\\documentstorage\\s.doc"); - - // Set Custom Properties - jacTest.selectCustomDocumentProperitiesMode(); - - // Set Built In Properties - jacTest.selectBuiltinPropertiesMode(); - - // Get custom Property Value - String custValue = jacTest.getCustomProperty("Information Source"); - - // Get built in prroperty Property Value - String builtInValue = jacTest.getBuiltInProperty("Author"); - - // Close Word Doc - jacTest.close(); - - // Output data - System.out.println("Document Val One: " + custValue); - System.out.println("Document Author: " + builtInValue); - - } catch (Exception e) { - System.out.println(e); - } - } -} \ No newline at end of file diff --git a/samples/com/jacob/samples/outlook/Outlook.java b/samples/com/jacob/samples/outlook/Outlook.java deleted file mode 100644 index 018091d..0000000 --- a/samples/com/jacob/samples/outlook/Outlook.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.jacob.samples.outlook; - -/** - * JACOB Outlook sample contributed by - * Christopher Brind - */ - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * sample class to show simple outlook manipulation - */ -public class Outlook { - - private static String pad(int i) { - StringBuffer sb = new StringBuffer(); - - while (sb.length() < i) { - sb.append(' '); - } - - return sb.toString(); - } - - private static void recurseFolders(int iIndent, Dispatch o) { - - if (o == null) { - return; - } - Dispatch oFolders = Dispatch.get(o, "Folders").toDispatch(); - // System.out.println("oFolders=" + oFolders); - if (oFolders == null) { - return; - } - - Dispatch oFolder = Dispatch.get(oFolders, "GetFirst").toDispatch(); - do { - Object oFolderName = Dispatch.get(oFolder, "Name"); - if (null == oFolderName) { - break; - } - - System.out.println(pad(iIndent) + oFolderName); - recurseFolders(iIndent + 3, oFolder); - - oFolder = Dispatch.get(oFolders, "GetNext").toDispatch(); - } while (true); - - } - - /** - * standard run loop - * - * @param asArgs - * command line arguments - * @throws Exception - */ - public static void main(String asArgs[]) throws Exception { - System.out.println("Outlook: IN"); - - ActiveXComponent axOutlook = new ActiveXComponent("Outlook.Application"); - try { - System.out.println("version=" + axOutlook.getProperty("Version")); - - Dispatch oOutlook = axOutlook.getObject(); - System.out.println("version=" + Dispatch.get(oOutlook, "Version")); - - Dispatch oNameSpace = axOutlook.getProperty("Session").toDispatch(); - System.out.println("oNameSpace=" + oNameSpace); - - recurseFolders(0, oNameSpace); - - } finally { - axOutlook.invoke("Quit", new Variant[] {}); - } - } - -} diff --git a/samples/com/jacob/samples/servlet/JacobScript.java_nocompile b/samples/com/jacob/samples/servlet/JacobScript.java_nocompile deleted file mode 100644 index fb09a34..0000000 --- a/samples/com/jacob/samples/servlet/JacobScript.java_nocompile +++ /dev/null @@ -1,75 +0,0 @@ -package com.jacob.samples.servlet; - -import javax.servlet.*; -import javax.servlet.http.*; -import java.io.*; - -import com.jacob.com.*; -import com.jacob.activeX.*; - -public class JacobScript extends javax.servlet.http.HttpServlet -{ - public void doGet(HttpServletRequest req, - HttpServletResponse res) - throws ServletException - { - PrintWriter out = null; - try - { - res.setContentType("text/html"); - out = res.getWriter(); - // display a form - out.println("

      Enter a VBScript Expression

      "); - out.println("
      "); - out.println(""); - out.println(""); - out.println("
      "); - } catch (Exception e) { - e.printStackTrace(); - out.println("

      Error:"+e+"

      "); - } - } - - public void doPost(HttpServletRequest req, - HttpServletResponse res) - throws ServletException - { - PrintWriter out = null; - - try - { - res.setContentType("text/html"); - out = res.getWriter(); - // get what they typed in - String expr = (String)req.getParameter("expr"); - // make sure we have a session - HttpSession session = req.getSession(true); - Dispatch sControl = null; - if (session.isNew()) - { - // initialize the control and store it on the session - String lang = "VBScript"; - ActiveXComponent sC = new ActiveXComponent("ScriptControl"); - sControl = sC.getObject(); - Dispatch.put(sControl, "Language", lang); - session.putValue("control", sControl); - } - else - { - sControl = (Dispatch)session.getValue("control"); - } - Variant result = Dispatch.call(sControl, "Eval", expr); - // display a form - out.println("

      Enter a VBScript Expression

      "); - out.println("
      "); - out.println(""); - out.println(""); - out.println("
      "); - out.println("

      Jacob Response:

      "); - out.println("

      "+result+"

      "); - } catch (Exception e) { - e.printStackTrace(); - out.println("

      Error:"+e+"

      "); - } - } -} diff --git a/samples/com/jacob/samples/servlet/readme.txt b/samples/com/jacob/samples/servlet/readme.txt deleted file mode 100644 index 145223d..0000000 --- a/samples/com/jacob/samples/servlet/readme.txt +++ /dev/null @@ -1,45 +0,0 @@ -This sample runs in Weblogic 5.1 as a servlet. - -0. Rename JacobScript.java_nocompile to JacobScript.java -1. Compile this file (make sure you have jdk1.2 installed or the - javax.servlet.* classes in your classpath). -2. Make sure the weblogic policy file allows native access. The easiest - way is to replace the contents with this: - -grant codeBase "file:d:/weblogic/-" { - permission java.security.AllPermission; -}; - -grant codeBase "file:/c:/classes/-" { - permission java.security.AllPermission; -}; - - -grant codeBase "file:${java.home}/lib/ext/-" { - permission java.security.AllPermission; -}; - -grant { - permission java.security.AllPermission; -}; - -3. Add the servlet to the weblogic.properties file: - -weblogic.httpd.register.JacobScript=JacobScript - -4. Either add your CLASSPATH to weblogic.classpath in startWebLogic.cmd - or copy the com directory into weblogic/myserver/servletclasses - -5. Copy the jacob/samples/servlet/* into weblogic/myserver/servletclasses -6. Start weblogic - -7. Type the url: http://localhost:7001/JacobScript into the browser - (If you run on port 7001) - -8. Enter a VBScript expression like: - 1+2 - Now - "hello" & " world" - etc. - and watch the MS Script control (which you must have installed) - evaluate and return the result. diff --git a/samples/com/jacob/samples/system/DiskUtils.java b/samples/com/jacob/samples/system/DiskUtils.java deleted file mode 100644 index 93a0621..0000000 --- a/samples/com/jacob/samples/system/DiskUtils.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.jacob.samples.system; - -import java.text.DecimalFormat; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -/** - * Example VB script that grabs hard drive properties. - *

      - * Source Forge posting - * http://sourceforge.net/forum/forum.php?thread_id=1785936&forum_id=375946 - *

      - * Enhance by clay_shooter with info from - * http://msdn2.microsoft.com/en-us/library/d6dw7aeh.aspx - * - * @author qstephenson - * - */ -public class DiskUtils { - - /** formatters aren't thread safe but the sample only has one thread */ - private static DecimalFormat sizeFormatter = new DecimalFormat( - "###,###,###,###"); - - /** a pointer to the scripting file system object */ - private ActiveXComponent fileSystemApp = null; - - /** the dispatch that points at the drive this DiskUtil operates against */ - private Dispatch myDrive = null; - - /** - * Standard constructor - * - * @param drive - * the drive to run the test against. - */ - public DiskUtils(String drive) { - setUp(drive); - } - - /** - * open the connection to the scripting object - * - * @param drive - * the drive to run the test against - */ - public void setUp(String drive) { - if (fileSystemApp == null) { - ComThread.InitSTA(); - fileSystemApp = new ActiveXComponent("Scripting.FileSystemObject"); - myDrive = Dispatch.call(fileSystemApp, "GetDrive", drive) - .toDispatch(); - } - } - - /** - * Do any needed cleanup - */ - public void tearDown() { - ComThread.Release(); - } - - /** - * convenience method - * - * @return driver serial number - */ - public int getSerialNumber() { - return Dispatch.get(myDrive, "SerialNumber").getInt(); - } - - /** - * Convenience method. We go through these formatting hoops so we can make - * the size string pretty. We wouldn't have to do that if we didn't mind - * long strings with Exxx at the end or the fact that the value returned can - * vary in size based on the size of the disk. - * - * @return driver total size of the disk - */ - public String getTotalSize() { - Variant returnValue = Dispatch.get(myDrive, "TotalSize"); - if (returnValue.getvt() == Variant.VariantDouble) { - return sizeFormatter.format(returnValue.getDouble()); - } else if (returnValue.getvt() == Variant.VariantInt) { - return sizeFormatter.format(returnValue.getInt()); - } else { - return "Don't know type: " + returnValue.getvt(); - } - } - - /** - * Convenience method. We wouldn't have to do that if we didn't mind long - * strings with Exxx at the end or the fact that the value returned can vary - * in size based on the size of the disk. - * - * @return driver free size of the disk - */ - public String getFreeSpace() { - Variant returnValue = Dispatch.get(myDrive, "FreeSpace"); - if (returnValue.getvt() == Variant.VariantDouble) { - return sizeFormatter.format(returnValue.getDouble()); - } else if (returnValue.getvt() == Variant.VariantInt) { - return sizeFormatter.format(returnValue.getInt()); - } else { - return "Don't know type: " + returnValue.getvt(); - } - } - - /** - * - * @return file system on the drive - */ - public String getFileSystemType() { - // figure ot the actual variant type - // Variant returnValue = Dispatch.get(myDrive, "FileSystem"); - // System.out.println(returnValue.getvt()); - return Dispatch.get(myDrive, "FileSystem").getString(); - } - - /** - * - * @return volume name - */ - public String getVolumeName() { - return Dispatch.get(myDrive, "VolumeName").getString(); - } - - /** - * Simple main program that creates a DiskUtils object and queries for the - * C: drive - * - * @param args - * standard command line arguments - */ - public static void main(String[] args) { - // DiskUtils utilConnection = new DiskUtils("F"); - DiskUtils utilConnection = new DiskUtils("C"); - System.out.println("Disk serial number is: " - + utilConnection.getSerialNumber()); - System.out.println("FileSystem is: " - + utilConnection.getFileSystemType()); - System.out.println("Volume Name is: " + utilConnection.getVolumeName()); - System.out.println("Disk total size is: " - + utilConnection.getTotalSize()); - System.out.println("Disk free space is: " - + utilConnection.getFreeSpace()); - utilConnection.tearDown(); - } -} diff --git a/samples/com/jacob/samples/system/SystemMonitor.java b/samples/com/jacob/samples/system/SystemMonitor.java deleted file mode 100644 index a3a05a1..0000000 --- a/samples/com/jacob/samples/system/SystemMonitor.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.jacob.samples.system; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.Dispatch; -import com.jacob.com.EnumVariant; -import com.jacob.com.Variant; - -/** - * Sample program that shows how to talk to WMI on local machine. - * - * This test program was derived from SourceForge question - * http://sourceforge.net/forum/forum.php?thread_id=1831650&forum_id=375946 - * fold, spindled and mutilated by clay_shooter - * - * @author chris_knowles - * - */ -public class SystemMonitor { - - /** - * example run loop method called by main() - */ - public void runMonitor() { - - ActiveXComponent wmi = null; - wmi = new ActiveXComponent("WbemScripting.SWbemLocator"); - // no connection parameters means to connect to the local machine - Variant conRet = wmi.invoke("ConnectServer"); - // the author liked the ActiveXComponent api style over the Dispatch - // style - ActiveXComponent wmiconnect = new ActiveXComponent(conRet.toDispatch()); - - // the WMI supports a query language. - String query = "select CategoryString, Message, TimeGenerated, User, Type " - + "from Win32_NtLogEvent " - + "where Logfile = 'Application' and TimeGenerated > '20070915000000.000000-***'"; - Variant vCollection = wmiconnect - .invoke("ExecQuery", new Variant(query)); - - EnumVariant enumVariant = new EnumVariant(vCollection.toDispatch()); - - String resultString = ""; - Dispatch item = null; - - while (enumVariant.hasMoreElements()) { - resultString = ""; - item = enumVariant.nextElement().toDispatch(); - String categoryString = Dispatch.call(item, "CategoryString") - .toString(); - String messageString = Dispatch.call(item, "Message").toString(); - String timeGenerated = Dispatch.call(item, "TimeGenerated") - .toString(); - String eventUser = Dispatch.call(item, "User").toString(); - String eventType = Dispatch.call(item, "Type").toString(); - resultString += "TimeGenerated: " + timeGenerated + " Category: " - + categoryString + " User: " + eventUser + " EventType: " - + eventType + " Message:" + messageString; - System.out.println(resultString); - - } - - } - - /** - * sample's main program - * - * @param args - * command line arguments - */ - public static void main(String[] args) { - SystemMonitor utilConnection = new SystemMonitor(); - utilConnection.runMonitor(); - } - -} diff --git a/samples/com/jacob/samples/visio/VisioApp.java b/samples/com/jacob/samples/visio/VisioApp.java deleted file mode 100644 index d1c8337..0000000 --- a/samples/com/jacob/samples/visio/VisioApp.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.jacob.samples.visio; - -import java.io.File; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.DispatchEvents; -import com.jacob.com.Variant; - -/** - * Created as part of sourceforge 1386454 to demonstrate returning values in - * event handlers - * - * @author miles@rowansoftware.net - * - * This class represents the visio app itself - */ -public class VisioApp extends ActiveXComponent { - - /** - * constructor that spins up Visio - * - * @throws VisioException - */ - public VisioApp() throws VisioException { - super("Visio.Application"); - setVisible(false); - } - - /** - * creates a DispatchEvents object to register o as a listener - * - * @param o - */ - public void addEventListener(VisioEventListener o) { - DispatchEvents events = new DispatchEvents(this, o); - if (events == null) { - System.out - .println("You should never get null back when creating a DispatchEvents object"); - } - } - - /** - * opens the passed in file in Visio - * - * @param f - * @throws VisioException - */ - public void open(File f) throws VisioException { - try { - ActiveXComponent documents = new ActiveXComponent(getProperty( - "Documents").toDispatch()); - Variant[] args = new Variant[1]; - args[0] = new Variant(f.getPath()); - documents.invoke("Open", args); - } catch (Exception e) { - e.printStackTrace(); - throw new VisioException(e); - } - } - - /** - * tells Visio to save the drawing - * - * @throws VisioException - */ - public void save() throws VisioException { - try { - ActiveXComponent document = new ActiveXComponent(getProperty( - "ActiveDocument").toDispatch()); - document.invoke("Save"); - } catch (Exception e) { - e.printStackTrace(); - throw new VisioException(e); - } - } - - /** - * terminates Visio - */ - public void quit() { - System.out.println("Received quit()"); - // there can't be any open documents for this to work - // you'll get a visio error if you don't close them - ActiveXComponent document = new ActiveXComponent(getProperty( - "ActiveDocument").toDispatch()); - document.invoke("Close"); - invoke("Quit"); - } - - /** - * runs the Visio export command - * - * @param f - * @throws VisioException - */ - public void export(File f) throws VisioException { - try { - ActiveXComponent document = new ActiveXComponent(getProperty( - "ActivePage").toDispatch()); - Variant[] args = new Variant[1]; - args[0] = new Variant(f.getPath()); - document.invoke("Export", args); - } catch (Exception e) { - throw new VisioException(e); - } - } - - /** - * makes Visio visible so the user can watch - * - * @param b - * @throws VisioException - */ - public void setVisible(boolean b) throws VisioException { - try { - setProperty("Visible", new Variant(b)); - } catch (Exception e) { - throw new VisioException(e); - } - } -} diff --git a/samples/com/jacob/samples/visio/VisioAppFacade.java b/samples/com/jacob/samples/visio/VisioAppFacade.java deleted file mode 100644 index 9395f84..0000000 --- a/samples/com/jacob/samples/visio/VisioAppFacade.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.jacob.samples.visio; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * Created as part of sourceforge 1386454 to demonstrate returning values in - * event handlers - * - * @author miles@rowansoftware.net - * - * This singleton isolates the demo app from the Visio instance object so that - * you can't try and send messages to a dead Visio instance after quit() has - * been called. Direct consumption of VisioApp would mean you could quit but - * would still have a handle to the no longer connected application proxy - * - */ -public class VisioAppFacade { - - private VisioApp app; - private static VisioAppFacade instance; - - /** extension for image files */ - public static final String IMAGE_EXT = ".jpg"; - /** extension for visio files */ - public static final String VISIO_EXT = ".vsd"; - /** the buffer size when we want to read stuff in */ - public static final int BUFFER_SIZE = 2048; - - /** - * Wrapper around Visio - * - * @throws VisioException - */ - private VisioAppFacade() throws VisioException { - this.app = new VisioApp(); - app.addEventListener(new VisioEventAdapter(app)); - } - - /** - * @return the singleton instance of Visio - * @throws VisioException - */ - public static VisioAppFacade getInstance() throws VisioException { - if (instance == null) { - instance = new VisioAppFacade(); - } - return instance; - } - - /** - * creates a preview in a temp file and returns the raw data. - * - * @param visioData - * @return raw preview data - * @throws VisioException - */ - public byte[] createPreview(byte[] visioData) throws VisioException { - byte[] preview; - File tmpFile; - try { - tmpFile = getTempVisioFile(); - OutputStream out = new FileOutputStream(tmpFile); - out.write(visioData); - out.close(); - } catch (IOException ioe) { - throw new VisioException(ioe); - } - preview = createPreview(tmpFile); - tmpFile.delete(); - return preview; - } - - /** - * reads a preview from a saved file - * - * @param visioFile - * @return raw preview data - * @throws VisioException - */ - public byte[] createPreview(File visioFile) throws VisioException { - try { - File imageFile; - imageFile = getTempImageFile(); - app.open(visioFile); - app.export(imageFile); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - FileInputStream fin = new FileInputStream(imageFile); - copy(fin, bout); - fin.close(); - imageFile.delete(); - bout.close(); - return bout.toByteArray(); - } catch (IOException ioe) { - throw new VisioException(ioe); - } - } - - private void copy(InputStream in, OutputStream out) throws IOException { - byte[] buff = new byte[BUFFER_SIZE]; - int read; - do { - read = in.read(buff); - if (read > 0) { - out.write(buff, 0, read); - } - } while (read > 0); - } - - /** - * creates a preview from an input stream - * - * @param in - * @return byte contents of the preview stream - * @throws VisioException - */ - public byte[] createPreview(InputStream in) throws VisioException { - byte[] preview; - // byte[] buff = new byte[2048]; - // int read = 0; - OutputStream out; - File tmpFile; - - try { - tmpFile = getTempVisioFile(); - out = new FileOutputStream(tmpFile); - copy(in, out); - out.close(); - } catch (IOException ioe) { - throw new VisioException(ioe); - } - - preview = createPreview(tmpFile); - tmpFile.delete(); - return preview; - } - - /** - * opens the file in Visio and makes the editor visible - * - * @param f - * the reference to the Visio file to be opened - * @throws VisioException - */ - public void editDiagram(File f) throws VisioException { - app.open(f); - app.setVisible(true); - } - - /** - * creates a temporary viso file - * - * @return created visio temporary file - * @throws IOException - */ - private File getTempVisioFile() throws IOException { - return File.createTempFile("java", VISIO_EXT); - } - - /** - * creates a temporary image file and returns the File object - * - * @return the created image file object - * @throws IOException - */ - private File getTempImageFile() throws IOException { - return File.createTempFile("java", IMAGE_EXT); - } - - /** exit visio */ - public void quit() { - app.quit(); - instance = null; - } -} diff --git a/samples/com/jacob/samples/visio/VisioDemo.java b/samples/com/jacob/samples/visio/VisioDemo.java deleted file mode 100644 index 7cb6c8d..0000000 --- a/samples/com/jacob/samples/visio/VisioDemo.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.jacob.samples.visio; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.io.File; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.WindowConstants; -import javax.swing.filechooser.FileFilter; - -import com.jacob.com.ComThread; - -/** - * Created as part of sourceforge 1386454 to demonstrate returning values in - * event handlers - * - * @author miles@rowansoftware.net - *

      - * This file contains the main() that runs the demo - *

      - * Look in the docs area at the Jacob usage document for command line - * options. - */ -public class VisioDemo extends JFrame implements ActionListener, WindowListener { - - /** - * Totally dummy value to make Eclipse quit complaining - */ - private static final long serialVersionUID = 1L; - - JButton chooseButton; - JButton openButton; - JPanel buttons; - - ImageIcon theImage; - JLabel theLabel; // the icon on the page is actually this button's icon - - File selectedFile; - /** everyone should get this through getVisio() */ - private VisioAppFacade visioProxy = null; - - // put this up here so it remembers where we were on the last choose - JFileChooser chooser = null; - - public class VisioFileFilter extends FileFilter { - public boolean accept(File f) { - if (f.isDirectory()) { - return true; - } else { - return (f.getName().toUpperCase().endsWith(".VSD")); - } - } - - public String getDescription() { - return "Visio Drawings"; - } - } - - public VisioDemo() { - super("Visio in Swing POC"); - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - buttons = new JPanel(); - getContentPane().setLayout(new BorderLayout()); - chooseButton = new JButton("Choose file to display"); - openButton = new JButton("Open file chosen file in Visio"); - chooseButton.addActionListener(this); - openButton.addActionListener(this); - buttons.add(chooseButton); - buttons.add(openButton); - getContentPane().add(buttons, BorderLayout.SOUTH); - theLabel = new JLabel(""); - getContentPane().add(theLabel, BorderLayout.CENTER); - addWindowListener(this); - setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - setSize(640, 480); - this.setVisible(true); - } - - public static void main(String args[]) throws Exception { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - ComThread.InitSTA(); - VisioDemo poc = new VisioDemo(); - ComThread.Release(); - if (poc == null) { - System.out.println("poc== null? That should never happen!"); - } - } - }); - } - - public void actionPerformed(ActionEvent e) { - if (e.getSource() == chooseButton) { - pickFile(); - } else if (e.getSource() == openButton) { - try { - openFile(); - } catch (Exception ex) { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - } else { - System.out.println("Awesome!"); - } - } - - private void pickFile() { - try { - chooser = new JFileChooser(); - // comment this out if you want it to always go to myDocuments - chooser - .setCurrentDirectory(new File(System - .getProperty("user.dir"))); - chooser.setFileFilter(new VisioFileFilter()); - int returnVal = chooser.showOpenDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - selectedFile = chooser.getSelectedFile(); - showSelectedFilePreview(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * use this private method instead of initializing on boot up so that - * instance and all listeners are created in this thread (event thread) - * rather than root thread - * - * @return - */ - private VisioAppFacade getVisio() { - if (visioProxy == null) { - try { - visioProxy = VisioAppFacade.getInstance(); - } catch (VisioException ve) { - System.out.println("ailed to openFile()"); - ve.printStackTrace(); - } - } - return visioProxy; - } - - private void showSelectedFilePreview() throws VisioException { - if (selectedFile != null) { - byte[] image = getVisio().createPreview(selectedFile); - theImage = new ImageIcon(image); - theLabel.setIcon(theImage); - } - } - - private void openFile() throws VisioException { - try { - getVisio().editDiagram(selectedFile); - showSelectedFilePreview(); - } catch (VisioException ve) { - System.out.println("ailed to openFile()"); - ve.printStackTrace(); - } - - } - - public void windowActivated(WindowEvent e) { - } - - public void windowClosed(WindowEvent e) { - System.out.println("WINDOW CLOSED"); - if (visioProxy != null) { - visioProxy.quit(); - } - } - - public void windowClosing(WindowEvent e) { - } - - public void windowDeactivated(WindowEvent e) { - } - - public void windowDeiconified(WindowEvent e) { - } - - public void windowIconified(WindowEvent e) { - System.out.println("Fooboo"); - } - - public void windowOpened(WindowEvent e) { - } -} diff --git a/samples/com/jacob/samples/visio/VisioEventAdapter.java b/samples/com/jacob/samples/visio/VisioEventAdapter.java deleted file mode 100644 index 2923310..0000000 --- a/samples/com/jacob/samples/visio/VisioEventAdapter.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.jacob.samples.visio; - -import com.jacob.com.Variant; - -/** - * Created as part of sourceforge 1386454 to demonstrate returning values in - * event handlers - * - * @author miles@rowansoftware.net - * - * You can subclass this class and only implement the methods you're interested - * in - */ -public class VisioEventAdapter implements VisioEventListener { - - VisioApp app = null; - - public VisioEventAdapter(VisioApp pApp) { - app = pApp; - System.out.println("Event listener constructed"); - } - - public void BeforeQuit(Variant[] args) { - } - - public void DocumentChanged(Variant[] args) { - System.out.println("documentChanged()"); - } - - public void DocumentCloseCanceled(Variant[] args) { - } - - public void DocumentCreated(Variant[] args) { - } - - public void DocumentOpened(Variant[] args) { - System.out.println("DocumentOpened()"); - } - - public void DocumentSaved(Variant[] args) { - } - - public void DocumentSavedAs(Variant[] args) { - } - - public Variant QueryCancelDocumentClose(Variant[] args) { - System.out.println("QueryCancelDocumentClose()"); - return new Variant(false); - } - - /** - * we don't actually let it quit. We block it so that we don't have to - * relaunch when we look at a new document - */ - public Variant QueryCancelQuit(Variant[] args) { - // these may throw VisioException - System.out - .println("Saving document, hiding and telling visio not to quit"); - try { - app.save(); - app.setVisible(false); - } catch (VisioException ve) { - System.out.println("ailed to openFile()"); - ve.printStackTrace(); - } - return new Variant(true); - } -} diff --git a/samples/com/jacob/samples/visio/VisioEventListener.java b/samples/com/jacob/samples/visio/VisioEventListener.java deleted file mode 100644 index 97ea2f9..0000000 --- a/samples/com/jacob/samples/visio/VisioEventListener.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.jacob.samples.visio; - -import com.jacob.com.Variant; - -/** - * Created as part of sourceforge 1386454 to demonstrate returning values in - * event handlers - * - * @author miles@rowansoftware.net - * - * There are many more Visio events available. See the Microsoft Office SDK - * documentation. To receive an event, add a method to this interface whose name - * matches the event name and has only one parameter, Variant[]. The JACOB - * library will use reflection to call that method when an event is received. - */ -public interface VisioEventListener { - - public void BeforeQuit(Variant[] args); - - public void DocumentChanged(Variant[] args); - - public void DocumentCloseCanceled(Variant[] args); - - public void DocumentCreated(Variant[] args); - - public void DocumentOpened(Variant[] args); - - public void DocumentSaved(Variant[] args); - - public void DocumentSavedAs(Variant[] args); - - public Variant QueryCancelQuit(Variant[] args); -} diff --git a/samples/com/jacob/samples/visio/VisioException.java b/samples/com/jacob/samples/visio/VisioException.java deleted file mode 100644 index 06edd08..0000000 --- a/samples/com/jacob/samples/visio/VisioException.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.jacob.samples.visio; - -/** - * Created as part of sourceforge 1386454 to demonstrate returning values in - * event handlers - * - * @author miles@rowansoftware.net - * - * This extends runtime exception so that we can be sloppy and not put catch - * blocks everywhere - */ -public class VisioException extends Exception { - /** - * Totally dummy value to make Eclipse quit complaining - */ - private static final long serialVersionUID = 1L; - - public VisioException(String msg) { - super(msg); - } - - public VisioException(Throwable cause) { - super(cause); - } -} diff --git a/samples/com/jacob/samples/visio/test_drawing.vsd b/samples/com/jacob/samples/visio/test_drawing.vsd deleted file mode 100644 index 73293a0..0000000 Binary files a/samples/com/jacob/samples/visio/test_drawing.vsd and /dev/null differ diff --git a/src/com/jacob/activeX/.cvsignore b/src.1.15-M3/main/java/com/jacob/activeX/.cvsignore similarity index 100% rename from src/com/jacob/activeX/.cvsignore rename to src.1.15-M3/main/java/com/jacob/activeX/.cvsignore diff --git a/src/com/jacob/activeX/ActiveXComponent.java b/src.1.15-M3/main/java/com/jacob/activeX/ActiveXComponent.java similarity index 100% rename from src/com/jacob/activeX/ActiveXComponent.java rename to src.1.15-M3/main/java/com/jacob/activeX/ActiveXComponent.java diff --git a/src/com/jacob/activeX/ActiveXDispatchEvents.java b/src.1.15-M3/main/java/com/jacob/activeX/ActiveXDispatchEvents.java similarity index 100% rename from src/com/jacob/activeX/ActiveXDispatchEvents.java rename to src.1.15-M3/main/java/com/jacob/activeX/ActiveXDispatchEvents.java diff --git a/src/com/jacob/activeX/ActiveXInvocationProxy.java b/src.1.15-M3/main/java/com/jacob/activeX/ActiveXInvocationProxy.java similarity index 100% rename from src/com/jacob/activeX/ActiveXInvocationProxy.java rename to src.1.15-M3/main/java/com/jacob/activeX/ActiveXInvocationProxy.java diff --git a/src/com/jacob/com/.cvsignore b/src.1.15-M3/main/java/com/jacob/com/.cvsignore similarity index 100% rename from src/com/jacob/com/.cvsignore rename to src.1.15-M3/main/java/com/jacob/com/.cvsignore diff --git a/src/com/jacob/com/ComException.java b/src.1.15-M3/main/java/com/jacob/com/ComException.java similarity index 100% rename from src/com/jacob/com/ComException.java rename to src.1.15-M3/main/java/com/jacob/com/ComException.java diff --git a/src/com/jacob/com/ComFailException.java b/src.1.15-M3/main/java/com/jacob/com/ComFailException.java similarity index 100% rename from src/com/jacob/com/ComFailException.java rename to src.1.15-M3/main/java/com/jacob/com/ComFailException.java diff --git a/src/com/jacob/com/ComThread.java b/src.1.15-M3/main/java/com/jacob/com/ComThread.java similarity index 100% rename from src/com/jacob/com/ComThread.java rename to src.1.15-M3/main/java/com/jacob/com/ComThread.java diff --git a/src/com/jacob/com/Currency.java b/src.1.15-M3/main/java/com/jacob/com/Currency.java similarity index 100% rename from src/com/jacob/com/Currency.java rename to src.1.15-M3/main/java/com/jacob/com/Currency.java diff --git a/src/com/jacob/com/DateUtilities.java b/src.1.15-M3/main/java/com/jacob/com/DateUtilities.java similarity index 100% rename from src/com/jacob/com/DateUtilities.java rename to src.1.15-M3/main/java/com/jacob/com/DateUtilities.java diff --git a/src/com/jacob/com/Dispatch.java b/src.1.15-M3/main/java/com/jacob/com/Dispatch.java similarity index 100% rename from src/com/jacob/com/Dispatch.java rename to src.1.15-M3/main/java/com/jacob/com/Dispatch.java diff --git a/src/com/jacob/com/DispatchEvents.java b/src.1.15-M3/main/java/com/jacob/com/DispatchEvents.java similarity index 100% rename from src/com/jacob/com/DispatchEvents.java rename to src.1.15-M3/main/java/com/jacob/com/DispatchEvents.java diff --git a/src/com/jacob/com/DispatchIdentifier.java b/src.1.15-M3/main/java/com/jacob/com/DispatchIdentifier.java similarity index 100% rename from src/com/jacob/com/DispatchIdentifier.java rename to src.1.15-M3/main/java/com/jacob/com/DispatchIdentifier.java diff --git a/src/com/jacob/com/DispatchProxy.java b/src.1.15-M3/main/java/com/jacob/com/DispatchProxy.java similarity index 100% rename from src/com/jacob/com/DispatchProxy.java rename to src.1.15-M3/main/java/com/jacob/com/DispatchProxy.java diff --git a/src/com/jacob/com/EnumVariant.java b/src.1.15-M3/main/java/com/jacob/com/EnumVariant.java similarity index 100% rename from src/com/jacob/com/EnumVariant.java rename to src.1.15-M3/main/java/com/jacob/com/EnumVariant.java diff --git a/src/com/jacob/com/InvocationProxy.java b/src.1.15-M3/main/java/com/jacob/com/InvocationProxy.java similarity index 100% rename from src/com/jacob/com/InvocationProxy.java rename to src.1.15-M3/main/java/com/jacob/com/InvocationProxy.java diff --git a/src/com/jacob/com/InvocationProxyAllVariants.java b/src.1.15-M3/main/java/com/jacob/com/InvocationProxyAllVariants.java similarity index 100% rename from src/com/jacob/com/InvocationProxyAllVariants.java rename to src.1.15-M3/main/java/com/jacob/com/InvocationProxyAllVariants.java diff --git a/src/com/jacob/com/JacobException.java b/src.1.15-M3/main/java/com/jacob/com/JacobException.java similarity index 100% rename from src/com/jacob/com/JacobException.java rename to src.1.15-M3/main/java/com/jacob/com/JacobException.java diff --git a/src/com/jacob/com/JacobObject.java b/src.1.15-M3/main/java/com/jacob/com/JacobObject.java similarity index 100% rename from src/com/jacob/com/JacobObject.java rename to src.1.15-M3/main/java/com/jacob/com/JacobObject.java diff --git a/src/com/jacob/com/JacobReleaseInfo.java b/src.1.15-M3/main/java/com/jacob/com/JacobReleaseInfo.java similarity index 100% rename from src/com/jacob/com/JacobReleaseInfo.java rename to src.1.15-M3/main/java/com/jacob/com/JacobReleaseInfo.java diff --git a/src/com/jacob/com/LibraryLoader.java b/src.1.15-M3/main/java/com/jacob/com/LibraryLoader.java similarity index 100% rename from src/com/jacob/com/LibraryLoader.java rename to src.1.15-M3/main/java/com/jacob/com/LibraryLoader.java diff --git a/src/com/jacob/com/MainSTA.java b/src.1.15-M3/main/java/com/jacob/com/MainSTA.java similarity index 100% rename from src/com/jacob/com/MainSTA.java rename to src.1.15-M3/main/java/com/jacob/com/MainSTA.java diff --git a/src/com/jacob/com/NotImplementedException.java b/src.1.15-M3/main/java/com/jacob/com/NotImplementedException.java similarity index 100% rename from src/com/jacob/com/NotImplementedException.java rename to src.1.15-M3/main/java/com/jacob/com/NotImplementedException.java diff --git a/src/com/jacob/com/ROT.java b/src.1.15-M3/main/java/com/jacob/com/ROT.java similarity index 100% rename from src/com/jacob/com/ROT.java rename to src.1.15-M3/main/java/com/jacob/com/ROT.java diff --git a/src/com/jacob/com/STA.java b/src.1.15-M3/main/java/com/jacob/com/STA.java similarity index 100% rename from src/com/jacob/com/STA.java rename to src.1.15-M3/main/java/com/jacob/com/STA.java diff --git a/src/com/jacob/com/SafeArray.java b/src.1.15-M3/main/java/com/jacob/com/SafeArray.java similarity index 100% rename from src/com/jacob/com/SafeArray.java rename to src.1.15-M3/main/java/com/jacob/com/SafeArray.java diff --git a/src/com/jacob/com/Variant.java b/src.1.15-M3/main/java/com/jacob/com/Variant.java similarity index 100% rename from src/com/jacob/com/Variant.java rename to src.1.15-M3/main/java/com/jacob/com/Variant.java diff --git a/src/com/jacob/com/VariantUtilities.java b/src.1.15-M3/main/java/com/jacob/com/VariantUtilities.java similarity index 100% rename from src/com/jacob/com/VariantUtilities.java rename to src.1.15-M3/main/java/com/jacob/com/VariantUtilities.java diff --git a/src/com/jacob/com/VariantViaEvent.java b/src.1.15-M3/main/java/com/jacob/com/VariantViaEvent.java similarity index 100% rename from src/com/jacob/com/VariantViaEvent.java rename to src.1.15-M3/main/java/com/jacob/com/VariantViaEvent.java diff --git a/src/com/jacob/com/WrongThreadException.java b/src.1.15-M3/main/java/com/jacob/com/WrongThreadException.java similarity index 100% rename from src/com/jacob/com/WrongThreadException.java rename to src.1.15-M3/main/java/com/jacob/com/WrongThreadException.java diff --git a/unittest/com/jacob/com/ActiveXComponentFactoryTest.java b/unittest/com/jacob/com/ActiveXComponentFactoryTest.java deleted file mode 100644 index 71f4c26..0000000 --- a/unittest/com/jacob/com/ActiveXComponentFactoryTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.jacob.com; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.test.BaseTestCase; - -/** - * This exercises the two Dispatch factor methods that let you control whether - * you create a new running COM object or connect to an existing one - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ActiveXComponentFactoryTest extends BaseTestCase { - - /** - * This test is supposed to verify we get multiple instances when we mean - * too. Unfortunately, it requires that the runner of the test verify via - * the "Windows Task Manager" - */ - public void testMultipleInstances() { - ComThread.InitMTA(); - String mApplicationId = "Word.Application"; - ActiveXComponent instance1 = ActiveXComponent - .createNewInstance(mApplicationId); - ActiveXComponent instance2 = ActiveXComponent - .createNewInstance(mApplicationId); - try { - Thread.sleep(10000); - } catch (InterruptedException ie) { - } - instance1.invoke("Quit", new Variant[] {}); - instance2.invoke("Quit", new Variant[] {}); - ComThread.Release(); - - } - - /** - * This test is supposed to verify we can force multiple items through a - * single running instance. It requires that a user physically watch the - * "Windows Task Manager" to verify only one copy of MS Word is executing - */ - public void testOnlyOneInstance() { - ComThread.InitMTA(); - String mApplicationId = "Word.Application"; - ActiveXComponent instance1 = new ActiveXComponent(mApplicationId); - ActiveXComponent instance2 = ActiveXComponent - .connectToActiveInstance(mApplicationId); - assertNotNull(instance2); - try { - Thread.sleep(10000); - } catch (InterruptedException ie) { - } - instance1.invoke("Quit", new Variant[] {}); - ComThread.Release(); - - } - - /** - * Test that verifies function of the ActiveXComponentFactory - */ - public void testActiveXComponentFactory() { - ComThread.InitSTA(true); - try { - System.out - .println("This test only works if MS Word is NOT already running"); - String mApplicationId = "Word.Application"; - ActiveXComponent mTryConnectingFirst = ActiveXComponent - .connectToActiveInstance(mApplicationId); - if (mTryConnectingFirst != null) { - mTryConnectingFirst.invoke("Quit", new Variant[] {}); - System.out - .println("Was able to connect to MSWord when hadn't started it"); - } else { - System.out - .println("Correctly could not connect to running MSWord"); - } - System.out.println(" Word Starting"); - ActiveXComponent mTryStartingSecond = ActiveXComponent - .createNewInstance(mApplicationId); - if (mTryStartingSecond == null) { - System.out.println("was unable to start up MSWord "); - } else { - System.out.println("Correctly could start MSWord"); - } - ActiveXComponent mTryConnectingThird = ActiveXComponent - .connectToActiveInstance(mApplicationId); - if (mTryConnectingThird == null) { - fail("Was unable able to connect to MSWord after previous startup"); - } else { - System.out.println("Stopping MSWord"); - // stop it so we can fail trying to connect to a running - mTryConnectingThird.invoke("Quit", new Variant[] {}); - } - Thread.sleep(2000); - ActiveXComponent mTryConnectingFourth = ActiveXComponent - .connectToActiveInstance(mApplicationId); - if (mTryConnectingFourth != null) { - mTryConnectingFourth.invoke("Quit", new Variant[] {}); - fail("Was able to connect to MSWord that was stopped"); - } else { - System.out - .println("Correctly could not connect to running MSWord"); - } - } catch (InterruptedException ie) { - } catch (ComException e) { - e.printStackTrace(); - fail("Caught COM exception"); - } finally { - // System.out.println("About to sleep for 2 seconds so we can bask - // in the glory of this success"); - // Thread.sleep(2000); - ComThread.Release(); - ComThread.quitMainSTA(); - } - } -} diff --git a/unittest/com/jacob/com/DateUtilitiesTest.java b/unittest/com/jacob/com/DateUtilitiesTest.java deleted file mode 100644 index e7b7f50..0000000 --- a/unittest/com/jacob/com/DateUtilitiesTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.jacob.com; - -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -import junit.framework.TestCase; - -/** - * test cases that should exercise the new date conversion code - *

      - * This test does not require any command line options because it is only a - * utility test - */ - -public class DateUtilitiesTest extends TestCase { - - /** - * verify date conversion to and from java - */ - public void testDateUtilities() { - Date now = new Date(); - double comTimeForNow = DateUtilities.convertDateToWindowsTime(now); - Date retrievedNow = DateUtilities - .convertWindowsTimeToDate(comTimeForNow); - if (!now.equals(retrievedNow)) { - fail("DateUtilities Date Test failed " + now + " != " - + retrievedNow); - } else { - System.out.println("DateUtilities Date Test passed"); - } - - } - - /** - * Verify that the start of time is when we think it is. - */ - public void testBeginningOfWindowsTime() { - // this is a magic time in the windows world - Date beginningOfWindowsTime = new GregorianCalendar(1899, - Calendar.DECEMBER, 30).getTime(); - double comTimeForBeginningOfWindowsTime = DateUtilities - .convertDateToWindowsTime(beginningOfWindowsTime); - if (comTimeForBeginningOfWindowsTime > 0) { - fail("Beginning of windows time test failed " - + comTimeForBeginningOfWindowsTime); - } else { - System.out.println("Beginning of windows time test passed"); - } - - } - -} diff --git a/unittest/com/jacob/com/DispatchNullProgramId.java b/unittest/com/jacob/com/DispatchNullProgramId.java deleted file mode 100644 index 5146562..0000000 --- a/unittest/com/jacob/com/DispatchNullProgramId.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * This test verifies that the Dispatch object protects itself when the - * constructor is called with a null program id. Prior to this protection, the - * VM might crash.m - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class DispatchNullProgramId extends BaseTestCase { - - /** - * Verify that dispatch constructors are protected from null program ids. - */ - public void testNullProgramId() { - try { - String nullParam = null; - new Dispatch(nullParam); - fail("the dispatch failed to protect itself from null program ids"); - } catch (IllegalArgumentException iae) { - System.out - .println("the dispatch protected itself from null program ids"); - } - try { - String nullParam = ""; - new Dispatch(nullParam); - fail("the dispatch failed to protect itself from empty string program ids"); - } catch (IllegalArgumentException iae) { - System.out - .println("the dispatch protected itself from empty string program ids"); - } - } -} diff --git a/unittest/com/jacob/com/DispatchTest.java b/unittest/com/jacob/com/DispatchTest.java deleted file mode 100644 index eef7dc1..0000000 --- a/unittest/com/jacob/com/DispatchTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * Test some of the Dispatch utility methods - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class DispatchTest extends BaseTestCase { - - /** - * Dummy test until someone gets their act together - */ - public void testDispatch() { - // what should we test - } -} diff --git a/unittest/com/jacob/com/DispatchValidDispatchTest.java b/unittest/com/jacob/com/DispatchValidDispatchTest.java deleted file mode 100644 index 54bf635..0000000 --- a/unittest/com/jacob/com/DispatchValidDispatchTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * Test armoring of dispatch static methods - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class DispatchValidDispatchTest extends BaseTestCase { - - /** - * force an IllegalArgumentException to verify the utility method throws - * correctly. - */ - public void testThrowIllegalArgumentException() { - try { - Dispatch.call(null, 0); - fail("Failed to throw IllegalArgumentException"); - } catch (IllegalArgumentException iae) { - System.out.println("Caught correct IllegalArgumentException: " - + iae); - } - } - - /** - * force an IllegalStateException to verify the utility method throws - * correctly. - */ - public void testThrowIllegalStateException() { - try { - Dispatch foo = new Dispatch(); - Dispatch.call(foo, 0); - fail("Failed to throw IllegalStateException"); - } catch (IllegalStateException ise) { - System.out.println("Caught correct IllegalStateException " + ise); - } - } -} diff --git a/unittest/com/jacob/com/JacobDeadlockTest.java b/unittest/com/jacob/com/JacobDeadlockTest.java deleted file mode 100644 index 1639fed..0000000 --- a/unittest/com/jacob/com/JacobDeadlockTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * Sourceforge defect report 1986987 July 2008. This test case demonstrated a - * deadlock issue. - *

        - *
      • One thread attempts to create an object in a thread where InitMTA has - * not been called. This results in ROT.addObject being called which then calls - * ComThread.InitMTA - *
      • One thread attempts to call ComThread.release() which then calls ROT - * .clear objects. - *
      - * The result is one thread with a call sequence ComThread--ROT and the other - * with a sequence ROT--ComThread resulting in deadlock. - *

      - * This test will fail with debug logging turned on because of the amount of - * time it takes to write the debug output. - * - * @author jsamarziya - * - */ -public class JacobDeadlockTest extends BaseTestCase { - private static final long TIMEOUT = 5000l; - - /** Thread component */ - public static class TestThread extends Thread { - private final int id; - private final boolean initCOM; - private final boolean writeOutput; - - /** - * constructor for ThestThread - * - * @param id - * @param initCOM - * @param writeOutput - * - */ - public TestThread(int id, boolean initCOM, boolean writeOutput) { - this.id = id; - this.initCOM = initCOM; - this.writeOutput = writeOutput; - } - - @Override - public void run() { - for (int i = 0; i < 1000; i++) { - log("iteration " + i); - if (initCOM) { - log("Initializing COM thread"); - ComThread.InitMTA(false); - } - log("Creating JacobObject"); - new JacobObject(); - log("Releasing COM thread"); - ComThread.Release(); - } - log("Exiting Java Thread"); - } - - private void log(String message) { - if (writeOutput) { - System.out.println(Thread.currentThread().getName() - + ": TestThread[" + id + "] " + " " + " - " + message); - } - } - } - - /** - * This test shows that if ComThread.Init() is called explicitly, no problem - * occurs. - * - * @throws InterruptedException - */ - public void testShowNoProblemIfCOMIsInitialized() - throws InterruptedException { - runTest(2, true, false); - runTest(100, true, false); - } - - /** - * This test shows that if only one thread is creating COM objects, no - * problem occurs. - * - * @throws InterruptedException - */ - public void testShowNoProblemIfSingleThreaded() throws InterruptedException { - runTest(1, false, false); - runTest(1, true, false); - } - - /** - * Runs the test with two threads, which don't initialize the COM thread. - * - * This test will always fail. - * - * @throws InterruptedException - */ - public void testShowDeadlockProblem() throws InterruptedException { - runTest(2, false, true); - } - - private void runTest(int numberOfThreads, boolean initCOM, - boolean writeOutput) throws InterruptedException { - Thread[] threads = new Thread[numberOfThreads]; - for (int i = 0; i < threads.length; i++) { - threads[i] = new TestThread(i, initCOM, writeOutput); - threads[i].start(); - } - for (int i = 0; i < threads.length; i++) { - threads[i].join(TIMEOUT); - if (threads[i].isAlive()) { - fail("thread " + i + " failed to finish in " + TIMEOUT - + " milliseconds"); - } - } - } -} diff --git a/unittest/com/jacob/com/JacobObjectTest.java b/unittest/com/jacob/com/JacobObjectTest.java deleted file mode 100644 index 47da8a7..0000000 --- a/unittest/com/jacob/com/JacobObjectTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * This will eventually be changed to a unit test. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class JacobObjectTest extends BaseTestCase { - - /** - * verify the build version and date functions work correctly - */ - public void testBuildVersion() { - System.out.println("build version is " + JacobReleaseInfo.getBuildVersion()); - System.out.println("build date is " + JacobReleaseInfo.getBuildDate()); - } - -} diff --git a/unittest/com/jacob/com/LibraryLoaderTest.java b/unittest/com/jacob/com/LibraryLoaderTest.java deleted file mode 100644 index 70ddd48..0000000 --- a/unittest/com/jacob/com/LibraryLoaderTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.jacob.com; - -import junit.framework.TestCase; - -/** - * Tests Library loader architecture methods This test requires that jacob.jar - * be compiled and added to the classpath. You will need to refresh the release - * directory so that eclipse knows about jacob.jar. Otherwise you will get a - * "jar not found" dialog. - * - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - * - * @author clay_shooter - * - */ -public class LibraryLoaderTest extends TestCase { - - /** - * verify the architecture switches work - */ - public void testArchitectureVersions() { - System.out.println("running on 32Bit? VM" - + LibraryLoader.shouldLoad32Bit()); - // verify no null pointer is thrown - LibraryLoader.shouldLoad32Bit(); - } - - /** - * verify LibraryLoader.JACOB_DLL_NAME is read by LibraryLoader - */ - public void testJacobDllNameSystemProperty() { - // fill with bad dll name - System.setProperty(LibraryLoader.JACOB_DLL_NAME, "xxx"); - try { - LibraryLoader.loadJacobLibrary(); - fail("Should have been unable to load dll with name xxx"); - } catch (UnsatisfiedLinkError ule) { - // yes, this is what we want to see when using a bad name - } - // no way to clear a system property once set so lets try setting to - // default - System.setProperty(LibraryLoader.JACOB_DLL_NAME, LibraryLoader - .getPreferredDLLName()); - try { - LibraryLoader.loadJacobLibrary(); - } catch (UnsatisfiedLinkError ule) { - fail("Should have been able to load dll after setting " - + LibraryLoader.JACOB_DLL_NAME + " to " - + LibraryLoader.getPreferredDLLName() + " " - + ule.getMessage()); - } - } - - /** - * Verifies that we get a preferred DLL name with X86 since we really only - * run the unit tests on 32 bit platforms. - */ - public void testDLLNameContainsProcessorAndVersion() { - System.out.println(LibraryLoader.getPreferredDLLName()); - if (LibraryLoader.shouldLoad32Bit()) { - // we build the package and run the unit tests on X86 - assertTrue(LibraryLoader.getPreferredDLLName() - + "should have contained " - + LibraryLoader.DLL_NAME_MODIFIER_32_BIT, LibraryLoader - .getPreferredDLLName().contains( - LibraryLoader.DLL_NAME_MODIFIER_32_BIT)); - } else { - // we build the package and run the unit tests on X86 - assertTrue(LibraryLoader.getPreferredDLLName() - + "should have contained " - + LibraryLoader.DLL_NAME_MODIFIER_64_BIT, LibraryLoader - .getPreferredDLLName().contains( - LibraryLoader.DLL_NAME_MODIFIER_64_BIT)); - } - } -} diff --git a/unittest/com/jacob/com/README.txt b/unittest/com/jacob/com/README.txt deleted file mode 100644 index a958f59..0000000 --- a/unittest/com/jacob/com/README.txt +++ /dev/null @@ -1 +0,0 @@ -This package exists in case folks need to test the Jacob COM objects and need access to protected methods \ No newline at end of file diff --git a/unittest/com/jacob/com/ROT2Test.java b/unittest/com/jacob/com/ROT2Test.java deleted file mode 100644 index ff30cf1..0000000 --- a/unittest/com/jacob/com/ROT2Test.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * This test class exists to test the WeakRefernce implementation . - * - * It is not useful if there isn't one at this time - * - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ROT2Test extends BaseTestCase { - - /** - * runs a multi-threaded test - */ - public void testDoesNotBlowUp() { - ROT2TestThread threads[] = new ROT2TestThread[4]; - for (int i = 0; i < threads.length; i++) { - threads[i] = new ROT2TestThread("thread-" + i, 3000); - } - for (int i = 0; i < threads.length; i++) { - threads[i].start(); - } - } - - /** - * This will try and exercise the thread support in the ROT - */ - - public class ROT2TestThread extends Thread { - private java.util.List ThreadObjects; - - private int initialRunSize = 0; - - /** - * @param arg0 - * @param iStartCount - * the initial number of threads - */ - public ROT2TestThread(String arg0, int iStartCount) { - super(arg0); - initialRunSize = iStartCount; - - } - - /** - * A semi-complex series of steps to put the ROT under stress. 1) - * discard half the objects we've created 2) if size is greater than 1 - * but not a even number, add 1 new object 3) stop when size is 1. - * - * @see java.lang.Runnable#run() - */ - public void run() { - // something that keeps object references around - // so the gc can't collect them - // we need to create these in the thread so they end up in the right - // ROT table - ThreadObjects = new java.util.ArrayList(initialRunSize); - for (int i = 0; i < initialRunSize; i++) { - // create the object - Variant aNewVariant = new Variant(getName() + "_" + i); - - // create a hard reference to it - ThreadObjects.add(aNewVariant); - } - - while (ThreadObjects.size() > 1) { - String message = ""; - message = getName() + " Workingset=" + ThreadObjects.size() - + " ROT: "; - message += "(before additions and gc " - + ROT.getThreadObjects(false).size() + ")"; - // if there is an odd number of objects greater than 2 - if (ThreadObjects.size() > 2 && ThreadObjects.size() % 2 != 0) { - // add a new object - Variant aNewVariant = new Variant(getName() + "_*" - + ThreadObjects.size()); - ThreadObjects.add(aNewVariant); - } - // now iterate across all the objects in our list - for (int i = ThreadObjects.size(); i > 0; i--) { - // removing every other one? - if (i % 2 == 0) { - // remove the reference so gc can get it - ThreadObjects.remove(i - 1); - } - - } - - try { - // simulate the system under load and run the GC - // should end up with weak references with no objects - // attached - Thread.sleep(9); - } catch (InterruptedException e) { - // the VM doesn't want us to sleep anymore, - // so get back to work - } - message += " (before gc, after additions " - + ROT.getThreadObjects(false).size() + ")"; - System.gc(); - message += " (after System.gc " - + ROT.getThreadObjects(false).size() + ")"; - System.out.println(message); - } - } - - /** - * Another test would be to override this to always return the same - * name. That would really screw the ROT! - * - * @see java.lang.Object#toString() - */ - public String toString() { - return super.toString(); - } - } -} \ No newline at end of file diff --git a/unittest/com/jacob/com/ROT3Test.java b/unittest/com/jacob/com/ROT3Test.java deleted file mode 100644 index 798c420..0000000 --- a/unittest/com/jacob/com/ROT3Test.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * This tries to exercise ROT's garbage collection This is named this way - * because the build.xml ignores files ending in Test when building the binary - * zip file - * - * This will eventually be changed to a unit test. - * - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ROT3Test extends BaseTestCase { - - /** - * runs a multi-threaded test - */ - public void testROTVersion3() { - ROT3TestThread threads[] = new ROT3TestThread[4]; - for (int i = 0; i < threads.length; i++) { - threads[i] = new ROT3TestThread("thread-" + i, 3000 + i * 10); - } - for (int i = 0; i < threads.length; i++) { - threads[i].start(); - } - } - - /** - * This will try and exercise the thread support in the ROT - */ - - public class ROT3TestThread extends Thread { - private java.util.List variansCreatedInThisThread; - - private int initialRunSize = 0; - - /** - * @param arg0 - * @param iStartCount - * the number of initial threads - */ - public ROT3TestThread(String arg0, int iStartCount) { - super(arg0); - initialRunSize = iStartCount; - - } - - /** - * A semi-complex series of steps to put the ROT under stress. 1) - * discard half the objects we've created 2) if size is greater than 1 - * but not a even number, add 1 new object 3) stop when size is 1. - * - * @see java.lang.Runnable#run() - */ - @SuppressWarnings("deprecation") - public void run() { - // something that keeps object references around - // so the gc can't collect them - // we need to create these in the thread so they end up in the right - // ROT table - variansCreatedInThisThread = new java.util.ArrayList( - initialRunSize); - for (int i = 0; i < initialRunSize; i++) { - // create the object - Variant aNewVariant = new Variant(getName() + "_" + i); - // create a hard reference to it - variansCreatedInThisThread.add(aNewVariant); - } - - while (variansCreatedInThisThread.size() > 1) { - String message = ""; - message = getName() + " Workingset=" - + variansCreatedInThisThread.size() - + " ROT threadObject hashCode: " - + ROT.getThreadObjects(true).hashCode(); - message += " size before mods and gc " - + ROT.getThreadObjects(true).size() + ")"; - // If there are more than 10 objects in our cache then add 1/4 - // of that again - if (variansCreatedInThisThread.size() > 10) { - message += " (adding) "; - // add an additional 1/4 of our current number - for (int i = 0; i < variansCreatedInThisThread.size() / 4; i++) { - // add a new object - Variant aNewVariant = new Variant(getName() + "_*" - + variansCreatedInThisThread.size()); - variansCreatedInThisThread.add(aNewVariant); - } - } - // now iterate across 1/2 the objects in our list - message += " (removing) "; - for (int i = variansCreatedInThisThread.size(); i > 0; i--) { - // removing every other one? - if (i % 2 == 0) { - // remove the reference so gc can get it - if (!ROT.USE_AUTOMATIC_GARBAGE_COLLECTION) { - // uses deprecated API to set up a special situation - // because this is an ROT test - ROT.removeObject(variansCreatedInThisThread - .get(i - 1)); - } - variansCreatedInThisThread.remove(i - 1); - } - - } - - message += " (after mods " + ROT.getThreadObjects(true).size() - + ")"; - // comm - if (!ROT.USE_AUTOMATIC_GARBAGE_COLLECTION) { - ROT.clearObjects(); - } - System.gc(); - try { - // vain attempt at letting the gc run - Thread.sleep(200); - } catch (InterruptedException ie) { - - } - message += " (after gc " + ROT.getThreadObjects(true).size() - + ")"; - message += " Should see GC if debug turned on..."; - System.out.println(message); - } - } - - /** - * Another test would be to overide this to always return the same name. - * That would really screw the ROT! - * - * @see java.lang.Object#toString() - */ - public String toString() { - return super.toString(); - } - } -} diff --git a/unittest/com/jacob/com/ROTTest.java b/unittest/com/jacob/com/ROTTest.java deleted file mode 100644 index 38b032b..0000000 --- a/unittest/com/jacob/com/ROTTest.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.jacob.com; - -import com.jacob.test.BaseTestCase; - -/** - * This tries to exercise ROT's garbage collection - * - * This will eventually be changed to a unit test. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ROTTest extends BaseTestCase { - - /** - * verify the SystemProperty (classname).PutInROT functions as expected. A - * value of false means instances of the class are not put in the ROT Any o - * ther value means they are - */ - public void testDontFillROTSystemProperty() { - debug("testDontFillROTSystemProperty: started"); - // Make sure the class is loaded before running any of the tests - // class to load and any pre-defined Variants (FALSE and TRUE) to be - // created immediately - VariantViaEvent.class.getName(); - if (ROT.getThreadObjects(true).entrySet().size() < 1) { - debug("Failure: ROT should have objects in it as soon as Variant class loaded."); - } - - System.setProperty(VariantViaEvent.class.getName() - + ROT.PUT_IN_ROT_SUFFIX, "false"); - int countPriorToTest = ROT.getThreadObjects(true).entrySet().size(); - new VariantViaEvent(); - int countAfterAddWithoutROT = ROT.getThreadObjects(true).entrySet() - .size(); - if (countAfterAddWithoutROT != countPriorToTest) { - debug("Failure: count prior: " + countPriorToTest - + " and count after without ROT was: " - + countAfterAddWithoutROT); - } - - System.setProperty(VariantViaEvent.class.getName() - + ROT.PUT_IN_ROT_SUFFIX, "true"); - new VariantViaEvent(); - int countAfterAddWithROT = ROT.getThreadObjects(true).entrySet().size(); - if (countAfterAddWithROT != (countPriorToTest + 1)) { - debug("Failure: count prior: " + countPriorToTest - + " and count after with ROT was: " + countAfterAddWithROT); - } - debug("testDontFillROTSystemProperty: completed"); - } - - /** - * Needs documentation. This test looks broken - * - */ - public void testGCBehavior() { - int sizeBeforeBuild = 0; - int sizeAfterBuild = 0; - int sizeBeforeGC = 0; - int sizeAfterGC = 0; - int loopSize = 10000; - int sizeExpectedAfterBuild = 0; - - debug("testGCBehavior: started"); - debug("creating 10,000 object sets"); - // cause classes to get loaded and any static instances to be created - SafeArray.class.getName(); - Variant.class.getName(); - sizeBeforeBuild = ROT.getThreadObjects(false).size(); - sizeExpectedAfterBuild = ((loopSize * 3) + sizeBeforeBuild); - for (int i = 0; i < loopSize; i++) { - SafeArray a1 = new SafeArray(Variant.VariantVariant, 2); - a1.setVariant(0, new Variant("foo")); - a1.setVariant(1, new Variant("bar")); - } - sizeAfterBuild = ROT.getThreadObjects(false).size(); - if (sizeAfterBuild < sizeExpectedAfterBuild) { - debug("Something got GC'd: " + sizeAfterBuild); - } else if (sizeAfterBuild > sizeExpectedAfterBuild) { - debug("More: " + sizeAfterBuild + " than expected: " - + sizeExpectedAfterBuild); - } else { - debug("They're all there"); - } - // add more to the VM - debug("Flooding Memory to force GC"); - for (int i = 0; i <= loopSize * 2; i++) { - new String("this is just some text to see if we can force gc " + i); - } - // storage will hold weak references until the next JacobObject is - // created - System.gc(); - sizeBeforeGC = ROT.getThreadObjects(false).size(); - debug("Objects left after flood and gc but before adding a new object that clean's up weak references: " - + sizeBeforeGC); - debug("Creating single object. This adds one and causes ROT to clean up GC'd"); - new JacobObject(); - sizeAfterGC = ROT.getThreadObjects(false).size(); - debug("Objects left after adding one (caused weak ref objects to be removed): " - + sizeAfterGC); - new JacobObject(); - if (ROT.getThreadObjects(false).size() != sizeAfterGC + 1) { - debug("Unexpected number of objects after adding only one more " - + ROT.getThreadObjects(false).size()); - } else { - debug("Found number expected after adding one more " - + (sizeAfterGC + 1)); - } - ROT.clearObjects(); - if (ROT.getThreadObjects(false) == null) { - debug("ROT pool was destroyed as expected after clearObjects called."); - } else { - debug("ROT pool for thread still exists when it shouldn't"); - } - - // ========= part two ================================ - debug("Verifying doesn't blow up with double release"); - for (int i = 0; i <= 10000; i++) { - new JacobObject(); - } - // force safeRelease call on all objects - ROT.clearObjects(); - // now force the gc to go collect them, running safeRelease again - System.gc(); - debug("testGCBehavior: finished"); - } - - private static void debug(String message) { - System.out.println(Thread.currentThread().getName() + " " + message); - } -} diff --git a/unittest/com/jacob/com/VariantDateTest.java b/unittest/com/jacob/com/VariantDateTest.java deleted file mode 100644 index 892422f..0000000 --- a/unittest/com/jacob/com/VariantDateTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.jacob.com; - -import java.util.Date; - -import com.jacob.test.BaseTestCase; - -/** - * test cases that should exercise the new date conversion code - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class VariantDateTest extends BaseTestCase { - - /** - * verify the conversion of Variants into java dates - */ - public void testVariantDate() { - Date now = new Date(); - Variant holder = new Variant(); - holder.putDate(now); - Date retrievedNow = holder.getJavaDate(); - if (!now.equals(retrievedNow)) { - fail("Variant Date Test failed " + now + " != " + retrievedNow); - } else { - System.out.println("Variant Date Test passed"); - } - - } - - /** - * verify that the Variant constructor accepts Java dates and converts them - * correctly - */ - public void testVariantDateToJavaObject() { - Date now = new Date(); - Variant holder = new Variant(now); - for (int i = 0; i < 30000; i++) { - Variant dateVariant = new Variant(now); - Date retrievedNow = holder.getJavaDate(); - retrievedNow = dateVariant.getJavaDate(); - if (!now.equals(retrievedNow)) { - fail("Variant Date Test (1) failed " + now + " != " - + retrievedNow); - } else { - // System.out.println("Variant Date Test (1) passed"); - } - // verify auto typecasting works - retrievedNow = (Date) dateVariant.toJavaObject(); - if (!now.equals(retrievedNow)) { - fail("Variant Date Test (2) failed " + now + " != " - + retrievedNow); - } else { - // System.out.println("Variant Date Test (2) passed - // "+retrievedNow); - } - - Variant intVariant = new Variant(4); - Object variantReturn = intVariant.toJavaObject(); - // degenerate test to make sure date isn't always returned - if (variantReturn instanceof Date) { - System.out.println("int variant returned date"); - } - } - System.out.print("Test finished. All tests passed."); - - } - -} diff --git a/unittest/com/jacob/com/VariantTest.java b/unittest/com/jacob/com/VariantTest.java deleted file mode 100644 index ac09e21..0000000 --- a/unittest/com/jacob/com/VariantTest.java +++ /dev/null @@ -1,667 +0,0 @@ -package com.jacob.com; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.Date; - -import com.jacob.test.BaseTestCase; - -/** - * runs through some of the get and set methods on Variant - * - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class VariantTest extends BaseTestCase { - - /** - * This verifies that toJavaObject() works for all of the main data types - * when they exist as a byRef version. - *

      - * It compares the toJavaObject() for a byref against the toJavaObject() for - * the regular. - * - */ - public void testByRefToJavaObject() { - Variant v = null; - Variant vByRef = null; - - v = new Variant(new Float(53.3), false); - vByRef = new Variant(new Float(53.3), true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - v = new Variant(new Double(53.3), false); - vByRef = new Variant(new Double(53.3), true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - - v = new Variant(new Boolean(true), false); - vByRef = new Variant(new Boolean(true), true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - - v = new Variant(new Integer(53), false); - vByRef = new Variant(new Integer(53), true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - - v = new Variant(new Short((short) 53), false); - vByRef = new Variant(new Short((short) 53), true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - - v = new Variant("53.33", false); - vByRef = new Variant("53.33", true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - - // Ugh, you have to pick a magic number whose scale is less than 28 - // 53.53 had a scale of 64 and 53.52 had a scale of 47 - BigDecimal testDecimal = new BigDecimal(53.50); - v = new Variant(testDecimal, false); - vByRef = new Variant(testDecimal, true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - - Date now = new Date(); - v = new Variant(now, false); - vByRef = new Variant(now, true); - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - } - - /** - * try and test VT_I8. This should only work on 64 bit machines - */ - public void testLong() { - Variant v = null; - Variant vByRef = null; - - long longNumber = 1L << 40; - v = new Variant(new Long(longNumber), false); - vByRef = new Variant(new Long(longNumber), true); - assertEquals("Could recover long number " + longNumber, v.getLong(), - longNumber); - assertEquals("Could not make long number " + longNumber - + " come out the same for get and getByRef()", - v.toJavaObject(), vByRef.toJavaObject()); - v = new Variant("" + longNumber); - v.changeType(Variant.VariantLongInt); - assertEquals("Conversion from string to long didn't work ", - v.getLong(), longNumber); - } - - /** - * do some testing around currencies - */ - public void testCurrencyHandling() { - Variant v = null; - Variant vByRef = null; - - // need to do currency also - // currency is an integer scaled up by 10,000 to give 4 digits to the - // right of the decimal - int currencyScale = 10000; - long twentyThousand = 20000 * currencyScale; - Currency twentyThousandAsCurrency = new Currency(twentyThousand); - v = new Variant(twentyThousandAsCurrency, false); - vByRef = new Variant(twentyThousandAsCurrency, true); - if (!(v.toJavaObject() instanceof Currency)) { - fail("v.toJavaObject was not Long for currency but was: " - + v.toJavaObject()); - } - if (!v.toJavaObject().equals(vByRef.toJavaObject())) { - fail(v.toString() + " could not make type " + v.getvt() + " and " - + vByRef.getvt() + " java objects come out the same"); - } - long twentyThousandDotSeven = twentyThousand + 700; - Currency twentyThousandDotSevenAsCurrency = new Currency( - twentyThousandDotSeven); - // use the primitive constructor - v = new Variant(twentyThousandDotSevenAsCurrency); - assertEquals("failed test with " + twentyThousandDotSeven, - twentyThousandDotSeven, v.getCurrency().longValue()); - - } - - /** - * 4/2007 bug report toObject on dispatch tries to call getDispatchRef - * instead of getDispatch so toString() on dispatch blows up. - * - */ - public void testDispatchToJavaObject() { - Variant v2 = new Variant(); - v2.putNothing(); - // this test fails even though the exact same code below works fine - // v2.toJavaObject(); - } - - /** - * see what happens when we conver to by ref - * - */ - public void testSomeChangeVT() { - Variant v; - // the code shows e shouldn't need to use a returned Variant but the - // test says we do - Variant vConverted; - v = new Variant(53.3); - short originalVT = v.getvt(); - short modifier; - - modifier = Variant.VariantShort; - vConverted = v.changeType(modifier); - if (vConverted.getvt() != modifier) { - fail("Failed to change Variant " + originalVT + " using mask " - + modifier + " resulted in " + vConverted.getvt()); - } - - modifier = Variant.VariantString; - vConverted = v.changeType(modifier); - if (vConverted.getvt() != modifier) { - fail("Failed to change Variant " + originalVT + " using mask " - + modifier + " resulted in " + vConverted.getvt()); - } - - // can't convert to byref! - modifier = Variant.VariantByref | Variant.VariantShort; - vConverted = v.changeType(modifier); - if (vConverted.getvt() == modifier) { - fail("Should not have been able to change Variant " + originalVT - + " using mask " + modifier + " resulted in " - + vConverted.getvt()); - } - } - - /** - * make sure variant with no backing store works. - * - */ - public void testUninitializedVariant() { - Variant v; - // Variants created without parameters are auto set to VariantEmpty - v = new Variant(); - try { - if (v.getvt() == Variant.VariantEmpty) { - // successful - // System.out.println("Variant initialized without parameters - // correctly set to empty"); - } else { - throw new RuntimeException( - "getvt() on uninitialized variant shoud have returned VariantEmpty, instead returned " - + v.getvt()); - } - } catch (IllegalStateException ise) { - throw new RuntimeException( - "getvt() on uninitialized variant shoud have succeeded, but instead threw exception"); - } - try { - v.toString(); - } catch (IllegalStateException ise) { - fail("toString() should never throw a runtime exception"); - throw new RuntimeException( - "toString() should not blow up even with uninitialized Variant"); - } - - } - - /** - * - * verify the toString() method does not do type conversion - */ - public void testToStringDoesNotConvert() { - Variant v; - v = new Variant(true); - v.toString(); - if (v.getvt() != Variant.VariantBoolean) { - throw new RuntimeException( - "toString() converted boolean to something else"); - } else { - // fail("toString() correctly does not convert type"); - } - if (v.getBoolean() != true) { - fail("toString() converted boolean true to " + v.getBoolean()); - } - v = new Variant(false); - v.toString(); - if (v.getvt() != Variant.VariantBoolean) { - throw new RuntimeException( - "toString() converted boolean to something else"); - } else { - // fail("toString() correctly does not convert type"); - } - if (v.getBoolean() != false) { - fail("toString() converted boolean false to " + v.getBoolean()); - } - } - - /** - * Verify that booleans can be released. Part of the suite that checks all - * types. - */ - public void testSafeReleaseBoolean() { - Variant v; - v = new Variant(true); - // System.out.println("Newly created Variant ("+ v.getBoolean()+") "+ - // "trying to create access violation but it doesn't seem to be easy"); - v.safeRelease(); - try { - v.getBoolean(); - fail("IllegalStateException should have been thrown when querying safeReleased object"); - throw new RuntimeException("test failed"); - } catch (IllegalStateException ise) { - // System.out.println("IllegalStateException correctly thrown after - // safeRelease"); - } - v = new Variant(true); - for (int i = 0; i < 10; i++) { - new Variant("xxx" + i); - new Variant(i); - new Variant("yyy" + i); - } - ComThread.Release(); - try { - v.getBoolean(); - fail("IllegalStateException should have been thrown when querying ComThread.Release"); - throw new RuntimeException("test failed"); - } catch (IllegalStateException ise) { - // System.out.println("IllegalStateException correctly thrown after - // ComThread.Release"); - } - } - - /** - * verify the constant values aren't released with safeRelease - * - */ - public void testSafeReleaseConstant() { - // System.out.println("Using Static constant Variant - should never - // throw access violation"); - Variant.VT_TRUE.safeRelease(); - if (Variant.VT_TRUE.getBoolean() != true) { - fail("VT_TRUE has been broken by SafeRelease()"); - throw new RuntimeException("test failed"); - } else { - // System.out.println("VT_TRUE survived SafeRelease()"); - } - - for (int i = 0; i < 10; i++) { - new Variant("xxx" + i); - new Variant(i); - new Variant("yyy" + i); - } - ComThread.Release(); - - if (Variant.VT_TRUE.getBoolean() != true) { - fail("VT_TRUE has been broken by ComThread.Release()"); - throw new RuntimeException("test failed"); - } else { - // System.out.println("VT_TRUE survived ComThread.Release()"); - } - - } - - /** - * this used to try and and create an access violation but that didn't work - * and now the methods on the Variant are smarter about working after a - * release - * - */ - public void testSafeReleaseString() { - String mTestString = "Guitar Hero"; - Variant v = new Variant(mTestString); - // System.out.println("Newly created Variant ("+ v.getString()+") "+ - // "about to safe release and then access"); - v.safeRelease(); - try { - v.getString(); - fail("IllegalStateException should have been thrown when querying safeReleased object"); - throw new RuntimeException("test failed"); - } catch (IllegalStateException ise) { - // System.out.println("IllegalStateException correctly thrown after - // safeRelease"); - } - } - - /** - * verifies objectIsAConstant works as expected - * - */ - public void testObjectIsAConstant() { - Variant v = new Variant("d"); - if (!v.objectIsAConstant(Variant.VT_FALSE)) { - fail("did not recognize VT_FALSE"); - } - if (!v.objectIsAConstant(Variant.VT_TRUE)) { - fail("did not recognize VT_TRUE"); - } - if (!v.objectIsAConstant(Variant.VT_MISSING)) { - fail("did not recognize VT_MISSING"); - } - if (!v.objectIsAConstant(Variant.DEFAULT)) { - fail("did not recognize DEFAULT"); - } - if (v.objectIsAConstant(new Variant(true))) { - fail("confused a boolean with VT_TRUE"); - } - if (v.objectIsAConstant(new Variant(false))) { - fail("confused a boolean with VT_FALSE"); - } - - } - - /** - * tests put and get methods looking for obvious defects - * - */ - public void testPutsAndGets() { - Variant v = new Variant(); - - v.putInt(10); - assertEquals("int test failed", 10, v.getInt()); - - v.putShort((short) 20); - assertEquals("short test failed", (short) 20, v.getShort()); - - v.putByte((byte) 30); - assertEquals("byte test failed", (byte) 30, v.getByte()); - - v.putFloat(40); - if (v.getFloat() != 40.0) { - fail("float test failed"); - } - - v.putDouble(50); - if (v.getDouble() != 50.0) { - fail("double test failed"); - } - - v.putString("1234.567"); - assertEquals("string test failed", "1234.567", v.getString()); - - v.putBoolean(true); - assertEquals("failed boolean test(true)", true, v.getBoolean()); - - v.putBoolean(false); - assertEquals("failed boolean test(false)", false, v.getBoolean()); - - long originalValue = 123456789123456789L; - v.putCurrency(new Currency(originalValue)); - assertEquals("failed currency test", 123456789123456789L, v - .getCurrency().longValue()); - - BigDecimal testDecimal = new BigDecimal("22.222"); - v.putDecimal(testDecimal); - assertEquals("failed BigDecimal test", testDecimal, v.getDecimal()); - - Date ourDate = new Date(); - v.putDate(ourDate); - Date retrievedDate = v.getJavaDate(); - if (!retrievedDate.equals(ourDate)) { - fail("failed java date load and unload"); - } - - v.putNull(); - if (!v.isNull()) { - fail("failed detecting set null"); - } - v.putString("something other than null"); - if (v.isNull()) { - fail("failed null replacement with string"); - } - - v.putEmpty(); - if (!v.isNull()) { - fail("failed detecting set empty as null"); - } - v.putString("something other than null"); - if (v.isNull()) { - fail("failed empty replacement with string as isNull"); - } - - Variant v2 = new Variant(); - v2.putNothing(); - if (v2.getvt() != Variant.VariantDispatch) { - fail("putNothing was supposed to set the type to VariantDispatch"); - } - if (!v2.isNull()) { - fail("putNothing is supposed to cause isNull() to return true"); - } - // this line blows up in the test above - if (v2.toJavaObject() == null) { - fail("putNothing() followed by toJavaObject() should return a Dispatch"); - } - - } - - /** - * verify decimal works right - */ - public void testDecimalConversion() { - Variant v = new Variant(); - v.changeType(Variant.VariantDecimal); - for (int i = 10; i >= -10; i--) { - v.putDecimal(new BigDecimal(i)); - // first see if we can get it back as decimal - assertEquals("conversion back to decimal failed " + i, - new BigDecimal(i), v.getDecimal()); - v.changeType(Variant.VariantFloat); - // now see if a float conversion would work - assertEquals("conversion to float failed " + i, new Float(i), v - .getFloat()); - // now convert it back to decimal for reassignment - v.changeType(Variant.VariantDecimal); - assertTrue("Failed conversion of type back to Decimal " + i, v - .getvt() == Variant.VariantDecimal); - } - - } - - /** - * for(BigDecimal i in 79228162514264337593543950330.0 .. - * 79228162514264337593543950341.0) { com.jacob.com.Variant dv = new - * com.jacob.com.Variant(i, false) println i + " : " + dv.getDecimal() } - * - */ - public void testLargeDecimals() { - // the largest decimal number, not in hex is - // 7922816251426433759354395033.0 - BigInteger theStartDigits = new BigInteger("ffffffffffffffffffffff00", - 16); - BigInteger theMaxDigits = new BigInteger("ffffffffffffffffffffffff", 16); - BigDecimal startDecimal = new BigDecimal(theStartDigits); - BigDecimal endDecimal = new BigDecimal(theMaxDigits); - BigDecimal incrementDecimal = new BigDecimal(1); - BigDecimal testDecimal = startDecimal; - Variant testVariant; - while (endDecimal.compareTo(testDecimal) >= 0) { - testVariant = new Variant(testDecimal, false); - BigDecimal result = testVariant.getDecimal(); - assertEquals(testDecimal, result); - testDecimal = testDecimal.add(incrementDecimal); - } - // test Decimal is now too large - try { - new Variant(testDecimal, false); - } catch (IllegalArgumentException iae) { - // System.out.println("Caught expected exception"); - } - // lets try something different. we can call putVariant with rounding - // enabled - testVariant = new Variant(); - testVariant.changeType(Variant.VariantDecimal); - try { - testVariant.putDecimal(endDecimal.setScale(30)); - fail("Should have thrown exception with scale of 30 and no rounding"); - } catch (IllegalArgumentException iae) { - // should have caught this exception - } - // now we test with a negative scale. Note that you can't do with - // without some magic, in this case scientific notation - try { - testVariant.putDecimal(new BigDecimal("700E24")); - assertTrue(new BigDecimal("700E24").compareTo(testVariant - .getDecimal()) == 0); - } catch (IllegalArgumentException iae) { - // should have caught this exception - } - - testVariant.putDecimal(VariantUtilities - .roundToMSDecimal(new BigDecimal("700E24"))); - // use compareTo because it takes into account varying scales - assertTrue(new BigDecimal("700E24").compareTo(testVariant.getDecimal()) == 0); - - // This passes because the number is within range. - testVariant.putDecimal(endDecimal); - - // this should pass because we have rounding turned on - // it turns out the max number gets more digits when - // it's scale is set to 30. so we can't use the max number when there is - // a scale - BigDecimal modifiedDecimal = endDecimal; - System.out.println("integer piece starts as " - + modifiedDecimal.unscaledValue().toString(16) + " scale=: " - + modifiedDecimal.scale()); - System.out.println("integer piece after rounding without scale is " - + VariantUtilities.roundToMSDecimal(modifiedDecimal) - .unscaledValue().toString(16) + " scale=: " - + modifiedDecimal.scale()); - System.out.println("integer piece after rounding with scale 30 is " - + VariantUtilities.roundToMSDecimal( - modifiedDecimal.setScale(30)).unscaledValue().toString( - 16) + " scale=: " + modifiedDecimal.scale()); - try { - testVariant.putDecimal(VariantUtilities - .roundToMSDecimal(modifiedDecimal.setScale(30))); - fail("should have thrown an exception for a number whose scale " - + "change created too many digits to be represented."); - } catch (IllegalArgumentException iae) { - // should catch an exception here because the rounding after scale - // change would have made the number too large - } - - System.out.println(""); - modifiedDecimal = endDecimal.subtract(incrementDecimal); - System.out.println("integer piece starts as " - + modifiedDecimal.unscaledValue().toString(16) + " scale=: " - + modifiedDecimal.scale()); - System.out.println("integer piece after rounding without scale is " - + VariantUtilities.roundToMSDecimal(modifiedDecimal) - .unscaledValue().toString(16) + " scale=: " - + modifiedDecimal.scale()); - System.out.println("integer piece after rounding with scale 30 is " - + VariantUtilities.roundToMSDecimal( - modifiedDecimal.setScale(30)).unscaledValue().toString( - 16) + " scale=: " + modifiedDecimal.scale()); - testVariant.putDecimal(VariantUtilities - .roundToMSDecimal(modifiedDecimal.setScale(30))); - System.out.println(""); - } - - /** - * Spin up a lot of threads and have them all create variants 3/2007 there - * have been several reports in multi-threaded servers that show init() - * failing - * - */ - public void testManyThreadedInit() { - VariantInitTestThread threads[] = new VariantInitTestThread[75]; - - System.out.println("Starting thread test (" + threads.length - + " threads each creating 10000 objects)." - + " This may take 30 seconds or more."); - for (int i = 0; i < threads.length; i++) { - threads[i] = new VariantInitTestThread("thread-" + i, 10000); - } - for (int i = 0; i < threads.length; i++) { - threads[i].start(); - } - int numComplete = 0; - while (numComplete < threads.length) { - // give the works time to work - try { - Thread.sleep(333); - } catch (InterruptedException ie) { - // do nothing - } - numComplete = 0; - for (int i = 0; i < threads.length; i++) { - if (threads[i].isComplete) { - numComplete++; - } - } - // System.out.print("["+numComplete+"/"+threads.length+"]"); - } - System.out.println("Finished thread test"); - } - - /** - * a class to create variants in separate threads - * - */ - class VariantInitTestThread extends Thread { - private boolean isComplete = false; - - private int initialRunSize = 0; - - /** - * @param newThreadName - * the name for the thread - * @param iStartCount - * number of threads to start with - */ - public VariantInitTestThread(String newThreadName, int iStartCount) { - super(newThreadName); - initialRunSize = iStartCount; - - } - - /** - * getter so master can see if thread is done - * - * @return state of complete flag - */ - public boolean isComplete() { - return isComplete; - } - - /** - * Blow out a bunch of Variants - * - * @see java.lang.Runnable#run() - */ - public void run() { - for (int variantIndex = 0; variantIndex < initialRunSize; variantIndex++) { - try { - Thread.yield(); - Thread.sleep(0); - } catch (InterruptedException ie) { - // do nothing - } - // System.out.println(Thread.currentThread().getName()); - Variant testSubject = new Variant(variantIndex); - testSubject.getvt(); - testSubject.getInt(); - } - isComplete = true; - } - } -} diff --git a/unittest/com/jacob/com/VariantUtilitiesTest.java b/unittest/com/jacob/com/VariantUtilitiesTest.java deleted file mode 100644 index 736884c..0000000 --- a/unittest/com/jacob/com/VariantUtilitiesTest.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.jacob.com; - -import java.util.Arrays; -import java.util.Date; - -import com.jacob.test.BaseTestCase; - -/** - * This class should test some of the converter capabilities - * - */ -public class VariantUtilitiesTest extends BaseTestCase { - - /** - * verify that dispatch can convert from object to variant and that the - * variant holds the right value - */ - public void testConverters() { - Date testDate = new Date(); - Variant fromDate = VariantUtilities.objectToVariant(testDate); - Date returnedDate = fromDate.getJavaDate(); - // System.out.println("test date is "+testDate); - // System.out.println("VariantDate is "+fromDate.getJavaDate()); - assertTrue("Could not call obj2variant(Date) and get it to work", - testDate.equals(returnedDate)); - Currency someMoney = new Currency(12349876L); - Variant fromMoney = VariantUtilities.objectToVariant(someMoney); - Currency someMoneyConverted = fromMoney.getCurrency(); - assertTrue("Could not call obj2variant(Long) and get it to work", - someMoney.equals(someMoneyConverted)); - System.out.println("currency returned was: " + someMoneyConverted); - - } - - public void testPrimitiveByteArray() { - byte[] arr = new byte[] { 1, 2, 3 }; - - Variant arrVar = VariantUtilities.objectToVariant(arr); - assertNotNull(arrVar); - SafeArray sa = arrVar.toSafeArray(); - assertNotNull(sa); - - assertEquals(Variant.VariantByte, sa.getvt()); - - assertEquals(0, sa.getLBound()); - assertEquals(2, sa.getUBound()); - - byte[] bytes = sa.toByteArray(); - assertTrue(Arrays.equals(bytes, arr)); - } - - public void testPrimitiveIntArray() { - int[] arr = new int[] { 1000, 2000, 3 }; - - Variant arrVar = VariantUtilities.objectToVariant(arr); - assertNotNull(arrVar); - SafeArray sa = arrVar.toSafeArray(); - assertNotNull(sa); - - assertEquals(Variant.VariantInt, sa.getvt()); - - assertEquals(0, sa.getLBound()); - assertEquals(2, sa.getUBound()); - - int[] ints = sa.toIntArray(); - assertTrue(Arrays.equals(ints, arr)); - } - - public void testPrimitiveDoubleArray() { - double[] arr = new double[] { 1000, 2000, 3 }; - - Variant arrVar = VariantUtilities.objectToVariant(arr); - assertNotNull(arrVar); - SafeArray sa = arrVar.toSafeArray(); - assertNotNull(sa); - - assertEquals(Variant.VariantDouble, sa.getvt()); - - assertEquals(0, sa.getLBound()); - assertEquals(2, sa.getUBound()); - - double[] doubles = sa.toDoubleArray(); - assertTrue(Arrays.equals(doubles, arr)); - } - - public void testPrimitiveLongArray() { - long[] arr = new long[] { 0xcafebabecafebabeL, 42, 0xbabecafebabeL }; - - Variant arrVar = VariantUtilities.objectToVariant(arr); - assertNotNull(arrVar); - SafeArray sa = arrVar.toSafeArray(); - assertNotNull(sa); - - assertEquals(Variant.VariantLongInt, sa.getvt()); - - assertEquals(0, sa.getLBound()); - assertEquals(2, sa.getUBound()); - - long[] longs = sa.toLongArray(); - assertTrue(Arrays.equals(longs, arr)); - } - -} diff --git a/unittest/com/jacob/test/BaseTestCase.java b/unittest/com/jacob/test/BaseTestCase.java deleted file mode 100644 index d545146..0000000 --- a/unittest/com/jacob/test/BaseTestCase.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.jacob.test; - -import java.net.URL; - -import junit.framework.TestCase; - -import com.jacob.com.JacobObject; - -/** - * This base test class may require that the unittest package be - * 'jacob-project/unittest' be on the classpath to find some resources. - * - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. Or try these: - * - *

      - *      -Djava.library.path=d:/jacob/release/x86 
      - *      -Dcom.jacob.autogc=false 
      - *      -Dcom.jacob.debug=false 
      - *      -Xcheck:jni
      - * 
      - */ -public class BaseTestCase extends TestCase { - - protected void setUp() { - // verify we have run with the dll in the lib path - try { - JacobObject foo = new JacobObject(); - if (foo == null) { - fail("Failed basic sanity test: Can't create JacobObject (-D)"); - } - } catch (UnsatisfiedLinkError ule) { - fail("Did you remember to run with the jacob.dll in the libpath ?"); - } - } - - /** - * this test exists just to test the setup. - */ - public void testSetup() { - JacobObject foo = new JacobObject(); - assertNotNull(foo); - } - - /** - * - * @return a simple VB script that generates the result "3" - */ - public String getSampleVPScriptForEval() { - return "1+(2*4)-3"; - - } - - /** - * Converts the class name into a path and appends the resource name. Used - * to derive the path to a resource in the file system where the resource is - * co-located with the referenced class. - * - * @param resourceName - * @param classInSamePackageAsResource - * @return a class loader compatible fully qualified file system path to a - * resource - */ - @SuppressWarnings("unchecked") - private String getJavaFilePathToPackageResource(String resourceName, - Class classInSamePackageAsResource) { - - String classPackageName = classInSamePackageAsResource.getName(); - int i = classPackageName.lastIndexOf('.'); - if (i == -1) { - classPackageName = ""; - } else { - classPackageName = classPackageName.substring(0, i); - } - - // change all "." to ^ for later conversion to "/" so we can append - // resource names with "." - classPackageName = classPackageName.replace('.', '^'); - System.out.println("classPackageName: " + classPackageName); - String fullPathToResource; - if (classPackageName.length() > 0) { - fullPathToResource = classPackageName + "^" + resourceName; - } else { - fullPathToResource = resourceName; - } - - fullPathToResource = fullPathToResource.replace('^', '/'); - System.out.println("fullPathToResource: " + fullPathToResource); - - URL urlToLibrary = classInSamePackageAsResource.getClassLoader() - .getResource(fullPathToResource); - assertNotNull("URL to resource " + resourceName - + " should not be null." - + " You probably need to add 'unittest' to the" - + " classpath so the tests can find resources", urlToLibrary); - String fullPathToResourceAsFile = urlToLibrary.getFile(); - System.out.println("url to library: " + urlToLibrary); - System.out.println("fullPathToResourceAsFile: " - + fullPathToResourceAsFile); - - return fullPathToResourceAsFile; - } - - /** - * Converts the class name into a path and appends the resource name. Used - * to derive the path to a resource in the file system where the resource is - * co-located with the referenced class. - * - * @param resourceName - * @param classInSamePackageAsResource - * @return returns the path in the file system of the requested resource in - * windows c compatible format - */ - @SuppressWarnings("unchecked") - public String getWindowsFilePathToPackageResource(String resourceName, - Class classInSamePackageAsResource) { - String javaFilePath = getJavaFilePathToPackageResource(resourceName, - classInSamePackageAsResource); - javaFilePath = javaFilePath.replace('/', '\\'); - return javaFilePath.substring(1); - } - - /** - * - * @param resourceName - * @param classInSamePackageAsResource - * @return a resource located in the same package as the passed in class - */ - @SuppressWarnings( { "unused", "unchecked" }) - private Object getPackageResource(String resourceName, - Class classInSamePackageAsResource) { - String fullPathToResource = getJavaFilePathToPackageResource( - resourceName, classInSamePackageAsResource); - ClassLoader localClassLoader = classInSamePackageAsResource - .getClassLoader(); - if (null == localClassLoader) { - return ClassLoader.getSystemResource(fullPathToResource); - } else { - return localClassLoader.getResource(fullPathToResource); - } - } - - /** - * load a library from same place in the file system that the class was - * loaded from. - *

      - * This is an attempt to let unit tests run without having to run regsvr32. - * - * @param libraryName - * @param classInSamePackageAsResource - */ - @SuppressWarnings( { "unchecked", "unused" }) - private void loadLibraryFromClassPackage(String libraryName, - Class classInSamePackageAsResource) { - String libraryNameWithSuffix = ""; - String fullLibraryNameWithPath = ""; - if (libraryName != null && libraryName.endsWith("dll")) { - libraryNameWithSuffix = libraryName; - } else if (libraryName != null) { - libraryNameWithSuffix = libraryName + ".dll"; - } else { - fail("can't create full library name " + libraryName); - } - // generate the path the classloader would use to find this on the - // classpath - fullLibraryNameWithPath = getJavaFilePathToPackageResource( - libraryNameWithSuffix, classInSamePackageAsResource); - System.load(fullLibraryNameWithPath); - // requires that the dll be on the library path - // System.loadLibrary(fullLibraryNameWithPath); - } - -} diff --git a/unittest/com/jacob/test/errors/UnicodeErrorTest.java b/unittest/com/jacob/test/errors/UnicodeErrorTest.java deleted file mode 100644 index b4a4f1c..0000000 --- a/unittest/com/jacob/test/errors/UnicodeErrorTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.jacob.test.errors; - -import com.jacob.test.BaseTestCase; -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; - -/** - * This test verifies patch SF 1794811 . It shows how unicode filenames throw - * exceptions in 1.13M4 and earlier. - * - * @author justme84 - * - */ -public class UnicodeErrorTest extends BaseTestCase { - - /** - * verifies that messages can now have unicode in them like when the file - * names have unicode characters - */ - public void testUnicodeCharactersInErrorMessage() { - ActiveXComponent application = new ActiveXComponent("Word.Application"); - ActiveXComponent documents = application - .getPropertyAsComponent("Documents"); - String fileName = "abc\u0411\u0412\u0413\u0414def"; - try { - documents.invoke("Open", fileName); - fail("Should have thrown an exception"); - } catch (ComException e) { - assertTrue("Error message should contain file name with unicode " - + "characters in it. " + e.getMessage(), e.getMessage() - .indexOf(fileName) > 0); - } - } -} \ No newline at end of file diff --git a/unittest/com/jacob/test/events/ExcelEventTest.java b/unittest/com/jacob/test/events/ExcelEventTest.java deleted file mode 100644 index 9ec1fee..0000000 --- a/unittest/com/jacob/test/events/ExcelEventTest.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.jacob.test.events; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.DispatchEvents; -import com.jacob.com.InvocationProxy; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This test was lifted from a forum posting and shows how you can't listen to - * Excel events (added post 1.9.1 Eclipse Settings.) This also uses the 1.9.1 - * InvocationProxy to receive the events. The test was modified in 1.14 to show - * how to hook up multiple event listeners to various Excel components - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ExcelEventTest extends BaseTestCase { - - /** - * load up excel, register for events and make stuff happen - * - * @param args - */ - public void testExcelWithInvocationProxy() { - ComThread.InitSTA(); - // we are going to listen to events on Application. - // You can probably also listen Excel.Sheet and Excel.Chart - String excelApplicationProgramId = "Excel.Application"; - String excelSheetProgramId = "Excel.Sheet"; - String typeLibLocation; - // office 2003 - typeLibLocation = "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE"; - // office 2007 - typeLibLocation = "C:\\Program Files\\Microsoft Office\\OFFICE12\\EXCEL.EXE"; - - // Grab The Component. - ActiveXComponent axc = new ActiveXComponent(excelApplicationProgramId); - hookupListener(axc, excelApplicationProgramId, typeLibLocation); - - try { - - System.out.println("version=" + axc.getProperty("Version")); - System.out.println("version=" + Dispatch.get(axc, "Version")); - axc.setProperty("Visible", true); - Dispatch workbooks = axc.getPropertyAsComponent("Workbooks"); - Dispatch workbook = Dispatch.get(workbooks, "Add").toDispatch(); - Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch(); - System.out.println("Workbook: "+workbook); - System.out.println("Sheet: "+sheet); - if (typeLibLocation.contains("OFFICE11")){ - // office 2007 throws crashes the VM - System.out.println("Hooking up sheet listener"); - hookupListener(sheet, excelSheetProgramId, typeLibLocation); - } - System.out.println("Retrieving cells"); - Dispatch a1 = Dispatch.invoke(sheet, "Range", Dispatch.Get, - new Object[] { "A1" }, new int[1]).toDispatch(); - Dispatch a2 = Dispatch.invoke(sheet, "Range", Dispatch.Get, - new Object[] { "A2" }, new int[1]).toDispatch(); - System.out.println("Inserting value into A1"); - System.out.println("Inserting calculation 2xA1 into A2"); - Dispatch.put(a1, "Value", "123.456"); - Dispatch.put(a2, "Formula", "=A1*2"); - System.out.println("Retrieved a1 from excel:" - + Dispatch.get(a1, "Value")); - System.out.println("Retrieved a2 from excel:" - + Dispatch.get(a2, "Value")); - Variant f = new Variant(false); - Dispatch.call(workbook, "Close", f); - axc.invoke("Quit", new Variant[] {}); - - } catch (ComException cfe) { - cfe.printStackTrace(); - fail("Failed to attach to " + excelApplicationProgramId + ": " - + cfe.getMessage()); - } - try { - // the sleep is required to let everything clear out after the quit - Thread.sleep(2000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - ComThread.Release(); - } - - /** - * extracted the listener hookup so we could try multiple listeners. - * - * @param axc - * @param programId - * @param typeLibLocation - */ - private void hookupListener(Dispatch axc, String programId, - String typeLibLocation) { - // Add a listener (doesn't matter what it is). - DispatchEvents applicationEvents; - if (typeLibLocation == null) { - applicationEvents = new DispatchEvents(axc, new ExcelEvents( - programId)); - } else { - applicationEvents = new DispatchEvents(axc, new ExcelEvents( - programId), programId, typeLibLocation); - } - if (applicationEvents == null) { - System.out - .println("No exception thrown but no dispatch returned for Excel events"); - } else { - // Yea! - System.out.println("Successfully attached listener to " + programId); - - } - } - - /** - * Proxy class to verify we receive expected events - */ - public class ExcelEvents extends InvocationProxy { - - private String listenerPrefix = "-"; - - /** - * Constructor so we can create an instance that implements invoke() - * - * @param interfaceIdentifier - * a string that identifies which listener is speaking - */ - public ExcelEvents(String interfaceIdentifier) { - listenerPrefix = interfaceIdentifier; - } - - /** - * Override the invoke method to log all the events so that we don't - * have to implement all of the specific events. - */ - public Variant invoke(String methodName, Variant targetParameter[]) { - System.out.println("Received event from " + listenerPrefix + ": " - + methodName); - return null; - } - - } -} diff --git a/unittest/com/jacob/test/events/IETest.java b/unittest/com/jacob/test/events/IETest.java deleted file mode 100644 index e4560a9..0000000 --- a/unittest/com/jacob/test/events/IETest.java +++ /dev/null @@ -1,436 +0,0 @@ -package com.jacob.test.events; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.DispatchEvents; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This test runs fine against jdk 1.4 and 1.5 - * - * This demonstrates the new event handling code in jacob 1.7 This example will - * open up IE and print out some of the events it listens to as it navigates to - * web sites. contributed by Niels Olof Bouvin mailto:n.o.bouvin@daimi.au.dk and - * Henning Jae jehoej@daimi.au.dk - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ - -public class IETest extends BaseTestCase { - - /** - * well known address we can navigate to - */ - private String testUrls[] = { - "http://sourceforge.net/projects/jacob-project", - "http://www.google.com" }; - - /** - * runs the IE test and feeds it commands - */ - public void testRunIECleanly() { - runTheTest(true, testUrls); - } - - /** - * runs the IE test and feeds it commands - */ - public void testRunIETerminateWithoutWait() { - runTheTest(false, testUrls); - } - - /** - * The actual work of running the test. - * - * @param waitForQuit - * @param urls - */ - private void runTheTest(boolean waitForQuit, String[] urls) { - // this line starts the pump but it runs fine without it - ComThread.startMainSTA(); - // Run the test in a thread. Lets us test running out of "main" thread - IETestThread aThread = new IETestThread(waitForQuit, urls); - aThread.start(); - while (aThread.isAlive()) { - try { - Thread.sleep(250); - } catch (InterruptedException e) { - // done with the sleep - } - } - System.out.println("Main: Thread quit, about to quitMainSTA in thread " - + Thread.currentThread().getName()); - // this line only does something if startMainSTA() was called - ComThread.quitMainSTA(); - System.out.println("Main: did quit main sta in thread " - + Thread.currentThread().getName()); - - if (aThread.threadFailedWithException != null) { - fail("caught an unexpected exception " - + aThread.threadFailedWithException); - } - } -} - -class IETestThread extends Thread { - /** flag that says we got a quit message from IE */ - public static boolean quitHandled = false; - - /** - * determines if we wait until last quit call back received before - * terminating - */ - private static boolean waitUntilReceivedQuitCallback = true; - - /** - * the places we should navigate to - */ - private static String[] targets = null; - - /** - * holds any caught exception so the main/test case can see them - */ - public Throwable threadFailedWithException = null; - - /** - * constructor for the test thread - * - * @param beNeat - * should we wait until quit received - * @param urls - * the web pages we will navigate to - */ - public IETestThread(boolean beNeat, String urls[]) { - super(); - waitUntilReceivedQuitCallback = beNeat; - targets = urls; - } - - /** - * Run through the addresses passed in via the constructor - */ - public void run() { - // pick a time that lets sourceforge respond (in msec) - int delay = 3000; - // pre-1.14 paired with statement below that blows up - ComThread.InitMTA(); - ActiveXComponent ie = new ActiveXComponent( - "InternetExplorer.Application"); - try { - Dispatch.put(ie, "Visible", new Variant(true)); - Dispatch.put(ie, "AddressBar", new Variant(true)); - System.out.println("IETestThread: " + Dispatch.get(ie, "Path")); - Dispatch.put(ie, "StatusText", new Variant("My Status Text")); - - System.out.println("IETestThread: About to hookup event listener"); - IEEvents ieE = new IEEvents(); - new DispatchEvents(ie, ieE, "InternetExplorer.Application.1"); - System.out.println("IETestThread: Did hookup event listener"); - - for (String url : targets) { - System.out.println("IETestThread: About to call navigate to " - + url); - Dispatch.call(ie, "Navigate", new Variant(url)); - System.out.println("IETestThread: Did call navigate to " + url); - try { - Thread.sleep(delay); - } catch (Exception e) { - } - } - } catch (Exception e) { - threadFailedWithException = e; - e.printStackTrace(); - } catch (Throwable re) { - threadFailedWithException = re; - re.printStackTrace(); - } finally { - System.out.println("IETestThread: About to send Quit"); - ie.invoke("Quit", new Variant[] {}); - System.out.println("IETestThread: Did send Quit"); - } - // a value is set to false if we try to crash VM by leaving before - // callbacks all received - if (waitUntilReceivedQuitCallback) { - System.out - .println("IETestThread: Waiting until we've received quit callback"); - // wait a little while for it to end - while (!quitHandled) { - try { - Thread.sleep(delay / 10); - } catch (InterruptedException e) { - } - } - System.out.println("IETestThread: Received the OnQuit callback"); - } else { - System.out.println("IETestThread: Not waiting for OnQuit callback"); - } - System.out.println("IETestThread: Calling ComThread.Release in thread " - + Thread.currentThread().getName()); - ComThread.Release(); - } - - /** - * The events class must be publicly accessible for reflection to work. The - * list of available events is located at - * http://msdn2.microsoft.com/en-us/library/aa768280.aspx - */ - public class IEEvents { - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void BeforeNavigate2(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): BeforeNavigate2 " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void CommandStateChange(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() - + "): CommandStateChange " + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void DocumentComplete(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): DocumentComplete " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void DownloadBegin(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): DownloadBegin " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void DownloadComplete(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): DownloadComplete " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void NavigateError(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): NavigateError " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void NavigateComplete2(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): NavigateComplete " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void NewWindow2(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): NewWindow2 " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void OnFullScreen(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): OnFullScreen " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void OnMenuBar(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): OnMenuBar " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void OnQuit(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): OnQuit " - + args.length + " parameters"); - IETestThread.quitHandled = true; - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void OnStatusBar(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): OnStatusBar " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void OnTheaterMode(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): OnTheaterMode " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void OnToolBar(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): OnToolBar " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void OnVisible(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): OnVisible " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void ProgressChange(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): ProgressChange " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void PropertyChange(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): PropertyChange " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void SetSecureLockIcon(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() - + "): setSecureLockIcon " + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void StatusTextChange(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): StatusTextChange " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void TitleChange(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): TitleChange " - + args.length + " parameters"); - } - - /** - * Internet explorer event this proxy can receive - * - * @param args - * the COM Variant objects that this event passes in. - */ - public void WindowClosing(Variant[] args) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): WindowClosing " - + args.length + " parameters"); - } - } - -} diff --git a/unittest/com/jacob/test/events/IETestActiveXProxy.java b/unittest/com/jacob/test/events/IETestActiveXProxy.java deleted file mode 100644 index 9f45862..0000000 --- a/unittest/com/jacob/test/events/IETestActiveXProxy.java +++ /dev/null @@ -1,289 +0,0 @@ -package com.jacob.test.events; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.activeX.ActiveXDispatchEvents; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This test runs fine against jdk 1.4 and 1.5 - * - * This demonstrates the new event handling code in jacob 1.7 This example will - * open up IE and print out some of the events it listens to as it havigates to - * web sites. contributed by Niels Olof Bouvin mailto:n.o.bouvin@daimi.au.dk and - * Henning Jae jehoej@daimi.au.dk - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ - -public class IETestActiveXProxy extends BaseTestCase { - - /** - * the main test method that builds up the connection and runs the test - */ - public void testIEActiveProxyCallback() { - // this line starts the pump but it runs fine without it - ComThread.startMainSTA(); - // remove this line and it dies - // /ComThread.InitMTA(true); - IETestActiveProxyThread aThread = new IETestActiveProxyThread(); - aThread.start(); - while (aThread.isAlive()) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // doen with the sleep - // e.printStackTrace(); - } - } - System.out - .println("Main: Thread quit, about to quit main sta in thread " - + Thread.currentThread().getName()); - // this line only does someting if startMainSTA() was called - ComThread.quitMainSTA(); - System.out.println("Main: did quit main sta in thread " - + Thread.currentThread().getName()); - if (aThread.threadFailedWithException != null) { - fail("caught an unexpected exception " - + aThread.threadFailedWithException); - } - } -} - -class IETestActiveProxyThread extends Thread { - /** says that the quit message has been received from the target application */ - public static boolean quitHandled = false; - - /** - * holds any caught exception so the main/test case can see them - */ - public Throwable threadFailedWithException = null; - - /** the thread's constructor */ - public IETestActiveProxyThread() { - super(); - } - - public void run() { - // this used to be 5 seconds but sourceforge is slow - int delay = 5000; // msec - // paired with statement below that blows up - ComThread.InitMTA(); - ActiveXComponent ie = new ActiveXComponent( - "InternetExplorer.Application"); - try { - Dispatch.put(ie, "Visible", new Variant(true)); - Dispatch.put(ie, "AddressBar", new Variant(true)); - System.out.println("IETestActiveProxyThread: " - + Dispatch.get(ie, "Path")); - Dispatch.put(ie, "StatusText", new Variant("My Status Text")); - - System.out - .println("IETestActiveProxyThread: About to hookup event listener"); - IEEventsActiveProxy ieE = new IEEventsActiveProxy(); - new ActiveXDispatchEvents(ie, ieE, "InternetExplorer.Application.1"); - System.out - .println("IETestActiveProxyThread: Did hookup event listener"); - // / why is this here? Was there some other code here in the past? - Variant optional = new Variant(); - optional.putNoParam(); - - System.out - .println("IETestActiveProxyThread: About to call navigate to sourceforge"); - Dispatch.call(ie, "Navigate", new Variant( - "http://sourceforge.net/projects/jacob-project")); - System.out - .println("IETestActiveProxyThread: Did call navigate to sourceforge"); - try { - Thread.sleep(delay); - } catch (Exception e) { - } - System.out - .println("IETestActiveProxyThread: About to call navigate to yahoo"); - Dispatch.call(ie, "Navigate", new Variant( - "http://groups.yahoo.com/group/jacob-project")); - System.out - .println("IETestActiveProxyThread: Did call navigate to yahoo"); - try { - Thread.sleep(delay); - } catch (Exception e) { - } - } catch (Exception e) { - threadFailedWithException = e; - e.printStackTrace(); - } catch (Throwable re) { - threadFailedWithException = re; - re.printStackTrace(); - } finally { - System.out.println("IETestActiveProxyThread: About to send Quit"); - ie.invoke("Quit", new Variant[] {}); - System.out.println("IETestActiveProxyThread: Did send Quit"); - } - // this blows up when it tries to release a DispatchEvents object - // I think this is because there is still one event we should get back - // "OnQuit" that will came after we have released the thread pool - // this is probably messed up because DispatchEvent object will have - // been - // freed before the callback - // commenting out ie.invoke(quit...) causes this to work without error - // this code tries to wait until the quit has been handled but that - // doesn't work - System.out - .println("IETestActiveProxyThread: Waiting until we've received the quit callback"); - while (!quitHandled) { - try { - Thread.sleep(delay / 5); - } catch (InterruptedException e) { - } - } - System.out - .println("IETestActiveProxyThread: Received the quit callback"); - // wait a little while for it to end - // try {Thread.sleep(delay); } catch (InterruptedException e) {} - System.out - .println("IETestActiveProxyThread: about to call ComThread.Release in thread " - + Thread.currentThread().getName()); - - ComThread.Release(); - } - - /** - * The events class must be publicly accessable for reflection to work. The - * list of available events is located at - * http://msdn2.microsoft.com/en-us/library/aa768280.aspx - */ - public class IEEventsActiveProxy { - - public void BeforeNavigate2(Dispatch pDisp, String url, Integer flags, - String targetFrameName, Variant postData, String headers, - Boolean cancel) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): BeforeNavigate2 " - + url); - } - - public void CommandStateChange(Integer command, Boolean enable) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() - + "): CommandStateChange " + command); - } - - public void DocumentComplete(Dispatch pDisp, String url) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): DocumentComplete " - + url); - } - - public void DownloadBegin() { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): DownloadBegin "); - } - - public void DownloadComplete() { - System.out - .println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() - + "): DownloadComplete "); - } - - public void NavigateComplete2(Dispatch pDisp, String url) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): NavigateComplete " - + url); - } - - public void NavigateError(Dispatch pDispatch, String url, - String targetFrameName, Integer statusCode, Boolean Cancel) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): NavigateError " - + statusCode); - } - - public void NewWindow2(Dispatch pDisp, Boolean cancel) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): NewWindow2 " - + pDisp); - } - - public void OnFullScreen(Boolean fullScreen) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): OnFullScreen " - + fullScreen); - } - - public void OnMenuBar(Boolean menuBar) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): OnMenuBar " - + menuBar); - } - - public void OnQuit() { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): OnQuit "); - IETestActiveProxyThread.quitHandled = true; - } - - public void OnStatusBar(Boolean statusBar) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): OnStatusBar " - + statusBar); - } - - public void OnTheaterMode(Boolean theaterMode) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): OnTheaterMode " - + theaterMode); - } - - public void OnToolBar(Boolean onToolBar) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): OnToolBar " - + onToolBar); - } - - public void OnVisible(Boolean onVisible) { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): onVisible " - + onVisible); - } - - public void ProgressChange() { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): ProgressChange "); - } - - public void PropertyChange() { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): PropertyChange "); - } - - public void SetSecureLockIcon(Integer secureLockIcon) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() - + "): setSecureLockIcon " + secureLockIcon); - } - - public void StatusTextChange() { - System.out - .println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() - + "): StatusTextChange "); - } - - public void TitleChange() { - System.out.println("IEEventsActiveProxy Received (" - + Thread.currentThread().getName() + "): TitleChange "); - } - - public void WindowClosing(Boolean isChildWindow) { - System.out.println("IEEvents Received (" - + Thread.currentThread().getName() + "): WindowClosing " - + isChildWindow); - } - } - -} diff --git a/unittest/com/jacob/test/events/WordEventTest.java b/unittest/com/jacob/test/events/WordEventTest.java deleted file mode 100644 index bc81b73..0000000 --- a/unittest/com/jacob/test/events/WordEventTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.jacob.test.events; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.DispatchEvents; -import com.jacob.com.InvocationProxy; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This test was lifted from a forum posting and shows how you can't listen to - * Excel events (added post 1.9.1 Eclipse Settings.) That test was modified make - * this a MSWord event listener to demonstrate that the InvocationProxy code - * works with MS Word Events This also uses the 1.10 InvocationProxy to receive - * the events. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class WordEventTest extends BaseTestCase { - - /** - * load up word, register for events and make stuff happen - * - * @param args - */ - public void testCaptureWordEvents() { - String pid = "Word.Application"; - String typeLibLocation = null; - - // Grab The Component. - ActiveXComponent axc = new ActiveXComponent(pid); - try { - // Add a listener (doesn't matter what it is). - DispatchEvents de; - if (typeLibLocation == null) { - de = new DispatchEvents(axc, new WordEventTest()); - } else { - de = new DispatchEvents(axc, new WordEventTest(), pid, - typeLibLocation); - } - if (de == null) { - fail("No exception thrown but no dispatch returned for Word events"); - } else { - // Yea! - System.out.println("Successfully attached to " + pid); - - } - // this is different from the ExcelEventTest because it uses - // the jacob active X api instead of the Dispatch api - System.out.println("version=" + axc.getPropertyAsString("Version")); - axc.setProperty("Visible", true); - ActiveXComponent documents = axc - .getPropertyAsComponent("Documents"); - if (documents == null) { - fail("unable to get documents"); - } - axc.invoke("Quit", new Variant[] {}); - - } catch (ComException cfe) { - cfe.printStackTrace(); - fail("Failed to attach to " + pid + ": " + cfe.getMessage()); - - } - System.out - .println("Someone needs to add some MSWord commands to this to " - + "make some on screen stuff happens so the tester " - + "thinks we tested something"); - } - - /** - * a class that receives messages from word - */ - public class WordEvents extends InvocationProxy { - /** - * Constructor so we can create an instance that implements invoke() - */ - public WordEvents() { - } - - /** - * override the invoke() method to log all the events without writing a - * bunch of code - */ - public Variant invoke(String methodName, Variant targetParameter[]) { - System.out.println("Received event from Windows program" - + methodName); - return null; - } - - } -} \ No newline at end of file diff --git a/unittest/com/jacob/test/excel/ControllerTest.java b/unittest/com/jacob/test/excel/ControllerTest.java deleted file mode 100644 index efd6d4b..0000000 --- a/unittest/com/jacob/test/excel/ControllerTest.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.jacob.test.excel; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; -import java.util.StringTokenizer; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * this test verifies that you can call toString() on a Variant extracted from - * Excel that contains a 2 dimensional array of doubles. 1.14M5 and earlier blew - * up on this because two objects pointed at the same windows memory space SF 1840487 - */ -public class ControllerTest extends BaseTestCase { - - private Controller controller; - - protected void setUp() { - controller = new Controller(); - } - - public void testGetColumnA() { - List list = controller.getColumnA(super - .getWindowsFilePathToPackageResource("teste.xls", this - .getClass())); - assertEquals(50, list.size()); - } - - public void testGetColumnB() { - List list = controller.getColumnB(super - .getWindowsFilePathToPackageResource("teste.xls", this - .getClass())); - assertEquals(40, list.size()); - } - - /** - * This class looks bad because it is a compressed version that was - * originally in 3 different files as part of a bug submission. I didn't - * want to simplify it because it might no longer demonstrate the problem we - * were trying to fix - */ - public class Controller { - - private List columnA; - - private List columnB; - - public List getColumnA(String pathToTest) { - load(pathToTest); - return columnA; - } - - public List getColumnB(String pathToTest) { - load(pathToTest); - return columnB; - } - - public void load(String pathToTest) { - if (columnA == null || columnB == null) { - File excelFile = new File(pathToTest); - executaExcelCallBack(excelFile.getAbsolutePath(), "password"); - } - } - - public void executaExcelCallBack(String path, String password) { - // ComThread.InitSTA(); - ComThread.InitMTA(); - ActiveXComponent excel = new ActiveXComponent("Excel.Application"); - - try { - - excel.setProperty("Visible", false); - Dispatch workbooks = excel.getProperty("Workbooks") - .toDispatch(); - - Dispatch workbook = Dispatch.call(workbooks, "Open", path, // FileName - 3, // UpdateLinks - false, // Readonly - 5, // Format - password // Password - ).toDispatch(); - - Dispatch sheets = Dispatch.call(workbook, "Worksheets") - .toDispatch(); - System.out.println("Before executa"); - executa(excel, sheets); - System.out.println("After executa"); - - Dispatch.call(workbook, "Close", new Variant(false)); - Dispatch.call(workbooks, "Close"); - System.out.println("After Close"); - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - Thread.sleep(1000); - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("Before Quit"); - excel.invoke("Quit", new Variant[] {}); - try { - Thread.sleep(1000); - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("After Quit, Before Release()"); - ComThread.Release(); - System.out.println("After Release()"); - } - } - - /** - * Constante para configurar a planilha em modo "Calculation" automático - */ - public static final int CALC_AUTOMATICO = -4105; - - /** - * Constante para configurar a planilha em modo "Calculation" manual - */ - public static final int CALC_MANUAL = -4135; - - /** - * Escreve um determinado valor em uma célula da pasta em questão. O - * valor é escrito configurando a propriedade Value da célula - * - * @param celula - - * célula para escrever novo valor - * @param sheet - - * pasta da planilha em questão - * @param valor - - * valor a ser escrito na celula - */ - public void informarValorCelula(String celula, Dispatch sheet, - String valor) { - System.out.println("Entered informarValorCelula"); - Dispatch cel = obterCelula(celula, sheet); - Dispatch.put(cel, "Value", valor); - System.out.println("Exiting informarValorCelula"); - } - - /** - * Obtem o valor de contido em uma célula. O valor representa o conteúdo - * da propriedade Value da célula - * - * @param celula - - * célula a ser lida - * @param sheet - - * pasta da planilha que contém a célula - * @return - conteúdo da propriedade Value - */ - public Variant obterValorCelula(String celula, Dispatch sheet) { - System.out.println("Entered obterValorCelula"); - Dispatch d = obterCelula(celula, sheet); - Variant returnedValue = Dispatch.get(d, "Value"); - System.out.println("Exiting obterValorCelula"); - return returnedValue; - } - - /** - * Obtem referência para a célua ou conjunto de células especificado no - * parametro - * - * @param celula - - * Referência para célula ou conjunto de células. A String - * "A1" referencia a coluna A e linha 1. A Sting "A1:A10" - * referencia as células compreendidas no intervalo entre a - * célua A1 e a célula A10 - * @param sheet - - * pasta da planilha qye contém as células - * @return - referencia para um célula ou conjunto de células, - * dependendo do parâmetro passado - */ - public Dispatch obterCelula(String celula, Dispatch sheet) { - System.out.println("Entered obterCelula"); - Dispatch d = Dispatch.invoke(sheet, "Range", Dispatch.Get, - new Object[] { celula }, new int[1]).toDispatch(); - System.out.println("Exiting obterCelula"); - return d; - } - - /** - * Obtem os valores de um conjunto de células - * - * @param celulas - - * Referência para conjunto de células - * @param sheet - - * Pasta que contém as cálulas referenciadas - * @return - Lista onde cada elemento é o valor de uma célula - * referenciada na conjunto - */ - public List obterValoresRange(String celulas, Dispatch sheet) { - List valores = new LinkedList(); - - // obtem valor das celulas como um Variant - Variant var = obterValorCelula(celulas, sheet); - - // toString da Variant é interpretado por um StringTokenizer e os - // tokens - // inseridos na lista de retorno - String arrayAsString = null; - System.out - .println("Calling toString() on the Variant that is an array will blow up " - + var.getvt() + " --> " + arrayAsString); - arrayAsString = var.toString(); - StringTokenizer st = new StringTokenizer(arrayAsString, "\n"); - while (st.hasMoreTokens()) { - valores.add(st.nextToken().trim()); - } - return valores; - } - - /** - * Método para execução de ação a ser executada em planilha excel. - * - * @param xl - - * Referencia para aplicação excel - * @param sheets - - * Referencia para conjunto de pastas da planilha - */ - public void executa(ActiveXComponent xl, Dispatch sheets) { - - System.out.println("Entered private ExcellCallBack executa()"); - Dispatch sheet = Dispatch.call(sheets, "Item", "Plan1") - .toDispatch(); - columnA = obterValoresRange("A1:A50", sheet); - columnB = obterValoresRange("B1:B40", sheet); - System.out.println("Exiting private ExcellCallBack executa()"); - } - } -} diff --git a/unittest/com/jacob/test/excel/teste.xls b/unittest/com/jacob/test/excel/teste.xls deleted file mode 100644 index e039eef..0000000 Binary files a/unittest/com/jacob/test/excel/teste.xls and /dev/null differ diff --git a/unittest/com/jacob/test/powerpoint/PowerpointTest.java b/unittest/com/jacob/test/powerpoint/PowerpointTest.java deleted file mode 100644 index 906ce72..0000000 --- a/unittest/com/jacob/test/powerpoint/PowerpointTest.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.jacob.test.powerpoint; - -/** - * $Id$ - * - * This is really more of a multi threaded tester - *

      - * May need to run with some command line options (including from inside Eclipse). - * Look in the docs area at the Jacob usage document for command line options. - */ -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComFailException; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.test.BaseTestCase; - -/** - * - * power point test program posted to sourceforge to demonstrate memory problem. - * The submitter stated they had the problem on windows 2000 with office 2000 I - * have been unable to duplicate on windows XP with office 2003. I am adding - * this to the tree just in case we need to come back to it. - *

      - * This test was modified for office 2007 to synchronize communication with Excel. - * Office 2003 didn't require this. - *

      - * This relies on BaseTestCase to provide the root path to the file under test - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class PowerpointTest extends BaseTestCase { - private static final int NUM_THREADS = 5; - protected static final int NUM_ITERATIONS = 50; - - /** - * main program that lets us run this as a test - * - * @param args - */ - public void testPowerpoint() { - ComThread.InitMTA(); - - ActiveXComponent component = new ActiveXComponent( - "Powerpoint.Application"); - Dispatch comPowerpoint = component.getObject(); - - try { - PowerpointTestThread[] threads = new PowerpointTestThread[NUM_THREADS]; - for (int i = 0; i < NUM_THREADS; i++) { - threads[i] = new PowerpointTestThread(i + 1, comPowerpoint); - threads[i].start(); - } - - boolean allThreadsFinished = false; - while (!allThreadsFinished) { - allThreadsFinished = true; - for (int i = 0; i < NUM_THREADS; i++) { - if (threads[i].isAlive()) { - allThreadsFinished = false; - break; - } - } - if (!allThreadsFinished) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // no op - } - } - } - - Dispatch.call(comPowerpoint, "Quit"); - for (int i = 0; i < NUM_THREADS; i++) { - if (threads[i].threadFailedWithException != null) { - fail("caught unexpected exception in thread " - + threads[i].threadFailedWithException); - } - } - } finally { - ComThread.Release(); - } - - } - - /** - * the thread class that runs power point - */ - public class PowerpointTestThread extends Thread { - /** - * holds any caught exception so the main/test case can see them - */ - public Throwable threadFailedWithException = null; - - private int threadID; - private Dispatch comPowerpoint; - - /** - * thread constructor - * - * @param threadID - * @param comPowerpoint - */ - public PowerpointTestThread(int threadID, Dispatch comPowerpoint) { - super("TestThread " + threadID); - this.threadID = threadID; - this.comPowerpoint = comPowerpoint; - } - - public void run() { - System.out.println("Thread \"" + Thread.currentThread().getName() - + "\" started"); - System.out.flush(); - ComThread.InitMTA(); - try { - for (int i = 0; i < NUM_ITERATIONS; i++) { - if (i % 10 == 0) { - System.out.println(Thread.currentThread().getName() - + ": Iteration " + i); - System.out.flush(); - } - // office 2003 seems to have been able to handle more - // multi-threaded requests than office 2007 - // office 2003 could handle 5 threads @ 50 iterations - // office 2007 can only handle 1 thread at a time - synchronized(comPowerpoint){ - Dispatch comPresentations = Dispatch.get(comPowerpoint, - "Presentations").toDispatch(); - Dispatch comPresentation = Dispatch.call( - comPresentations, - "Open", - getWindowsFilePathToPackageResource("test" - + threadID + ".ppt", this.getClass()), - new Integer(0), new Integer(0), new Integer(0)) - .toDispatch(); - Dispatch.call(comPresentation, "Close"); - } - } - } catch (ComFailException cfe) { - threadFailedWithException = cfe; - System.err.println(Thread.currentThread().getName() - + "\" while working on: " - + getWindowsFilePathToPackageResource("test" + threadID - + ".ppt", this.getClass())); - cfe.printStackTrace(); - } catch (Exception e) { - threadFailedWithException = e; - System.err.println("Error in Thread \"" - + Thread.currentThread().getName() + "\":"); - e.printStackTrace(); - } finally { - ComThread.Release(); - System.out.println("Thread \"" - + Thread.currentThread().getName() + "\" finished"); - System.out.flush(); - } - } - - } -} \ No newline at end of file diff --git a/unittest/com/jacob/test/powerpoint/test1.ppt b/unittest/com/jacob/test/powerpoint/test1.ppt deleted file mode 100644 index ec60592..0000000 Binary files a/unittest/com/jacob/test/powerpoint/test1.ppt and /dev/null differ diff --git a/unittest/com/jacob/test/powerpoint/test2.ppt b/unittest/com/jacob/test/powerpoint/test2.ppt deleted file mode 100644 index ff806c5..0000000 Binary files a/unittest/com/jacob/test/powerpoint/test2.ppt and /dev/null differ diff --git a/unittest/com/jacob/test/powerpoint/test3.ppt b/unittest/com/jacob/test/powerpoint/test3.ppt deleted file mode 100644 index 426d05f..0000000 Binary files a/unittest/com/jacob/test/powerpoint/test3.ppt and /dev/null differ diff --git a/unittest/com/jacob/test/powerpoint/test4.ppt b/unittest/com/jacob/test/powerpoint/test4.ppt deleted file mode 100644 index 426d05f..0000000 Binary files a/unittest/com/jacob/test/powerpoint/test4.ppt and /dev/null differ diff --git a/unittest/com/jacob/test/powerpoint/test5.ppt b/unittest/com/jacob/test/powerpoint/test5.ppt deleted file mode 100644 index 426d05f..0000000 Binary files a/unittest/com/jacob/test/powerpoint/test5.ppt and /dev/null differ diff --git a/unittest/com/jacob/test/safearray/SafeArrayBasicTest.java b/unittest/com/jacob/test/safearray/SafeArrayBasicTest.java deleted file mode 100644 index a41f220..0000000 Binary files a/unittest/com/jacob/test/safearray/SafeArrayBasicTest.java and /dev/null differ diff --git a/unittest/com/jacob/test/safearray/SafeArrayContents.java b/unittest/com/jacob/test/safearray/SafeArrayContents.java deleted file mode 100644 index 1e9cc0a..0000000 --- a/unittest/com/jacob/test/safearray/SafeArrayContents.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.jacob.test.safearray; - -import com.jacob.com.ComFailException; -import com.jacob.com.SafeArray; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * A safe array contents test (old test) - * - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class SafeArrayContents extends BaseTestCase { - - public static void printArray(boolean a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(int a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(short a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(byte a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(double a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(float a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(String a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(Variant a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public static void printArray(char a[]) { - System.out.print("["); - for (int i = 0; i < a.length; i++) { - System.out.print(" " + a[i] + " "); - } - System.out.println("]"); - } - - public void testSafeArrayContents() { - // int - System.out.println("Int"); - SafeArray ia = new SafeArray(Variant.VariantInt, 4); - System.out.println("elem size:" + ia.getElemSize()); - int iack[] = new int[] { 100000, 200000, 300000, 400000 }; - printArray(iack); - ia.fromIntArray(iack); - iack = ia.toIntArray(); - printArray(iack); - - int i4[] = new int[4]; - ia.getInts(0, 4, i4, 0); - printArray(i4); - - SafeArray ia2 = new SafeArray(Variant.VariantInt, 4); - ia2.setInts(0, 4, i4, 0); - iack = ia2.toIntArray(); - printArray(iack); - - // double - System.out.println("Double"); - SafeArray da = new SafeArray(Variant.VariantDouble, 4); - System.out.println("elem size:" + da.getElemSize()); - double dack[] = new double[] { 123.456, 456.123, 1234567.89, 12.3456789 }; - printArray(dack); - da.fromDoubleArray(dack); - dack = da.toDoubleArray(); - printArray(dack); - - double d4[] = new double[4]; - da.getDoubles(0, 4, d4, 0); - printArray(d4); - - SafeArray da2 = new SafeArray(Variant.VariantDouble, 4); - da2.setDoubles(0, 4, d4, 0); - dack = da2.toDoubleArray(); - printArray(dack); - - // float - System.out.println("Float"); - SafeArray fa = new SafeArray(Variant.VariantFloat, 4); - System.out.println("elem size:" + fa.getElemSize()); - float fack[] = new float[] { 123.456F, 456.123F, 1234567.89F, - 12.3456789F }; - printArray(fack); - fa.fromFloatArray(fack); - fack = fa.toFloatArray(); - printArray(fack); - - float f4[] = new float[4]; - fa.getFloats(0, 4, f4, 0); - printArray(f4); - - SafeArray fa2 = new SafeArray(Variant.VariantFloat, 4); - fa2.setFloats(0, 4, f4, 0); - fack = fa2.toFloatArray(); - printArray(fack); - - // boolean - System.out.println("Boolean"); - SafeArray ba = new SafeArray(Variant.VariantBoolean, 4); - System.out.println("elem size:" + ba.getElemSize()); - boolean back[] = new boolean[] { true, false, true, false }; - printArray(back); - ba.fromBooleanArray(back); - back = ba.toBooleanArray(); - printArray(back); - - boolean b4[] = new boolean[4]; - ba.getBooleans(0, 4, b4, 0); - printArray(b4); - - SafeArray ba2 = new SafeArray(Variant.VariantBoolean, 4); - ba2.setBooleans(0, 4, b4, 0); - back = ba2.toBooleanArray(); - printArray(back); - - // char - System.out.println("Char"); - SafeArray ca = new SafeArray(Variant.VariantShort, 4); - System.out.println("elem size:" + ca.getElemSize()); - char cack[] = new char[] { 'a', 'b', 'c', 'd' }; - printArray(cack); - ca.fromCharArray(cack); - cack = ca.toCharArray(); - printArray(cack); - - char c4[] = new char[4]; - ca.getChars(0, 4, c4, 0); - printArray(c4); - - SafeArray ca2 = new SafeArray(Variant.VariantShort, 4); - ca2.setChars(0, 4, c4, 0); - cack = ca2.toCharArray(); - printArray(cack); - - // short - System.out.println("Short"); - SafeArray sha = new SafeArray(Variant.VariantShort, 4); - System.out.println("elem size:" + sha.getElemSize()); - short shack[] = new short[] { 1000, 2000, 3000, 4000 }; - printArray(shack); - sha.fromShortArray(shack); - shack = sha.toShortArray(); - printArray(shack); - - short sh4[] = new short[4]; - sha.getShorts(0, 4, sh4, 0); - printArray(sh4); - - SafeArray sha2 = new SafeArray(Variant.VariantShort, 4); - sha2.setShorts(0, 4, sh4, 0); - shack = sha2.toShortArray(); - printArray(shack); - - // string - System.out.println("String"); - SafeArray sa = new SafeArray(Variant.VariantString, 4); - System.out.println("elem size:" + sa.getElemSize()); - String sack[] = new String[] { "aa", "bb", "cc", "dd" }; - printArray(sack); - sa.fromStringArray(sack); - sack = sa.toStringArray(); - printArray(sack); - - String s4[] = new String[4]; - sa.getStrings(0, 4, s4, 0); - printArray(s4); - - SafeArray sa2 = new SafeArray(Variant.VariantString, 4); - sa2.setStrings(0, 4, s4, 0); - sack = sa2.toStringArray(); - printArray(sack); - - // variant - System.out.println("Variant"); - SafeArray va = new SafeArray(Variant.VariantVariant, 4); - System.out.println("elem size:" + va.getElemSize()); - Variant vack[] = new Variant[] { new Variant(1), new Variant(2.3), - new Variant(true), new Variant("four"), }; - printArray(vack); - va.fromVariantArray(vack); - vack = va.toVariantArray(); - printArray(vack); - - Variant v4[] = new Variant[4]; - va.getVariants(0, 4, v4, 0); - printArray(v4); - - SafeArray va2 = new SafeArray(Variant.VariantVariant, 4); - va2.setVariants(0, 4, v4, 0); - vack = va2.toVariantArray(); - printArray(vack); - - // byte - System.out.println("Byte"); - SafeArray bba = new SafeArray(Variant.VariantByte, 4); - System.out.println("elem size:" + bba.getElemSize()); - byte bback[] = new byte[] { 0x1, 0x2, 0x3, 0x4 }; - printArray(bback); - bba.fromByteArray(bback); - bback = bba.toByteArray(); - printArray(bback); - - byte bb4[] = new byte[4]; - bba.getBytes(0, 4, bb4, 0); - printArray(bb4); - - SafeArray bba2 = new SafeArray(Variant.VariantByte, 4); - bba2.setBytes(0, 4, bb4, 0); - bback = bba2.toByteArray(); - printArray(bback); - - try { - // this should throw ComException - bba2.fromCharArray(new char[] { 'a' }); - fail("Failed to catch expected exception"); - } catch (ComFailException cfe) { - // do nothing - // cfe.printStackTrace(); - } - } -} diff --git a/unittest/com/jacob/test/safearray/SafeArrayDispatchTest.java b/unittest/com/jacob/test/safearray/SafeArrayDispatchTest.java deleted file mode 100644 index 43796f8..0000000 --- a/unittest/com/jacob/test/safearray/SafeArrayDispatchTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.jacob.test.safearray; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.Dispatch; -import com.jacob.com.SafeArray; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * Test class to verify dispatch with SafeArray - */ -public class SafeArrayDispatchTest extends BaseTestCase { - public void testDispatchWithSafeArray() { - try { - String scriptCommand = "1+(2*4)-3"; - String lang = "VBScript"; - ActiveXComponent sControl = new ActiveXComponent("ScriptControl"); - Dispatch.put(sControl, "Language", lang); - - Variant result = Dispatch.call(sControl, "Eval", scriptCommand); - assertTrue(result.toString().equals("6")); - - // wrap the script control in a variant - Variant v = new Variant(sControl); - - // create a safe array of type dispatch - SafeArray sa = new SafeArray(Variant.VariantDispatch, 1); - - // put the variant in the array - sa.setVariant(0, v); - - // take it back out - Variant v2 = sa.getVariant(0); - Dispatch d = v2.toDispatch(); - - // make sure you can call eval on it - result = Dispatch.call(d, "Eval", scriptCommand); - assertTrue(result.toString().equals("6")); - } catch (ComException e) { - e.printStackTrace(); - fail("script failure " + e); - } - } -} diff --git a/unittest/com/jacob/test/safearray/SafeArrayLeak.java b/unittest/com/jacob/test/safearray/SafeArrayLeak.java deleted file mode 100644 index f0405bc..0000000 --- a/unittest/com/jacob/test/safearray/SafeArrayLeak.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.jacob.test.safearray; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.JacobReleaseInfo; -import com.jacob.com.SafeArray; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This test program demonstrates a weak in the setString(int[],String) method - * in SafeArray. To see the leak: - *

        - *
      • Bring up the windows task manager and click on the performance tab. - *
      • Run the test program - *
      - * You should see the Page File Usage History graph rise at te end of every - * cycle. Running the same program with setString(r,c,String) does not show the - * same symptoms - */ -public class SafeArrayLeak extends BaseTestCase { - - /** - * ---------------------------------------------------------------------------------------------------------------------------- - * - * ---------------------------------------------------------------------------------------------------------------------------- - */ - public void testLeakWithSetString() { - - ActiveXComponent xl = null; - Dispatch workbooks = null; - Dispatch workbook = null; - Dispatch workSheets = null; - Dispatch sheet = null; - Dispatch tabCells = null; - SafeArray sa = null; - - // -Dcom.jacob.autogc=true - System.out.println("Jacob version: " + JacobReleaseInfo.getBuildVersion()); - - for (int t = 0; t < 10; t++) { - // look at a large range of cells - String position = "A7:DM8934"; - - try { - xl = new ActiveXComponent("Excel.Application"); - System.out - .println("Excel version=" + xl.getProperty("Version")); - - xl.setProperty("Visible", new Variant(false)); - workbooks = xl.getProperty("Workbooks").toDispatch(); - - workbook = Dispatch.get(workbooks, "Add").toDispatch(); - - workSheets = Dispatch.get(workbook, "Worksheets").toDispatch(); - - sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch(); - // grab the whole range specified above. - tabCells = Dispatch.invoke(sheet, "Range", Dispatch.Get, - new Object[] { position }, new int[1]).toDispatch(); - - sa = Dispatch.get(tabCells, "Value").toSafeArray(true); - - System.out.println("Ub0=" + sa.getUBound(1)); // nbCol - System.out.println("Ub1=" + sa.getUBound(2)); // nbLgn - - // number of rows - int nbLgn = sa.getUBound(2); - // number of columns - int nbCol = sa.getUBound(1); - - int[] colLgn = new int[] { 0, 0 }; - - // now set a value on every cell in the range we retrieved - for (int i = 1; i <= nbLgn; i++) { - colLgn[1] = i; - - for (int j = 1; j <= nbCol; j++) { - colLgn[0] = j; - // this one works with out a leak 1.13-M3 - // sa.setString(j, i, "test"); - // This one leaks with 1.13-M3 and earlier - sa.setString(colLgn, "test"); - } - } - - Dispatch.put(tabCells, "Value", sa); - - Variant f = new Variant(false); - Dispatch.call(workbook, "Close", f); - System.out.println("Close"); - } catch (Exception e) { - e.printStackTrace(); - } finally { - - if (sa != null) { - try { - sa.safeRelease(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - sa = null; - } - } - - if (tabCells != null) { - try { - tabCells.safeRelease(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - tabCells = null; - } - } - - if (sheet != null) { - try { - sheet.safeRelease(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - sheet = null; - } - } - - if (workSheets != null) { - try { - workSheets.safeRelease(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - workSheets = null; - } - } - - if (workbook != null) { - try { - workbook.safeRelease(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - workbook = null; - } - } - - if (workbooks != null) { - try { - workbooks.safeRelease(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - workbooks = null; - } - } - - if (xl != null) { - try { - xl.invoke("Quit", new Variant[] {}); - } catch (Exception e) { - e.printStackTrace(); - } - - try { - xl.safeRelease(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - xl = null; - } - } - - ComThread.Release(); - } - } - } -} diff --git a/unittest/com/jacob/test/safearray/SafeArrayReleaseTest.java b/unittest/com/jacob/test/safearray/SafeArrayReleaseTest.java deleted file mode 100644 index 1ea6de3..0000000 --- a/unittest/com/jacob/test/safearray/SafeArrayReleaseTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.jacob.test.safearray; - -import com.jacob.com.ComThread; -import com.jacob.com.SafeArray; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - *

      - * SF 1085370 In my understatnding, an instance of SafeArray java class has a - * value of a pointer to VARIANT structure that contains a pointer to a - * SAFEARRAY strucuture. - * - * On the other hand, we can create a Variant object from the SafeArray object - * like this: SafeArray sa = ...; Variant val = new Variant(sa); the val object - * has a pointer to another VARIANT structure that contains a pointer to the - * same SAFEARRAY structure. - * - * In this case, the val object has a pointer to another VARIANT that contains a - * pointer to the same SAFEARRAY like this: - * - * +-----------+ |SafeArray | +------------+ | m_pV--->VARIANT(a) | - * +-----------+ | VT_ARRAY| +---------+ | parray---->SAFEARRAY| +------------+ - * +^--------+ | +-----------+ | |Variant | +------------+ | | - * m_pVariant--->VARIANT(b) | | +-----------+ | VT_ARRAY| | | parray-----+ - * +------------+ - * - * When previous objects are rereased by ComThread.Release(), first the - * VARIANT(a) is released by VariantClear() function, and second the VARIANT(b) - * is released by VariantClear() function too. But the SAFEARRAY was already - * released by the VARIANT(a). - * - * So, in my enviroment (WinXP + J2SDK 1.4.1) the following java program is - * sometimes crash with EXCEPTION_ACCESS_VIOLATION. - * - * - * To solve this problem, it is nessesary to copy the SAFEARRAY like this: - * - * +-----------+ |Variant | +------------+ | m_pVariant--->VARIANT(a) | - * +-----------+ | VT_ARRAY| +---------+ | parray---->SAFEARRAY| +------------+ - * +|--------+ | +-----------+ | copySA() |SafeArray | +------------+ | | - * m_pV--->VARIANT(b) | V +-----------+ | VT_ARRAY| +---------+ | - * parray---->SAFEARRAY| +------------+ +---------+ - * - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ - -public class SafeArrayReleaseTest extends BaseTestCase { - final static int MAX = 300; - - /** - * verifies the release works on SafeArray - */ - public void testSaveArrayRelease() { - int count; - System.out.println("Starting test for max = " + MAX); - for (count = 1; count < MAX; count++) { - int i = 0; - try { - ComThread.InitMTA(); - for (i = 0; i < count; i++) { - SafeArray a1 = new SafeArray(Variant.VariantVariant, 2); - a1.setVariant(0, new Variant("foo")); - a1.setVariant(1, new Variant("bar")); - Variant v = new Variant(a1); - SafeArray a2 = v.toSafeArray(true); - if (a2 == null) { - System.out.println("got null back from toSafeArray()"); - } - } - ComThread.Release(); - System.gc(); - // System.out.print("."); - } catch (Exception e) { - fail("Test fails with i = " + i + " (max = " + MAX + ")"); - } - } - System.gc(); - System.out.println("\nTest ends with count = " + count + " (max = " - + MAX + ")"); - } -} \ No newline at end of file diff --git a/unittest/com/jacob/test/safearray/SafeArrayViaExcel.java b/unittest/com/jacob/test/safearray/SafeArrayViaExcel.java deleted file mode 100644 index d71a612..0000000 --- a/unittest/com/jacob/test/safearray/SafeArrayViaExcel.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.jacob.test.safearray; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.Dispatch; -import com.jacob.com.SafeArray; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This does simple tests with SafeArray using Excel as a source - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - *

      - * This relies on BaseTestCase to provide the root path to the file under test - */ -public class SafeArrayViaExcel extends BaseTestCase { - - /** - * verify safe arrays work with standard applications, Excel in this case - */ - public void testSafeArrayViaExcel() { - - ActiveXComponent xl = new ActiveXComponent("Excel.Application"); - try { - Dispatch cell; - SafeArray sAProdText; - Dispatch workbooks = xl.getProperty("Workbooks").toDispatch(); - System.out.println("have workbooks"); - Dispatch workbook = Dispatch.call( - workbooks, - "Open", - getWindowsFilePathToPackageResource( - "SafeArrayViaExcel.xls", this.getClass())) - .toDispatch(); - System.out.println("Opened File - SafeArrayViaExcel.xls\n"); - Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch(); - cell = Dispatch.invoke(sheet, "Range", Dispatch.Get, - new Object[] { "A1:D1000" }, new int[1]).toDispatch(); - System.out.println("have cell:" + cell); - sAProdText = Dispatch.get(cell, "Value").toSafeArray(); - System.out.println("sa: dim=" + sAProdText.getNumDim()); - System.out.println("sa: start row=" + sAProdText.getLBound(1)); - System.out.println("sa: start col=" + sAProdText.getLBound(2)); - System.out.println("sa: end row=" + sAProdText.getUBound(1)); - System.out.println("sa: end col=" + sAProdText.getUBound(2)); - int i; - int lineNumber = 1; - int n = 0; - for (lineNumber = 1; lineNumber < 1000; lineNumber++) { - for (i = 1; i < 4; i++) { - System.out.println((n++) + " " + lineNumber + " " + i + " " - + sAProdText.getString(lineNumber, i)); - /* - * if (sAProdText.getString(lineNumber,i).compareTo("aaaa") != - * 0 ) { System.out.println("Invalid String in line " + - * lineNumber + " Cell " + i + " Value = " + - * sAProdText.getString(lineNumber,i)); stringFound = false; } } - * if (stringFound) { System.out.println("Valid Strings in - * line " + lineNumber); lineNumber++; } - */ - } - } - - Dispatch.call(workbook, "Close"); - System.out.println("Closed File\n"); - } catch (Exception e) { - e.printStackTrace(); - fail("Caught Exception " + e); - } finally { - xl.invoke("Quit", new Variant[] {}); - } - } -} diff --git a/unittest/com/jacob/test/safearray/SafeArrayViaExcel.xls b/unittest/com/jacob/test/safearray/SafeArrayViaExcel.xls deleted file mode 100644 index 219a664..0000000 Binary files a/unittest/com/jacob/test/safearray/SafeArrayViaExcel.xls and /dev/null differ diff --git a/unittest/com/jacob/test/vbscript/ScriptTest.java b/unittest/com/jacob/test/vbscript/ScriptTest.java deleted file mode 100644 index 755f8d4..0000000 --- a/unittest/com/jacob/test/vbscript/ScriptTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.jacob.test.vbscript; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.DispatchEvents; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * In this case the component is created and used in the same thread and it's an - * Apartment Threaded component, so we call InitSTA. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ScriptTest extends BaseTestCase { - - public void testStupidSpeedTest() { - String lang = "VBScript"; - ActiveXComponent sC = new ActiveXComponent("ScriptControl"); - Dispatch sControl = sC.getObject(); - Dispatch.put(sControl, "Language", lang); - for (int i = 0; i < 10000; i++) { - Dispatch.call(sControl, "Eval", "1+1"); - } - } - - public void testCreatingDispatchEvents() { - ComThread.InitSTA(true); - DispatchEvents de = null; - Dispatch sControl = null; - - try { - String scriptCommand = getSampleVPScriptForEval(); - String lang = "VBScript"; - ActiveXComponent sC = new ActiveXComponent("ScriptControl"); - sControl = sC.getObject(); - Dispatch.put(sControl, "Language", lang); - ScriptTestErrEvents te = new ScriptTestErrEvents(); - de = new DispatchEvents(sControl, te); - if (de == null) { - System.out - .println("Received null when trying to create new DispatchEvents"); - } - Variant result = Dispatch.call(sControl, "Eval", scriptCommand); - // call it twice to see the objects reused - result = Dispatch.call(sControl, "Eval", scriptCommand); - // call it 3 times to see the objects reused - result = Dispatch.call(sControl, "Eval", scriptCommand); - System.out.println("eval(" + scriptCommand + ") = " + result); - } catch (ComException e) { - e.printStackTrace(); - fail("Caught Exception " + e); - } finally { - Integer I = null; - for (int i = 1; i < 1000000; i++) { - I = new Integer(i); - } - System.out.println(I); - ComThread.Release(); - ComThread.quitMainSTA(); - } - } -} diff --git a/unittest/com/jacob/test/vbscript/ScriptTest2.java b/unittest/com/jacob/test/vbscript/ScriptTest2.java deleted file mode 100644 index 0fe91ea..0000000 --- a/unittest/com/jacob/test/vbscript/ScriptTest2.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.jacob.test.vbscript; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.DispatchEvents; -import com.jacob.com.DispatchProxy; -import com.jacob.com.STA; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This example demonstrates how to make calls between two different STA's. - * First, to create an STA, you need to extend the STA class and override its - * OnInit() method. This method will be called in the STA's thread so you can - * use it to create your COM components that will run in that STA. If you then - * try to call methods on those components from other threads (STA or MTA) - - * this will fail. You cannot create a component in an STA and call its methods - * from another thread. You can use the DispatchProxy to get a proxy to any - * Dispatch that lives in another STA. This object has to be created in the STA - * that houses the Dispatch (in this case it's created in the OnInit method). - * Then, another thread can call the toDispatch() method of DispatchProxy to get - * a local proxy. At most ONE (!) thread can call toDispatch(), and the call can - * be made only once. This is because a IStream object is used to pass the - * proxy, and it is only written once and closed when you read it. If you need - * multiple threads to access a Dispatch pointer, then create that many - * DispatchProxy objects. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ - -public class ScriptTest2 extends BaseTestCase { - public void testScript2() { - try { - ComThread.InitSTA(); - ScriptTestSTA script = new ScriptTestSTA(); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { - // should we get this? - } - - String scriptCommand = getSampleVPScriptForEval(); - // get a thread-local Dispatch from sCon - Dispatch sc = script.sCon.toDispatch(); - - // call a method on the thread-local Dispatch obtained - // from the DispatchProxy. If you try to make the same - // method call on the sControl object - you will get a - // ComException. - Variant result = Dispatch.call(sc, "Eval", scriptCommand); - System.out.println("eval(" + scriptCommand + ") = " + result); - script.quit(); - System.out.println("called quit"); - } catch (ComException e) { - e.printStackTrace(); - fail("caught exception" + e); - } finally { - Integer I = null; - for (int i = 1; i < 1000000; i++) { - I = new Integer(i); - } - System.out.println(I); - ComThread.Release(); - } - } - - public class ScriptTestSTA extends STA { - - public DispatchEvents de = null; - - public Dispatch sControl = null; - - public DispatchProxy sCon = null; - - public boolean OnInit() { - try { - System.out.println("OnInit"); - System.out.println(Thread.currentThread()); - String lang = "VBScript"; - sControl = new ActiveXComponent("ScriptControl"); - - // sCon can be called from another thread - sCon = new DispatchProxy(sControl); - - Dispatch.put(sControl, "Language", lang); - ScriptTestErrEvents te = new ScriptTestErrEvents(); - de = new DispatchEvents(sControl, te); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - public void OnQuit() { - System.out.println("OnQuit"); - } - - } - -} diff --git a/unittest/com/jacob/test/vbscript/ScriptTest2ActiveX.java b/unittest/com/jacob/test/vbscript/ScriptTest2ActiveX.java deleted file mode 100644 index 58c7898..0000000 --- a/unittest/com/jacob/test/vbscript/ScriptTest2ActiveX.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.jacob.test.vbscript; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.ComThread; -import com.jacob.com.DispatchEvents; -import com.jacob.com.DispatchProxy; -import com.jacob.com.STA; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * This example demonstrates how to make calls between two different STA's. - * First, to create an STA, you need to extend the STA class and override its - * OnInit() method. This method will be called in the STA's thread so you can - * use it to create your COM components that will run in that STA. If you then - * try to call methods on those components from other threads (STA or MTA) - - * this will fail. You cannot create a component in an STA and call its methods - * from another thread. You can use the DispatchProxy to get a proxy to any - * Dispatch that lives in another STA. This object has to be created in the STA - * that houses the Dispatch (in this case it's created in the OnInit method). - * Then, another thread can call the toDispatch() method of DispatchProxy to get - * a local proxy. At most ONE (!) thread can call toDispatch(), and the call can - * be made only once. This is because a IStream object is used to pass the - * proxy, and it is only written once and closed when you read it. If you need - * multiple threads to access a Dispatch pointer, then create that many - * DispatchProxy objects. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ScriptTest2ActiveX extends BaseTestCase { - public static ActiveXComponent sC; - - public static DispatchEvents de = null; - - public static DispatchProxy sCon = null; - - public void testActiveXSTA() { - try { - ComThread.InitSTA(); - ScriptTest2ActiveXSTA script = new ScriptTest2ActiveXSTA(); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { - // should we get this? - } - - // get a thread-local Dispatch from sCon - ActiveXComponent sc = new ActiveXComponent(sCon.toDispatch()); - - // call a method on the thread-local Dispatch obtained - // from the DispatchProxy. If you try to make the same - // method call on the sControl object - you will get a - // ComException. - String scriptCommand = getSampleVPScriptForEval(); - Variant result = sc.invoke("Eval", scriptCommand); - System.out.println("eval(" + scriptCommand + ") = " + result); - script.quit(); - System.out.println("called quit"); - } catch (ComException e) { - e.printStackTrace(); - fail("blew up with Com Exception " + e); - } finally { - Integer I = null; - for (int i = 1; i < 1000000; i++) { - I = new Integer(i); - } - System.out.println(I); - ComThread.Release(); - } - } - - public class ScriptTest2ActiveXSTA extends STA { - - public boolean OnInit() { - try { - System.out.println("OnInit"); - System.out.println(Thread.currentThread()); - String lang = "VBScript"; - sC = new ActiveXComponent("ScriptControl"); - - // sCon can be called from another thread - sCon = new DispatchProxy(sC); - - sC.setProperty("Language", lang); - ScriptTestErrEvents te = new ScriptTestErrEvents(); - de = new DispatchEvents(sC, te); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - public void OnQuit() { - System.out.println("OnQuit"); - } - - } - -} \ No newline at end of file diff --git a/unittest/com/jacob/test/vbscript/ScriptTest3.java b/unittest/com/jacob/test/vbscript/ScriptTest3.java deleted file mode 100644 index 2745ec6..0000000 --- a/unittest/com/jacob/test/vbscript/ScriptTest3.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.jacob.test.vbscript; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import com.jacob.com.DispatchEvents; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * Here we create the ScriptControl component in a separate MTA thread and then - * call the Eval method from the main thread. The main thread must also be an - * MTA thread. If you try to create it as an STA then you will not be able to - * make calls into a component running in another thread. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ScriptTest3 extends BaseTestCase { - - public static ActiveXComponent sC; - - public static DispatchEvents de = null; - - public static Dispatch sControl = null; - - public static boolean quit = false; - - public void testScript() { - try { - ComThread.InitMTA(); - ScriptTest3Inner script = new ScriptTest3Inner(); - script.start(); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { - // should we get this? - } - - Variant result = Dispatch.call(sControl, "Eval", - getSampleVPScriptForEval()); - System.out.println("eval(" + getSampleVPScriptForEval() + ") = " - + result); - System.out.println("setting quit"); - ScriptTest3.quit = true; - } catch (ComException e) { - e.printStackTrace(); - fail("Caught excpetion running script with MTA"); - } finally { - System.out.println("main done"); - ComThread.Release(); - } - } - - class ScriptTest3Inner extends Thread { - public void run() { - try { - ComThread.InitMTA(); - System.out.println("OnInit"); - String lang = "VBScript"; - sC = new ActiveXComponent("ScriptControl"); - sControl = sC.getObject(); - Dispatch.put(sControl, "Language", lang); - ScriptTestErrEvents te = new ScriptTestErrEvents(); - de = new DispatchEvents(sControl, te); - System.out.println("sControl=" + sControl); - while (!quit) { - sleep(100); - } - ComThread.Release(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - System.out.println("worker thread exits"); - } - } - - } -} diff --git a/unittest/com/jacob/test/vbscript/ScriptTest3ActiveX.java b/unittest/com/jacob/test/vbscript/ScriptTest3ActiveX.java deleted file mode 100644 index e75b268..0000000 --- a/unittest/com/jacob/test/vbscript/ScriptTest3ActiveX.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.jacob.test.vbscript; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.ComThread; -import com.jacob.com.DispatchEvents; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * Here we create the ScriptControl component in a separate MTA thread and then - * call the Eval method from the main thread. The main thread must also be an - * MTA thread. If you try to create it as an STA then you will not be able to - * make calls into a component running in another thread. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ScriptTest3ActiveX extends BaseTestCase { - public static ActiveXComponent sC; - - public static DispatchEvents de = null; - - public static boolean quit = false; - - public void testYetAnotherScriptTest() { - try { - ComThread.InitMTA(); - ScriptTest3ActiveXInner script = new ScriptTest3ActiveXInner(); - script.start(); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { - // should we get this? - } - - Variant result = sC.invoke("Eval", getSampleVPScriptForEval()); - System.out.println("eval(" + getSampleVPScriptForEval() + ") = " - + result); - System.out.println("setting quit"); - ScriptTest3ActiveX.quit = true; - } catch (ComException e) { - e.printStackTrace(); - fail("Caught ComException " + e); - } finally { - System.out.println("main done"); - ComThread.Release(); - } - } - - public class ScriptTest3ActiveXInner extends Thread { - public void run() { - try { - ComThread.InitMTA(); - System.out.println("OnInit"); - String lang = "VBScript"; - sC = new ActiveXComponent("ScriptControl"); - sC.setProperty("Language", lang); - ScriptTestErrEvents te = new ScriptTestErrEvents(); - de = new DispatchEvents(sC, te); - System.out.println("sControl=" + sC); - while (!quit) { - sleep(100); - } - ComThread.Release(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - System.out.println("worker thread exits"); - } - } - - } -} diff --git a/unittest/com/jacob/test/vbscript/ScriptTestActiveX.java b/unittest/com/jacob/test/vbscript/ScriptTestActiveX.java deleted file mode 100644 index 210db85..0000000 --- a/unittest/com/jacob/test/vbscript/ScriptTestActiveX.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.jacob.test.vbscript; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComException; -import com.jacob.com.ComThread; -import com.jacob.com.DispatchEvents; -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * In this case the component is created and used in the same thread and it's an - * Apartment Threaded component, so we call InitSTA. - *

      - * May need to run with some command line options (including from inside - * Eclipse). Look in the docs area at the Jacob usage document for command line - * options. - */ -public class ScriptTestActiveX extends BaseTestCase { - public void testActiveXScript() { - ComThread.InitSTA(true); - DispatchEvents de = null; - - try { - String lang = "VBScript"; - ActiveXComponent sC = new ActiveXComponent("ScriptControl"); - sC.setProperty("Language", lang); - ScriptTestErrEvents te = new ScriptTestErrEvents(); - de = new DispatchEvents(sC, te); - if (de == null) { - System.out - .println("null returned when trying to create DispatchEvents"); - } - Variant result; - result = sC.invoke("Eval", getSampleVPScriptForEval()); - // call it twice to see the objects reused - result = sC.invoke("Eval", getSampleVPScriptForEval()); - // call it 3 times to see the objects reused - result = sC.invoke("Eval", getSampleVPScriptForEval()); - System.out.println("eval(" + getSampleVPScriptForEval() + ") = " - + result); - } catch (ComException e) { - e.printStackTrace(); - } finally { - Integer I = null; - for (int i = 1; i < 1000000; i++) { - I = new Integer(i); - } - System.out.println(I); - ComThread.Release(); - ComThread.quitMainSTA(); - } - } -} diff --git a/unittest/com/jacob/test/vbscript/ScriptTestErrEvents.java b/unittest/com/jacob/test/vbscript/ScriptTestErrEvents.java deleted file mode 100644 index c0700bf..0000000 --- a/unittest/com/jacob/test/vbscript/ScriptTestErrEvents.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.jacob.test.vbscript; - -import com.jacob.com.Variant; -import com.jacob.test.BaseTestCase; - -/** - * Extracted from ScriptTest so everyone can see this Made a test solely because - * it made the ant test easier - */ -public class ScriptTestErrEvents extends BaseTestCase { - - public void Error(Variant[] args) { - System.out.println("java callback for error!"); - } - - public void Timeout(Variant[] args) { - System.out.println("java callback for error!"); - } -} diff --git a/unittest/com/jacob/test/windowsmedia/WMPlayer.java b/unittest/com/jacob/test/windowsmedia/WMPlayer.java deleted file mode 100644 index 734d391..0000000 --- a/unittest/com/jacob/test/windowsmedia/WMPlayer.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.jacob.test.windowsmedia; - -/** - * partial test program from the sourceforge bug report 1453161 - * that says you get a random "can't map name to dispid" when - * getting the URL from the player - *

      - * May need to run with some command line options (including from inside Eclipse). - * Look in the docs area at the Jacob usage document for command line options. - */ -import com.jacob.activeX.ActiveXComponent; -import com.jacob.test.BaseTestCase; - -public class WMPlayer extends BaseTestCase { - - public void testOpenWMPlayer() { - ActiveXComponent wmp = null; - wmp = new ActiveXComponent("WMPlayer.OCX"); - - // the sourceforge posting didn't post all the code so this is all we - // have we need some other information on how to set the document - // so that we have a url to open - for (int i = 0; i < 1000; i++) { - System.out.println("the wmp url is " - + wmp.getProperty("URL").toString()); - } - - } - -} diff --git a/unittest/readme.txt b/unittest/readme.txt deleted file mode 100644 index 389dc05..0000000 --- a/unittest/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains junit tests and other/older tests for -specific functions. Sometimes tests in this directory migrate -to the samples directory as they are updated to show more functionality. \ No newline at end of file diff --git a/vstudio/jacob/jacob.vcproj b/vstudio/jacob/jacob.vcproj deleted file mode 100644 index 15f314a..0000000 --- a/vstudio/jacob/jacob.vcproj +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -