Comparar commits
1279 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 296e89e7c6 | |||
| e52c4255d9 | |||
| a0eaa3fb95 | |||
| bf870bb9e3 | |||
| 8d4aa48713 | |||
| 21d459bb55 | |||
| 05210b2332 | |||
| 942380eadd | |||
| e0ff9cd8d3 | |||
| 3470e24b46 | |||
| ab513b62a0 | |||
| da6c521e1c | |||
| 5115f143ce | |||
| 64466deb5e | |||
| d8638912f0 | |||
| 87c582ce23 | |||
| 9f1361b533 | |||
| 323a913bf6 | |||
| deff187509 | |||
| cfbe750615 | |||
| 32447ce488 | |||
| 27c7d3ad49 | |||
| 9340b94e63 | |||
| d7bb1e189f | |||
| 6cd4216336 | |||
| bbef9fa6ab | |||
| 28fc8ce789 | |||
| 8508354adc | |||
| 6d8bf1eaf4 | |||
| d498bd9493 | |||
| c490fc9101 | |||
| 05348f6c26 | |||
| bfc02645a0 | |||
| 46238caafb | |||
| 2a756c628a | |||
| 56eb5c7d4a | |||
| 1bd0db1148 | |||
| dc013ea124 | |||
| 34d87fd98f | |||
| 71631fb543 | |||
| 4934eb644b | |||
| f3e7ede297 | |||
| 2c0d097389 | |||
| e3aa9cd1a2 | |||
| d84910a762 | |||
| 2c16197d0f | |||
| 2e4c4349dd | |||
| 5d4e9b14fd | |||
| feecc7fd1e | |||
| 3f23dc3ffb | |||
| 5ce1658269 | |||
| 75a532b088 | |||
| 8aa8a2e090 | |||
| 4836f05059 | |||
| ed35e7b973 | |||
| 4e4dbda6f0 | |||
| 6756267f48 | |||
| 87200e8006 | |||
| 35c743df72 | |||
| c94c3b9ee0 | |||
| 1d0988127d | |||
| e736b45a35 | |||
| e67a50c904 | |||
| 6f37195ce2 | |||
| 9785311050 | |||
| ed5dac53cc | |||
| 6b25643334 | |||
| 667fdd1e32 | |||
| a0c486f826 | |||
| a41d97d9e8 | |||
| 30b64fb78c | |||
| f277c9dce2 | |||
| c7dcf61bb6 | |||
| 438d1313fc | |||
| e465dca4ce | |||
| 99bd756eab | |||
| b2e16d4f6c | |||
| 6f13f2e6d9 | |||
| f5d7955f41 | |||
| 0aab1f52a5 | |||
| 8dd1592f70 | |||
| eaf9e25461 | |||
| deb7cc68f4 | |||
| 5b3a782ab7 | |||
| 66fcd236cf | |||
| 487dab42de | |||
| bb27c09164 | |||
| f6ceaf3355 | |||
| cb8f9dd7df | |||
| 395bffcf72 | |||
| 35cc5e2e31 | |||
| 4df5e827a7 | |||
| 8de77d3df3 | |||
| 8a4a7e1b1a | |||
| 7dc7547271 | |||
| 4ee5e0efec | |||
| e79f6e0e04 | |||
| 9de200502a | |||
| 57197d3cc8 | |||
| e4a1158b50 | |||
| 23a7cbaf11 | |||
| 21765f9a9c | |||
| bc0b30fec5 | |||
| 6883010c0f | |||
| 3fc7603da8 | |||
| 79c3521c94 | |||
| 1d6fa14851 | |||
| ddecf09700 | |||
| e9d3793b61 | |||
| 5ec1f87113 | |||
| f35fe81b40 | |||
| 4d0f5ab5d5 | |||
| 919a31f16e | |||
| 938ee0ddd8 | |||
| 4f9260b35e | |||
| 6e0690aa70 | |||
| 854165453a | |||
| 04d74c8ba5 | |||
| 0ddf39c979 | |||
| 842904ad44 | |||
| 20b582e97b | |||
| 2553a95c95 | |||
| f989080691 | |||
| 02230ef692 | |||
| d8d9c62de1 | |||
| c1ac91e00f | |||
| 4f1f03346f | |||
| 8c9e2e67ef | |||
| 2c32c5596e | |||
| af8c85428d | |||
| 2bb0ac91d1 | |||
| 8f24f1d82a | |||
| 6762c42a18 | |||
| f1903d903c | |||
| 2ee9962838 | |||
| 9f4155a150 | |||
| 44f6e5ab76 | |||
| b10c508a6b | |||
| 70f3c4757f | |||
| 15b2df4acf | |||
| 3157243deb | |||
| 95526ab823 | |||
| cf6b5e4dce | |||
| 4b245b9053 | |||
| 923cd5a937 | |||
| 342afd7221 | |||
| 91a9bd6ab3 | |||
| b980a28c91 | |||
| 9b7ba38dc2 | |||
| 08157deece | |||
| c7e7e2bcdc | |||
| 01ab778621 | |||
| 312de23e5e | |||
| 792c5374d7 | |||
| 34dea52d6c | |||
| 6f3703d00b | |||
| cbd4b46f9f | |||
| ff1109389c | |||
| c31e9cdebf | |||
| 97449288eb | |||
| 9c2aebcf3c | |||
| 54c1851db5 | |||
| f1d0a9b688 | |||
| d62a8abb24 | |||
| 3f182664be | |||
| 6f362b53c3 | |||
| 617420eaf9 | |||
| e0d2079802 | |||
| 897b318324 | |||
| 1737d6addb | |||
| 418a53806c | |||
| 79272c76a5 | |||
| d0936b0189 | |||
| 8db46b4c1a | |||
| c6a88f3b7f | |||
| 2fb4c9b683 | |||
| 766db7a318 | |||
| e8d4a3e6c0 | |||
| 9ac8de0f5d | |||
| fed3b9f432 | |||
| 327b429d79 | |||
| 55cca7220a | |||
| 3e55136c6a | |||
| 2d7971a429 | |||
| acf06d725f | |||
| e5dcc56056 | |||
| ce96234b72 | |||
| 3b8fe3b011 | |||
| 82561550e8 | |||
| 631920d41e | |||
| 6021064040 | |||
| 0547a9c3e2 | |||
| a1fe8ce22c | |||
| 5e56b8565a | |||
| 16d4db1790 | |||
| 32442cd2c4 | |||
| 2ac6c86266 | |||
| 5664101490 | |||
| d2dda4abb6 | |||
| 1f878f01f7 | |||
| bf28737ebd | |||
| 7fb2c1b041 | |||
| 4f3dcfdf4b | |||
| 13b2d7c0c1 | |||
| 2239bdfdfd | |||
| c6151c3775 | |||
| 0387196f85 | |||
| c7e7798979 | |||
| aa80c8d19f | |||
| 02d5f47380 | |||
| 75f3ed2d5a | |||
| 4e5afb4940 | |||
| 85793114d4 | |||
| 708e76473a | |||
| 2b8773a8f0 | |||
| 962ae7998e | |||
| 8f199788a5 | |||
| caaddd1179 | |||
| 3704b23a71 | |||
| c596f9f7d5 | |||
| f6208e71f4 | |||
| 85a3cda5c8 | |||
| 6c591c38d9 | |||
| 15aac21e2b | |||
| e0441a356d | |||
| f3da8161aa | |||
| 609e3e459b | |||
| 8638bb57f9 | |||
| d11084ce0d | |||
| 1ae335c7da | |||
| 99529821b4 | |||
| d551e656cb | |||
| ba49b166fb | |||
| a3e002c1db | |||
| 02601e4f7c | |||
| e2349e4bf6 | |||
| 87afaf44f7 | |||
| bb913b171d | |||
| 975063a28f | |||
| 8e44c82096 | |||
| 7a33f0b43e | |||
| cfdf20f4b7 | |||
| 13207caab6 | |||
| 980b86e2c5 | |||
| c6afe5f73d | |||
| 5c48942bda | |||
| 82c032329a | |||
| 2a2bdbe60c | |||
| 9414757638 | |||
| 253dc5abae | |||
| 296185c0ba | |||
| 70cff3e17a | |||
| 78969b8050 | |||
| d90f6e3346 | |||
| 8f99db35dd | |||
| b5759955d5 | |||
| adafa3b2c4 | |||
| 979f43da07 | |||
| 528036e9e3 | |||
| 39aebf1d0b | |||
| 45df2eb8f5 | |||
| 7ae490a393 | |||
| 4c114f7796 | |||
| 92aa443023 | |||
| 1492546150 | |||
| 95c7be884f | |||
| 00acbd664e | |||
| e7b4a2d5ec | |||
| d7448ad16c | |||
| 7d8afba0f4 | |||
| 0f1bdc87d4 | |||
| d4ed7ea34f | |||
| daf8d5ef89 | |||
| 3ba1fd0975 | |||
| a3cdb5a90d | |||
| c6c99b8b98 | |||
| fffe7926da | |||
| 285e5305cb | |||
| b9fa73ce7a | |||
| d5669d2ae4 | |||
| 3db7fc10ec | |||
| 7a0ec5b1df | |||
| 8e99313ea4 | |||
| 8e8aba6ffb | |||
| f903aa926d | |||
| 3848e55813 | |||
| 55778824f3 | |||
| 5b240371d9 | |||
| d65432a014 | |||
| 107d7fa43e | |||
| bf19830d66 | |||
| 090b248708 | |||
| e5855c2fa1 | |||
| 064785b985 | |||
| 757446c64e | |||
| 14e69d1501 | |||
| 874caccc53 | |||
| 295aaa4c31 | |||
| dbd45ddf90 | |||
| 2f2289c9df | |||
| 9b7dddfe0c | |||
| 21a468a125 | |||
| de82d964ca | |||
| d843968432 | |||
| f4958ee8f9 | |||
| 1ed65484e0 | |||
| 8c1e1c2d2e | |||
| c888d6e86a | |||
| a9ef0e6aca | |||
| 35b409dce8 | |||
| 16f3f9310e | |||
| 5206982e48 | |||
| 8e9e3b45b6 | |||
| f96eddc6ca | |||
| b2dc918313 | |||
| d511e9f0e5 | |||
| ed93f9833e | |||
| 4b34601dc3 | |||
| c7142dc82c | |||
| 9914826b57 | |||
| d2159d70e3 | |||
| 6a06656c16 | |||
| b1aa24d911 | |||
| 198cb1f9df | |||
| 3fa90d76f5 | |||
| bfea982d45 | |||
| 78d70e760e | |||
| 4b9632c4ee | |||
| 6c9708070c | |||
| b7a299f42a | |||
| e35977776d | |||
| 25d1b110a3 | |||
| 38b796a516 | |||
| 136653a644 | |||
| 1af1000139 | |||
| 5db3b42770 | |||
| 6b552cc03d | |||
| 19d7775e91 | |||
| 299b0a9517 | |||
| 075efa649d | |||
| b4f0f21421 | |||
| dbeda7f67d | |||
| ea56252d2f | |||
| 8d376755dc | |||
| 5d8243ec3b | |||
| 85e962c124 | |||
| 97403354a2 | |||
| 605dfcbd33 | |||
| 3f6441c420 | |||
| 885586188c | |||
| a517ca68e9 | |||
| 4f84e1b325 | |||
| 5857cf7c49 | |||
| 52bec37a5b | |||
| 48b584d979 | |||
| 6d2658d888 | |||
| 48df3d3cd2 | |||
| d58add66d4 | |||
| 5ac33562cf | |||
| 483223546b | |||
| 3a795a4483 | |||
| 3e0ee7eced | |||
| 721a080af9 | |||
| e8dd1564d5 | |||
| 6b923bcf0c | |||
| 889d2bbb11 | |||
| d53bbd32a9 | |||
| 467ab4ec17 | |||
| 900a68eb63 | |||
| 638135f309 | |||
| 3a94cbf242 | |||
| 8326d791bf | |||
| a676e3acaa | |||
| 8a5265c1dd | |||
| cab106167c | |||
| 6fc42f59e1 | |||
| d0995f3bc2 | |||
| 8ed4def1f3 | |||
| bf0ab0ea55 | |||
| d4a33cbc58 | |||
| 18cd75b130 | |||
| 4b2c411a2e | |||
| b33ac764b4 | |||
| 0edd935144 | |||
| 839be7862e | |||
| 3cfb7df151 | |||
| 3364dfcc2a | |||
| 818f7fa5d6 | |||
| 8bb128062a | |||
| f576184c13 | |||
| 7d57612d7d | |||
| c94e9ff4b7 | |||
| 0a8a67ca5f | |||
| dac9dc4742 | |||
| bf91b32d25 | |||
| 16e6031999 | |||
| a4ee620aaf | |||
| 2c18ec2b75 | |||
| f0080de225 | |||
| e176d09eac | |||
| 9ff14b0a90 | |||
| 1b234b6c3b | |||
| 84cfea1ac0 | |||
| 85d8d08972 | |||
| 5cf120de75 | |||
| bdf38eaf8e | |||
| 3823533c17 | |||
| fecaf92ec1 | |||
| d7ed79ea07 | |||
| 830dc666ad | |||
| 68010b6752 | |||
| b7951759ec | |||
| ead2c70a1a | |||
| e0016e875f | |||
| d74598979a | |||
| 24f60158d4 | |||
| 910642248d | |||
| b26402bd57 | |||
| 6166a169e3 | |||
| bf1579a5dc | |||
| 2a51bbfba5 | |||
| d8e8889d92 | |||
| 6fdb21414d | |||
| 6178c5c6a0 | |||
| e7b0c5d05d | |||
| 1140b4eed2 | |||
| 99613775b1 | |||
| 13c1a17018 | |||
| e51a82e19d | |||
| 5180a7e092 | |||
| d56c74724c | |||
| 27e9f0f005 | |||
| 832845535a | |||
| fcf1f5c283 | |||
| 47d1f3cc89 | |||
| 58b89ebc55 | |||
| a2bfccb15b | |||
| 7904663f14 | |||
| bbc1d4b432 | |||
| f22ab3c687 | |||
| 12b1886d7b | |||
| d08124bedf | |||
| cb32c812d0 | |||
| 69fbc85665 | |||
| 65a246f39b | |||
| 0d9bd6d96b | |||
| efd7866a36 | |||
| ff647ad4df | |||
| 4acf0056f5 | |||
| 675c983922 | |||
| 8a286f570c | |||
| d9dd417b09 | |||
| 215763d012 | |||
| 9180d8f39c | |||
| 2fb527a017 | |||
| 211a9ebf4d | |||
| 7e1b32649e | |||
| ed58f42176 | |||
| e00752087b | |||
| 626bf14b2d | |||
| 683e7351f0 | |||
| 5242a7d826 | |||
| ee18766b16 | |||
| f3a384f011 | |||
| 5267a6ddde | |||
| a9f757f39c | |||
| af1ef9330f | |||
| cf58970bdf | |||
| 4595abcebe | |||
| 4b73c277fa | |||
| 9f80a92973 | |||
| b4091b4f45 | |||
| cb714b9f8b | |||
| 0769a8e597 | |||
| 846cbb3c96 | |||
| e6d7829ca2 | |||
| 404cf22380 | |||
| 6c75db5003 | |||
| 71a8ecfd27 | |||
| 2582708b2f | |||
| 5587a8fadc | |||
| 22cb28ec50 | |||
| c4d9966709 | |||
| c69d03a74b | |||
| 38643d974b | |||
| 00308279df | |||
| 896f4b8b85 | |||
| ae1bafb39b | |||
| 3e2e7ffec7 | |||
| 46bc91fc63 | |||
| fb9e4c6262 | |||
| aa043c73e7 | |||
| 68ed3e521e | |||
| b6b3a51d32 | |||
| 7573196742 | |||
| b2e16a0ca5 | |||
| 53809b3c38 | |||
| 2549728a97 | |||
| 06fde953b1 | |||
| 21b9287cfd | |||
| eeeed87239 | |||
| 97e50d7a35 | |||
| f0195711b5 | |||
| 68ba4117f6 | |||
| dbd584d305 | |||
| f308faf1ea | |||
| 4ea22e54e3 | |||
| 10e77227b6 | |||
| e69d7fa485 | |||
| a9521411a5 | |||
| 70b11b47ee | |||
| 63ba1fa79f | |||
| 24fbca4c1d | |||
| b0fa11cb0a | |||
| 8bd15d139a | |||
| 7aab825cf1 | |||
| cb03ea8f4e | |||
| 35ee8d44f3 | |||
| 9db7e1a958 | |||
| cdb4797fa3 | |||
| bd4207dfa4 | |||
| c9493636a9 | |||
| ce0138e614 | |||
| fd07c9e404 | |||
| ed6ae9501b | |||
| ffef2e046a | |||
| 95eecebb28 | |||
| 176aa9d2e2 | |||
| f3a4f3fdde | |||
| e6d76b9bc8 | |||
| 49868b8203 | |||
| 522f8fef49 | |||
| c4dfa259eb | |||
| f62bd63fe6 | |||
| f7cd61e9e6 | |||
| 6a79012942 | |||
| 528e1bcbe9 | |||
| f0fd47dbdb | |||
| e1c2632941 | |||
| ef19ab440b | |||
| 75bb17e11f | |||
| 2c2f4bee15 | |||
| 58696f0c2c | |||
| 4130e11693 | |||
| 19de232dd2 | |||
| afb3fb6ab1 | |||
| 4dda1bcdd1 | |||
| c665f2ccb9 | |||
| 370112938e | |||
| bcc0c28001 | |||
| 1f01a50e09 | |||
| 9cc0ce3148 | |||
| bd0425966f | |||
| 7089c83878 | |||
| 9511c34c54 | |||
| c6e9d44c7d | |||
| 3d051ecbb5 | |||
| f0ae20f0b6 | |||
| 2c83e4c22b | |||
| 07eaffd28f | |||
| 8c1f995e4e | |||
| f721075ac3 | |||
| da711cc76b | |||
| d9fb94a13d | |||
| 9da1b4528d | |||
| 768ea368a6 | |||
| 6ff34c29db | |||
| acdfd6ea20 | |||
| b9bf45ecce | |||
| b5df2c589a | |||
| dff973e9ee | |||
| 4a0644f3cd | |||
| f8d521999c | |||
| be0e5b51cd | |||
| f10c45b1f8 | |||
| 6d608dd49b | |||
| 70658a0279 | |||
| f3ceebecfd | |||
| 251eae5cac | |||
| 07b88af439 | |||
| 959616e992 | |||
| f7b2f910b7 | |||
| 4220566fb4 | |||
| 415179f9b7 | |||
| 9a9f8cbd99 | |||
| 319f6e9047 | |||
| 9b7d02618e | |||
| ed2f4d3b05 | |||
| fef81ce17f | |||
| 1942640b2d | |||
| d8232c9122 | |||
| 1a8b3b55d8 | |||
| 156d2015a5 | |||
| 8cbbb1eec8 | |||
| 351d68faf6 | |||
| 6d0651acbc | |||
| 7bd83c65f9 | |||
| dfe8862e0f | |||
| e89e70c9a6 | |||
| 8f06411357 | |||
| 011a2eaed7 | |||
| f29b2f5c51 | |||
| 1a9d2daef3 | |||
| 662f961d91 | |||
| 7e06d1ab81 | |||
| 6a22e39d4c | |||
| ff27aaffe3 | |||
| 601f1026eb | |||
| bada2e326d | |||
| 655bb8f369 | |||
| 1035ffb2f4 | |||
| 840f975866 | |||
| aeb8719a34 | |||
| 40860245a4 | |||
| 20cae32b15 | |||
| 9742f91782 | |||
| bdf59518fb | |||
| 3f7e52a4d9 | |||
| 8da7dc2e56 | |||
| b1cda9cd72 | |||
| 811d025b88 | |||
| c7e96bd3c0 | |||
| bc67864e57 | |||
| 96a4450d70 | |||
| 8591ebd55f | |||
| 16b6d591d5 | |||
| 5e3e485d4d | |||
| f7bd979d1b | |||
| 176b44fd65 | |||
| 548714343a | |||
| 8ce6297b97 | |||
| 52897e2693 | |||
| d5582d6181 | |||
| d9868285a0 | |||
| 429bed5aba | |||
| 3442e07023 | |||
| fef7e3786e | |||
| e77f69908a | |||
| c2be88fd9c | |||
| 85f8c409de | |||
| f03eab0824 | |||
| 05fbe1faed | |||
| 0b4986a788 | |||
| 3c337eef51 | |||
| 90720962ce | |||
| ad442d822d | |||
| bff052d9cd | |||
| bbfc36e8c6 | |||
| 136dbaa257 | |||
| cd41aeab61 | |||
| 8bf987d4df | |||
| 3ee74fd6dc | |||
| 13e2d7b925 | |||
| b6215a24b5 | |||
| 5141543000 | |||
| 56ba8d86f4 | |||
| 6a028caec1 | |||
| 2d9b393975 | |||
| c62b73bdf5 | |||
| 8308984e47 | |||
| f26c7ca671 | |||
| 74c776e219 | |||
| 8962c8c8d0 | |||
| 35ddb69c2b | |||
| f7879bc3f3 | |||
| 67cea90fc0 | |||
| 0de3277b18 | |||
| 8f4772f383 | |||
| ea7f8440d5 | |||
| 2832feaa8e | |||
| f06c0f1037 | |||
| 1f8675d4c1 | |||
| 335f419a86 | |||
| 53236d5061 | |||
| 72222ca3fb | |||
| 1e326c9543 | |||
| cb6671f5b8 | |||
| ebbe779668 | |||
| 4394096da0 | |||
| ed7a59c3ff | |||
| ccee09a4ff | |||
| 089dbce7cc | |||
| 980a334c42 | |||
| 8bad679ade | |||
| 981c32ee11 | |||
| f90fd1288b | |||
| 2e27312ea0 | |||
| f2b6eb5e7a | |||
| 24439832da | |||
| 89c1f7fa4c | |||
| b78eef7789 | |||
| aaa7fd0123 | |||
| 8b17879219 | |||
| 6ab495c8eb | |||
| 03be32b103 | |||
| 4218a07549 | |||
| 61a0549295 | |||
| f6b58d2bdc | |||
| 17a26e7dbc | |||
| 580dd76041 | |||
| 74ae45c476 | |||
| d6d99a9b6b | |||
| 3854e50e64 | |||
| a8966e8dcf | |||
| 69da33a076 | |||
| 98c7993a41 | |||
| 662763fdcc | |||
| 47211510b0 | |||
| 997ff2e7ed | |||
| 32d19f0a61 | |||
| a5ce77f5c4 | |||
| 464e03172f | |||
| d9ad71341c | |||
| 4eedc67bf0 | |||
| c96712eadc | |||
| f680b598b7 | |||
| 3b2fd06dc0 | |||
| dfadfb1985 | |||
| e944b8c7eb | |||
| 9ccd51be1f | |||
| f342996cb5 | |||
| 58e8b66f70 | |||
| fa5d747905 | |||
| 6993a6686f | |||
| 296b97d58a | |||
| 363db04779 | |||
| 13f2419f33 | |||
| ec9868b85b | |||
| a31faf3026 | |||
| e1fda6694b | |||
| 2fb117023b | |||
| d2a70dac78 | |||
| 18218163fd | |||
| fccab0ac15 | |||
| 02a01db39a | |||
| bd950aa654 | |||
| 32758ee8e2 | |||
| 0c79114d30 | |||
| 43b426410d | |||
| 26de4b0dd0 | |||
| 58243488fc | |||
| 489b5ddde1 | |||
| 0d0d36d599 | |||
| 2d454fb7dc | |||
| 5097ed533f | |||
| 160dee7d84 | |||
| 7395736b9f | |||
| b64c489135 | |||
| fffc3f0f7c | |||
| 5dd4e0c846 | |||
| e32ae1cae6 | |||
| 8771dce348 | |||
| 3ac6f75611 | |||
| f88d243071 | |||
| feb7b88279 | |||
| 070b47e825 | |||
| c1289c07be | |||
| e68fd9dfaf | |||
| f23a4bf9d5 | |||
| 70084e70dd | |||
| 9c00a3f674 | |||
| 048d2f41c3 | |||
| b769daec0c | |||
| 4e36f71f3a | |||
| 25db8ccfa7 | |||
| 5c2923c0af | |||
| 018ad7f2c0 | |||
| c1a7fd7267 | |||
| 3c086de42c | |||
| b48390fc1e | |||
| 136fe02333 | |||
| 5f9d100b2d | |||
| 176f3f32d4 | |||
| 2667202a3f | |||
| 245eb88b40 | |||
| d51479c357 | |||
| 7a583b1aaa | |||
| eaff9bd176 | |||
| da4d941906 | |||
| ed94e60da3 | |||
| 2fe6c956b4 | |||
| 559c7d7f13 | |||
| 6b7f2eeadb | |||
| 7bda1b3d0e | |||
| d516b01c75 | |||
| 08c579f0cb | |||
| c231069066 | |||
| ec16947808 | |||
| 2d61573175 | |||
| 507c065c0e | |||
| cf6b6299e0 | |||
| 862a746170 | |||
| 14717ce21f | |||
| 72aade4f8f | |||
| fbf75539f9 | |||
| 879402d020 | |||
| 7296f2213d | |||
| fb243c6cf5 | |||
| 20d1a720ce | |||
| ea12e0755b | |||
| 83cc22a24c | |||
| c795c80439 | |||
| edab625da6 | |||
| 9f9240391b | |||
| 4fbbc6b42a | |||
| cdbc379608 | |||
| bfeac30452 | |||
| 2e7d188afa | |||
| d291bd52cd | |||
| d8e8fd09a6 | |||
| d66471e4c0 | |||
| bb7d364f45 | |||
| f9f8474e7f | |||
| e2cac3a280 | |||
| d6b5c2c797 | |||
| c0e51cb47f | |||
| 03f054b474 | |||
| 511676e0e9 | |||
| 94ac8af162 | |||
| a814936bd7 | |||
| e42b2ca09d | |||
| 7be159d0c2 | |||
| c53c384096 | |||
| 6a52c22a02 | |||
| 6f30debd34 | |||
| d400921e17 | |||
| e95b37e5de | |||
| b9cc27c1ad | |||
| c8852f7c44 | |||
| 18b0700337 | |||
| 8d535e72c7 | |||
| 2f51fc68cb | |||
| 1f1972bf0e | |||
| e91fbd35c2 | |||
| f46c5ffc2b | |||
| a9f90b508a | |||
| 7dd96c6978 | |||
| 0c888d992b | |||
| 14da21e9f9 | |||
| 019e861539 | |||
| 79d208096b | |||
| 28c4c5fef5 | |||
| 5e211134d5 | |||
| 310e829d70 | |||
| 3d0040a183 | |||
| bbb0501f76 | |||
| 641b7aa3ad | |||
| 1572b12f75 | |||
| 689ddc493f | |||
| cb05293c11 | |||
| d5e2ee902d | |||
| b9995b2ad0 | |||
| bd243519df | |||
| f11614bc27 | |||
| 58a5185c20 | |||
| e92ff82c19 | |||
| c4c07d7878 | |||
| e07ed3082d | |||
| 5728822dad | |||
| fd13022f7c | |||
| 296eaec0e6 | |||
| 8b8672214c | |||
| 2f662bcf6d | |||
| 35f12b7027 | |||
| 719fab1ad2 | |||
| 67ffdd5168 | |||
| afc3fe3687 | |||
| 14dbeda4ed | |||
| f5ee066cc0 | |||
| ad65bcccfb | |||
| fab66d7d49 | |||
| d78c38e4e2 | |||
| 21cecef8ef | |||
| 3e8511fbc6 | |||
| 21863e190d | |||
| fb84300563 | |||
| a8de00b8e5 | |||
| 5fd52be589 | |||
| 6335fef0b1 | |||
| 3455742d89 | |||
| 6ba364f64f | |||
| 164da6cf1c | |||
| 1b6bc6342e | |||
| bde74fdccf | |||
| 6dd612162d | |||
| 2ff4d20fad | |||
| fbcd02ae6e | |||
| 6de51cdf5a | |||
| e97b1df6ee | |||
| 65d68b8d70 | |||
| f915ec7e05 | |||
| 44b4bc0cac | |||
| 2a6ac9a20d | |||
| 076298e343 | |||
| 1c3ab0f80f | |||
| a0ae2836d9 | |||
| 2309762aca | |||
| e4d89f7087 | |||
| 44c41b6faf | |||
| 8003de03ec | |||
| c5ae6a3cbb | |||
| 4581cb2f61 | |||
| 804795c5f8 | |||
| c2c1f81ea5 | |||
| 14481ee346 | |||
| aea387ce02 | |||
| 4ddad49369 | |||
| 224f18fef4 | |||
| 2390543445 | |||
| 473d48b39b | |||
| a947dfdac5 | |||
| a064b2a0e1 | |||
| 3755747fda | |||
| 57ded8d803 | |||
| aa5fc9b3d8 | |||
| 6d6f711080 | |||
| afb3a7cc84 | |||
| 76f7b189fa | |||
| d330f19292 | |||
| b14ccb8eab | |||
| d873f6f6be | |||
| 7f0d465e98 | |||
| 9889489355 | |||
| 09b23cfc1d | |||
| 213ed15c70 | |||
| ff3d76fd42 | |||
| 7e0a412c4f | |||
| 39e6a58604 | |||
| 853cc722a1 | |||
| 3f5023068c | |||
| ebb8e89456 | |||
| a098b44f4c | |||
| 10d1e51393 | |||
| 9bcc884276 | |||
| a044a56b1c | |||
| 59bb61a366 | |||
| f2981454cb | |||
| 39dccddb60 | |||
| 3afaa9a34a | |||
| 65f40c35a2 | |||
| 0a1ab12a8d | |||
| e1539266e6 | |||
| 7c5e60b5f4 | |||
| e72ed5eeaa | |||
| bd78c9c331 | |||
| 84d3253f86 | |||
| 964c5b93f8 | |||
| 6c194233a5 | |||
| 8360bf1cd0 | |||
| d578b89619 | |||
| dee20f8e45 | |||
| 4130e1972d | |||
| 1ff9c604bb | |||
| 211060eb8f | |||
| 78d9c638ba | |||
| afaf338160 | |||
| 9e9c4aeb77 | |||
| 8efc0b1f40 | |||
| 1df51398ae | |||
| cd2277cc79 | |||
| 164e6fe04b | |||
| c365ee7577 | |||
| f22c38bbd9 | |||
| 03e9ee321a | |||
| 95f31151ec | |||
| 198ed1ef85 | |||
| 4f17e1f142 | |||
| ff9454da44 | |||
| ea14ae85e8 | |||
| 52891f8a93 | |||
| c8f1bde8e2 | |||
| 6a6e7f862f | |||
| d52fbed05c | |||
| 322052ce65 | |||
| af18df2bc2 | |||
| 236c939132 | |||
| c411f140f3 | |||
| 3d56106b07 | |||
| 8c01954c50 | |||
| fed646a207 | |||
| d76441cf71 | |||
| ee6696fdf4 | |||
| c6265c36a9 | |||
| cc5e41bf32 | |||
| 049d8386ff | |||
| 3b7efa4e74 | |||
| d992ac54a2 | |||
| 2d3fb36420 | |||
| 30ff28e1d8 | |||
| 09f8f310f4 | |||
| 53d7b16564 | |||
| 18dd85d6cb | |||
| 74ee6ea8b4 | |||
| 2541679dbd | |||
| cbb062cc35 | |||
| 8cf8878425 | |||
| 24b72070c0 | |||
| d72c49e556 | |||
| 3000dc237f | |||
| 1fbf9dc44f | |||
| 90af15ef5c | |||
| 55e4a5aa15 | |||
| a0c80f279b | |||
| 8195e0e11d | |||
| 56b3f8cef0 | |||
| 28a00f61ff | |||
| 7f2ea33a80 | |||
| 92ff23e77f | |||
| 58fb8ca2df | |||
| cc3fbd975c | |||
| e449a43bbe | |||
| 71c792f51b | |||
| 7c7c9f3272 | |||
| ed62e48b95 | |||
| 17d9e9e68d | |||
| 6972a4ffda | |||
| 1833aa0fb9 | |||
| f1fb139b4e | |||
| 5cb470331d | |||
| 269deef6db | |||
| 42695e7250 | |||
| a6e56b97f6 | |||
| 747d6c32d4 | |||
| eab6e41cde | |||
| 69dbe845f4 | |||
| f498318c07 | |||
| 630b9c0ac4 | |||
| 0cad4386fa | |||
| 09cb76f264 | |||
| 2e3a48ccdd | |||
| 5e4814d992 | |||
| 5c0cc6f153 | |||
| 857fe3de46 | |||
| e2214f8adb | |||
| 1106229a57 | |||
| bc9d0be295 | |||
| 3b836249fe | |||
| a26e394061 | |||
| b8099539f0 | |||
| dc411e8f99 | |||
| 404585d134 | |||
| 19ce713188 | |||
| 89284fe55f | |||
| ba022c338a | |||
| 097e5f3924 | |||
| ed2c518d96 | |||
| 0e5843995f | |||
| 5b9cd52784 | |||
| 2db72615b5 | |||
| f6ab3edc23 | |||
| cef6194628 | |||
| 53f387b203 | |||
| 4fbcb5b5fb | |||
| 8e7652ef6a | |||
| 83038cf24a | |||
| b00ff3e98f | |||
| da2773e02a | |||
| 01d71b7bed | |||
| 19afda0069 | |||
| 9e1196444e | |||
| f38364b399 | |||
| 36849e7716 | |||
| b764162526 | |||
| a3d9aa8501 | |||
| c71480eaf8 | |||
| 9af9291b73 | |||
| 68ce0c383e | |||
| 75af086be8 | |||
| 1ac92cca9b | |||
| be72fbab29 | |||
| 70150bdf45 | |||
| 6b452bafae | |||
| 8ddac835b6 | |||
| 69043d0293 | |||
| a82e6c354e | |||
| 84e8de6e9f | |||
| 3aeecc9eb1 | |||
| 00d0b59cd1 | |||
| bda487e870 | |||
| c1d28ba8d5 | |||
| 5feacad4a5 | |||
| 10ea848900 | |||
| d14178be4c | |||
| 3f5b1375ab | |||
| eaf444eabc | |||
| 6309741522 | |||
| 9dc9a293f3 | |||
| f2c2a4fce9 | |||
| c0b69e57d5 | |||
| 59a259f4d3 | |||
| 3de1eb36d3 | |||
| c3813b6d7f | |||
| 8d27f68baa | |||
| ff3cd68b8c | |||
| cadeba6cb5 | |||
| 0739e7dc00 | |||
| edfdfd2e85 | |||
| 7b7a42f221 | |||
| 4b18d1f73d | |||
| c3042afaf3 | |||
| b0304e9679 | |||
| 2e7e03d014 | |||
| aea706c528 | |||
| 0cfe60e9d1 | |||
| 14e2e92e86 | |||
| 884402787b | |||
| 01c78756af | |||
| 7086846465 | |||
| 838d4ad920 | |||
| 7e37eaaf77 | |||
| 07cc7a3719 | |||
| 2b9be16ffa | |||
| 9458d88f67 | |||
| 6a34124175 | |||
| 39c8792ece | |||
| 1d04af52e3 | |||
| 26e9509c9b | |||
| 9c157d3215 | |||
| d22de05b0b | |||
| 1fe3dc7c20 | |||
| f7c0bc613a | |||
| c7fa2da826 | |||
| da11bece0f | |||
| e3399b11ed | |||
| 115ab36fce | |||
| f8c7a245bf | |||
| ce806772f0 | |||
| dcc1f6b4f1 | |||
| 2829f5941a | |||
| cd98813de5 | |||
| e4a91de766 | |||
| 3425a763bc | |||
| 2340e7a777 | |||
| 5cbe2058c1 | |||
| c6dddbd02b | |||
| 5ffc0c3748 | |||
| bd29f83ee9 | |||
| 9474f853f8 | |||
| 0c25275ec2 | |||
| 39228c27ed | |||
| 5e93cc704d | |||
| b509af8959 | |||
| d57e96dc56 | |||
| b01d6d1982 | |||
| 35b6ded138 | |||
| acc46605f2 | |||
| 16d1996ed0 | |||
| 92a515c33e | |||
| e4363160ba | |||
| 1dc2781d2b | |||
| bb27735fe6 | |||
| b2a54c100c | |||
| 25723e7141 | |||
| 70758199c7 | |||
| e8bb12563f | |||
| d66a8e32c3 | |||
| 7c3b7fd6b5 | |||
| 1a2f93a8b3 | |||
| 944c95cf7a | |||
| 00fa972430 | |||
| f5179e6794 | |||
| 80e2b5a749 | |||
| 7063d9996f | |||
| bdfeb13f0d | |||
| 69205de17d | |||
| 260d513fea | |||
| 3704031875 | |||
| 8406f5f48f | |||
| 23a9e73212 | |||
| 429e37d3ad | |||
| 51e79c4283 | |||
| affcab04e2 | |||
| 59689d5522 | |||
| b13c84cf46 | |||
| 265289f679 | |||
| fb5036cd6d | |||
| 40bec108e7 | |||
| b922048fa8 | |||
| affca4b92d | |||
| 3e53d8752e | |||
| 4d92f6c8e7 | |||
| 0e185fa11a | |||
| f73986bd21 | |||
| 0208f68fe5 | |||
| 01adb0e638 | |||
| 1edd456322 | |||
| c9b5428008 | |||
| d5fa5633d5 | |||
| ac35bfc6fc | |||
| f7942975fe | |||
| 59aa6bb1bf | |||
| 45a45ab990 | |||
| 4db74cbea8 | |||
| c3e1101ffa | |||
| 7e0cc12e92 | |||
| 2d7dc885ec | |||
| a0525f03ee | |||
| 2b30dfb314 | |||
| bf41e64840 | |||
| 4d39ddee67 | |||
| d58b032b41 | |||
| 91e5478df6 | |||
| bd0768f877 | |||
| 49d345f767 | |||
| 12ac48fc79 | |||
| 6b91c41da8 | |||
| 2b59579e35 | |||
| 6cbdf3f3a3 | |||
| 1d1dc81104 | |||
| f045a2367f | |||
| 6257f07d1a | |||
| 4232af563c | |||
| 961543615c | |||
| aeb0abab87 | |||
| 77fe243556 | |||
| d4970cf452 | |||
| f0b1462f2d | |||
| 27e52f33ba | |||
| fadab28eb6 | |||
| b5e44c8dfa | |||
| f359848d1a | |||
| c30df49e15 | |||
| 675561bb9a | |||
| abc0bbf381 | |||
| e332366d15 | |||
| d420424039 | |||
| f4932dd020 | |||
| 085520ddc8 | |||
| 77175b3f72 | |||
| 2544e45a0b | |||
| 6002211b1c | |||
| ccabd2b16b | |||
| e680ecfbfc | |||
| e7ba089659 | |||
| 0cd4aa24e2 | |||
| 5826120fbd | |||
| 220aa4b27d | |||
| 1c3adc892c | |||
| 4af66bb62f | |||
| 5435965f90 | |||
| 6fdb7de0fe | |||
| bc7144b01b | |||
| e57279831e | |||
| 7247436b5f | |||
| a8b0d40ff9 | |||
| f893d22733 | |||
| 688ddfeced | |||
| f9e40776d4 | |||
| 8c1d2eb47f | |||
| 1359dfc658 | |||
| 6e2de5eee3 | |||
| 8807355af3 | |||
| f7e9f91ade | |||
| c4860de618 | |||
| c578b58314 | |||
| acdb200512 | |||
| e75be655ce | |||
| d6669a0dd5 | |||
| 4819d52b00 | |||
| 2dbf801eb4 | |||
| d170961701 | |||
| c7747d9769 | |||
| dd2aa9a8de | |||
| 4e9452abed | |||
| 6d3b2bddaf | |||
| ebc6a9c28a | |||
| 78ffc52a8b | |||
| b4d77e827d | |||
| bfb73f08fd | |||
| af8b7f037c | |||
| 334f0b0609 | |||
| 3ab5cb4a1d | |||
| d2a9eb5a8b | |||
| bc75c54bd3 | |||
| d3782ec816 | |||
| 8d8d3843c4 | |||
| 49634f3bf2 | |||
| c64a84c769 | |||
| 9813273b07 |
Arquivo executável → Arquivo normal
+9
-8
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||
<classpathentry kind="output" path="build.eclipse/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||
<classpathentry kind="lib" path="lib/test/reflections-0.9.8.jar"/>
|
||||
<classpathentry kind="output" path="build.eclipse/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,9 +2,22 @@ build
|
||||
build-d64
|
||||
build.eclipse
|
||||
build.number
|
||||
build.clover
|
||||
.metadata
|
||||
.DS_Store
|
||||
bin
|
||||
contrib/ntservice/dist
|
||||
contrib/platform/dist
|
||||
doc
|
||||
*~
|
||||
**/*~
|
||||
dist/*.asc
|
||||
dist/*-sources.jar
|
||||
dist/*-javadoc.jar
|
||||
dist/src-mvn.zip
|
||||
dist/out-of-date.jar
|
||||
perf*.txt
|
||||
native/libffi/doc/libffi.info
|
||||
junit-*
|
||||
pom-jna.xml.asc
|
||||
pom-jna-platform.xml.asc
|
||||
|
||||
Arquivo executável → Arquivo normal
@@ -1,62 +0,0 @@
|
||||
#Wed Aug 29 20:43:29 EDT 2007
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
@@ -1,3 +0,0 @@
|
||||
#Tue Mar 27 21:18:08 EDT 2007
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Arquivo executável → Arquivo normal
+722
-568
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+504
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
Arquivo executável → Arquivo normal
+25
-504
@@ -1,504 +1,25 @@
|
||||
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.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
JNA is dual-licensed under 2 alternative Open Source/Free
|
||||
licenses: LGPL 2.1 and Apache License 2.0. (starting with
|
||||
JNA version 4.0.0).
|
||||
|
||||
What this means is that one can choose either one of these
|
||||
licenses (for purposes of re-distributing JNA; usually by
|
||||
including it as one of jars another application or
|
||||
library uses) by downloading corresponding jar file,
|
||||
using it, and living happily everafter.
|
||||
|
||||
You may obtain a copy of the LGPL License at:
|
||||
|
||||
http://www.gnu.org/licenses/licenses.html
|
||||
|
||||
A copy is also included in the downloadable source code package
|
||||
containing JNA, in file "LGPL2.1", under the same directory
|
||||
as this file.
|
||||
|
||||
You may obtain a copy of the ASL License at:
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
A copy is also included in the downloadable source code package
|
||||
containing JNA, in file "ASL2.0", under the same directory
|
||||
as this file.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
This copy of JNA is licensed under the
|
||||
Apache (Software) License, version 2.0 ("the License").
|
||||
See the License for details about distribution rights, and the
|
||||
specific rights regarding derivate works.
|
||||
|
||||
You may obtain a copy of the License at:
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
A copy is also included in the downloadable source code package
|
||||
containing JNA, in file "ASL2.0", under the same directory
|
||||
as this file.
|
||||
@@ -0,0 +1,13 @@
|
||||
This copy of JNA is licensed under the
|
||||
Lesser General Public License (LGPL), version 2.1 ("the License").
|
||||
See the License for details about distribution rights, and the
|
||||
specific rights regarding derivate works.
|
||||
|
||||
You may obtain a copy of the License at:
|
||||
|
||||
http://www.gnu.org/licenses/licenses.html
|
||||
|
||||
A copy is also included in the downloadable source code package
|
||||
containing JNA, in file "LGPL2.1", under the same directory
|
||||
as this file.
|
||||
|
||||
Arquivo executável → Arquivo normal
+43
-33
@@ -3,30 +3,29 @@
|
||||
Java Native Access (JNA)
|
||||
========================
|
||||
|
||||
The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://twall.github.com/jna/3.4.2/javadoc/). Please read the [overview](http://twall.github.com/jna/3.4.2/javadoc/overview-summary.html#overview_description).
|
||||
The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://twall.github.com/jna/4.1.0). Please read the [overview](http://twall.github.io/jna/4.1.0/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).
|
||||
|
||||
JNA provides Java programs easy access to native shared libraries (DLLs on Windows) without writing anything but Java code—no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes. Access is dynamic at runtime without code generation.
|
||||
JNA provides Java programs easy access to native shared libraries without writing anything but Java code - no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes.
|
||||
|
||||
JNA allows you to call directly into native functions using natural Java method invocation. The Java call looks just like it does in native code. Most calls require no special handling or configuration; no boilerplate or generated code is required.
|
||||
JNA allows you to call directly into native functions using natural Java method invocation. The Java call looks just like the call does in native code. Most calls require no special handling or configuration; no boilerplate or generated code is required.
|
||||
|
||||
The JNA library uses a small native library stub to dynamically invoke native code. The developer uses a Java interface to describe functions and structures in the target native library. This makes it quite easy to take advantage of native platform features without incurring the high overhead of configuring and building JNI code for multiple platforms.
|
||||
JNA uses a small JNI library stub to dynamically invoke native code. The developer uses a Java interface to describe functions and structures in the target native library. This makes it quite easy to take advantage of native platform features without incurring the high overhead of configuring and building JNI code for multiple platforms.
|
||||
|
||||
While some attention is paid to performance, correctness and ease of use take priority.
|
||||
While significant attention has been paid to performance, correctness and ease of use take priority.
|
||||
|
||||
JNA includes a platform library with many native functions already mapped as well as a set of utility interfaces that simplify native access.
|
||||
In addition, JNA includes a platform library with many native functions already mapped as well as a set of utility interfaces that simplify native access.
|
||||
|
||||
Projects Using JNA
|
||||
==================
|
||||
JNA is a mature library with dozens of contributors and hundreds of commercial and non-commercial projects that use it. If you're using JNA, feel free to [tell us about it](http://groups.google.com/group/jna-users). Include some details about your company, project name, purpose and size and tell us how you use the library.
|
||||
|
||||
Download
|
||||
========
|
||||
|
||||
Version 3.4.2
|
||||
Version 4.1.0
|
||||
|
||||
* [jna.jar](jna/blob/3.4.2/dist/jna.jar?raw=true)
|
||||
* [platform.jar](jna/blob/3.4.2/dist/platform.jar?raw=true)
|
||||
|
||||
Version 3.4.1
|
||||
|
||||
* [jna.jar](jna/blob/3.4.1/dist/jna.jar?raw=true)
|
||||
* [platform.jar](jna/blob/3.4.1/dist/platform.jar?raw=true)
|
||||
* [jna.jar](https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar)
|
||||
* [jna-platform.jar](https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna-platform/4.1.0/jna-platform-4.1.0.jar)
|
||||
|
||||
Features
|
||||
========
|
||||
@@ -42,7 +41,7 @@ Features
|
||||
* Nested structures and arrays
|
||||
* Wide (wchar_t-based) strings
|
||||
* Native long support (32- or 64-bit as appropriate)
|
||||
* Demo applications
|
||||
* [Demo applications/examples](https://github.com/twall/jna/tree/master/contrib)
|
||||
* Supported on 1.4 or later JVMs, including JavaME (earlier VMs may work with stubbed NIO support)
|
||||
* Customizable marshalling/unmarshalling (argument and return value conversions)
|
||||
* Customizable mapping from Java method to native function name, and customizable invocation to simulate C preprocessor function macros
|
||||
@@ -51,11 +50,13 @@ Features
|
||||
* Type-safety for native pointers
|
||||
* VM crash protection (optional)
|
||||
* Optimized direct mapping for high-performance applications.
|
||||
* COM support for early and late binding.
|
||||
* COM/Typelib java code generator.
|
||||
|
||||
Community and Support
|
||||
=====================
|
||||
|
||||
All questions should be posted ot the [jna-users Google group](http://groups.google.com/group/jna-users). Issues can be submitted [here on Github](https://github.com/twall/jna/issues).
|
||||
All questions should be posted to the [jna-users Google group](http://groups.google.com/group/jna-users). Issues can be submitted [here on Github](https://github.com/twall/jna/issues).
|
||||
|
||||
When posting to the mailing list, please include the following:
|
||||
|
||||
@@ -73,38 +74,47 @@ For commercial support, please contact twalljava [at] java [dot] net.
|
||||
Using the Library
|
||||
=================
|
||||
|
||||
* [Getting Started](jna/tree/master/www/GettingStarted.md)
|
||||
* [Mapping between Java and Native](jna/tree/master/www/Mappings.md)
|
||||
* [Using Pointers and Arrays](jna/tree/master/www/PointersAndArrays.md)
|
||||
* [Using Structures and Unions](jna/tree/master/www/StructuresAndUnions.md)
|
||||
* [Using By-Reference Arguments](jna/tree/master/www/ByRefArguments.md)
|
||||
* [Customization of Type Mapping](jna/tree/master/www/CustomMappings.md)
|
||||
* [Callbacks/Function Pointers/Closures](jna/tree/master/www/CallbacksAndClosures.md)
|
||||
* [Dynamically Typed Languages (JRuby/Jython)](jna/tree/master/www/DynamicallyTypedLanguages.md)
|
||||
* [Platform Library](jna/tree/master/www/PlatformLibrary.md)
|
||||
* [Direct Method Mapping](jna/tree/master/www/DirectMapping.md) (Optimization)
|
||||
* [Frequently Asked Questions (FAQ)](jna/tree/master/www/FrequentlyAskedQuestions.md)
|
||||
* [Setting up a Windows Development Environment](jna/tree/master/www/WindowsDevelopmentEnvironment.md)
|
||||
* [Avoiding Crashes](http://twall.github.com/jna/3.4.2/javadoc/overview-summary.html#crash-protection)
|
||||
* [Getting Started](https://github.com/twall/jna/blob/master/www/GettingStarted.md)
|
||||
* [Mapping between Java and Native](https://github.com/twall/jna/blob/master/www/Mappings.md)
|
||||
* [Using Pointers and Arrays](https://github.com/twall/jna/blob/master/www/PointersAndArrays.md)
|
||||
* [Using Structures and Unions](https://github.com/twall/jna/blob/master/www/StructuresAndUnions.md)
|
||||
* [Using By-Reference Arguments](https://github.com/twall/jna/blob/master/www/ByRefArguments.md)
|
||||
* [Customization of Type Mapping](https://github.com/twall/jna/blob/master/www/CustomMappings.md)
|
||||
* [Callbacks/Function Pointers/Closures](https://github.com/twall/jna/blob/master/www/CallbacksAndClosures.md)
|
||||
* [Dynamically Typed Languages (JRuby/Jython)](https://github.com/twall/jna/blob/master/www/DynamicallyTypedLanguages.md)
|
||||
* [Platform Library](https://github.com/twall/jna/blob/master/www/PlatformLibrary.md)
|
||||
* [Direct Method Mapping](https://github.com/twall/jna/blob/master/www/DirectMapping.md) (Optimization)
|
||||
* [Frequently Asked Questions (FAQ)](https://github.com/twall/jna/blob/master/www/FrequentlyAskedQuestions.md)
|
||||
* [Avoiding Crashes](http://twall.github.com/jna/4.1.0/javadoc/overview-summary.html#crash-protection)
|
||||
|
||||
Primary Documentation (JavaDoc)
|
||||
===============================
|
||||
|
||||
The definitive JNA reference is in the [JavaDoc](http://twall.github.com/jna/3.4.2/javadoc/).
|
||||
The definitive JNA reference is in the [JavaDoc](http://twall.github.com/jna/4.1.0/).
|
||||
|
||||
Developers
|
||||
==========
|
||||
|
||||
* [Contributing to JNA](https://github.com/twall/jna/blob/master/www/Contributing.md)
|
||||
* [Setting up a Windows Development Environment](https://github.com/twall/jna/blob/master/www/WindowsDevelopmentEnvironment.md)
|
||||
* [Setting up an Android Development Environment](https://github.com/twall/jna/blob/master/www/AndroidDevelopmentEnvironment.md)
|
||||
* [Releasing JNA](https://github.com/twall/jna/blob/master/www/ReleasingJNA.md)
|
||||
* [Publishing to Maven Central](https://github.com/twall/jna/blob/master/www/PublishingToMavenCentral.md)
|
||||
|
||||
Contributing
|
||||
============
|
||||
|
||||
You're encouraged to contribute to JNA. Fork the code from [github.com/twall/jna](https://github.com/twall/jna) and submit pull requests.
|
||||
You're encouraged to contribute to JNA. Fork the code from [https://github.com/twall/jna](https://github.com/twall/jna) and submit pull requests.
|
||||
|
||||
For more informationon setting up a development environment see [Contributing to JNA](jna/tree/master/www/Contributing.md).
|
||||
For more information on setting up a development environment see [Contributing to JNA](https://github.com/twall/jna/blob/master/www/Contributing.md).
|
||||
|
||||
If you are interested in paid support, feel free to say so on the [jna-users mailing list](http://groups.google.com/group/jna-users). Most simple questions will be answered on the list, but more complicated work, new features or target platforms can be negotiated with any of the JNA developers (this is how several of JNA's features came into being). You may even encounter other users with the same need and be able to cost share the new development.
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This library is provided under the LGPL, version 2.1 or later. Alternative license arrangements are negotiable.
|
||||
This library is licensed under the LGPL, version 2.1 or later, and (from version 4.0 onward) the Apache Software License, version 2.0. Commercial license arrangements are negotiable.
|
||||
|
||||
*NOTE: Oracle is not sponsoring this project, even though the package name (com.sun.jna) might imply otherwise.*
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
JNA release process (does not yet include maven deployment)
|
||||
|
||||
* Bump version in CHANGES.md and build.xml. Change JNI version in build.xml *only* if
|
||||
JNA's native API has been changed (i.e. md5 changed). Bump JNA minor version if its Java API
|
||||
has changed significantly or incompatibly.
|
||||
|
||||
* If native changes have been made, run `ant dist` target on each target
|
||||
platform, pushing the resulting target-specific jar file to master.
|
||||
|
||||
* Run `ant dist` target. Commit and push generated jar files in dist.
|
||||
|
||||
* Update Javadoc
|
||||
Check out gh-pages branch, copy latest doc/javadoc into <version>/javadoc,
|
||||
commit and push.
|
||||
|
||||
* Update README.md, commit and push
|
||||
* download links
|
||||
* javadoc links
|
||||
|
||||
* Tag as <version>, push new tag to origin
|
||||
+65
-52
@@ -10,19 +10,54 @@
|
||||
o arrays are treated as pointers, except within a struct
|
||||
- in structure (inline; otherwise pointer-to-X should be used)
|
||||
- as function argument (auto-convert to pointer via Memory)
|
||||
o pointer to type in struct should use Pointer or ByReference
|
||||
o pointer to type in struct should use PointerType or Structure.ByReference
|
||||
o "free" should be invisible wherever possible
|
||||
|
||||
# FUTURE DEMOS:
|
||||
* test keyboard keys' state (needs OSX)
|
||||
* test keyboard keys' state (needs OSX impl)
|
||||
* get system process information, basic process control
|
||||
* additional file utilities (meta info, free space, etc)
|
||||
* enforce window minimum/maximum size (workaround java bug)
|
||||
|
||||
# TODO
|
||||
|
||||
* make native dll extraction from jar public, to use with user dlls packaged
|
||||
in a jar
|
||||
* annotations/generics:
|
||||
o GetPrimitiveArrayCritical: use this if flagged (by annotation? method name?)
|
||||
o per-arg/return type marshalling
|
||||
o avoid casts in loadLibrary
|
||||
o wrap global variables w/type (set/get)
|
||||
o support annotations of parameters and return values w/o breaking
|
||||
1.4 compatibility (retroweaver?), e.g.
|
||||
-- retroweaver (requires retroweaver runtime classes to provide annotation
|
||||
features) not yet worth doing
|
||||
|
||||
void my_function(@MarshalAs(off_t)long arg);
|
||||
|
||||
trading off cruft in the interface def to avoid cruft in the usage:
|
||||
|
||||
my_function(0) versus my_function(new off_t(0))
|
||||
|
||||
this only really applies to NativeLong/IntegerType types that want to use a
|
||||
primitive value instead of creating an object instance.
|
||||
o flag string(/wstring)-returning methods which need to free their result
|
||||
to avoid leaking memory whan auto-creating strings from the result
|
||||
(since normally we don't take explicit ownership of any returned pointers)
|
||||
this is a special case for returned strings only, since other returned
|
||||
pointers are available to the user for later "freeing"
|
||||
Use a map on library creation, an iface for the library, or annotation
|
||||
NOTE: how many methods actually do this? strdup...
|
||||
Maybe make function return "Memory", which can then be converted to a
|
||||
Structure or some other type. Then memory will free itself when no longer
|
||||
referenced. (not really common)
|
||||
|
||||
|
||||
* eliminate type conversion contexts; these are almost entirely unused and
|
||||
more complicated than just wrapping a native mapping in a utility function
|
||||
* direct non-primitive array arguments (String[], Pointer[], NativeMapped[])
|
||||
|
||||
* auto-generate direct mappings/bindings on a per-method basis (perform a
|
||||
method register on first call to an interface-mapped function) with
|
||||
sufficient pre-processing to convert to primitives.
|
||||
|
||||
* dispose memory/callbacks in Native finalizer to ensure they run first
|
||||
(use referencequeue to run them when they become unreachable)
|
||||
@@ -32,59 +67,11 @@
|
||||
and forth multiple times). This also makes it easer to perform conversions
|
||||
(no native changes required).
|
||||
|
||||
* use libffi java raw?
|
||||
|
||||
* direct/raw non-primitive array arguments (String[], Pointer[], NativeMapped[])
|
||||
* ppc64 direct/raw failures (multiple)
|
||||
* direct calls on ppc to varargs (callbacks) with FP args fail; avoid them for
|
||||
now
|
||||
* combine direct and interface mapping calling code where possible
|
||||
* Callback.PostCallWrite.write() cf PostCallRead
|
||||
* GetPrimitiveArrayCritical: use this if flagged (by annotation? method name?)
|
||||
* MethodArgument/ReturnMapper: per method mapping of arguments/return type.
|
||||
Can use annotations as shorthand to initialize a map, but basically set up a
|
||||
per-NativeLibrary (or per-Function?) map of methods to mappers.
|
||||
|
||||
Requires separate compilation of annotation handling.
|
||||
* ditch type conversion context (?)
|
||||
* packaging: 'types', 'convert/marshal' subpackages?
|
||||
note: marshal/unmarshal vs to/fromnative: to/fromnative is more
|
||||
explicit, since marshal/unmarshal doesn't indicate src/dst.
|
||||
o moving conversion contexts to subpackage cleans up top level
|
||||
substantially, but we probably don't want to move things like Structure and
|
||||
Pointer into a types subpackage (which would leave just a few top-level
|
||||
classes). Javadoc is cluttered by example classes anyway.
|
||||
|
||||
* support annotations of parameters and return values w/o breaking
|
||||
1.4 compatibility (retroweaver?), e.g.
|
||||
-- retroweaver (requires retroweaver runtime classes to provide annotation
|
||||
features) not yet worth doing
|
||||
|
||||
void my_function(@MarshalAs(off_t)long arg);
|
||||
|
||||
trading off cruft in the interface def to avoid cruft in the usage:
|
||||
|
||||
my_function(0) versus my_function(new off_t(0))
|
||||
|
||||
this only really applies to NativeLong/IntegerType types that want to use a
|
||||
primitive value instead of creating an object instance.
|
||||
|
||||
* flag string(/wstring)-returning methods which need to free their result
|
||||
to avoid leaking memory whan auto-creating strings from the result
|
||||
(since normally we don't take explicit ownership of any returned pointers)
|
||||
this is a special case for returned strings only, since other returned
|
||||
pointers are available to the user for later "freeing"
|
||||
Use a map on library creation, an iface for the library, or annotation
|
||||
NOTE: how many methods actually do this? strdup...
|
||||
Maybe make function return "Memory", which can then be converted to a
|
||||
Structure or some other type. Then memory will free itself when no longer
|
||||
referenced.
|
||||
* make Pointer free-able (system allocates memory, client frees it); actually,
|
||||
this should probably be automatic so the user doesn't have to think about it.
|
||||
Maybe a custom type representing "function-allocated-pointer" or
|
||||
"pointer-requiring-free" (which is just Memory). For now, leave it up to
|
||||
the user to manage the pointer, since they have to define the free method
|
||||
anyway. use could always put a finalizer on a PointerType-derived type.
|
||||
* universal GCC build w/cross-compile (needs cross compilers...)
|
||||
* return Pointer.SIZE/LONG_SIZE/WCHAR_SIZE in bits (for consistency with 1.5)
|
||||
Long.SIZE, Integer.SIZE, et al.
|
||||
@@ -94,6 +81,32 @@
|
||||
|
||||
|
||||
# DONE
|
||||
* combine direct and interface mapping calling code where possible
|
||||
* DOCS: how to properly use W32API_DEFAULT_OPTIONS (A/W, String/WString)
|
||||
* make native dll extraction from jar public, to use with user dlls packaged
|
||||
in a jar
|
||||
* use consistent cpu references (x86->i386, x86_64->amd64)
|
||||
* osgi for osx
|
||||
* NO: make Pointer free-able (system allocates memory, client frees it); actually,
|
||||
this should probably be automatic so the user doesn't have to think about it.
|
||||
Maybe a custom type representing "function-allocated-pointer" or
|
||||
"pointer-requiring-free" (which is just Memory). For now, leave it up to
|
||||
the user to manage the pointer, since they have to define the free method
|
||||
anyway. use could always put a finalizer on a PointerType-derived type.
|
||||
- user can do this explicitly if needed
|
||||
* NO: use libffi java raw? (deprecated)
|
||||
* NO: MethodArgument/ReturnMapper: per method mapping of arguments/return type.
|
||||
Can use annotations as shorthand to initialize a map, but basically set up a
|
||||
per-NativeLibrary (or per-Function?) map of methods to mappers.
|
||||
|
||||
Requires separate compilation of annotation handling.
|
||||
* NO: packaging: 'types', 'convert/marshal' subpackages?
|
||||
note: marshal/unmarshal vs to/fromnative: to/fromnative is more
|
||||
explicit, since marshal/unmarshal doesn't indicate src/dst.
|
||||
o moving conversion contexts to subpackage cleans up top level
|
||||
substantially, but we probably don't want to move things like Structure and
|
||||
Pointer into a types subpackage (which would leave just a few top-level
|
||||
classes). Javadoc is cluttered by example classes anyway.
|
||||
* cache structure information per-class
|
||||
* fix setFieldOrder to *always* apply if used
|
||||
* Make a separate jar file for all OS-specific headers
|
||||
|
||||
+488
-275
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Arquivo executável → Arquivo normal
@@ -1,73 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.alphamaskdemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.alphamaskdemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-alphamask.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.AlphaMaskDemo" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.alphamaskdemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.alphamaskdemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-alphamask.jar"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.AlphaMaskDemo" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -72,7 +72,7 @@ import com.sun.jna.platform.win32.WinDef.HWND;
|
||||
import com.sun.jna.platform.win32.WinGDI.BITMAPINFO;
|
||||
import com.sun.jna.platform.win32.WinNT.HANDLE;
|
||||
import com.sun.jna.platform.win32.WinUser.BLENDFUNCTION;
|
||||
import com.sun.jna.platform.win32.WinUser.POINT;
|
||||
import com.sun.jna.platform.win32.WinDef.POINT;
|
||||
import com.sun.jna.platform.win32.WinUser.SIZE;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
@@ -154,7 +154,7 @@ public class AlphaMaskDemo implements Runnable {
|
||||
int w = image.getWidth(null);
|
||||
int h = image.getHeight(null);
|
||||
alphaWindow.setSize(w, h);
|
||||
if (buffer == null || buffer.getSize() != w*h*4) {
|
||||
if (buffer == null || buffer.size() != w*h*4) {
|
||||
buffer = new com.sun.jna.Memory(w*h*4);
|
||||
pixels = new int[w*h];
|
||||
}
|
||||
@@ -438,7 +438,7 @@ public class AlphaMaskDemo implements Runnable {
|
||||
if (flavor != null) {
|
||||
Reader reader = flavor.getReaderForText(t);
|
||||
char[] buf = new char[512];
|
||||
StringBuffer b = new StringBuffer();
|
||||
StringBuilder b = new StringBuilder();
|
||||
int count;
|
||||
// excise excess NUL characters (bug in firefox, java
|
||||
// or my code, not sure which). someone got the
|
||||
|
||||
@@ -200,7 +200,7 @@ public class AlphaMaskDemo2 implements Runnable {
|
||||
if (flavor != null) {
|
||||
Reader reader = flavor.getReaderForText(t);
|
||||
char[] buf = new char[512];
|
||||
StringBuffer b = new StringBuffer();
|
||||
StringBuilder b = new StringBuilder();
|
||||
int count;
|
||||
// excise excess NUL characters (bug in firefox,
|
||||
// java
|
||||
|
||||
@@ -1,73 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.balloonmanagerdemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.balloonmanagerdemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-balloonmanager.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.BalloonManagerDemo" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.balloonmanagerdemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.balloonmanagerdemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-balloonmanager.jar"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.BalloonManagerDemo" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
Arquivo executável → Arquivo normal
@@ -1,73 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.balloontipsdemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.balloontipsdemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-balloontips.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.FilteredTextField" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.balloontipsdemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.balloontipsdemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-balloontips.jar"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.FilteredTextField" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,424 +1,424 @@
|
||||
package com.sun.jna.contrib.demo;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.Popup;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.AttributeSet;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.PlainDocument;
|
||||
//TODO: FilteredTextField - Comment this class.
|
||||
/**
|
||||
* The FilteredTextField class is a JTextField that only allows specified
|
||||
* characters to be entered into it. The allowed characters can be added to
|
||||
* the text field, and entry validation is performed as each character is
|
||||
* typed. In addition, complete string validation is tested against a
|
||||
* configurable regular expression when leaving the field. If the string is
|
||||
* invalid the text field is bordered with a red line, and the user is notified
|
||||
* of the error upon returning to the text field. The text field can also be
|
||||
* configured to accept a limited number of characters.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FilteredTextField extends JTextField {
|
||||
public static final Character[] UPPERCASE_CHARS = {'A', 'B', 'C', 'D', 'E',
|
||||
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z'};
|
||||
public static final Character[] LOWERCASE_CHARS = {'a', 'b', 'c', 'd', 'e',
|
||||
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z'};
|
||||
public static final Character[] NUMERIC_CHARS = {'1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9', '0'};
|
||||
|
||||
private static final Integer ENTRY_BALLOON = 0;
|
||||
private static final Integer VALID_BALLOON = 1;
|
||||
private static final Integer LENGTH_BALLOON = 2;
|
||||
private static final Border RED_BORDER =
|
||||
BorderFactory.createLineBorder(Color.RED, 2);
|
||||
|
||||
private ArrayList<Character> allowable = new ArrayList<Character>();
|
||||
private int maximumLength = String.valueOf(Long.MAX_VALUE).length();
|
||||
|
||||
private Border defaultBorder = null;
|
||||
private boolean isValid = true;
|
||||
|
||||
private Popup balloon = null;
|
||||
private String entryError = null;
|
||||
private String validRegex = null;
|
||||
private String validError = null;
|
||||
private Color balloonBorderColor = null;
|
||||
private Color balloonBackgroundColor = null;
|
||||
private Color balloonTextColor = null;
|
||||
private Integer balloonDuration = null;
|
||||
|
||||
private Integer balloonType = null;
|
||||
|
||||
/**
|
||||
* Create a FilteredTextField.
|
||||
*/
|
||||
public FilteredTextField () {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a FilteredTextField.
|
||||
* @param columns the number of columns to use to calculate the preferred
|
||||
* width
|
||||
*/
|
||||
public FilteredTextField (int columns) {
|
||||
super(columns);
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the FilteredTextField.
|
||||
*/
|
||||
private void init () {
|
||||
defaultBorder = getBorder();
|
||||
entryError = "";
|
||||
validRegex = "";
|
||||
validError = "";
|
||||
balloonBorderColor = BalloonTipManager.DEFAULT_BORDER_COLOR;
|
||||
balloonBackgroundColor = BalloonTipManager.DEFAULT_BACKGROUND_COLOR;
|
||||
balloonTextColor = BalloonTipManager.DEFAULT_TEXT_COLOR;
|
||||
balloonDuration = 10000;
|
||||
balloonType = ENTRY_BALLOON;
|
||||
addFocusListener(new ValidationEar());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the allowable character used for entry validation.
|
||||
* @param characters the allowable characters
|
||||
*/
|
||||
public void setCharacters (Character[] characters) {
|
||||
clearCharacters();
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
addCharacter(characters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the character array to the list used for entry validation.
|
||||
* @param characters the character array
|
||||
*/
|
||||
public void addCharacters (Character[] characters) {
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
addCharacter(characters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the character to the list used for entry validation.
|
||||
* @param characters the character
|
||||
*/
|
||||
public void addCharacter (Character character) {
|
||||
if (!allowable.contains(character)) {
|
||||
allowable.add(character);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the list of allowable characters for entry validation.
|
||||
*/
|
||||
public void clearCharacters () {
|
||||
allowable.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the character array from the list used for entry validation.
|
||||
* @param characters the character array
|
||||
*/
|
||||
public void removeCharacters (Character[] characters) {
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
removeCharacter(characters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the character from the list used for entry validation.
|
||||
* @param character the character
|
||||
*/
|
||||
public void removeCharacter (Character character) {
|
||||
if (allowable.contains(character)) {
|
||||
allowable.remove(character);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters for the length of the entry string.
|
||||
* @param maximumLength the number of characters
|
||||
*/
|
||||
public void setMaximumLength (int maximumLength) {
|
||||
this.maximumLength = maximumLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that is displayed when there is an entry error.
|
||||
* @param entryError the entry error message
|
||||
*/
|
||||
public void setEntryError (String entryError) {
|
||||
this.entryError = entryError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the regular expression that is used for string validation. String
|
||||
* validation is checked when exiting the text field.
|
||||
* @param validRegex the validation regular expression
|
||||
*/
|
||||
public void setValidRegex (String validRegex) {
|
||||
this.validRegex = validRegex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that is displayed when there is a validation error.
|
||||
* @param validError the validation error message
|
||||
*/
|
||||
public void setValidError (String validError) {
|
||||
this.validError = validError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color to use for the balloon border.
|
||||
* @param borderColor the balloon border color
|
||||
*/
|
||||
public void setBalloonBorderColor (Color borderColor) {
|
||||
balloonBorderColor = borderColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color to use for the balloon background.
|
||||
* @param backgroundColor the balloon background color
|
||||
*/
|
||||
public void setBalloonBackgroundColor (Color backgroundColor) {
|
||||
balloonBackgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color to use for the balloon text.
|
||||
* @param textColor the balloon text color
|
||||
*/
|
||||
public void setBalloonTextColor (Color textColor) {
|
||||
balloonTextColor = textColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time in milliseconds that the balloon is visible before
|
||||
* disappearing. This is the maximum time that the balloon will be visible,
|
||||
* as other events can also make the balloon disappear.
|
||||
* @param duration the time in milliseconds
|
||||
*/
|
||||
public void setBalloonDuration (Integer duration) {
|
||||
balloonDuration = duration;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.JTextField#createDefaultModel()
|
||||
*/
|
||||
protected Document createDefaultModel () {
|
||||
return new FilteredTextFieldDocument();
|
||||
}
|
||||
|
||||
/*
|
||||
* This class defines the document used for the FilteredTextField.
|
||||
*/
|
||||
private class FilteredTextFieldDocument extends PlainDocument {
|
||||
/*
|
||||
* Create a FilteredTextFieldDocument.
|
||||
*/
|
||||
public FilteredTextFieldDocument () {
|
||||
addDocumentListener(new FilteredTextFieldEar());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.text.PlainDocument#insertString(
|
||||
* int, java.lang.String, javax.swing.text.AttributeSet)
|
||||
*/
|
||||
public void insertString (int offset, String str, AttributeSet a)
|
||||
throws BadLocationException
|
||||
{
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
if (balloonType == VALID_BALLOON) {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
StringBuffer buffer =
|
||||
new StringBuffer(FilteredTextField.this.getText());
|
||||
if (offset >= 0 && offset <= buffer.length()) {
|
||||
buffer.insert(offset, str);
|
||||
String strBuf = buffer.toString();
|
||||
|
||||
if (buffer.length() > maximumLength) {
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
if (balloonType == LENGTH_BALLOON) {
|
||||
BalloonTipManager.restartTimer();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||
"The number of characters must be less than or equal to " +
|
||||
maximumLength, 0, 0, balloonDuration, balloonBorderColor,
|
||||
balloonBackgroundColor, balloonTextColor);
|
||||
balloon.show();
|
||||
balloonType = LENGTH_BALLOON;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strBuf == null || strBuf.equals("")) {
|
||||
remove(0, getLength());
|
||||
super.insertString(0, "", null);
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
balloon.hide();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (allowable.contains(str.charAt(0))) {
|
||||
super.insertString(offset, str, a);
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
if (balloonType == ENTRY_BALLOON) {
|
||||
BalloonTipManager.restartTimer();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||
entryError, 0, 0, balloonDuration, balloonBorderColor,
|
||||
balloonBackgroundColor, balloonTextColor);
|
||||
balloon.show();
|
||||
balloonType = ENTRY_BALLOON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This listener class is needed to catch character removal events.
|
||||
*/
|
||||
private class FilteredTextFieldEar implements DocumentListener {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.event.DocumentListener#insertUpdate(
|
||||
* javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void insertUpdate (DocumentEvent e) {/* N/A */}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.event.DocumentListener#removeUpdate(
|
||||
* javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void removeUpdate (DocumentEvent e) {
|
||||
if (balloon != null && BalloonTipManager.isShowing())
|
||||
{
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.event.DocumentListener#changedUpdate(
|
||||
* javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void changedUpdate (DocumentEvent e) {/* N/A */}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This listener class is used to determine whether the string is valid based
|
||||
* on a regular expression. The validation is tested when leaving the text
|
||||
* field, and notification is performed when returning to the text field.
|
||||
*/
|
||||
private class ValidationEar extends FocusAdapter {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.awt.event.FocusAdapter#focusLost(java.awt.event.FocusEvent)
|
||||
*/
|
||||
public void focusLost (FocusEvent e) {
|
||||
String entered = getText().trim();
|
||||
if (!entered.matches(validRegex)) {
|
||||
if (balloon != null) {
|
||||
balloon.hide();
|
||||
}
|
||||
setBorder(
|
||||
BorderFactory.createCompoundBorder(RED_BORDER, defaultBorder));
|
||||
isValid = false;
|
||||
}
|
||||
else {
|
||||
setBorder(defaultBorder);
|
||||
isValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.awt.event.FocusAdapter#focusGained(java.awt.event.FocusEvent)
|
||||
*/
|
||||
public void focusGained (FocusEvent e) {
|
||||
if (!isValid) {
|
||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||
validError, 0, 0, balloonDuration, balloonBorderColor,
|
||||
balloonBackgroundColor, balloonTextColor);
|
||||
balloon.show();
|
||||
balloonType = VALID_BALLOON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A main entry point to test the FilteredTextField.
|
||||
* @param args application arguments
|
||||
*/
|
||||
public static void main (String[] args) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JFrame jframe = new JFrame("Balloon Tips on FilteredTextField");
|
||||
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
jframe.setSize(400, 75);
|
||||
jframe.setLocation(400, 400);
|
||||
JPanel jpanel = new JPanel();
|
||||
jpanel.setLayout(new BorderLayout());
|
||||
FilteredTextField ftfield = new FilteredTextField(10);
|
||||
ftfield.setCharacters(LOWERCASE_CHARS);
|
||||
ftfield.addCharacter('-');
|
||||
ftfield.addCharacter('_');
|
||||
ftfield.addCharacter(' ');
|
||||
ftfield.setMaximumLength(10);
|
||||
ftfield.setEntryError(
|
||||
"Only lower case letters, hyphens, underscores, and spaces allowed.");
|
||||
ftfield.setValidRegex("^a+[a-z-_ ]*");
|
||||
ftfield.setValidError("The string must begin with the letter 'a'.");
|
||||
jpanel.add(new JLabel("Type some text into either field"), BorderLayout.NORTH);
|
||||
jpanel.add(ftfield, BorderLayout.CENTER);
|
||||
jpanel.add(new FilteredTextField(10), BorderLayout.SOUTH);
|
||||
jframe.getContentPane().add(jpanel);
|
||||
jframe.setVisible(true);
|
||||
}
|
||||
}
|
||||
package com.sun.jna.contrib.demo;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.Popup;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.AttributeSet;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.PlainDocument;
|
||||
//TODO: FilteredTextField - Comment this class.
|
||||
/**
|
||||
* The FilteredTextField class is a JTextField that only allows specified
|
||||
* characters to be entered into it. The allowed characters can be added to
|
||||
* the text field, and entry validation is performed as each character is
|
||||
* typed. In addition, complete string validation is tested against a
|
||||
* configurable regular expression when leaving the field. If the string is
|
||||
* invalid the text field is bordered with a red line, and the user is notified
|
||||
* of the error upon returning to the text field. The text field can also be
|
||||
* configured to accept a limited number of characters.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FilteredTextField extends JTextField {
|
||||
public static final Character[] UPPERCASE_CHARS = {'A', 'B', 'C', 'D', 'E',
|
||||
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z'};
|
||||
public static final Character[] LOWERCASE_CHARS = {'a', 'b', 'c', 'd', 'e',
|
||||
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z'};
|
||||
public static final Character[] NUMERIC_CHARS = {'1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9', '0'};
|
||||
|
||||
private static final Integer ENTRY_BALLOON = 0;
|
||||
private static final Integer VALID_BALLOON = 1;
|
||||
private static final Integer LENGTH_BALLOON = 2;
|
||||
private static final Border RED_BORDER =
|
||||
BorderFactory.createLineBorder(Color.RED, 2);
|
||||
|
||||
private ArrayList<Character> allowable = new ArrayList<Character>();
|
||||
private int maximumLength = String.valueOf(Long.MAX_VALUE).length();
|
||||
|
||||
private Border defaultBorder = null;
|
||||
private boolean isValid = true;
|
||||
|
||||
private Popup balloon = null;
|
||||
private String entryError = null;
|
||||
private String validRegex = null;
|
||||
private String validError = null;
|
||||
private Color balloonBorderColor = null;
|
||||
private Color balloonBackgroundColor = null;
|
||||
private Color balloonTextColor = null;
|
||||
private Integer balloonDuration = null;
|
||||
|
||||
private Integer balloonType = null;
|
||||
|
||||
/**
|
||||
* Create a FilteredTextField.
|
||||
*/
|
||||
public FilteredTextField () {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a FilteredTextField.
|
||||
* @param columns the number of columns to use to calculate the preferred
|
||||
* width
|
||||
*/
|
||||
public FilteredTextField (int columns) {
|
||||
super(columns);
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the FilteredTextField.
|
||||
*/
|
||||
private void init () {
|
||||
defaultBorder = getBorder();
|
||||
entryError = "";
|
||||
validRegex = "";
|
||||
validError = "";
|
||||
balloonBorderColor = BalloonTipManager.DEFAULT_BORDER_COLOR;
|
||||
balloonBackgroundColor = BalloonTipManager.DEFAULT_BACKGROUND_COLOR;
|
||||
balloonTextColor = BalloonTipManager.DEFAULT_TEXT_COLOR;
|
||||
balloonDuration = 10000;
|
||||
balloonType = ENTRY_BALLOON;
|
||||
addFocusListener(new ValidationEar());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the allowable character used for entry validation.
|
||||
* @param characters the allowable characters
|
||||
*/
|
||||
public void setCharacters (Character[] characters) {
|
||||
clearCharacters();
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
addCharacter(characters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the character array to the list used for entry validation.
|
||||
* @param characters the character array
|
||||
*/
|
||||
public void addCharacters (Character[] characters) {
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
addCharacter(characters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the character to the list used for entry validation.
|
||||
* @param characters the character
|
||||
*/
|
||||
public void addCharacter (Character character) {
|
||||
if (!allowable.contains(character)) {
|
||||
allowable.add(character);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the list of allowable characters for entry validation.
|
||||
*/
|
||||
public void clearCharacters () {
|
||||
allowable.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the character array from the list used for entry validation.
|
||||
* @param characters the character array
|
||||
*/
|
||||
public void removeCharacters (Character[] characters) {
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
removeCharacter(characters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the character from the list used for entry validation.
|
||||
* @param character the character
|
||||
*/
|
||||
public void removeCharacter (Character character) {
|
||||
if (allowable.contains(character)) {
|
||||
allowable.remove(character);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters for the length of the entry string.
|
||||
* @param maximumLength the number of characters
|
||||
*/
|
||||
public void setMaximumLength (int maximumLength) {
|
||||
this.maximumLength = maximumLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that is displayed when there is an entry error.
|
||||
* @param entryError the entry error message
|
||||
*/
|
||||
public void setEntryError (String entryError) {
|
||||
this.entryError = entryError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the regular expression that is used for string validation. String
|
||||
* validation is checked when exiting the text field.
|
||||
* @param validRegex the validation regular expression
|
||||
*/
|
||||
public void setValidRegex (String validRegex) {
|
||||
this.validRegex = validRegex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that is displayed when there is a validation error.
|
||||
* @param validError the validation error message
|
||||
*/
|
||||
public void setValidError (String validError) {
|
||||
this.validError = validError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color to use for the balloon border.
|
||||
* @param borderColor the balloon border color
|
||||
*/
|
||||
public void setBalloonBorderColor (Color borderColor) {
|
||||
balloonBorderColor = borderColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color to use for the balloon background.
|
||||
* @param backgroundColor the balloon background color
|
||||
*/
|
||||
public void setBalloonBackgroundColor (Color backgroundColor) {
|
||||
balloonBackgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color to use for the balloon text.
|
||||
* @param textColor the balloon text color
|
||||
*/
|
||||
public void setBalloonTextColor (Color textColor) {
|
||||
balloonTextColor = textColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time in milliseconds that the balloon is visible before
|
||||
* disappearing. This is the maximum time that the balloon will be visible,
|
||||
* as other events can also make the balloon disappear.
|
||||
* @param duration the time in milliseconds
|
||||
*/
|
||||
public void setBalloonDuration (Integer duration) {
|
||||
balloonDuration = duration;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.JTextField#createDefaultModel()
|
||||
*/
|
||||
protected Document createDefaultModel () {
|
||||
return new FilteredTextFieldDocument();
|
||||
}
|
||||
|
||||
/*
|
||||
* This class defines the document used for the FilteredTextField.
|
||||
*/
|
||||
private class FilteredTextFieldDocument extends PlainDocument {
|
||||
/*
|
||||
* Create a FilteredTextFieldDocument.
|
||||
*/
|
||||
public FilteredTextFieldDocument () {
|
||||
addDocumentListener(new FilteredTextFieldEar());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.text.PlainDocument#insertString(
|
||||
* int, java.lang.String, javax.swing.text.AttributeSet)
|
||||
*/
|
||||
public void insertString (int offset, String str, AttributeSet a)
|
||||
throws BadLocationException
|
||||
{
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
if (balloonType == VALID_BALLOON) {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
StringBuilder buffer =
|
||||
new StringBuilder(FilteredTextField.this.getText());
|
||||
if (offset >= 0 && offset <= buffer.length()) {
|
||||
buffer.insert(offset, str);
|
||||
String strBuf = buffer.toString();
|
||||
|
||||
if (buffer.length() > maximumLength) {
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
if (balloonType == LENGTH_BALLOON) {
|
||||
BalloonTipManager.restartTimer();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||
"The number of characters must be less than or equal to " +
|
||||
maximumLength, 0, 0, balloonDuration, balloonBorderColor,
|
||||
balloonBackgroundColor, balloonTextColor);
|
||||
balloon.show();
|
||||
balloonType = LENGTH_BALLOON;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strBuf == null || strBuf.equals("")) {
|
||||
remove(0, getLength());
|
||||
super.insertString(0, "", null);
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
balloon.hide();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (allowable.contains(str.charAt(0))) {
|
||||
super.insertString(offset, str, a);
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||
if (balloonType == ENTRY_BALLOON) {
|
||||
BalloonTipManager.restartTimer();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||
entryError, 0, 0, balloonDuration, balloonBorderColor,
|
||||
balloonBackgroundColor, balloonTextColor);
|
||||
balloon.show();
|
||||
balloonType = ENTRY_BALLOON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This listener class is needed to catch character removal events.
|
||||
*/
|
||||
private class FilteredTextFieldEar implements DocumentListener {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.event.DocumentListener#insertUpdate(
|
||||
* javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void insertUpdate (DocumentEvent e) {/* N/A */}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.event.DocumentListener#removeUpdate(
|
||||
* javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void removeUpdate (DocumentEvent e) {
|
||||
if (balloon != null && BalloonTipManager.isShowing())
|
||||
{
|
||||
balloon.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see javax.swing.event.DocumentListener#changedUpdate(
|
||||
* javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void changedUpdate (DocumentEvent e) {/* N/A */}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This listener class is used to determine whether the string is valid based
|
||||
* on a regular expression. The validation is tested when leaving the text
|
||||
* field, and notification is performed when returning to the text field.
|
||||
*/
|
||||
private class ValidationEar extends FocusAdapter {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.awt.event.FocusAdapter#focusLost(java.awt.event.FocusEvent)
|
||||
*/
|
||||
public void focusLost (FocusEvent e) {
|
||||
String entered = getText().trim();
|
||||
if (!entered.matches(validRegex)) {
|
||||
if (balloon != null) {
|
||||
balloon.hide();
|
||||
}
|
||||
setBorder(
|
||||
BorderFactory.createCompoundBorder(RED_BORDER, defaultBorder));
|
||||
isValid = false;
|
||||
}
|
||||
else {
|
||||
setBorder(defaultBorder);
|
||||
isValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.awt.event.FocusAdapter#focusGained(java.awt.event.FocusEvent)
|
||||
*/
|
||||
public void focusGained (FocusEvent e) {
|
||||
if (!isValid) {
|
||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||
validError, 0, 0, balloonDuration, balloonBorderColor,
|
||||
balloonBackgroundColor, balloonTextColor);
|
||||
balloon.show();
|
||||
balloonType = VALID_BALLOON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A main entry point to test the FilteredTextField.
|
||||
* @param args application arguments
|
||||
*/
|
||||
public static void main (String[] args) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JFrame jframe = new JFrame("Balloon Tips on FilteredTextField");
|
||||
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
jframe.setSize(400, 75);
|
||||
jframe.setLocation(400, 400);
|
||||
JPanel jpanel = new JPanel();
|
||||
jpanel.setLayout(new BorderLayout());
|
||||
FilteredTextField ftfield = new FilteredTextField(10);
|
||||
ftfield.setCharacters(LOWERCASE_CHARS);
|
||||
ftfield.addCharacter('-');
|
||||
ftfield.addCharacter('_');
|
||||
ftfield.addCharacter(' ');
|
||||
ftfield.setMaximumLength(10);
|
||||
ftfield.setEntryError(
|
||||
"Only lower case letters, hyphens, underscores, and spaces allowed.");
|
||||
ftfield.setValidRegex("^a+[a-z-_ ]*");
|
||||
ftfield.setValidError("The string must begin with the letter 'a'.");
|
||||
jpanel.add(new JLabel("Type some text into either field"), BorderLayout.NORTH);
|
||||
jpanel.add(ftfield, BorderLayout.CENTER);
|
||||
jpanel.add(new FilteredTextField(10), BorderLayout.SOUTH);
|
||||
jframe.getContentPane().add(jpanel);
|
||||
jframe.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
+68
-73
@@ -1,73 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.dnddemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.dnddemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-dnd.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.GhostedDragImageDemo" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.dnddemo" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.dnddemo.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-dnd.jar"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.GhostedDragImageDemo" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- Run Demo. -->
|
||||
<target name="run" depends="compile">
|
||||
<java classname="${main-class}" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${classes}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${classes}"/>
|
||||
<delete file="${jar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright 2014 Martin Steiger
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.jna.contrib.demo;
|
||||
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.platform.EnumUtils;
|
||||
import com.sun.jna.platform.win32.Dxva2;
|
||||
import com.sun.jna.platform.win32.HighLevelMonitorConfigurationAPI;
|
||||
import com.sun.jna.platform.win32.HighLevelMonitorConfigurationAPI.MC_COLOR_TEMPERATURE;
|
||||
import com.sun.jna.platform.win32.HighLevelMonitorConfigurationAPI.MC_DISPLAY_TECHNOLOGY_TYPE;
|
||||
import com.sun.jna.platform.win32.HighLevelMonitorConfigurationAPI.MC_DRIVE_TYPE;
|
||||
import com.sun.jna.platform.win32.HighLevelMonitorConfigurationAPI.MC_GAIN_TYPE;
|
||||
import com.sun.jna.platform.win32.HighLevelMonitorConfigurationAPI.MC_POSITION_TYPE;
|
||||
import com.sun.jna.platform.win32.HighLevelMonitorConfigurationAPI.MC_SIZE_TYPE;
|
||||
import com.sun.jna.platform.win32.LowLevelMonitorConfigurationAPI.MC_TIMING_REPORT;
|
||||
import com.sun.jna.platform.win32.PhysicalMonitorEnumerationAPI.PHYSICAL_MONITOR;
|
||||
import com.sun.jna.platform.win32.User32;
|
||||
import com.sun.jna.platform.win32.WTypes.LPSTR;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORD;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.HDC;
|
||||
import com.sun.jna.platform.win32.WinDef.LPARAM;
|
||||
import com.sun.jna.platform.win32.WinDef.RECT;
|
||||
import com.sun.jna.platform.win32.WinNT.HANDLE;
|
||||
import com.sun.jna.platform.win32.WinUser;
|
||||
import com.sun.jna.platform.win32.WinUser.HMONITOR;
|
||||
import com.sun.jna.platform.win32.WinUser.MONITORENUMPROC;
|
||||
import com.sun.jna.platform.win32.WinUser.MONITORINFOEX;
|
||||
|
||||
/**
|
||||
* A small demo that tests the Win32 monitor API.
|
||||
* All available physical and virtual monitors are enumerated and
|
||||
* their capabilities printed to stdout
|
||||
* @author Martin Steiger
|
||||
*/
|
||||
public class MonitorInfoDemo
|
||||
{
|
||||
/**
|
||||
* @param args (ignored)
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println("Installed Physical Monitors: " + User32.INSTANCE.GetSystemMetrics(WinUser.SM_CMONITORS));
|
||||
|
||||
User32.INSTANCE.EnumDisplayMonitors(null, null, new MONITORENUMPROC() {
|
||||
|
||||
@Override
|
||||
public int apply(HMONITOR hMonitor, HDC hdc, RECT rect, LPARAM lparam)
|
||||
{
|
||||
enumerate(hMonitor);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}, new LPARAM(0));
|
||||
}
|
||||
|
||||
static void enumerate(HMONITOR hMonitor)
|
||||
{
|
||||
System.out.println("Found HMONITOR: " + hMonitor.getPointer().toString());
|
||||
|
||||
MONITORINFOEX info = new MONITORINFOEX();
|
||||
User32.INSTANCE.GetMonitorInfo(hMonitor, info);
|
||||
System.out.println("Screen " + info.rcMonitor);
|
||||
System.out.println("Work area " + info.rcWork);
|
||||
boolean isPrimary = (info.dwFlags & WinUser.MONITORINFOF_PRIMARY) != 0;
|
||||
System.out.println("Primary? " + (isPrimary ? "yes" : "no"));
|
||||
System.out.println("Device " + new String(info.szDevice));
|
||||
|
||||
DWORDByReference pdwNumberOfPhysicalMonitors = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, pdwNumberOfPhysicalMonitors);
|
||||
int monitorCount = pdwNumberOfPhysicalMonitors.getValue().intValue();
|
||||
|
||||
System.out.println("HMONITOR is linked to " + monitorCount + " physical monitors");
|
||||
|
||||
PHYSICAL_MONITOR[] physMons = new PHYSICAL_MONITOR[monitorCount];
|
||||
Dxva2.INSTANCE.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, physMons);
|
||||
|
||||
for (int i = 0; i < monitorCount; i++)
|
||||
{
|
||||
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
|
||||
System.out.println("Monitor " + i + " - " + new String(physMons[i].szPhysicalMonitorDescription));
|
||||
|
||||
enumeratePhysicalMonitor(hPhysicalMonitor);
|
||||
}
|
||||
|
||||
Dxva2.INSTANCE.DestroyPhysicalMonitors(monitorCount, physMons);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hPhysicalMonitor
|
||||
*/
|
||||
private static void enumeratePhysicalMonitor(HANDLE hPhysicalMonitor)
|
||||
{
|
||||
MC_DISPLAY_TECHNOLOGY_TYPE.ByReference techType = new MC_DISPLAY_TECHNOLOGY_TYPE.ByReference();
|
||||
Dxva2.INSTANCE.GetMonitorTechnologyType(hPhysicalMonitor, techType);
|
||||
System.out.println("TECHTYPE: " + techType.getValue());
|
||||
|
||||
DWORDByReference temps = new DWORDByReference();
|
||||
DWORDByReference caps = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetMonitorCapabilities(hPhysicalMonitor, caps, temps);
|
||||
System.out.println("CAPS " + EnumUtils.setFromInteger(caps.getValue().intValue(), HighLevelMonitorConfigurationAPI.MC_CAPS.class));
|
||||
System.out.println("Temps " + temps.getValue());
|
||||
|
||||
// Brightness
|
||||
DWORDByReference pdwMinimumBrightness = new DWORDByReference();
|
||||
DWORDByReference pdwCurrentBrightness = new DWORDByReference();
|
||||
DWORDByReference pdwMaximumBrightness = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetMonitorBrightness(hPhysicalMonitor, pdwMinimumBrightness, pdwCurrentBrightness, pdwMaximumBrightness);
|
||||
|
||||
System.out.println("Brightness Min: " + pdwMinimumBrightness.getValue());
|
||||
System.out.println("Brightness Current: " + pdwCurrentBrightness.getValue());
|
||||
System.out.println("Brightness Max: " + pdwMaximumBrightness.getValue());
|
||||
|
||||
// Contrast
|
||||
DWORDByReference pdwMinimumContrast = new DWORDByReference();
|
||||
DWORDByReference pdwCurrentContrast = new DWORDByReference();
|
||||
DWORDByReference pdwMaximumContrast = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetMonitorContrast(hPhysicalMonitor, pdwMinimumContrast, pdwCurrentContrast, pdwMaximumContrast);
|
||||
|
||||
System.out.println("Contrast Min: " + pdwMinimumContrast.getValue());
|
||||
System.out.println("Contrast Current: " + pdwCurrentContrast.getValue());
|
||||
System.out.println("Contrast Max: " + pdwMaximumContrast.getValue());
|
||||
|
||||
// Temperature
|
||||
MC_COLOR_TEMPERATURE.ByReference pctCurrentColorTemperature = new MC_COLOR_TEMPERATURE.ByReference();
|
||||
Dxva2.INSTANCE.GetMonitorColorTemperature(hPhysicalMonitor, pctCurrentColorTemperature);
|
||||
System.out.println("Current Temp: " + pctCurrentColorTemperature.getValue());
|
||||
|
||||
// Capabilities string
|
||||
DWORDByReference pdwCapabilitiesStringLengthInCharacters = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetCapabilitiesStringLength(hPhysicalMonitor, pdwCapabilitiesStringLengthInCharacters);
|
||||
DWORD capStrLen = pdwCapabilitiesStringLengthInCharacters.getValue();
|
||||
|
||||
LPSTR pszASCIICapabilitiesString = new LPSTR(new Memory(capStrLen.intValue()));
|
||||
Dxva2.INSTANCE.CapabilitiesRequestAndCapabilitiesReply(hPhysicalMonitor, pszASCIICapabilitiesString, capStrLen);
|
||||
System.out.println("Cap-String:" + new String(pszASCIICapabilitiesString.getPointer().getString(0)));
|
||||
|
||||
// Position
|
||||
MC_POSITION_TYPE ptPositionType = MC_POSITION_TYPE.MC_HORIZONTAL_POSITION;
|
||||
DWORDByReference pdwMinimumPosition = new DWORDByReference();
|
||||
DWORDByReference pdwCurrentPosition = new DWORDByReference();
|
||||
DWORDByReference pdwMaximumPosition = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetMonitorDisplayAreaPosition(hPhysicalMonitor, ptPositionType, pdwMinimumPosition, pdwCurrentPosition, pdwMaximumPosition);
|
||||
|
||||
System.out.println("Position (horz) Min: " + pdwMinimumPosition.getValue());
|
||||
System.out.println("Position (horz) Current: " + pdwCurrentPosition.getValue());
|
||||
System.out.println("Position (horz) Max: " + pdwMaximumPosition.getValue());
|
||||
|
||||
// Size
|
||||
MC_SIZE_TYPE ptSizeType = MC_SIZE_TYPE.MC_WIDTH;
|
||||
DWORDByReference pdwMinimumSize = new DWORDByReference();
|
||||
DWORDByReference pdwCurrentSize = new DWORDByReference();
|
||||
DWORDByReference pdwMaximumSize = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetMonitorDisplayAreaSize(hPhysicalMonitor, ptSizeType, pdwMinimumSize, pdwCurrentSize, pdwMaximumSize);
|
||||
|
||||
System.out.println("Width Min: " + pdwMinimumSize.getValue());
|
||||
System.out.println("Width Current: " + pdwCurrentSize.getValue());
|
||||
System.out.println("Width Max: " + pdwMaximumSize.getValue());
|
||||
|
||||
// Gain
|
||||
MC_GAIN_TYPE ptGainType = MC_GAIN_TYPE.MC_RED_GAIN;
|
||||
DWORDByReference pdwMinimumGain = new DWORDByReference();
|
||||
DWORDByReference pdwCurrentGain = new DWORDByReference();
|
||||
DWORDByReference pdwMaximumGain = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetMonitorRedGreenOrBlueGain(hPhysicalMonitor, ptGainType, pdwMinimumGain, pdwCurrentGain, pdwMaximumGain);
|
||||
|
||||
System.out.println("Red Gain Min: " + pdwMinimumSize.getValue());
|
||||
System.out.println("Red Gain Current: " + pdwCurrentSize.getValue());
|
||||
System.out.println("Red Gain Max: " + pdwMaximumSize.getValue());
|
||||
|
||||
// Drive
|
||||
MC_DRIVE_TYPE ptDriveType = MC_DRIVE_TYPE.MC_RED_DRIVE;
|
||||
DWORDByReference pdwMinimumDrive = new DWORDByReference();
|
||||
DWORDByReference pdwCurrentDrive = new DWORDByReference();
|
||||
DWORDByReference pdwMaximumDrive = new DWORDByReference();
|
||||
Dxva2.INSTANCE.GetMonitorRedGreenOrBlueDrive(hPhysicalMonitor, ptDriveType, pdwMinimumDrive, pdwCurrentDrive, pdwMaximumDrive);
|
||||
|
||||
System.out.println("Red Drive Min: " + pdwMinimumSize.getValue());
|
||||
System.out.println("Red Drive Current: " + pdwCurrentSize.getValue());
|
||||
System.out.println("Red Drive Max: " + pdwMaximumSize.getValue());
|
||||
|
||||
// Timing Report
|
||||
MC_TIMING_REPORT pmtrMonitorTimingReport = new MC_TIMING_REPORT();
|
||||
Dxva2.INSTANCE.GetTimingReport(hPhysicalMonitor, pmtrMonitorTimingReport);
|
||||
System.out.println("HorizontalFrequencyInHZ " + pmtrMonitorTimingReport.dwHorizontalFrequencyInHZ);
|
||||
System.out.println("VerticalFrequencyInHZ " + pmtrMonitorTimingReport.dwVerticalFrequencyInHZ);
|
||||
|
||||
System.out.println("--------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
|
||||
<classpathentry kind="var" path="JNA_LIB"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>msoffice</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
Arquivo binário não exibido.
Arquivo binário não exibido.
@@ -0,0 +1,43 @@
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.sun.jna.platform.win32.COM.COMUtils;
|
||||
import com.sun.jna.platform.win32.COM.COMUtils.COMInfo;
|
||||
|
||||
public class COMInfoUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
String filename = "C:\\TEMP\\CLSIDs.txt";
|
||||
ArrayList<COMInfo> comInfos = COMUtils.getAllCOMInfoOnSystem();
|
||||
writer = new FileWriter(filename);
|
||||
|
||||
for (COMInfo comInfo : comInfos) {
|
||||
String result = "CLSID: " + comInfo.clsid + "\n";
|
||||
result += "InprocHandler32: " + comInfo.inprocHandler32 + "\n";
|
||||
result += "InprocServer32: " + comInfo.inprocServer32 + "\n";
|
||||
result += "LocalServer32: " + comInfo.localServer32 + "\n";
|
||||
result += "ProgID: " + comInfo.progID + "\n";
|
||||
result += "ProgTypeLibID: " + comInfo.typeLib + "\n";
|
||||
|
||||
writer.write(result + "\n");
|
||||
}
|
||||
|
||||
System.out.println("file written to: " + filename);
|
||||
System.out.println("Found CLSID`s on the system: "
|
||||
+ comInfos.size());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.sun.jna.platform.win32.COM.office;
|
||||
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.COM.COMException;
|
||||
import com.sun.jna.platform.win32.COM.COMLateBindingObject;
|
||||
import com.sun.jna.platform.win32.COM.IDispatch;
|
||||
|
||||
public class MSExcel extends COMLateBindingObject {
|
||||
|
||||
public MSExcel() throws COMException {
|
||||
super("Excel.Application", false);
|
||||
}
|
||||
|
||||
public MSExcel(boolean visible) throws COMException {
|
||||
this();
|
||||
this.setVisible(visible);
|
||||
}
|
||||
|
||||
public void setVisible(boolean bVisible) throws COMException {
|
||||
this.setProperty("Visible", bVisible);
|
||||
}
|
||||
|
||||
public String getVersion() throws COMException {
|
||||
return this.getStringProperty("Version");
|
||||
}
|
||||
|
||||
public void newExcelBook() throws COMException {
|
||||
this.invokeNoReply("Add", getWorkbooks());
|
||||
}
|
||||
|
||||
public void openExcelBook(String filename, boolean bVisible)
|
||||
throws COMException {
|
||||
// OpenDocument
|
||||
this.invokeNoReply("Open", getWorkbooks(), new VARIANT(filename));
|
||||
}
|
||||
|
||||
public void closeActiveWorkbook(boolean bSave) throws COMException {
|
||||
this.invokeNoReply("Close", getActiveWorkbook(), new VARIANT(bSave));
|
||||
}
|
||||
|
||||
public void quit() throws COMException {
|
||||
this.invokeNoReply("Quit");
|
||||
}
|
||||
|
||||
public void insertValue(String range, String value) throws COMException {
|
||||
Range pRange = new Range(this.getAutomationProperty("Range",
|
||||
this.getActiveSheet(), new VARIANT(range)));
|
||||
this.setProperty("Value", pRange, new VARIANT(value));
|
||||
}
|
||||
|
||||
public Application getApplication() {
|
||||
return new Application(this.getAutomationProperty("Application"));
|
||||
}
|
||||
|
||||
public ActiveWorkbook getActiveWorkbook() {
|
||||
return new ActiveWorkbook(this.getAutomationProperty("ActiveWorkbook"));
|
||||
}
|
||||
|
||||
public Workbooks getWorkbooks() {
|
||||
return new Workbooks(this.getAutomationProperty("WorkBooks"));
|
||||
}
|
||||
|
||||
public ActiveSheet getActiveSheet() {
|
||||
return new ActiveSheet(this.getAutomationProperty("ActiveSheet"));
|
||||
}
|
||||
|
||||
public class Application extends COMLateBindingObject {
|
||||
|
||||
public Application(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
public class Workbooks extends COMLateBindingObject {
|
||||
public Workbooks(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
public class ActiveWorkbook extends COMLateBindingObject {
|
||||
public ActiveWorkbook(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
public class ActiveSheet extends COMLateBindingObject {
|
||||
public ActiveSheet(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
public class Range extends COMLateBindingObject {
|
||||
public Range(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.sun.jna.platform.win32.COM.office;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.sun.jna.platform.win32.COM.COMException;
|
||||
import com.sun.jna.platform.win32.WinDef.LONG;
|
||||
|
||||
public class MSOfficeDemo {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new MSOfficeDemo();
|
||||
}
|
||||
|
||||
private String currentWorkingDir = new File("").getAbsolutePath()
|
||||
+ File.separator;
|
||||
|
||||
public MSOfficeDemo() {
|
||||
this.testMSWord();
|
||||
// this.testMSExcel();
|
||||
}
|
||||
|
||||
public void testMSWord() {
|
||||
MSWord msWord = null;
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/office/ff839952(v=office.15).aspx
|
||||
LONG wdFormatPDF = new LONG(17); // PDF format.
|
||||
LONG wdFormatRTF = new LONG(6); // Rich text format (RTF).
|
||||
LONG wdFormatHTML = new LONG(8); // Standard HTML format.
|
||||
LONG wdFormatDocument = new LONG(0); // Microsoft Office Word 97 - 2003 binary file format.
|
||||
LONG wdFormatDocumentDefault = new LONG(16); // Word default document file format. For Word 2010, this is the DOCX format.
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/office/ff838709(v=office.15).aspx
|
||||
LONG wdOriginalDocumentFormat = new LONG(1); // Original document format.
|
||||
LONG wdPromptUser = new LONG(2); // Prompt user to select a document format.
|
||||
LONG wdWordDocument = new LONG(0); // Microsoft Word document format.
|
||||
|
||||
try {
|
||||
msWord = new MSWord();
|
||||
System.out.println("MSWord version: " + msWord.getVersion());
|
||||
|
||||
msWord.setVisible(true);
|
||||
// msWord.newDocument();
|
||||
msWord.openDocument(currentWorkingDir + "jnatest.doc", true);
|
||||
msWord.insertText("Hello from JNA! \n\n");
|
||||
// wait 10sec. before closing
|
||||
Thread.currentThread().sleep(1000);
|
||||
// save in different formats
|
||||
// pdf format is only supported in MSWord 2007 and above
|
||||
msWord.SaveAs("C:\\TEMP\\jnatestSaveAs.doc", wdFormatDocument);
|
||||
msWord.SaveAs("C:\\TEMP\\jnatestSaveAs.pdf", wdFormatPDF);
|
||||
msWord.SaveAs("C:\\TEMP\\jnatestSaveAs.rtf", wdFormatRTF);
|
||||
msWord.SaveAs("C:\\TEMP\\jnatestSaveAs.html", wdFormatHTML);
|
||||
// close and save the document
|
||||
msWord.closeActiveDocument(false);
|
||||
msWord.newDocument();
|
||||
// msWord.openDocument(currentWorkingDir + "jnatest.doc", true);
|
||||
msWord.insertText("Hello from JNA! \n Please notice that JNA can control MS Word via the new COM interface! \nHere we are creating a new word document and we save it to the 'TEMP' directory!");
|
||||
// save with no user prompt
|
||||
msWord.SaveAs("C:\\TEMP\\jnatestNewDoc1.docx", wdFormatDocumentDefault);
|
||||
msWord.SaveAs("C:\\TEMP\\jnatestNewDoc2.docx", wdFormatDocumentDefault);
|
||||
msWord.SaveAs("C:\\TEMP\\jnatestNewDoc3.docx", wdFormatDocumentDefault);
|
||||
// close and save the document
|
||||
msWord.closeActiveDocument(false);
|
||||
// open 3 documents
|
||||
msWord.openDocument("C:\\TEMP\\jnatestNewDoc1.docx", true);
|
||||
msWord.insertText("Hello some changes from JNA!\n");
|
||||
msWord.openDocument("C:\\TEMP\\jnatestNewDoc2.docx", true);
|
||||
msWord.insertText("Hello some changes from JNA!\n");
|
||||
msWord.openDocument("C:\\TEMP\\jnatestNewDoc3.docx", true);
|
||||
msWord.insertText("Hello some changes from JNA!\n");
|
||||
// save the document and prompt the user
|
||||
msWord.Save(false, wdPromptUser);
|
||||
// wait then close word
|
||||
msWord.quit();
|
||||
} catch(InterruptedException ie) {
|
||||
ie.printStackTrace();
|
||||
} catch (COMException e) {
|
||||
if (e.getExcepInfo() != null) {
|
||||
System.out
|
||||
.println("bstrSource: " + e.getExcepInfo().bstrSource);
|
||||
System.out.println("bstrDescription: "
|
||||
+ e.getExcepInfo().bstrDescription);
|
||||
}
|
||||
|
||||
// print stack trace
|
||||
e.printStackTrace();
|
||||
|
||||
if (msWord != null)
|
||||
msWord.quit();
|
||||
}
|
||||
}
|
||||
|
||||
public void testMSExcel() {
|
||||
MSExcel msExcel = null;
|
||||
|
||||
try {
|
||||
msExcel = new MSExcel();
|
||||
System.out.println("MSExcel version: " + msExcel.getVersion());
|
||||
msExcel.setVisible(true);
|
||||
// msExcel.newExcelBook();
|
||||
msExcel.openExcelBook(currentWorkingDir + "jnatest.xls", true);
|
||||
msExcel.insertValue("A1", "Hello from JNA!");
|
||||
// wait 10sec. before closing
|
||||
Thread.currentThread().sleep(10000);
|
||||
// close and save the active sheet
|
||||
msExcel.closeActiveWorkbook(true);
|
||||
msExcel.setVisible(true);
|
||||
// msExcel.newExcelBook();
|
||||
msExcel.openExcelBook(currentWorkingDir + "jnatest.xls", true);
|
||||
msExcel.insertValue("A1", "Hello from JNA!");
|
||||
// close and save the active sheet
|
||||
msExcel.closeActiveWorkbook(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
if (msExcel != null)
|
||||
msExcel.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.sun.jna.platform.win32.COM.office;
|
||||
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.COM.COMException;
|
||||
import com.sun.jna.platform.win32.COM.COMLateBindingObject;
|
||||
import com.sun.jna.platform.win32.COM.IDispatch;
|
||||
import com.sun.jna.platform.win32.WinDef.LONG;
|
||||
|
||||
public class MSWord extends COMLateBindingObject {
|
||||
|
||||
public MSWord() throws COMException {
|
||||
super("Word.Application", false);
|
||||
}
|
||||
|
||||
public MSWord(boolean visible) throws COMException {
|
||||
this();
|
||||
this.setVisible(visible);
|
||||
}
|
||||
|
||||
public void setVisible(boolean bVisible) throws COMException {
|
||||
this.setProperty("Visible", bVisible);
|
||||
}
|
||||
|
||||
public String getVersion() throws COMException {
|
||||
return this.getStringProperty("Version");
|
||||
}
|
||||
|
||||
public void newDocument() throws COMException {
|
||||
this.invokeNoReply("Add", getDocuments());
|
||||
}
|
||||
|
||||
public void openDocument(String filename, boolean bVisible)
|
||||
throws COMException {
|
||||
// OpenDocument
|
||||
this.invokeNoReply("Open", getDocuments(), new VARIANT(filename));
|
||||
}
|
||||
|
||||
public void closeActiveDocument(boolean bSave) throws COMException {
|
||||
this.invokeNoReply("Close", getActiveDocument(), new VARIANT(bSave));
|
||||
}
|
||||
|
||||
public void quit() throws COMException {
|
||||
this.invokeNoReply("Quit");
|
||||
}
|
||||
|
||||
public void insertText(String text) throws COMException {
|
||||
Selection pSelection = new Selection(this.getAutomationProperty(
|
||||
"Selection", this.getIDispatch()));
|
||||
this.invokeNoReply("TypeText", pSelection, new VARIANT(text));
|
||||
}
|
||||
|
||||
public void Save(boolean bNoPrompt, LONG originalFormat) throws COMException {
|
||||
VARIANT vtNoPrompt = new VARIANT(bNoPrompt);
|
||||
VARIANT vtOriginalFormat = new VARIANT(originalFormat);
|
||||
|
||||
this.invokeNoReply("Save", this.getDocuments(),
|
||||
vtNoPrompt, vtOriginalFormat);
|
||||
}
|
||||
|
||||
public void SaveAs(String FileName, LONG FileFormat) throws COMException {
|
||||
VARIANT vtFileName = new VARIANT(FileName);
|
||||
VARIANT vtFileFormat = new VARIANT(FileFormat);
|
||||
|
||||
this.invokeNoReply("SaveAs", this.getActiveDocument(),
|
||||
vtFileName, vtFileFormat);
|
||||
}
|
||||
|
||||
public ActiveDocument getActiveDocument() {
|
||||
return new ActiveDocument(this.getAutomationProperty("ActiveDocument"));
|
||||
}
|
||||
|
||||
public Documents getDocuments() {
|
||||
// GetDocuments
|
||||
Documents pDocuments = new Documents(this.getAutomationProperty(
|
||||
"Documents", this.getApplication().getIDispatch()));
|
||||
|
||||
return pDocuments;
|
||||
}
|
||||
|
||||
public Application getApplication() {
|
||||
return new Application(this.getAutomationProperty("Application"));
|
||||
}
|
||||
|
||||
public class Application extends COMLateBindingObject {
|
||||
public Application(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
public class Documents extends COMLateBindingObject {
|
||||
public Documents(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
public class ActiveDocument extends COMLateBindingObject {
|
||||
public ActiveDocument(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
|
||||
public class Selection extends COMLateBindingObject {
|
||||
public Selection(IDispatch iDispatch) throws COMException {
|
||||
super(iDispatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
|
||||
<classpathentry kind="lib" path="C:/GitHub/jna-3.5.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>native_window_msg</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,381 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.DBT;
|
||||
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_DEVICEINTERFACE;
|
||||
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_HANDLE;
|
||||
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_HDR;
|
||||
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_OEM;
|
||||
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_PORT;
|
||||
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_VOLUME;
|
||||
import com.sun.jna.platform.win32.Kernel32;
|
||||
import com.sun.jna.platform.win32.User32;
|
||||
import com.sun.jna.platform.win32.WinDef.HMODULE;
|
||||
import com.sun.jna.platform.win32.WinDef.HWND;
|
||||
import com.sun.jna.platform.win32.WinDef.LPARAM;
|
||||
import com.sun.jna.platform.win32.WinDef.LRESULT;
|
||||
import com.sun.jna.platform.win32.WinDef.WPARAM;
|
||||
import com.sun.jna.platform.win32.WinUser;
|
||||
import com.sun.jna.platform.win32.WinUser.HDEVNOTIFY;
|
||||
import com.sun.jna.platform.win32.WinUser.MSG;
|
||||
import com.sun.jna.platform.win32.WinUser.WNDCLASSEX;
|
||||
import com.sun.jna.platform.win32.WinUser.WindowProc;
|
||||
import com.sun.jna.platform.win32.Wtsapi32;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class Win32WindowTest.
|
||||
*/
|
||||
public class Win32WindowDemo implements WindowProc {
|
||||
|
||||
/**
|
||||
* Instantiates a new win32 window test.
|
||||
*/
|
||||
public Win32WindowDemo() {
|
||||
// define new window class
|
||||
WString windowClass = new WString("MyWindowClass");
|
||||
HMODULE hInst = Kernel32.INSTANCE.GetModuleHandle("");
|
||||
|
||||
WNDCLASSEX wClass = new WNDCLASSEX();
|
||||
wClass.hInstance = hInst;
|
||||
wClass.lpfnWndProc = Win32WindowDemo.this;
|
||||
wClass.lpszClassName = windowClass;
|
||||
|
||||
// register window class
|
||||
User32.INSTANCE.RegisterClassEx(wClass);
|
||||
getLastError();
|
||||
|
||||
// create new window
|
||||
HWND hWnd = User32.INSTANCE
|
||||
.CreateWindowEx(
|
||||
User32.WS_EX_TOPMOST,
|
||||
windowClass,
|
||||
"My hidden helper window, used only to catch the windows events",
|
||||
0, 0, 0, 0, 0,
|
||||
null, // WM_DEVICECHANGE contradicts parent=WinUser.HWND_MESSAGE
|
||||
null, hInst, null);
|
||||
|
||||
getLastError();
|
||||
System.out.println("window sucessfully created! window hwnd: "
|
||||
+ hWnd.getPointer().toString());
|
||||
|
||||
Wtsapi32.INSTANCE.WTSRegisterSessionNotification(hWnd,
|
||||
Wtsapi32.NOTIFY_FOR_THIS_SESSION);
|
||||
|
||||
/* this filters for all device classes */
|
||||
// DEV_BROADCAST_HDR notificationFilter = new DEV_BROADCAST_HDR();
|
||||
// notificationFilter.dbch_devicetype = DBT.DBT_DEVTYP_DEVICEINTERFACE;
|
||||
|
||||
/* this filters for all usb device classes */
|
||||
DEV_BROADCAST_DEVICEINTERFACE notificationFilter = new DEV_BROADCAST_DEVICEINTERFACE();
|
||||
notificationFilter.dbcc_size = notificationFilter.size();
|
||||
notificationFilter.dbcc_devicetype = DBT.DBT_DEVTYP_DEVICEINTERFACE;
|
||||
notificationFilter.dbcc_classguid = DBT.GUID_DEVINTERFACE_USB_DEVICE;
|
||||
|
||||
/*
|
||||
* use User32.DEVICE_NOTIFY_ALL_INTERFACE_CLASSES instead of
|
||||
* DEVICE_NOTIFY_WINDOW_HANDLE to ignore the dbcc_classguid value
|
||||
*/
|
||||
HDEVNOTIFY hDevNotify = User32.INSTANCE.RegisterDeviceNotification(
|
||||
hWnd, notificationFilter, User32.DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
|
||||
getLastError();
|
||||
if (hDevNotify != null)
|
||||
System.out.println("RegisterDeviceNotification was sucessfully!");
|
||||
|
||||
MSG msg = new MSG();
|
||||
while (User32.INSTANCE.GetMessage(msg, hWnd, 0, 0) != 0) {
|
||||
User32.INSTANCE.TranslateMessage(msg);
|
||||
User32.INSTANCE.DispatchMessage(msg);
|
||||
}
|
||||
|
||||
User32.INSTANCE.UnregisterDeviceNotification(hDevNotify);
|
||||
Wtsapi32.INSTANCE.WTSUnRegisterSessionNotification(hWnd);
|
||||
User32.INSTANCE.UnregisterClass(windowClass, hInst);
|
||||
User32.INSTANCE.DestroyWindow(hWnd);
|
||||
|
||||
System.out.println("program exit!");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.sun.jna.platform.win32.User32.WindowProc#callback(com.sun.jna.platform
|
||||
* .win32.WinDef.HWND, int, com.sun.jna.platform.win32.WinDef.WPARAM,
|
||||
* com.sun.jna.platform.win32.WinDef.LPARAM)
|
||||
*/
|
||||
public LRESULT callback(HWND hwnd, int uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch (uMsg) {
|
||||
case WinUser.WM_CREATE: {
|
||||
onCreate(wParam, lParam);
|
||||
return new LRESULT(0);
|
||||
}
|
||||
case WinUser.WM_DESTROY: {
|
||||
User32.INSTANCE.PostQuitMessage(0);
|
||||
return new LRESULT(0);
|
||||
}
|
||||
case WinUser.WM_SESSION_CHANGE: {
|
||||
this.onSessionChange(wParam, lParam);
|
||||
return new LRESULT(0);
|
||||
}
|
||||
case WinUser.WM_DEVICECHANGE: {
|
||||
LRESULT lResult = this.onDeviceChange(wParam, lParam);
|
||||
return lResult != null ? lResult :
|
||||
User32.INSTANCE.DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
default:
|
||||
return User32.INSTANCE.DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last error.
|
||||
*
|
||||
* @return the last error
|
||||
*/
|
||||
public int getLastError() {
|
||||
int rc = Kernel32.INSTANCE.GetLastError();
|
||||
|
||||
if (rc != 0)
|
||||
System.out.println("error: " + rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* On session change.
|
||||
*
|
||||
* @param wParam
|
||||
* the w param
|
||||
* @param lParam
|
||||
* the l param
|
||||
*/
|
||||
protected void onSessionChange(WPARAM wParam, LPARAM lParam) {
|
||||
switch (wParam.intValue()) {
|
||||
case Wtsapi32.WTS_CONSOLE_CONNECT: {
|
||||
this.onConsoleConnect(lParam.intValue());
|
||||
break;
|
||||
}
|
||||
case Wtsapi32.WTS_CONSOLE_DISCONNECT: {
|
||||
this.onConsoleDisconnect(lParam.intValue());
|
||||
break;
|
||||
}
|
||||
case Wtsapi32.WTS_SESSION_LOGON: {
|
||||
this.onMachineLogon(lParam.intValue());
|
||||
break;
|
||||
}
|
||||
case Wtsapi32.WTS_SESSION_LOGOFF: {
|
||||
this.onMachineLogoff(lParam.intValue());
|
||||
break;
|
||||
}
|
||||
case Wtsapi32.WTS_SESSION_LOCK: {
|
||||
this.onMachineLocked(lParam.intValue());
|
||||
break;
|
||||
}
|
||||
case Wtsapi32.WTS_SESSION_UNLOCK: {
|
||||
this.onMachineUnlocked(lParam.intValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On console connect.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session id
|
||||
*/
|
||||
protected void onConsoleConnect(int sessionId) {
|
||||
System.out.println("onConsoleConnect: " + sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* On console disconnect.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session id
|
||||
*/
|
||||
protected void onConsoleDisconnect(int sessionId) {
|
||||
System.out.println("onConsoleDisconnect: " + sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* On machine locked.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session id
|
||||
*/
|
||||
protected void onMachineLocked(int sessionId) {
|
||||
System.out.println("onMachineLocked: " + sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* On machine unlocked.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session id
|
||||
*/
|
||||
protected void onMachineUnlocked(int sessionId) {
|
||||
System.out.println("onMachineUnlocked: " + sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* On machine logon.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session id
|
||||
*/
|
||||
protected void onMachineLogon(int sessionId) {
|
||||
System.out.println("onMachineLogon: " + sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* On machine logoff.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session id
|
||||
*/
|
||||
protected void onMachineLogoff(int sessionId) {
|
||||
System.out.println("onMachineLogoff: " + sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* On device change.
|
||||
*
|
||||
* @param wParam
|
||||
* the w param
|
||||
* @param lParam
|
||||
* the l param
|
||||
* @return the result. Null if the message is not processed.
|
||||
*/
|
||||
protected LRESULT onDeviceChange(WPARAM wParam, LPARAM lParam) {
|
||||
switch (wParam.intValue()) {
|
||||
case DBT.DBT_DEVICEARRIVAL: {
|
||||
return onDeviceChangeArrival(lParam);
|
||||
}
|
||||
case DBT.DBT_DEVICEREMOVECOMPLETE: {
|
||||
return onDeviceChangeRemoveComplete(lParam);
|
||||
}
|
||||
case DBT.DBT_DEVNODES_CHANGED: {
|
||||
//lParam is 0 for this wParam
|
||||
return onDeviceChangeNodesChanged();
|
||||
}
|
||||
default:
|
||||
System.out
|
||||
.println("Message WM_DEVICECHANGE message received, value unhandled.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected LRESULT onDeviceChangeArrivalOrRemoveComplete(LPARAM lParam, String action) {
|
||||
DEV_BROADCAST_HDR bhdr = new DEV_BROADCAST_HDR(lParam.longValue());
|
||||
switch (bhdr.dbch_devicetype) {
|
||||
case DBT.DBT_DEVTYP_DEVICEINTERFACE: {
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363244.aspx
|
||||
DEV_BROADCAST_DEVICEINTERFACE bdif = new DEV_BROADCAST_DEVICEINTERFACE(bhdr.getPointer());
|
||||
System.out.println("BROADCAST_DEVICEINTERFACE: " + action);
|
||||
System.out.println("dbcc_devicetype: " + bdif.dbcc_devicetype);
|
||||
System.out.println("dbcc_name: " + bdif.getDbcc_name());
|
||||
System.out.println("dbcc_classguid: "
|
||||
+ bdif.dbcc_classguid.toGuidString());
|
||||
break;
|
||||
}
|
||||
case DBT.DBT_DEVTYP_HANDLE: {
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363245.aspx
|
||||
DEV_BROADCAST_HANDLE bhd = new DEV_BROADCAST_HANDLE(bhdr.getPointer());
|
||||
System.out.println("BROADCAST_HANDLE: " + action);
|
||||
break;
|
||||
}
|
||||
case DBT.DBT_DEVTYP_OEM: {
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363247.aspx
|
||||
DEV_BROADCAST_OEM boem = new DEV_BROADCAST_OEM(bhdr.getPointer());
|
||||
System.out.println("BROADCAST_OEM: " + action);
|
||||
break;
|
||||
}
|
||||
case DBT.DBT_DEVTYP_PORT: {
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363248.aspx
|
||||
DEV_BROADCAST_PORT bpt = new DEV_BROADCAST_PORT(bhdr.getPointer());
|
||||
System.out.println("BROADCAST_PORT: " + action);
|
||||
break;
|
||||
}
|
||||
case DBT.DBT_DEVTYP_VOLUME: {
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363249.aspx
|
||||
DEV_BROADCAST_VOLUME bvl = new DEV_BROADCAST_VOLUME(bhdr.getPointer());
|
||||
int logicalDriveAffected = bvl.dbcv_unitmask;
|
||||
short flag = bvl.dbcv_flags;
|
||||
boolean isMediaNotPhysical = 0 != (flag & DBT.DBTF_MEDIA/*value is 1*/);
|
||||
boolean isNet = 0 != (flag & DBT.DBTF_NET/*value is 2*/);
|
||||
System.out.println(action);
|
||||
int driveLetterIndex = 0;
|
||||
while (logicalDriveAffected != 0) {
|
||||
if (0 != (logicalDriveAffected & 1)) {
|
||||
System.out.println("Logical Drive Letter: " +
|
||||
((char) ('A' + driveLetterIndex)));
|
||||
}
|
||||
logicalDriveAffected >>>= 1;
|
||||
driveLetterIndex++;
|
||||
}
|
||||
System.out.println("isMediaNotPhysical:"+isMediaNotPhysical);
|
||||
System.out.println("isNet:"+isNet);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
// return TRUE means processed message for this wParam.
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363205.aspx
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363208.aspx
|
||||
return new LRESULT(1);
|
||||
}
|
||||
|
||||
protected LRESULT onDeviceChangeArrival(LPARAM lParam) {
|
||||
return onDeviceChangeArrivalOrRemoveComplete(lParam, "Arrival");
|
||||
}
|
||||
|
||||
protected LRESULT onDeviceChangeRemoveComplete(LPARAM lParam) {
|
||||
return onDeviceChangeArrivalOrRemoveComplete(lParam, "Remove Complete");
|
||||
}
|
||||
|
||||
protected LRESULT onDeviceChangeNodesChanged() {
|
||||
System.out.println("Message DBT_DEVNODES_CHANGED");
|
||||
// return TRUE means processed message for this wParam.
|
||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363211.aspx
|
||||
return new LRESULT(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* On create.
|
||||
*
|
||||
* @param wParam
|
||||
* the w param
|
||||
* @param lParam
|
||||
* the l param
|
||||
*/
|
||||
protected void onCreate(WPARAM wParam, LPARAM lParam) {
|
||||
System.out.println("onCreate: WM_CREATE");
|
||||
}
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
*
|
||||
* @param args
|
||||
* the arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new Win32WindowDemo();
|
||||
}
|
||||
}
|
||||
@@ -1,212 +1,196 @@
|
||||
/*
|
||||
* Advapi32.java
|
||||
*
|
||||
* Created on 6. August 2007, 11:24
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.ptr.*;
|
||||
import com.sun.jna.win32.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface Advapi32 extends StdCallLibrary {
|
||||
Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32", Advapi32.class,
|
||||
W32APIOptions.UNICODE_OPTIONS);
|
||||
|
||||
/*
|
||||
SC_HANDLE WINAPI OpenSCManager(
|
||||
LPCTSTR lpMachineName,
|
||||
LPCTSTR lpDatabaseName,
|
||||
DWORD dwDesiredAccess
|
||||
);*/
|
||||
public Pointer OpenSCManager(String lpMachineName, WString lpDatabaseName, int dwDesiredAccess);
|
||||
|
||||
/*
|
||||
BOOL WINAPI CloseServiceHandle(
|
||||
SC_HANDLE hSCObject
|
||||
);*/
|
||||
public boolean CloseServiceHandle(Pointer hSCObject);
|
||||
|
||||
/*
|
||||
SC_HANDLE WINAPI OpenService(
|
||||
SC_HANDLE hSCManager,
|
||||
LPCTSTR lpServiceName,
|
||||
DWORD dwDesiredAccess
|
||||
);*/
|
||||
public Pointer OpenService(Pointer hSCManager, String lpServiceName, int dwDesiredAccess);
|
||||
|
||||
/*
|
||||
BOOL WINAPI StartService(
|
||||
SC_HANDLE hService,
|
||||
DWORD dwNumServiceArgs,
|
||||
LPCTSTR* lpServiceArgVectors
|
||||
);*/
|
||||
public boolean StartService(Pointer hService, int dwNumServiceArgs, char[] lpServiceArgVectors);
|
||||
|
||||
/*
|
||||
BOOL WINAPI ControlService(
|
||||
SC_HANDLE hService,
|
||||
DWORD dwControl,
|
||||
LPSERVICE_STATUS lpServiceStatus
|
||||
);*/
|
||||
public boolean ControlService(Pointer hService, int dwControl, SERVICE_STATUS lpServiceStatus);
|
||||
|
||||
/*
|
||||
BOOL WINAPI StartServiceCtrlDispatcher(
|
||||
const SERVICE_TABLE_ENTRY* lpServiceTable
|
||||
);*/
|
||||
public boolean StartServiceCtrlDispatcher(Structure[] lpServiceTable);
|
||||
|
||||
/*
|
||||
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandler(
|
||||
LPCTSTR lpServiceName,
|
||||
LPHANDLER_FUNCTION lpHandlerProc
|
||||
);*/
|
||||
public Pointer RegisterServiceCtrlHandler(String lpServiceName, Handler lpHandlerProc);
|
||||
|
||||
/*
|
||||
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerEx(
|
||||
LPCTSTR lpServiceName,
|
||||
LPHANDLER_FUNCTION_EX lpHandlerProc,
|
||||
LPVOID lpContext
|
||||
);*/
|
||||
public Pointer RegisterServiceCtrlHandlerEx(String lpServiceName, HandlerEx lpHandlerProc, Pointer lpContext);
|
||||
|
||||
/*
|
||||
BOOL WINAPI SetServiceStatus(
|
||||
SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
LPSERVICE_STATUS lpServiceStatus
|
||||
);*/
|
||||
public boolean SetServiceStatus(Pointer hServiceStatus, SERVICE_STATUS lpServiceStatus);
|
||||
|
||||
/*
|
||||
SC_HANDLE WINAPI CreateService(
|
||||
SC_HANDLE hSCManager,
|
||||
LPCTSTR lpServiceName,
|
||||
LPCTSTR lpDisplayName,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwServiceType,
|
||||
DWORD dwStartType,
|
||||
DWORD dwErrorControl,
|
||||
LPCTSTR lpBinaryPathName,
|
||||
LPCTSTR lpLoadOrderGroup,
|
||||
LPDWORD lpdwTagId,
|
||||
LPCTSTR lpDependencies,
|
||||
LPCTSTR lpServiceStartName,
|
||||
LPCTSTR lpPassword
|
||||
);*/
|
||||
public Pointer CreateService(Pointer hSCManager, String lpServiceName, String lpDisplayName,
|
||||
int dwDesiredAccess, int dwServiceType, int dwStartType, int dwErrorControl,
|
||||
String lpBinaryPathName, String lpLoadOrderGroup, IntByReference lpdwTagId,
|
||||
String lpDependencies, String lpServiceStartName, String lpPassword);
|
||||
|
||||
/*
|
||||
BOOL WINAPI DeleteService(
|
||||
SC_HANDLE hService
|
||||
);*/
|
||||
public boolean DeleteService(Pointer hService);
|
||||
|
||||
/*
|
||||
BOOL WINAPI ChangeServiceConfig2(
|
||||
SC_HANDLE hService,
|
||||
DWORD dwInfoLevel,
|
||||
LPVOID lpInfo
|
||||
);*/
|
||||
public boolean ChangeServiceConfig2(Pointer hService, int dwInfoLevel, ChangeServiceConfig2Info lpInfo);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegEnumValue(
|
||||
HKEY hKey,
|
||||
DWORD dwIndex,
|
||||
LPTSTR lpValueName,
|
||||
LPDWORD lpcchValueName,
|
||||
LPDWORD lpReserved,
|
||||
LPDWORD lpType,
|
||||
LPBYTE lpData,
|
||||
LPDWORD lpcbData
|
||||
);*/
|
||||
public int RegEnumValue(int hKey, int dwIndex, char[] lpValueName, IntByReference lpcchValueName, IntByReference reserved,
|
||||
IntByReference lpType, byte[] lpData, IntByReference lpcbData);
|
||||
|
||||
interface SERVICE_MAIN_FUNCTION extends StdCallCallback {
|
||||
/*
|
||||
VOID WINAPI ServiceMain(
|
||||
DWORD dwArgc,
|
||||
LPTSTR* lpszArgv
|
||||
);*/
|
||||
public void callback(int dwArgc, Pointer lpszArgv);
|
||||
}
|
||||
|
||||
interface Handler extends StdCallCallback {
|
||||
/*
|
||||
VOID WINAPI Handler(
|
||||
DWORD fdwControl
|
||||
);*/
|
||||
public void callback(int fdwControl);
|
||||
}
|
||||
|
||||
interface HandlerEx extends StdCallCallback {
|
||||
/*
|
||||
DWORD WINAPI HandlerEx(
|
||||
DWORD dwControl,
|
||||
DWORD dwEventType,
|
||||
LPVOID lpEventData,
|
||||
LPVOID lpContext
|
||||
);*/
|
||||
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext);
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_STATUS {
|
||||
DWORD dwServiceType;
|
||||
DWORD dwCurrentState;
|
||||
DWORD dwControlsAccepted;
|
||||
DWORD dwWin32ExitCode;
|
||||
DWORD dwServiceSpecificExitCode;
|
||||
DWORD dwCheckPoint;
|
||||
DWORD dwWaitHint;
|
||||
} SERVICE_STATUS,
|
||||
*LPSERVICE_STATUS;*/
|
||||
public static class SERVICE_STATUS extends Structure {
|
||||
public int dwServiceType;
|
||||
public int dwCurrentState;
|
||||
public int dwControlsAccepted;
|
||||
public int dwWin32ExitCode;
|
||||
public int dwServiceSpecificExitCode;
|
||||
public int dwCheckPoint;
|
||||
public int dwWaitHint;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_TABLE_ENTRY {
|
||||
LPTSTR lpServiceName;
|
||||
LPSERVICE_MAIN_FUNCTION lpServiceProc;
|
||||
} SERVICE_TABLE_ENTRY,
|
||||
*LPSERVICE_TABLE_ENTRY;*/
|
||||
public static class SERVICE_TABLE_ENTRY extends Structure {
|
||||
public String lpServiceName;
|
||||
public SERVICE_MAIN_FUNCTION lpServiceProc;
|
||||
}
|
||||
|
||||
public static class ChangeServiceConfig2Info extends Structure {
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_DESCRIPTION {
|
||||
LPTSTR lpDescription;
|
||||
} SERVICE_DESCRIPTION,
|
||||
*LPSERVICE_DESCRIPTION;*/
|
||||
public static class SERVICE_DESCRIPTION extends ChangeServiceConfig2Info {
|
||||
public String lpDescription;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Advapi32.java
|
||||
*
|
||||
* Created on 6. August 2007, 11:24
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
import com.sun.jna.win32.W32APIOptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface Advapi32 extends StdCallLibrary {
|
||||
Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32",
|
||||
Advapi32.class, W32APIOptions.UNICODE_OPTIONS);
|
||||
|
||||
/*
|
||||
* SC_HANDLE WINAPI OpenSCManager( LPCTSTR lpMachineName, LPCTSTR
|
||||
* lpDatabaseName, DWORD dwDesiredAccess );
|
||||
*/
|
||||
public Pointer OpenSCManager(String lpMachineName, WString lpDatabaseName,
|
||||
int dwDesiredAccess);
|
||||
|
||||
/*
|
||||
* BOOL WINAPI CloseServiceHandle( SC_HANDLE hSCObject );
|
||||
*/
|
||||
public boolean CloseServiceHandle(Pointer hSCObject);
|
||||
|
||||
/*
|
||||
* SC_HANDLE WINAPI OpenService( SC_HANDLE hSCManager, LPCTSTR
|
||||
* lpServiceName, DWORD dwDesiredAccess );
|
||||
*/
|
||||
public Pointer OpenService(Pointer hSCManager, String lpServiceName,
|
||||
int dwDesiredAccess);
|
||||
|
||||
/*
|
||||
* BOOL WINAPI StartService( SC_HANDLE hService, DWORD dwNumServiceArgs,
|
||||
* LPCTSTR* lpServiceArgVectors );
|
||||
*/
|
||||
public boolean StartService(Pointer hService, int dwNumServiceArgs,
|
||||
char[] lpServiceArgVectors);
|
||||
|
||||
/*
|
||||
* BOOL WINAPI ControlService( SC_HANDLE hService, DWORD dwControl,
|
||||
* LPSERVICE_STATUS lpServiceStatus );
|
||||
*/
|
||||
public boolean ControlService(Pointer hService, int dwControl,
|
||||
SERVICE_STATUS lpServiceStatus);
|
||||
|
||||
/*
|
||||
* BOOL WINAPI StartServiceCtrlDispatcher( const SERVICE_TABLE_ENTRY*
|
||||
* lpServiceTable );
|
||||
*/
|
||||
public boolean StartServiceCtrlDispatcher(Structure[] lpServiceTable);
|
||||
|
||||
/*
|
||||
* SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandler( LPCTSTR
|
||||
* lpServiceName, LPHANDLER_FUNCTION lpHandlerProc );
|
||||
*/
|
||||
public Pointer RegisterServiceCtrlHandler(String lpServiceName,
|
||||
Handler lpHandlerProc);
|
||||
|
||||
/*
|
||||
* SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerEx( LPCTSTR
|
||||
* lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext );
|
||||
*/
|
||||
public Pointer RegisterServiceCtrlHandlerEx(String lpServiceName,
|
||||
HandlerEx lpHandlerProc, Pointer lpContext);
|
||||
|
||||
/*
|
||||
* BOOL WINAPI SetServiceStatus( SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
* LPSERVICE_STATUS lpServiceStatus );
|
||||
*/
|
||||
public boolean SetServiceStatus(Pointer hServiceStatus,
|
||||
SERVICE_STATUS lpServiceStatus);
|
||||
|
||||
/*
|
||||
* SC_HANDLE WINAPI CreateService( SC_HANDLE hSCManager, LPCTSTR
|
||||
* lpServiceName, LPCTSTR lpDisplayName, DWORD dwDesiredAccess, DWORD
|
||||
* dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCTSTR
|
||||
* lpBinaryPathName, LPCTSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCTSTR
|
||||
* lpDependencies, LPCTSTR lpServiceStartName, LPCTSTR lpPassword );
|
||||
*/
|
||||
public Pointer CreateService(Pointer hSCManager, String lpServiceName,
|
||||
String lpDisplayName, int dwDesiredAccess, int dwServiceType,
|
||||
int dwStartType, int dwErrorControl, String lpBinaryPathName,
|
||||
String lpLoadOrderGroup, IntByReference lpdwTagId,
|
||||
String lpDependencies, String lpServiceStartName, String lpPassword);
|
||||
|
||||
/*
|
||||
* BOOL WINAPI DeleteService( SC_HANDLE hService );
|
||||
*/
|
||||
public boolean DeleteService(Pointer hService);
|
||||
|
||||
/*
|
||||
* BOOL WINAPI ChangeServiceConfig2( SC_HANDLE hService, DWORD dwInfoLevel,
|
||||
* LPVOID lpInfo );
|
||||
*/
|
||||
public boolean ChangeServiceConfig2(Pointer hService, int dwInfoLevel,
|
||||
ChangeServiceConfig2Info lpInfo);
|
||||
|
||||
/*
|
||||
* LONG WINAPI RegEnumValue( HKEY hKey, DWORD dwIndex, LPTSTR lpValueName,
|
||||
* LPDWORD lpcchValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE
|
||||
* lpData, LPDWORD lpcbData );
|
||||
*/
|
||||
public int RegEnumValue(int hKey, int dwIndex, char[] lpValueName,
|
||||
IntByReference lpcchValueName, IntByReference reserved,
|
||||
IntByReference lpType, byte[] lpData, IntByReference lpcbData);
|
||||
|
||||
interface SERVICE_MAIN_FUNCTION extends StdCallCallback {
|
||||
/*
|
||||
* VOID WINAPI ServiceMain( DWORD dwArgc, LPTSTR* lpszArgv );
|
||||
*/
|
||||
public void callback(int dwArgc, Pointer lpszArgv);
|
||||
}
|
||||
|
||||
interface Handler extends StdCallCallback {
|
||||
/*
|
||||
* VOID WINAPI Handler( DWORD fdwControl );
|
||||
*/
|
||||
public void callback(int fdwControl);
|
||||
}
|
||||
|
||||
interface HandlerEx extends StdCallCallback {
|
||||
/*
|
||||
* DWORD WINAPI HandlerEx( DWORD dwControl, DWORD dwEventType, LPVOID
|
||||
* lpEventData, LPVOID lpContext );
|
||||
*/
|
||||
public int callback(int dwControl, int dwEventType,
|
||||
Pointer lpEventData, Pointer lpContext);
|
||||
}
|
||||
|
||||
/*
|
||||
* typedef struct _SERVICE_STATUS { DWORD dwServiceType; DWORD
|
||||
* dwCurrentState; DWORD dwControlsAccepted; DWORD dwWin32ExitCode; DWORD
|
||||
* dwServiceSpecificExitCode; DWORD dwCheckPoint; DWORD dwWaitHint; }
|
||||
* SERVICE_STATUS,LPSERVICE_STATUS;
|
||||
*/
|
||||
public static class SERVICE_STATUS extends Structure {
|
||||
public int dwServiceType;
|
||||
public int dwCurrentState;
|
||||
public int dwControlsAccepted;
|
||||
public int dwWin32ExitCode;
|
||||
public int dwServiceSpecificExitCode;
|
||||
public int dwCheckPoint;
|
||||
public int dwWaitHint;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwServiceType", "dwCurrentState", "dwControlsAccepted", "dwWin32ExitCode", "dwServiceSpecificExitCode", "dwCheckPoint", "dwWaitHint" });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* typedef struct _SERVICE_TABLE_ENTRY { LPTSTR lpServiceName;
|
||||
* LPSERVICE_MAIN_FUNCTION lpServiceProc; } SERVICE_TABLE_ENTRY,
|
||||
* LPSERVICE_TABLE_ENTRY;
|
||||
*/
|
||||
public static class SERVICE_TABLE_ENTRY extends Structure {
|
||||
public String lpServiceName;
|
||||
public SERVICE_MAIN_FUNCTION lpServiceProc;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "lpServiceName", "lpServiceProc" });
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class ChangeServiceConfig2Info extends Structure {
|
||||
}
|
||||
|
||||
/*
|
||||
* typedef struct _SERVICE_DESCRIPTION { LPTSTR lpDescription; }
|
||||
* SERVICE_DESCRIPTION,LPSERVICE_DESCRIPTION;
|
||||
*/
|
||||
public static class SERVICE_DESCRIPTION extends ChangeServiceConfig2Info {
|
||||
public String lpDescription;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "lpDescription" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* WINERROR.java
|
||||
*
|
||||
* Created on 7. August 2007, 08:09
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINERROR {
|
||||
public final static int ERROR_SUCCESS = 0;
|
||||
public final static int NO_ERROR = 0;
|
||||
public final static int ERROR_FILE_NOT_FOUND = 2;
|
||||
public final static int ERROR_MORE_DATA = 234;
|
||||
}
|
||||
/*
|
||||
* WINERROR.java
|
||||
*
|
||||
* Created on 7. August 2007, 08:09
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINERROR {
|
||||
public final static int ERROR_SUCCESS = 0;
|
||||
public final static int NO_ERROR = 0;
|
||||
public final static int ERROR_FILE_NOT_FOUND = 2;
|
||||
public final static int ERROR_MORE_DATA = 234;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
/*
|
||||
* WINNT.java
|
||||
*
|
||||
* Created on 8. August 2007, 13:41
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINNT {
|
||||
public final static int DELETE = 0x00010000;
|
||||
public final static int READ_CONTROL = 0x00020000;
|
||||
public final static int WRITE_DAC = 0x00040000;
|
||||
public final static int WRITE_OWNER = 0x00080000;
|
||||
public final static int SYNCHRONIZE = 0x00100000;
|
||||
|
||||
public final static int STANDARD_RIGHTS_REQUIRED = 0x000F0000;
|
||||
|
||||
public final static int STANDARD_RIGHTS_READ = READ_CONTROL;
|
||||
public final static int STANDARD_RIGHTS_WRITE = READ_CONTROL;
|
||||
public final static int STANDARD_RIGHTS_EXECUTE = READ_CONTROL;
|
||||
|
||||
public final static int STANDARD_RIGHTS_ALL = 0x001F0000;
|
||||
|
||||
public final static int SPECIFIC_RIGHTS_ALL = 0x0000FFFF;
|
||||
|
||||
public final static int GENERIC_EXECUTE = 0x20000000;
|
||||
|
||||
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
||||
}
|
||||
/*
|
||||
* WINNT.java
|
||||
*
|
||||
* Created on 8. August 2007, 13:41
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINNT {
|
||||
public final static int DELETE = 0x00010000;
|
||||
public final static int READ_CONTROL = 0x00020000;
|
||||
public final static int WRITE_DAC = 0x00040000;
|
||||
public final static int WRITE_OWNER = 0x00080000;
|
||||
public final static int SYNCHRONIZE = 0x00100000;
|
||||
|
||||
public final static int STANDARD_RIGHTS_REQUIRED = 0x000F0000;
|
||||
|
||||
public final static int STANDARD_RIGHTS_READ = READ_CONTROL;
|
||||
public final static int STANDARD_RIGHTS_WRITE = READ_CONTROL;
|
||||
public final static int STANDARD_RIGHTS_EXECUTE = READ_CONTROL;
|
||||
|
||||
public final static int STANDARD_RIGHTS_ALL = 0x001F0000;
|
||||
|
||||
public final static int SPECIFIC_RIGHTS_ALL = 0x0000FFFF;
|
||||
|
||||
public final static int GENERIC_EXECUTE = 0x20000000;
|
||||
|
||||
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
||||
}
|
||||
|
||||
@@ -1,104 +1,104 @@
|
||||
/*
|
||||
* WINSVC.java
|
||||
*
|
||||
* Created on 8. August 2007, 15:07
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINSVC {
|
||||
public final static int SERVICE_CONTROL_STOP = 0x00000001;
|
||||
public final static int SERVICE_CONTROL_SHUTDOWN = 0x00000005;
|
||||
|
||||
public final static int SERVICE_STOPPED = 0x00000001;
|
||||
public final static int SERVICE_START_PENDING = 0x00000002;
|
||||
public final static int SERVICE_STOP_PENDING = 0x00000003;
|
||||
public final static int SERVICE_RUNNING = 0x00000004;
|
||||
public final static int SERVICE_CONTINUE_PENDING = 0x00000005;
|
||||
public final static int SERVICE_PAUSE_PENDING = 0x00000006;
|
||||
public final static int SERVICE_PAUSED = 0x00000007;
|
||||
|
||||
public final static int SERVICE_ACCEPT_STOP = 0x00000001;
|
||||
public final static int SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002;
|
||||
public final static int SERVICE_ACCEPT_SHUTDOWN = 0x00000004;
|
||||
public final static int SERVICE_ACCEPT_PARAMCHANGE = 0x00000008;
|
||||
public final static int SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010;
|
||||
|
||||
public final static int SC_MANAGER_CONNECT = 0x0001;
|
||||
public final static int SC_MANAGER_CREATE_SERVICE = 0x0002;
|
||||
public final static int SC_MANAGER_ENUMERATE_SERVICE = 0x0004;
|
||||
public final static int SC_MANAGER_LOCK = 0x0008;
|
||||
public final static int SC_MANAGER_QUERY_LOCK_STATUS = 0x0010;
|
||||
public final static int SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020;
|
||||
|
||||
public final static int SC_MANAGER_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||
SC_MANAGER_CONNECT |
|
||||
SC_MANAGER_CREATE_SERVICE |
|
||||
SC_MANAGER_ENUMERATE_SERVICE |
|
||||
SC_MANAGER_LOCK |
|
||||
SC_MANAGER_QUERY_LOCK_STATUS |
|
||||
SC_MANAGER_MODIFY_BOOT_CONFIG;
|
||||
|
||||
public final static int SERVICE_QUERY_CONFIG = 0x0001;
|
||||
public final static int SERVICE_CHANGE_CONFIG = 0x0002;
|
||||
public final static int SERVICE_QUERY_STATUS = 0x0004;
|
||||
public final static int SERVICE_ENUMERATE_DEPENDENTS = 0x0008;
|
||||
public final static int SERVICE_START = 0x0010;
|
||||
public final static int SERVICE_STOP = 0x0020;
|
||||
public final static int SERVICE_PAUSE_CONTINUE = 0x0040;
|
||||
public final static int SERVICE_INTERROGATE = 0x0080;
|
||||
public final static int SERVICE_USER_DEFINED_CONTROL = 0x0100;
|
||||
|
||||
public final static int SERVICE_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||
SERVICE_QUERY_CONFIG |
|
||||
SERVICE_CHANGE_CONFIG |
|
||||
SERVICE_QUERY_STATUS |
|
||||
SERVICE_ENUMERATE_DEPENDENTS |
|
||||
SERVICE_START |
|
||||
SERVICE_STOP |
|
||||
SERVICE_PAUSE_CONTINUE |
|
||||
SERVICE_INTERROGATE |
|
||||
SERVICE_USER_DEFINED_CONTROL;
|
||||
|
||||
public final static int SERVICE_CONFIG_DESCRIPTION = 1;
|
||||
public final static int SERVICE_CONFIG_FAILURE_ACTIONS = 2;
|
||||
|
||||
public final static int SERVICE_KERNEL_DRIVER = 0x00000001;
|
||||
public final static int SERVICE_FILE_SYSTEM_DRIVER = 0x00000002;
|
||||
public final static int SERVICE_ADAPTER = 0x00000004;
|
||||
public final static int SERVICE_RECOGNIZER_DRIVER = 0x00000008;
|
||||
|
||||
public final static int SERVICE_DRIVER = SERVICE_KERNEL_DRIVER |
|
||||
SERVICE_FILE_SYSTEM_DRIVER |
|
||||
SERVICE_RECOGNIZER_DRIVER;
|
||||
|
||||
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
||||
public final static int SERVICE_WIN32_SHARE_PROCESS = 0x00000020;
|
||||
public final static int SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS;
|
||||
|
||||
public final static int SERVICE_INTERACTIVE_PROCESS = 0x00000100;
|
||||
|
||||
public final static int SERVICE_TYPE_ALL = SERVICE_WIN32 |
|
||||
SERVICE_ADAPTER |
|
||||
SERVICE_DRIVER |
|
||||
SERVICE_INTERACTIVE_PROCESS;
|
||||
|
||||
public final static int SERVICE_BOOT_START = 0x00000000;
|
||||
public final static int SERVICE_SYSTEM_START = 0x00000001;
|
||||
public final static int SERVICE_AUTO_START = 0x00000002;
|
||||
public final static int SERVICE_DEMAND_START = 0x00000003;
|
||||
public final static int SERVICE_DISABLED = 0x00000004;
|
||||
|
||||
public final static int SERVICE_ERROR_IGNORE = 0x00000000;
|
||||
public final static int SERVICE_ERROR_NORMAL = 0x00000001;
|
||||
public final static int SERVICE_ERROR_SEVERE = 0x00000002;
|
||||
public final static int SERVICE_ERROR_CRITICAL = 0x00000003;
|
||||
}
|
||||
/*
|
||||
* WINSVC.java
|
||||
*
|
||||
* Created on 8. August 2007, 15:07
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINSVC {
|
||||
public final static int SERVICE_CONTROL_STOP = 0x00000001;
|
||||
public final static int SERVICE_CONTROL_SHUTDOWN = 0x00000005;
|
||||
|
||||
public final static int SERVICE_STOPPED = 0x00000001;
|
||||
public final static int SERVICE_START_PENDING = 0x00000002;
|
||||
public final static int SERVICE_STOP_PENDING = 0x00000003;
|
||||
public final static int SERVICE_RUNNING = 0x00000004;
|
||||
public final static int SERVICE_CONTINUE_PENDING = 0x00000005;
|
||||
public final static int SERVICE_PAUSE_PENDING = 0x00000006;
|
||||
public final static int SERVICE_PAUSED = 0x00000007;
|
||||
|
||||
public final static int SERVICE_ACCEPT_STOP = 0x00000001;
|
||||
public final static int SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002;
|
||||
public final static int SERVICE_ACCEPT_SHUTDOWN = 0x00000004;
|
||||
public final static int SERVICE_ACCEPT_PARAMCHANGE = 0x00000008;
|
||||
public final static int SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010;
|
||||
|
||||
public final static int SC_MANAGER_CONNECT = 0x0001;
|
||||
public final static int SC_MANAGER_CREATE_SERVICE = 0x0002;
|
||||
public final static int SC_MANAGER_ENUMERATE_SERVICE = 0x0004;
|
||||
public final static int SC_MANAGER_LOCK = 0x0008;
|
||||
public final static int SC_MANAGER_QUERY_LOCK_STATUS = 0x0010;
|
||||
public final static int SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020;
|
||||
|
||||
public final static int SC_MANAGER_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||
SC_MANAGER_CONNECT |
|
||||
SC_MANAGER_CREATE_SERVICE |
|
||||
SC_MANAGER_ENUMERATE_SERVICE |
|
||||
SC_MANAGER_LOCK |
|
||||
SC_MANAGER_QUERY_LOCK_STATUS |
|
||||
SC_MANAGER_MODIFY_BOOT_CONFIG;
|
||||
|
||||
public final static int SERVICE_QUERY_CONFIG = 0x0001;
|
||||
public final static int SERVICE_CHANGE_CONFIG = 0x0002;
|
||||
public final static int SERVICE_QUERY_STATUS = 0x0004;
|
||||
public final static int SERVICE_ENUMERATE_DEPENDENTS = 0x0008;
|
||||
public final static int SERVICE_START = 0x0010;
|
||||
public final static int SERVICE_STOP = 0x0020;
|
||||
public final static int SERVICE_PAUSE_CONTINUE = 0x0040;
|
||||
public final static int SERVICE_INTERROGATE = 0x0080;
|
||||
public final static int SERVICE_USER_DEFINED_CONTROL = 0x0100;
|
||||
|
||||
public final static int SERVICE_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||
SERVICE_QUERY_CONFIG |
|
||||
SERVICE_CHANGE_CONFIG |
|
||||
SERVICE_QUERY_STATUS |
|
||||
SERVICE_ENUMERATE_DEPENDENTS |
|
||||
SERVICE_START |
|
||||
SERVICE_STOP |
|
||||
SERVICE_PAUSE_CONTINUE |
|
||||
SERVICE_INTERROGATE |
|
||||
SERVICE_USER_DEFINED_CONTROL;
|
||||
|
||||
public final static int SERVICE_CONFIG_DESCRIPTION = 1;
|
||||
public final static int SERVICE_CONFIG_FAILURE_ACTIONS = 2;
|
||||
|
||||
public final static int SERVICE_KERNEL_DRIVER = 0x00000001;
|
||||
public final static int SERVICE_FILE_SYSTEM_DRIVER = 0x00000002;
|
||||
public final static int SERVICE_ADAPTER = 0x00000004;
|
||||
public final static int SERVICE_RECOGNIZER_DRIVER = 0x00000008;
|
||||
|
||||
public final static int SERVICE_DRIVER = SERVICE_KERNEL_DRIVER |
|
||||
SERVICE_FILE_SYSTEM_DRIVER |
|
||||
SERVICE_RECOGNIZER_DRIVER;
|
||||
|
||||
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
||||
public final static int SERVICE_WIN32_SHARE_PROCESS = 0x00000020;
|
||||
public final static int SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS;
|
||||
|
||||
public final static int SERVICE_INTERACTIVE_PROCESS = 0x00000100;
|
||||
|
||||
public final static int SERVICE_TYPE_ALL = SERVICE_WIN32 |
|
||||
SERVICE_ADAPTER |
|
||||
SERVICE_DRIVER |
|
||||
SERVICE_INTERACTIVE_PROCESS;
|
||||
|
||||
public final static int SERVICE_BOOT_START = 0x00000000;
|
||||
public final static int SERVICE_SYSTEM_START = 0x00000001;
|
||||
public final static int SERVICE_AUTO_START = 0x00000002;
|
||||
public final static int SERVICE_DEMAND_START = 0x00000003;
|
||||
public final static int SERVICE_DISABLED = 0x00000004;
|
||||
|
||||
public final static int SERVICE_ERROR_IGNORE = 0x00000000;
|
||||
public final static int SERVICE_ERROR_NORMAL = 0x00000001;
|
||||
public final static int SERVICE_ERROR_SEVERE = 0x00000002;
|
||||
public final static int SERVICE_ERROR_CRITICAL = 0x00000003;
|
||||
}
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
/*
|
||||
* TestService.java
|
||||
*
|
||||
* Created on 12. September 2007, 12:49
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
/**
|
||||
* TestService.
|
||||
*/
|
||||
public class TestService extends Win32Service {
|
||||
|
||||
/**
|
||||
* main.
|
||||
* @param args arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
TestService service = new TestService();
|
||||
|
||||
if(args.length == 1) {
|
||||
|
||||
if(args[0].equalsIgnoreCase("install")) {
|
||||
System.out.println(service.install("TestService DisplayName", "TestService Description",
|
||||
null, null, null));
|
||||
|
||||
} else if(args[0].equalsIgnoreCase("uninstall")) {
|
||||
System.out.println(service.uninstall());
|
||||
|
||||
} else {
|
||||
System.out.println("Arguments:");
|
||||
System.out.println("install = install service");
|
||||
System.out.println("uninstall = uninstall service");
|
||||
System.out.println("<none> = run service");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
} else {
|
||||
service.init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of TestService.
|
||||
*/
|
||||
public TestService() {
|
||||
super("TestService");
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called on start.
|
||||
*/
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called on stop.
|
||||
*/
|
||||
public void onStop() {
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* TestService.java
|
||||
*
|
||||
* Created on 12. September 2007, 12:49
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
/**
|
||||
* TestService.
|
||||
*/
|
||||
public class TestService extends Win32Service {
|
||||
|
||||
/**
|
||||
* main.
|
||||
* @param args arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
TestService service = new TestService();
|
||||
|
||||
if(args.length == 1) {
|
||||
|
||||
if(args[0].equalsIgnoreCase("install")) {
|
||||
System.out.println(service.install("TestService DisplayName", "TestService Description",
|
||||
null, null, null));
|
||||
|
||||
} else if(args[0].equalsIgnoreCase("uninstall")) {
|
||||
System.out.println(service.uninstall());
|
||||
|
||||
} else {
|
||||
System.out.println("Arguments:");
|
||||
System.out.println("install = install service");
|
||||
System.out.println("uninstall = uninstall service");
|
||||
System.out.println("<none> = run service");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
} else {
|
||||
service.init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of TestService.
|
||||
*/
|
||||
public TestService() {
|
||||
super("TestService");
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called on start.
|
||||
*/
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called on stop.
|
||||
*/
|
||||
public void onStop() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,310 +1,310 @@
|
||||
/*
|
||||
* Win32Service.java
|
||||
*
|
||||
* Created on 12. September 2007, 12:05
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
import jnacontrib.jna.*;
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
/**
|
||||
* Baseclass for a Win32 service.
|
||||
*/
|
||||
public abstract class Win32Service {
|
||||
protected String serviceName;
|
||||
private ServiceMain serviceMain;
|
||||
private ServiceControl serviceControl;
|
||||
private Pointer serviceStatusHandle;
|
||||
private Object waitObject = new Object();
|
||||
|
||||
/**
|
||||
* Creates a new instance of Win32Service.
|
||||
*
|
||||
* @param serviceName internal name of the service
|
||||
*/
|
||||
public Win32Service(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the service.
|
||||
*
|
||||
* @param displayName visible name
|
||||
* @param description description
|
||||
* @param dependencies array of other services to depend on or null
|
||||
* @param account service account or null for LocalSystem
|
||||
* @param password password for service account or null
|
||||
* @throws java.lang.Exception
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password) {
|
||||
return(install(displayName, description, dependencies, account, password, "java.exe -cp \"" +
|
||||
System.getProperty("java.class.path") + "\" -Xrs " + this.getClass().getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the service.
|
||||
*
|
||||
* @return true on success
|
||||
* @param displayName visible name
|
||||
* @param description description
|
||||
* @param dependencies array of other services to depend on or null
|
||||
* @param account service account or null for LocalSystem
|
||||
* @param password password for service account or null
|
||||
* @param command command line to start the service
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password, String command) {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_DESCRIPTION desc;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
String dep = "";
|
||||
|
||||
if(dependencies != null) {
|
||||
for(String s : dependencies) {
|
||||
dep += s + "\0";
|
||||
}
|
||||
}
|
||||
dep += "\0";
|
||||
|
||||
desc = new Advapi32.SERVICE_DESCRIPTION();
|
||||
desc.lpDescription = description;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.CreateService(serviceManager, serviceName, displayName,
|
||||
WINSVC.SERVICE_ALL_ACCESS, WINSVC.SERVICE_WIN32_OWN_PROCESS, WINSVC.SERVICE_DEMAND_START,
|
||||
WINSVC.SERVICE_ERROR_NORMAL,
|
||||
command,
|
||||
null, null, dep, account, password);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.ChangeServiceConfig2(service, WINSVC.SERVICE_CONFIG_DESCRIPTION, desc);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall the service.
|
||||
*
|
||||
* @throws java.lang.Exception
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean uninstall() {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINSVC.SERVICE_ALL_ACCESS);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.DeleteService(service);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the ServiceControlManager to start the service.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean start() {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.StartService(service, 0, null);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the ServiceControlManager to stop the service.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean stop() throws Exception {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
Advapi32.SERVICE_STATUS serviceStatus;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(service != null) {
|
||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||
success = advapi32.ControlService(service, WINSVC.SERVICE_CONTROL_STOP, serviceStatus);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the service, connect to the ServiceControlManager.
|
||||
*/
|
||||
public void init() {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_TABLE_ENTRY entry;
|
||||
|
||||
serviceMain = new ServiceMain();
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
entry = new Advapi32.SERVICE_TABLE_ENTRY();
|
||||
entry.lpServiceName = serviceName;
|
||||
entry.lpServiceProc = serviceMain;
|
||||
|
||||
advapi32.StartServiceCtrlDispatcher(entry.toArray(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a handle to the ServiceControlManager.
|
||||
*
|
||||
* @param machine name of the machine or null for localhost
|
||||
* @param access access flags
|
||||
* @return handle to ServiceControlManager or null when failed
|
||||
*/
|
||||
private Pointer openServiceControlManager(String machine, int access) {
|
||||
Pointer handle = null;
|
||||
Advapi32 advapi32;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = advapi32.OpenSCManager(machine, null, access);
|
||||
return(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report service status to the ServiceControlManager.
|
||||
*
|
||||
* @param status status
|
||||
* @param win32ExitCode exit code
|
||||
* @param waitHint time to wait
|
||||
*/
|
||||
private void reportStatus(int status, int win32ExitCode, int waitHint) {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_STATUS serviceStatus;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||
serviceStatus.dwServiceType = WINNT.SERVICE_WIN32_OWN_PROCESS;
|
||||
serviceStatus.dwControlsAccepted = WINSVC.SERVICE_ACCEPT_STOP | WINSVC.SERVICE_ACCEPT_SHUTDOWN;
|
||||
serviceStatus.dwWin32ExitCode = win32ExitCode;
|
||||
serviceStatus.dwWaitHint = waitHint;
|
||||
serviceStatus.dwCurrentState = status;
|
||||
|
||||
advapi32.SetServiceStatus(serviceStatusHandle, serviceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when service is starting.
|
||||
*/
|
||||
public abstract void onStart();
|
||||
|
||||
/*
|
||||
* Called when service should stop.
|
||||
*/
|
||||
public abstract void onStop();
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the service main function.
|
||||
*/
|
||||
private class ServiceMain implements Advapi32.SERVICE_MAIN_FUNCTION {
|
||||
|
||||
/**
|
||||
* Called when the service is starting.
|
||||
*
|
||||
* @param dwArgc number of arguments
|
||||
* @param lpszArgv pointer to arguments
|
||||
*/
|
||||
public void callback(int dwArgc, Pointer lpszArgv) {
|
||||
Advapi32 advapi32;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceControl = new ServiceControl();
|
||||
serviceStatusHandle = advapi32.RegisterServiceCtrlHandlerEx(serviceName, serviceControl, null);
|
||||
|
||||
reportStatus(WINSVC.SERVICE_START_PENDING, WINERROR.NO_ERROR, 3000);
|
||||
reportStatus(WINSVC.SERVICE_RUNNING, WINERROR.NO_ERROR, 0);
|
||||
|
||||
onStart();
|
||||
|
||||
try {
|
||||
synchronized(waitObject) {
|
||||
waitObject.wait();
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
reportStatus(WINSVC.SERVICE_STOPPED, WINERROR.NO_ERROR, 0);
|
||||
|
||||
// Avoid returning from ServiceMain, which will cause a crash
|
||||
// See http://support.microsoft.com/kb/201349, which recommends
|
||||
// having init() wait for this thread.
|
||||
// Waiting on this thread in init() won't fix the crash, though.
|
||||
//System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the service control function.
|
||||
*/
|
||||
private class ServiceControl implements Advapi32.HandlerEx {
|
||||
|
||||
/**
|
||||
* Called when the service get a control code.
|
||||
*
|
||||
* @param dwControl
|
||||
* @param dwEventType
|
||||
* @param lpEventData
|
||||
* @param lpContext
|
||||
*/
|
||||
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext) {
|
||||
switch(dwControl) {
|
||||
case WINSVC.SERVICE_CONTROL_STOP:
|
||||
case WINSVC.SERVICE_CONTROL_SHUTDOWN:
|
||||
reportStatus(WINSVC.SERVICE_STOP_PENDING, WINERROR.NO_ERROR, 5000);
|
||||
onStop();
|
||||
synchronized(waitObject) {
|
||||
waitObject.notifyAll();
|
||||
}
|
||||
}
|
||||
return WINERROR.NO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Win32Service.java
|
||||
*
|
||||
* Created on 12. September 2007, 12:05
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
import jnacontrib.jna.*;
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
/**
|
||||
* Baseclass for a Win32 service.
|
||||
*/
|
||||
public abstract class Win32Service {
|
||||
protected String serviceName;
|
||||
private ServiceMain serviceMain;
|
||||
private ServiceControl serviceControl;
|
||||
private Pointer serviceStatusHandle;
|
||||
private Object waitObject = new Object();
|
||||
|
||||
/**
|
||||
* Creates a new instance of Win32Service.
|
||||
*
|
||||
* @param serviceName internal name of the service
|
||||
*/
|
||||
public Win32Service(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the service.
|
||||
*
|
||||
* @param displayName visible name
|
||||
* @param description description
|
||||
* @param dependencies array of other services to depend on or null
|
||||
* @param account service account or null for LocalSystem
|
||||
* @param password password for service account or null
|
||||
* @throws java.lang.Exception
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password) {
|
||||
return(install(displayName, description, dependencies, account, password, "java.exe -cp \"" +
|
||||
System.getProperty("java.class.path") + "\" -Xrs " + this.getClass().getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the service.
|
||||
*
|
||||
* @return true on success
|
||||
* @param displayName visible name
|
||||
* @param description description
|
||||
* @param dependencies array of other services to depend on or null
|
||||
* @param account service account or null for LocalSystem
|
||||
* @param password password for service account or null
|
||||
* @param command command line to start the service
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password, String command) {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_DESCRIPTION desc;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
String dep = "";
|
||||
|
||||
if(dependencies != null) {
|
||||
for(String s : dependencies) {
|
||||
dep += s + "\0";
|
||||
}
|
||||
}
|
||||
dep += "\0";
|
||||
|
||||
desc = new Advapi32.SERVICE_DESCRIPTION();
|
||||
desc.lpDescription = description;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.CreateService(serviceManager, serviceName, displayName,
|
||||
WINSVC.SERVICE_ALL_ACCESS, WINSVC.SERVICE_WIN32_OWN_PROCESS, WINSVC.SERVICE_DEMAND_START,
|
||||
WINSVC.SERVICE_ERROR_NORMAL,
|
||||
command,
|
||||
null, null, dep, account, password);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.ChangeServiceConfig2(service, WINSVC.SERVICE_CONFIG_DESCRIPTION, desc);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall the service.
|
||||
*
|
||||
* @throws java.lang.Exception
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean uninstall() {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINSVC.SERVICE_ALL_ACCESS);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.DeleteService(service);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the ServiceControlManager to start the service.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean start() {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.StartService(service, 0, null);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the ServiceControlManager to stop the service.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean stop() throws Exception {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
Advapi32.SERVICE_STATUS serviceStatus;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(service != null) {
|
||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||
success = advapi32.ControlService(service, WINSVC.SERVICE_CONTROL_STOP, serviceStatus);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the service, connect to the ServiceControlManager.
|
||||
*/
|
||||
public void init() {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_TABLE_ENTRY entry;
|
||||
|
||||
serviceMain = new ServiceMain();
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
entry = new Advapi32.SERVICE_TABLE_ENTRY();
|
||||
entry.lpServiceName = serviceName;
|
||||
entry.lpServiceProc = serviceMain;
|
||||
|
||||
advapi32.StartServiceCtrlDispatcher(entry.toArray(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a handle to the ServiceControlManager.
|
||||
*
|
||||
* @param machine name of the machine or null for localhost
|
||||
* @param access access flags
|
||||
* @return handle to ServiceControlManager or null when failed
|
||||
*/
|
||||
private Pointer openServiceControlManager(String machine, int access) {
|
||||
Pointer handle = null;
|
||||
Advapi32 advapi32;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = advapi32.OpenSCManager(machine, null, access);
|
||||
return(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report service status to the ServiceControlManager.
|
||||
*
|
||||
* @param status status
|
||||
* @param win32ExitCode exit code
|
||||
* @param waitHint time to wait
|
||||
*/
|
||||
private void reportStatus(int status, int win32ExitCode, int waitHint) {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_STATUS serviceStatus;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||
serviceStatus.dwServiceType = WINNT.SERVICE_WIN32_OWN_PROCESS;
|
||||
serviceStatus.dwControlsAccepted = WINSVC.SERVICE_ACCEPT_STOP | WINSVC.SERVICE_ACCEPT_SHUTDOWN;
|
||||
serviceStatus.dwWin32ExitCode = win32ExitCode;
|
||||
serviceStatus.dwWaitHint = waitHint;
|
||||
serviceStatus.dwCurrentState = status;
|
||||
|
||||
advapi32.SetServiceStatus(serviceStatusHandle, serviceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when service is starting.
|
||||
*/
|
||||
public abstract void onStart();
|
||||
|
||||
/*
|
||||
* Called when service should stop.
|
||||
*/
|
||||
public abstract void onStop();
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the service main function.
|
||||
*/
|
||||
private class ServiceMain implements Advapi32.SERVICE_MAIN_FUNCTION {
|
||||
|
||||
/**
|
||||
* Called when the service is starting.
|
||||
*
|
||||
* @param dwArgc number of arguments
|
||||
* @param lpszArgv pointer to arguments
|
||||
*/
|
||||
public void callback(int dwArgc, Pointer lpszArgv) {
|
||||
Advapi32 advapi32;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceControl = new ServiceControl();
|
||||
serviceStatusHandle = advapi32.RegisterServiceCtrlHandlerEx(serviceName, serviceControl, null);
|
||||
|
||||
reportStatus(WINSVC.SERVICE_START_PENDING, WINERROR.NO_ERROR, 3000);
|
||||
reportStatus(WINSVC.SERVICE_RUNNING, WINERROR.NO_ERROR, 0);
|
||||
|
||||
onStart();
|
||||
|
||||
try {
|
||||
synchronized(waitObject) {
|
||||
waitObject.wait();
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
reportStatus(WINSVC.SERVICE_STOPPED, WINERROR.NO_ERROR, 0);
|
||||
|
||||
// Avoid returning from ServiceMain, which will cause a crash
|
||||
// See http://support.microsoft.com/kb/201349, which recommends
|
||||
// having init() wait for this thread.
|
||||
// Waiting on this thread in init() won't fix the crash, though.
|
||||
//System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the service control function.
|
||||
*/
|
||||
private class ServiceControl implements Advapi32.HandlerEx {
|
||||
|
||||
/**
|
||||
* Called when the service get a control code.
|
||||
*
|
||||
* @param dwControl
|
||||
* @param dwEventType
|
||||
* @param lpEventData
|
||||
* @param lpContext
|
||||
*/
|
||||
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext) {
|
||||
switch(dwControl) {
|
||||
case WINSVC.SERVICE_CONTROL_STOP:
|
||||
case WINSVC.SERVICE_CONTROL_SHUTDOWN:
|
||||
reportStatus(WINSVC.SERVICE_STOP_PENDING, WINERROR.NO_ERROR, 5000);
|
||||
onStop();
|
||||
synchronized(waitObject) {
|
||||
waitObject.notifyAll();
|
||||
}
|
||||
}
|
||||
return WINERROR.NO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+182
-89
@@ -1,89 +1,182 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="platform" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project platform.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="JnaContrib-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
<condition property="tests.platform" value="test-win32">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition property="tests.platform" value="test-osx">
|
||||
<os family="mac"/>
|
||||
</condition>
|
||||
<target name="test" depends="init,compile-test" description="Run unit tests." if="tests.platform">
|
||||
<antcall target="${tests.platform}" />
|
||||
</target>
|
||||
<target name="test-report">
|
||||
<junitreport todir="${build.test.results.dir}">
|
||||
<fileset dir="${build.test.results.dir}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<report todir="${build.test.results.dir}"/>
|
||||
</junitreport>
|
||||
<property name="build.test.results.dir.abs" location="${build.test.results.dir}"/>
|
||||
<echo message="View test report in file://${build.test.results.dir.abs}/index.html" />
|
||||
</target>
|
||||
<target name="test-osx">
|
||||
<echo>No platform tests yet for OSX</echo>
|
||||
</target>
|
||||
<target name="test-win32" depends="-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" />
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="platform" default="default" basedir=".">
|
||||
<description>Builds and tests platform-specific code.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="JnaContrib-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
|
||||
<target name="-do-jar-without-manifest">
|
||||
<jar jarfile="${dist.jar}" compress="${jar.compress}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="com.sun.jna.Native"/>
|
||||
<attribute name="Manifest-Version" value="1.0"/>
|
||||
<attribute name="Implementation-Title" value="${impl.title}"/>
|
||||
<attribute name="Implementation-Vendor" value="${vendor}"/>
|
||||
<attribute name="Implementation-Version" value="${impl.version}"/>
|
||||
<attribute name="Specification-Title" value="${spec.title}"/>
|
||||
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
|
||||
<attribute name="Specification-Version" value="${spec.version}"/>
|
||||
<!--
|
||||
OSGi Bundle attributes
|
||||
See http://www.osgi.org/Specifications/Reference
|
||||
-->
|
||||
<attribute name="Bundle-Category" value="jni"/>
|
||||
<attribute name="Bundle-ManifestVersion" value="2"/>
|
||||
<attribute name="Bundle-Name" value="jna-platform"/>
|
||||
<attribute name="Bundle-Description" value="JNA Platform Library"/>
|
||||
<attribute name="Bundle-SymbolicName" value="com.sun.jna.platform"/>
|
||||
<attribute name="Bundle-Version" value="${osgi.version}"/>
|
||||
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.4"/>
|
||||
<attribute name="Bundle-Vendor" value="${vendor}"/>
|
||||
<attribute name="Require-Bundle" value="com.sun.jna;bundle-version="${osgi.version}""/>
|
||||
<attribute name="Export-Package"
|
||||
value="
|
||||
com.sun.jna.platform,
|
||||
com.sun.jna.platform.dnd,
|
||||
com.sun.jna.platform.mac,
|
||||
com.sun.jna.platform.unix,
|
||||
com.sun.jna.platform.win32,
|
||||
com.sun.jna.platform.win32.COM,
|
||||
com.sun.jna.platform.win32.COM.tlb,
|
||||
com.sun.jna.platform.win32.COM.tlb.imp,
|
||||
com.sun.jna.platform.wince
|
||||
"/>
|
||||
</manifest>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="test" depends="init,compile,compile-test,-pre-test-run" description="Run platform unit tests.">
|
||||
<echo>Running platform tests: ${test.src.dir}</echo>
|
||||
<property name="test.fork" value="yes"/>
|
||||
<property name="build.test.results.dir.abs" location="${build.test.results.dir}"/>
|
||||
<mkdir dir="${build.test.results.dir.abs}"/>
|
||||
<echo>Saving test results in ${build.test.results.dir.abs}</echo>
|
||||
<condition property="tests.platform" value="**/mac/**">
|
||||
<os family="mac"/>
|
||||
</condition>
|
||||
<condition property="tests.platform" value="**/win32/**">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition property="tests.platform" value="**/unix/**">
|
||||
<os family="unix"/>
|
||||
</condition>
|
||||
<property name="tests.platform" value=""/>
|
||||
<property name="tests.exclude" value=""/>
|
||||
<property name="tests.exclude-patterns" value=""/>
|
||||
<condition property="java.awt.headless" value="true">
|
||||
<isset property="headless"/>
|
||||
</condition>
|
||||
<condition property="vmopt.arch" value="-d64" else="-Dignore">
|
||||
<and>
|
||||
<!-- Sun 64-bit VM for windows doesn't support the -d64 switch -->
|
||||
<not><os family="windows"/></not>
|
||||
<equals arg1="${vm.arch}" arg2="-d64" trim="true"/>
|
||||
</and>
|
||||
</condition>
|
||||
<propertyset id="headless">
|
||||
<propertyref prefix="java.awt.headless"/>
|
||||
</propertyset>
|
||||
<echo>tests.platform=${tests.platform}</echo>
|
||||
<junit fork="${test.fork}" failureproperty="testfailure" tempdir="${build.dir}">
|
||||
<!-- optionally run headless -->
|
||||
<syspropertyset refid="headless"/>
|
||||
<!-- avoid VM conflicts with JNA protected mode -->
|
||||
<env key="${ld.preload.name}" file="${libjsig}"/>
|
||||
<!-- Ignore any system install of JNA -->
|
||||
<sysproperty key="jna.nosys" value="true"/>
|
||||
<!-- Avoid VM crashes, if possible -->
|
||||
<sysproperty key="jna.protected" value="true"/>
|
||||
<sysproperty key="jna.builddir" file="${file.reference.jna.build}"/>
|
||||
<jvmarg value="${vmopt.arch}"/>
|
||||
<classpath><path path="${run.test.classpath}"/><path path="${file.reference.jna.build}/test-classes"/></classpath>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<batchtest todir="${build.test.results.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="${tests.exclude-patterns}">
|
||||
<!-- Until StructureFieldOrderTest gets fixed up a little -->
|
||||
<exclude name="**/StructureFieldOrderTest.java"/>
|
||||
<include name="com/sun/jna/platform/*Test.java"/>
|
||||
<include name="${tests.platform}"/>
|
||||
<exclude name="${tests.exclude}"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
<junitreport todir="${build.test.results.dir}">
|
||||
<fileset dir="${build.test.results.dir}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<report todir="${build.test.results.dir}"/>
|
||||
</junitreport>
|
||||
<echo message="View test report in file://${build.test.results.dir.abs}/index.html" />
|
||||
<fail if="testfailure">One or more tests failed</fail>
|
||||
</target>
|
||||
|
||||
<!-- One-off test to check field order definitions -->
|
||||
<target name="test-field-order" depends="-pre-test-run-single" >
|
||||
<!-- @todo How to ensure sys prop: jna.nosys=true is seen in tests? -->
|
||||
<!--<property name="test.includes" value="com/sun/jna/platform/**/*.java"/>-->
|
||||
<property name="test.includes" value="com/sun/jna/platform/StructureFieldOrderTest.java"/>
|
||||
<property name="javac.includes" value="**/*"/>
|
||||
<antcall target="test-single"/>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -1,59 +1,67 @@
|
||||
application.args=
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/platform.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
file.reference.jna.jar=../../build/jna.jar
|
||||
libs.junit.classpath=../../lib/junit.jar
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.jna.jar};
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.source=1.5
|
||||
javac.target=1.5
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
application.args=
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/jna-platform.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
file.reference.jna.jar=../../build/jna.jar
|
||||
file.reference.jna-test.jar=../../build/jna-test.jar
|
||||
libs.junit.classpath=../../lib/junit.jar
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.jna.jar}:\
|
||||
${file.reference.jna.build}/test-classes
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.source=1.5
|
||||
javac.target=1.5
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${file.reference.jna-test.jar}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
../../lib/test/reflections-0.9.8.jar:\
|
||||
../../lib/test/guava-11.0.2.jar:\
|
||||
../../lib/test/javassist-3.12.1.GA.jar:\
|
||||
../../lib/test/slf4j-api-1.6.1.jar:\
|
||||
../../lib/test/dom4j-1.6.1.jar:\
|
||||
${build.test.classes.dir}
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2014 Martin Steiger
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.jna.platform;
|
||||
|
||||
import com.sun.jna.FromNativeContext;
|
||||
import com.sun.jna.ToNativeContext;
|
||||
import com.sun.jna.TypeConverter;
|
||||
|
||||
/**
|
||||
* A {@link TypeConverter} that maps an integer enum value to
|
||||
* an actual Java enum.
|
||||
* @param <T> the enum type
|
||||
* @author Martin Steiger
|
||||
*/
|
||||
public class EnumConverter<T extends Enum<T>> implements TypeConverter {
|
||||
|
||||
private final Class<T> clazz;
|
||||
|
||||
/**
|
||||
* @param clazz the enum class
|
||||
*/
|
||||
public EnumConverter(Class<T> clazz)
|
||||
{
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromNative(Object input, FromNativeContext context) {
|
||||
Integer i = (Integer) input;
|
||||
|
||||
T[] vals = clazz.getEnumConstants();
|
||||
return vals[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer toNative(Object input, ToNativeContext context) {
|
||||
T t = clazz.cast(input);
|
||||
|
||||
return Integer.valueOf(t.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Integer> nativeType() {
|
||||
return Integer.class;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright 2014 Martin Steiger
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sun.jna.platform;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sun.jna.platform.win32.FlagEnum;
|
||||
|
||||
/**
|
||||
* Several helper methods to convert integer flag (sets)
|
||||
* into enum (sets)
|
||||
* @author Martin Steiger
|
||||
*/
|
||||
public class EnumUtils
|
||||
{
|
||||
/**
|
||||
* Uninitialized integer flag
|
||||
*/
|
||||
public static final int UNINITIALIZED = -1;
|
||||
|
||||
/**
|
||||
* @param val the enum
|
||||
* @return the index of the enum in the enum list
|
||||
*/
|
||||
public static <E extends Enum<E>> int toInteger(E val)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
E[] vals = (E[]) val.getClass().getEnumConstants();
|
||||
|
||||
for (int idx = 0; idx < vals.length; idx++)
|
||||
{
|
||||
if (vals[idx] == val)
|
||||
return idx;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idx the enum index
|
||||
* @param clazz the enum class
|
||||
* @return the enum at position idx
|
||||
*/
|
||||
public static <E extends Enum<E>> E fromInteger(int idx, Class<E> clazz)
|
||||
{
|
||||
if (idx == UNINITIALIZED)
|
||||
return null;
|
||||
|
||||
E[] vals = clazz.getEnumConstants();
|
||||
return vals[idx];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flags the ORed flags
|
||||
* @param clazz the enum class
|
||||
* @return the representing set
|
||||
*/
|
||||
public static <T extends FlagEnum> Set<T> setFromInteger(int flags, Class<T> clazz)
|
||||
{
|
||||
T[] vals = clazz.getEnumConstants();
|
||||
Set<T> result = new HashSet<T>();
|
||||
|
||||
for (T val : vals)
|
||||
{
|
||||
if ((flags & val.getFlag()) != 0)
|
||||
{
|
||||
result.add(val);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param set the set to convert
|
||||
* @return the flags combined into an integer
|
||||
*/
|
||||
public static <T extends FlagEnum> int setToInteger(Set<T> set) {
|
||||
int sum = 0;
|
||||
|
||||
for (T t : set)
|
||||
{
|
||||
sum |= t.getFlag();
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ import com.sun.jna.platform.win32.WinGDI.BITMAPINFO;
|
||||
import com.sun.jna.platform.win32.WinNT.HANDLE;
|
||||
import com.sun.jna.platform.win32.WinUser;
|
||||
import com.sun.jna.platform.win32.WinUser.BLENDFUNCTION;
|
||||
import com.sun.jna.platform.win32.WinUser.POINT;
|
||||
import com.sun.jna.platform.win32.WinDef.POINT;
|
||||
import com.sun.jna.platform.win32.WinUser.SIZE;
|
||||
import com.sun.jna.ptr.ByteByReference;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
@@ -17,19 +17,22 @@
|
||||
|
||||
package com.sun.jna.platform.mac;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Callback;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/**
|
||||
* Author: Denis Tulskiy
|
||||
* Date: 7/25/11
|
||||
*/
|
||||
public interface Carbon {
|
||||
public interface Carbon extends Library {
|
||||
public static Carbon INSTANCE = (Carbon) Native.loadLibrary("Carbon", Carbon.class);
|
||||
|
||||
public static final int cmdKey = 0x0100;
|
||||
@@ -70,7 +73,8 @@ public interface Carbon {
|
||||
public class EventTypeSpec extends Structure {
|
||||
public int eventClass;
|
||||
public int eventKind;
|
||||
{ setFieldOrder(new String[] { "eventClass", "eventKind" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "eventClass", "eventKind" }); }
|
||||
}
|
||||
|
||||
public static class EventHotKeyID extends Structure {
|
||||
@@ -78,7 +82,8 @@ public interface Carbon {
|
||||
public int id;
|
||||
|
||||
public static class ByValue extends EventHotKeyID implements Structure.ByValue { }
|
||||
{ setFieldOrder(new String[] { "signature", "id" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "signature", "id" }); }
|
||||
}
|
||||
|
||||
public static interface EventHandlerProcPtr extends Callback {
|
||||
|
||||
@@ -1,57 +1,86 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.mac;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
import com.sun.jna.platform.FileUtils;
|
||||
|
||||
public class MacFileUtils extends FileUtils {
|
||||
|
||||
public boolean hasTrash() { return true; }
|
||||
|
||||
public interface FileManager extends Library {
|
||||
int kFSFileOperationDefaultOptions = 0;
|
||||
int kFSFileOperationsOverwrite = 0x01;
|
||||
int kFSFileOperationsSkipSourcePermissionErrors = 0x02;
|
||||
int kFSFileOperationsDoNotMoveAcrossVolumes = 0x04;
|
||||
int kFSFileOperationsSkipPreflight = 0x08;
|
||||
|
||||
public FileManager INSTANCE = (FileManager)Native.loadLibrary("CoreServices", FileManager.class);
|
||||
int FSPathMoveObjectToTrashSync(String src, PointerByReference target, int options);
|
||||
}
|
||||
|
||||
public void moveToTrash(File[] files) throws IOException {
|
||||
File home = new File(System.getProperty("user.home"));
|
||||
File trash = new File(home, ".Trash");
|
||||
if (!trash.exists()) {
|
||||
throw new IOException("The Trash was not found in its expected location (" + trash + ")");
|
||||
}
|
||||
List<File> failed = new ArrayList<File>();
|
||||
for (int i=0;i < files.length;i++) {
|
||||
File src = files[i];
|
||||
if (FileManager.INSTANCE.FSPathMoveObjectToTrashSync(src.getAbsolutePath(), null, 0) != 0) {
|
||||
failed.add(src);
|
||||
}
|
||||
}
|
||||
if (failed.size() > 0) {
|
||||
throw new IOException("The following files could not be trashed: " + failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Copyright (c) 2007-2013 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.mac;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
import com.sun.jna.ptr.ByteByReference;
|
||||
import com.sun.jna.platform.FileUtils;
|
||||
|
||||
public class MacFileUtils extends FileUtils {
|
||||
|
||||
public boolean hasTrash() { return true; }
|
||||
|
||||
public interface FileManager extends Library {
|
||||
|
||||
public FileManager INSTANCE = (FileManager)Native.loadLibrary("CoreServices", FileManager.class);
|
||||
|
||||
int kFSFileOperationDefaultOptions = 0;
|
||||
int kFSFileOperationsOverwrite = 0x01;
|
||||
int kFSFileOperationsSkipSourcePermissionErrors = 0x02;
|
||||
int kFSFileOperationsDoNotMoveAcrossVolumes = 0x04;
|
||||
int kFSFileOperationsSkipPreflight = 0x08;
|
||||
|
||||
int kFSPathDefaultOptions = 0x0;
|
||||
int kFSPathMakeRefDoNotFollowLeafSymlink = 0x01;
|
||||
|
||||
class FSRef extends Structure {
|
||||
public byte[] hidden = new byte[80];
|
||||
protected List getFieldOrder() { return Arrays.asList(new String[] { "hidden" }); }
|
||||
}
|
||||
|
||||
// Deprecated; use trashItemAtURL instead:
|
||||
// https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html#//apple_ref/occ/instm/NSFileManager/trashItemAtURL:resultingItemURL:error:
|
||||
int FSRefMakePath(FSRef fsref, byte[] path, int maxPathSize);
|
||||
int FSPathMakeRef(String source, int options, ByteByReference isDirectory);
|
||||
int FSPathMakeRefWithOptions(String source, int options, FSRef fsref, ByteByReference isDirectory);
|
||||
int FSPathMoveObjectToTrashSync(String source, PointerByReference target, int options);
|
||||
int FSMoveObjectToTrashSync(FSRef source, FSRef target, int options);
|
||||
}
|
||||
|
||||
public void moveToTrash(File[] files) throws IOException {
|
||||
File home = new File(System.getProperty("user.home"));
|
||||
File trash = new File(home, ".Trash");
|
||||
if (!trash.exists()) {
|
||||
throw new IOException("The Trash was not found in its expected location (" + trash + ")");
|
||||
}
|
||||
List<String> failed = new ArrayList<String>();
|
||||
for (int i=0;i < files.length;i++) {
|
||||
File src = files[i];
|
||||
FileManager.FSRef fsref = new FileManager.FSRef();
|
||||
int status = FileManager.INSTANCE.FSPathMakeRefWithOptions(src.getAbsolutePath(),
|
||||
FileManager.kFSPathMakeRefDoNotFollowLeafSymlink,
|
||||
fsref, null);
|
||||
if (status != 0) {
|
||||
failed.add(src + " (FSRef: " + status + ")");
|
||||
continue;
|
||||
}
|
||||
status = FileManager.INSTANCE.FSMoveObjectToTrashSync(fsref, null, 0);
|
||||
if (status != 0) {
|
||||
failed.add(src + " (" + status + ")");
|
||||
}
|
||||
}
|
||||
if (failed.size() > 0) {
|
||||
throw new IOException("The following files could not be trashed: " + failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.unix;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Callback;
|
||||
import com.sun.jna.FromNativeContext;
|
||||
import com.sun.jna.Library;
|
||||
@@ -277,7 +280,9 @@ public interface X11 extends Library {
|
||||
public short green, greenMask;
|
||||
public short blue, blueMask;
|
||||
public short alpha, alphaMask;
|
||||
{ setFieldOrder(new String[] { "red", "redMask", "green", "greenMask", "blue", "blueMask", "alpha", "alphaMask" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "red", "redMask", "green", "greenMask", "blue", "blueMask", "alpha", "alphaMask" });
|
||||
}
|
||||
}
|
||||
class PictFormat extends NativeLong {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -290,7 +295,9 @@ public interface X11 extends Library {
|
||||
public int depth;
|
||||
public XRenderDirectFormat direct;
|
||||
public Colormap colormap;
|
||||
{ setFieldOrder(new String[] { "id", "type", "depth", "direct", "colormap" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "id", "type", "depth", "direct", "colormap" });
|
||||
}
|
||||
}
|
||||
int PictTypeIndexed = 0x0;
|
||||
int PictTypeDirect = 0x1;
|
||||
@@ -339,14 +346,18 @@ public interface X11 extends Library {
|
||||
class XInputClassInfoByReference extends Structure implements Structure.ByReference {
|
||||
public byte input_class;
|
||||
public byte event_type_base;
|
||||
{ setFieldOrder(new String[] { "input_class", "event_type_base" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "input_class", "event_type_base" });
|
||||
}
|
||||
}
|
||||
|
||||
class XDeviceByReference extends Structure implements Structure.ByReference {
|
||||
public XID device_id;
|
||||
public int num_classes;
|
||||
public XInputClassInfoByReference classes;
|
||||
{ setFieldOrder(new String[] { "device_id", "num_classes", "classes" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "device_id", "num_classes", "classes" });
|
||||
}
|
||||
}
|
||||
|
||||
X11 INSTANCE = (X11)Native.loadLibrary("X11", X11.class);
|
||||
@@ -374,7 +385,9 @@ public interface X11 extends Library {
|
||||
public int icon_x, icon_y;
|
||||
public Pixmap icon_mask;
|
||||
public XID window_group;
|
||||
{ setFieldOrder(new String[] { "flags", "input", "initial_state", "icon_pixmap", "icon_window", "icon_x", "icon_y", "icon_mask", "window_group" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "flags", "input", "initial_state", "icon_pixmap", "icon_window", "icon_x", "icon_y", "icon_mask", "window_group" });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -390,7 +403,9 @@ public interface X11 extends Library {
|
||||
public Atom encoding;
|
||||
public int format;
|
||||
public NativeLong nitems;
|
||||
{ setFieldOrder(new String[] { "value", "encoding", "format", "nitems" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "value", "encoding", "format", "nitems" });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -419,12 +434,14 @@ public interface X11 extends Library {
|
||||
public static class Aspect extends Structure {
|
||||
public int x; // numerator
|
||||
public int y; // denominator
|
||||
{ setFieldOrder(new String[] { "x", "y" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y" }); }
|
||||
}
|
||||
public Aspect min_aspect, max_aspect;
|
||||
public int base_width, base_height;
|
||||
public int win_gravity;
|
||||
{ setFieldOrder(new String[] { "flags", "x", "y", "width", "height", "min_width", "min_height", "max_width", "max_height", "width_inc", "height_inc", "min_aspect", "max_aspect", "base_width", "base_height", "win_gravity" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "flags", "x", "y", "width", "height", "min_width", "min_height", "max_width", "max_height", "width_inc", "height_inc", "min_aspect", "max_aspect", "base_width", "base_height", "win_gravity" }); }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -478,7 +495,9 @@ public interface X11 extends Library {
|
||||
public NativeLong do_not_propagate_mask;
|
||||
public boolean override_redirect;
|
||||
public Screen screen;
|
||||
{ setFieldOrder(new String[] { "x", "y", "width", "height", "border_width", "depth", "visual", "root", "c_class", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "colormap", "map_installed", "map_state", "all_event_masks", "your_event_mask", "do_not_propagate_mask", "override_redirect", "screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y", "width", "height", "border_width", "depth", "visual", "root", "c_class", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "colormap", "map_installed", "map_state", "all_event_masks", "your_event_mask", "do_not_propagate_mask", "override_redirect", "screen" });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -516,7 +535,9 @@ public interface X11 extends Library {
|
||||
public boolean override_redirect;
|
||||
public Colormap colormap;
|
||||
public Cursor cursor;
|
||||
{ setFieldOrder(new String[] { "background_pixmap", "background_pixel", "border_pixmap", "border_pixel", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "event_mask", "do_not_propagate_mask", "override_redirect", "colormap", "cursor" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "background_pixmap", "background_pixel", "border_pixmap", "border_pixel", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "event_mask", "do_not_propagate_mask", "override_redirect", "colormap", "cursor" });
|
||||
}
|
||||
}
|
||||
|
||||
int XK_0 = 0x30;
|
||||
@@ -559,25 +580,31 @@ public interface X11 extends Library {
|
||||
public NativeLong blue_mask;
|
||||
public int colormap_size;
|
||||
public int bits_per_rgb;
|
||||
{ setFieldOrder(new String[] { "visual", "visualid", "screen", "depth", "c_class", "red_mask", "green_mask", "blue_mask", "colormap_size", "bits_per_rgb" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "visual", "visualid", "screen", "depth", "c_class", "red_mask", "green_mask", "blue_mask", "colormap_size", "bits_per_rgb" });
|
||||
}
|
||||
}
|
||||
class XPoint extends Structure {
|
||||
public short x, y;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y" });
|
||||
}
|
||||
public XPoint() { this((short)0, (short)0); }
|
||||
public XPoint(short x, short y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
setFieldOrder(new String[] { "x", "y" });
|
||||
}
|
||||
}
|
||||
class XRectangle extends Structure {
|
||||
public short x, y;
|
||||
public short width, height;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y", "width", "height" });
|
||||
}
|
||||
public XRectangle() { this((short)0, (short)0, (short)0, (short)0); }
|
||||
public XRectangle(short x, short y, short width, short height) {
|
||||
this.x = x; this.y = y;
|
||||
this.width = width; this.height = height;
|
||||
setFieldOrder(new String[] { "x", "y", "width", "height" });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,7 +745,9 @@ public interface X11 extends Library {
|
||||
public Pixmap clip_mask; /* bitmap clipping; other calls for rects */
|
||||
public int dash_offset; /* patterned/dashed line information */
|
||||
public byte dashes;
|
||||
{ setFieldOrder(new String[] { "function", "plane_mask", "foreground", "background", "line_width", "line_style", "cap_style", "join_style", "fill_style", "fill_rule", "arc_mode", "tile", "stipple", "ts_x_origin", "ts_y_origin", "font", "subwindow_mode", "graphics_exposures", "clip_x_origin", "clip_y_origin", "clip_mask", "dash_offset", "dashes" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "function", "plane_mask", "foreground", "background", "line_width", "line_style", "cap_style", "join_style", "fill_style", "fill_rule", "arc_mode", "tile", "stipple", "ts_x_origin", "ts_y_origin", "font", "subwindow_mode", "graphics_exposures", "clip_x_origin", "clip_y_origin", "clip_mask", "dash_offset", "dashes" });
|
||||
}
|
||||
}
|
||||
GC XCreateGC(Display display, Drawable drawable, NativeLong mask, XGCValues values);
|
||||
int XSetFillRule(Display display, GC gc, int fill_rule);
|
||||
@@ -1344,7 +1373,9 @@ public interface X11 extends Library {
|
||||
public int send_event; // true if this came from a SendEvent request
|
||||
public Display display; // Display the event was read from
|
||||
public Window window; // window on which event was requested in event mask
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window" });
|
||||
}
|
||||
}
|
||||
|
||||
class XKeyEvent extends Structure {
|
||||
@@ -1361,7 +1392,9 @@ public interface X11 extends Library {
|
||||
public int state; // key or button mask
|
||||
public int keycode; // detail
|
||||
public int same_screen; // same screen flag
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "keycode", "same_screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "keycode", "same_screen" });
|
||||
}
|
||||
}
|
||||
|
||||
class XButtonEvent extends Structure {
|
||||
@@ -1378,7 +1411,9 @@ public interface X11 extends Library {
|
||||
public int state; // key or button mask
|
||||
public int button; // detail
|
||||
public int same_screen; // same screen flag
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "button", "same_screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "button", "same_screen" });
|
||||
}
|
||||
}
|
||||
|
||||
class XButtonPressedEvent extends XButtonEvent {
|
||||
@@ -1396,7 +1431,9 @@ public interface X11 extends Library {
|
||||
public Atom message_type;
|
||||
public int format;
|
||||
public Data data;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "message_type", "format", "data" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "message_type", "format", "data" });
|
||||
}
|
||||
|
||||
public static class Data extends Union {
|
||||
public byte b[] = new byte[20];
|
||||
@@ -1419,7 +1456,9 @@ public interface X11 extends Library {
|
||||
public int state; // key or button mask
|
||||
public byte is_hint; // detail
|
||||
public int same_screen; // same screen flag
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "is_hint", "same_screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "is_hint", "same_screen" });
|
||||
}
|
||||
}
|
||||
|
||||
class XPointerMovedEvent extends XMotionEvent {
|
||||
@@ -1445,7 +1484,9 @@ public interface X11 extends Library {
|
||||
public int same_screen; // same screen flag
|
||||
public int focus; // boolean focus
|
||||
public int state; // key or button mask
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "mode", "detail", "same_screen", "focus", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "mode", "detail", "same_screen", "focus", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XEnterWindowEvent extends XCrossingEvent {
|
||||
@@ -1467,7 +1508,9 @@ public interface X11 extends Library {
|
||||
* NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
|
||||
* NotifyPointerRoot, NotifyDetailNone
|
||||
*/
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "mode", "detail" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "mode", "detail" });
|
||||
}
|
||||
}
|
||||
|
||||
class XFocusInEvent extends XFocusChangeEvent {
|
||||
@@ -1485,7 +1528,9 @@ public interface X11 extends Library {
|
||||
public int x, y;
|
||||
public int width, height;
|
||||
public int count; // if non-zero, at least this many more
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "count" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "count" });
|
||||
}
|
||||
}
|
||||
|
||||
class XGraphicsExposeEvent extends Structure {
|
||||
@@ -1499,7 +1544,9 @@ public interface X11 extends Library {
|
||||
public int count; // if non-zero, at least this many more
|
||||
public int major_code; // core is CopyArea or CopyPlane
|
||||
public int minor_code; // not defined in the core
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "drawable", "x", "y", "width", "height", "count", "major_code", "minor_code" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "drawable", "x", "y", "width", "height", "count", "major_code", "minor_code" });
|
||||
}
|
||||
}
|
||||
|
||||
class XNoExposeEvent extends Structure {
|
||||
@@ -1510,7 +1557,9 @@ public interface X11 extends Library {
|
||||
public Drawable drawable;
|
||||
public int major_code; // core is CopyArea or CopyPlane
|
||||
public int minor_code; // not defined in the core
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "drawable", "major_code", "minor_code" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "drawable", "major_code", "minor_code" });
|
||||
}
|
||||
}
|
||||
|
||||
class XVisibilityEvent extends Structure {
|
||||
@@ -1520,7 +1569,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window window;
|
||||
public int state; // Visibility state
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XCreateWindowEvent extends Structure {
|
||||
@@ -1534,7 +1585,9 @@ public interface X11 extends Library {
|
||||
public int width, height; // size of window
|
||||
public int border_width; // border width
|
||||
public int override_redirect; // creation should be overridden
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "parent", "window", "x", "y", "width", "height", "border_width", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window", "x", "y", "width", "height", "border_width", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XDestroyWindowEvent extends Structure {
|
||||
@@ -1544,7 +1597,8 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window event;
|
||||
public Window window;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window" }); }
|
||||
}
|
||||
|
||||
class XUnmapEvent extends Structure {
|
||||
@@ -1555,7 +1609,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int from_configure;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "from_configure" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "from_configure" });
|
||||
}
|
||||
}
|
||||
|
||||
class XMapEvent extends Structure {
|
||||
@@ -1566,7 +1622,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int override_redirect; // boolean, is override set...
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XMapRequestEvent extends Structure {
|
||||
@@ -1576,7 +1634,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window parent;
|
||||
public Window window;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window" });
|
||||
}
|
||||
}
|
||||
|
||||
class XReparentEvent extends Structure {
|
||||
@@ -1589,7 +1649,9 @@ public interface X11 extends Library {
|
||||
public Window parent;
|
||||
public int x, y;
|
||||
public int override_redirect;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "parent", "x", "y", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XConfigureEvent extends Structure {
|
||||
@@ -1604,7 +1666,9 @@ public interface X11 extends Library {
|
||||
public int border_width;
|
||||
public Window above;
|
||||
public int override_redirect;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "border_width", "above", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "x", "y", "width", "height", "border_width", "above", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XGravityEvent extends Structure {
|
||||
@@ -1615,7 +1679,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int x, y;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "x", "y" });
|
||||
}
|
||||
}
|
||||
|
||||
class XResizeRequestEvent extends Structure {
|
||||
@@ -1625,7 +1691,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window window;
|
||||
public int width, height;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "width", "height" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "width", "height" });
|
||||
}
|
||||
}
|
||||
|
||||
class XConfigureRequestEvent extends Structure {
|
||||
@@ -1641,7 +1709,9 @@ public interface X11 extends Library {
|
||||
public Window above;
|
||||
public int detail; // Above, Below, TopIf, BottomIf, Opposite
|
||||
public NativeLong value_mask;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "above", "detail", "value_mask" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window", "x", "y", "width", "height", "border_width", "above", "detail", "value_mask" });
|
||||
}
|
||||
}
|
||||
|
||||
class XCirculateEvent extends Structure {
|
||||
@@ -1652,7 +1722,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int place; // PlaceOnTop, PlaceOnBottom
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "event", "window", "place" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "place" });
|
||||
}
|
||||
}
|
||||
|
||||
class XCirculateRequestEvent extends Structure {
|
||||
@@ -1663,7 +1735,9 @@ public interface X11 extends Library {
|
||||
public Window parent;
|
||||
public Window window;
|
||||
public int place; // PlaceOnTop, PlaceOnBottom
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "parent", "window", "place" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window", "place" });
|
||||
}
|
||||
}
|
||||
|
||||
class XPropertyEvent extends Structure {
|
||||
@@ -1675,7 +1749,9 @@ public interface X11 extends Library {
|
||||
public Atom atom;
|
||||
public NativeLong time;
|
||||
public int state; // NewValue, Deleted
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "atom", "time", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "atom", "time", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XSelectionClearEvent extends Structure {
|
||||
@@ -1686,7 +1762,9 @@ public interface X11 extends Library {
|
||||
public Window window;
|
||||
public Atom selection;
|
||||
public NativeLong time;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "selection", "time" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "selection", "time" });
|
||||
}
|
||||
}
|
||||
|
||||
class XSelectionRequestEvent extends Structure {
|
||||
@@ -1700,7 +1778,9 @@ public interface X11 extends Library {
|
||||
public Atom target;
|
||||
public Atom property;
|
||||
public NativeLong time;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "owner", "requestor", "selection", "target", "property", "time" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "owner", "requestor", "selection", "target", "property", "time" });
|
||||
}
|
||||
}
|
||||
|
||||
class XSelectionEvent extends Structure {
|
||||
@@ -1713,7 +1793,9 @@ public interface X11 extends Library {
|
||||
public Atom target;
|
||||
public Atom property; // ATOM or None
|
||||
public NativeLong time;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "requestor", "selection", "target", "property", "time" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "requestor", "selection", "target", "property", "time" });
|
||||
}
|
||||
}
|
||||
|
||||
class XColormapEvent extends Structure {
|
||||
@@ -1725,7 +1807,9 @@ public interface X11 extends Library {
|
||||
public Colormap colormap; // COLORMAP or None
|
||||
public int c_new; // C++
|
||||
public int state; // ColormapInstalled, ColormapUninstalled
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "colormap", "c_new", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "colormap", "c_new", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XMappingEvent extends Structure {
|
||||
@@ -1737,7 +1821,9 @@ public interface X11 extends Library {
|
||||
public int request; // one of MappingModifier, MappingKeyboard, MappingPointer
|
||||
public int first_keycode; // first keycode
|
||||
public int count; // defines range of change w. first_keycode*/
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "request", "first_keycode", "count" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "request", "first_keycode", "count" });
|
||||
}
|
||||
}
|
||||
|
||||
class XErrorEvent extends Structure {
|
||||
@@ -1748,7 +1834,9 @@ public interface X11 extends Library {
|
||||
public byte request_code; // Major op-code of failed request
|
||||
public byte minor_code; // Minor op-code of failed request
|
||||
public XID resourceid; // resource id
|
||||
{ setFieldOrder(new String[] { "type", "display", "serial", "error_code", "request_code", "minor_code", "resourceid" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "display", "serial", "error_code", "request_code", "minor_code", "resourceid" });
|
||||
}
|
||||
}
|
||||
|
||||
// generated on EnterWindow and FocusIn when KeyMapState selected
|
||||
@@ -1759,7 +1847,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window window;
|
||||
public byte key_vector[] = new byte[32];
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "key_vector" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "key_vector" });
|
||||
}
|
||||
}
|
||||
|
||||
int XSelectInput(Display display, Window window, NativeLong eventMask);
|
||||
@@ -1904,7 +1994,9 @@ public interface X11 extends Library {
|
||||
class XModifierKeymapRef extends Structure implements Structure.ByReference{
|
||||
public int max_keypermod; /* The server's max # of keys per modifier */
|
||||
public Pointer modifiermap; /* An 8 by max_keypermod array of modifiers */
|
||||
{ setFieldOrder(new String[] { "max_keypermod", "modifiermap" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "max_keypermod", "modifiermap" });
|
||||
}
|
||||
}
|
||||
|
||||
class XKeyboardControlRef extends Structure implements Structure.ByReference {
|
||||
@@ -1925,7 +2017,9 @@ public interface X11 extends Library {
|
||||
/** AutoRepeatModeOff, AutoRepeatModeOn, AutoRepeatModeDefault. */
|
||||
public int auto_repeat_mode;
|
||||
|
||||
{ setFieldOrder(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led", "led_mode", "key", "auto_repeat_mode" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led", "led_mode", "key", "auto_repeat_mode" });
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "XKeyboardControlByReference{" +
|
||||
@@ -1957,7 +2051,9 @@ public interface X11 extends Library {
|
||||
/** Bit vector. Each bit set to 1 indicates that auto-repeat is enabled for the corresponding key. The vector is represented as 32 bytes. Byte N (from 0) contains the bits for keys 8N to 8N + 7 with the least significant bit in the byte representing key 8N. */
|
||||
public byte auto_repeats[] = new byte[32];
|
||||
|
||||
{ setFieldOrder(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led_mask", "global_auto_repeat", "auto_repeats" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led_mask", "global_auto_repeat", "auto_repeats" });
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "XKeyboardStateByReference{" +
|
||||
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -1,127 +1,127 @@
|
||||
/* Copyright (c) 2010 Daniel Doubrovkine, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import com.sun.jna.IntegerType;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.ByReference;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
|
||||
/**
|
||||
* Based on basetsd.h (various types)
|
||||
* @author dblock[at]dblock[dot]org
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public interface BaseTSD extends StdCallLibrary {
|
||||
/**
|
||||
* Signed long type for pointer precision.
|
||||
* Use when casting a pointer to a long to perform pointer arithmetic.
|
||||
*/
|
||||
public static class LONG_PTR extends IntegerType {
|
||||
public LONG_PTR() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public LONG_PTR(long value) {
|
||||
super(Pointer.SIZE, value);
|
||||
}
|
||||
|
||||
public Pointer toPointer() {
|
||||
return Pointer.createConstant(longValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed SIZE_T.
|
||||
*/
|
||||
public static class SSIZE_T extends LONG_PTR {
|
||||
public SSIZE_T() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public SSIZE_T(long value) {
|
||||
super(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsigned LONG_PTR.
|
||||
*/
|
||||
public static class ULONG_PTR extends IntegerType {
|
||||
public ULONG_PTR() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public ULONG_PTR(long value) {
|
||||
super(Pointer.SIZE, value, true);
|
||||
}
|
||||
|
||||
public Pointer toPointer() {
|
||||
return Pointer.createConstant(longValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PULONG_PTR
|
||||
*/
|
||||
public static class ULONG_PTRByReference extends ByReference {
|
||||
public ULONG_PTRByReference() {
|
||||
this(new ULONG_PTR(0));
|
||||
}
|
||||
public ULONG_PTRByReference(ULONG_PTR value) {
|
||||
super(Pointer.SIZE);
|
||||
setValue(value);
|
||||
}
|
||||
public void setValue(ULONG_PTR value) {
|
||||
if (Pointer.SIZE == 4) {
|
||||
getPointer().setInt(0, value.intValue());
|
||||
}
|
||||
else {
|
||||
getPointer().setLong(0, value.longValue());
|
||||
}
|
||||
}
|
||||
public ULONG_PTR getValue() {
|
||||
return new ULONG_PTR(Pointer.SIZE == 4
|
||||
? getPointer().getInt(0)
|
||||
: getPointer().getLong(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unsigned DWORD_PTR.
|
||||
*/
|
||||
public static class DWORD_PTR extends IntegerType {
|
||||
public DWORD_PTR() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public DWORD_PTR(long value) {
|
||||
super(Pointer.SIZE, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum number of bytes to which a pointer can point.
|
||||
* Use for a count that must span the full range of a pointer.
|
||||
*/
|
||||
public static class SIZE_T extends ULONG_PTR {
|
||||
public SIZE_T() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public SIZE_T(long value) {
|
||||
super(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Copyright (c) 2010 Daniel Doubrovkine, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import com.sun.jna.IntegerType;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.ByReference;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
|
||||
/**
|
||||
* Based on basetsd.h (various types)
|
||||
* @author dblock[at]dblock[dot]org
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public interface BaseTSD extends StdCallLibrary {
|
||||
/**
|
||||
* Signed long type for pointer precision.
|
||||
* Use when casting a pointer to a long to perform pointer arithmetic.
|
||||
*/
|
||||
public static class LONG_PTR extends IntegerType {
|
||||
public LONG_PTR() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public LONG_PTR(long value) {
|
||||
super(Pointer.SIZE, value);
|
||||
}
|
||||
|
||||
public Pointer toPointer() {
|
||||
return Pointer.createConstant(longValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed SIZE_T.
|
||||
*/
|
||||
public static class SSIZE_T extends LONG_PTR {
|
||||
public SSIZE_T() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public SSIZE_T(long value) {
|
||||
super(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsigned LONG_PTR.
|
||||
*/
|
||||
public static class ULONG_PTR extends IntegerType {
|
||||
public ULONG_PTR() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public ULONG_PTR(long value) {
|
||||
super(Pointer.SIZE, value, true);
|
||||
}
|
||||
|
||||
public Pointer toPointer() {
|
||||
return Pointer.createConstant(longValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PULONG_PTR
|
||||
*/
|
||||
public static class ULONG_PTRByReference extends ByReference {
|
||||
public ULONG_PTRByReference() {
|
||||
this(new ULONG_PTR(0));
|
||||
}
|
||||
public ULONG_PTRByReference(ULONG_PTR value) {
|
||||
super(Pointer.SIZE);
|
||||
setValue(value);
|
||||
}
|
||||
public void setValue(ULONG_PTR value) {
|
||||
if (Pointer.SIZE == 4) {
|
||||
getPointer().setInt(0, value.intValue());
|
||||
}
|
||||
else {
|
||||
getPointer().setLong(0, value.longValue());
|
||||
}
|
||||
}
|
||||
public ULONG_PTR getValue() {
|
||||
return new ULONG_PTR(Pointer.SIZE == 4
|
||||
? getPointer().getInt(0)
|
||||
: getPointer().getLong(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unsigned DWORD_PTR.
|
||||
*/
|
||||
public static class DWORD_PTR extends IntegerType {
|
||||
public DWORD_PTR() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public DWORD_PTR(long value) {
|
||||
super(Pointer.SIZE, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum number of bytes to which a pointer can point.
|
||||
* Use for a count that must span the full range of a pointer.
|
||||
*/
|
||||
public static class SIZE_T extends ULONG_PTR {
|
||||
public SIZE_T() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public SIZE_T(long value) {
|
||||
super(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.Guid;
|
||||
import com.sun.jna.platform.win32.Guid.CLSID;
|
||||
import com.sun.jna.platform.win32.Kernel32;
|
||||
import com.sun.jna.platform.win32.OaIdl;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPID;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPIDByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.Ole32;
|
||||
import com.sun.jna.platform.win32.OleAuto;
|
||||
import com.sun.jna.platform.win32.OleAuto.DISPPARAMS;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.Variant.VariantArg;
|
||||
import com.sun.jna.platform.win32.WTypes;
|
||||
import com.sun.jna.platform.win32.WinDef.LCID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Helper class to provide basic COM support.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class COMBindingBaseObject extends COMInvoker {
|
||||
|
||||
/** The Constant LOCALE_USER_DEFAULT. */
|
||||
public final static LCID LOCALE_USER_DEFAULT = Kernel32.INSTANCE
|
||||
.GetUserDefaultLCID();
|
||||
|
||||
/** The Constant LOCALE_SYSTEM_DEFAULT. */
|
||||
public final static LCID LOCALE_SYSTEM_DEFAULT = Kernel32.INSTANCE
|
||||
.GetSystemDefaultLCID();
|
||||
|
||||
/** The i unknown. */
|
||||
private IUnknown iUnknown;
|
||||
|
||||
/** The i dispatch. */
|
||||
private IDispatch iDispatch;
|
||||
|
||||
/** IDispatch interface reference. */
|
||||
private PointerByReference pDispatch = new PointerByReference();
|
||||
|
||||
/** IUnknown interface reference. */
|
||||
private PointerByReference pUnknown = new PointerByReference();
|
||||
|
||||
public COMBindingBaseObject(IDispatch dispatch) {
|
||||
// transfer the value
|
||||
this.iDispatch = dispatch;
|
||||
}
|
||||
|
||||
public COMBindingBaseObject(CLSID clsid, boolean useActiveInstance) {
|
||||
this(clsid, useActiveInstance, WTypes.CLSCTX_SERVER);
|
||||
}
|
||||
|
||||
public COMBindingBaseObject(CLSID clsid, boolean useActiveInstance,
|
||||
int dwClsContext) {
|
||||
// Initialize COM for this thread...
|
||||
HRESULT hr = Ole32.INSTANCE.CoInitialize(null);
|
||||
|
||||
if (COMUtils.FAILED(hr)) {
|
||||
Ole32.INSTANCE.CoUninitialize();
|
||||
throw new COMException("CoInitialize() failed!");
|
||||
}
|
||||
|
||||
if (useActiveInstance) {
|
||||
hr = OleAuto.INSTANCE.GetActiveObject(clsid, null, this.pUnknown);
|
||||
|
||||
if (COMUtils.SUCCEEDED(hr)) {
|
||||
this.iUnknown = new Unknown(this.pUnknown.getValue());
|
||||
hr = iUnknown.QueryInterface(IDispatch.IID_IDISPATCH,
|
||||
this.pDispatch);
|
||||
} else {
|
||||
hr = Ole32.INSTANCE.CoCreateInstance(clsid, null, dwClsContext,
|
||||
IDispatch.IID_IDISPATCH, this.pDispatch);
|
||||
}
|
||||
} else {
|
||||
hr = Ole32.INSTANCE.CoCreateInstance(clsid, null, dwClsContext,
|
||||
IDispatch.IID_IDISPATCH, this.pDispatch);
|
||||
}
|
||||
|
||||
if (COMUtils.FAILED(hr)) {
|
||||
throw new COMException("COM object with CLSID "
|
||||
+ clsid.toGuidString() + " not registered properly!");
|
||||
}
|
||||
|
||||
this.iDispatch = new Dispatch(this.pDispatch.getValue());
|
||||
}
|
||||
|
||||
public COMBindingBaseObject(String progId, boolean useActiveInstance,
|
||||
int dwClsContext) throws COMException {
|
||||
// Initialize COM for this thread...
|
||||
HRESULT hr = Ole32.INSTANCE.CoInitialize(null);
|
||||
|
||||
if (COMUtils.FAILED(hr)) {
|
||||
this.release();
|
||||
throw new COMException("CoInitialize() failed!");
|
||||
}
|
||||
|
||||
// Get CLSID for Word.Application...
|
||||
CLSID.ByReference clsid = new CLSID.ByReference();
|
||||
hr = Ole32.INSTANCE.CLSIDFromProgID(progId, clsid);
|
||||
|
||||
if (COMUtils.FAILED(hr)) {
|
||||
Ole32.INSTANCE.CoUninitialize();
|
||||
throw new COMException("CLSIDFromProgID() failed!");
|
||||
}
|
||||
|
||||
if (useActiveInstance) {
|
||||
hr = OleAuto.INSTANCE.GetActiveObject(clsid, null, this.pUnknown);
|
||||
|
||||
if (COMUtils.SUCCEEDED(hr)) {
|
||||
this.iUnknown = new Unknown(this.pUnknown.getValue());
|
||||
hr = iUnknown.QueryInterface(IDispatch.IID_IDISPATCH,
|
||||
this.pDispatch);
|
||||
} else {
|
||||
hr = Ole32.INSTANCE.CoCreateInstance(clsid, null, dwClsContext,
|
||||
IDispatch.IID_IDISPATCH, this.pDispatch);
|
||||
}
|
||||
} else {
|
||||
hr = Ole32.INSTANCE.CoCreateInstance(clsid, null, dwClsContext,
|
||||
IDispatch.IID_IDISPATCH, this.pDispatch);
|
||||
}
|
||||
|
||||
if (COMUtils.FAILED(hr)) {
|
||||
throw new COMException("COM object with ProgID '" + progId
|
||||
+ "' and CLSID " + clsid.toGuidString()
|
||||
+ " not registered properly!");
|
||||
}
|
||||
|
||||
this.iDispatch = new Dispatch(this.pDispatch.getValue());
|
||||
}
|
||||
|
||||
public COMBindingBaseObject(String progId, boolean useActiveInstance)
|
||||
throws COMException {
|
||||
this(progId, useActiveInstance, WTypes.CLSCTX_SERVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the i dispatch.
|
||||
*
|
||||
* @return the i dispatch
|
||||
*/
|
||||
public IDispatch getIDispatch() {
|
||||
return iDispatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the i dispatch pointer.
|
||||
*
|
||||
* @return the i dispatch pointer
|
||||
*/
|
||||
public PointerByReference getIDispatchPointer() {
|
||||
return pDispatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the i unknown.
|
||||
*
|
||||
* @return the i unknown
|
||||
*/
|
||||
public IUnknown getIUnknown() {
|
||||
return iUnknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the i unknown pointer.
|
||||
*
|
||||
* @return the i unknown pointer
|
||||
*/
|
||||
public PointerByReference getIUnknownPointer() {
|
||||
return pUnknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release.
|
||||
*/
|
||||
public void release() {
|
||||
if (this.iDispatch != null)
|
||||
this.iDispatch.Release();
|
||||
|
||||
Ole32.INSTANCE.CoUninitialize();
|
||||
}
|
||||
|
||||
protected HRESULT oleMethod(int nType, VARIANT.ByReference pvResult,
|
||||
IDispatch pDisp, String name, VARIANT[] pArgs) throws COMException {
|
||||
|
||||
if (pDisp == null)
|
||||
throw new COMException("pDisp (IDispatch) parameter is null!");
|
||||
|
||||
// variable declaration
|
||||
WString[] ptName = new WString[] { new WString(name) };
|
||||
DISPIDByReference pdispID = new DISPIDByReference();
|
||||
|
||||
// Get DISPID for name passed...
|
||||
HRESULT hr = pDisp.GetIDsOfNames(Guid.IID_NULL, ptName, 1,
|
||||
LOCALE_USER_DEFAULT, pdispID);
|
||||
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return this
|
||||
.oleMethod(nType, pvResult, pDisp, pdispID.getValue(), pArgs);
|
||||
}
|
||||
|
||||
protected HRESULT oleMethod(int nType, VARIANT.ByReference pvResult,
|
||||
IDispatch pDisp, DISPID dispId, VARIANT[] pArgs)
|
||||
throws COMException {
|
||||
|
||||
if (pDisp == null)
|
||||
throw new COMException("pDisp (IDispatch) parameter is null!");
|
||||
|
||||
// variable declaration
|
||||
int _argsLen = 0;
|
||||
VARIANT[] _args = null;
|
||||
DISPPARAMS dp = new DISPPARAMS();
|
||||
EXCEPINFO.ByReference pExcepInfo = new EXCEPINFO.ByReference();
|
||||
IntByReference puArgErr = new IntByReference();
|
||||
|
||||
// make parameter reverse ordering as expected by COM runtime
|
||||
if ((pArgs != null) && (pArgs.length > 0)) {
|
||||
_argsLen = pArgs.length;
|
||||
_args = new VARIANT[_argsLen];
|
||||
|
||||
int revCount = _argsLen;
|
||||
for (int i = 0; i < _argsLen; i++) {
|
||||
_args[i] = pArgs[--revCount];
|
||||
}
|
||||
}
|
||||
|
||||
// Handle special-case for property-puts!
|
||||
if (nType == OleAuto.DISPATCH_PROPERTYPUT) {
|
||||
dp.cNamedArgs = new UINT(_argsLen);
|
||||
dp.rgdispidNamedArgs = new DISPIDByReference(
|
||||
OaIdl.DISPID_PROPERTYPUT);
|
||||
}
|
||||
|
||||
// Build DISPPARAMS
|
||||
if (_argsLen > 0) {
|
||||
dp.cArgs = new UINT(_args.length);
|
||||
// make pointer of variant array
|
||||
dp.rgvarg = new VariantArg.ByReference(_args);
|
||||
|
||||
// write 'DISPPARAMS' structure to memory
|
||||
dp.write();
|
||||
}
|
||||
|
||||
// Make the call!
|
||||
HRESULT hr = pDisp.Invoke(dispId, Guid.IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
||||
new DISPID(nType), dp, pvResult, pExcepInfo, puArgErr);
|
||||
|
||||
COMUtils.checkRC(hr, pExcepInfo, puArgErr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ole method.
|
||||
*
|
||||
* @param nType
|
||||
* the n type
|
||||
* @param pvResult
|
||||
* the pv result
|
||||
* @param pDisp
|
||||
* the disp
|
||||
* @param name
|
||||
* the name
|
||||
* @param pArg
|
||||
* the arg
|
||||
* @return the hresult
|
||||
* @throws COMException
|
||||
* the cOM exception
|
||||
*/
|
||||
protected HRESULT oleMethod(int nType, VARIANT.ByReference pvResult,
|
||||
IDispatch pDisp, String name, VARIANT pArg) throws COMException {
|
||||
|
||||
return this.oleMethod(nType, pvResult, pDisp, name,
|
||||
new VARIANT[] { pArg });
|
||||
}
|
||||
|
||||
protected HRESULT oleMethod(int nType, VARIANT.ByReference pvResult,
|
||||
IDispatch pDisp, DISPID dispId, VARIANT pArg) throws COMException {
|
||||
|
||||
return this.oleMethod(nType, pvResult, pDisp, dispId,
|
||||
new VARIANT[] { pArg });
|
||||
}
|
||||
|
||||
/**
|
||||
* Ole method.
|
||||
*
|
||||
* @param nType
|
||||
* the n type
|
||||
* @param pvResult
|
||||
* the pv result
|
||||
* @param pDisp
|
||||
* the disp
|
||||
* @param name
|
||||
* the name
|
||||
* @return the hresult
|
||||
* @throws COMException
|
||||
* the cOM exception
|
||||
*/
|
||||
protected HRESULT oleMethod(int nType, VARIANT.ByReference pvResult,
|
||||
IDispatch pDisp, String name) throws COMException {
|
||||
|
||||
return this.oleMethod(nType, pvResult, pDisp, name, (VARIANT[]) null);
|
||||
}
|
||||
|
||||
protected HRESULT oleMethod(int nType, VARIANT.ByReference pvResult,
|
||||
IDispatch pDisp, DISPID dispId) throws COMException {
|
||||
|
||||
return this.oleMethod(nType, pvResult, pDisp, dispId, (VARIANT[]) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check failed.
|
||||
*
|
||||
* @param hr
|
||||
* the hr
|
||||
*/
|
||||
protected void checkFailed(HRESULT hr) {
|
||||
COMUtils.checkRC(hr, null, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.Guid.CLSID;
|
||||
import com.sun.jna.platform.win32.Guid.IID;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPID;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPIDByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.OleAuto;
|
||||
import com.sun.jna.platform.win32.OleAuto.DISPPARAMS;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT.ByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.LCID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.UINTByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Helper class to provide basic COM support.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class COMEarlyBindingObject extends COMBindingBaseObject implements
|
||||
IDispatch {
|
||||
|
||||
public COMEarlyBindingObject(CLSID clsid, boolean useActiveInstance,
|
||||
int dwClsContext) {
|
||||
super(clsid, useActiveInstance, dwClsContext);
|
||||
}
|
||||
|
||||
protected String getStringProperty(DISPID dispId) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), dispId);
|
||||
|
||||
return result.getValue().toString();
|
||||
}
|
||||
|
||||
protected void setProperty(DISPID dispId, boolean value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, this.getIDispatch(),
|
||||
dispId, new VARIANT(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT QueryInterface(IID riid, PointerByReference ppvObject) {
|
||||
return this.getIDispatch().QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int AddRef() {
|
||||
return this.getIDispatch().AddRef();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int Release() {
|
||||
return this.getIDispatch().Release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetTypeInfoCount(UINTByReference pctinfo) {
|
||||
return this.getIDispatch().GetTypeInfoCount(pctinfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetTypeInfo(UINT iTInfo, LCID lcid,
|
||||
PointerByReference ppTInfo) {
|
||||
return this.getIDispatch().GetTypeInfo(iTInfo, lcid, ppTInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT GetIDsOfNames(IID riid, WString[] rgszNames, int cNames,
|
||||
LCID lcid, DISPIDByReference rgDispId) {
|
||||
return this.getIDispatch().GetIDsOfNames(riid, rgszNames, cNames, lcid,
|
||||
rgDispId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HRESULT Invoke(DISPID dispIdMember, IID riid, LCID lcid,
|
||||
DISPID wFlags, DISPPARAMS pDispParams, ByReference pVarResult,
|
||||
EXCEPINFO.ByReference pExcepInfo,
|
||||
IntByReference puArgErr) {
|
||||
return this.getIDispatch().Invoke(dispIdMember, riid, lcid, wFlags,
|
||||
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Exception class for all COM related classes.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class COMException extends RuntimeException {
|
||||
|
||||
/** The p excep info. */
|
||||
private EXCEPINFO pExcepInfo;
|
||||
|
||||
/** The pu arg err. */
|
||||
private IntByReference puArgErr;
|
||||
|
||||
private int uArgErr;
|
||||
|
||||
/**
|
||||
* Instantiates a new automation exception.
|
||||
*/
|
||||
public COMException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new automation exception.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param cause
|
||||
* the cause
|
||||
*/
|
||||
public COMException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new automation exception.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public COMException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new automation exception.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param pExcepInfo
|
||||
* the excep info
|
||||
* @param puArgErr
|
||||
* the pu arg err
|
||||
*/
|
||||
public COMException(String message, EXCEPINFO pExcepInfo,
|
||||
IntByReference puArgErr) {
|
||||
super(message + " (puArgErr=" + puArgErr.getValue() + ")");
|
||||
this.pExcepInfo = pExcepInfo;
|
||||
this.puArgErr = puArgErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new automation exception.
|
||||
*
|
||||
* @param cause
|
||||
* the cause
|
||||
*/
|
||||
public COMException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the excep info.
|
||||
*
|
||||
* @return the excep info
|
||||
*/
|
||||
public EXCEPINFO getExcepInfo() {
|
||||
return pExcepInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the arg err.
|
||||
*
|
||||
* @return the arg err
|
||||
*/
|
||||
public IntByReference getArgErr() {
|
||||
return puArgErr;
|
||||
}
|
||||
|
||||
public int getuArgErr() {
|
||||
return uArgErr;
|
||||
}
|
||||
|
||||
public void setuArgErr(int uArgErr) {
|
||||
this.uArgErr = uArgErr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.Function;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.PointerType;
|
||||
|
||||
public abstract class COMInvoker extends PointerType {
|
||||
|
||||
protected int _invokeNativeInt(int vtableId, Object[] args) {
|
||||
Pointer vptr = this.getPointer().getPointer(0);
|
||||
// we take the vtable id and multiply with the pointer size (4 bytes on
|
||||
// 32bit OS)
|
||||
Function func = Function.getFunction(vptr.getPointer(vtableId
|
||||
* Pointer.SIZE));
|
||||
return func.invokeInt(args);
|
||||
}
|
||||
|
||||
protected Object _invokeNativeObject(int vtableId, Object[] args,
|
||||
Class returnType) {
|
||||
Pointer vptr = this.getPointer().getPointer(0);
|
||||
// we take the vtable id and multiply with the pointer size (4 bytes on
|
||||
// 32bit OS)
|
||||
Function func = Function.getFunction(vptr.getPointer(vtableId
|
||||
* Pointer.SIZE));
|
||||
return func.invoke(returnType, args);
|
||||
}
|
||||
|
||||
protected void _invokeNativeVoid(int vtableId, Object[] args) {
|
||||
Pointer vptr = this.getPointer().getPointer(0);
|
||||
// we take the vtable id and multiply with the pointer size (4 bytes on
|
||||
// 32bit OS)
|
||||
Function func = Function.getFunction(vptr.getPointer(vtableId
|
||||
* Pointer.SIZE));
|
||||
func.invokeVoid(args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,622 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.sun.jna.platform.win32.Guid.CLSID;
|
||||
import com.sun.jna.platform.win32.OaIdl.VARIANT_BOOL;
|
||||
import com.sun.jna.platform.win32.OleAuto;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WinDef.LONG;
|
||||
import com.sun.jna.platform.win32.WinDef.SHORT;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Helper class to provide basic COM support.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class COMLateBindingObject extends COMBindingBaseObject {
|
||||
|
||||
/**
|
||||
* Instantiates a new cOM object.
|
||||
*
|
||||
* @param iDispatch
|
||||
* the i dispatch
|
||||
*/
|
||||
public COMLateBindingObject(IDispatch iDispatch) {
|
||||
super(iDispatch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new cOM object.
|
||||
*
|
||||
* @param clsid
|
||||
* the clsid
|
||||
* @param useActiveInstance
|
||||
* the use active instance
|
||||
*/
|
||||
public COMLateBindingObject(CLSID clsid, boolean useActiveInstance) {
|
||||
super(clsid, useActiveInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new cOM object.
|
||||
*
|
||||
* @param progId
|
||||
* the prog id
|
||||
* @param useActiveInstance
|
||||
* the use active instance
|
||||
* @throws COMException
|
||||
* the automation exception
|
||||
*/
|
||||
public COMLateBindingObject(String progId, boolean useActiveInstance)
|
||||
throws COMException {
|
||||
super(progId, useActiveInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the automation property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @return the automation property
|
||||
*/
|
||||
protected IDispatch getAutomationProperty(String propertyName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), propertyName);
|
||||
|
||||
return ((IDispatch) result.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the automation property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param comObject
|
||||
* the com object
|
||||
* @return the automation property
|
||||
*/
|
||||
protected IDispatch getAutomationProperty(String propertyName,
|
||||
COMLateBindingObject comObject) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
comObject.getIDispatch(), propertyName);
|
||||
|
||||
return ((IDispatch) result.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the automation property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param comObject
|
||||
* the com object
|
||||
* @param value
|
||||
* the value
|
||||
* @return the automation property
|
||||
*/
|
||||
protected IDispatch getAutomationProperty(String propertyName,
|
||||
COMLateBindingObject comObject, VARIANT value) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
comObject.getIDispatch(), propertyName, value);
|
||||
|
||||
return ((IDispatch) result.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the automation property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param iDispatch
|
||||
* the i dispatch
|
||||
* @return the automation property
|
||||
*/
|
||||
protected IDispatch getAutomationProperty(String propertyName,
|
||||
IDispatch iDispatch) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), propertyName);
|
||||
|
||||
return ((IDispatch) result.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the boolean property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @return the boolean property
|
||||
*/
|
||||
protected boolean getBooleanProperty(String propertyName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), propertyName);
|
||||
|
||||
return (((VARIANT_BOOL) result.getValue()).intValue() != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the date property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @return the date property
|
||||
*/
|
||||
protected Date getDateProperty(String propertyName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), propertyName);
|
||||
|
||||
return result.dateValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the int property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @return the int property
|
||||
*/
|
||||
protected int getIntProperty(String propertyName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), propertyName);
|
||||
|
||||
return ((LONG) result.getValue()).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the short property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @return the short property
|
||||
*/
|
||||
protected short getShortProperty(String propertyName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), propertyName);
|
||||
|
||||
return ((SHORT) result.getValue()).shortValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @return the string property
|
||||
*/
|
||||
protected String getStringProperty(String propertyName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
|
||||
this.getIDispatch(), propertyName);
|
||||
|
||||
return result.getValue().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @return the variant
|
||||
*/
|
||||
protected VARIANT invoke(String methodName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, result, this.getIDispatch(),
|
||||
methodName);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg
|
||||
* the arg
|
||||
* @return the variant
|
||||
*/
|
||||
protected VARIANT invoke(String methodName, VARIANT arg) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, result, this.getIDispatch(),
|
||||
methodName, arg);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param args
|
||||
* the args
|
||||
* @return the variant
|
||||
*/
|
||||
protected VARIANT invoke(String methodName, VARIANT[] args) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, result, this.getIDispatch(),
|
||||
methodName, args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg1
|
||||
* the arg1
|
||||
* @param arg2
|
||||
* the arg2
|
||||
* @return the variant
|
||||
*/
|
||||
protected VARIANT invoke(String methodName, VARIANT arg1, VARIANT arg2) {
|
||||
return invoke(methodName, new VARIANT[] { arg1, arg2 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg1
|
||||
* the arg1
|
||||
* @param arg2
|
||||
* the arg2
|
||||
* @param arg3
|
||||
* the arg3
|
||||
* @return the variant
|
||||
*/
|
||||
protected VARIANT invoke(String methodName, VARIANT arg1, VARIANT arg2,
|
||||
VARIANT arg3) {
|
||||
return invoke(methodName, new VARIANT[] { arg1, arg2, arg3 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg1
|
||||
* the arg1
|
||||
* @param arg2
|
||||
* the arg2
|
||||
* @param arg3
|
||||
* the arg3
|
||||
* @param arg4
|
||||
* the arg4
|
||||
* @return the variant
|
||||
*/
|
||||
protected VARIANT invoke(String methodName, VARIANT arg1, VARIANT arg2,
|
||||
VARIANT arg3, VARIANT arg4) {
|
||||
return invoke(methodName, new VARIANT[] { arg1, arg2, arg3, arg4 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param dispatch
|
||||
* the dispatch
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, IDispatch dispatch) {
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, null, dispatch, methodName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param comObject
|
||||
* the com object
|
||||
*/
|
||||
protected void invokeNoReply(String methodName,
|
||||
COMLateBindingObject comObject) {
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, null, comObject.getIDispatch(),
|
||||
methodName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param dispatch
|
||||
* the dispatch
|
||||
* @param arg
|
||||
* the arg
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, IDispatch dispatch,
|
||||
VARIANT arg) {
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, null, dispatch, methodName, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param dispatch
|
||||
* the dispatch
|
||||
* @param arg1
|
||||
* the arg1
|
||||
* @param arg2
|
||||
* the arg2
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, IDispatch dispatch,
|
||||
VARIANT arg1, VARIANT arg2) {
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, null, dispatch, methodName,
|
||||
new VARIANT[] { arg1, arg2 });
|
||||
}
|
||||
|
||||
protected void invokeNoReply(String methodName, COMLateBindingObject comObject,
|
||||
VARIANT arg1, VARIANT arg2) {
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, null, comObject.getIDispatch(), methodName,
|
||||
new VARIANT[] { arg1, arg2 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param comObject
|
||||
* the com object
|
||||
* @param arg
|
||||
* the arg
|
||||
*/
|
||||
protected void invokeNoReply(String methodName,
|
||||
COMLateBindingObject comObject, VARIANT arg) {
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, null, comObject.getIDispatch(),
|
||||
methodName, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param dispatch
|
||||
* the dispatch
|
||||
* @param args
|
||||
* the args
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, IDispatch dispatch,
|
||||
VARIANT[] args) {
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, null, dispatch, methodName,
|
||||
args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
*/
|
||||
protected void invokeNoReply(String methodName) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, result, this.getIDispatch(),
|
||||
methodName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg
|
||||
* the arg
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, VARIANT arg) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, result, this.getIDispatch(),
|
||||
methodName, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param args
|
||||
* the args
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, VARIANT[] args) {
|
||||
VARIANT.ByReference result = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, result, this.getIDispatch(),
|
||||
methodName, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg1
|
||||
* the arg1
|
||||
* @param arg2
|
||||
* the arg2
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, VARIANT arg1, VARIANT arg2) {
|
||||
invokeNoReply(methodName, new VARIANT[] { arg1, arg2 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg1
|
||||
* the arg1
|
||||
* @param arg2
|
||||
* the arg2
|
||||
* @param arg3
|
||||
* the arg3
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, VARIANT arg1, VARIANT arg2,
|
||||
VARIANT arg3) {
|
||||
invokeNoReply(methodName, new VARIANT[] { arg1, arg2, arg3 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke no reply.
|
||||
*
|
||||
* @param methodName
|
||||
* the method name
|
||||
* @param arg1
|
||||
* the arg1
|
||||
* @param arg2
|
||||
* the arg2
|
||||
* @param arg3
|
||||
* the arg3
|
||||
* @param arg4
|
||||
* the arg4
|
||||
*/
|
||||
protected void invokeNoReply(String methodName, VARIANT arg1, VARIANT arg2,
|
||||
VARIANT arg3, VARIANT arg4) {
|
||||
invokeNoReply(methodName, new VARIANT[] { arg1, arg2, arg3, arg4 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName, boolean value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, this.getIDispatch(),
|
||||
propertyName, new VARIANT(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName, Date value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, this.getIDispatch(),
|
||||
propertyName, new VARIANT(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName, IDispatch value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, this.getIDispatch(),
|
||||
propertyName, new VARIANT(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName, int value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, this.getIDispatch(),
|
||||
propertyName, new VARIANT(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName, short value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, this.getIDispatch(),
|
||||
propertyName, new VARIANT(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName, String value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, this.getIDispatch(),
|
||||
propertyName, new VARIANT(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param iDispatch
|
||||
* the i dispatch
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName, IDispatch iDispatch,
|
||||
VARIANT value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null, iDispatch,
|
||||
propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property.
|
||||
*
|
||||
* @param propertyName
|
||||
* the property name
|
||||
* @param comObject
|
||||
* the com object
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void setProperty(String propertyName,
|
||||
COMLateBindingObject comObject, VARIANT value) {
|
||||
this.oleMethod(OleAuto.DISPATCH_PROPERTYPUT, null,
|
||||
comObject.getIDispatch(), propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* To variant.
|
||||
*
|
||||
* @return the variant
|
||||
*/
|
||||
public VARIANT toVariant() {
|
||||
return new VARIANT(this.getIDispatch());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.platform.win32.Advapi32;
|
||||
import com.sun.jna.platform.win32.Advapi32Util;
|
||||
import com.sun.jna.platform.win32.Advapi32Util.EnumKey;
|
||||
import com.sun.jna.platform.win32.Advapi32Util.InfoKey;
|
||||
import com.sun.jna.platform.win32.Kernel32Util;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTR;
|
||||
import com.sun.jna.platform.win32.WinNT;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.platform.win32.WinReg;
|
||||
import com.sun.jna.platform.win32.WinReg.HKEYByReference;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class COMUtils.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class COMUtils.
|
||||
*/
|
||||
public abstract class COMUtils {
|
||||
|
||||
/** The Constant CO_E_NOTINITIALIZED. */
|
||||
public static final int S_OK = 0;
|
||||
|
||||
/**
|
||||
* Succeeded.
|
||||
*
|
||||
* @param hr
|
||||
* the hr
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean SUCCEEDED(HRESULT hr) {
|
||||
return SUCCEEDED(hr.intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Succeeded.
|
||||
*
|
||||
* @param hr
|
||||
* the hr
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean SUCCEEDED(int hr) {
|
||||
if (hr == S_OK)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Failed.
|
||||
*
|
||||
* @param hr
|
||||
* the hr
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean FAILED(HRESULT hr) {
|
||||
return FAILED(hr.intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Failed.
|
||||
*
|
||||
* @param hr
|
||||
* the hr
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean FAILED(int hr) {
|
||||
if (hr != S_OK)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw new exception.
|
||||
*
|
||||
* @param hr
|
||||
* the hr
|
||||
*/
|
||||
public static void checkRC(HRESULT hr) {
|
||||
checkRC(hr, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw new exception.
|
||||
*
|
||||
* @param hr
|
||||
* the hr
|
||||
* @param pExcepInfo
|
||||
* the excep info
|
||||
* @param puArgErr
|
||||
* the pu arg err
|
||||
*/
|
||||
public static void checkRC(HRESULT hr, EXCEPINFO pExcepInfo,
|
||||
IntByReference puArgErr) {
|
||||
if (FAILED(hr)) {
|
||||
String formatMessageFromHR = Kernel32Util.formatMessage(hr);
|
||||
throw new COMException(formatMessageFromHR, pExcepInfo, puArgErr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all com info on system.
|
||||
*
|
||||
* @return the all com info on system
|
||||
*/
|
||||
public static ArrayList<COMInfo> getAllCOMInfoOnSystem() {
|
||||
HKEYByReference phkResult = new HKEYByReference();
|
||||
HKEYByReference phkResult2 = new HKEYByReference();
|
||||
String subKey;
|
||||
ArrayList<COMInfo> comInfos = new ArrayList<COMUtils.COMInfo>();
|
||||
|
||||
try {
|
||||
// open root key
|
||||
phkResult = Advapi32Util.registryGetKey(WinReg.HKEY_CLASSES_ROOT,
|
||||
"CLSID", WinNT.KEY_ALL_ACCESS);
|
||||
// open subkey
|
||||
InfoKey infoKey = Advapi32Util.registryQueryInfoKey(
|
||||
phkResult.getValue(), WinNT.KEY_ALL_ACCESS);
|
||||
|
||||
for (int i = 0; i < infoKey.lpcSubKeys.getValue(); i++) {
|
||||
EnumKey enumKey = Advapi32Util.registryRegEnumKey(
|
||||
phkResult.getValue(), i);
|
||||
subKey = Native.toString(enumKey.lpName);
|
||||
|
||||
COMInfo comInfo = new COMInfo(subKey);
|
||||
|
||||
phkResult2 = Advapi32Util.registryGetKey(phkResult.getValue(),
|
||||
subKey, WinNT.KEY_ALL_ACCESS);
|
||||
InfoKey infoKey2 = Advapi32Util.registryQueryInfoKey(
|
||||
phkResult2.getValue(), WinNT.KEY_ALL_ACCESS);
|
||||
|
||||
for (int y = 0; y < infoKey2.lpcSubKeys.getValue(); y++) {
|
||||
EnumKey enumKey2 = Advapi32Util.registryRegEnumKey(
|
||||
phkResult2.getValue(), y);
|
||||
String subKey2 = Native.toString(enumKey2.lpName);
|
||||
|
||||
if (subKey2.equals("InprocHandler32")) {
|
||||
comInfo.inprocHandler32 = (String) Advapi32Util
|
||||
.registryGetValue(phkResult2.getValue(),
|
||||
subKey2, null);
|
||||
} else if (subKey2.equals("InprocServer32")) {
|
||||
comInfo.inprocServer32 = (String) Advapi32Util
|
||||
.registryGetValue(phkResult2.getValue(),
|
||||
subKey2, null);
|
||||
} else if (subKey2.equals("LocalServer32")) {
|
||||
comInfo.localServer32 = (String) Advapi32Util
|
||||
.registryGetValue(phkResult2.getValue(),
|
||||
subKey2, null);
|
||||
} else if (subKey2.equals("ProgID")) {
|
||||
comInfo.progID = (String) Advapi32Util
|
||||
.registryGetValue(phkResult2.getValue(),
|
||||
subKey2, null);
|
||||
} else if (subKey2.equals("TypeLib")) {
|
||||
comInfo.typeLib = (String) Advapi32Util
|
||||
.registryGetValue(phkResult2.getValue(),
|
||||
subKey2, null);
|
||||
}
|
||||
}
|
||||
|
||||
Advapi32.INSTANCE.RegCloseKey(phkResult2.getValue());
|
||||
comInfos.add(comInfo);
|
||||
}
|
||||
} finally {
|
||||
Advapi32.INSTANCE.RegCloseKey(phkResult.getValue());
|
||||
Advapi32.INSTANCE.RegCloseKey(phkResult2.getValue());
|
||||
}
|
||||
|
||||
return comInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class COMInfo.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class COMInfo.
|
||||
*/
|
||||
public static class COMInfo {
|
||||
|
||||
/** The clsid. */
|
||||
public String clsid;
|
||||
|
||||
/** The inproc handler32. */
|
||||
public String inprocHandler32;
|
||||
|
||||
/** The inproc server32. */
|
||||
public String inprocServer32;
|
||||
|
||||
/** The local server32. */
|
||||
public String localServer32;
|
||||
|
||||
/** The prog id. */
|
||||
public String progID;
|
||||
|
||||
/** The type lib. */
|
||||
public String typeLib;
|
||||
|
||||
/**
|
||||
* Instantiates a new cOM info.
|
||||
*/
|
||||
public COMInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new cOM info.
|
||||
*
|
||||
* @param clsid
|
||||
* the clsid
|
||||
*/
|
||||
public COMInfo(String clsid) {
|
||||
this.clsid = clsid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.Guid.IID;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPID;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPIDByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.OleAuto.DISPPARAMS;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WinDef.LCID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.UINTByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the IDispatch interface
|
||||
*
|
||||
* IDispatch.GetTypeInfoCount 12 IDispatch.GetTypeInfo 16
|
||||
* IDispatch.GetIDsOfNames 20 IDispatch.Invoke 24
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class Dispatch extends Unknown implements IDispatch {
|
||||
|
||||
public static class ByReference extends Dispatch implements
|
||||
Structure.ByReference {
|
||||
}
|
||||
|
||||
public Dispatch() {
|
||||
}
|
||||
|
||||
public Dispatch(Pointer pvInstance) {
|
||||
super(pvInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info count.
|
||||
*
|
||||
* @param pctinfo
|
||||
* the pctinfo
|
||||
* @return the hresult
|
||||
*
|
||||
* Virtual
|
||||
*/
|
||||
public HRESULT GetTypeInfoCount(UINTByReference pctinfo) {
|
||||
return (HRESULT) this._invokeNativeObject(3,
|
||||
new Object[] { this.getPointer(), pctinfo }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info.
|
||||
*
|
||||
* @param iTInfo
|
||||
* the i t info
|
||||
* @param lcid
|
||||
* the lcid
|
||||
* @param ppTInfo
|
||||
* the pp t info
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeInfo(UINT iTInfo, LCID lcid,
|
||||
PointerByReference ppTInfo) {
|
||||
return (HRESULT) this._invokeNativeObject(4,
|
||||
new Object[] { this.getPointer(), iTInfo, lcid, ppTInfo },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ids of names.
|
||||
*
|
||||
* @param riid
|
||||
* the riid
|
||||
* @param rgszNames
|
||||
* the rgsz names
|
||||
* @param cNames
|
||||
* the c names
|
||||
* @param lcid
|
||||
* the lcid
|
||||
* @param rgDispId
|
||||
* the rg disp id
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetIDsOfNames(IID riid, WString[] rgszNames, int cNames,
|
||||
LCID lcid, DISPIDByReference rgDispId) {
|
||||
return (HRESULT) this._invokeNativeObject(5,
|
||||
new Object[] { this.getPointer(), riid, rgszNames, cNames,
|
||||
lcid, rgDispId }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param dispIdMember
|
||||
* the disp id member
|
||||
* @param riid
|
||||
* the riid
|
||||
* @param lcid
|
||||
* the lcid
|
||||
* @param wFlags
|
||||
* the w flags
|
||||
* @param pDispParams
|
||||
* the disp params
|
||||
* @param pVarResult
|
||||
* the var result
|
||||
* @param pExcepInfo
|
||||
* the excep info
|
||||
* @param puArgErr
|
||||
* the pu arg err
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT Invoke(DISPID dispIdMember, IID riid, LCID lcid,
|
||||
DISPID wFlags, DISPPARAMS pDispParams,
|
||||
VARIANT.ByReference pVarResult, EXCEPINFO.ByReference pExcepInfo,
|
||||
IntByReference puArgErr) {
|
||||
return (HRESULT) this
|
||||
._invokeNativeObject(6, new Object[] { this.getPointer(),
|
||||
dispIdMember, riid, lcid, wFlags, pDispParams,
|
||||
pVarResult, pExcepInfo, puArgErr }, HRESULT.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.Guid.IID;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPID;
|
||||
import com.sun.jna.platform.win32.OaIdl.DISPIDByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.OleAuto.DISPPARAMS;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WinDef.LCID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.UINTByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the IDispatch interface
|
||||
*
|
||||
* IDispatch.GetTypeInfoCount 12 IDispatch.GetTypeInfo 16
|
||||
* IDispatch.GetIDsOfNames 20 IDispatch.Invoke 24
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public interface IDispatch extends IUnknown {
|
||||
|
||||
public final static IID IID_IDISPATCH = new IID(
|
||||
"00020400-0000-0000-C000-000000000046");
|
||||
|
||||
public HRESULT GetTypeInfoCount(UINTByReference pctinfo);
|
||||
|
||||
public HRESULT GetTypeInfo(UINT iTInfo, LCID lcid,
|
||||
PointerByReference ppTInfo);
|
||||
|
||||
public HRESULT GetIDsOfNames(IID riid, WString[] rgszNames, int cNames,
|
||||
LCID lcid, DISPIDByReference rgDispId);
|
||||
|
||||
public HRESULT Invoke(DISPID dispIdMember, IID riid, LCID lcid,
|
||||
DISPID wFlags, DISPPARAMS pDispParams,
|
||||
VARIANT.ByReference pVarResult, EXCEPINFO.ByReference pExcepInfo,
|
||||
IntByReference puArgErr);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.Guid.GUID;
|
||||
import com.sun.jna.platform.win32.Guid.IID;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTR;
|
||||
import com.sun.jna.platform.win32.WinDef.BOOL;
|
||||
import com.sun.jna.platform.win32.WinDef.PVOID;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the IRecordInfo interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public interface IRecordInfo extends IUnknown {
|
||||
|
||||
public final static IID IID_IRecordInfo = new IID(
|
||||
"{0000002F-0000-0000-C000-000000000046}");
|
||||
|
||||
public HRESULT RecordInit(/* [out] */PVOID pvNew);
|
||||
|
||||
public HRESULT RecordClear(
|
||||
/* [in] */PVOID pvExisting);
|
||||
|
||||
public HRESULT RecordCopy(/* [in] */PVOID pvExisting,
|
||||
/* [out] */PVOID pvNew);
|
||||
|
||||
public HRESULT GetGuid(
|
||||
/* [out] */GUID pguid);
|
||||
|
||||
public HRESULT GetName(
|
||||
/* [out] */BSTR pbstrName);
|
||||
|
||||
public HRESULT GetSize(
|
||||
/* [out] */ULONG pcbSize);
|
||||
|
||||
public HRESULT GetTypeInfo(
|
||||
/* [out] */ITypeInfo ppTypeInfo);
|
||||
|
||||
public HRESULT GetField(
|
||||
/* [in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [out] */VARIANT pvarField);
|
||||
|
||||
public HRESULT GetFieldNoCopy(
|
||||
/* [in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [out] */VARIANT pvarField,
|
||||
/* [out] */PVOID ppvDataCArray);
|
||||
|
||||
public HRESULT PutField(
|
||||
/* [in] */ULONG wFlags,
|
||||
/* [out][in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [in] */VARIANT pvarField);
|
||||
|
||||
public HRESULT PutFieldNoCopy(
|
||||
/* [in] */ULONG wFlags,
|
||||
/* [out][in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [in] */VARIANT pvarField);
|
||||
|
||||
public HRESULT GetFieldNames(
|
||||
/* [out][in] */ULONG pcNames,
|
||||
/* [length_is][size_is][out] */BSTR rgBstrNames);
|
||||
|
||||
public BOOL IsMatchingType(
|
||||
/* [in] */IRecordInfo pRecordInfo);
|
||||
|
||||
public PVOID RecordCreate();
|
||||
|
||||
public HRESULT RecordCreateCopy(
|
||||
/* [in] */PVOID pvSource,
|
||||
/* [out] */PVOID ppvDest);
|
||||
|
||||
public HRESULT RecordDestroy(
|
||||
/* [in] */PVOID pvRecord);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.OaIdl.BINDPTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.DESCKIND;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinDef.WORD;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeComp interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public interface ITypeComp extends IUnknown {
|
||||
|
||||
public HRESULT Bind(
|
||||
/* [annotation][in] */
|
||||
WString szName,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [in] */WORD wFlags,
|
||||
/* [out] */PointerByReference ppTInfo,
|
||||
/* [out] */DESCKIND.ByReference pDescKind,
|
||||
/* [out] */BINDPTR.ByReference pBindPtr);
|
||||
|
||||
public HRESULT BindType(
|
||||
/* [annotation][in] */
|
||||
WString szName,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [out] */PointerByReference ppTInfo,
|
||||
/* [out] */PointerByReference ppTComp);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.platform.win32.Guid.REFIID;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPE;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.INVOKEKIND;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.VARDESC;
|
||||
import com.sun.jna.platform.win32.OleAuto.DISPPARAMS;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTR;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTRByReference;
|
||||
import com.sun.jna.platform.win32.WTypes.LPOLESTR;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.PVOID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.UINTByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.WORD;
|
||||
import com.sun.jna.platform.win32.WinDef.WORDByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeInfo interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public interface ITypeInfo extends IUnknown {
|
||||
|
||||
public HRESULT GetTypeAttr(
|
||||
/* [out] */PointerByReference ppTypeAttr);
|
||||
|
||||
public HRESULT GetTypeComp(
|
||||
/* [out] */PointerByReference ppTComp);
|
||||
|
||||
public/* [local] */HRESULT GetFuncDesc(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */PointerByReference ppFuncDesc);
|
||||
|
||||
public/* [local] */HRESULT GetVarDesc(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */PointerByReference ppVarDesc);
|
||||
|
||||
public/* [local] */HRESULT GetNames(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [length_is][size_is][out] */BSTR[] rgBstrNames,
|
||||
/* [in] */UINT cMaxNames,
|
||||
/* [out] */UINTByReference pcNames);
|
||||
|
||||
public HRESULT GetRefTypeOfImplType(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */HREFTYPEByReference pRefType);
|
||||
|
||||
public HRESULT GetImplTypeFlags(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */IntByReference pImplTypeFlags);
|
||||
|
||||
public/* [local] */HRESULT GetIDsOfNames(
|
||||
/* [size_is][in] */LPOLESTR[] rgszNames,
|
||||
/* [in] */UINT cNames,
|
||||
/* [size_is][out] */MEMBERID[] pMemId);
|
||||
|
||||
public/* [local] */HRESULT Invoke(
|
||||
/* [in] */PVOID pvInstance,
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [in] */WORD wFlags,
|
||||
/* [out][in] */DISPPARAMS.ByReference pDispParams,
|
||||
/* [out] */VARIANT.ByReference pVarResult,
|
||||
/* [out] */EXCEPINFO.ByReference pExcepInfo,
|
||||
/* [out] */UINTByReference puArgErr);
|
||||
|
||||
public/* [local] */HRESULT GetDocumentation(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [out] */BSTRByReference pBstrName,
|
||||
/* [out] */BSTRByReference pBstrDocString,
|
||||
/* [out] */DWORDByReference pdwHelpContext,
|
||||
/* [out] */BSTRByReference pBstrHelpFile);
|
||||
|
||||
public/* [local] */HRESULT GetDllEntry(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [in] */INVOKEKIND invKind,
|
||||
/* [out] */BSTRByReference pBstrDllName,
|
||||
/* [out] */BSTRByReference pBstrName,
|
||||
/* [out] */WORDByReference pwOrdinal);
|
||||
|
||||
public HRESULT GetRefTypeInfo(
|
||||
/* [in] */HREFTYPE hRefType,
|
||||
/* [out] */PointerByReference ppTInfo);
|
||||
|
||||
public/* [local] */HRESULT AddressOfMember(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [in] */INVOKEKIND invKind,
|
||||
/* [out] */PointerByReference ppv);
|
||||
|
||||
public/* [local] */HRESULT CreateInstance(
|
||||
/* [in] */IUnknown pUnkOuter,
|
||||
/* [in] */REFIID riid,
|
||||
/* [iid_is][out] */PointerByReference ppvObj);
|
||||
|
||||
public HRESULT GetMops(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [out] */BSTRByReference pBstrMops);
|
||||
|
||||
public/* [local] */HRESULT GetContainingTypeLib(
|
||||
/* [out] */PointerByReference ppTLib,
|
||||
/* [out] */UINTByReference pIndex);
|
||||
|
||||
public/* [local] */void ReleaseTypeAttr(
|
||||
/* [in] */TYPEATTR pTypeAttr);
|
||||
|
||||
public/* [local] */void ReleaseFuncDesc(
|
||||
/* [in] */FUNCDESC pFuncDesc);
|
||||
|
||||
public/* [local] */void ReleaseVarDesc(
|
||||
/* [in] */VARDESC pVarDesc);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.platform.win32.Guid.GUID;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TLIBATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEKIND;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTRByReference;
|
||||
import com.sun.jna.platform.win32.WTypes.LPOLESTR;
|
||||
import com.sun.jna.platform.win32.WinDef.BOOLByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinDef.USHORTByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeLib interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public interface ITypeLib extends IUnknown {
|
||||
|
||||
public UINT GetTypeInfoCount();
|
||||
|
||||
public HRESULT GetTypeInfo(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */PointerByReference pTInfo);
|
||||
|
||||
public HRESULT GetTypeInfoType(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */TYPEKIND.ByReference pTKind);
|
||||
|
||||
public HRESULT GetTypeInfoOfGuid(
|
||||
/* [in] */GUID guid,
|
||||
/* [out] */PointerByReference pTinfo);
|
||||
|
||||
public HRESULT GetLibAttr(
|
||||
/* [out] */PointerByReference ppTLibAttr);
|
||||
|
||||
public HRESULT GetTypeComp(
|
||||
/* [out] */PointerByReference ppTComp);
|
||||
|
||||
public HRESULT GetDocumentation(
|
||||
/* [in] */int index,
|
||||
/* [out] */BSTRByReference pBstrName,
|
||||
/* [out] */BSTRByReference pBstrDocString,
|
||||
/* [out] */DWORDByReference pdwHelpContext,
|
||||
/* [out] */BSTRByReference pBstrHelpFile);
|
||||
|
||||
public HRESULT IsName(
|
||||
/* [annotation][out][in] */
|
||||
LPOLESTR szNameBuf,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [out] */BOOLByReference pfName);
|
||||
|
||||
public HRESULT FindName(
|
||||
/* [annotation][out][in] */
|
||||
BSTRByReference szNameBuf,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [length_is][size_is][out] */ITypeInfo[] ppTInfo,
|
||||
/* [length_is][size_is][out] */MEMBERID[] rgMemId,
|
||||
/* [out][in] */USHORTByReference pcFound);
|
||||
|
||||
public void ReleaseTLibAttr(/* [in] */TLIBATTR pTLibAttr);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.platform.win32.Guid.IID;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeInfo interface
|
||||
*
|
||||
* Method Name V-Table Offset IUnknown.QueryInterface 0 IUnknown.AddRef 4
|
||||
* IUnknown.Release 8
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public interface IUnknown {
|
||||
|
||||
/** The Constant IID_IDispatch. */
|
||||
public final static IID IID_IUNKNOWN = new IID(
|
||||
"{00000000-0000-0000-C000-000000000046}");
|
||||
|
||||
public HRESULT QueryInterface(IID riid, PointerByReference ppvObject);
|
||||
|
||||
public int AddRef();
|
||||
|
||||
public int Release();
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.Guid.GUID;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTR;
|
||||
import com.sun.jna.platform.win32.WinDef.BOOL;
|
||||
import com.sun.jna.platform.win32.WinDef.PVOID;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the IRecordInfo interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class RecordInfo extends Unknown implements IRecordInfo {
|
||||
|
||||
public static class ByReference extends RecordInfo implements
|
||||
Structure.ByReference {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i record info.
|
||||
*/
|
||||
public RecordInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i record info.
|
||||
*
|
||||
* @param pvInstance
|
||||
* the pv instance
|
||||
*/
|
||||
public RecordInfo(Pointer pvInstance) {
|
||||
super(pvInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Record init.
|
||||
*
|
||||
* @param pvNew
|
||||
* the pv new
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT RecordInit(/* [out] */PVOID pvNew) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record clear.
|
||||
*
|
||||
* @param pvExisting
|
||||
* the pv existing
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT RecordClear(
|
||||
/* [in] */PVOID pvExisting) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record copy.
|
||||
*
|
||||
* @param pvExisting
|
||||
* the pv existing
|
||||
* @param pvNew
|
||||
* the pv new
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT RecordCopy(
|
||||
/* [in] */PVOID pvExisting,
|
||||
/* [out] */PVOID pvNew) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the guid.
|
||||
*
|
||||
* @param pguid
|
||||
* the pguid
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetGuid(
|
||||
/* [out] */GUID pguid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @param pbstrName
|
||||
* the pbstr name
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetName(
|
||||
/* [out] */BSTR pbstrName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size.
|
||||
*
|
||||
* @param pcbSize
|
||||
* the pcb size
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetSize(
|
||||
/* [out] */ULONG pcbSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info.
|
||||
*
|
||||
* @param ppTypeInfo
|
||||
* the pp type info
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeInfo(
|
||||
/* [out] */ITypeInfo ppTypeInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field.
|
||||
*
|
||||
* @param pvData
|
||||
* the pv data
|
||||
* @param szFieldName
|
||||
* the sz field name
|
||||
* @param pvarField
|
||||
* the pvar field
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetField(
|
||||
/* [in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [out] */VARIANT pvarField) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field no copy.
|
||||
*
|
||||
* @param pvData
|
||||
* the pv data
|
||||
* @param szFieldName
|
||||
* the sz field name
|
||||
* @param pvarField
|
||||
* the pvar field
|
||||
* @param ppvDataCArray
|
||||
* the ppv data c array
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetFieldNoCopy(
|
||||
/* [in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [out] */VARIANT pvarField,
|
||||
/* [out] */PVOID ppvDataCArray) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put field.
|
||||
*
|
||||
* @param wFlags
|
||||
* the w flags
|
||||
* @param pvData
|
||||
* the pv data
|
||||
* @param szFieldName
|
||||
* the sz field name
|
||||
* @param pvarField
|
||||
* the pvar field
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT PutField(
|
||||
/* [in] */ULONG wFlags,
|
||||
/* [out][in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [in] */VARIANT pvarField) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put field no copy.
|
||||
*
|
||||
* @param wFlags
|
||||
* the w flags
|
||||
* @param pvData
|
||||
* the pv data
|
||||
* @param szFieldName
|
||||
* the sz field name
|
||||
* @param pvarField
|
||||
* the pvar field
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT PutFieldNoCopy(
|
||||
/* [in] */ULONG wFlags,
|
||||
/* [out][in] */PVOID pvData,
|
||||
/* [in] */WString szFieldName,
|
||||
/* [in] */VARIANT pvarField) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field names.
|
||||
*
|
||||
* @param pcNames
|
||||
* the pc names
|
||||
* @param rgBstrNames
|
||||
* the rg bstr names
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetFieldNames(
|
||||
/* [out][in] */ULONG pcNames,
|
||||
/* [length_is][size_is][out] */BSTR rgBstrNames) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is matching type.
|
||||
*
|
||||
* @param pRecordInfo
|
||||
* the record info
|
||||
* @return the bool
|
||||
*/
|
||||
public BOOL IsMatchingType(
|
||||
/* [in] */IRecordInfo pRecordInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record create.
|
||||
*
|
||||
* @return the pvoid
|
||||
*/
|
||||
public PVOID RecordCreate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record create copy.
|
||||
*
|
||||
* @param pvSource
|
||||
* the pv source
|
||||
* @param ppvDest
|
||||
* the ppv dest
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT RecordCreateCopy(
|
||||
/* [in] */PVOID pvSource,
|
||||
/* [out] */PVOID ppvDest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record destroy.
|
||||
*
|
||||
* @param pvRecord
|
||||
* the pv record
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT RecordDestroy(
|
||||
/* [in] */PVOID pvRecord) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.OaIdl.BINDPTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.DESCKIND;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinDef.WORD;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeComp interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TypeComp extends Unknown {
|
||||
|
||||
public static class ByReference extends TypeComp implements
|
||||
Structure.ByReference {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i type comp.
|
||||
*/
|
||||
public TypeComp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i type comp.
|
||||
*
|
||||
* @param pvInstance
|
||||
* the pv instance
|
||||
*/
|
||||
public TypeComp(Pointer pvInstance) {
|
||||
super(pvInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind.
|
||||
*
|
||||
* @param szName
|
||||
* the sz name
|
||||
* @param lHashVal
|
||||
* the l hash val
|
||||
* @param wFlags
|
||||
* the w flags
|
||||
* @param ppTInfo
|
||||
* the pp t info
|
||||
* @param pDescKind
|
||||
* the desc kind
|
||||
* @param pBindPtr
|
||||
* the bind ptr
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT Bind(
|
||||
/* [annotation][in] */
|
||||
WString szName,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [in] */WORD wFlags,
|
||||
/* [out] */PointerByReference ppTInfo,
|
||||
/* [out] */DESCKIND.ByReference pDescKind,
|
||||
/* [out] */BINDPTR.ByReference pBindPtr) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(3,
|
||||
new Object[] { this.getPointer(), szName, lHashVal, wFlags,
|
||||
ppTInfo, pDescKind, pBindPtr }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind type.
|
||||
*
|
||||
* @param szName
|
||||
* the sz name
|
||||
* @param lHashVal
|
||||
* the l hash val
|
||||
* @param ppTInfo
|
||||
* the pp t info
|
||||
* @param ppTComp
|
||||
* the pp t comp
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT BindType(
|
||||
/* [annotation][in] */
|
||||
WString szName,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [out] */PointerByReference ppTInfo,
|
||||
/* [out] */PointerByReference ppTComp) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(4,
|
||||
new Object[] { this.getPointer(), szName, lHashVal, ppTInfo,
|
||||
ppTComp }, HRESULT.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.platform.win32.Guid.REFIID;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPE;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.INVOKEKIND;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.VARDESC;
|
||||
import com.sun.jna.platform.win32.OleAuto.DISPPARAMS;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTR;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTRByReference;
|
||||
import com.sun.jna.platform.win32.WTypes.LPOLESTR;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.PVOID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.UINTByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.WORD;
|
||||
import com.sun.jna.platform.win32.WinDef.WORDByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeInfo interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TypeInfo extends Unknown implements ITypeInfo {
|
||||
|
||||
public static class ByReference extends TypeInfo implements
|
||||
Structure.ByReference {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i type info.
|
||||
*/
|
||||
public TypeInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i type info.
|
||||
*
|
||||
* @param pvInstance
|
||||
* the pv instance
|
||||
*/
|
||||
public TypeInfo(Pointer pvInstance) {
|
||||
super(pvInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type attr.
|
||||
*
|
||||
* @param ppTypeAttr
|
||||
* the pp type attr
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeAttr(
|
||||
/* [out] */PointerByReference ppTypeAttr) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(3,
|
||||
new Object[] { this.getPointer(), ppTypeAttr }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type comp.
|
||||
*
|
||||
* @param ppTComp
|
||||
* the pp t comp
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeComp(
|
||||
/* [out] */PointerByReference ppTComp) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(4,
|
||||
new Object[] { this.getPointer(), ppTComp }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the func desc.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param ppFuncDesc
|
||||
* the pp func desc
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT GetFuncDesc(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */PointerByReference ppFuncDesc) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(5,
|
||||
new Object[] { this.getPointer(), index, ppFuncDesc },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the var desc.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param ppVarDesc
|
||||
* the pp var desc
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT GetVarDesc(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */PointerByReference ppVarDesc) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(6,
|
||||
new Object[] { this.getPointer(), index, ppVarDesc },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the names.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param rgBstrNames
|
||||
* the rg bstr names
|
||||
* @param cMaxNames
|
||||
* the c max names
|
||||
* @param pcNames
|
||||
* the pc names
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT GetNames(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [length_is][size_is][out] */BSTR[] rgBstrNames,
|
||||
/* [in] */UINT cMaxNames,
|
||||
/* [out] */UINTByReference pcNames) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(7,
|
||||
new Object[] { this.getPointer(), memid, rgBstrNames,
|
||||
cMaxNames, pcNames }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ref type of impl type.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param pRefType
|
||||
* the ref type
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetRefTypeOfImplType(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */HREFTYPEByReference pRefType) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(8,
|
||||
new Object[] { this.getPointer(), index, pRefType },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the impl type flags.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param pImplTypeFlags
|
||||
* the impl type flags
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetImplTypeFlags(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */IntByReference pImplTypeFlags) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(9,
|
||||
new Object[] { this.getPointer(), index, pImplTypeFlags },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the i ds of names.
|
||||
*
|
||||
* @param rgszNames
|
||||
* the rgsz names
|
||||
* @param cNames
|
||||
* the c names
|
||||
* @param pMemId
|
||||
* the mem id
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT GetIDsOfNames(
|
||||
/* [size_is][in] */LPOLESTR[] rgszNames,
|
||||
/* [in] */UINT cNames,
|
||||
/* [size_is][out] */MEMBERID[] pMemId) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(10,
|
||||
new Object[] { this.getPointer(), rgszNames, cNames, pMemId },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param pvInstance
|
||||
* the pv instance
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param wFlags
|
||||
* the w flags
|
||||
* @param pDispParams
|
||||
* the disp params
|
||||
* @param pVarResult
|
||||
* the var result
|
||||
* @param pExcepInfo
|
||||
* the excep info
|
||||
* @param puArgErr
|
||||
* the pu arg err
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT Invoke(
|
||||
/* [in] */PVOID pvInstance,
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [in] */WORD wFlags,
|
||||
/* [out][in] */DISPPARAMS.ByReference pDispParams,
|
||||
/* [out] */VARIANT.ByReference pVarResult,
|
||||
/* [out] */EXCEPINFO.ByReference pExcepInfo,
|
||||
/* [out] */UINTByReference puArgErr) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(11,
|
||||
new Object[] { this.getPointer(), pvInstance, memid, wFlags,
|
||||
pDispParams, pVarResult, pExcepInfo, puArgErr },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the documentation.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param pBstrName
|
||||
* the bstr name
|
||||
* @param pBstrDocString
|
||||
* the bstr doc string
|
||||
* @param pdwHelpContext
|
||||
* the pdw help context
|
||||
* @param pBstrHelpFile
|
||||
* the bstr help file
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT GetDocumentation(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [out] */BSTRByReference pBstrName,
|
||||
/* [out] */BSTRByReference pBstrDocString,
|
||||
/* [out] */DWORDByReference pdwHelpContext,
|
||||
/* [out] */BSTRByReference pBstrHelpFile) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(12,
|
||||
new Object[] { this.getPointer(), memid, pBstrName,
|
||||
pBstrDocString, pdwHelpContext, pBstrHelpFile },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dll entry.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param invKind
|
||||
* the inv kind
|
||||
* @param pBstrDllName
|
||||
* the bstr dll name
|
||||
* @param pBstrName
|
||||
* the bstr name
|
||||
* @param pwOrdinal
|
||||
* the pw ordinal
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT GetDllEntry(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [in] */INVOKEKIND invKind,
|
||||
/* [out] */BSTRByReference pBstrDllName,
|
||||
/* [out] */BSTRByReference pBstrName,
|
||||
/* [out] */WORDByReference pwOrdinal) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(13,
|
||||
new Object[] { this.getPointer(), memid, invKind, pBstrDllName,
|
||||
pBstrName, pwOrdinal }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ref type info.
|
||||
*
|
||||
* @param hRefType
|
||||
* the h ref type
|
||||
* @param ppTInfo
|
||||
* the pp t info
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetRefTypeInfo(
|
||||
/* [in] */HREFTYPE hRefType,
|
||||
/* [out] */PointerByReference ppTInfo) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(14,
|
||||
new Object[] { this.getPointer(), hRefType, ppTInfo },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of member.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param invKind
|
||||
* the inv kind
|
||||
* @param ppv
|
||||
* the ppv
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT AddressOfMember(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [in] */INVOKEKIND invKind,
|
||||
/* [out] */PointerByReference ppv) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(15,
|
||||
new Object[] { this.getPointer(), memid, invKind, ppv },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the instance.
|
||||
*
|
||||
* @param pUnkOuter
|
||||
* the unk outer
|
||||
* @param riid
|
||||
* the riid
|
||||
* @param ppvObj
|
||||
* the ppv obj
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT CreateInstance(
|
||||
/* [in] */IUnknown pUnkOuter,
|
||||
/* [in] */REFIID riid,
|
||||
/* [iid_is][out] */PointerByReference ppvObj) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(16,
|
||||
new Object[] { this.getPointer(), pUnkOuter, riid, ppvObj },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mops.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param pBstrMops
|
||||
* the bstr mops
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetMops(
|
||||
/* [in] */MEMBERID memid,
|
||||
/* [out] */BSTRByReference pBstrMops) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(17,
|
||||
new Object[] { this.getPointer(), memid, pBstrMops },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the containing type lib.
|
||||
*
|
||||
* @param ppTLib
|
||||
* the pp t lib
|
||||
* @param pIndex
|
||||
* the index
|
||||
* @return the hresult
|
||||
*/
|
||||
public/* [local] */HRESULT GetContainingTypeLib(
|
||||
/* [out] */PointerByReference ppTLib,
|
||||
/* [out] */UINTByReference pIndex) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(18,
|
||||
new Object[] { this.getPointer(), ppTLib, pIndex },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release type attr.
|
||||
*
|
||||
* @param pTypeAttr
|
||||
* the type attr
|
||||
*/
|
||||
public/* [local] */void ReleaseTypeAttr(
|
||||
/* [in] */TYPEATTR pTypeAttr) {
|
||||
this._invokeNativeVoid(19, new Object[] { this.getPointer(), pTypeAttr });
|
||||
}
|
||||
|
||||
/**
|
||||
* Release func desc.
|
||||
*
|
||||
* @param pFuncDesc
|
||||
* the func desc
|
||||
*/
|
||||
public/* [local] */void ReleaseFuncDesc(
|
||||
/* [in] */FUNCDESC pFuncDesc) {
|
||||
this._invokeNativeVoid(20, new Object[] { this.getPointer(), pFuncDesc });
|
||||
}
|
||||
|
||||
/**
|
||||
* Release var desc.
|
||||
*
|
||||
* @param pVarDesc
|
||||
* the var desc
|
||||
*/
|
||||
public/* [local] */void ReleaseVarDesc(
|
||||
/* [in] */VARDESC pVarDesc) {
|
||||
this._invokeNativeVoid(21, new Object[] { this.getPointer(), pVarDesc });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,681 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.platform.win32.Guid.REFIID;
|
||||
import com.sun.jna.platform.win32.OaIdl.EXCEPINFO;
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPE;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference;
|
||||
import com.sun.jna.platform.win32.OaIdl.INVOKEKIND;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.VARDESC;
|
||||
import com.sun.jna.platform.win32.OleAuto;
|
||||
import com.sun.jna.platform.win32.OleAuto.DISPPARAMS;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTR;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTRByReference;
|
||||
import com.sun.jna.platform.win32.WTypes.LPOLESTR;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.PVOID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.UINTByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.WORD;
|
||||
import com.sun.jna.platform.win32.WinDef.WORDByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ITypeInfoUtil.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class ITypeInfoUtil.
|
||||
*/
|
||||
public class TypeInfoUtil {
|
||||
|
||||
/** The Constant OLEAUTO. */
|
||||
public final static OleAuto OLEAUTO = OleAuto.INSTANCE;
|
||||
|
||||
/** The type info. */
|
||||
private ITypeInfo typeInfo;
|
||||
|
||||
/**
|
||||
* Instantiates a new i type info util.
|
||||
*
|
||||
* @param typeInfo
|
||||
* the type info
|
||||
*/
|
||||
public TypeInfoUtil(ITypeInfo typeInfo) {
|
||||
this.typeInfo = typeInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type attr.
|
||||
*
|
||||
* @return the type attr
|
||||
*/
|
||||
public TYPEATTR getTypeAttr() {
|
||||
PointerByReference ppTypeAttr = new PointerByReference();
|
||||
HRESULT hr = this.typeInfo.GetTypeAttr(ppTypeAttr);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new TYPEATTR(ppTypeAttr.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type comp.
|
||||
*
|
||||
* @return the type comp
|
||||
*/
|
||||
public TypeComp getTypeComp() {
|
||||
PointerByReference ppTypeAttr = new PointerByReference();
|
||||
HRESULT hr = this.typeInfo.GetTypeComp(ppTypeAttr);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new TypeComp(ppTypeAttr.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the func desc.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the func desc
|
||||
*/
|
||||
public FUNCDESC getFuncDesc(int index) {
|
||||
PointerByReference ppFuncDesc = new PointerByReference();
|
||||
HRESULT hr = this.typeInfo.GetFuncDesc(new UINT(index), ppFuncDesc);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new FUNCDESC(ppFuncDesc.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the var desc.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the var desc
|
||||
*/
|
||||
public VARDESC getVarDesc(int index) {
|
||||
PointerByReference ppVarDesc = new PointerByReference();
|
||||
HRESULT hr = this.typeInfo.GetVarDesc(new UINT(index), ppVarDesc);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new VARDESC(ppVarDesc.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the names.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param maxNames
|
||||
* the max names
|
||||
* @return the names
|
||||
*/
|
||||
public String[] getNames(MEMBERID memid, int maxNames) {
|
||||
BSTR[] rgBstrNames = new BSTR[maxNames];
|
||||
UINTByReference pcNames = new UINTByReference();
|
||||
HRESULT hr = this.typeInfo.GetNames(memid, rgBstrNames, new UINT(
|
||||
maxNames), pcNames);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
int cNames = pcNames.getValue().intValue();
|
||||
String[] result = new String[cNames];
|
||||
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = rgBstrNames[i].getValue();
|
||||
OLEAUTO.SysFreeString(rgBstrNames[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ref type of impl type.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the ref type of impl type
|
||||
*/
|
||||
public HREFTYPE getRefTypeOfImplType(int index) {
|
||||
HREFTYPEByReference ppTInfo = new HREFTYPEByReference();
|
||||
HRESULT hr = this.typeInfo.GetRefTypeOfImplType(new UINT(index),
|
||||
ppTInfo);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return ppTInfo.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the impl type flags.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the impl type flags
|
||||
*/
|
||||
public int getImplTypeFlags(int index) {
|
||||
IntByReference pImplTypeFlags = new IntByReference();
|
||||
HRESULT hr = this.typeInfo.GetImplTypeFlags(new UINT(index),
|
||||
pImplTypeFlags);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return pImplTypeFlags.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the i ds of names.
|
||||
*
|
||||
* @param rgszNames
|
||||
* the rgsz names
|
||||
* @param cNames
|
||||
* the c names
|
||||
* @return the i ds of names
|
||||
*/
|
||||
public MEMBERID[] getIDsOfNames(LPOLESTR[] rgszNames, int cNames) {
|
||||
MEMBERID[] pMemId = new MEMBERID[cNames];
|
||||
HRESULT hr = this.typeInfo.GetIDsOfNames(rgszNames, new UINT(cNames),
|
||||
pMemId);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return pMemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke.
|
||||
*
|
||||
* @param pvInstance
|
||||
* the pv instance
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param wFlags
|
||||
* the w flags
|
||||
* @param pDispParams
|
||||
* the disp params
|
||||
* @return the invoke
|
||||
*/
|
||||
public Invoke Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags,
|
||||
DISPPARAMS.ByReference pDispParams) {
|
||||
|
||||
VARIANT.ByReference pVarResult = new VARIANT.ByReference();
|
||||
EXCEPINFO.ByReference pExcepInfo = new EXCEPINFO.ByReference();
|
||||
UINTByReference puArgErr = new UINTByReference();
|
||||
|
||||
HRESULT hr = this.typeInfo.Invoke(pvInstance, memid, wFlags,
|
||||
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new Invoke(pVarResult, pExcepInfo, puArgErr.getValue()
|
||||
.intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class Invoke.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class Invoke.
|
||||
*/
|
||||
public static class Invoke {
|
||||
|
||||
/** The p var result. */
|
||||
private VARIANT.ByReference pVarResult;
|
||||
|
||||
/** The p excep info. */
|
||||
private EXCEPINFO.ByReference pExcepInfo;
|
||||
|
||||
/** The pu arg err. */
|
||||
private int puArgErr;
|
||||
|
||||
/**
|
||||
* Instantiates a new invoke.
|
||||
*
|
||||
* @param pVarResult
|
||||
* the var result
|
||||
* @param pExcepInfo
|
||||
* the excep info
|
||||
* @param puArgErr
|
||||
* the pu arg err
|
||||
*/
|
||||
public Invoke(VARIANT.ByReference pVarResult,
|
||||
EXCEPINFO.ByReference pExcepInfo, int puArgErr) {
|
||||
this.pVarResult = pVarResult;
|
||||
this.pExcepInfo = pExcepInfo;
|
||||
this.puArgErr = puArgErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the p var result.
|
||||
*
|
||||
* @return the p var result
|
||||
*/
|
||||
public VARIANT.ByReference getpVarResult() {
|
||||
return pVarResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the p excep info.
|
||||
*
|
||||
* @return the p excep info
|
||||
*/
|
||||
public EXCEPINFO.ByReference getpExcepInfo() {
|
||||
return pExcepInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pu arg err.
|
||||
*
|
||||
* @return the pu arg err
|
||||
*/
|
||||
public int getPuArgErr() {
|
||||
return puArgErr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the documentation.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @return the documentation
|
||||
*/
|
||||
public TypeInfoDoc getDocumentation(MEMBERID memid) {
|
||||
BSTRByReference pBstrName = new BSTRByReference();
|
||||
BSTRByReference pBstrDocString = new BSTRByReference();
|
||||
DWORDByReference pdwHelpContext = new DWORDByReference();
|
||||
BSTRByReference pBstrHelpFile = new BSTRByReference();
|
||||
|
||||
HRESULT hr = this.typeInfo.GetDocumentation(memid, pBstrName,
|
||||
pBstrDocString, pdwHelpContext, pBstrHelpFile);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
TypeInfoDoc TypeInfoDoc = new TypeInfoDoc(pBstrName.getString(),
|
||||
pBstrDocString.getString(), pdwHelpContext.getValue()
|
||||
.intValue(), pBstrHelpFile.getString());
|
||||
|
||||
OLEAUTO.SysFreeString(pBstrName.getValue());
|
||||
OLEAUTO.SysFreeString(pBstrDocString.getValue());
|
||||
OLEAUTO.SysFreeString(pBstrHelpFile.getValue());
|
||||
|
||||
return TypeInfoDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TypeInfoDoc.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class TypeInfoDoc.
|
||||
*/
|
||||
public static class TypeInfoDoc {
|
||||
|
||||
/** The name. */
|
||||
private String name;
|
||||
|
||||
/** The doc string. */
|
||||
private String docString;
|
||||
|
||||
/** The help context. */
|
||||
private int helpContext;
|
||||
|
||||
/** The help file. */
|
||||
private String helpFile;
|
||||
|
||||
/**
|
||||
* Instantiates a new type info doc.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param docString
|
||||
* the doc string
|
||||
* @param helpContext
|
||||
* the help context
|
||||
* @param helpFile
|
||||
* the help file
|
||||
*/
|
||||
public TypeInfoDoc(String name, String docString, int helpContext,
|
||||
String helpFile) {
|
||||
this.name = name;
|
||||
this.docString = docString;
|
||||
this.helpContext = helpContext;
|
||||
this.helpFile = helpFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the doc string.
|
||||
*
|
||||
* @return the doc string
|
||||
*/
|
||||
public String getDocString() {
|
||||
return docString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the help context.
|
||||
*
|
||||
* @return the help context
|
||||
*/
|
||||
public int getHelpContext() {
|
||||
return helpContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the help file.
|
||||
*
|
||||
* @return the help file
|
||||
*/
|
||||
public String getHelpFile() {
|
||||
return helpFile;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dll entry.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param invKind
|
||||
* the inv kind
|
||||
* @return the dll entry
|
||||
*/
|
||||
public DllEntry GetDllEntry(MEMBERID memid, INVOKEKIND invKind) {
|
||||
BSTRByReference pBstrDllName = new BSTRByReference();
|
||||
BSTRByReference pBstrName = new BSTRByReference();
|
||||
WORDByReference pwOrdinal = new WORDByReference();
|
||||
|
||||
HRESULT hr = this.typeInfo.GetDllEntry(memid, invKind, pBstrDllName,
|
||||
pBstrName, pwOrdinal);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
OLEAUTO.SysFreeString(pBstrDllName.getValue());
|
||||
OLEAUTO.SysFreeString(pBstrName.getValue());
|
||||
|
||||
return new DllEntry(pBstrDllName.getString(), pBstrName.getString(),
|
||||
pwOrdinal.getValue().intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class DllEntry.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class DllEntry.
|
||||
*/
|
||||
public static class DllEntry {
|
||||
|
||||
/** The dll name. */
|
||||
private String dllName;
|
||||
|
||||
/** The name. */
|
||||
private String name;
|
||||
|
||||
/** The ordinal. */
|
||||
private int ordinal;
|
||||
|
||||
/**
|
||||
* Instantiates a new dll entry.
|
||||
*
|
||||
* @param dllName
|
||||
* the dll name
|
||||
* @param name
|
||||
* the name
|
||||
* @param ordinal
|
||||
* the ordinal
|
||||
*/
|
||||
public DllEntry(String dllName, String name, int ordinal) {
|
||||
this.dllName = dllName;
|
||||
this.name = name;
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dll name.
|
||||
*
|
||||
* @return the dll name
|
||||
*/
|
||||
public String getDllName() {
|
||||
return dllName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dll name.
|
||||
*
|
||||
* @param dllName
|
||||
* the new dll name
|
||||
*/
|
||||
public void setDllName(String dllName) {
|
||||
this.dllName = dllName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name
|
||||
* the new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ordinal.
|
||||
*
|
||||
* @return the ordinal
|
||||
*/
|
||||
public int getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ordinal.
|
||||
*
|
||||
* @param ordinal
|
||||
* the new ordinal
|
||||
*/
|
||||
public void setOrdinal(int ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ref type info.
|
||||
*
|
||||
* @param hreftype
|
||||
* the hreftype
|
||||
* @return the ref type info
|
||||
*/
|
||||
public ITypeInfo getRefTypeInfo(HREFTYPE hreftype) {
|
||||
PointerByReference ppTInfo = new PointerByReference();
|
||||
HRESULT hr = this.typeInfo.GetRefTypeInfo(hreftype, ppTInfo);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new TypeInfo(ppTInfo.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of member.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @param invKind
|
||||
* the inv kind
|
||||
* @return the pointer by reference
|
||||
*/
|
||||
public PointerByReference AddressOfMember(MEMBERID memid, INVOKEKIND invKind) {
|
||||
PointerByReference ppv = new PointerByReference();
|
||||
HRESULT hr = this.typeInfo.AddressOfMember(memid, invKind, ppv);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return ppv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the instance.
|
||||
*
|
||||
* @param pUnkOuter
|
||||
* the unk outer
|
||||
* @param riid
|
||||
* the riid
|
||||
* @return the pointer by reference
|
||||
*/
|
||||
public PointerByReference CreateInstance(IUnknown pUnkOuter, REFIID riid) {
|
||||
PointerByReference ppvObj = new PointerByReference();
|
||||
HRESULT hr = this.typeInfo.CreateInstance(pUnkOuter, riid, ppvObj);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return ppvObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mops.
|
||||
*
|
||||
* @param memid
|
||||
* the memid
|
||||
* @return the string
|
||||
*/
|
||||
public String GetMops(MEMBERID memid) {
|
||||
|
||||
BSTRByReference pBstrMops = new BSTRByReference();
|
||||
HRESULT hr = this.typeInfo.GetMops(memid, pBstrMops);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return pBstrMops.getString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the containing type lib.
|
||||
*
|
||||
* @return the containing type lib
|
||||
*/
|
||||
public ContainingTypeLib GetContainingTypeLib() {
|
||||
|
||||
PointerByReference ppTLib = new PointerByReference();
|
||||
UINTByReference pIndex = new UINTByReference();
|
||||
|
||||
HRESULT hr = this.typeInfo.GetContainingTypeLib(ppTLib, pIndex);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new ContainingTypeLib(new TypeLib(ppTLib.getValue()), pIndex
|
||||
.getValue().intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class ContainingTypeLib.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class ContainingTypeLib.
|
||||
*/
|
||||
public static class ContainingTypeLib {
|
||||
|
||||
/** The type lib. */
|
||||
private ITypeLib typeLib;
|
||||
|
||||
/** The index. */
|
||||
private int index;
|
||||
|
||||
/**
|
||||
* Instantiates a new containing type lib.
|
||||
*
|
||||
* @param typeLib
|
||||
* the type lib
|
||||
* @param index
|
||||
* the index
|
||||
*/
|
||||
public ContainingTypeLib(ITypeLib typeLib, int index) {
|
||||
this.typeLib = typeLib;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type lib.
|
||||
*
|
||||
* @return the type lib
|
||||
*/
|
||||
public ITypeLib getTypeLib() {
|
||||
return typeLib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type lib.
|
||||
*
|
||||
* @param typeLib
|
||||
* the new type lib
|
||||
*/
|
||||
public void setTypeLib(ITypeLib typeLib) {
|
||||
this.typeLib = typeLib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the index.
|
||||
*
|
||||
* @return the index
|
||||
*/
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the index.
|
||||
*
|
||||
* @param index
|
||||
* the new index
|
||||
*/
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Release type attr.
|
||||
*
|
||||
* @param pTypeAttr
|
||||
* the type attr
|
||||
*/
|
||||
public void ReleaseTypeAttr(TYPEATTR pTypeAttr) {
|
||||
this.typeInfo.ReleaseTypeAttr(pTypeAttr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release func desc.
|
||||
*
|
||||
* @param pFuncDesc
|
||||
* the func desc
|
||||
*/
|
||||
public void ReleaseFuncDesc(FUNCDESC pFuncDesc) {
|
||||
this.typeInfo.ReleaseFuncDesc(pFuncDesc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release var desc.
|
||||
*
|
||||
* @param pVarDesc
|
||||
* the var desc
|
||||
*/
|
||||
public void ReleaseVarDesc(VARDESC pVarDesc) {
|
||||
this.typeInfo.ReleaseVarDesc(pVarDesc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.platform.win32.Guid.GUID;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TLIBATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEKIND;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTRByReference;
|
||||
import com.sun.jna.platform.win32.WTypes.LPOLESTR;
|
||||
import com.sun.jna.platform.win32.WinDef.BOOLByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinDef.USHORTByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeLib interface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TypeLib extends Unknown implements ITypeLib {
|
||||
|
||||
public static class ByReference extends TypeLib implements
|
||||
Structure.ByReference {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i type lib.
|
||||
*/
|
||||
public TypeLib() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i type lib.
|
||||
*
|
||||
* @param pvInstance
|
||||
* the pv instance
|
||||
*/
|
||||
public TypeLib(Pointer pvInstance) {
|
||||
super(pvInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info count.
|
||||
*
|
||||
* @return the uint
|
||||
*/
|
||||
public UINT GetTypeInfoCount() {
|
||||
return (UINT) this._invokeNativeObject(3,
|
||||
new Object[] { this.getPointer() }, UINT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param pTInfo
|
||||
* the t info
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeInfo(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */PointerByReference pTInfo) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(4,
|
||||
new Object[] { this.getPointer(), index, pTInfo },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info type.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param pTKind
|
||||
* the t kind
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeInfoType(
|
||||
/* [in] */UINT index,
|
||||
/* [out] */TYPEKIND.ByReference pTKind) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(5,
|
||||
new Object[] { this.getPointer(), index, pTKind },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info of guid.
|
||||
*
|
||||
* @param guid
|
||||
* the guid
|
||||
* @param pTinfo
|
||||
* the tinfo
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeInfoOfGuid(
|
||||
/* [in] */GUID guid,
|
||||
/* [out] */PointerByReference pTinfo) {
|
||||
|
||||
return (HRESULT) this
|
||||
._invokeNativeObject(6, new Object[] { this.getPointer(), guid,
|
||||
pTinfo }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lib attr.
|
||||
*
|
||||
* @param ppTLibAttr
|
||||
* the pp t lib attr
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetLibAttr(
|
||||
/* [out] */PointerByReference ppTLibAttr) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(7,
|
||||
new Object[] { this.getPointer(), ppTLibAttr }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type comp.
|
||||
*
|
||||
* @param pTComp
|
||||
* the t comp
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetTypeComp(
|
||||
/* [out] */PointerByReference pTComp) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(8,
|
||||
new Object[] { this.getPointer(), pTComp }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the documentation.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param pBstrName
|
||||
* the bstr name
|
||||
* @param pBstrDocString
|
||||
* the bstr doc string
|
||||
* @param pdwHelpContext
|
||||
* the pdw help context
|
||||
* @param pBstrHelpFile
|
||||
* the bstr help file
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT GetDocumentation(
|
||||
/* [in] */int index,
|
||||
/* [out] */BSTRByReference pBstrName,
|
||||
/* [out] */BSTRByReference pBstrDocString,
|
||||
/* [out] */DWORDByReference pdwHelpContext,
|
||||
/* [out] */BSTRByReference pBstrHelpFile) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(9,
|
||||
new Object[] { this.getPointer(), index, pBstrName,
|
||||
pBstrDocString, pdwHelpContext, pBstrHelpFile },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is name.
|
||||
*
|
||||
* @param szNameBuf
|
||||
* the sz name buf
|
||||
* @param lHashVal
|
||||
* the l hash val
|
||||
* @param pfName
|
||||
* the pf name
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT IsName(
|
||||
/* [annotation][out][in] */
|
||||
LPOLESTR szNameBuf,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [out] */BOOLByReference pfName) {
|
||||
|
||||
return (HRESULT) this
|
||||
._invokeNativeObject(10, new Object[] { this.getPointer(),
|
||||
szNameBuf, lHashVal, pfName }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find name.
|
||||
*
|
||||
* @param szNameBuf
|
||||
* the sz name buf
|
||||
* @param lHashVal
|
||||
* the l hash val
|
||||
* @param ppTInfo
|
||||
* the pp t info
|
||||
* @param rgMemId
|
||||
* the rg mem id
|
||||
* @param pcFound
|
||||
* the pc found
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT FindName(
|
||||
/* [annotation][out][in] */
|
||||
BSTRByReference szNameBuf,
|
||||
/* [in] */ULONG lHashVal,
|
||||
/* [length_is][size_is][out] */ITypeInfo[] ppTInfo,
|
||||
/* [length_is][size_is][out] */MEMBERID[] rgMemId,
|
||||
/* [out][in] */USHORTByReference pcFound) {
|
||||
|
||||
return (HRESULT) this._invokeNativeObject(11,
|
||||
new Object[] { this.getPointer(), szNameBuf, lHashVal, ppTInfo,
|
||||
rgMemId, pcFound }, HRESULT.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release t lib attr.
|
||||
*
|
||||
* @param pTLibAttr
|
||||
* the t lib attr
|
||||
*/
|
||||
public void ReleaseTLibAttr(/* [in] */TLIBATTR pTLibAttr) {
|
||||
this._invokeNativeObject(12, new Object[] { this.getPointer() },
|
||||
HRESULT.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,536 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.Guid.CLSID;
|
||||
import com.sun.jna.platform.win32.Kernel32;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TLIBATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEKIND;
|
||||
import com.sun.jna.platform.win32.Ole32;
|
||||
import com.sun.jna.platform.win32.OleAuto;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTRByReference;
|
||||
import com.sun.jna.platform.win32.WTypes.LPOLESTR;
|
||||
import com.sun.jna.platform.win32.WinDef.BOOLByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.DWORDByReference;
|
||||
import com.sun.jna.platform.win32.WinDef.LCID;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinDef.USHORTByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the class ITypeLibUtil.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class ITypeLibUtil.
|
||||
*/
|
||||
public class TypeLibUtil {
|
||||
|
||||
/** The Constant OLEAUTO. */
|
||||
public final static OleAuto OLEAUTO = OleAuto.INSTANCE;
|
||||
|
||||
/** The typelib. */
|
||||
private ITypeLib typelib;
|
||||
// get user default lcid
|
||||
/** The lcid. */
|
||||
private LCID lcid = Kernel32.INSTANCE.GetUserDefaultLCID();
|
||||
|
||||
/** The name. */
|
||||
private String name;
|
||||
|
||||
/** The doc string. */
|
||||
private String docString;
|
||||
|
||||
/** The help context. */
|
||||
private int helpContext;
|
||||
|
||||
/** The help file. */
|
||||
private String helpFile;
|
||||
|
||||
/**
|
||||
* Instantiates a new i type lib util.
|
||||
*
|
||||
* @param clsidStr
|
||||
* the clsid str
|
||||
* @param wVerMajor
|
||||
* the w ver major
|
||||
* @param wVerMinor
|
||||
* the w ver minor
|
||||
*/
|
||||
public TypeLibUtil(String clsidStr, int wVerMajor, int wVerMinor) {
|
||||
CLSID.ByReference clsid = new CLSID.ByReference();
|
||||
// get CLSID from string
|
||||
HRESULT hr = Ole32.INSTANCE.CLSIDFromString(new WString(clsidStr),
|
||||
clsid);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
// load typelib
|
||||
PointerByReference pTypeLib = new PointerByReference();
|
||||
hr = OleAuto.INSTANCE.LoadRegTypeLib(clsid, wVerMajor, wVerMinor, lcid,
|
||||
pTypeLib);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
// init type lib class
|
||||
this.typelib = new TypeLib(pTypeLib.getValue());
|
||||
|
||||
this.initTypeLibInfo();
|
||||
}
|
||||
|
||||
public TypeLibUtil(String file) {
|
||||
// load typelib
|
||||
PointerByReference pTypeLib = new PointerByReference();
|
||||
HRESULT hr = OleAuto.INSTANCE.LoadTypeLib(new WString(file), pTypeLib);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
// init type lib class
|
||||
this.typelib = new TypeLib(pTypeLib.getValue());
|
||||
|
||||
this.initTypeLibInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the type lib info.
|
||||
*/
|
||||
private void initTypeLibInfo() {
|
||||
TypeLibDoc documentation = this.getDocumentation(-1);
|
||||
this.name = documentation.getName();
|
||||
this.docString = documentation.getDocString();
|
||||
this.helpContext = documentation.getHelpContext();
|
||||
this.helpFile = documentation.getHelpFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info count.
|
||||
*
|
||||
* @return the type info count
|
||||
*/
|
||||
public int getTypeInfoCount() {
|
||||
return this.typelib.GetTypeInfoCount().intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info type.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the type info type
|
||||
*/
|
||||
public TYPEKIND getTypeInfoType(int index) {
|
||||
TYPEKIND.ByReference typekind = new TYPEKIND.ByReference();
|
||||
HRESULT hr = this.typelib.GetTypeInfoType(new UINT(index), typekind);
|
||||
COMUtils.checkRC(hr);
|
||||
return typekind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the type info
|
||||
*/
|
||||
public ITypeInfo getTypeInfo(int index) {
|
||||
PointerByReference ppTInfo = new PointerByReference();
|
||||
HRESULT hr = this.typelib.GetTypeInfo(new UINT(index), ppTInfo);
|
||||
COMUtils.checkRC(hr);
|
||||
return new TypeInfo(ppTInfo.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type info util.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the type info util
|
||||
*/
|
||||
public TypeInfoUtil getTypeInfoUtil(int index) {
|
||||
return new TypeInfoUtil(this.getTypeInfo(index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lib attr.
|
||||
*
|
||||
* @return the lib attr
|
||||
*/
|
||||
public TLIBATTR getLibAttr() {
|
||||
PointerByReference ppTLibAttr = new PointerByReference();
|
||||
HRESULT hr = typelib.GetLibAttr(ppTLibAttr);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new TLIBATTR(ppTLibAttr.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type comp.
|
||||
*
|
||||
* @return the i type comp. by reference
|
||||
*/
|
||||
public TypeComp GetTypeComp() {
|
||||
PointerByReference ppTComp = new PointerByReference();
|
||||
HRESULT hr = this.typelib.GetTypeComp(ppTComp);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new TypeComp(ppTComp.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the documentation.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @return the documentation
|
||||
*/
|
||||
public TypeLibDoc getDocumentation(int index) {
|
||||
BSTRByReference pBstrName = new BSTRByReference();
|
||||
BSTRByReference pBstrDocString = new BSTRByReference();
|
||||
DWORDByReference pdwHelpContext = new DWORDByReference();
|
||||
BSTRByReference pBstrHelpFile = new BSTRByReference();
|
||||
|
||||
HRESULT hr = typelib.GetDocumentation(index, pBstrName, pBstrDocString,
|
||||
pdwHelpContext, pBstrHelpFile);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
TypeLibDoc typeLibDoc = new TypeLibDoc(pBstrName.getString(),
|
||||
pBstrDocString.getString(), pdwHelpContext.getValue()
|
||||
.intValue(), pBstrHelpFile.getString());
|
||||
|
||||
OLEAUTO.SysFreeString(pBstrName.getValue());
|
||||
OLEAUTO.SysFreeString(pBstrDocString.getValue());
|
||||
OLEAUTO.SysFreeString(pBstrHelpFile.getValue());
|
||||
|
||||
return typeLibDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TypeLibDoc.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class TypeLibDoc.
|
||||
*/
|
||||
public static class TypeLibDoc {
|
||||
|
||||
/** The name. */
|
||||
private String name;
|
||||
|
||||
/** The doc string. */
|
||||
private String docString;
|
||||
|
||||
/** The help context. */
|
||||
private int helpContext;
|
||||
|
||||
/** The help file. */
|
||||
private String helpFile;
|
||||
|
||||
/**
|
||||
* Instantiates a new type lib doc.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param docString
|
||||
* the doc string
|
||||
* @param helpContext
|
||||
* the help context
|
||||
* @param helpFile
|
||||
* the help file
|
||||
*/
|
||||
public TypeLibDoc(String name, String docString, int helpContext,
|
||||
String helpFile) {
|
||||
this.name = name;
|
||||
this.docString = docString;
|
||||
this.helpContext = helpContext;
|
||||
this.helpFile = helpFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the doc string.
|
||||
*
|
||||
* @return the doc string
|
||||
*/
|
||||
public String getDocString() {
|
||||
return docString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the help context.
|
||||
*
|
||||
* @return the help context
|
||||
*/
|
||||
public int getHelpContext() {
|
||||
return helpContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the help file.
|
||||
*
|
||||
* @return the help file
|
||||
*/
|
||||
public String getHelpFile() {
|
||||
return helpFile;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is name.
|
||||
*
|
||||
* @param nameBuf
|
||||
* the name buf
|
||||
* @param hashVal
|
||||
* the hash val
|
||||
* @return the checks if is name
|
||||
*/
|
||||
public IsName IsName(String nameBuf, int hashVal) {
|
||||
|
||||
LPOLESTR szNameBuf = new LPOLESTR(nameBuf);
|
||||
ULONG lHashVal = new ULONG(hashVal);
|
||||
BOOLByReference pfName = new BOOLByReference();
|
||||
|
||||
HRESULT hr = this.typelib.IsName(szNameBuf, lHashVal, pfName);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
return new IsName(szNameBuf.getValue(), pfName.getValue()
|
||||
.booleanValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class IsName.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class IsName.
|
||||
*/
|
||||
public static class IsName {
|
||||
|
||||
/** The name buf. */
|
||||
private String nameBuf;
|
||||
|
||||
/** The name. */
|
||||
private boolean name;
|
||||
|
||||
/**
|
||||
* Instantiates a new checks if is name.
|
||||
*
|
||||
* @param nameBuf
|
||||
* the name buf
|
||||
* @param name
|
||||
* the name
|
||||
*/
|
||||
public IsName(String nameBuf, boolean name) {
|
||||
this.nameBuf = nameBuf;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name buf.
|
||||
*
|
||||
* @return the name buf
|
||||
*/
|
||||
public String getNameBuf() {
|
||||
return nameBuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is name.
|
||||
*
|
||||
* @return true, if is name
|
||||
*/
|
||||
public boolean isName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find name.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param hashVal
|
||||
* the hash val
|
||||
* @param found
|
||||
* the found
|
||||
* @return the find name
|
||||
*/
|
||||
public FindName FindName(String name, int hashVal, short found) {
|
||||
/* [annotation][out][in] */
|
||||
BSTRByReference szNameBuf = new BSTRByReference(
|
||||
OleAuto.INSTANCE.SysAllocString(name));
|
||||
/* [in] */ULONG lHashVal = new ULONG(hashVal);
|
||||
/* [out][in] */USHORTByReference pcFound = new USHORTByReference(found);
|
||||
|
||||
HRESULT hr = this.typelib.FindName(szNameBuf, lHashVal, null, null,
|
||||
pcFound);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
found = pcFound.getValue().shortValue();
|
||||
/* [length_is][size_is][out] */ITypeInfo[] ppTInfo = new ITypeInfo[found];
|
||||
/* [length_is][size_is][out] */MEMBERID[] rgMemId = new MEMBERID[found];
|
||||
hr = this.typelib.FindName(szNameBuf, lHashVal, ppTInfo, rgMemId,
|
||||
pcFound);
|
||||
COMUtils.checkRC(hr);
|
||||
|
||||
FindName findName = new FindName(szNameBuf.getString(), ppTInfo,
|
||||
rgMemId, found);
|
||||
OLEAUTO.SysFreeString(szNameBuf.getValue());
|
||||
|
||||
return findName;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class FindName.
|
||||
*
|
||||
* @author wolf.tobias@gmx.net The Class FindName.
|
||||
*/
|
||||
public static class FindName {
|
||||
|
||||
/** The name buf. */
|
||||
private String nameBuf;
|
||||
|
||||
/** The p t info. */
|
||||
private ITypeInfo[] pTInfo;
|
||||
|
||||
/** The rg mem id. */
|
||||
private MEMBERID[] rgMemId;
|
||||
|
||||
/** The pc found. */
|
||||
private short pcFound;
|
||||
|
||||
/**
|
||||
* Instantiates a new find name.
|
||||
*
|
||||
* @param nameBuf
|
||||
* the name buf
|
||||
* @param pTInfo
|
||||
* the t info
|
||||
* @param rgMemId
|
||||
* the rg mem id
|
||||
* @param pcFound
|
||||
* the pc found
|
||||
*/
|
||||
public FindName(String nameBuf, ITypeInfo[] pTInfo, MEMBERID[] rgMemId,
|
||||
short pcFound) {
|
||||
this.nameBuf = nameBuf;
|
||||
this.pTInfo = pTInfo;
|
||||
this.rgMemId = rgMemId;
|
||||
this.pcFound = pcFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name buf.
|
||||
*
|
||||
* @return the name buf
|
||||
*/
|
||||
public String getNameBuf() {
|
||||
return nameBuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the t info.
|
||||
*
|
||||
* @return the t info
|
||||
*/
|
||||
public ITypeInfo[] getTInfo() {
|
||||
return pTInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mem id.
|
||||
*
|
||||
* @return the mem id
|
||||
*/
|
||||
public MEMBERID[] getMemId() {
|
||||
return rgMemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the found.
|
||||
*
|
||||
* @return the found
|
||||
*/
|
||||
public short getFound() {
|
||||
return pcFound;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Release t lib attr.
|
||||
*
|
||||
* @param pTLibAttr
|
||||
* the t lib attr
|
||||
*/
|
||||
public void ReleaseTLibAttr(/* [in] */TLIBATTR pTLibAttr) {
|
||||
this.typelib.ReleaseTLibAttr(pTLibAttr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lcid.
|
||||
*
|
||||
* @return the lcid
|
||||
*/
|
||||
public LCID getLcid() {
|
||||
return lcid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the typelib.
|
||||
*
|
||||
* @return the typelib
|
||||
*/
|
||||
public ITypeLib getTypelib() {
|
||||
return typelib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the doc string.
|
||||
*
|
||||
* @return the doc string
|
||||
*/
|
||||
public String getDocString() {
|
||||
return docString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the help context.
|
||||
*
|
||||
* @return the help context
|
||||
*/
|
||||
public long getHelpContext() {
|
||||
return helpContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the help file.
|
||||
*
|
||||
* @return the help file
|
||||
*/
|
||||
public String getHelpFile() {
|
||||
return helpFile;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/* Copyright (c) 2012 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.platform.win32.Guid.IID;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* Wrapper class for the ITypeInfo interface
|
||||
*
|
||||
* Method Name V-Table Offset IUnknown.QueryInterface 0 IUnknown.AddRef 4
|
||||
* IUnknown.Release 8
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class Unknown extends COMInvoker implements IUnknown {
|
||||
|
||||
public static class ByReference extends Unknown implements
|
||||
Structure.ByReference {
|
||||
}
|
||||
|
||||
public Unknown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new i unknown.
|
||||
*
|
||||
* @param pvInstance
|
||||
* the pv instance
|
||||
*/
|
||||
public Unknown(Pointer pvInstance) {
|
||||
this.setPointer(pvInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query interface.
|
||||
*
|
||||
* @param riid
|
||||
* the riid
|
||||
* @param ppvObject
|
||||
* the ppv object
|
||||
* @return the hresult
|
||||
*/
|
||||
public HRESULT QueryInterface(IID riid, PointerByReference ppvObject) {
|
||||
return (HRESULT) this._invokeNativeObject(0,
|
||||
new Object[] { this.getPointer(), riid, ppvObject },
|
||||
HRESULT.class);
|
||||
}
|
||||
|
||||
public int AddRef() {
|
||||
return this._invokeNativeInt(1, new Object[] { this.getPointer() });
|
||||
}
|
||||
|
||||
public int Release() {
|
||||
return this._invokeNativeInt(2, new Object[] { this.getPointer() });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
Provides...
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,231 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEKIND;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
import com.sun.jna.platform.win32.COM.tlb.imp.TlbBase;
|
||||
import com.sun.jna.platform.win32.COM.tlb.imp.TlbCmdlineArgs;
|
||||
import com.sun.jna.platform.win32.COM.tlb.imp.TlbCoClass;
|
||||
import com.sun.jna.platform.win32.COM.tlb.imp.TlbConst;
|
||||
import com.sun.jna.platform.win32.COM.tlb.imp.TlbDispInterface;
|
||||
import com.sun.jna.platform.win32.COM.tlb.imp.TlbEnum;
|
||||
import com.sun.jna.platform.win32.COM.tlb.imp.TlbInterface;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbImp.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbImp implements TlbConst {
|
||||
|
||||
/** The type lib util. */
|
||||
private TypeLibUtil typeLibUtil;
|
||||
|
||||
/** The out. */
|
||||
private File comRootDir;
|
||||
|
||||
private File outputDir;
|
||||
|
||||
private TlbCmdlineArgs cmdlineArgs;
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
*
|
||||
* @param args
|
||||
* the arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new TlbImp(args);
|
||||
}
|
||||
|
||||
public TlbImp(String[] args) {
|
||||
this.cmdlineArgs = new TlbCmdlineArgs(args);
|
||||
|
||||
if (this.cmdlineArgs.isTlbId()) {
|
||||
String clsid = this.cmdlineArgs.getRequiredParam(CMD_ARG_TYPELIB_ID);
|
||||
int majorVersion = this.cmdlineArgs
|
||||
.getIntParam(CMD_ARG_TYPELIB_MAJOR_VERSION);
|
||||
int minorVersion = this.cmdlineArgs
|
||||
.getIntParam(CMD_ARG_TYPELIB_MINOR_VERSION);
|
||||
|
||||
// initialize typelib
|
||||
// check version numbers with registry entries!!!
|
||||
this.typeLibUtil = new TypeLibUtil(clsid, majorVersion,
|
||||
minorVersion);
|
||||
this.startCOM2Java();
|
||||
} else if (this.cmdlineArgs.isTlbFile()) {
|
||||
String file = this.cmdlineArgs.getRequiredParam(CMD_ARG_TYPELIB_FILE);
|
||||
// initialize typelib
|
||||
// check version numbers with registry entries!!!
|
||||
this.typeLibUtil = new TypeLibUtil(file);
|
||||
this.startCOM2Java();
|
||||
} else
|
||||
this.cmdlineArgs.showCmdHelp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start startCOM2Java.
|
||||
*/
|
||||
public void startCOM2Java() {
|
||||
try {
|
||||
// create output Dir
|
||||
this.createDir();
|
||||
|
||||
String bindingMode = this.cmdlineArgs.getBindingMode();
|
||||
|
||||
int typeInfoCount = typeLibUtil.getTypeInfoCount();
|
||||
for (int i = 0; i < typeInfoCount; ++i) {
|
||||
TYPEKIND typekind = typeLibUtil.getTypeInfoType(i);
|
||||
|
||||
if (typekind.value == TYPEKIND.TKIND_ENUM) {
|
||||
this.createCOMEnum(i, this.getPackageName(), typeLibUtil);
|
||||
} else if (typekind.value == TYPEKIND.TKIND_RECORD) {
|
||||
this.logInfo("'TKIND_RECORD' objects are currently not supported!");
|
||||
} else if (typekind.value == TYPEKIND.TKIND_MODULE) {
|
||||
this.logInfo("'TKIND_MODULE' objects are currently not supported!");
|
||||
} else if (typekind.value == TYPEKIND.TKIND_INTERFACE) {
|
||||
this.createCOMInterface(i, this.getPackageName(),
|
||||
typeLibUtil);
|
||||
} else if (typekind.value == TYPEKIND.TKIND_DISPATCH) {
|
||||
this.createCOMDispInterface(i, this.getPackageName(),
|
||||
typeLibUtil);
|
||||
} else if (typekind.value == TYPEKIND.TKIND_COCLASS) {
|
||||
this.createCOMCoClass(i, this.getPackageName(),
|
||||
typeLibUtil, bindingMode);
|
||||
} else if (typekind.value == TYPEKIND.TKIND_ALIAS) {
|
||||
this.logInfo("'TKIND_ALIAS' objects are currently not supported!");
|
||||
} else if (typekind.value == TYPEKIND.TKIND_UNION) {
|
||||
this.logInfo("'TKIND_UNION' objects are currently not supported!");
|
||||
}
|
||||
}
|
||||
|
||||
logInfo(typeInfoCount + " files sucessfully written to: "
|
||||
+ this.comRootDir.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void createDir() throws FileNotFoundException {
|
||||
String _outputDir = this.cmdlineArgs.getParam(CMD_ARG_OUTPUT_DIR);
|
||||
String path = "_jnaCOM_" + System.currentTimeMillis() + "\\myPackage\\"
|
||||
+ this.typeLibUtil.getName().toLowerCase() + "\\";
|
||||
|
||||
if (_outputDir != null) {
|
||||
this.comRootDir = new File(_outputDir + "\\" + path);
|
||||
} else {
|
||||
String tmp = System.getProperty("java.io.tmpdir");
|
||||
this.comRootDir = new File(tmp + "\\" + path);
|
||||
}
|
||||
|
||||
if (this.comRootDir.exists())
|
||||
this.comRootDir.delete();
|
||||
|
||||
if (this.comRootDir.mkdirs()) {
|
||||
logInfo("Output directory sucessfully created.");
|
||||
} else {
|
||||
throw new FileNotFoundException(
|
||||
"Output directory NOT sucessfully created to: "
|
||||
+ this.comRootDir.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private String getPackageName() {
|
||||
return "myPackage." + this.typeLibUtil.getName().toLowerCase();
|
||||
}
|
||||
|
||||
private void writeTextFile(String filename, String str) throws IOException {
|
||||
String file = this.comRootDir + File.separator + filename;
|
||||
BufferedOutputStream bos = new BufferedOutputStream(
|
||||
new FileOutputStream(file));
|
||||
bos.write(str.getBytes());
|
||||
bos.close();
|
||||
}
|
||||
|
||||
private void writeTlbClass(TlbBase tlbBase) throws IOException {
|
||||
StringBuffer classBuffer = tlbBase.getClassBuffer();
|
||||
this.writeTextFile(tlbBase.getFilename(), classBuffer.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the com enum.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @return the string buffer
|
||||
*/
|
||||
private void createCOMEnum(int index, String packagename,
|
||||
TypeLibUtil typeLibUtil) throws IOException {
|
||||
TlbEnum tlbEnum = new TlbEnum(index, packagename, typeLibUtil);
|
||||
this.writeTlbClass(tlbEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the com interface.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @return the string buffer
|
||||
*/
|
||||
private void createCOMInterface(int index, String packagename,
|
||||
TypeLibUtil typeLibUtil) throws IOException {
|
||||
TlbInterface tlbInterface = new TlbInterface(index, packagename,
|
||||
typeLibUtil);
|
||||
this.writeTlbClass(tlbInterface);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the com dispatch.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @return the string buffer
|
||||
*/
|
||||
private void createCOMDispInterface(int index, String packagename,
|
||||
TypeLibUtil typeLibUtil) throws IOException {
|
||||
TlbDispInterface tlbDispatch = new TlbDispInterface(index, packagename,
|
||||
typeLibUtil);
|
||||
this.writeTlbClass(tlbDispatch);
|
||||
}
|
||||
|
||||
private void createCOMCoClass(int index, String packagename,
|
||||
TypeLibUtil typeLibUtil, String bindingMode) throws IOException {
|
||||
TlbCoClass tlbCoClass = new TlbCoClass(index, this.getPackageName(),
|
||||
typeLibUtil, bindingMode);
|
||||
this.writeTlbClass(tlbCoClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log info.
|
||||
*
|
||||
* @param msg
|
||||
* the msg
|
||||
*/
|
||||
public static void logInfo(String msg) {
|
||||
System.out.println(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.platform.win32.Guid.CLSID;
|
||||
import com.sun.jna.platform.win32.OaIdl;
|
||||
import com.sun.jna.platform.win32.OaIdl.CURRENCY;
|
||||
import com.sun.jna.platform.win32.OaIdl.DATE;
|
||||
import com.sun.jna.platform.win32.OaIdl.DECIMAL;
|
||||
import com.sun.jna.platform.win32.OaIdl.ELEMDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPE;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEDESC;
|
||||
import com.sun.jna.platform.win32.Variant;
|
||||
import com.sun.jna.platform.win32.WTypes.BSTR;
|
||||
import com.sun.jna.platform.win32.WTypes.LPSTR;
|
||||
import com.sun.jna.platform.win32.WTypes.LPWSTR;
|
||||
import com.sun.jna.platform.win32.WTypes.VARTYPE;
|
||||
import com.sun.jna.platform.win32.WinBase.FILETIME;
|
||||
import com.sun.jna.platform.win32.WinDef.BOOL;
|
||||
import com.sun.jna.platform.win32.WinDef.CHAR;
|
||||
import com.sun.jna.platform.win32.WinDef.INT_PTR;
|
||||
import com.sun.jna.platform.win32.WinDef.LONG;
|
||||
import com.sun.jna.platform.win32.WinDef.PVOID;
|
||||
import com.sun.jna.platform.win32.WinDef.SCODE;
|
||||
import com.sun.jna.platform.win32.WinDef.UCHAR;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT;
|
||||
import com.sun.jna.platform.win32.WinDef.UINT_PTR;
|
||||
import com.sun.jna.platform.win32.WinDef.ULONG;
|
||||
import com.sun.jna.platform.win32.WinDef.USHORT;
|
||||
import com.sun.jna.platform.win32.WinNT.HRESULT;
|
||||
import com.sun.jna.platform.win32.COM.IDispatch;
|
||||
import com.sun.jna.platform.win32.COM.ITypeInfo;
|
||||
import com.sun.jna.platform.win32.COM.IUnknown;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbFunction.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public abstract class TlbAbstractMethod extends TlbBase implements Variant {
|
||||
|
||||
protected TypeInfoDoc typeInfoDoc;
|
||||
|
||||
protected String methodName;
|
||||
|
||||
protected String docStr;
|
||||
|
||||
protected short vtableId;
|
||||
|
||||
protected MEMBERID memberid;
|
||||
|
||||
protected short paramCount;
|
||||
|
||||
protected String returnType;
|
||||
|
||||
protected String methodparams = "";
|
||||
|
||||
protected String methodvariables = "";
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb function.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @param funcDesc
|
||||
* the func desc
|
||||
* @param typeInfoUtil
|
||||
* the type info util
|
||||
*/
|
||||
public TlbAbstractMethod(int index, TypeLibUtil typeLibUtil,
|
||||
FUNCDESC funcDesc, TypeInfoUtil typeInfoUtil) {
|
||||
super(index, typeLibUtil, typeInfoUtil);
|
||||
this.typeInfoDoc = typeInfoUtil.getDocumentation(funcDesc.memid);
|
||||
this.methodName = typeInfoDoc.getName();
|
||||
this.docStr = typeInfoDoc.getDocString();
|
||||
|
||||
// get function values
|
||||
this.vtableId = funcDesc.oVft.shortValue();
|
||||
this.memberid = funcDesc.memid;
|
||||
this.paramCount = funcDesc.cParams.shortValue();
|
||||
this.returnType = this.getType(funcDesc);
|
||||
}
|
||||
|
||||
public TypeInfoDoc getTypeInfoDoc() {
|
||||
return typeInfoDoc;
|
||||
}
|
||||
|
||||
public String getMethodName() {
|
||||
return methodName;
|
||||
}
|
||||
|
||||
public String getDocStr() {
|
||||
return docStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the var type.
|
||||
*
|
||||
* @param vt
|
||||
* the vt
|
||||
* @return the var type
|
||||
*/
|
||||
protected String getVarType(VARTYPE vt) {
|
||||
switch (vt.intValue()) {
|
||||
case VT_EMPTY:
|
||||
return "";
|
||||
case VT_NULL:
|
||||
return "null";
|
||||
case VT_I2:
|
||||
return "short";
|
||||
case VT_I4:
|
||||
return "int";
|
||||
case VT_R4:
|
||||
return "float";
|
||||
case VT_R8:
|
||||
return "double";
|
||||
case VT_CY:
|
||||
return CURRENCY.class.getSimpleName();
|
||||
case VT_DATE:
|
||||
return DATE.class.getSimpleName();
|
||||
case VT_BSTR:
|
||||
return BSTR.class.getSimpleName();
|
||||
case VT_DISPATCH:
|
||||
return IDispatch.class.getSimpleName();
|
||||
case VT_ERROR:
|
||||
return SCODE.class.getSimpleName();
|
||||
case VT_BOOL:
|
||||
return BOOL.class.getSimpleName();
|
||||
case VT_VARIANT:
|
||||
return VARIANT.class.getSimpleName();
|
||||
case VT_UNKNOWN:
|
||||
return IUnknown.class.getSimpleName();
|
||||
case VT_DECIMAL:
|
||||
return DECIMAL.class.getSimpleName();
|
||||
case VT_I1:
|
||||
return CHAR.class.getSimpleName();
|
||||
case VT_UI1:
|
||||
return UCHAR.class.getSimpleName();
|
||||
case VT_UI2:
|
||||
return USHORT.class.getSimpleName();
|
||||
case VT_UI4:
|
||||
return UINT.class.getSimpleName();
|
||||
case VT_I8:
|
||||
return LONG.class.getSimpleName();
|
||||
case VT_UI8:
|
||||
return ULONG.class.getSimpleName();
|
||||
case VT_INT:
|
||||
return "int";
|
||||
case VT_UINT:
|
||||
return UINT.class.getSimpleName();
|
||||
case VT_VOID:
|
||||
return PVOID.class.getSimpleName();
|
||||
case VT_HRESULT:
|
||||
return HRESULT.class.getSimpleName();
|
||||
case VT_PTR:
|
||||
return Pointer.class.getSimpleName();
|
||||
case VT_SAFEARRAY:
|
||||
return "safearray";
|
||||
case VT_CARRAY:
|
||||
return "carray";
|
||||
case VT_USERDEFINED:
|
||||
return "userdefined";
|
||||
case VT_LPSTR:
|
||||
return LPSTR.class.getSimpleName();
|
||||
case VT_LPWSTR:
|
||||
return LPWSTR.class.getSimpleName();
|
||||
case VT_RECORD:
|
||||
return "record";
|
||||
case VT_INT_PTR:
|
||||
return INT_PTR.class.getSimpleName();
|
||||
case VT_UINT_PTR:
|
||||
return UINT_PTR.class.getSimpleName();
|
||||
case VT_FILETIME:
|
||||
return FILETIME.class.getSimpleName();
|
||||
case VT_STREAM:
|
||||
return "steam";
|
||||
case VT_STORAGE:
|
||||
return "storage";
|
||||
case VT_STREAMED_OBJECT:
|
||||
return "steamed_object";
|
||||
case VT_STORED_OBJECT:
|
||||
return "stored_object";
|
||||
case VT_BLOB_OBJECT:
|
||||
return "blob_object";
|
||||
case VT_CF:
|
||||
return "cf";
|
||||
case VT_CLSID:
|
||||
return CLSID.class.getSimpleName();
|
||||
case VT_VERSIONED_STREAM:
|
||||
return "";
|
||||
// case VT_BSTR_BLOB:
|
||||
// return "";
|
||||
case VT_VECTOR:
|
||||
return "";
|
||||
case VT_ARRAY:
|
||||
return "";
|
||||
case VT_BYREF:
|
||||
return PVOID.class.getSimpleName();
|
||||
case VT_RESERVED:
|
||||
return "";
|
||||
case VT_ILLEGAL:
|
||||
return "illegal";
|
||||
/*
|
||||
* case VT_ILLEGALMASKED: return "illegal_masked"; case VT_TYPEMASK:
|
||||
* return "typemask";
|
||||
*/default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getUserdefinedType(HREFTYPE hreftype) {
|
||||
ITypeInfo refTypeInfo = this.typeInfoUtil.getRefTypeInfo(hreftype);
|
||||
TypeInfoUtil typeInfoUtil = new TypeInfoUtil(refTypeInfo);
|
||||
TypeInfoDoc documentation = typeInfoUtil
|
||||
.getDocumentation(OaIdl.MEMBERID_NIL);
|
||||
return documentation.getName();
|
||||
}
|
||||
|
||||
protected String getType(FUNCDESC funcDesc) {
|
||||
ELEMDESC elemDesc = funcDesc.elemdescFunc;
|
||||
return this.getType(elemDesc);
|
||||
}
|
||||
|
||||
protected String getType(ELEMDESC elemDesc) {
|
||||
TYPEDESC _typeDesc = elemDesc.tdesc;
|
||||
return this.getType(_typeDesc);
|
||||
}
|
||||
|
||||
protected String getType(TYPEDESC typeDesc) {
|
||||
VARTYPE vt = typeDesc.vt;
|
||||
String type = "not_defined";
|
||||
|
||||
if (vt.intValue() == Variant.VT_PTR) {
|
||||
TYPEDESC lptdesc = typeDesc._typedesc.getLptdesc();
|
||||
type = this.getType(lptdesc);
|
||||
} else if (vt.intValue() == Variant.VT_SAFEARRAY
|
||||
|| vt.intValue() == Variant.VT_CARRAY) {
|
||||
TYPEDESC tdescElem = typeDesc._typedesc.getLpadesc().tdescElem;
|
||||
type = this.getType(tdescElem);
|
||||
} else if (vt.intValue() == Variant.VT_USERDEFINED) {
|
||||
HREFTYPE hreftype = typeDesc._typedesc.hreftype;
|
||||
type = this.getUserdefinedType(hreftype);
|
||||
} else {
|
||||
type = this.getVarType(vt);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
protected String replaceJavaKeyword(String name) {
|
||||
if (name.equals("final"))
|
||||
return "_" + name;
|
||||
else if (name.equals("default"))
|
||||
return "_" + name;
|
||||
else if (name.equals("case"))
|
||||
return "_" + name;
|
||||
else if (name.equals("char"))
|
||||
return "_" + name;
|
||||
else if (name.equals("private"))
|
||||
return "_" + name;
|
||||
else if (name.equals("default"))
|
||||
return "_" + name;
|
||||
else
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbBase.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public abstract class TlbBase {
|
||||
|
||||
/** The Constant CR. */
|
||||
public final static String CR = "\n";
|
||||
|
||||
/** The Constant CRCR. */
|
||||
public final static String CRCR = "\n\n";
|
||||
|
||||
/** The Constant TAB. */
|
||||
public final static String TAB = "\t";
|
||||
|
||||
/** The Constant TABTAB. */
|
||||
public final static String TABTAB = "\t\t";
|
||||
|
||||
/** The type lib util. */
|
||||
protected TypeLibUtil typeLibUtil;
|
||||
|
||||
protected TypeInfoUtil typeInfoUtil;
|
||||
|
||||
/** The index. */
|
||||
protected int index;
|
||||
|
||||
/** The template buffer. */
|
||||
protected StringBuffer templateBuffer;
|
||||
|
||||
/** The class buffer. */
|
||||
protected StringBuffer classBuffer;
|
||||
|
||||
/** The content. */
|
||||
protected String content = "";
|
||||
|
||||
protected String filename = "DefaultFilename";
|
||||
|
||||
protected String name = "DefaultName";
|
||||
|
||||
/** The iunknown methods. */
|
||||
public static String[] IUNKNOWN_METHODS = { "QueryInterface", "AddRef",
|
||||
"Release" };
|
||||
|
||||
/** The idispatch methods. */
|
||||
public static String[] IDISPATCH_METHODS = { "GetTypeInfoCount",
|
||||
"GetTypeInfo", "GetIDsOfNames", "Invoke" };
|
||||
|
||||
protected String bindingMode = TlbConst.BINDING_MODE_DISPID;
|
||||
|
||||
public TlbBase(int index, TypeLibUtil typeLibUtil, TypeInfoUtil typeInfoUtil) {
|
||||
this(index, typeLibUtil, typeInfoUtil, TlbConst.BINDING_MODE_DISPID);
|
||||
}
|
||||
|
||||
public TlbBase(int index, TypeLibUtil typeLibUtil, TypeInfoUtil typeInfoUtil, String bindingMode) {
|
||||
this.index = index;
|
||||
this.typeLibUtil = typeLibUtil;
|
||||
this.typeInfoUtil = typeInfoUtil;
|
||||
this.bindingMode = bindingMode;
|
||||
|
||||
String filename = this.getClassTemplate();
|
||||
try {
|
||||
this.readTemplateFile(filename);
|
||||
this.classBuffer = templateBuffer;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log error.
|
||||
*
|
||||
* @param msg
|
||||
* the msg
|
||||
*/
|
||||
public void logError(String msg) {
|
||||
this.log("ERROR", msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log info.
|
||||
*
|
||||
* @param msg
|
||||
* the msg
|
||||
*/
|
||||
public void logInfo(String msg) {
|
||||
this.log("INFO", msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class buffer.
|
||||
*
|
||||
* @return the class buffer
|
||||
*/
|
||||
public StringBuffer getClassBuffer() {
|
||||
return classBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the content.
|
||||
*
|
||||
* @param content
|
||||
* the content
|
||||
*/
|
||||
public void createContent(String content) {
|
||||
this.replaceVariable("content", content);
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
if (!filename.endsWith("java"))
|
||||
filename += ".java";
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return this.filename;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log.
|
||||
*
|
||||
* @param level
|
||||
* the level
|
||||
* @param msg
|
||||
* the msg
|
||||
*/
|
||||
protected void log(String level, String msg) {
|
||||
String _msg = level + " " + this.getTime() + " : " + msg;
|
||||
System.out.println(_msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time.
|
||||
*
|
||||
* @return the time
|
||||
*/
|
||||
private String getTime() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
return sdf.format(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class template.
|
||||
*
|
||||
* @return the class template
|
||||
*/
|
||||
abstract protected String getClassTemplate();
|
||||
|
||||
/**
|
||||
* Read template file.
|
||||
*
|
||||
* @param filename
|
||||
* the filename
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
protected void readTemplateFile(String filename) throws IOException {
|
||||
this.templateBuffer = new StringBuffer();
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
InputStream is = this.getClass().getClassLoader()
|
||||
.getResourceAsStream(filename);
|
||||
reader = new BufferedReader(new InputStreamReader(is));
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null)
|
||||
this.templateBuffer.append(line + "\n");
|
||||
} finally {
|
||||
if (reader != null)
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace variable.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
protected void replaceVariable(String name, String value) {
|
||||
if (value == null)
|
||||
value = "";
|
||||
|
||||
Pattern pattern = Pattern.compile("\\$\\{" + name + "\\}");
|
||||
Matcher matcher = pattern.matcher(this.classBuffer);
|
||||
String replacement = value;
|
||||
String result = "";
|
||||
|
||||
while (matcher.find()) {
|
||||
result = matcher.replaceAll(replacement);
|
||||
}
|
||||
|
||||
if (result.length() > 0)
|
||||
this.classBuffer = new StringBuffer(result);
|
||||
}
|
||||
|
||||
protected void createPackageName(String packagename) {
|
||||
this.replaceVariable("packagename", packagename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the class name.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
*/
|
||||
protected void createClassName(String name) {
|
||||
this.replaceVariable("classname", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is reserved method.
|
||||
*
|
||||
* @param method
|
||||
* the method
|
||||
* @return true, if is reserved method
|
||||
*/
|
||||
protected boolean isReservedMethod(String method) {
|
||||
for (int i = 0; i < IUNKNOWN_METHODS.length; i++) {
|
||||
if (IUNKNOWN_METHODS[i].equalsIgnoreCase(method))
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < IDISPATCH_METHODS.length; i++) {
|
||||
if (IDISPATCH_METHODS[i].equalsIgnoreCase(method))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isVTableMode() {
|
||||
if(this.bindingMode.equalsIgnoreCase(TlbConst.BINDING_MODE_VTABLE))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isDispIdMode() {
|
||||
if(this.bindingMode.equalsIgnoreCase(TlbConst.BINDING_MODE_DISPID))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class TlbCmdlineArgs extends Hashtable<String, String> implements
|
||||
TlbConst {
|
||||
|
||||
public TlbCmdlineArgs(String[] args) {
|
||||
this.readCmdArgs(args);
|
||||
}
|
||||
|
||||
public int getIntParam(String key) {
|
||||
String param = this.getRequiredParam(key);
|
||||
return new Integer(param).intValue();
|
||||
}
|
||||
|
||||
public String getParam(String key) {
|
||||
return this.get(key);
|
||||
}
|
||||
|
||||
public String getRequiredParam(String key) {
|
||||
String param = this.getParam(key);
|
||||
if (param == null)
|
||||
throw new TlbParameterNotFoundException(
|
||||
"Commandline parameter not found: " + key);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
private void readCmdArgs(String[] args) {
|
||||
if (args.length < 2)
|
||||
this.showCmdHelp();
|
||||
|
||||
for (int i = 0; i < args.length;) {
|
||||
String cmdName = args[i];
|
||||
String cmdValue = args[i+1];
|
||||
if (cmdName.startsWith("-") && !cmdValue.startsWith("-")) {
|
||||
this.put(cmdName.substring(1), cmdValue);
|
||||
i+=2;
|
||||
}else {
|
||||
this.showCmdHelp();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTlbFile() {
|
||||
return this.containsKey(CMD_ARG_TYPELIB_FILE);
|
||||
}
|
||||
|
||||
public boolean isTlbId() {
|
||||
return this.containsKey(CMD_ARG_TYPELIB_ID);
|
||||
}
|
||||
|
||||
public String getBindingMode() {
|
||||
if(this.containsKey(CMD_ARG_BINDING_MODE))
|
||||
return this.getParam(CMD_ARG_BINDING_MODE);
|
||||
else
|
||||
return BINDING_MODE_VTABLE;
|
||||
}
|
||||
|
||||
public void showCmdHelp() {
|
||||
String helpStr = "usage: TlbImp [-tlb.id -tlb.major.version -tlb.minor.version] [-tlb.file] [-bind.mode vTable, dispId] [-output.dir]"
|
||||
+ CRCR
|
||||
+ "options:"
|
||||
+ CR
|
||||
+ "-tlb.id The guid of the type library."
|
||||
+ CR
|
||||
+ "-tlb.major.version The major version of the type library."
|
||||
+ CR
|
||||
+ "-tlb.minor.version The minor version of the type library."
|
||||
+ CR
|
||||
+ "-tlb.file The file name containing the type library."
|
||||
+ CR
|
||||
+ "-bind.mode The binding mode used to create the Java code."
|
||||
+ CR
|
||||
+ "-output.dir The optional output directory, default is the user temp directory."
|
||||
+ CRCR
|
||||
+ "samples:"
|
||||
+ CR
|
||||
+ "Microsoft Shell Controls And Automation:"
|
||||
+ CR
|
||||
+ "-tlb.file shell32.dll"
|
||||
+ CR
|
||||
+ "-tlb.id {50A7E9B0-70EF-11D1-B75A-00A0C90564FE} -tlb.major.version 1 -tlb.minor.version 0"
|
||||
+ CRCR
|
||||
+ "Microsoft Word 12.0 Object Library:"
|
||||
+ CR
|
||||
+ "-tlb.id {00020905-0000-0000-C000-000000000046} -tlb.major.version 8 -tlb.minor.version 4"
|
||||
+ CRCR;
|
||||
|
||||
System.out.println(helpStr);
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPE;
|
||||
import com.sun.jna.platform.win32.OaIdl.INVOKEKIND;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
|
||||
import com.sun.jna.platform.win32.COM.ITypeInfo;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil.TypeLibDoc;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbClass.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbCoClass extends TlbBase {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb class.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
*/
|
||||
public TlbCoClass(int index, String packagename, TypeLibUtil typeLibUtil, String bindingMode) {
|
||||
super(index, typeLibUtil, null);
|
||||
|
||||
TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);
|
||||
|
||||
TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
|
||||
String docString = typeLibDoc.getDocString();
|
||||
|
||||
if(typeLibDoc.getName().length() > 0)
|
||||
this.name = typeLibDoc.getName();
|
||||
|
||||
this.logInfo("Type of kind 'CoClass' found: " + this.name);
|
||||
|
||||
this.createPackageName(packagename);
|
||||
this.createClassName(this.name);
|
||||
this.setFilename(this.name);
|
||||
|
||||
String guidStr = this.typeLibUtil.getLibAttr().guid.toGuidString();
|
||||
int majorVerNum = this.typeLibUtil.getLibAttr().wMajorVerNum.intValue();
|
||||
int minorVerNum = this.typeLibUtil.getLibAttr().wMinorVerNum.intValue();
|
||||
String version = majorVerNum + "." + minorVerNum;
|
||||
String clsid = typeInfoUtil.getTypeAttr().guid.toGuidString();
|
||||
|
||||
this.createJavaDocHeader(guidStr, version, docString);
|
||||
this.createCLSID(clsid);
|
||||
this.createCLSIDName(this.name);
|
||||
|
||||
// Get the TypeAttributes
|
||||
TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
|
||||
int cImplTypes = typeAttr.cImplTypes.intValue();
|
||||
String interfaces = "";
|
||||
|
||||
for (int i = 0; i < cImplTypes; i++) {
|
||||
HREFTYPE refTypeOfImplType = typeInfoUtil.getRefTypeOfImplType(i);
|
||||
ITypeInfo refTypeInfo = typeInfoUtil
|
||||
.getRefTypeInfo(refTypeOfImplType);
|
||||
TypeInfoUtil refTypeInfoUtil = new TypeInfoUtil(refTypeInfo);
|
||||
this.createFunctions(refTypeInfoUtil, bindingMode);
|
||||
TypeInfoDoc documentation = refTypeInfoUtil
|
||||
.getDocumentation(new MEMBERID(-1));
|
||||
interfaces += documentation.getName();
|
||||
|
||||
if (i < cImplTypes - 1)
|
||||
interfaces += ", ";
|
||||
}
|
||||
|
||||
this.createInterfaces(interfaces);
|
||||
this.createContent(this.content);
|
||||
}
|
||||
|
||||
protected void createFunctions(TypeInfoUtil typeInfoUtil, String bindingMode) {
|
||||
TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
|
||||
int cFuncs = typeAttr.cFuncs.intValue();
|
||||
for (int i = 0; i < cFuncs; i++) {
|
||||
// Get the function description
|
||||
FUNCDESC funcDesc = typeInfoUtil.getFuncDesc(i);
|
||||
|
||||
TlbAbstractMethod method = null;
|
||||
if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_FUNC)) {
|
||||
if(this.isVTableMode())
|
||||
method = new TlbFunctionVTable(i, index, typeLibUtil, funcDesc, typeInfoUtil);
|
||||
else
|
||||
method = new TlbFunctionDispId(i, index, typeLibUtil, funcDesc, typeInfoUtil);
|
||||
} else if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_PROPERTYGET)) {
|
||||
method = new TlbPropertyGet(i, index, typeLibUtil, funcDesc,
|
||||
typeInfoUtil);
|
||||
} else if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_PROPERTYPUT)) {
|
||||
method = new TlbPropertyPut(i, index, typeLibUtil, funcDesc,
|
||||
typeInfoUtil);
|
||||
} else if (funcDesc.invkind
|
||||
.equals(INVOKEKIND.INVOKE_PROPERTYPUTREF)) {
|
||||
method = new TlbPropertyPut(i, index, typeLibUtil, funcDesc,
|
||||
typeInfoUtil);
|
||||
}
|
||||
|
||||
if(!isReservedMethod(method.getMethodName()))
|
||||
{
|
||||
this.content += method.getClassBuffer();
|
||||
|
||||
if (i < cFuncs - 1)
|
||||
this.content += CR;
|
||||
}
|
||||
|
||||
// Release our function description stuff
|
||||
typeInfoUtil.ReleaseFuncDesc(funcDesc);
|
||||
}
|
||||
}
|
||||
|
||||
protected void createJavaDocHeader(String guid, String version,
|
||||
String helpstring) {
|
||||
this.replaceVariable("uuid", guid);
|
||||
this.replaceVariable("version", version);
|
||||
this.replaceVariable("helpstring", helpstring);
|
||||
}
|
||||
|
||||
protected void createCLSIDName(String clsidName) {
|
||||
this.replaceVariable("clsidname", clsidName.toUpperCase());
|
||||
}
|
||||
|
||||
protected void createCLSID(String clsid) {
|
||||
this.replaceVariable("clsid", clsid);
|
||||
}
|
||||
|
||||
protected void createInterfaces(String interfaces) {
|
||||
this.replaceVariable("interfaces", interfaces);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbCoClass.template";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package ${packagename};
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.platform.win32.*;
|
||||
import com.sun.jna.platform.win32.WinNT.*;
|
||||
import com.sun.jna.platform.win32.OaIdl.*;
|
||||
import com.sun.jna.platform.win32.WinDef.*;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.*;
|
||||
import com.sun.jna.platform.win32.COM.*;
|
||||
import com.sun.jna.platform.win32.Guid.*;
|
||||
|
||||
/**
|
||||
* uuid(${uuid})
|
||||
* version(${version})
|
||||
* helpstring(${helpstring})
|
||||
* clsid(${clsid})
|
||||
*
|
||||
*/
|
||||
public class ${classname} extends COMEarlyBindingObject implements ${interfaces} {
|
||||
|
||||
public static final CLSID ${clsidname}_CLSID = new CLSID("${clsid}");
|
||||
|
||||
public ${classname}() {
|
||||
super(${clsidname}_CLSID, false, WTypes.CLSCTX_SERVER);
|
||||
}
|
||||
|
||||
public ${classname}(CLSID clsid, boolean useActiveInstance, int dwClsContext) {
|
||||
super(clsid, useActiveInstance, dwClsContext);
|
||||
}
|
||||
|
||||
${content}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
public interface TlbConst {
|
||||
|
||||
public final static String CR = "\n";
|
||||
|
||||
public final static String CRCR = "\n\n";
|
||||
|
||||
public final static String TYPELIB_ID_SHELL = "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}";
|
||||
|
||||
public final static String TYPELIB_MAJOR_VERSION_SHELL = "1";
|
||||
|
||||
public final static String TYPELIB_MINOR_VERSION_SHELL = "0";
|
||||
|
||||
public final static String TYPELIB_ID_WORD = "{00020905-0000-0000-C000-000000000046}";
|
||||
|
||||
public final static String TYPELIB_MAJOR_VERSION_WORD = "8";
|
||||
|
||||
public final static String TYPELIB_MINOR_VERSION_WORD = "4";
|
||||
|
||||
public final static String TYPELIB_ID_OFFICE = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}";
|
||||
|
||||
public final static String TYPELIB_MAJOR_VERSION_OFFICE = "2";
|
||||
|
||||
public final static String TYPELIB_MINOR_VERSION_OFFICE = "5";
|
||||
|
||||
public final static String CMD_ARG_TYPELIB_ID = "tlb.id";
|
||||
|
||||
public final static String CMD_ARG_BINDING_MODE = "bind.mode";
|
||||
|
||||
public final static String BINDING_MODE_VTABLE = "vtable";
|
||||
|
||||
public final static String BINDING_MODE_DISPID = "dispid";
|
||||
|
||||
public final static String CMD_ARG_TYPELIB_MAJOR_VERSION = "tlb.major.version";
|
||||
|
||||
public final static String CMD_ARG_TYPELIB_MINOR_VERSION = "tlb.minor.version";
|
||||
|
||||
public final static String CMD_ARG_TYPELIB_FILE = "tlb.file";
|
||||
|
||||
public final static String CMD_ARG_OUTPUT_DIR = "output.dir";
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.HREFTYPE;
|
||||
import com.sun.jna.platform.win32.OaIdl.INVOKEKIND;
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
|
||||
import com.sun.jna.platform.win32.WinDef.WORD;
|
||||
import com.sun.jna.platform.win32.COM.ITypeInfo;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil.TypeLibDoc;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbDispatch.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbDispInterface extends TlbBase {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb dispatch.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
*/
|
||||
public TlbDispInterface(int index, String packagename,
|
||||
TypeLibUtil typeLibUtil) {
|
||||
super(index, typeLibUtil, null);
|
||||
|
||||
TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
|
||||
String docString = typeLibDoc.getDocString();
|
||||
|
||||
if(typeLibDoc.getName().length() > 0)
|
||||
this.name = typeLibDoc.getName();
|
||||
|
||||
this.logInfo("Type of kind 'DispInterface' found: " + this.name);
|
||||
|
||||
this.createPackageName(packagename);
|
||||
this.createClassName(this.name);
|
||||
this.setFilename(this.name);
|
||||
|
||||
// Get the TypeAttributes
|
||||
TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);
|
||||
TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
|
||||
|
||||
this.createJavaDocHeader(typeAttr.guid.toGuidString(), docString);
|
||||
|
||||
int cFuncs = typeAttr.cFuncs.intValue();
|
||||
for (int i = 0; i < cFuncs; i++) {
|
||||
// Get the function description
|
||||
FUNCDESC funcDesc = typeInfoUtil.getFuncDesc(i);
|
||||
|
||||
// Get the member ID
|
||||
MEMBERID memberID = funcDesc.memid;
|
||||
|
||||
// Get the name of the method
|
||||
TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
|
||||
String methodName = typeInfoDoc2.getName();
|
||||
TlbAbstractMethod method = null;
|
||||
|
||||
if (!isReservedMethod(methodName)) {
|
||||
if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_FUNC)) {
|
||||
method = new TlbFunctionStub(index, typeLibUtil, funcDesc,
|
||||
typeInfoUtil);
|
||||
} else if (funcDesc.invkind
|
||||
.equals(INVOKEKIND.INVOKE_PROPERTYGET)) {
|
||||
method = new TlbPropertyGetStub(index, typeLibUtil,
|
||||
funcDesc, typeInfoUtil);
|
||||
} else if (funcDesc.invkind
|
||||
.equals(INVOKEKIND.INVOKE_PROPERTYPUT)) {
|
||||
method = new TlbPropertyPutStub(index, typeLibUtil,
|
||||
funcDesc, typeInfoUtil);
|
||||
} else if (funcDesc.invkind
|
||||
.equals(INVOKEKIND.INVOKE_PROPERTYPUTREF)) {
|
||||
method = new TlbPropertyPutStub(index, typeLibUtil,
|
||||
funcDesc, typeInfoUtil);
|
||||
}
|
||||
|
||||
this.content += method.getClassBuffer();
|
||||
|
||||
if (i < cFuncs - 1)
|
||||
this.content += CR;
|
||||
}
|
||||
|
||||
// Release our function description stuff
|
||||
typeInfoUtil.ReleaseFuncDesc(funcDesc);
|
||||
}
|
||||
|
||||
this.createContent(this.content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the java doc header.
|
||||
*
|
||||
* @param guid
|
||||
* the guid
|
||||
* @param helpstring
|
||||
* the helpstring
|
||||
*/
|
||||
protected void createJavaDocHeader(String guid, String helpstring) {
|
||||
this.replaceVariable("uuid", guid);
|
||||
this.replaceVariable("helpstring", helpstring);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbDispInterface.template";
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package ${packagename};
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.platform.win32.*;
|
||||
import com.sun.jna.platform.win32.WinNT.*;
|
||||
import com.sun.jna.platform.win32.OaIdl.*;
|
||||
import com.sun.jna.platform.win32.WinDef.*;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.*;
|
||||
import com.sun.jna.platform.win32.COM.*;
|
||||
import com.sun.jna.platform.win32.Guid.*;
|
||||
|
||||
/**
|
||||
* uuid(${uuid})
|
||||
* version(${version})
|
||||
* helpstring(${helpstring})
|
||||
*
|
||||
*/
|
||||
public interface ${classname} extends IDispatch {
|
||||
|
||||
${content}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.VARDESC;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil.TypeLibDoc;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbEnum.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbEnum extends TlbBase {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb enum.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
*/
|
||||
public TlbEnum(int index, String packagename, TypeLibUtil typeLibUtil) {
|
||||
super(index, typeLibUtil, null);
|
||||
|
||||
TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
|
||||
String docString = typeLibDoc.getDocString();
|
||||
|
||||
if (typeLibDoc.getName().length() > 0)
|
||||
this.name = typeLibDoc.getName();
|
||||
|
||||
this.logInfo("Type of kind 'Enum' found: " + this.name);
|
||||
|
||||
this.createPackageName(packagename);
|
||||
this.createClassName(this.name);
|
||||
this.setFilename(this.name);
|
||||
|
||||
// Get the TypeAttributes
|
||||
TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);
|
||||
TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
|
||||
|
||||
this.createJavaDocHeader(typeAttr.guid.toGuidString(), docString);
|
||||
|
||||
int cVars = typeAttr.cVars.intValue();
|
||||
for (int i = 0; i < cVars; i++) {
|
||||
// Get the property description
|
||||
VARDESC varDesc = typeInfoUtil.getVarDesc(i);
|
||||
VARIANT constValue = varDesc._vardesc.lpvarValue;
|
||||
Object value = constValue.getValue();
|
||||
|
||||
// Get the member ID
|
||||
MEMBERID memberID = varDesc.memid;
|
||||
|
||||
// Get the name of the property
|
||||
TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
|
||||
this.content += TABTAB + "//" + typeInfoDoc2.getName() + CR;
|
||||
this.content += TABTAB + "public static final int "
|
||||
+ typeInfoDoc2.getName() + " = " + value.toString() + ";";
|
||||
|
||||
if (i < cVars - 1)
|
||||
this.content += CR;
|
||||
|
||||
// release the pointer
|
||||
typeInfoUtil.ReleaseVarDesc(varDesc);
|
||||
}
|
||||
|
||||
this.createContent(this.content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the java doc header.
|
||||
*
|
||||
* @param guid
|
||||
* the guid
|
||||
* @param helpstring
|
||||
* the helpstring
|
||||
*/
|
||||
protected void createJavaDocHeader(String guid, String helpstring) {
|
||||
this.replaceVariable("uuid", guid);
|
||||
this.replaceVariable("helpstring", helpstring);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbEnum.template";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package ${packagename};
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.platform.win32.*;
|
||||
import com.sun.jna.platform.win32.WinNT.*;
|
||||
import com.sun.jna.platform.win32.OaIdl.*;
|
||||
import com.sun.jna.platform.win32.WinDef.*;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.*;
|
||||
import com.sun.jna.platform.win32.COM.*;
|
||||
import com.sun.jna.platform.win32.Guid.*;
|
||||
|
||||
/**
|
||||
* uuid(${uuid})
|
||||
* helpstring(${helpstring})
|
||||
*
|
||||
*/
|
||||
public class ${classname} extends Structure {
|
||||
public static class ByReference extends ${classname} implements
|
||||
Structure.ByReference {
|
||||
}
|
||||
|
||||
public int value;
|
||||
|
||||
public ${classname}() {
|
||||
}
|
||||
|
||||
public ${classname}(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public ${classname}(Pointer pointer) {
|
||||
super(pointer);
|
||||
this.read();
|
||||
}
|
||||
|
||||
${content}
|
||||
|
||||
@Override
|
||||
protected List<String> getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "value" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.ELEMDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbFunction.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbFunctionDispId extends TlbAbstractMethod {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb function.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @param funcDesc
|
||||
* the func desc
|
||||
* @param typeInfoUtil
|
||||
* the type info util
|
||||
*/
|
||||
public TlbFunctionDispId(int count, int index, TypeLibUtil typeLibUtil,
|
||||
FUNCDESC funcDesc, TypeInfoUtil typeInfoUtil) {
|
||||
super(index, typeLibUtil, funcDesc, typeInfoUtil);
|
||||
|
||||
String[] names = typeInfoUtil.getNames(funcDesc.memid, paramCount + 1);
|
||||
|
||||
for (int i = 0; i < paramCount; i++) {
|
||||
ELEMDESC elemdesc = funcDesc.lprgelemdescParam.elemDescArg[i];
|
||||
String methodName = names[i + 1].toLowerCase();
|
||||
String type = this.getType(elemdesc.tdesc);
|
||||
String _methodName = this.replaceJavaKeyword(methodName);
|
||||
methodparams += type + " " + _methodName;
|
||||
|
||||
//wrap all in a VARIANT
|
||||
if(type.equals("VARIANT"))
|
||||
methodvariables += _methodName;
|
||||
else
|
||||
methodvariables += "new VARIANT(" + _methodName + ")";
|
||||
|
||||
// if there is more than 1 param
|
||||
if (i < (paramCount - 1)) {
|
||||
methodparams += ", ";
|
||||
methodvariables += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
String returnValue;
|
||||
if(this.returnType.equalsIgnoreCase("VARIANT"))
|
||||
returnValue = "pResult";
|
||||
else
|
||||
returnValue = "((" + returnType + ") pResult.getValue())";
|
||||
|
||||
this.replaceVariable("helpstring", docStr);
|
||||
this.replaceVariable("returntype", returnType);
|
||||
this.replaceVariable("returnvalue", returnValue);
|
||||
this.replaceVariable("methodname", methodName);
|
||||
this.replaceVariable("methodparams", methodparams);
|
||||
this.replaceVariable("methodvariables", methodvariables);
|
||||
this.replaceVariable("vtableid", String.valueOf(vtableId));
|
||||
this.replaceVariable("memberid", String.valueOf(memberid));
|
||||
this.replaceVariable("functionCount", String.valueOf(count));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbFunctionDispId.template";
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* ${helpstring}
|
||||
* Virtual table id: ${vtableid}
|
||||
* Member id: ${memberid}
|
||||
*/
|
||||
public ${returntype} ${methodname}(${methodparams}) {
|
||||
VARIANT.ByReference pResult = new VARIANT.ByReference();
|
||||
this.oleMethod(OleAuto.DISPATCH_METHOD, pResult, getIDispatch(), new DISPID(${memberid}), new VARIANT[] {${methodvariables}});
|
||||
return ${returnvalue};
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.ELEMDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbFunction.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbFunctionStub extends TlbAbstractMethod {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb function.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @param funcDesc
|
||||
* the func desc
|
||||
* @param typeInfoUtil
|
||||
* the type info util
|
||||
*/
|
||||
public TlbFunctionStub(int index, TypeLibUtil typeLibUtil,
|
||||
FUNCDESC funcDesc, TypeInfoUtil typeInfoUtil) {
|
||||
super(index, typeLibUtil, funcDesc, typeInfoUtil);
|
||||
|
||||
TypeInfoDoc typeInfoDoc = typeInfoUtil.getDocumentation(funcDesc.memid);
|
||||
String methodname = typeInfoDoc.getName();
|
||||
String docStr = typeInfoDoc.getDocString();
|
||||
String[] names = typeInfoUtil.getNames(funcDesc.memid, paramCount + 1);
|
||||
|
||||
// if there is at least one param we need a comma
|
||||
if (paramCount > 0)
|
||||
methodvariables = ", ";
|
||||
|
||||
for (int i = 0; i < paramCount; i++) {
|
||||
ELEMDESC elemdesc = funcDesc.lprgelemdescParam.elemDescArg[i];
|
||||
String methodName = names[i + 1].toLowerCase();
|
||||
methodparams += this.getType(elemdesc.tdesc) + " "
|
||||
+ this.replaceJavaKeyword(methodName);
|
||||
methodvariables += methodName;
|
||||
|
||||
// if there is more than 1 param
|
||||
if (i < (paramCount - 1)) {
|
||||
methodparams += ", ";
|
||||
methodvariables += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
this.replaceVariable("helpstring", docStr);
|
||||
this.replaceVariable("returntype", returnType);
|
||||
this.replaceVariable("methodname", methodname);
|
||||
this.replaceVariable("methodparams", methodparams);
|
||||
this.replaceVariable("vtableid", String.valueOf(vtableId));
|
||||
this.replaceVariable("memberid", String.valueOf(memberid));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbFunctionStub.template";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* ${helpstring}
|
||||
* Virtual table id: ${vtableid}
|
||||
* Member id: ${memberid}
|
||||
*/
|
||||
public ${returntype} ${methodname}(${methodparams});
|
||||
@@ -0,0 +1,83 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.ELEMDESC;
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbFunction.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbFunctionVTable extends TlbAbstractMethod {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb function.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @param funcDesc
|
||||
* the func desc
|
||||
* @param typeInfoUtil
|
||||
* the type info util
|
||||
*/
|
||||
public TlbFunctionVTable(int count, int index, TypeLibUtil typeLibUtil,
|
||||
FUNCDESC funcDesc, TypeInfoUtil typeInfoUtil) {
|
||||
super(index, typeLibUtil, funcDesc, typeInfoUtil);
|
||||
|
||||
String[] names = typeInfoUtil.getNames(funcDesc.memid, paramCount + 1);
|
||||
|
||||
// if there is at least one param we need a comma
|
||||
if (paramCount > 0)
|
||||
methodvariables = ", ";
|
||||
|
||||
for (int i = 0; i < paramCount; i++) {
|
||||
ELEMDESC elemdesc = funcDesc.lprgelemdescParam.elemDescArg[i];
|
||||
String methodName = names[i + 1].toLowerCase();
|
||||
methodparams += this.getType(elemdesc.tdesc) + " "
|
||||
+ this.replaceJavaKeyword(methodName);
|
||||
methodvariables += methodName;
|
||||
|
||||
// if there is more than 1 param
|
||||
if (i < (paramCount - 1)) {
|
||||
methodparams += ", ";
|
||||
methodvariables += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
this.replaceVariable("helpstring", docStr);
|
||||
this.replaceVariable("returntype", returnType);
|
||||
this.replaceVariable("methodname", methodName);
|
||||
this.replaceVariable("methodparams", methodparams);
|
||||
this.replaceVariable("methodvariables", methodvariables);
|
||||
this.replaceVariable("vtableid", String.valueOf(vtableId));
|
||||
this.replaceVariable("memberid", String.valueOf(memberid));
|
||||
this.replaceVariable("functionCount", String.valueOf(count));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbFunctionVTable.template";
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* ${helpstring}
|
||||
* Virtual table id: ${vtableid}
|
||||
* Member id: ${memberid}
|
||||
*/
|
||||
public ${returntype} ${methodname}(${methodparams}) {
|
||||
return (${returntype})this._invokeNativeObject(${functionCount}, new Object[] { this.getPointer()${methodvariables}}, ${returntype}.class);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.MEMBERID;
|
||||
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
|
||||
import com.sun.jna.platform.win32.OaIdl.VARDESC;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil.TypeLibDoc;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbInterface.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbInterface extends TlbBase {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb interface.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
*/
|
||||
public TlbInterface(int index, String packagename, TypeLibUtil typeLibUtil) {
|
||||
super(index, typeLibUtil, null);
|
||||
|
||||
TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
|
||||
String docString = typeLibDoc.getDocString();
|
||||
|
||||
if (typeLibDoc.getName().length() > 0)
|
||||
this.name = typeLibDoc.getName();
|
||||
|
||||
this.logInfo("Type of kind 'Interface' found: " + this.name);
|
||||
|
||||
this.createPackageName(packagename);
|
||||
this.createClassName(this.name);
|
||||
this.setFilename(this.name);
|
||||
|
||||
// Get the TypeAttributes
|
||||
TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);
|
||||
TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
|
||||
|
||||
this.createJavaDocHeader(typeAttr.guid.toGuidString(), docString);
|
||||
|
||||
int cVars = typeAttr.cVars.intValue();
|
||||
for (int i = 0; i < cVars; i++) {
|
||||
// Get the property description
|
||||
VARDESC varDesc = typeInfoUtil.getVarDesc(i);
|
||||
VARIANT constValue = varDesc._vardesc.lpvarValue;
|
||||
Object value = constValue.getValue();
|
||||
|
||||
// Get the member ID
|
||||
MEMBERID memberID = varDesc.memid;
|
||||
|
||||
// Get the name of the property
|
||||
TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
|
||||
this.content += TABTAB + "//" + typeInfoDoc2.getName() + CR;
|
||||
this.content += TABTAB + "public static final int "
|
||||
+ typeInfoDoc2.getName() + " = " + value.toString() + ";";
|
||||
|
||||
if (i < cVars - 1)
|
||||
this.content += CR;
|
||||
}
|
||||
|
||||
this.createContent(this.content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the java doc header.
|
||||
*
|
||||
* @param guid
|
||||
* the guid
|
||||
* @param helpstring
|
||||
* the helpstring
|
||||
*/
|
||||
protected void createJavaDocHeader(String guid, String helpstring) {
|
||||
this.replaceVariable("uuid", guid);
|
||||
this.replaceVariable("helpstring", helpstring);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbInterface.template";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package ${packagename};
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.platform.win32.*;
|
||||
import com.sun.jna.platform.win32.OaIdl.*;
|
||||
import com.sun.jna.platform.win32.WinDef.*;
|
||||
import com.sun.jna.platform.win32.Variant.VARIANT;
|
||||
import com.sun.jna.platform.win32.WTypes.*;
|
||||
import com.sun.jna.platform.win32.COM.*;
|
||||
import com.sun.jna.platform.win32.Guid.*;
|
||||
|
||||
/**
|
||||
* uuid(${uuid})
|
||||
* version(${version})
|
||||
* helpstring(${helpstring})
|
||||
*
|
||||
*/
|
||||
public interface ${classname} extends IUnknown {
|
||||
|
||||
${content}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
public class TlbParameterNotFoundException extends RuntimeException {
|
||||
|
||||
public TlbParameterNotFoundException() {
|
||||
}
|
||||
|
||||
public TlbParameterNotFoundException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public TlbParameterNotFoundException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public TlbParameterNotFoundException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbPropertyGet.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbPropertyGet extends TlbAbstractMethod {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb property get.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @param funcDesc
|
||||
* the func desc
|
||||
* @param typeInfoUtil
|
||||
* the type info util
|
||||
*/
|
||||
public TlbPropertyGet(int count, int index, TypeLibUtil typeLibUtil,
|
||||
FUNCDESC funcDesc, TypeInfoUtil typeInfoUtil) {
|
||||
super(index, typeLibUtil, funcDesc, typeInfoUtil);
|
||||
|
||||
this.methodName = "get" + this.getMethodName();
|
||||
|
||||
this.replaceVariable("helpstring", docStr);
|
||||
this.replaceVariable("returntype", returnType);
|
||||
this.replaceVariable("methodname", methodName);
|
||||
this.replaceVariable("vtableid", String.valueOf(vtableId));
|
||||
this.replaceVariable("memberid", String.valueOf(memberid));
|
||||
this.replaceVariable("functionCount", String.valueOf(count));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbPropertyGet.template";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* ${helpstring}
|
||||
* Virtual table id: ${vtableid}
|
||||
* Member id: ${memberid}
|
||||
*/
|
||||
public ${returntype} ${methodname}() {
|
||||
return (${returntype})this._invokeNativeObject(${functionCount}, new Object[] { this.getPointer() }, ${returntype}.class);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/* Copyright (c) 2013 Tobias Wolf, All Rights Reserved
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package com.sun.jna.platform.win32.COM.tlb.imp;
|
||||
|
||||
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil;
|
||||
import com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc;
|
||||
import com.sun.jna.platform.win32.COM.TypeLibUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TlbPropertyGet.
|
||||
*
|
||||
* @author Tobias Wolf, wolf.tobias@gmx.net
|
||||
*/
|
||||
public class TlbPropertyGetStub extends TlbAbstractMethod {
|
||||
|
||||
/**
|
||||
* Instantiates a new tlb property get.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param typeLibUtil
|
||||
* the type lib util
|
||||
* @param funcDesc
|
||||
* the func desc
|
||||
* @param typeInfoUtil
|
||||
* the type info util
|
||||
*/
|
||||
public TlbPropertyGetStub(int index, TypeLibUtil typeLibUtil,
|
||||
FUNCDESC funcDesc, TypeInfoUtil typeInfoUtil) {
|
||||
super(index, typeLibUtil, funcDesc, typeInfoUtil);
|
||||
|
||||
TypeInfoDoc typeInfoDoc = typeInfoUtil.getDocumentation(funcDesc.memid);
|
||||
String docStr = typeInfoDoc.getDocString();
|
||||
String methodname = "get" + typeInfoDoc.getName();
|
||||
|
||||
this.replaceVariable("helpstring", docStr);
|
||||
this.replaceVariable("returntype", returnType);
|
||||
this.replaceVariable("methodname", methodname);
|
||||
this.replaceVariable("vtableid", String.valueOf(vtableId));
|
||||
this.replaceVariable("memberid", String.valueOf(memberid));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.jna.platform.win32.COM.tlb.imp.TlbBase#getClassTemplate()
|
||||
*/
|
||||
@Override
|
||||
protected String getClassTemplate() {
|
||||
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbPropertyGetStub.template";
|
||||
}
|
||||
}
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário