Comparar commits
1766 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 | |||
| efce3ec30e | |||
| e56835fccc | |||
| 4f495756aa | |||
| 9dce43affa | |||
| 7200f90633 | |||
| 861e4cc3bc | |||
| c2c1f81ea5 | |||
| 14481ee346 | |||
| a92256bc72 | |||
| be42dda63d | |||
| 7313da6156 | |||
| b7d94d6a14 | |||
| 782b11f201 | |||
| aea387ce02 | |||
| 4ddad49369 | |||
| 224f18fef4 | |||
| 2390543445 | |||
| 473d48b39b | |||
| a947dfdac5 | |||
| b83e977839 | |||
| ab2d5a72e7 | |||
| bc5855e900 | |||
| 2c5993d680 | |||
| 2cc7fe3272 | |||
| 958ecde56b | |||
| 0a9a4c926a | |||
| a0b50515e2 | |||
| edf2dacfac | |||
| d65bd51895 | |||
| e0bd677ffc | |||
| c7123cf59b | |||
| 187fcdc2fb | |||
| a064b2a0e1 | |||
| 777406eb7b | |||
| 37f108fa51 | |||
| f0817a3e75 | |||
| 0eb9636bdf | |||
| 3f3872974e | |||
| 99533d2052 | |||
| dce035056a | |||
| 53cb504e90 | |||
| 2162f14786 | |||
| bd7fdf2438 | |||
| cc399eca28 | |||
| adb048c01a | |||
| 738900d840 | |||
| 3755747fda | |||
| 36020c6d33 | |||
| b64e24691b | |||
| a97377bb4a | |||
| b661a7ecbd | |||
| 2f3807d9a4 | |||
| 9932ce345e | |||
| b254399c02 | |||
| 5c08bfcd5c | |||
| fcd4cafe8a | |||
| cd6a1f48c8 | |||
| 2996d99914 | |||
| 785173f106 | |||
| bf66cb55d6 | |||
| 9ce2f894c3 | |||
| 436e842faa | |||
| adf4a382a3 | |||
| d4ba6b3575 | |||
| 6439e36464 | |||
| 57ded8d803 | |||
| aa5fc9b3d8 | |||
| 6d6f711080 | |||
| afb3a7cc84 | |||
| e14201201d | |||
| 92b5085dd8 | |||
| 4c814e7700 | |||
| fb6d9e6908 | |||
| 1398a5764b | |||
| e66bea10d4 | |||
| 8ba666dfe0 | |||
| 882bd3dd11 | |||
| 317d41e1df | |||
| 02bd142758 | |||
| 5f2620944f | |||
| 0405f305f9 | |||
| 501dc9054a | |||
| b2c3c585db | |||
| 481010d0b3 | |||
| 4f79bd12e1 | |||
| 0bfd959bcb | |||
| d7845899b4 | |||
| 307bf2600b | |||
| 04f7f25563 | |||
| de33b60d87 | |||
| 6e0914b1c9 | |||
| f7f4b349e9 | |||
| 3c2f3115e0 | |||
| 2df1b3675c | |||
| 76f7b189fa | |||
| 8c2d495e1c | |||
| 42c9dea2c2 | |||
| c52599b6d9 | |||
| ec90593be8 | |||
| 382d0098af | |||
| 4c14dddec3 | |||
| c2ce8be50f | |||
| a7717e5933 | |||
| 9b255071f2 | |||
| 70bb54e13f | |||
| 4461ca926c | |||
| d330f19292 | |||
| b14ccb8eab | |||
| d873f6f6be | |||
| 7f0d465e98 | |||
| 7855615a9d | |||
| 9889489355 | |||
| 09b23cfc1d | |||
| 213ed15c70 | |||
| 6f7ece8603 | |||
| 5d44e011b9 | |||
| 0a190774b4 | |||
| ff3d76fd42 | |||
| 7e0a412c4f | |||
| 39e6a58604 | |||
| 853cc722a1 | |||
| 3f5023068c | |||
| ebb8e89456 | |||
| a098b44f4c | |||
| 10d1e51393 | |||
| 9bcc884276 | |||
| a044a56b1c | |||
| 59bb61a366 | |||
| f2981454cb | |||
| 39dccddb60 | |||
| 3afaa9a34a | |||
| 65f40c35a2 | |||
| 0a1ab12a8d | |||
| e1539266e6 | |||
| 7c5e60b5f4 | |||
| e72ed5eeaa | |||
| bd78c9c331 | |||
| 84d3253f86 | |||
| a09b116a9c | |||
| f351facdf4 | |||
| 2143c18459 | |||
| 8c0df63844 | |||
| 121430dac1 | |||
| 71163d3b9a | |||
| 964c5b93f8 | |||
| 6c194233a5 | |||
| 8360bf1cd0 | |||
| 3c916775ee | |||
| 5ba54ed055 | |||
| bd5b7fb376 | |||
| 05ed5c68bf | |||
| b8dd54f99b | |||
| e20d384f9d | |||
| bd63a56975 | |||
| d578b89619 | |||
| 1f10720f6e | |||
| 1ef26f6227 | |||
| 7d59645a67 | |||
| dee20f8e45 | |||
| 70e7b8f1f9 | |||
| 9e9b898452 | |||
| 4130e1972d | |||
| 1ff9c604bb | |||
| 00e3608c54 | |||
| af6bd86757 | |||
| 0952ce45c1 | |||
| 040e67b637 | |||
| cd6fe24df5 | |||
| 42d2fb8607 | |||
| 241028bbd8 | |||
| 0c58f7cb59 | |||
| 47887c1d95 | |||
| 211060eb8f | |||
| 78d9c638ba | |||
| afaf338160 | |||
| 9e9c4aeb77 | |||
| 8efc0b1f40 | |||
| 1df51398ae | |||
| cd2277cc79 | |||
| 164e6fe04b | |||
| c365ee7577 | |||
| cbc16d2a48 | |||
| 636b01b95c | |||
| 41683e76bb | |||
| 4030e1c015 | |||
| db6a8e7cda | |||
| dd93afa50e | |||
| 822d49087b | |||
| e463de8cc8 | |||
| 0c060dbaaa | |||
| 0fec165454 | |||
| 504460458c | |||
| 2fba190dde | |||
| b8fb3290b2 | |||
| 2e0c0a670f | |||
| 9473f51d7b | |||
| de857048a2 | |||
| 83ec260e09 | |||
| cbf8b37734 | |||
| e81f46ecf5 | |||
| c2089f5275 | |||
| e9da3c61c1 | |||
| 01ff3f1d86 | |||
| 931deeef94 | |||
| 5caa17a994 | |||
| ecbfaa4b2d | |||
| 0d273fefc6 | |||
| 9c4232b6e2 | |||
| 79c2aaaebb | |||
| 7141c7a612 | |||
| cd420e3e33 | |||
| ef2cc89023 | |||
| 2beeabb17b | |||
| d83dde09a7 | |||
| 3ca38481c7 | |||
| 288a5157be | |||
| f5bde32616 | |||
| bffbc30c3d | |||
| 9ca125ddc4 | |||
| df2721c0ce | |||
| f22c38bbd9 | |||
| 03e9ee321a | |||
| 961e41be26 | |||
| 1332fbbcb0 | |||
| 8325f7cd82 | |||
| 86f7b9788d | |||
| b23411bc2b | |||
| 7c43abaf4e | |||
| d7c106d08b | |||
| 95f31151ec | |||
| 198ed1ef85 | |||
| 4f17e1f142 | |||
| ff9454da44 | |||
| ea14ae85e8 | |||
| 52891f8a93 | |||
| c8f1bde8e2 | |||
| 6a6e7f862f | |||
| d52fbed05c | |||
| 322052ce65 | |||
| af18df2bc2 | |||
| 236c939132 | |||
| c411f140f3 | |||
| 3d56106b07 | |||
| fdf9bbcc31 | |||
| 65385d2ac6 | |||
| 133d956592 | |||
| 245dcb0f4a | |||
| 6b19aa7ec9 | |||
| c5cbdbb1e8 | |||
| cbf16d3f82 | |||
| df6ab34e5b | |||
| 816317b8a6 | |||
| 521aa2dad0 | |||
| 6e439ca778 | |||
| d66e9e98b7 | |||
| a3994e009d | |||
| 062afd1773 | |||
| 8d2d8086b1 | |||
| cf71299f3b | |||
| 36dad4738a | |||
| fb744c65bd | |||
| a9949b3fe0 | |||
| a72d5b473b | |||
| 201931d2f8 | |||
| c58c5260a0 | |||
| e25dcd7c5f | |||
| 04e36d1560 | |||
| 681e840d97 | |||
| 59b44d532c | |||
| 04a6806957 | |||
| 6041c067a5 | |||
| 9b9e6510ac | |||
| 489d797df5 | |||
| 9df51dd4d8 | |||
| 6ffbf31eda | |||
| 7ea92aa923 | |||
| 1d481a7050 | |||
| 76781972a2 | |||
| 2953b46a3c | |||
| aae0c47f5c | |||
| 6d83a71bdd | |||
| 7b515a7dc8 | |||
| 8c06f5762f | |||
| 1d96ae4ab2 | |||
| c1b875ff38 | |||
| 5b15ee4ae3 | |||
| 92d3c433c4 | |||
| 79ff2f7a93 | |||
| b78618dca1 | |||
| 0967615734 | |||
| 9eb51ebaba | |||
| d9c887c0d4 | |||
| 6e6d761f2b | |||
| 7865bb46ad | |||
| c6ad9adbe0 | |||
| 907e2eb411 | |||
| e1ed265df7 | |||
| 1466833fb7 | |||
| ebf08cfede | |||
| fc703cadb8 | |||
| bb69e3d099 | |||
| 08e6f64a64 | |||
| d9193f4442 | |||
| e658538926 | |||
| b55b60cff4 | |||
| ac272df5d3 | |||
| b61e701298 | |||
| 7e2f27fe42 | |||
| 078763cb92 | |||
| 2f66bb2b77 | |||
| b3de77c961 | |||
| 60184e16f5 | |||
| 3e71e6cb3e | |||
| f0b5b01a5f | |||
| 877af01713 | |||
| 39ce53e6c9 | |||
| 3d60203509 | |||
| ed3da68670 | |||
| a0cf56bdac | |||
| 26b8fad3c1 | |||
| 6f9c712b22 | |||
| b95bcb2b63 | |||
| 67fb8d11c2 | |||
| e1f846df99 | |||
| b8cba40e84 | |||
| 0d9dede3c4 | |||
| bb2888f670 | |||
| 1cb727a62a | |||
| 77419e2808 | |||
| 6b42585e82 | |||
| 2841c3aaf1 | |||
| 72871bbd4c | |||
| 697e024936 | |||
| 8c01954c50 | |||
| c7603bffa8 | |||
| 366296743b | |||
| a48f90067e | |||
| 8e6b046ee0 | |||
| fed646a207 | |||
| d76441cf71 | |||
| ee6696fdf4 | |||
| c6265c36a9 | |||
| cc5e41bf32 | |||
| 049d8386ff | |||
| af9c4e6cb9 | |||
| 1af26d22fd | |||
| f9c9e0ef41 | |||
| 06060b7dff | |||
| 6b9d964e36 | |||
| 43752710f8 | |||
| 3b7efa4e74 | |||
| c397a0a4e3 | |||
| 5a674bf44b | |||
| cea1743630 | |||
| 2666f05790 | |||
| 53822961b9 | |||
| 0574c76c4f | |||
| 6941166a71 | |||
| 34ab92f0fb | |||
| b5dbe3bb94 | |||
| 542b9c47ed | |||
| bf6a58c9b7 | |||
| a7182710cc | |||
| cd238a0800 | |||
| 3e6f098b34 | |||
| 244dd4296b | |||
| c7ef8c3223 | |||
| 34b5f2f206 | |||
| ae4c442077 | |||
| 1da72d973d | |||
| 8ef79fb6a6 | |||
| 15e8e58f67 | |||
| c082e4813d | |||
| fc2c75c7df | |||
| d033c4c5a9 | |||
| 04e4a24664 | |||
| 2a7ecd3847 | |||
| 727c8a47d1 | |||
| 37630b17c3 | |||
| d992ac54a2 | |||
| 1ec856379d | |||
| 8d43c5cabf | |||
| 0fae5813f6 | |||
| 62242cd708 | |||
| 5c758d3baf | |||
| 1f495f5fec | |||
| 9e6ebd4c8e | |||
| dd323edec4 | |||
| 53006d6ff4 | |||
| 94097d4656 | |||
| 033ef99663 | |||
| c82e2b01a4 | |||
| b25bc96eb7 | |||
| 00c79242fe | |||
| 46dac8226a | |||
| 8e919e7298 | |||
| 499b115a01 | |||
| 75c0885a5b | |||
| 1cec02f2d8 | |||
| b05e7835c6 | |||
| 62201ceba0 | |||
| 7d28dd8114 | |||
| 6d3f003133 | |||
| 167d6bcbb7 | |||
| fac681cfa2 | |||
| a1643fcdc2 | |||
| d1d7f2eb2b | |||
| 605ab234d7 | |||
| d10c7c922e | |||
| 1c82657c0c | |||
| a4a7faba40 | |||
| ffa4cc6ac9 | |||
| 0cdc7ff542 | |||
| 71de662675 | |||
| a18e453686 | |||
| 6e99ab0184 | |||
| 4b8d91084b | |||
| ed900e2b31 | |||
| e2e67eac9f | |||
| 7ce94ed58e | |||
| 57d44c3c36 | |||
| 3a86a62865 | |||
| 65d5d4303d | |||
| 8d7256ef08 | |||
| fd16cfc67a | |||
| e7bd55637a | |||
| 0f459174c8 | |||
| 1d19323026 | |||
| ed1cc99506 | |||
| f66cb26c58 | |||
| 707412d1b6 | |||
| a7ebdc5453 | |||
| dc35957f63 | |||
| 0711483bb7 | |||
| f4f5ff1887 | |||
| 33a4fa3203 | |||
| 8b22412e55 | |||
| 92d721d9d0 | |||
| 0f06d0b8ce | |||
| e321ec4c6f | |||
| 2f2892ff08 | |||
| 1dd559e80e | |||
| b7fb1b7e5a | |||
| eb60877793 | |||
| 5907ce0a02 | |||
| 2d3fb36420 | |||
| 5a1d431e51 | |||
| 0552c4a001 | |||
| 96d017869a | |||
| ddc2688af8 | |||
| baa60b6198 | |||
| 8abdddf11a | |||
| 9141018b27 | |||
| 3370fecdf2 | |||
| 30ff28e1d8 | |||
| 09f8f310f4 | |||
| 53d7b16564 | |||
| 5e91f76f0f | |||
| 557b3e1c93 | |||
| 18dd85d6cb | |||
| 74ee6ea8b4 | |||
| 2541679dbd | |||
| cbb062cc35 | |||
| 8cf8878425 | |||
| 3f65e56ccd | |||
| 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 | |||
| 5bd2cba2c2 | |||
| 3de7eb58a7 | |||
| 41eb294ce6 | |||
| ba94f2ebe0 | |||
| 7912248950 | |||
| 5d27c255b3 | |||
| 80e86e3b83 | |||
| 3a759f1eea | |||
| a09e503f19 | |||
| da4524b05c | |||
| 1a98283709 | |||
| acca8c5ac9 | |||
| 55eabb84e4 | |||
| 5b9cd52784 | |||
| 2db72615b5 | |||
| f6ab3edc23 | |||
| cef6194628 | |||
| 90ba9fce2a | |||
| 76b3982ddd | |||
| c946f80d5b | |||
| 8d350c7d99 | |||
| 7cd7fb8d6c | |||
| b12e563340 | |||
| 9c0aadce1e | |||
| b8d538b1b4 | |||
| 0219cd71b9 | |||
| 899fcbdfcc | |||
| 79fed6e32f | |||
| 55263ca11d | |||
| fe1f4a3bac | |||
| dd4fda55b5 | |||
| 2aae506110 | |||
| aae54a6f41 | |||
| 89da58adec | |||
| 57ef003eb9 | |||
| d378a64096 | |||
| 58ac91bc10 | |||
| 97602c0bf8 | |||
| 8523c487c1 | |||
| 3580b58bf6 | |||
| 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 | |||
| 9b26a4d5ce | |||
| c43fc68bc8 | |||
| df07539331 | |||
| 563931750b | |||
| 6b090de7b1 | |||
| d8863ef95f | |||
| 36f9595ce7 | |||
| d14178be4c | |||
| 48565e6305 | |||
| 3727f9583b | |||
| 4a6bbf0b3c | |||
| 7513a7157f | |||
| e7dbdb6ead | |||
| db5f101bfc | |||
| 3c06e8b6fd | |||
| 28f94cbd0b | |||
| 6f37cbd946 | |||
| 396281263b | |||
| a00e8ac201 | |||
| b1772a89c1 | |||
| 58f07ff045 | |||
| 12f99d4fc7 | |||
| 05da0a6877 | |||
| 46ce871f34 | |||
| 4b22c2f044 | |||
| 4014828eff | |||
| bc87a62d59 | |||
| f6862442d3 | |||
| bff7f57eb8 | |||
| e19024ca0d | |||
| 73997e4799 | |||
| ffa97aa438 | |||
| d08244dfd8 | |||
| 2e0d367045 | |||
| 0f1fb2e6a1 | |||
| 672e362ed8 | |||
| bcae16c441 | |||
| 19b8f5cb59 | |||
| 68b37156d8 | |||
| d9237b64c0 | |||
| 3f5b1375ab | |||
| eaf444eabc | |||
| da037b38e3 | |||
| 62f864f4ab | |||
| bf89f1d37d | |||
| 3dc986e609 | |||
| 2f5e874201 | |||
| 05291932f8 | |||
| 72aa450ecb | |||
| 926ea21fe0 | |||
| 657a077cdb | |||
| 9a90f56845 | |||
| 7d36e0d63b | |||
| 865d5ed7a1 | |||
| 9dd91ee17e | |||
| 425ea821d7 | |||
| bea5049a2f | |||
| eae1e34696 | |||
| e63b6b00bc | |||
| e5b3ed226b | |||
| d5ce354c87 | |||
| e280838989 | |||
| 2309054b1f | |||
| 9dcc44a76b | |||
| 7a417c6d3b | |||
| 425ab15ae1 | |||
| c75ff4f118 | |||
| 75d3dd19ec | |||
| 4cd556555e | |||
| 6309741522 | |||
| feebe921af | |||
| 92929308bd | |||
| ca4f14b555 | |||
| a7bcfacbd9 | |||
| e097b4820d | |||
| 566ec7974c | |||
| c735d6c420 | |||
| cf54ca9551 | |||
| 9dc9a293f3 | |||
| f2c2a4fce9 | |||
| 9f1da1b562 | |||
| f5a3dbf82b | |||
| 89f83e796a | |||
| 977a9e49c5 | |||
| 7ee0a4b39f | |||
| 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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
|
<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.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||||
<classpathentry kind="output" path="build.eclipse/classes"/>
|
<classpathentry kind="lib" path="lib/test/reflections-0.9.8.jar"/>
|
||||||
</classpath>
|
<classpathentry kind="output" path="build.eclipse/classes"/>
|
||||||
|
</classpath>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>jnalib</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>
|
||||||
+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.
|
||||||
+722
@@ -0,0 +1,722 @@
|
|||||||
|
NOTE: as of JNA 4.0, JNA is now dual-licensed under LGPL and ASL (see LICENSE).
|
||||||
|
|
||||||
|
NOTE: JNI native support is typically incompatible between minor versions, and almost always incompatible between major versions.
|
||||||
|
|
||||||
|
Next Release
|
||||||
|
============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* Updated AIX natives and build - [@twall](https://github.com/twall).
|
||||||
|
* [#290](https://github.com/twall/jna/pull/290): Improved the stacktrace for the exceptions thrown by `com.sun.jna.Structure` - [@ebourg](https://github.com/ebourg).
|
||||||
|
* [#332](https://github.com/twall/jna/pull/332): Added Win32 Monitor Configuration API in `com.sun.jna.platform.win32.Dxva2` - [@msteiger](https://github.com/msteiger).
|
||||||
|
* Added Winspool monitor sample and updated Kernel32, WinBase, Winspool - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* Added Some minor changes to MS Office samples Test and small changes to the MS Office samples Bug Fixes - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* [#333](https://github.com/twall/jna/pull/333): Added `CoTaskMemAlloc`, `CoTaskMemRealloc` and `CoTaskMemFree` to `com.sun.jna.platform.win32.Ole32` - [@msteiger](https://github.com/msteiger).
|
||||||
|
* [#334](https://github.com/twall/jna/pull/334): Added `com.sun.jna.platform.win32.Shell32.SHGetKnownFolderPath` and `KnownFolders` GUID constants - [@msteiger](https://github.com/msteiger).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* [#319](https://github.com/twall/jna/pull/319): Fix direct-mapping type-mapped pointer result types - [@marco2357](https://github.com/marco2357).
|
||||||
|
* Added Variant and TlbImp Fixes - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
|
||||||
|
Release 4.1
|
||||||
|
===========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* Added `com.sun.jna.platform.win32.Advapi32Util.registryCloseKey` - [@falldog](https://github.com/falldog).
|
||||||
|
* Enabled platform tests to be run w/o building native bits - [@twall](https://github.com/twall).
|
||||||
|
* Added COM/Typelib java code generator `com.sun.jna.platform.win32.COM.tlb.TlbImp` - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* [#226](https://github.com/twall/jna/issues/226): Added OSGI information to jna-platform.jar - [@brettwooldridge](https://github.com/brettwooldridge).
|
||||||
|
* [#267](https://github.com/twall/jna/pull/267): Added support for Windows RAS32 API, `com.sun.jna.platform.win32.Rasapi32` and `Rasapi32Util` - [@kc7bfi](https://github.com/kc7bfi).
|
||||||
|
* [#101](https://github.com/twall/jna/issues/101): Modify `com.sun.jna.platform.win32.Advapi32Util.registryGet*` API to support `KEY_WOW64` option - [@falldog](https://github.com/falldog).
|
||||||
|
* [#271](https://github.com/twall/jna/pull/271): Added `com.sun.jna.platform.win32.Gdi32.ChoosePixelFormat` and `SetPixelFormat` - [@kc7bfi](https://github.com/kc7bfi).
|
||||||
|
* [#271](https://github.com/twall/jna/pull/271): Added `com.sun.jna.platform.win32.OpenGL32`, `OpenGL32Util` and `WinOpenGL` - [@kc7bfi](https://github.com/kc7bfi).
|
||||||
|
* [#250](https://github.com/twall/jna/pull/250): Added `com.sun.jna.platform.win32.Kernel32.GetPrivateProfileSection`, `GetPrivateProfileSectionNames` and `WritePrivateProfileSection` and corresponding `Kernel32Util` helpers - [@quipsy-karg](https://github.com/quipsy-karg).
|
||||||
|
* [#287](https://github.com/twall/jna/pull/287): Added `DBTF_MEDIA` and `DBTF_NET` to `com.sun.jna.platform.win32.DBT` - [@daifei4321](https://github.com/daifei4321).
|
||||||
|
* [#295](https://github.com/twall/jna/pull/295): Added `com.sun.jna.platform.win32.Kernel32.ResetEvent` - [@manithree](https://github.com/manithree).
|
||||||
|
* [#301](https://github.com/twall/jna/pull/301): Added `accessCheck` to `com.sun.jna.platform.win32.Advapi32Util`, `MapGenericMask` and `AccessCheck` to `com.sun.jna.platform.win32.Advapi32`, `PRIVILEGE_SET` and `GENERIC_MAPPING` to `com.sun.jna.platform.win32.WinNT` - [@BusyByte](https://github.com/BusyByte).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* Fixed inconsistent behavior on `Structure.ByValue` fields within a `Structure` - [@twall](https://github.com/twall).
|
||||||
|
* [#279](https://github.com/twall/jna/issues/279): Accommodate FreeBSD libc loading - [@sevan](https://github.com/sevan).
|
||||||
|
* [#287](https://github.com/twall/jna/pull/287): Fixed contrib `win32.Win32WindowDemo`, now showing the added/removed drive letter, and whether the event is about media in drive or physical drive - [@daifei4321](https://github.com/daifei4321).
|
||||||
|
* [#300](https://github.com/twall/jna/issues/300): Fix stdcall argument alignment - [@twall](https://github.com/twall).
|
||||||
|
|
||||||
|
Release 4.0
|
||||||
|
===========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* Added ASL licensing to facilitate distribution - [@twall](https://github.com/twall).
|
||||||
|
* [#109](https://github.com/twall/jna/issues/109): Set default Java compatibility level to 1.6 - [@twall](https://github.com/twall).
|
||||||
|
* [#209](https://github.com/twall/jna/issues/209): Improved default performance saving last error results - [@twall](https://github.com/twall).
|
||||||
|
* Use predictable names for CPU architecture prefix (namely x86, x86-64); names correspond to OSGI processor values - [@twall](https://github.com/twall).
|
||||||
|
* Avoid superfluous Structure memory allocation from native - [@twall](https://github.com/twall).
|
||||||
|
* Added `Library.OPTION_CLASSLOADER`, which enables loading native libraries from any class loader (including JNA's native library). This enables parallel dependencies on JNA (e.g. within a tomcat deployment without having to include JNA in the app server environment) - [@twall](https://github.com/twall).
|
||||||
|
* Use per-library String encoding settings (see `Native.getDefaultStringEncoding()` and `Structure.getStringEncoding()`) - [@twall](https://github.com/twall).
|
||||||
|
* Added memory dump for debugging (see `com.sun.jna.Memory`) - [@twall](https://github.com/twall).
|
||||||
|
* Improved caching of Structure alignment, type mapping, and encoding information - [@twall](https://github.com/twall).
|
||||||
|
* [#225](https://github.com/twall/jna/pull/225): Added `platform.win32.Kernel32.GetLogicalProcessorInformation` and `platform.win32.Kernel32Util.getLogicalProcessorInformation` - [@trejkaz](https://github.com/trejkaz).
|
||||||
|
* [#236](https://github.com/twall/jna/issues/236): Auto-strip profiler native method prefix specified by `jna.profiler.prefix`, which defaults to $$YJP$$ - [@twall](https://github.com/twall).
|
||||||
|
* Added `jna.debug_load` property to diagnose library loading issues - [@twall](https://github.com/twall).
|
||||||
|
* Throw explicit `IllegalArgumentException` when `Structure.ByReference` is used where it shouldn't be (can result in multiply freed memory or other unexpected behavior) - [@twall](https://github.com/twall).
|
||||||
|
* [#243](https://github.com/twall/jna/issues/243): Automatically accommodate long library paths on Windows which would otherwise fail - [@twall](https://github.com/twall).
|
||||||
|
* [#241](https://github.com/twall/jna/issues/241) - Added `com.sun.jna.platform.win32.Shell32.SHAppBarMessage` - [@bsorrentino](https://github.com/bsorrentino).
|
||||||
|
* Make `Structure.read/writeField()` protected to facilitate per-field overrides - [@twall](https://github.com/twall).
|
||||||
|
* Speed up callback lookup where large numbers of native function pointers are in use - [@twall](https://github.com/twall).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* [#213](https://github.com/twall/jna/pull/213): Fixed `Structure.toString()` not to dump memory when `jna.dump_memory` is false - [@tomohiron](https://github.com/tomohiron).
|
||||||
|
* Use dedicated TLS to indicate callback detach state, to avoid any potential conflicts with last error storage - [@twall](https://github.com/twall).
|
||||||
|
* [#173](https://github.com/twall/jna/issues/173): Fixed OSX 10.8/Xcode 4+ builds, web start path with Oracle 1.7 JDK - [@mkjellman](https://github.com/mkjellman).
|
||||||
|
* [#215](https://github.com/twall/jna/issues/215): Forced use of XSI `strerror_r` on linux - [LionelCons](https://github.com/LionelCons).
|
||||||
|
* [#214](https://github.com/twall/jna/issues/214): Don't map library names when an absolute path is provided - [@twall](https://github.com/twall).
|
||||||
|
* [#218](https://github.com/twall/jna/issues/218): Explicitly handled broken Android `SecurityManager` implementation - [@twall](https://github.com/twall).
|
||||||
|
* [#223](https://github.com/twall/jna/issues/223): Fixed layout/size derivation for unions - [@twall](https://github.com/twall).
|
||||||
|
* [#229](https://github.com/twall/jna/issues/229): Added `CreateProcessW` (Unicode version) - [@twall](https://github.com/twall).
|
||||||
|
* Avoid solaris/x86 JVM bug w/library open flags - [@twall](https://github.com/twall).
|
||||||
|
* Fixed NPE returning wide string from a direct-mapped function - [@twall](https://github.com/twall).
|
||||||
|
* [#237](https://github.com/twall/jna/issues/237): Fix LastErrorException/getLastError on AIX - [@skissane](https://github.com/skissane).
|
||||||
|
* [#228](https://github.com/twall/jna/issues/228): Fix win32/win64 crashes due to LastErrorException buffer overruns (`snprintf` on windows is broken) - [@davidhoyt](https://github.com/davidhoyt).
|
||||||
|
|
||||||
|
Release 3.5.2
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* Basic [COM support](https://github.com/twall/jna/blob/master/www/PlatformLibrary.md) for w32 - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* Avoid superfluous Structure memory allocation by using Structure(Pointer) ctors if available - [@twall](https://github.com/twall).
|
||||||
|
* [PR#120](https://github.com/twall/jna/pull/120): Provide methods for extracting native libraries from the class path for use by JNA - [@Zlika](https://github.com/Zlika).
|
||||||
|
* [PR#163](https://github.com/twall/jna/pull/163): The Java `GUID` structure can be used directly as alternative to `Ole32Util.getGUIDFromString()` - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* [PR#163](https://github.com/twall/jna/pull/163): Ported Win32 `dbt.h` - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* [PR#163](https://github.com/twall/jna/pull/163): Added Win32 `WTSRegisterSessionNotification()` and `WTSUnRegisterSessionNotification()` from `Wtsapi32.dll` - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* [PR#163](https://github.com/twall/jna/pull/163): Added Win32 `native_window_msg` that creates windows, registers for USB device and logon/logoff notifications - [@wolftobias](https://github.com/wolftobias).
|
||||||
|
* [PR#178](https://github.com/twall/jna/pull/178): Added Win32 `USER_INFO_10` structure from `LMAccess.h` - [@davidmc24](https://github.com/davidmc24).
|
||||||
|
* [PR#192](https://github.com/twall/jna/pull/192): Added Win32 `SHGetSpecialFolderPath()` and initialization file (.ini) API functions from `kernel32.dll` - [@headcrashing](https://github.com/headcrashing).
|
||||||
|
* [PR#194](https://github.com/twall/jna/pull/194): Added Unit Test for `CLSIDFromProgID()` - [@headcrashing](https://github.com/headcrashing).
|
||||||
|
* [PR#196](https://github.com/twall/jna/pull/196): Added Win32 `RegisterWindowMessage()` and new wrapper `User32Util` for convenient use of `RegisterWindowMessage`, `CreateWindow` and `CreateWindowEx` - [@headcrashing](https://github.com/headcrashing).
|
||||||
|
* [PR#187](https://github.com/twall/jna/pull/187): Allow StructureFieldOrderTest unit test in platform project to run on Linux. - [@bhamail](https://github.com/bhamail).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* [PR#180](https://github.com/twall/jna/pull/180): Fix: added missing fields in `XEvents.getFieldOrder()` - [@xwizard](https://github.com/xwizard).
|
||||||
|
* [PR#183](https://github.com/twall/jna/pull/183): Fix `LMAccess.GROUP_INFO_3.getFieldOrder()` to return correct fields names - [@bhamail](https://github.com/bhamail).
|
||||||
|
* [PR#187](https://github.com/twall/jna/pull/187): Fix `getFieldOrder()` to return correct field names for some X11 structures - [@bhamail](https://github.com/bhamail).
|
||||||
|
* Remove deprecated methods on Memory (getSize,isValid) and Structure (getSize) - [@twall](https://github.com/twall).
|
||||||
|
* Remove problematic AWT check via `Class.forName("java.awt.Component")` (see [here](https://bugs.eclipse.org/bugs/show_bug.cgi?id=388170)) - [@twall](https://github.com/twall).
|
||||||
|
* [PR#210](https://github.com/twall/jna/pull/210) Add OSGI processor specs for Mac OS X - [@bertfrees](https://github.com/bertfrees).
|
||||||
|
* [PR#174](https://github.com/twall/jna/pull/174): Recompile linux-amd64 natives to remove glibc-2.11 dependencies, now requires only 2.2.5 or better - [@twall](https://github.com/twall).
|
||||||
|
* [PR#183](https://github.com/twall/jna/pull/183): Added `StructureFieldOrderInspector` unit test utility to scan for `Structure` field issues; see: `com.sun.jna.platform.StructureFieldOrderTest.testMethodGetFieldOrder` - [@bhamail](https://github.com/bhamail).
|
||||||
|
* [PR#187](https://github.com/twall/jna/pull/187): Allow `StructureFieldOrderTest` unit test in platform project to run on Linux - [@bhamail](https://github.com/bhamail).
|
||||||
|
* [#206](https://github.com/twall/jna/issues/206): Fix `moveToTrash()` on OSX to work with symlinks - [@twall](https://github.com/twall).
|
||||||
|
* Fix NPE if `Thread.getContextClassLoader()` returns `null` - [@twall](https://github.com/twall).
|
||||||
|
|
||||||
|
Release 3.5.1
|
||||||
|
=============
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* Fix bug where string fields sometimes failed to be writtern - [@twall](https://github.com/twall) (roman kisluhin).
|
||||||
|
* [PR#145](https://github.com/twall/jna/pull/145): Fix `Netapi32Util.getDomainTrusts()` returns "empty" domain object - [@aikidojohn](https://github.com/aikidojohn).
|
||||||
|
* [PR#145](https://github.com/twall/jna/pull/145): Fix `Netapi32.getDC()` - added missing fields in `DOMAIN_CONTROLLER_INFO` - [@aikidojohn](https://github.com/aikidojohn).
|
||||||
|
* [PR#151](https://github.com/twall/jna/pull/151): 'platform.jar' in the dist directory was not updated for release 3.5.0. (The 'platform.jar' published to maven central was correct.)
|
||||||
|
|
||||||
|
Release 3.5.0
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* [#62](https://github.com/twall/jna/issues/62) If a callback is required to reside in a DLL, use [`DLLCallback`](http://twall.github.com/jna/3.5.1/javadoc/com/sun/jna/win32/DLLCallback.html) to tag your Callback object - [@twall](https://github.com/twall).
|
||||||
|
* `Structure.getFieldOrder()` supersedes `Structure.setFieldOrder()` and is now required - [@twall](https://github.com/twall).
|
||||||
|
* Search `~/Library/Frameworks` and `/Library/Frameworks` on OSX - [@shaneholloway](https://github.com/shaneholloway).
|
||||||
|
* Automatic cleanup of native threads (based on suggestions from neil smith) - [@twall](https://github.com/twall).
|
||||||
|
* Add `android-arm` target - [@ochafik](https://github.com/ochafik), [@twall](https://github.com/twall).
|
||||||
|
* Add `jna.tmpdir` to override temporary JNA storage location - [@twall](https://github.com/twall).
|
||||||
|
* Add `EXTRA_MAKE_OPTS` ant property to override make variables - [@twall](https://github.com/twall).
|
||||||
|
* Add `Library.OPTION_OPEN_FLAGS` to customize dlopen behavior - [@twall](https://github.com/twall).
|
||||||
|
* [#113](https://github.com/twall/jna/issues/113), [#114](https://github.com/twall/jna/issues/114): Add support for GNU/kFreeBSD and debian multi-arch distros - [@twall](https://github.com/twall).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* Fix `Advapi32Util.registryGetValues()` tried to allocate memory for a zero-length `REG_BINARY` value - [@phailwhale22](https://github.com/phailwhale22).
|
||||||
|
* Fix crash in direct mode callbacks with certain type conversions - [@twall](https://github.com/twall).
|
||||||
|
* More thoroughly propagate unexpected exceptions generated in jnidispatch - [@twall](https://github.com/twall).
|
||||||
|
* Cleanup maven poms and publishing to central repo - [@bhamail](https://github.com/bhamail).
|
||||||
|
* [#129](https://github.com/twall/jna/issues/129): Allow `Memory` field in structure - [@twall](https://github.com/twall).
|
||||||
|
* Preserve `PointerType` fields on `Structure.read()` if unchanged - [@twall](https://github.com/twall).
|
||||||
|
* [#128](https://github.com/twall/jna/issues/128): Fix masking extracting DWORD upper and lower WORD values - [@twall](https://github.com/twall).
|
||||||
|
* [#135](https://github.com/twall/jna/issues/135): Fix for `Advapi32Util.registryGetValues()` when reading zero length values - [@danwi](https://github.com/danwi).
|
||||||
|
|
||||||
|
Release 3.4.2
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* Add `platform.win32.Kernel32.GetEnvironmentVariable` and `platform.win32.Kernel32Util.getEnvironmentVariable` - [@dblock](https://github.com/dblock).
|
||||||
|
* Moved `Kernel32.dll` function definitions from `WinNT.java` into `Kernel32.java` - [@dblock](https://github.com/dblock).
|
||||||
|
* Provide `toPointer()` methods on all `_PTR` types (platform win32) - [@twall](https://github.com/twall).
|
||||||
|
* Provide `ant -Dskip-native` to skip platform native build - [@twall](https://github.com/twall).
|
||||||
|
* Provide `ant -Dheadless=true` to run unit tests headless - [@twall](https://github.com/twall).
|
||||||
|
* Added Windows dev environment instructions - [@twall](https://github.com/twall).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* Ensure platform win32 classes use unsigned where appropriate (`ULONG_PTR`, `UINT_PTR`, `ULONGLONG`, `WORD`, `DWORDLONG`) - [@twall](https://github.com/twall).
|
||||||
|
* [#71](https://github.com/twall/jna/issues/71), [#73](https://github.com/twall/jna/issues/73): Fix OSGI entries in manifest - [@twall](https://github.com/twall).
|
||||||
|
* [#78](https://github.com/twall/jna/issues/78): Fix NPE in `platform.win32.Netapi32Util.getDomainTrusts` - [@dblock](https://github.com/dblock).
|
||||||
|
* Fix: auto-sync memory for `struct**` arguments (array of struct pointers) - [@twall](https://github.com/twall).
|
||||||
|
* Fix: `platform.win32.Secur32.AcquireCredentialsHandle`, `InitializeSecurityContext` and `AcceptSecurityContext` on Win32 64-bit - [@dblock](https://github.com/dblock).
|
||||||
|
* Fix: avoid overwriting native `char *` or `wchar_t *` fields within structures when unmodified (similar to current operation with pointers) - [@twall](https://github.com/twall).
|
||||||
|
* Fix: `platform.win32.DsGetDC.DS_DOMAIN_TRUSTS` and `DsEnumerateDomainTrusts` on Win32 64-bit - [@trejkaz](https://github.com/trejkaz).
|
||||||
|
* Fix: Crash freeing the wrong pointer in `Netapi32Util.getDomainTrusts` - [@trejkaz](https://github.com/trejkaz).
|
||||||
|
* [#100](https://github.com/twall/jna/issues/100): Fix `platform.win32.W32FileMonitor` - [@dblock](https://github.com/dblock).
|
||||||
|
* Return INT_PTR from `platform.win32.Shell32.ShellExecute`, since returning
|
||||||
|
`HINSTANCE` is useless.
|
||||||
|
* Fix runtime error in some instances where Structure.setFieldOrder is used (never return self when sharing AutoAllocated memory).
|
||||||
|
* [#107](https://github.com/twall/jna/issues/107): `Structure.clear()` always calls `ensureAllocated()` to avoid NPE.
|
||||||
|
* Ensure internal memory pointer is *always* allocated when calling `Structure.useMemory()`, even if layout is not yet determined.
|
||||||
|
|
||||||
|
Release 3.4.1
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* Add 'unsigned' modifier to IntegerType.
|
||||||
|
* Add to `platform.win32.User32`: `GetLastInputInfo`.
|
||||||
|
* Add `platform.win32.WinNT.GetFileType` and `platform.win32.Kernel32Util.getFileType`.
|
||||||
|
* Add to `platform.win32.Kernel32Util`: `getFileType`.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
* Re-build linux-amd and linux-i386 against older versions of glibc (2.2.5 and
|
||||||
|
2.1.3 respectively).
|
||||||
|
* Properly initialize first printer info struct in winspool library.
|
||||||
|
* Properly support getting and setting zero-array-length `REG_MULTI_SZ` values on Win32.
|
||||||
|
* Fixed SID in Win32 `USER_INFO_23` and `GROUP_INFO_3`.
|
||||||
|
* Fixed passing domain name into Win32 `Netapi32Util.getUserInfo`.
|
||||||
|
|
||||||
|
Release 3.4.0
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
* Provide `jna.nosys=true` to avoid loading any system-provided JNA (useful for local build/development).
|
||||||
|
* Allow override of default jnidispatch library name with `jna.boot.library.name` system property.
|
||||||
|
* Throw an Error if a system install of JNA is incompatible or if JNA's JNI library does not match.
|
||||||
|
* Disable automatic jnidispatch unpacking with `jna.nounpack=true`.
|
||||||
|
* Automatically look up system error messages for LastErrorException.
|
||||||
|
* Improved callback thread-mapping support; re-use, rename, and group callback
|
||||||
|
threads.
|
||||||
|
* Cache structure layout results, improving performance of structure creation.
|
||||||
|
* linux/arm 32-bit support (hardware provided by Alex Lam).
|
||||||
|
* linux/ppc 32-bit support (hardware provided by Fritiof Hedman).
|
||||||
|
* Preliminary linux/ia64, linux/ppc64 support (thanks to Laurent Guerby and the GCC compile farm).
|
||||||
|
* Windows CE/Mobile support (w32ce-arm) (resources provided by andrea antonello and Hydrologis SRL).
|
||||||
|
* linux multi-arch support (kohsuke).
|
||||||
|
* Added REG_QWORD registry type support
|
||||||
|
* Add to `platform.unix.x11`: `XGrabKey`, `XUngrabKey`, `XSetErrorHandler`.
|
||||||
|
* Add to `platform.mac.Carbon`: `GetEventDispatcherTarget`, `InstallEventHandler`, `RegisterEventHotKey`, `GetEventParameter`, `RemoveEventHandler`, `UnregisterEventHotKey`.
|
||||||
|
* Add to `platform.win32.Kernel32`: `CopyFile`, `MoveFile`, `MoveFileEx`, `CreateProcess`, `SetEnvironmentVariables`, `GetFileTime`, `SetFileTime`, `SetFileAttributes`, `DeviceIoControl`, `GetDiskFreeSpaceEx`, `CreateToolhelp32Snapshot`, `Process32First`, `Process32Next`.
|
||||||
|
* Add to `platform.win32.Msi`: `MsiGetComponentPath`, `MsiLocateComponent`, `MsiGetProductCode`, `MsiEnumComponents`.
|
||||||
|
* Add to `platform.win32.User32`: `RegisterHotKey`, `UnregisterHotKey`
|
||||||
|
* Add to `platform.win32.SetupApi`: `SetupDiGetClassDevs`, `SetupDiDestroyDeviceInfoList`, `SetupDiEnumDeviceInterfaces`, `SetupDiGetDeviceInterfaceDetail`, `SetupDiGetDeviceRegistryProperty`.
|
||||||
|
* Add `platform.win32.Shell32.ShellExecute`.
|
||||||
|
* Add to `platform.win32.User32`: `SetParent`, `IsWindowVisible`, `MoveWindow`, `SetWindowPos`, `AttachInputThread`, `SetForegroundWindow`, `GetForegroundWindow`, `SetFocus`, `SendInput`, `WaitForInputIdle`, `InvalidateRect`, `RedrawWindow`, `GetWindow`, `UpdateWindow`, `ShowWindow`, `CloseWindow`.
|
||||||
|
* Add to `platform.win32.Version`: `GetFileVersionInfoSize`, `GetFileVersionInfo`, `VerQueryValue`.
|
||||||
|
* Add to `platform.win32.Advapi32`: `GetFileSecurity`, `RegQueryValueEx(...Long...)`.
|
||||||
|
* Add to `platform.win32.Netapi32`: `NetUserGetInfo`.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
--------
|
||||||
|
* Revise cleanup of in-use temporary files on win32 (issue 6).
|
||||||
|
* Fix structure alignment issues on linux/ppc.
|
||||||
|
* Fix structure alignment issues on linux/arm.
|
||||||
|
* Account for NIO Buffer position (JIRA issue 185).
|
||||||
|
* Avoid crash with very long Strings (> 150k in length).
|
||||||
|
* Fix bug tracking Memory with an associated direct ByteBuffer.
|
||||||
|
* Fix bug handling structs by value when type mappers are in effect (JIRA issue 188).
|
||||||
|
|
||||||
|
Release 3.3.0
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Facilitate `Memory` subclasses (jbellis).
|
||||||
|
* Allow multiple fields of the same type in Unions (Francis Barber).
|
||||||
|
* Add `platform.win32.Advapi32.AdjustTokenPrivileges`, `platform.win32.Advapi32.LookupPrivilegeName`, `platform.win32.Advapi32.LookupPrivilegeValue`, `platform.win32.Advapi32.ImpersonateSelf`.
|
||||||
|
* Add `platform.win32.Advapi32.DuplicateTokenEx`, `platform.win32.Advapi32.CreateProcessAsUser`, `platform.win32.Kernel32.GetExitCodeProcess`, `platform.win32.Kernel32.TerminateProcess`, `platform.win32.Kernel32.ReadFile`, `platform.win32.Kernel32.CreatePipe`, `platform.win32.Kernel32.SetHandleInformation` and related constants / structures in `platform.win32.WinBase` and `platform.win32.WinNT`. Please note that the `SECURITY_ATTRIBUTES` structure has been moved from `platform.win32.WinNT` to `platform.win32.WinBase`.
|
||||||
|
* Add `platform.win32.Kernel32.DeleteFile` and `platform.win32.Kernel32Util.deleteFile`.
|
||||||
|
* Add `platform.win32.Kernel32.GetFileAttributes` and `platform.win32.Kernel32Util.getFileAttributes`.
|
||||||
|
* Add `platform.win32.Kernel32.GetTickCount`.
|
||||||
|
* Add Win32 Service functions to `platform.win32.Advapi32`.
|
||||||
|
* Add `platform.win32.W32ServiceManager` and `W32Service`.
|
||||||
|
* Add Win32 Event Logging functions to `platform.win32.Advapi32` and `platform.win32.Advapi32Util.EventLogIterator`.
|
||||||
|
* `platform.win32.Advapi32Util.registryCreateKey` returns `true` if key was created, `false` if it already exists.
|
||||||
|
* Add `REG_BINARY`, `REG_EXPAND_SZ` and `REG_MULTI_SZ` support to `platform.win32.Advapi32Util` registry functions.
|
||||||
|
* Reduce JNI crossings in a number of native methods, moving object creation out into pure Java code.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Move all native functions into `com.sun.jna.Native`, to ensure that all dependent classes must be disposed before the `Native` class is unloaded. Note that this change is incompatible with all previous JNA native libraries.
|
||||||
|
* Fix `platform.win32.Kernel32.GetNativeSystemInfo` and `GetSystemInfo` AV on Win64.
|
||||||
|
* Fix several potential minor bugs as reported by TvT.
|
||||||
|
* Fix bug in Structure.StructureSet.toString (Blair Zajac), exposed by Tomcat ThreadLocal cleanup.
|
||||||
|
* Fix several bugs when using Structure(Pointer) ctor and array fields (Samuel Audet).
|
||||||
|
|
||||||
|
Release 3.2.7
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Add native peer value accessors for Pointer
|
||||||
|
* The `jna.library.path` property is now re-evaluated whenever a native library is loaded. Previously this value was cached when the JNA classes loaded.
|
||||||
|
* `Native.loadLibrary` can now load `.drv` files.
|
||||||
|
* Refactor `com.sun.jna.platform.win32.WINBASE` into `WinDef`, `WinNT` and `BaseTSD`, matching Windows SDK headers.
|
||||||
|
* Refactor constants from `com.sun.jna.platform.win32.GDI32` into `WinGDI`, matching Windows SDK headers.
|
||||||
|
* Refactor constants from `com.sun.jna.platform.win32.User32` into `WinUser`, matching Windows SDK headers.
|
||||||
|
* Refactor `platform.win32.WinNT.LARGE_INTEGER` into a union.
|
||||||
|
* Add `platform.win32.ObjBase`, `com.sun.jna.platform.win32.Ole32.CoInitializeEx`, `CoUninitialize`, and `CoCreateInstance`.
|
||||||
|
* Add `platform.win32.Oleaut32.SysAllocString` and `SysFreeString`.
|
||||||
|
* Add `platform.win32.Secur32.ImpersonateSecurityContext` and `RevertSecurityContext`.
|
||||||
|
* Add `platform.win32.WinNT.WELL_KNOWN_SID_TYPE`, `SECURITY_MAX_SID_SIZE` and other related SID-related constants.
|
||||||
|
* Add `platform.win32.Advapi32.CreateWellKnownSid` and `IsWellKnownSid` and `com.sun.jna.platform.win32.Advapi32Util.isWellKnownSid`.
|
||||||
|
* Add `platform.win32.Kernel32.GetVersion`, `GetVersionEx`, `GetSystemInfo`, `GetNativeSystemInfo`, `GlobalMemoryStatusEx`, `GetLogicalDriveStrings` and `IsWow64Process`.
|
||||||
|
* Add `platform.win32.Kernel32Util.getLogicalDriveStrings`.
|
||||||
|
* Add `platform.win32.User32.GetSystemMetrics`.
|
||||||
|
* Add `platform.win32.BaseTSD.DWORD_PTR`.
|
||||||
|
* Add `platform.win32.WinBase.SYSTEM_INFO` and `MEMORYSTATUSEX`.
|
||||||
|
* Add `platform.win32.WinNT.OSVERSIONINFOEX`, `VER` constants.
|
||||||
|
* Add `platform.win32.WinDef.ULONGLONG` and `DWORDLONG`.
|
||||||
|
* Add `platform.win32.Shell32.SHGetDesktopFolder` (prep work for Com4JNA).
|
||||||
|
* Add `platform.win32.Winspool.GetPrinterInfo`.
|
||||||
|
* Add `platform.win32.WinspoolUtil.getPrinterInfo1`.
|
||||||
|
* Add `platform.win32.GDI32.GetDeviceCaps`.
|
||||||
|
* Add `platform.win32.GDI32.GetDIBits`.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix `ClassCastException` in `Structure.equals` (issue 152).
|
||||||
|
* Fix bug initializing a structure object from existing memory when the structure has initialized fields (issue 133).
|
||||||
|
* Fix NPE reading an array of string from a pointer when an element of the array is `NULL` (issue 151).
|
||||||
|
* Avoid calling `UnregisterNatives` in native code (issue 154).
|
||||||
|
* Compare unpacked library path against canonical (long) filename (issue 156).
|
||||||
|
* Fix `read()` of uninitialized memory in `platform.win32.Advapi32Util.getTokenGroups` and `getTokenAccount`.
|
||||||
|
* Fix `com.sun.jna.platform.win32.Secur32.QuerySecurityContextToken` to take a `CtxtHandle` instead of `PSecHandle`.
|
||||||
|
* Fix definition of BITMAPINFO (platform/win32).
|
||||||
|
|
||||||
|
Release 3.2.5
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Split code in examples.jar into a contrib platform.jar package and individual packages for demos.
|
||||||
|
* Fix Eclipse build and added Eclipse projects for all contrib samples, import projects from jnalib and contrib.
|
||||||
|
* Ensure Structure fields correctly ordered when inherited.
|
||||||
|
* Use explicit Structure field whenever provided, regardless of whether the VM requires it.
|
||||||
|
* Add Win32 mappings for two dozen functions from Kernel32.dll, Advapi32.dll, Netapi32.dll, Secur32.dll, NtDll.dll, Ole32.dll, Shell32.dll and Crypt32.dll to com.sun.jna.platform.win32.
|
||||||
|
* Port parts of WinError.h, WinNT.h, LMAccess.h, LMCons.h, LMErr.h, LMJoin.h, NTStatus.h, ShlObj.h, WinDef.h, ShellApi.h, Wdm.h, WinReg.h, WinCrypt.h, Sspi.h, Guid.h, NtSecApi.h and DsGetDc.h.
|
||||||
|
* Add Win32 simplified utility interfaces Kernel32Util, Advapi32Util, Netapi32Util, Crypt32Util, NtDllUtil, Shell32Util, Ole32Util and Secur32Util to com.sun.jna.platform.win32.
|
||||||
|
* Support unicode paths in W32FileUtils.
|
||||||
|
* Fix exception during dispose in W32FileMonitor.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Provide String.replace for 1.4 compatibility.
|
||||||
|
* Avoid allocating memory when Structure is provided a pointer in the ctor.
|
||||||
|
* Ensure proper value returned in Pointer.getValue() for non-null, unchanged NIO Buffer values.
|
||||||
|
* Use 1.4-compatible URI generation (issue 149).
|
||||||
|
|
||||||
|
Release 3.2.4
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Make Pointer ctor public.
|
||||||
|
* Provide access to Function objects for arbitrary Pointer values.
|
||||||
|
* Add linux/ia64 binaries (bpiwowar). See issue 134 patch.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Use a more robust method to decode a file-based URL (issue 135).
|
||||||
|
|
||||||
|
Release 3.2.3
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Include version information in code in case package information lost.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix WindowUtils exception on mouse over TrayIcon.
|
||||||
|
* Fix bug toggling windows transparent/opaque (win32/OSX).
|
||||||
|
* Avoid overwriting unchanged Pointer values in arrays (function calls with Pointer[] and Structure.read).
|
||||||
|
* Ensure Structure fields marked `final` are never written.
|
||||||
|
* Fix bug preventing proper population Structure.ByReference fields on Structure read.
|
||||||
|
* Ensure double buffering is disabled in components added to a transparent window.
|
||||||
|
* Fix UnsatisfiedLinkError attempting to load system libraries under Web Start.
|
||||||
|
* Fix loading Web Start-provided libraries on OSX (libraries must have a .jnilib suffix under Web Start).
|
||||||
|
* Properly include sources in Maven zip file (Issue 129).
|
||||||
|
|
||||||
|
Release 3.2.2
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Provide length-specified Pointer.getStringArray()
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix crash with direct mapping if NULL struct* used (Issue 125).
|
||||||
|
* Fix case where null-valued Structure fields would get non-null values on write.
|
||||||
|
* Synch callback Structure/Structure[] arguments on callback return.
|
||||||
|
* Fix NPE when mapping an interface to the current process.
|
||||||
|
* Automatically load proper C library version from current process on Linux (avoids crashing bug on Ubuntu with libc-i686 packages active).
|
||||||
|
* Avoid scanning structure contents in Structure.toString if contents aren't actually used.
|
||||||
|
|
||||||
|
Release 3.2.1
|
||||||
|
==========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Add HRESULT, LONG mapping to W32API (marc strapetz).
|
||||||
|
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix definition of HWND_BROADCAST in W32API.
|
||||||
|
* Fix memory alignment checking (Issue 121).
|
||||||
|
* Fix Structure equals/hashCode implementation, based on current Java fields rather than strictly native memory contents. Avoid using equals/hashCode when avoiding recursive reads/writes.
|
||||||
|
|
||||||
|
Release 3.2.0
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Handle String, Structure, Callback, Buffer, and primitive arrays in direct mappings. Handle NativeMapped and TypeMapper, with optimized paths for IntegerType and PointerType.
|
||||||
|
* Optionally throw errno/GetLastError as an exception. This is preferred to (and more efficient than) calling Native.getLastError().
|
||||||
|
* Unload/delete native library unpacked from jna.jar if Native class is garbage collected. Only install shutdown hook if using the system class loader.
|
||||||
|
* Auto-write contiguous Structure arrays when first element is written.
|
||||||
|
* Support NativeMapped[] as function arguments for interface-mapped libraries (Issue 90).
|
||||||
|
* Enable function lookup within current process on Windows.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Restrict recursive structure reads/writes by thread instead of globally. This avoids potentially missed reads/writes with concurrent access (Issue 120).
|
||||||
|
* Ensure Memory is not GC'd and freed if direct NIO buffers mapped to it are extant.
|
||||||
|
* Allow types derived from java.nio.Buffer as Structure fields.
|
||||||
|
|
||||||
|
Release 3.1.0
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Add raw JNI mapping of static Java methods. Performance is about 10X that of traditional JNA interface mapping, although with less type conversion functionality.
|
||||||
|
* Add library option to allow passing/return of Java Objects.
|
||||||
|
* Allow handling of uncaught callback exceptions (Issue 63).
|
||||||
|
* Object oriented interface to X server (see contrib/x11)
|
||||||
|
* Make Memory class more accessible.
|
||||||
|
* Provide Structure ctor with Pointer argument (issue 102).
|
||||||
|
* Allow implicit library access to current process on linux (issue 98).
|
||||||
|
* Open all shared libraries with RTLD_GLOBAL, if applicable. This was the default behavior on OSX and changes the default behavior on linux.
|
||||||
|
* Allow NIO Buffer as Structure field (with limitations) (Issue 57)
|
||||||
|
* Add `size_t` size.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Run tests with libjsig.so, if available, which fixes some crashes when running tests on 64-bit platforms.
|
||||||
|
* Fix Issue 104.
|
||||||
|
* Fix Issue 94 (Java 1.6 update 10 regression).
|
||||||
|
* Fix Issue 51 (Java 1.6 update 10 regression).
|
||||||
|
* Fix Issue 95.
|
||||||
|
* Fix Issue 101.
|
||||||
|
* Fix Issue 111, memory leak with String-returning Callback.
|
||||||
|
* Fix missing storage of union type information (affects usage of struct/union by value as argument and return type).
|
||||||
|
* Remove non-functional Structure ctors requiring explicit size.
|
||||||
|
|
||||||
|
Release 3.0.9
|
||||||
|
=============
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix issue 93 by only manually searching jna.library.path, then falling back to passing the mapped library name to dlopen/LoadLibrary. This fixes an issue in JRUBY where the incorrect libc.so.6 was being loaded.
|
||||||
|
|
||||||
|
Release 3.0.8
|
||||||
|
==========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Auto-map Pointer[]/String[]/WString[] return values.
|
||||||
|
* Provide utility functions to convert String to primitive array.
|
||||||
|
* Add jna.library.boot.path property to define the directory that the native stub library is loaded from
|
||||||
|
|
||||||
|
Release 3.0.7
|
||||||
|
==========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Improve Win32 loading of libraries with dependencies.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix bug reading structures with PointerType fields, introduced with Pointer field preservation fix.
|
||||||
|
|
||||||
|
Release 3.0.6
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Allow arbitrary callback method names if only one method is defined in the class which implements Callback (colinwalters).
|
||||||
|
* Allow specification of callback type mappers by using a TYPE_MAPPER field (colinwalters).
|
||||||
|
* Allow uninitialized (null-valued) boxed primitives in Structures (colinwalters).
|
||||||
|
* Add convenience methods to set active Union field and value simultaneously (xylo).
|
||||||
|
* Augment Union read/writeField to set the active field.
|
||||||
|
* Allow Structure auto-synch across native calls to be disabled.
|
||||||
|
* Win64 support.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Avoid overwriting unchanged Structure fields of type Pointer.
|
||||||
|
* Avoid more content dragging on OSX or warn if it's too late.
|
||||||
|
* Fix UnsatisfiedLinkError using transparent window on Win2K.
|
||||||
|
* Fix memory leak with callbacks called from native threads with no Java context (johnwallace).
|
||||||
|
* Defer structure size calculation if type mapper not yet set, allowing type mapper to be set in derived constructors (colinwalters).
|
||||||
|
* Ensure structure memory is allocated in Structure.read/writeField.
|
||||||
|
|
||||||
|
Release 3.0.5
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Allow explicit declaration of field order for VMs which have an unpredictable field order.
|
||||||
|
* Check for w32 libraries with a "lib" prefix in addition to normal lookup.
|
||||||
|
* Allow String[]/WString[] as callback argument/return value (assume NULL-terminated array).
|
||||||
|
* Add Solaris8 compatibility to sunos-sparc build (Corey Puffalt).
|
||||||
|
* Look up libraries using web start library path, if appropriate (Corey Puffalt).
|
||||||
|
* Use constants to return integer boolean values.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Properly track cursor on alpha-masked windows.
|
||||||
|
* Avoid searching /lib or /usr/lib on 64-bit Linux.
|
||||||
|
* Avoid using incorrect version of a library when both 32- and 64-bit versions are found.
|
||||||
|
* Avoid transparent window events always dragging window bug on OSX.
|
||||||
|
* Fix division by zero error calculating structure size on OSX/ppc.
|
||||||
|
* Avoid overwriting initialized NativeMapped Structure fields when calculating structure size.
|
||||||
|
* Fix NPE reading back into StringArray.
|
||||||
|
|
||||||
|
Release 3.0.4
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Automatically write contents of Structure.ByReference fields on Structure.write().
|
||||||
|
* Use the actual parameter type in Function invocations if no parameter type information is available (whether method is missing or untyped varargs).
|
||||||
|
* Augmented X11 library mappings (xylo).
|
||||||
|
* Support read/write of NativeMapped arrays within Structure (notably NativeLong).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix library load error when /usr/lib32 and /usr/lib both exist (linux) (Marek Slama).
|
||||||
|
* Avoid incorrect matches against libraries named with the same prefix (e.g. libc-client.so vs libc.so) (xylo).
|
||||||
|
* Properly handle arrays of NativeMapped (e.g. NativeLong) as a Structure field (stefan endrullis).
|
||||||
|
* Ensure structure size calculated prior to setting union active type.
|
||||||
|
* XID is 64-bits on 64-bit X clients (xylo).
|
||||||
|
* Ensure proper arch name is used on Debian (amd64 instead of x86_64).
|
||||||
|
|
||||||
|
Release 3.0.3
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Enable build/run using IBM's J9 VM (leonardo).
|
||||||
|
* Make StdCallFunctionMapper attempt a leading underscore if the simpler mapping doesn't work.
|
||||||
|
* Allow Structure.read to overwrite final fields (may not work on some 1.4 VMs).
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix NPE when passing an array of Structure.ByReference.
|
||||||
|
* Compare entire linux library version when finding a match.
|
||||||
|
* Don't pass struct by value unless the method signature declares it.
|
||||||
|
* Restrict custom first element structure alignment to OSX/ppc.
|
||||||
|
* Improve performance and reduce memory footprint for window masks. Optimize polygon-based masks on w32. Use XFillRectangles on X11.
|
||||||
|
* Fix linkage settings on sunos-amd64 to avoid relocation errors.
|
||||||
|
* Fix callback allocation code on w32, solaris, freebsd, darwin (libffi was misconfigured).
|
||||||
|
* Fix bug when NativeMapped fields are used in a Structure.ByValue instance.
|
||||||
|
* Fix NPE calling Structure.read() before memory is initialized.
|
||||||
|
* Fix NPE calling Structure.read/write with uninitialized NativeMapped fields.
|
||||||
|
|
||||||
|
Release 3.0.2
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Attempt to force unload of jnidispatch library prior to deleting it (w32).
|
||||||
|
* Added amd64 targets for OSX, FreeBSD, and Solaris.
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Reduce space allocated for invocation arguments.
|
||||||
|
* Fix NPE when NativeMapped type is used in a Structure.
|
||||||
|
* Fix some X11 type mappings for 64-bit.
|
||||||
|
* Fix OSX Leopard/JRE1.5+ window transparency.
|
||||||
|
* Fix window alpha compositing on X11.
|
||||||
|
* Fix loading of libraries with unicode names on OSX.
|
||||||
|
|
||||||
|
Release 3.0.1
|
||||||
|
=============
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Improve transparent window drawing performance on w32
|
||||||
|
* Use closure allocation from libffi
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Ensure nested structure arrays initialized with Structure.toArray use the appropriate native memory.
|
||||||
|
* Ensure structure size is calculated prior to converting to array
|
||||||
|
* Avoid creating new windows when setting a window mask
|
||||||
|
* Fix bug in Pointer.setChar.
|
||||||
|
|
||||||
|
Release 3.0
|
||||||
|
===========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* More supported platforms, via GCC's libffi (wmeissner)
|
||||||
|
* Support struct by value as parameter and return value (duncan)
|
||||||
|
* Support struct by reference within structures
|
||||||
|
* Provide access to native peer for java.awt.Component
|
||||||
|
* Provide access to native peer on OS X.
|
||||||
|
* Support MINGW32 builds (fullung)
|
||||||
|
* Allow per-field Structure read/write by field name
|
||||||
|
* Avoid writing Structure fields marked 'volatile'
|
||||||
|
* Read and wrap function pointers in Structure fields when read with a Java proxy to allow easy Java-side invocation (Ken Larson)
|
||||||
|
* Support array-backed Buffers as arguments (wmeissner)
|
||||||
|
* Auto-conversion of custom types (wmeissner)
|
||||||
|
* Allow pointer type-safety
|
||||||
|
* Optional VM crash protection, via Native.setProtected(boolean)
|
||||||
|
* Auto-convert WString[]
|
||||||
|
* Provide library synchronization wrapper similar to Collections.synchronizedX
|
||||||
|
* Support lookup of OSX framework libraries by name
|
||||||
|
* Explicit access to shared library global data
|
||||||
|
* Invocation interception to facilitate translation of C preprocessor macros and inline functions
|
||||||
|
* Provide utility to determine Web Start native library cache location; auto-include this path if jnidispatch is included as a <nativelib> (robertengels)
|
||||||
|
* Provide access to aligned memory
|
||||||
|
* Versioning information embedded in jna.jar and native library
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Avoid attempts to free native library if it failed to load (wmeissner)
|
||||||
|
* Explicitly check method signatures for varargs instead of heuristically guessing (wmeissner)
|
||||||
|
* Disallow declaring Pointer-derived fields in Structures (Function, Memory)
|
||||||
|
* Ensure Object.toString/hashCode/equals methods are intercepted on proxyied interfaces
|
||||||
|
* Update X11 library for 64-bit use (wmeissner)
|
||||||
|
* Properly map arrays of char*/wchar_t* under w32
|
||||||
|
* Allow Pointer[] as a Structure field and Function argument
|
||||||
|
* Fix some misleading Structure error messages
|
||||||
|
* Properly preserve/return GetLastError/errno after native calls
|
||||||
|
* Allocate executable memory on w32 to avoid errors with hardware-enforced data execution protection (DEP)
|
||||||
|
* Fix VM crash on w32 stdcall callbacks
|
||||||
|
* Use long offsets and sizes rather than ints (64-bit safe)
|
||||||
|
* Properly clean up references and release closure memory on JNI_Unload
|
||||||
|
* Use simpler AWT/JAWT library loading workaround
|
||||||
|
* Avoid changing array references within a Structure on read
|
||||||
|
|
||||||
|
Release 2.5
|
||||||
|
===========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Unions
|
||||||
|
* Optimized shaped windows (chris deckers & olivier chafik); instantiation time improved by about 2-3 orders of magnitude for large, mostly contiguous shapes
|
||||||
|
* Provide type mapping in callback arguments/results
|
||||||
|
* Provide access to ByteBuffer direct address as a Pointer
|
||||||
|
* Provide customization of native string encoding with jna.encoding system property
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Properly handle VMs with reversed Structure member storage
|
||||||
|
* Avoid making window undecorated when clearing window mask on X11
|
||||||
|
* Fix structure alignment bug on OSX/PPC when first element is > 4 bytes in size
|
||||||
|
* Clearing OSX window mask by setting to MASK_NONE now works properly
|
||||||
|
* Avoid index exceptions if native buffers are not NUL-terminated on string conversions
|
||||||
|
* Write initialized Structure[] argument memory prior to function calls
|
||||||
|
* Fix IllegalArgumentException reading WString into a Structure
|
||||||
|
* Clear memory when allocating a structure block (fixes VM crash)
|
||||||
|
* Remove versioned JAWT dependency on OSX, allowing use on 10.3/JRE1.4.
|
||||||
|
|
||||||
|
Release 2.4
|
||||||
|
===========
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
* Explicitly support unaligned structures
|
||||||
|
* Auto-reallocate structure arrays
|
||||||
|
* Automatic handling of w32 UNICODE/ASCII variants
|
||||||
|
* Automatic mapping of decorated w32 stdcall function names
|
||||||
|
* Customizable, automatic type conversion of arguments and results (wmeissner)
|
||||||
|
* Support char*[] arguments as Java String[]
|
||||||
|
* Structure supports Callback members (wmeissner)
|
||||||
|
* getByteBuffer from Pointer/Memory (wmeissner)
|
||||||
|
* Allow GC of native libraries
|
||||||
|
* Facilitate use from non-Java contexts (JRuby et al.) (wmeissner)
|
||||||
|
* Improve library path searching (wmeissner)
|
||||||
|
* Handle Structure[] arguments
|
||||||
|
* Handle native long arguments and return values
|
||||||
|
* Handle direct and array-based ByteBuffer arguments (wmeissner)
|
||||||
|
* Change default w32 build to use GCC (it's free, yo)
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Structure.toArray failed to initialize members
|
||||||
|
* Disallow explicit free of Structure/Memory
|
||||||
|
* Ensure native libraries are only loaded once until released
|
||||||
|
* Properly handle NULL when the return value is a Structure
|
||||||
|
* Proper conversion to wchar_t on linux
|
||||||
|
* Copy full length of Java strings to C strings instead of stopping when a NUL character is encountered
|
||||||
|
|
||||||
Arquivo executável → Arquivo normal
+504
-504
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+25
@@ -0,0 +1,25 @@
|
|||||||
|
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
+120
@@ -0,0 +1,120 @@
|
|||||||
|

|
||||||
|
|
||||||
|
Java Native Access (JNA)
|
||||||
|
========================
|
||||||
|
|
||||||
|
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 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 the call does in native code. Most calls require no special handling or configuration; no boilerplate or generated code is required.
|
||||||
|
|
||||||
|
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 significant attention has been paid to performance, correctness and ease of use take priority.
|
||||||
|
|
||||||
|
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 4.1.0
|
||||||
|
|
||||||
|
* [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
|
||||||
|
========
|
||||||
|
|
||||||
|
* Automatic mapping from Java to native functions, with simple mappings for all primitive data types
|
||||||
|
* Runs on most platforms which support Java
|
||||||
|
* Automatic conversion between C and Java strings, with customizable encoding/decoding
|
||||||
|
* Structure and Union arguments/return values, by reference and by value
|
||||||
|
* Function Pointers, (callbacks from native code to Java) as arguments and/or members of a struct
|
||||||
|
* Auto-generated Java proxies for native function pointers
|
||||||
|
* By-reference (pointer-to-type) arguments
|
||||||
|
* Java array and NIO Buffer arguments (primitive types and pointers) as pointer-to-buffer
|
||||||
|
* Nested structures and arrays
|
||||||
|
* Wide (wchar_t-based) strings
|
||||||
|
* Native long support (32- or 64-bit as appropriate)
|
||||||
|
* [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
|
||||||
|
* Support for automatic Windows ASCII/UNICODE function mappings
|
||||||
|
* Varargs support
|
||||||
|
* 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 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:
|
||||||
|
|
||||||
|
* What OS/CPU/architecture you're using (e.g. Windows 7 64-bit)
|
||||||
|
* Reference to your native interface definitions (i.e. C headers), if available
|
||||||
|
* The JNA mapping you're trying to use
|
||||||
|
* VM crash logs, if any
|
||||||
|
* Example native usage, and your attempted Java usage
|
||||||
|
|
||||||
|
It's nearly impossible to indicate proper Java usage when there's no native
|
||||||
|
reference to work from.
|
||||||
|
|
||||||
|
For commercial support, please contact twalljava [at] java [dot] net.
|
||||||
|
|
||||||
|
Using the Library
|
||||||
|
=================
|
||||||
|
|
||||||
|
* [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/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 [https://github.com/twall/jna](https://github.com/twall/jna) and submit pull requests.
|
||||||
|
|
||||||
|
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 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.*
|
||||||
|
|
||||||
|
|
||||||
+74
-65
@@ -10,72 +10,36 @@
|
|||||||
o arrays are treated as pointers, except within a struct
|
o arrays are treated as pointers, except within a struct
|
||||||
- in structure (inline; otherwise pointer-to-X should be used)
|
- in structure (inline; otherwise pointer-to-X should be used)
|
||||||
- as function argument (auto-convert to pointer via Memory)
|
- 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
|
o "free" should be invisible wherever possible
|
||||||
|
|
||||||
# FUTURE DEMOS:
|
# FUTURE DEMOS:
|
||||||
* test keyboard keys' state (needs OSX)
|
* test keyboard keys' state (needs OSX impl)
|
||||||
* get system process information, basic process control
|
* get system process information, basic process control
|
||||||
* additional file utilities (meta info, free space, etc)
|
* additional file utilities (meta info, free space, etc)
|
||||||
* enforce window minimum/maximum size (workaround java bug)
|
* enforce window minimum/maximum size (workaround java bug)
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
* fix setFieldOrder to *always* apply if used
|
* annotations/generics:
|
||||||
* cache structure information
|
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
|
||||||
|
|
||||||
* make direct calls call back *once* to Java where conversion is required,
|
void my_function(@MarshalAs(off_t)long arg);
|
||||||
and process all arguments from there (instead of potentially swapping back
|
|
||||||
and forth multipel times). This also makes it easer to perform conversions
|
|
||||||
(no native changes required).
|
|
||||||
|
|
||||||
* direct/raw non-primitive array arguments (String[], Pointer[], NativeMapped[])
|
trading off cruft in the interface def to avoid cruft in the usage:
|
||||||
|
|
||||||
* ppc64 direct/raw failures (multiple)
|
my_function(0) versus my_function(new off_t(0))
|
||||||
|
|
||||||
* direct calls on ppc to varargs (callbacks) with FP args fail; avoid them for
|
|
||||||
now
|
|
||||||
|
|
||||||
* combine direct and interface mapping calling code where possible
|
|
||||||
|
|
||||||
* make native dll extraction from jar public, to use with user dlls packaged
|
|
||||||
in a jar
|
|
||||||
|
|
||||||
* 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
|
this only really applies to NativeLong/IntegerType types that want to use a
|
||||||
primitive value instead of creating an object instance.
|
primitive value instead of creating an object instance.
|
||||||
|
o flag string(/wstring)-returning methods which need to free their result
|
||||||
* flag string(/wstring)-returning methods which need to free their result
|
|
||||||
to avoid leaking memory whan auto-creating strings from the result
|
to avoid leaking memory whan auto-creating strings from the result
|
||||||
(since normally we don't take explicit ownership of any returned pointers)
|
(since normally we don't take explicit ownership of any returned pointers)
|
||||||
this is a special case for returned strings only, since other returned
|
this is a special case for returned strings only, since other returned
|
||||||
@@ -84,13 +48,30 @@
|
|||||||
NOTE: how many methods actually do this? strdup...
|
NOTE: how many methods actually do this? strdup...
|
||||||
Maybe make function return "Memory", which can then be converted to a
|
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
|
Structure or some other type. Then memory will free itself when no longer
|
||||||
referenced.
|
referenced. (not really common)
|
||||||
* 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
|
* eliminate type conversion contexts; these are almost entirely unused and
|
||||||
"pointer-requiring-free" (which is just Memory). For now, leave it up to
|
more complicated than just wrapping a native mapping in a utility function
|
||||||
the user to manage the pointer, since they have to define the free method
|
* direct non-primitive array arguments (String[], Pointer[], NativeMapped[])
|
||||||
anyway. use could always put a finalizer on a PointerType-derived type.
|
|
||||||
|
* 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)
|
||||||
|
|
||||||
|
* make direct calls call back *once* to Java where conversion is required,
|
||||||
|
and process all arguments from there (instead of potentially swapping back
|
||||||
|
and forth multiple times). This also makes it easer to perform conversions
|
||||||
|
(no native changes required).
|
||||||
|
|
||||||
|
* ppc64 direct/raw failures (multiple)
|
||||||
|
* direct calls on ppc to varargs (callbacks) with FP args fail; avoid them for
|
||||||
|
now
|
||||||
|
* Callback.PostCallWrite.write() cf PostCallRead
|
||||||
|
|
||||||
* universal GCC build w/cross-compile (needs cross compilers...)
|
* universal GCC build w/cross-compile (needs cross compilers...)
|
||||||
* return Pointer.SIZE/LONG_SIZE/WCHAR_SIZE in bits (for consistency with 1.5)
|
* return Pointer.SIZE/LONG_SIZE/WCHAR_SIZE in bits (for consistency with 1.5)
|
||||||
Long.SIZE, Integer.SIZE, et al.
|
Long.SIZE, Integer.SIZE, et al.
|
||||||
@@ -100,6 +81,39 @@
|
|||||||
|
|
||||||
|
|
||||||
# DONE
|
# 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
|
||||||
|
Maybe make interfaces per-header file (winbase, winnt, stdlib, etc),
|
||||||
|
aggregated per-library (interface CLibrary extends stdlib, stdio, etc)
|
||||||
|
(how useful would it really be, or is this just sorting legos?)
|
||||||
|
o same for windowutils, fileutils, etc. (not useful)
|
||||||
* check Structure "final" fields; should never write back to native memory
|
* check Structure "final" fields; should never write back to native memory
|
||||||
* OSX ObjC access (see rococoa)
|
* OSX ObjC access (see rococoa)
|
||||||
* do Structure.write for any callback args
|
* do Structure.write for any callback args
|
||||||
@@ -259,11 +273,6 @@ int findNativeWindow(Window w);
|
|||||||
exception if the value is out of bounds).
|
exception if the value is out of bounds).
|
||||||
o when used as struct fields, could allow detection of field order by order
|
o when used as struct fields, could allow detection of field order by order
|
||||||
of initialization (requires all-or-nothing usage, though)
|
of initialization (requires all-or-nothing usage, though)
|
||||||
* Make a separate jar file for all OS-specific headers
|
|
||||||
Maybe make interfaces per-header file (winbase, winnt, stdlib, etc),
|
|
||||||
aggregated per-library (interface CLibrary extends stdlib, stdio, etc)
|
|
||||||
(how useful would it really be, or is this just sorting legos?)
|
|
||||||
o same for windowutils, fileutils, etc. (not useful)
|
|
||||||
* StringBuffer/StringBuilder as mutable char*/wchar_t* argument
|
* StringBuffer/StringBuilder as mutable char*/wchar_t* argument
|
||||||
NOTE: byte[]/char[] is probably better; it's trivial to convert to String
|
NOTE: byte[]/char[] is probably better; it's trivial to convert to String
|
||||||
and native code can't change the size anyway
|
and native code can't change the size anyway
|
||||||
+1200
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Arquivo executável → Arquivo normal
@@ -2,7 +2,7 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path=""/>
|
<classpathentry kind="src" path=""/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="/jna/dist/jna.jar"/>
|
<classpathentry kind="lib" path="/jnalib/dist/jna.jar"/>
|
||||||
<classpathentry kind="src" path="/platform"/>
|
<classpathentry kind="src" path="/platform"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
@@ -1,78 +1,66 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="jnacontrib.alphamaskdemo" default="jar" basedir=".">
|
<project name="jnacontrib.alphamaskdemo" default="jar" basedir=".">
|
||||||
<description>Builds, tests, and runs the project jnacontrib.alphamaskdemo.</description>
|
<description>Builds, tests, and runs the project jnacontrib.alphamaskdemo.</description>
|
||||||
<!-- Locations -->
|
<!-- Locations -->
|
||||||
<property name="src" location="."/>
|
<property name="src" location="."/>
|
||||||
<property name="build" location="build"/>
|
<property name="build" location="build"/>
|
||||||
<property name="jna-dist" location="../../../dist"/>
|
<property name="jna-dist" location="../../dist"/>
|
||||||
|
|
||||||
<property name="buildClasses" location="${build}/classes"/>
|
<property name="classes" location="${build}/classes"/>
|
||||||
<property name="buildJar" location="${build}/demo-alphamask.jar"/>
|
<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" />
|
<property name="main-class" value="com.sun.jna.contrib.demo.AlphaMaskDemo" />
|
||||||
|
|
||||||
<path id="classpath">
|
<path id="classpath">
|
||||||
<fileset dir="../../../build">
|
<fileset file="${file.reference.jna.jar}"/>
|
||||||
<include name="jna.jar"/>
|
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||||
</fileset>
|
</path>
|
||||||
<fileset dir="../platform/dist">
|
|
||||||
<include name="platform.jar"/>
|
<!-- Run Demo. -->
|
||||||
</fileset>
|
<target name="run" depends="compile">
|
||||||
</path>
|
<java classname="${main-class}" fork="true">
|
||||||
|
<classpath>
|
||||||
<!-- Run Demo. -->
|
<pathelement location="${classes}" />
|
||||||
<target name="run" depends="compile">
|
<path refid="classpath"/>
|
||||||
<java classname="${main-class}" fork="true">
|
</classpath>
|
||||||
<classpath>
|
</java>
|
||||||
<pathelement location="${buildClasses}" />
|
</target>
|
||||||
<path refid="classpath"/>
|
|
||||||
</classpath>
|
<!-- Delete class and jar files. -->
|
||||||
</java>
|
<target name="clean">
|
||||||
</target>
|
<delete dir="${classes}"/>
|
||||||
|
<delete file="${jar}"/>
|
||||||
<!-- Delete class and jar files. -->
|
<delete dir="${build}"/>
|
||||||
<target name="clean">
|
</target>
|
||||||
<delete dir="${buildClasses}"/>
|
|
||||||
<delete file="${buildJar}"/>
|
<!-- Compile all classes. -->
|
||||||
<delete dir="${build}"/>
|
<target name="compile">
|
||||||
</target>
|
<mkdir dir="${classes}"/>
|
||||||
|
<!-- Compile the project. -->
|
||||||
<!-- Compile all classes. -->
|
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||||
<target name="compile">
|
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||||
<mkdir dir="${buildClasses}"/>
|
<classpath>
|
||||||
|
<path refid="classpath"/>
|
||||||
<!-- Compile the project. -->
|
</classpath>
|
||||||
<javac srcdir="${src}" destdir="${buildClasses}" target="1.5" source="1.5" encoding="UTF-8" debug="on">
|
</javac>
|
||||||
<classpath>
|
</target>
|
||||||
<path refid="classpath"/>
|
|
||||||
</classpath>
|
<!-- Create jar-file. -->
|
||||||
<src>
|
<target name="jar" depends="compile">
|
||||||
<dirset dir="${src}"/>
|
<!-- Copy all non-java files to classes. -->
|
||||||
</src>
|
<copy todir="${classes}/com">
|
||||||
</javac>
|
<fileset dir="${src}/com">
|
||||||
|
<exclude name="**/*.java"/>
|
||||||
<!-- Copy all non-java files to classes. -->
|
</fileset>
|
||||||
<copy todir="${buildClasses}/com">
|
</copy>
|
||||||
<fileset dir="${src}/com">
|
<jar jarfile="${jar}" basedir="${classes}">
|
||||||
<exclude name="**/*.java"/>
|
<manifest>
|
||||||
</fileset>
|
<attribute name="Main-Class" value="${main-class}"/>
|
||||||
<!-- platform -->
|
</manifest>
|
||||||
<fileset dir="../platform/build/classes/com">
|
<!-- platform -->
|
||||||
<exclude name="**/*.java"/>
|
<fileset dir="../platform/build/classes/com"/>
|
||||||
</fileset>
|
<!-- jna -->
|
||||||
<!-- jna -->
|
<zipfileset src="${file.reference.jna.jar}"/>
|
||||||
<fileset dir="../../../build/classes/com">
|
</jar>
|
||||||
<exclude name="**/*.java"/>
|
</target>
|
||||||
</fileset>
|
</project>
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Create jar-file. -->
|
|
||||||
<target name="jar" depends="compile">
|
|
||||||
<jar jarfile="${buildJar}" basedir="${buildClasses}">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="${main-class}"/>
|
|
||||||
</manifest>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
+26
-23
@@ -64,14 +64,16 @@ import com.sun.jna.platform.unix.X11.Display;
|
|||||||
import com.sun.jna.platform.unix.X11.GC;
|
import com.sun.jna.platform.unix.X11.GC;
|
||||||
import com.sun.jna.platform.win32.GDI32;
|
import com.sun.jna.platform.win32.GDI32;
|
||||||
import com.sun.jna.platform.win32.User32;
|
import com.sun.jna.platform.win32.User32;
|
||||||
import com.sun.jna.platform.win32.GDI32.BITMAPINFO;
|
import com.sun.jna.platform.win32.WinGDI;
|
||||||
import com.sun.jna.platform.win32.User32.BLENDFUNCTION;
|
import com.sun.jna.platform.win32.WinUser;
|
||||||
import com.sun.jna.platform.win32.User32.POINT;
|
import com.sun.jna.platform.win32.WinDef.HBITMAP;
|
||||||
import com.sun.jna.platform.win32.User32.SIZE;
|
import com.sun.jna.platform.win32.WinDef.HDC;
|
||||||
import com.sun.jna.platform.win32.W32API.HANDLE;
|
import com.sun.jna.platform.win32.WinDef.HWND;
|
||||||
import com.sun.jna.platform.win32.W32API.HBITMAP;
|
import com.sun.jna.platform.win32.WinGDI.BITMAPINFO;
|
||||||
import com.sun.jna.platform.win32.W32API.HDC;
|
import com.sun.jna.platform.win32.WinNT.HANDLE;
|
||||||
import com.sun.jna.platform.win32.W32API.HWND;
|
import com.sun.jna.platform.win32.WinUser.BLENDFUNCTION;
|
||||||
|
import com.sun.jna.platform.win32.WinDef.POINT;
|
||||||
|
import com.sun.jna.platform.win32.WinUser.SIZE;
|
||||||
import com.sun.jna.ptr.PointerByReference;
|
import com.sun.jna.ptr.PointerByReference;
|
||||||
|
|
||||||
// TODO: put this into a reasonable API; right now this is pretty much
|
// TODO: put this into a reasonable API; right now this is pretty much
|
||||||
@@ -127,7 +129,7 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
|
|
||||||
private com.sun.jna.Memory buffer;
|
private com.sun.jna.Memory buffer;
|
||||||
private int[] pixels;
|
private int[] pixels;
|
||||||
private void updateX11(boolean a, boolean i) {
|
private void updateX11(boolean a, boolean i) {
|
||||||
X11 x11 = X11.INSTANCE;
|
X11 x11 = X11.INSTANCE;
|
||||||
X11.Window win = X11.Window.None;
|
X11.Window win = X11.Window.None;
|
||||||
Display dpy = x11.XOpenDisplay(null);
|
Display dpy = x11.XOpenDisplay(null);
|
||||||
@@ -152,7 +154,7 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
int w = image.getWidth(null);
|
int w = image.getWidth(null);
|
||||||
int h = image.getHeight(null);
|
int h = image.getHeight(null);
|
||||||
alphaWindow.setSize(w, h);
|
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);
|
buffer = new com.sun.jna.Memory(w*h*4);
|
||||||
pixels = new int[w*h];
|
pixels = new int[w*h];
|
||||||
}
|
}
|
||||||
@@ -230,9 +232,9 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
if (!alphaWindow.isDisplayable()) {
|
if (!alphaWindow.isDisplayable()) {
|
||||||
alphaWindow.pack();
|
alphaWindow.pack();
|
||||||
hWnd = getHwnd(alphaWindow);
|
hWnd = getHwnd(alphaWindow);
|
||||||
int flags = user.GetWindowLong(hWnd, User32.GWL_EXSTYLE);
|
int flags = user.GetWindowLong(hWnd, WinUser.GWL_EXSTYLE);
|
||||||
flags |= User32.WS_EX_LAYERED;
|
flags |= WinUser.WS_EX_LAYERED;
|
||||||
user.SetWindowLong(hWnd, User32.GWL_EXSTYLE, flags);
|
user.SetWindowLong(hWnd, WinUser.GWL_EXSTYLE, flags);
|
||||||
Window parent = alphaWindow.getOwner();
|
Window parent = alphaWindow.getOwner();
|
||||||
Point where = parent.getLocationOnScreen();
|
Point where = parent.getLocationOnScreen();
|
||||||
where.translate(parent.getWidth(), 0);
|
where.translate(parent.getWidth(), 0);
|
||||||
@@ -260,11 +262,11 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
bmi.bmiHeader.biHeight = h;
|
bmi.bmiHeader.biHeight = h;
|
||||||
bmi.bmiHeader.biPlanes = 1;
|
bmi.bmiHeader.biPlanes = 1;
|
||||||
bmi.bmiHeader.biBitCount = 32;
|
bmi.bmiHeader.biBitCount = 32;
|
||||||
bmi.bmiHeader.biCompression = GDI32.BI_RGB;
|
bmi.bmiHeader.biCompression = WinGDI.BI_RGB;
|
||||||
bmi.bmiHeader.biSizeImage = w * h * 4;
|
bmi.bmiHeader.biSizeImage = w * h * 4;
|
||||||
|
|
||||||
PointerByReference ppbits = new PointerByReference();
|
PointerByReference ppbits = new PointerByReference();
|
||||||
hBitmap = gdi.CreateDIBSection(memDC, bmi, GDI32.DIB_RGB_COLORS,
|
hBitmap = gdi.CreateDIBSection(memDC, bmi, WinGDI.DIB_RGB_COLORS,
|
||||||
ppbits, null, 0);
|
ppbits, null, 0);
|
||||||
oldBitmap = gdi.SelectObject(memDC, hBitmap);
|
oldBitmap = gdi.SelectObject(memDC, hBitmap);
|
||||||
Pointer pbits = ppbits.getValue();
|
Pointer pbits = ppbits.getValue();
|
||||||
@@ -293,9 +295,9 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
POINT srcLoc = new POINT();
|
POINT srcLoc = new POINT();
|
||||||
BLENDFUNCTION blend = new BLENDFUNCTION();
|
BLENDFUNCTION blend = new BLENDFUNCTION();
|
||||||
blend.SourceConstantAlpha = (byte)(alpha * 255);
|
blend.SourceConstantAlpha = (byte)(alpha * 255);
|
||||||
blend.AlphaFormat = User32.AC_SRC_ALPHA;
|
blend.AlphaFormat = WinUser.AC_SRC_ALPHA;
|
||||||
user.UpdateLayeredWindow(hWnd, screenDC, loc, size, memDC, srcLoc,
|
user.UpdateLayeredWindow(hWnd, screenDC, loc, size, memDC, srcLoc,
|
||||||
0, blend, User32.ULW_ALPHA);
|
0, blend, WinUser.ULW_ALPHA);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
user.ReleaseDC(null, screenDC);
|
user.ReleaseDC(null, screenDC);
|
||||||
@@ -309,9 +311,9 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
else if (a) {
|
else if (a) {
|
||||||
BLENDFUNCTION blend = new BLENDFUNCTION();
|
BLENDFUNCTION blend = new BLENDFUNCTION();
|
||||||
blend.SourceConstantAlpha = (byte)(alpha * 255);
|
blend.SourceConstantAlpha = (byte)(alpha * 255);
|
||||||
blend.AlphaFormat = User32.AC_SRC_ALPHA;
|
blend.AlphaFormat = WinUser.AC_SRC_ALPHA;
|
||||||
user.UpdateLayeredWindow(hWnd, null, null, null, null, null,
|
user.UpdateLayeredWindow(hWnd, null, null, null, null, null,
|
||||||
0, blend, User32.ULW_ALPHA);
|
0, blend, WinUser.ULW_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alphaWindow.isVisible()) {
|
if (!alphaWindow.isVisible()) {
|
||||||
@@ -386,8 +388,9 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
JPanel p = new JPanel(new BorderLayout(8, 8));
|
JPanel p = new JPanel(new BorderLayout(8, 8));
|
||||||
p.setBorder(new EmptyBorder(8, 8, 8, 8));
|
p.setBorder(new EmptyBorder(8, 8, 8, 8));
|
||||||
p.setTransferHandler(new TransferHandler() {
|
p.setTransferHandler(new TransferHandler() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
|
public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
|
||||||
List list = Arrays.asList(transferFlavors);
|
List<DataFlavor> list = Arrays.asList(transferFlavors);
|
||||||
if (list.contains(URL_FLAVOR)
|
if (list.contains(URL_FLAVOR)
|
||||||
|| list.contains(URI_LIST_FLAVOR)
|
|| list.contains(URI_LIST_FLAVOR)
|
||||||
|| list.contains(DataFlavor.imageFlavor)
|
|| list.contains(DataFlavor.imageFlavor)
|
||||||
@@ -424,8 +427,8 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)){
|
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)){
|
||||||
List files = (List)t.getTransferData(DataFlavor.javaFileListFlavor);
|
List<File> files = (List<File>) t.getTransferData(DataFlavor.javaFileListFlavor);
|
||||||
File f = (File)files.get(0);
|
File f = files.get(0);
|
||||||
URL url = new URL("file://" + f.toURI().toURL().getPath());
|
URL url = new URL("file://" + f.toURI().toURL().getPath());
|
||||||
Image image = Toolkit.getDefaultToolkit().getImage(url);
|
Image image = Toolkit.getDefaultToolkit().getImage(url);
|
||||||
setImage(image);
|
setImage(image);
|
||||||
@@ -435,7 +438,7 @@ public class AlphaMaskDemo implements Runnable {
|
|||||||
if (flavor != null) {
|
if (flavor != null) {
|
||||||
Reader reader = flavor.getReaderForText(t);
|
Reader reader = flavor.getReaderForText(t);
|
||||||
char[] buf = new char[512];
|
char[] buf = new char[512];
|
||||||
StringBuffer b = new StringBuffer();
|
StringBuilder b = new StringBuilder();
|
||||||
int count;
|
int count;
|
||||||
// excise excess NUL characters (bug in firefox, java
|
// excise excess NUL characters (bug in firefox, java
|
||||||
// or my code, not sure which). someone got the
|
// or my code, not sure which). someone got the
|
||||||
+6
-6
@@ -145,9 +145,10 @@ public class AlphaMaskDemo2 implements Runnable {
|
|||||||
JPanel p = new JPanel(new BorderLayout(8, 8));
|
JPanel p = new JPanel(new BorderLayout(8, 8));
|
||||||
p.setBorder(new EmptyBorder(8, 8, 8, 8));
|
p.setBorder(new EmptyBorder(8, 8, 8, 8));
|
||||||
p.setTransferHandler(new TransferHandler() {
|
p.setTransferHandler(new TransferHandler() {
|
||||||
public boolean canImport(JComponent comp,
|
private static final long serialVersionUID = 1L;
|
||||||
|
public boolean canImport(JComponent comp,
|
||||||
DataFlavor[] transferFlavors) {
|
DataFlavor[] transferFlavors) {
|
||||||
List list = Arrays.asList(transferFlavors);
|
List<DataFlavor> list = Arrays.asList(transferFlavors);
|
||||||
if (list.contains(URL_FLAVOR) || list.contains(URI_LIST_FLAVOR)
|
if (list.contains(URL_FLAVOR) || list.contains(URI_LIST_FLAVOR)
|
||||||
|| list.contains(DataFlavor.imageFlavor)
|
|| list.contains(DataFlavor.imageFlavor)
|
||||||
|| list.contains(DataFlavor.javaFileListFlavor)) {
|
|| list.contains(DataFlavor.javaFileListFlavor)) {
|
||||||
@@ -185,9 +186,8 @@ public class AlphaMaskDemo2 implements Runnable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||||
List files = (List)t
|
List<File> files = (List<File>) t.getTransferData(DataFlavor.javaFileListFlavor);
|
||||||
.getTransferData(DataFlavor.javaFileListFlavor);
|
File f = files.get(0);
|
||||||
File f = (File)files.get(0);
|
|
||||||
URL url = new URL("file://"
|
URL url = new URL("file://"
|
||||||
+ f.toURI().toURL().getPath());
|
+ f.toURI().toURL().getPath());
|
||||||
Image image = Toolkit.getDefaultToolkit().getImage(url);
|
Image image = Toolkit.getDefaultToolkit().getImage(url);
|
||||||
@@ -200,7 +200,7 @@ public class AlphaMaskDemo2 implements Runnable {
|
|||||||
if (flavor != null) {
|
if (flavor != null) {
|
||||||
Reader reader = flavor.getReaderForText(t);
|
Reader reader = flavor.getReaderForText(t);
|
||||||
char[] buf = new char[512];
|
char[] buf = new char[512];
|
||||||
StringBuffer b = new StringBuffer();
|
StringBuilder b = new StringBuilder();
|
||||||
int count;
|
int count;
|
||||||
// excise excess NUL characters (bug in firefox,
|
// excise excess NUL characters (bug in firefox,
|
||||||
// java
|
// java
|
||||||
|
Antes Largura: | Altura: | Tamanho: 18 KiB Depois Largura: | Altura: | Tamanho: 18 KiB |
+68
-77
@@ -1,77 +1,68 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="jnacontrib.balloonmanagerdemo" default="jar" basedir=".">
|
<project name="jnacontrib.balloonmanagerdemo" default="jar" basedir=".">
|
||||||
<description>Builds, tests, and runs the project jnacontrib.balloonmanagerdemo.</description>
|
<description>Builds, tests, and runs the project jnacontrib.balloonmanagerdemo.</description>
|
||||||
<!-- Locations -->
|
<!-- Locations -->
|
||||||
<property name="src" location="."/>
|
<property name="src" location="."/>
|
||||||
<property name="build" location="build"/>
|
<property name="build" location="build"/>
|
||||||
<property name="jna-dist" location="../../../dist"/>
|
<property name="jna-dist" location="../../dist"/>
|
||||||
|
|
||||||
<property name="buildClasses" location="${build}/classes"/>
|
<property name="classes" location="${build}/classes"/>
|
||||||
<property name="buildJar" location="${build}/demo-balloonmanager.jar"/>
|
<property name="jar" location="${build}/demo-balloonmanager.jar"/>
|
||||||
<property name="main-class" value="com.sun.jna.contrib.demo.BalloonManagerDemo" />
|
<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 dir="../../../build">
|
<path id="classpath">
|
||||||
<include name="jna.jar"/>
|
<fileset file="${file.reference.jna.jar}"/>
|
||||||
</fileset>
|
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||||
<fileset dir="../platform/dist">
|
</path>
|
||||||
<include name="platform.jar"/>
|
|
||||||
</fileset>
|
<!-- Run Demo. -->
|
||||||
</path>
|
<target name="run" depends="compile">
|
||||||
|
<java classname="${main-class}" fork="true">
|
||||||
<!-- Run Demo. -->
|
<classpath>
|
||||||
<target name="run" depends="compile">
|
<pathelement location="${classes}" />
|
||||||
<java classname="${main-class}" fork="true">
|
<path refid="classpath"/>
|
||||||
<classpath>
|
</classpath>
|
||||||
<pathelement location="${buildClasses}" />
|
</java>
|
||||||
<path refid="classpath"/>
|
</target>
|
||||||
</classpath>
|
|
||||||
</java>
|
<!-- Delete class and jar files. -->
|
||||||
</target>
|
<target name="clean">
|
||||||
|
<delete dir="${classes}"/>
|
||||||
<!-- Delete class and jar files. -->
|
<delete file="${jar}"/>
|
||||||
<target name="clean">
|
<delete dir="${build}"/>
|
||||||
<delete dir="${buildClasses}"/>
|
</target>
|
||||||
<delete file="${buildJar}"/>
|
|
||||||
<delete dir="${build}"/>
|
<!-- Compile all classes. -->
|
||||||
</target>
|
<target name="compile">
|
||||||
|
<mkdir dir="${classes}"/>
|
||||||
<!-- Compile all classes. -->
|
<!-- Compile the project. -->
|
||||||
<target name="compile">
|
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||||
<mkdir dir="${buildClasses}"/>
|
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||||
|
<classpath>
|
||||||
<!-- Compile the project. -->
|
<path refid="classpath"/>
|
||||||
<javac srcdir="${src}" destdir="${buildClasses}" target="1.5" source="1.5" encoding="UTF-8" debug="on">
|
</classpath>
|
||||||
<classpath>
|
</javac>
|
||||||
<path refid="classpath"/>
|
</target>
|
||||||
</classpath>
|
|
||||||
<src>
|
<!-- Create jar-file. -->
|
||||||
<dirset dir="${src}"/>
|
<target name="jar" depends="compile">
|
||||||
</src>
|
|
||||||
</javac>
|
<!-- Copy all non-java files to classes. -->
|
||||||
|
<copy todir="${classes}/com">
|
||||||
<!-- Copy all non-java files to classes. -->
|
<fileset dir="${src}/com">
|
||||||
<copy todir="${buildClasses}/com">
|
<exclude name="**/*.java"/>
|
||||||
<fileset dir="${src}/com">
|
</fileset>
|
||||||
<exclude name="**/*.java"/>
|
</copy>
|
||||||
</fileset>
|
|
||||||
<!-- platform -->
|
<jar jarfile="${jar}" basedir="${classes}">
|
||||||
<fileset dir="../platform/build/classes/com">
|
<manifest>
|
||||||
<exclude name="**/*.java"/>
|
<attribute name="Main-Class" value="${main-class}"/>
|
||||||
</fileset>
|
</manifest>
|
||||||
<!-- jna -->
|
<!-- platform -->
|
||||||
<fileset dir="../../../build/classes/com">
|
<fileset dir="../platform/build/classes/com"/>
|
||||||
<exclude name="**/*.java"/>
|
<!-- jna -->
|
||||||
</fileset>
|
<zipfileset src="${file.reference.jna.jar}"/>
|
||||||
</copy>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
</project>
|
||||||
<!-- Create jar-file. -->
|
|
||||||
<target name="jar" depends="compile">
|
|
||||||
<jar jarfile="${buildJar}" basedir="${buildClasses}">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="${main-class}"/>
|
|
||||||
</manifest>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
+2
@@ -57,6 +57,7 @@ public class BalloonManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class DropShadow extends JWindow {
|
private static class DropShadow extends JWindow {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private static final float SHADOW_ALPHA = .25f;
|
private static final float SHADOW_ALPHA = .25f;
|
||||||
private static final float YSCALE = .80f;
|
private static final float YSCALE = .80f;
|
||||||
private static final double ANGLE = 2*Math.PI/24;
|
private static final double ANGLE = 2*Math.PI/24;
|
||||||
@@ -149,6 +150,7 @@ public class BalloonManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class BubbleWindow extends JWindow {
|
private static final class BubbleWindow extends JWindow {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private static final int Y_OFFSET = 50;
|
private static final int Y_OFFSET = 50;
|
||||||
private static final int ARC = 25;
|
private static final int ARC = 25;
|
||||||
|
|
||||||
Arquivo executável → Arquivo normal
+2
@@ -1,3 +1,5 @@
|
|||||||
|
An implementation of balloon tips.
|
||||||
|
|
||||||
Compile the two classes in this directory. Requires Java 1.5+.
|
Compile the two classes in this directory. Requires Java 1.5+.
|
||||||
|
|
||||||
javac -cp examples.jar *.java
|
javac -cp examples.jar *.java
|
||||||
@@ -1,77 +1,68 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="jnacontrib.balloontipsdemo" default="jar" basedir=".">
|
<project name="jnacontrib.balloontipsdemo" default="jar" basedir=".">
|
||||||
<description>Builds, tests, and runs the project jnacontrib.balloontipsdemo.</description>
|
<description>Builds, tests, and runs the project jnacontrib.balloontipsdemo.</description>
|
||||||
<!-- Locations -->
|
<!-- Locations -->
|
||||||
<property name="src" location="."/>
|
<property name="src" location="."/>
|
||||||
<property name="build" location="build"/>
|
<property name="build" location="build"/>
|
||||||
<property name="jna-dist" location="../../../dist"/>
|
<property name="jna-dist" location="../../dist"/>
|
||||||
|
|
||||||
<property name="buildClasses" location="${build}/classes"/>
|
<property name="classes" location="${build}/classes"/>
|
||||||
<property name="buildJar" location="${build}/demo-balloontips.jar"/>
|
<property name="jar" location="${build}/demo-balloontips.jar"/>
|
||||||
<property name="main-class" value="com.sun.jna.contrib.demo.FilteredTextField" />
|
<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 dir="../../../build">
|
<path id="classpath">
|
||||||
<include name="jna.jar"/>
|
<fileset file="${file.reference.jna.jar}"/>
|
||||||
</fileset>
|
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||||
<fileset dir="../platform/dist">
|
</path>
|
||||||
<include name="platform.jar"/>
|
|
||||||
</fileset>
|
<!-- Run Demo. -->
|
||||||
</path>
|
<target name="run" depends="compile">
|
||||||
|
<java classname="${main-class}" fork="true">
|
||||||
<!-- Run Demo. -->
|
<classpath>
|
||||||
<target name="run" depends="compile">
|
<pathelement location="${classes}" />
|
||||||
<java classname="${main-class}" fork="true">
|
<path refid="classpath"/>
|
||||||
<classpath>
|
</classpath>
|
||||||
<pathelement location="${buildClasses}" />
|
</java>
|
||||||
<path refid="classpath"/>
|
</target>
|
||||||
</classpath>
|
|
||||||
</java>
|
<!-- Delete class and jar files. -->
|
||||||
</target>
|
<target name="clean">
|
||||||
|
<delete dir="${classes}"/>
|
||||||
<!-- Delete class and jar files. -->
|
<delete file="${jar}"/>
|
||||||
<target name="clean">
|
<delete dir="${build}"/>
|
||||||
<delete dir="${buildClasses}"/>
|
</target>
|
||||||
<delete file="${buildJar}"/>
|
|
||||||
<delete dir="${build}"/>
|
<!-- Compile all classes. -->
|
||||||
</target>
|
<target name="compile">
|
||||||
|
<mkdir dir="${classes}"/>
|
||||||
<!-- Compile all classes. -->
|
<!-- Compile the project. -->
|
||||||
<target name="compile">
|
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||||
<mkdir dir="${buildClasses}"/>
|
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||||
|
<classpath>
|
||||||
<!-- Compile the project. -->
|
<path refid="classpath"/>
|
||||||
<javac srcdir="${src}" destdir="${buildClasses}" target="1.5" source="1.5" encoding="UTF-8" debug="on">
|
</classpath>
|
||||||
<classpath>
|
</javac>
|
||||||
<path refid="classpath"/>
|
</target>
|
||||||
</classpath>
|
|
||||||
<src>
|
<!-- Create jar-file. -->
|
||||||
<dirset dir="${src}"/>
|
<target name="jar" depends="compile">
|
||||||
</src>
|
|
||||||
</javac>
|
<!-- Copy all non-java files to classes. -->
|
||||||
|
<copy todir="${classes}/com">
|
||||||
<!-- Copy all non-java files to classes. -->
|
<fileset dir="${src}/com">
|
||||||
<copy todir="${buildClasses}/com">
|
<exclude name="**/*.java"/>
|
||||||
<fileset dir="${src}/com">
|
</fileset>
|
||||||
<exclude name="**/*.java"/>
|
</copy>
|
||||||
</fileset>
|
|
||||||
<!-- platform -->
|
<jar jarfile="${jar}" basedir="${classes}">
|
||||||
<fileset dir="../platform/build/classes/com">
|
<manifest>
|
||||||
<exclude name="**/*.java"/>
|
<attribute name="Main-Class" value="${main-class}"/>
|
||||||
</fileset>
|
</manifest>
|
||||||
<!-- jna -->
|
<!-- platform -->
|
||||||
<fileset dir="../../../build/classes/com">
|
<fileset dir="../platform/build/classes/com"/>
|
||||||
<exclude name="**/*.java"/>
|
<!-- jna -->
|
||||||
</fileset>
|
<zipfileset src="${file.reference.jna.jar}"/>
|
||||||
</copy>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
</project>
|
||||||
<!-- Create jar-file. -->
|
|
||||||
<target name="jar" depends="compile">
|
|
||||||
<jar jarfile="${buildJar}" basedir="${buildClasses}">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="${main-class}"/>
|
|
||||||
</manifest>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
+519
-521
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+424
-422
@@ -1,422 +1,424 @@
|
|||||||
package com.sun.jna.contrib.demo;
|
package com.sun.jna.contrib.demo;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.event.FocusAdapter;
|
import java.awt.event.FocusAdapter;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.Popup;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.Popup;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.text.AttributeSet;
|
import javax.swing.event.DocumentListener;
|
||||||
import javax.swing.text.BadLocationException;
|
import javax.swing.text.AttributeSet;
|
||||||
import javax.swing.text.Document;
|
import javax.swing.text.BadLocationException;
|
||||||
import javax.swing.text.PlainDocument;
|
import javax.swing.text.Document;
|
||||||
//TODO: FilteredTextField - Comment this class.
|
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 FilteredTextField class is a JTextField that only allows specified
|
||||||
* the text field, and entry validation is performed as each character is
|
* characters to be entered into it. The allowed characters can be added to
|
||||||
* typed. In addition, complete string validation is tested against a
|
* the text field, and entry validation is performed as each character is
|
||||||
* configurable regular expression when leaving the field. If the string is
|
* typed. In addition, complete string validation is tested against a
|
||||||
* invalid the text field is bordered with a red line, and the user is notified
|
* configurable regular expression when leaving the field. If the string is
|
||||||
* of the error upon returning to the text field. The text field can also be
|
* invalid the text field is bordered with a red line, and the user is notified
|
||||||
* configured to accept a limited number of characters.
|
* 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 {
|
@SuppressWarnings("serial")
|
||||||
public static final Character[] UPPERCASE_CHARS = {'A', 'B', 'C', 'D', 'E',
|
public class FilteredTextField extends JTextField {
|
||||||
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
public static final Character[] UPPERCASE_CHARS = {'A', 'B', 'C', 'D', 'E',
|
||||||
'U', 'V', 'W', 'X', 'Y', 'Z'};
|
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||||
public static final Character[] LOWERCASE_CHARS = {'a', 'b', 'c', 'd', 'e',
|
'U', 'V', 'W', 'X', 'Y', 'Z'};
|
||||||
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
public static final Character[] LOWERCASE_CHARS = {'a', 'b', 'c', 'd', 'e',
|
||||||
'u', 'v', 'w', 'x', 'y', 'z'};
|
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||||
public static final Character[] NUMERIC_CHARS = {'1', '2', '3', '4', '5',
|
'u', 'v', 'w', 'x', 'y', 'z'};
|
||||||
'6', '7', '8', '9', '0'};
|
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 ENTRY_BALLOON = 0;
|
||||||
private static final Integer LENGTH_BALLOON = 2;
|
private static final Integer VALID_BALLOON = 1;
|
||||||
private static final Border RED_BORDER =
|
private static final Integer LENGTH_BALLOON = 2;
|
||||||
BorderFactory.createLineBorder(Color.RED, 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 ArrayList<Character> allowable = new ArrayList<Character>();
|
||||||
|
private int maximumLength = String.valueOf(Long.MAX_VALUE).length();
|
||||||
private Border defaultBorder = null;
|
|
||||||
private boolean isValid = true;
|
private Border defaultBorder = null;
|
||||||
|
private boolean isValid = true;
|
||||||
private Popup balloon = null;
|
|
||||||
private String entryError = null;
|
private Popup balloon = null;
|
||||||
private String validRegex = null;
|
private String entryError = null;
|
||||||
private String validError = null;
|
private String validRegex = null;
|
||||||
private Color balloonBorderColor = null;
|
private String validError = null;
|
||||||
private Color balloonBackgroundColor = null;
|
private Color balloonBorderColor = null;
|
||||||
private Color balloonTextColor = null;
|
private Color balloonBackgroundColor = null;
|
||||||
private Integer balloonDuration = null;
|
private Color balloonTextColor = null;
|
||||||
|
private Integer balloonDuration = null;
|
||||||
private Integer balloonType = null;
|
|
||||||
|
private Integer balloonType = null;
|
||||||
/**
|
|
||||||
* Create a FilteredTextField.
|
/**
|
||||||
*/
|
* Create a FilteredTextField.
|
||||||
public FilteredTextField () {
|
*/
|
||||||
super();
|
public FilteredTextField () {
|
||||||
init();
|
super();
|
||||||
}
|
init();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Create a FilteredTextField.
|
/**
|
||||||
* @param columns the number of columns to use to calculate the preferred
|
* Create a FilteredTextField.
|
||||||
* width
|
* @param columns the number of columns to use to calculate the preferred
|
||||||
*/
|
* width
|
||||||
public FilteredTextField (int columns) {
|
*/
|
||||||
super(columns);
|
public FilteredTextField (int columns) {
|
||||||
init();
|
super(columns);
|
||||||
}
|
init();
|
||||||
|
}
|
||||||
/*
|
|
||||||
* Initialize the FilteredTextField.
|
/*
|
||||||
*/
|
* Initialize the FilteredTextField.
|
||||||
private void init () {
|
*/
|
||||||
defaultBorder = getBorder();
|
private void init () {
|
||||||
entryError = "";
|
defaultBorder = getBorder();
|
||||||
validRegex = "";
|
entryError = "";
|
||||||
validError = "";
|
validRegex = "";
|
||||||
balloonBorderColor = BalloonTipManager.DEFAULT_BORDER_COLOR;
|
validError = "";
|
||||||
balloonBackgroundColor = BalloonTipManager.DEFAULT_BACKGROUND_COLOR;
|
balloonBorderColor = BalloonTipManager.DEFAULT_BORDER_COLOR;
|
||||||
balloonTextColor = BalloonTipManager.DEFAULT_TEXT_COLOR;
|
balloonBackgroundColor = BalloonTipManager.DEFAULT_BACKGROUND_COLOR;
|
||||||
balloonDuration = 10000;
|
balloonTextColor = BalloonTipManager.DEFAULT_TEXT_COLOR;
|
||||||
balloonType = ENTRY_BALLOON;
|
balloonDuration = 10000;
|
||||||
addFocusListener(new ValidationEar());
|
balloonType = ENTRY_BALLOON;
|
||||||
}
|
addFocusListener(new ValidationEar());
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Sets the allowable character used for entry validation.
|
/**
|
||||||
* @param characters the allowable characters
|
* Sets the allowable character used for entry validation.
|
||||||
*/
|
* @param characters the allowable characters
|
||||||
public void setCharacters (Character[] characters) {
|
*/
|
||||||
clearCharacters();
|
public void setCharacters (Character[] characters) {
|
||||||
for (int i = 0; i < characters.length; i++) {
|
clearCharacters();
|
||||||
addCharacter(characters[i]);
|
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
|
* 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++) {
|
public void addCharacters (Character[] characters) {
|
||||||
addCharacter(characters[i]);
|
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
|
* Adds the character to the list used for entry validation.
|
||||||
*/
|
* @param characters the character
|
||||||
public void addCharacter (Character character) {
|
*/
|
||||||
if (!allowable.contains(character)) {
|
public void addCharacter (Character character) {
|
||||||
allowable.add(character);
|
if (!allowable.contains(character)) {
|
||||||
}
|
allowable.add(character);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Clears the list of allowable characters for entry validation.
|
/**
|
||||||
*/
|
* Clears the list of allowable characters for entry validation.
|
||||||
public void clearCharacters () {
|
*/
|
||||||
allowable.clear();
|
public void clearCharacters () {
|
||||||
}
|
allowable.clear();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Removes the character array from the list used for entry validation.
|
/**
|
||||||
* @param characters the character array
|
* 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++) {
|
public void removeCharacters (Character[] characters) {
|
||||||
removeCharacter(characters[i]);
|
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
|
* Removes the character from the list used for entry validation.
|
||||||
*/
|
* @param character the character
|
||||||
public void removeCharacter (Character character) {
|
*/
|
||||||
if (allowable.contains(character)) {
|
public void removeCharacter (Character character) {
|
||||||
allowable.remove(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
|
* 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;
|
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
|
* 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;
|
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.
|
* Sets the regular expression that is used for string validation. String
|
||||||
* @param validRegex the validation regular expression
|
* validation is checked when exiting the text field.
|
||||||
*/
|
* @param validRegex the validation regular expression
|
||||||
public void setValidRegex (String validRegex) {
|
*/
|
||||||
this.validRegex = validRegex;
|
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
|
* 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;
|
public void setValidError (String validError) {
|
||||||
}
|
this.validError = validError;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Sets the color to use for the balloon border.
|
/**
|
||||||
* @param borderColor the balloon border color
|
* Sets the color to use for the balloon border.
|
||||||
*/
|
* @param borderColor the balloon border color
|
||||||
public void setBalloonBorderColor (Color borderColor) {
|
*/
|
||||||
balloonBorderColor = borderColor;
|
public void setBalloonBorderColor (Color borderColor) {
|
||||||
}
|
balloonBorderColor = borderColor;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Sets the color to use for the balloon background.
|
/**
|
||||||
* @param backgroundColor the balloon background color
|
* Sets the color to use for the balloon background.
|
||||||
*/
|
* @param backgroundColor the balloon background color
|
||||||
public void setBalloonBackgroundColor (Color backgroundColor) {
|
*/
|
||||||
balloonBackgroundColor = backgroundColor;
|
public void setBalloonBackgroundColor (Color backgroundColor) {
|
||||||
}
|
balloonBackgroundColor = backgroundColor;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Sets the color to use for the balloon text.
|
/**
|
||||||
* @param textColor the balloon text color
|
* Sets the color to use for the balloon text.
|
||||||
*/
|
* @param textColor the balloon text color
|
||||||
public void setBalloonTextColor (Color textColor) {
|
*/
|
||||||
balloonTextColor = textColor;
|
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,
|
* Sets the time in milliseconds that the balloon is visible before
|
||||||
* as other events can also make the balloon disappear.
|
* disappearing. This is the maximum time that the balloon will be visible,
|
||||||
* @param duration the time in milliseconds
|
* as other events can also make the balloon disappear.
|
||||||
*/
|
* @param duration the time in milliseconds
|
||||||
public void setBalloonDuration (Integer duration) {
|
*/
|
||||||
balloonDuration = duration;
|
public void setBalloonDuration (Integer duration) {
|
||||||
}
|
balloonDuration = duration;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
/*
|
||||||
* @see javax.swing.JTextField#createDefaultModel()
|
* (non-Javadoc)
|
||||||
*/
|
* @see javax.swing.JTextField#createDefaultModel()
|
||||||
protected Document createDefaultModel () {
|
*/
|
||||||
return new FilteredTextFieldDocument();
|
protected Document createDefaultModel () {
|
||||||
}
|
return new FilteredTextFieldDocument();
|
||||||
|
}
|
||||||
/*
|
|
||||||
* This class defines the document used for the FilteredTextField.
|
/*
|
||||||
*/
|
* This class defines the document used for the FilteredTextField.
|
||||||
private class FilteredTextFieldDocument extends PlainDocument {
|
*/
|
||||||
/*
|
private class FilteredTextFieldDocument extends PlainDocument {
|
||||||
* Create a FilteredTextFieldDocument.
|
/*
|
||||||
*/
|
* Create a FilteredTextFieldDocument.
|
||||||
public FilteredTextFieldDocument () {
|
*/
|
||||||
addDocumentListener(new FilteredTextFieldEar());
|
public FilteredTextFieldDocument () {
|
||||||
}
|
addDocumentListener(new FilteredTextFieldEar());
|
||||||
|
}
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
/*
|
||||||
* @see javax.swing.text.PlainDocument#insertString(
|
* (non-Javadoc)
|
||||||
* int, java.lang.String, javax.swing.text.AttributeSet)
|
* @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
|
public void insertString (int offset, String str, AttributeSet a)
|
||||||
{
|
throws BadLocationException
|
||||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
{
|
||||||
if (balloonType == VALID_BALLOON) {
|
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||||
balloon.hide();
|
if (balloonType == VALID_BALLOON) {
|
||||||
}
|
balloon.hide();
|
||||||
}
|
}
|
||||||
StringBuffer buffer =
|
}
|
||||||
new StringBuffer(FilteredTextField.this.getText());
|
StringBuilder buffer =
|
||||||
if (offset >= 0 && offset <= buffer.length()) {
|
new StringBuilder(FilteredTextField.this.getText());
|
||||||
buffer.insert(offset, str);
|
if (offset >= 0 && offset <= buffer.length()) {
|
||||||
String strBuf = buffer.toString();
|
buffer.insert(offset, str);
|
||||||
|
String strBuf = buffer.toString();
|
||||||
if (buffer.length() > maximumLength) {
|
|
||||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
if (buffer.length() > maximumLength) {
|
||||||
if (balloonType == LENGTH_BALLOON) {
|
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||||
BalloonTipManager.restartTimer();
|
if (balloonType == LENGTH_BALLOON) {
|
||||||
return;
|
BalloonTipManager.restartTimer();
|
||||||
}
|
return;
|
||||||
else {
|
}
|
||||||
balloon.hide();
|
else {
|
||||||
}
|
balloon.hide();
|
||||||
}
|
}
|
||||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
}
|
||||||
"The number of characters must be less than or equal to " +
|
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||||
maximumLength, 0, 0, balloonDuration, balloonBorderColor,
|
"The number of characters must be less than or equal to " +
|
||||||
balloonBackgroundColor, balloonTextColor);
|
maximumLength, 0, 0, balloonDuration, balloonBorderColor,
|
||||||
balloon.show();
|
balloonBackgroundColor, balloonTextColor);
|
||||||
balloonType = LENGTH_BALLOON;
|
balloon.show();
|
||||||
return;
|
balloonType = LENGTH_BALLOON;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (strBuf == null || strBuf.equals("")) {
|
|
||||||
remove(0, getLength());
|
if (strBuf == null || strBuf.equals("")) {
|
||||||
super.insertString(0, "", null);
|
remove(0, getLength());
|
||||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
super.insertString(0, "", null);
|
||||||
balloon.hide();
|
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||||
}
|
balloon.hide();
|
||||||
return;
|
}
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (allowable.contains(str.charAt(0))) {
|
|
||||||
super.insertString(offset, str, a);
|
if (allowable.contains(str.charAt(0))) {
|
||||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
super.insertString(offset, str, a);
|
||||||
balloon.hide();
|
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||||
}
|
balloon.hide();
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
if (balloon != null && BalloonTipManager.isShowing()) {
|
else {
|
||||||
if (balloonType == ENTRY_BALLOON) {
|
if (balloon != null && BalloonTipManager.isShowing()) {
|
||||||
BalloonTipManager.restartTimer();
|
if (balloonType == ENTRY_BALLOON) {
|
||||||
return;
|
BalloonTipManager.restartTimer();
|
||||||
}
|
return;
|
||||||
else {
|
}
|
||||||
balloon.hide();
|
else {
|
||||||
}
|
balloon.hide();
|
||||||
}
|
}
|
||||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
}
|
||||||
entryError, 0, 0, balloonDuration, balloonBorderColor,
|
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||||
balloonBackgroundColor, balloonTextColor);
|
entryError, 0, 0, balloonDuration, balloonBorderColor,
|
||||||
balloon.show();
|
balloonBackgroundColor, balloonTextColor);
|
||||||
balloonType = ENTRY_BALLOON;
|
balloon.show();
|
||||||
}
|
balloonType = ENTRY_BALLOON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
|
||||||
* This listener class is needed to catch character removal events.
|
/*
|
||||||
*/
|
* This listener class is needed to catch character removal events.
|
||||||
private class FilteredTextFieldEar implements DocumentListener {
|
*/
|
||||||
/*
|
private class FilteredTextFieldEar implements DocumentListener {
|
||||||
* (non-Javadoc)
|
/*
|
||||||
* @see javax.swing.event.DocumentListener#insertUpdate(
|
* (non-Javadoc)
|
||||||
* javax.swing.event.DocumentEvent)
|
* @see javax.swing.event.DocumentListener#insertUpdate(
|
||||||
*/
|
* javax.swing.event.DocumentEvent)
|
||||||
public void insertUpdate (DocumentEvent e) {/* N/A */}
|
*/
|
||||||
|
public void insertUpdate (DocumentEvent e) {/* N/A */}
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
/*
|
||||||
* @see javax.swing.event.DocumentListener#removeUpdate(
|
* (non-Javadoc)
|
||||||
* javax.swing.event.DocumentEvent)
|
* @see javax.swing.event.DocumentListener#removeUpdate(
|
||||||
*/
|
* javax.swing.event.DocumentEvent)
|
||||||
public void removeUpdate (DocumentEvent e) {
|
*/
|
||||||
if (balloon != null && BalloonTipManager.isShowing())
|
public void removeUpdate (DocumentEvent e) {
|
||||||
{
|
if (balloon != null && BalloonTipManager.isShowing())
|
||||||
balloon.hide();
|
{
|
||||||
}
|
balloon.hide();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
/*
|
||||||
* @see javax.swing.event.DocumentListener#changedUpdate(
|
* (non-Javadoc)
|
||||||
* javax.swing.event.DocumentEvent)
|
* @see javax.swing.event.DocumentListener#changedUpdate(
|
||||||
*/
|
* javax.swing.event.DocumentEvent)
|
||||||
public void changedUpdate (DocumentEvent e) {/* N/A */}
|
*/
|
||||||
}
|
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
|
* This listener class is used to determine whether the string is valid based
|
||||||
* field, and notification is performed when returning to the text field.
|
* 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 {
|
*/
|
||||||
/*
|
private class ValidationEar extends FocusAdapter {
|
||||||
* (non-Javadoc)
|
/*
|
||||||
* @see java.awt.event.FocusAdapter#focusLost(java.awt.event.FocusEvent)
|
* (non-Javadoc)
|
||||||
*/
|
* @see java.awt.event.FocusAdapter#focusLost(java.awt.event.FocusEvent)
|
||||||
public void focusLost (FocusEvent e) {
|
*/
|
||||||
String entered = getText().trim();
|
public void focusLost (FocusEvent e) {
|
||||||
if (!entered.matches(validRegex)) {
|
String entered = getText().trim();
|
||||||
if (balloon != null) {
|
if (!entered.matches(validRegex)) {
|
||||||
balloon.hide();
|
if (balloon != null) {
|
||||||
}
|
balloon.hide();
|
||||||
setBorder(
|
}
|
||||||
BorderFactory.createCompoundBorder(RED_BORDER, defaultBorder));
|
setBorder(
|
||||||
isValid = false;
|
BorderFactory.createCompoundBorder(RED_BORDER, defaultBorder));
|
||||||
}
|
isValid = false;
|
||||||
else {
|
}
|
||||||
setBorder(defaultBorder);
|
else {
|
||||||
isValid = true;
|
setBorder(defaultBorder);
|
||||||
}
|
isValid = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
/*
|
||||||
* @see java.awt.event.FocusAdapter#focusGained(java.awt.event.FocusEvent)
|
* (non-Javadoc)
|
||||||
*/
|
* @see java.awt.event.FocusAdapter#focusGained(java.awt.event.FocusEvent)
|
||||||
public void focusGained (FocusEvent e) {
|
*/
|
||||||
if (!isValid) {
|
public void focusGained (FocusEvent e) {
|
||||||
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
if (!isValid) {
|
||||||
validError, 0, 0, balloonDuration, balloonBorderColor,
|
balloon = BalloonTipManager.getBalloonTip(FilteredTextField.this,
|
||||||
balloonBackgroundColor, balloonTextColor);
|
validError, 0, 0, balloonDuration, balloonBorderColor,
|
||||||
balloon.show();
|
balloonBackgroundColor, balloonTextColor);
|
||||||
balloonType = VALID_BALLOON;
|
balloon.show();
|
||||||
}
|
balloonType = VALID_BALLOON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
|
||||||
* A main entry point to test the FilteredTextField.
|
/*
|
||||||
* @param args application arguments
|
* A main entry point to test the FilteredTextField.
|
||||||
*/
|
* @param args application arguments
|
||||||
public static void main (String[] args) {
|
*/
|
||||||
try {
|
public static void main (String[] args) {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
try {
|
||||||
}
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
catch (Exception e) {
|
}
|
||||||
e.printStackTrace();
|
catch (Exception e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
JFrame jframe = new JFrame("FilteredTextField Test");
|
}
|
||||||
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
JFrame jframe = new JFrame("Balloon Tips on FilteredTextField");
|
||||||
jframe.setSize(400, 75);
|
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
jframe.setLocation(400, 400);
|
jframe.setSize(400, 75);
|
||||||
JPanel jpanel = new JPanel();
|
jframe.setLocation(400, 400);
|
||||||
jpanel.setLayout(new BorderLayout());
|
JPanel jpanel = new JPanel();
|
||||||
FilteredTextField ftfield = new FilteredTextField(10);
|
jpanel.setLayout(new BorderLayout());
|
||||||
ftfield.setCharacters(LOWERCASE_CHARS);
|
FilteredTextField ftfield = new FilteredTextField(10);
|
||||||
ftfield.addCharacter('-');
|
ftfield.setCharacters(LOWERCASE_CHARS);
|
||||||
ftfield.addCharacter('_');
|
ftfield.addCharacter('-');
|
||||||
ftfield.addCharacter(' ');
|
ftfield.addCharacter('_');
|
||||||
ftfield.setMaximumLength(10);
|
ftfield.addCharacter(' ');
|
||||||
ftfield.setEntryError(
|
ftfield.setMaximumLength(10);
|
||||||
"Only lower case letters, hyphens, underscores, and spaces allowed.");
|
ftfield.setEntryError(
|
||||||
ftfield.setValidRegex("^a+[a-z-_ ]*");
|
"Only lower case letters, hyphens, underscores, and spaces allowed.");
|
||||||
ftfield.setValidError("The string must begin with the letter 'a'.");
|
ftfield.setValidRegex("^a+[a-z-_ ]*");
|
||||||
jpanel.add(ftfield, BorderLayout.CENTER);
|
ftfield.setValidError("The string must begin with the letter 'a'.");
|
||||||
jpanel.add(new FilteredTextField(10), BorderLayout.SOUTH);
|
jpanel.add(new JLabel("Type some text into either field"), BorderLayout.NORTH);
|
||||||
jframe.getContentPane().add(jpanel);
|
jpanel.add(ftfield, BorderLayout.CENTER);
|
||||||
jframe.setVisible(true);
|
jpanel.add(new FilteredTextField(10), BorderLayout.SOUTH);
|
||||||
}
|
jframe.getContentPane().add(jpanel);
|
||||||
}
|
jframe.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path=""/>
|
<classpathentry kind="src" path=""/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="/jna/dist/jna.jar"/>
|
<classpathentry kind="lib" path="/jnalib/dist/jna.jar"/>
|
||||||
<classpathentry kind="src" path="/platform"/>
|
<classpathentry kind="src" path="/platform"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
@@ -1,77 +1,68 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="jnacontrib.dnddemo" default="jar" basedir=".">
|
<project name="jnacontrib.dnddemo" default="jar" basedir=".">
|
||||||
<description>Builds, tests, and runs the project jnacontrib.dnddemo.</description>
|
<description>Builds, tests, and runs the project jnacontrib.dnddemo.</description>
|
||||||
<!-- Locations -->
|
<!-- Locations -->
|
||||||
<property name="src" location="."/>
|
<property name="src" location="."/>
|
||||||
<property name="build" location="build"/>
|
<property name="build" location="build"/>
|
||||||
<property name="jna-dist" location="../../../dist"/>
|
<property name="jna-dist" location="../../dist"/>
|
||||||
|
|
||||||
<property name="buildClasses" location="${build}/classes"/>
|
<property name="classes" location="${build}/classes"/>
|
||||||
<property name="buildJar" location="${build}/demo-dnd.jar"/>
|
<property name="jar" location="${build}/demo-dnd.jar"/>
|
||||||
<property name="main-class" value="com.sun.jna.contrib.demo.GhostedDragImageDemo" />
|
<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 dir="../../../build">
|
<path id="classpath">
|
||||||
<include name="jna.jar"/>
|
<fileset file="${file.reference.jna.jar}"/>
|
||||||
</fileset>
|
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
|
||||||
<fileset dir="../platform/dist">
|
</path>
|
||||||
<include name="platform.jar"/>
|
|
||||||
</fileset>
|
<!-- Run Demo. -->
|
||||||
</path>
|
<target name="run" depends="compile">
|
||||||
|
<java classname="${main-class}" fork="true">
|
||||||
<!-- Run Demo. -->
|
<classpath>
|
||||||
<target name="run" depends="compile">
|
<pathelement location="${classes}" />
|
||||||
<java classname="${main-class}" fork="true">
|
<path refid="classpath"/>
|
||||||
<classpath>
|
</classpath>
|
||||||
<pathelement location="${buildClasses}" />
|
</java>
|
||||||
<path refid="classpath"/>
|
</target>
|
||||||
</classpath>
|
|
||||||
</java>
|
<!-- Delete class and jar files. -->
|
||||||
</target>
|
<target name="clean">
|
||||||
|
<delete dir="${classes}"/>
|
||||||
<!-- Delete class and jar files. -->
|
<delete file="${jar}"/>
|
||||||
<target name="clean">
|
<delete dir="${build}"/>
|
||||||
<delete dir="${buildClasses}"/>
|
</target>
|
||||||
<delete file="${buildJar}"/>
|
|
||||||
<delete dir="${build}"/>
|
<!-- Compile all classes. -->
|
||||||
</target>
|
<target name="compile">
|
||||||
|
<mkdir dir="${classes}"/>
|
||||||
<!-- Compile all classes. -->
|
<!-- Compile the project. -->
|
||||||
<target name="compile">
|
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||||
<mkdir dir="${buildClasses}"/>
|
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||||
|
<classpath>
|
||||||
<!-- Compile the project. -->
|
<path refid="classpath"/>
|
||||||
<javac srcdir="${src}" destdir="${buildClasses}" target="1.5" source="1.5" encoding="UTF-8" debug="on">
|
</classpath>
|
||||||
<classpath>
|
</javac>
|
||||||
<path refid="classpath"/>
|
</target>
|
||||||
</classpath>
|
|
||||||
<src>
|
<!-- Create jar-file. -->
|
||||||
<dirset dir="${src}"/>
|
<target name="jar" depends="compile">
|
||||||
</src>
|
|
||||||
</javac>
|
<!-- Copy all non-java files to classes. -->
|
||||||
|
<copy todir="${classes}/com">
|
||||||
<!-- Copy all non-java files to classes. -->
|
<fileset dir="${src}/com">
|
||||||
<copy todir="${buildClasses}/com">
|
<exclude name="**/*.java"/>
|
||||||
<fileset dir="${src}/com">
|
</fileset>
|
||||||
<exclude name="**/*.java"/>
|
</copy>
|
||||||
</fileset>
|
|
||||||
<!-- platform -->
|
<jar jarfile="${jar}" basedir="${classes}">
|
||||||
<fileset dir="../platform/build/classes/com">
|
<manifest>
|
||||||
<exclude name="**/*.java"/>
|
<attribute name="Main-Class" value="${main-class}"/>
|
||||||
</fileset>
|
</manifest>
|
||||||
<!-- jna -->
|
<!-- platform -->
|
||||||
<fileset dir="../../../build/classes/com">
|
<fileset dir="../platform/build/classes/com"/>
|
||||||
<exclude name="**/*.java"/>
|
<!-- jna -->
|
||||||
</fileset>
|
<zipfileset src="${file.reference.jna.jar}"/>
|
||||||
</copy>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
</project>
|
||||||
<!-- Create jar-file. -->
|
|
||||||
<target name="jar" depends="compile">
|
|
||||||
<jar jarfile="${buildJar}" basedir="${buildClasses}">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="${main-class}"/>
|
|
||||||
</manifest>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
+2
-1
@@ -63,7 +63,8 @@ public class GhostedDragImageDemo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class DragLabel extends JLabel {
|
public static class DragLabel extends JLabel {
|
||||||
private boolean dragging;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private boolean dragging;
|
||||||
public DragLabel(Icon icon) {
|
public DragLabel(Icon icon) {
|
||||||
super(icon);
|
super(icon);
|
||||||
new DragHandler(this, DnDConstants.ACTION_COPY_OR_MOVE) {
|
new DragHandler(this, DnDConstants.ACTION_COPY_OR_MOVE) {
|
||||||
|
Antes Largura: | Altura: | Tamanho: 28 KiB Depois Largura: | Altura: | Tamanho: 28 KiB |
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" output="build.eclipse/contrib-test-classes" path="test"/>
|
<classpathentry kind="src" output="build.eclipse/contrib-test-classes" path="test"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/jna"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||||
<classpathentry kind="lib" path="/jna/dist/jna.jar"/>
|
<classpathentry kind="lib" path="/jnalib/dist/jna.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
+4
-4
@@ -16,16 +16,16 @@ debug.test.classpath=\
|
|||||||
dist.dir=dist
|
dist.dir=dist
|
||||||
dist.jar=${dist.dir}/contrib-ntservice.jar
|
dist.jar=${dist.dir}/contrib-ntservice.jar
|
||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
file.reference.jna.jar=../../../build/jna.jar
|
file.reference.jna.jar=../../build/jna.jar
|
||||||
libs.junit.classpath=../../../lib/junit.jar
|
libs.junit.classpath=../../lib/junit.jar
|
||||||
jar.compress=false
|
jar.compress=false
|
||||||
javac.classpath=\
|
javac.classpath=\
|
||||||
${file.reference.jna.jar};
|
${file.reference.jna.jar};
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
javac.source=1.6
|
javac.source=1.5
|
||||||
javac.target=1.6
|
javac.target=1.5
|
||||||
javac.test.classpath=\
|
javac.test.classpath=\
|
||||||
${javac.classpath}:\
|
${javac.classpath}:\
|
||||||
${build.classes.dir}:\
|
${build.classes.dir}:\
|
||||||
@@ -0,0 +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 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" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-22
@@ -1,22 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* WINERROR.java
|
* WINERROR.java
|
||||||
*
|
*
|
||||||
* Created on 7. August 2007, 08:09
|
* Created on 7. August 2007, 08:09
|
||||||
*
|
*
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package jnacontrib.jna;
|
package jnacontrib.jna;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author TB
|
* @author TB
|
||||||
*/
|
*/
|
||||||
public interface WINERROR {
|
public interface WINERROR {
|
||||||
public final static int ERROR_SUCCESS = 0;
|
public final static int ERROR_SUCCESS = 0;
|
||||||
public final static int NO_ERROR = 0;
|
public final static int NO_ERROR = 0;
|
||||||
public final static int ERROR_FILE_NOT_FOUND = 2;
|
public final static int ERROR_FILE_NOT_FOUND = 2;
|
||||||
public final static int ERROR_MORE_DATA = 234;
|
public final static int ERROR_MORE_DATA = 234;
|
||||||
}
|
}
|
||||||
@@ -0,0 +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;
|
||||||
|
}
|
||||||
+104
-109
@@ -1,109 +1,104 @@
|
|||||||
/*
|
/*
|
||||||
* WINSVC.java
|
* WINSVC.java
|
||||||
*
|
*
|
||||||
* Created on 8. August 2007, 15:07
|
* Created on 8. August 2007, 15:07
|
||||||
*
|
*
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package jnacontrib.jna;
|
package jnacontrib.jna;
|
||||||
|
|
||||||
import com.sun.jna.Pointer;
|
|
||||||
import com.sun.jna.Structure;
|
/**
|
||||||
import com.sun.jna.ptr.PointerByReference;
|
*
|
||||||
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
|
* @author TB
|
||||||
|
*/
|
||||||
|
public interface WINSVC {
|
||||||
/**
|
public final static int SERVICE_CONTROL_STOP = 0x00000001;
|
||||||
*
|
public final static int SERVICE_CONTROL_SHUTDOWN = 0x00000005;
|
||||||
* @author TB
|
|
||||||
*/
|
public final static int SERVICE_STOPPED = 0x00000001;
|
||||||
public interface WINSVC {
|
public final static int SERVICE_START_PENDING = 0x00000002;
|
||||||
public final static int SERVICE_CONTROL_STOP = 0x00000001;
|
public final static int SERVICE_STOP_PENDING = 0x00000003;
|
||||||
public final static int SERVICE_CONTROL_SHUTDOWN = 0x00000005;
|
public final static int SERVICE_RUNNING = 0x00000004;
|
||||||
|
public final static int SERVICE_CONTINUE_PENDING = 0x00000005;
|
||||||
public final static int SERVICE_STOPPED = 0x00000001;
|
public final static int SERVICE_PAUSE_PENDING = 0x00000006;
|
||||||
public final static int SERVICE_START_PENDING = 0x00000002;
|
public final static int SERVICE_PAUSED = 0x00000007;
|
||||||
public final static int SERVICE_STOP_PENDING = 0x00000003;
|
|
||||||
public final static int SERVICE_RUNNING = 0x00000004;
|
public final static int SERVICE_ACCEPT_STOP = 0x00000001;
|
||||||
public final static int SERVICE_CONTINUE_PENDING = 0x00000005;
|
public final static int SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002;
|
||||||
public final static int SERVICE_PAUSE_PENDING = 0x00000006;
|
public final static int SERVICE_ACCEPT_SHUTDOWN = 0x00000004;
|
||||||
public final static int SERVICE_PAUSED = 0x00000007;
|
public final static int SERVICE_ACCEPT_PARAMCHANGE = 0x00000008;
|
||||||
|
public final static int SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010;
|
||||||
public final static int SERVICE_ACCEPT_STOP = 0x00000001;
|
|
||||||
public final static int SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002;
|
public final static int SC_MANAGER_CONNECT = 0x0001;
|
||||||
public final static int SERVICE_ACCEPT_SHUTDOWN = 0x00000004;
|
public final static int SC_MANAGER_CREATE_SERVICE = 0x0002;
|
||||||
public final static int SERVICE_ACCEPT_PARAMCHANGE = 0x00000008;
|
public final static int SC_MANAGER_ENUMERATE_SERVICE = 0x0004;
|
||||||
public final static int SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010;
|
public final static int SC_MANAGER_LOCK = 0x0008;
|
||||||
|
public final static int SC_MANAGER_QUERY_LOCK_STATUS = 0x0010;
|
||||||
public final static int SC_MANAGER_CONNECT = 0x0001;
|
public final static int SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020;
|
||||||
public final static int SC_MANAGER_CREATE_SERVICE = 0x0002;
|
|
||||||
public final static int SC_MANAGER_ENUMERATE_SERVICE = 0x0004;
|
public final static int SC_MANAGER_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||||
public final static int SC_MANAGER_LOCK = 0x0008;
|
SC_MANAGER_CONNECT |
|
||||||
public final static int SC_MANAGER_QUERY_LOCK_STATUS = 0x0010;
|
SC_MANAGER_CREATE_SERVICE |
|
||||||
public final static int SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020;
|
SC_MANAGER_ENUMERATE_SERVICE |
|
||||||
|
SC_MANAGER_LOCK |
|
||||||
public final static int SC_MANAGER_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
SC_MANAGER_QUERY_LOCK_STATUS |
|
||||||
SC_MANAGER_CONNECT |
|
SC_MANAGER_MODIFY_BOOT_CONFIG;
|
||||||
SC_MANAGER_CREATE_SERVICE |
|
|
||||||
SC_MANAGER_ENUMERATE_SERVICE |
|
public final static int SERVICE_QUERY_CONFIG = 0x0001;
|
||||||
SC_MANAGER_LOCK |
|
public final static int SERVICE_CHANGE_CONFIG = 0x0002;
|
||||||
SC_MANAGER_QUERY_LOCK_STATUS |
|
public final static int SERVICE_QUERY_STATUS = 0x0004;
|
||||||
SC_MANAGER_MODIFY_BOOT_CONFIG;
|
public final static int SERVICE_ENUMERATE_DEPENDENTS = 0x0008;
|
||||||
|
public final static int SERVICE_START = 0x0010;
|
||||||
public final static int SERVICE_QUERY_CONFIG = 0x0001;
|
public final static int SERVICE_STOP = 0x0020;
|
||||||
public final static int SERVICE_CHANGE_CONFIG = 0x0002;
|
public final static int SERVICE_PAUSE_CONTINUE = 0x0040;
|
||||||
public final static int SERVICE_QUERY_STATUS = 0x0004;
|
public final static int SERVICE_INTERROGATE = 0x0080;
|
||||||
public final static int SERVICE_ENUMERATE_DEPENDENTS = 0x0008;
|
public final static int SERVICE_USER_DEFINED_CONTROL = 0x0100;
|
||||||
public final static int SERVICE_START = 0x0010;
|
|
||||||
public final static int SERVICE_STOP = 0x0020;
|
public final static int SERVICE_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||||
public final static int SERVICE_PAUSE_CONTINUE = 0x0040;
|
SERVICE_QUERY_CONFIG |
|
||||||
public final static int SERVICE_INTERROGATE = 0x0080;
|
SERVICE_CHANGE_CONFIG |
|
||||||
public final static int SERVICE_USER_DEFINED_CONTROL = 0x0100;
|
SERVICE_QUERY_STATUS |
|
||||||
|
SERVICE_ENUMERATE_DEPENDENTS |
|
||||||
public final static int SERVICE_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
SERVICE_START |
|
||||||
SERVICE_QUERY_CONFIG |
|
SERVICE_STOP |
|
||||||
SERVICE_CHANGE_CONFIG |
|
SERVICE_PAUSE_CONTINUE |
|
||||||
SERVICE_QUERY_STATUS |
|
SERVICE_INTERROGATE |
|
||||||
SERVICE_ENUMERATE_DEPENDENTS |
|
SERVICE_USER_DEFINED_CONTROL;
|
||||||
SERVICE_START |
|
|
||||||
SERVICE_STOP |
|
public final static int SERVICE_CONFIG_DESCRIPTION = 1;
|
||||||
SERVICE_PAUSE_CONTINUE |
|
public final static int SERVICE_CONFIG_FAILURE_ACTIONS = 2;
|
||||||
SERVICE_INTERROGATE |
|
|
||||||
SERVICE_USER_DEFINED_CONTROL;
|
public final static int SERVICE_KERNEL_DRIVER = 0x00000001;
|
||||||
|
public final static int SERVICE_FILE_SYSTEM_DRIVER = 0x00000002;
|
||||||
public final static int SERVICE_CONFIG_DESCRIPTION = 1;
|
public final static int SERVICE_ADAPTER = 0x00000004;
|
||||||
public final static int SERVICE_CONFIG_FAILURE_ACTIONS = 2;
|
public final static int SERVICE_RECOGNIZER_DRIVER = 0x00000008;
|
||||||
|
|
||||||
public final static int SERVICE_KERNEL_DRIVER = 0x00000001;
|
public final static int SERVICE_DRIVER = SERVICE_KERNEL_DRIVER |
|
||||||
public final static int SERVICE_FILE_SYSTEM_DRIVER = 0x00000002;
|
SERVICE_FILE_SYSTEM_DRIVER |
|
||||||
public final static int SERVICE_ADAPTER = 0x00000004;
|
SERVICE_RECOGNIZER_DRIVER;
|
||||||
public final static int SERVICE_RECOGNIZER_DRIVER = 0x00000008;
|
|
||||||
|
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
||||||
public final static int SERVICE_DRIVER = SERVICE_KERNEL_DRIVER |
|
public final static int SERVICE_WIN32_SHARE_PROCESS = 0x00000020;
|
||||||
SERVICE_FILE_SYSTEM_DRIVER |
|
public final static int SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS;
|
||||||
SERVICE_RECOGNIZER_DRIVER;
|
|
||||||
|
public final static int SERVICE_INTERACTIVE_PROCESS = 0x00000100;
|
||||||
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
|
||||||
public final static int SERVICE_WIN32_SHARE_PROCESS = 0x00000020;
|
public final static int SERVICE_TYPE_ALL = SERVICE_WIN32 |
|
||||||
public final static int SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS;
|
SERVICE_ADAPTER |
|
||||||
|
SERVICE_DRIVER |
|
||||||
public final static int SERVICE_INTERACTIVE_PROCESS = 0x00000100;
|
SERVICE_INTERACTIVE_PROCESS;
|
||||||
|
|
||||||
public final static int SERVICE_TYPE_ALL = SERVICE_WIN32 |
|
public final static int SERVICE_BOOT_START = 0x00000000;
|
||||||
SERVICE_ADAPTER |
|
public final static int SERVICE_SYSTEM_START = 0x00000001;
|
||||||
SERVICE_DRIVER |
|
public final static int SERVICE_AUTO_START = 0x00000002;
|
||||||
SERVICE_INTERACTIVE_PROCESS;
|
public final static int SERVICE_DEMAND_START = 0x00000003;
|
||||||
|
public final static int SERVICE_DISABLED = 0x00000004;
|
||||||
public final static int SERVICE_BOOT_START = 0x00000000;
|
|
||||||
public final static int SERVICE_SYSTEM_START = 0x00000001;
|
public final static int SERVICE_ERROR_IGNORE = 0x00000000;
|
||||||
public final static int SERVICE_AUTO_START = 0x00000002;
|
public final static int SERVICE_ERROR_NORMAL = 0x00000001;
|
||||||
public final static int SERVICE_DEMAND_START = 0x00000003;
|
public final static int SERVICE_ERROR_SEVERE = 0x00000002;
|
||||||
public final static int SERVICE_DISABLED = 0x00000004;
|
public final static int SERVICE_ERROR_CRITICAL = 0x00000003;
|
||||||
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
+66
-66
@@ -1,66 +1,66 @@
|
|||||||
/*
|
/*
|
||||||
* TestService.java
|
* TestService.java
|
||||||
*
|
*
|
||||||
* Created on 12. September 2007, 12:49
|
* Created on 12. September 2007, 12:49
|
||||||
*
|
*
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package jnacontrib.win32;
|
package jnacontrib.win32;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestService.
|
* TestService.
|
||||||
*/
|
*/
|
||||||
public class TestService extends Win32Service {
|
public class TestService extends Win32Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* main.
|
* main.
|
||||||
* @param args arguments
|
* @param args arguments
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
TestService service = new TestService();
|
TestService service = new TestService();
|
||||||
|
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("install")) {
|
if(args[0].equalsIgnoreCase("install")) {
|
||||||
System.out.println(service.install("TestService DisplayName", "TestService Description",
|
System.out.println(service.install("TestService DisplayName", "TestService Description",
|
||||||
null, null, null));
|
null, null, null));
|
||||||
|
|
||||||
} else if(args[0].equalsIgnoreCase("uninstall")) {
|
} else if(args[0].equalsIgnoreCase("uninstall")) {
|
||||||
System.out.println(service.uninstall());
|
System.out.println(service.uninstall());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Arguments:");
|
System.out.println("Arguments:");
|
||||||
System.out.println("install = install service");
|
System.out.println("install = install service");
|
||||||
System.out.println("uninstall = uninstall service");
|
System.out.println("uninstall = uninstall service");
|
||||||
System.out.println("<none> = run service");
|
System.out.println("<none> = run service");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
service.init();
|
service.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of TestService.
|
* Creates a new instance of TestService.
|
||||||
*/
|
*/
|
||||||
public TestService() {
|
public TestService() {
|
||||||
super("TestService");
|
super("TestService");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will be called on start.
|
* Will be called on start.
|
||||||
*/
|
*/
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will be called on stop.
|
* Will be called on stop.
|
||||||
*/
|
*/
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+310
-311
@@ -1,311 +1,310 @@
|
|||||||
/*
|
/*
|
||||||
* Win32Service.java
|
* Win32Service.java
|
||||||
*
|
*
|
||||||
* Created on 12. September 2007, 12:05
|
* Created on 12. September 2007, 12:05
|
||||||
*
|
*
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package jnacontrib.win32;
|
package jnacontrib.win32;
|
||||||
|
|
||||||
import jnacontrib.jna.*;
|
import jnacontrib.jna.*;
|
||||||
import com.sun.jna.Pointer;
|
import com.sun.jna.Pointer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baseclass for a Win32 service.
|
* Baseclass for a Win32 service.
|
||||||
*/
|
*/
|
||||||
public abstract class Win32Service {
|
public abstract class Win32Service {
|
||||||
protected String serviceName;
|
protected String serviceName;
|
||||||
private ServiceMain serviceMain;
|
private ServiceMain serviceMain;
|
||||||
private ServiceControl serviceControl;
|
private ServiceControl serviceControl;
|
||||||
private Pointer serviceStatusHandle;
|
private Pointer serviceStatusHandle;
|
||||||
private Object waitObject = new Object();
|
private Object waitObject = new Object();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of Win32Service.
|
* Creates a new instance of Win32Service.
|
||||||
*
|
*
|
||||||
* @param serviceName internal name of the service
|
* @param serviceName internal name of the service
|
||||||
*/
|
*/
|
||||||
public Win32Service(String serviceName) {
|
public Win32Service(String serviceName) {
|
||||||
this.serviceName = serviceName;
|
this.serviceName = serviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install the service.
|
* Install the service.
|
||||||
*
|
*
|
||||||
* @param displayName visible name
|
* @param displayName visible name
|
||||||
* @param description description
|
* @param description description
|
||||||
* @param dependencies array of other services to depend on or null
|
* @param dependencies array of other services to depend on or null
|
||||||
* @param account service account or null for LocalSystem
|
* @param account service account or null for LocalSystem
|
||||||
* @param password password for service account or null
|
* @param password password for service account or null
|
||||||
* @throws java.lang.Exception
|
* @throws java.lang.Exception
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*/
|
*/
|
||||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password) {
|
public boolean install(String displayName, String description, String[] dependencies, String account, String password) {
|
||||||
return(install(displayName, description, dependencies, account, password, "java.exe -cp \"" +
|
return(install(displayName, description, dependencies, account, password, "java.exe -cp \"" +
|
||||||
System.getProperty("java.class.path") + "\" -Xrs " + this.getClass().getName()));
|
System.getProperty("java.class.path") + "\" -Xrs " + this.getClass().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install the service.
|
* Install the service.
|
||||||
*
|
*
|
||||||
* @return true on success
|
* @return true on success
|
||||||
* @param displayName visible name
|
* @param displayName visible name
|
||||||
* @param description description
|
* @param description description
|
||||||
* @param dependencies array of other services to depend on or null
|
* @param dependencies array of other services to depend on or null
|
||||||
* @param account service account or null for LocalSystem
|
* @param account service account or null for LocalSystem
|
||||||
* @param password password for service account or null
|
* @param password password for service account or null
|
||||||
* @param command command line to start the service
|
* @param command command line to start the service
|
||||||
* @throws java.lang.Exception
|
* @throws java.lang.Exception
|
||||||
*/
|
*/
|
||||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password, String command) {
|
public boolean install(String displayName, String description, String[] dependencies, String account, String password, String command) {
|
||||||
Advapi32 advapi32;
|
Advapi32 advapi32;
|
||||||
Advapi32.SERVICE_DESCRIPTION desc;
|
Advapi32.SERVICE_DESCRIPTION desc;
|
||||||
Pointer serviceManager, service;
|
Pointer serviceManager, service;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
String dep = "";
|
String dep = "";
|
||||||
|
|
||||||
if(dependencies != null) {
|
if(dependencies != null) {
|
||||||
for(String s : dependencies) {
|
for(String s : dependencies) {
|
||||||
dep += s + "\0";
|
dep += s + "\0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dep += "\0";
|
dep += "\0";
|
||||||
|
|
||||||
desc = new Advapi32.SERVICE_DESCRIPTION();
|
desc = new Advapi32.SERVICE_DESCRIPTION();
|
||||||
desc.lpDescription = description;
|
desc.lpDescription = description;
|
||||||
|
|
||||||
advapi32 = Advapi32.INSTANCE;
|
advapi32 = Advapi32.INSTANCE;
|
||||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if(serviceManager != null) {
|
if(serviceManager != null) {
|
||||||
service = advapi32.CreateService(serviceManager, serviceName, displayName,
|
service = advapi32.CreateService(serviceManager, serviceName, displayName,
|
||||||
WINSVC.SERVICE_ALL_ACCESS, WINSVC.SERVICE_WIN32_OWN_PROCESS, WINSVC.SERVICE_DEMAND_START,
|
WINSVC.SERVICE_ALL_ACCESS, WINSVC.SERVICE_WIN32_OWN_PROCESS, WINSVC.SERVICE_DEMAND_START,
|
||||||
WINSVC.SERVICE_ERROR_NORMAL,
|
WINSVC.SERVICE_ERROR_NORMAL,
|
||||||
command,
|
command,
|
||||||
null, null, dep, account, password);
|
null, null, dep, account, password);
|
||||||
|
|
||||||
if(service != null) {
|
if(service != null) {
|
||||||
success = advapi32.ChangeServiceConfig2(service, WINSVC.SERVICE_CONFIG_DESCRIPTION, desc);
|
success = advapi32.ChangeServiceConfig2(service, WINSVC.SERVICE_CONFIG_DESCRIPTION, desc);
|
||||||
advapi32.CloseServiceHandle(service);
|
advapi32.CloseServiceHandle(service);
|
||||||
}
|
}
|
||||||
advapi32.CloseServiceHandle(serviceManager);
|
advapi32.CloseServiceHandle(serviceManager);
|
||||||
}
|
}
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uninstall the service.
|
* Uninstall the service.
|
||||||
*
|
*
|
||||||
* @throws java.lang.Exception
|
* @throws java.lang.Exception
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*/
|
*/
|
||||||
public boolean uninstall() {
|
public boolean uninstall() {
|
||||||
Advapi32 advapi32;
|
Advapi32 advapi32;
|
||||||
Pointer serviceManager, service;
|
Pointer serviceManager, service;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
advapi32 = Advapi32.INSTANCE;
|
advapi32 = Advapi32.INSTANCE;
|
||||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if(serviceManager != null) {
|
if(serviceManager != null) {
|
||||||
service = advapi32.OpenService(serviceManager, serviceName, WINSVC.SERVICE_ALL_ACCESS);
|
service = advapi32.OpenService(serviceManager, serviceName, WINSVC.SERVICE_ALL_ACCESS);
|
||||||
|
|
||||||
if(service != null) {
|
if(service != null) {
|
||||||
success = advapi32.DeleteService(service);
|
success = advapi32.DeleteService(service);
|
||||||
advapi32.CloseServiceHandle(service);
|
advapi32.CloseServiceHandle(service);
|
||||||
}
|
}
|
||||||
advapi32.CloseServiceHandle(serviceManager);
|
advapi32.CloseServiceHandle(serviceManager);
|
||||||
}
|
}
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask the ServiceControlManager to start the service.
|
* Ask the ServiceControlManager to start the service.
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*/
|
*/
|
||||||
public boolean start() {
|
public boolean start() {
|
||||||
Advapi32 advapi32;
|
Advapi32 advapi32;
|
||||||
Pointer serviceManager, service;
|
Pointer serviceManager, service;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
advapi32 = Advapi32.INSTANCE;
|
advapi32 = Advapi32.INSTANCE;
|
||||||
|
|
||||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||||
|
|
||||||
if(serviceManager != null) {
|
if(serviceManager != null) {
|
||||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||||
|
|
||||||
if(service != null) {
|
if(service != null) {
|
||||||
success = advapi32.StartService(service, 0, null);
|
success = advapi32.StartService(service, 0, null);
|
||||||
advapi32.CloseServiceHandle(service);
|
advapi32.CloseServiceHandle(service);
|
||||||
}
|
}
|
||||||
advapi32.CloseServiceHandle(serviceManager);
|
advapi32.CloseServiceHandle(serviceManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask the ServiceControlManager to stop the service.
|
* Ask the ServiceControlManager to stop the service.
|
||||||
* @return true on success
|
* @return true on success
|
||||||
*/
|
*/
|
||||||
public boolean stop() throws Exception {
|
public boolean stop() throws Exception {
|
||||||
Advapi32 advapi32;
|
Advapi32 advapi32;
|
||||||
Pointer serviceManager, service;
|
Pointer serviceManager, service;
|
||||||
Advapi32.SERVICE_STATUS serviceStatus;
|
Advapi32.SERVICE_STATUS serviceStatus;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
advapi32 = Advapi32.INSTANCE;
|
advapi32 = Advapi32.INSTANCE;
|
||||||
|
|
||||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||||
|
|
||||||
if(serviceManager != null) {
|
if(serviceManager != null) {
|
||||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||||
|
|
||||||
if(service != null) {
|
if(service != null) {
|
||||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||||
success = advapi32.ControlService(service, WINSVC.SERVICE_CONTROL_STOP, serviceStatus);
|
success = advapi32.ControlService(service, WINSVC.SERVICE_CONTROL_STOP, serviceStatus);
|
||||||
advapi32.CloseServiceHandle(service);
|
advapi32.CloseServiceHandle(service);
|
||||||
}
|
}
|
||||||
advapi32.CloseServiceHandle(serviceManager);
|
advapi32.CloseServiceHandle(serviceManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the service, connect to the ServiceControlManager.
|
* Initialize the service, connect to the ServiceControlManager.
|
||||||
*/
|
*/
|
||||||
public void init() {
|
public void init() {
|
||||||
Advapi32 advapi32;
|
Advapi32 advapi32;
|
||||||
Advapi32.SERVICE_TABLE_ENTRY[] entries = new Advapi32.SERVICE_TABLE_ENTRY[2];
|
Advapi32.SERVICE_TABLE_ENTRY entry;
|
||||||
Advapi32.SERVICE_TABLE_ENTRY entry;
|
|
||||||
|
serviceMain = new ServiceMain();
|
||||||
serviceMain = new ServiceMain();
|
advapi32 = Advapi32.INSTANCE;
|
||||||
advapi32 = Advapi32.INSTANCE;
|
entry = new Advapi32.SERVICE_TABLE_ENTRY();
|
||||||
entry = new Advapi32.SERVICE_TABLE_ENTRY();
|
entry.lpServiceName = serviceName;
|
||||||
entry.lpServiceName = serviceName;
|
entry.lpServiceProc = serviceMain;
|
||||||
entry.lpServiceProc = serviceMain;
|
|
||||||
|
advapi32.StartServiceCtrlDispatcher(entry.toArray(2));
|
||||||
advapi32.StartServiceCtrlDispatcher(entry.toArray(2));
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Get a handle to the ServiceControlManager.
|
||||||
* Get a handle to the ServiceControlManager.
|
*
|
||||||
*
|
* @param machine name of the machine or null for localhost
|
||||||
* @param machine name of the machine or null for localhost
|
* @param access access flags
|
||||||
* @param access access flags
|
* @return handle to ServiceControlManager or null when failed
|
||||||
* @return handle to ServiceControlManager or null when failed
|
*/
|
||||||
*/
|
private Pointer openServiceControlManager(String machine, int access) {
|
||||||
private Pointer openServiceControlManager(String machine, int access) {
|
Pointer handle = null;
|
||||||
Pointer handle = null;
|
Advapi32 advapi32;
|
||||||
Advapi32 advapi32;
|
|
||||||
|
advapi32 = Advapi32.INSTANCE;
|
||||||
advapi32 = Advapi32.INSTANCE;
|
handle = advapi32.OpenSCManager(machine, null, access);
|
||||||
handle = advapi32.OpenSCManager(machine, null, access);
|
return(handle);
|
||||||
return(handle);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Report service status to the ServiceControlManager.
|
||||||
* Report service status to the ServiceControlManager.
|
*
|
||||||
*
|
* @param status status
|
||||||
* @param status status
|
* @param win32ExitCode exit code
|
||||||
* @param win32ExitCode exit code
|
* @param waitHint time to wait
|
||||||
* @param waitHint time to wait
|
*/
|
||||||
*/
|
private void reportStatus(int status, int win32ExitCode, int waitHint) {
|
||||||
private void reportStatus(int status, int win32ExitCode, int waitHint) {
|
Advapi32 advapi32;
|
||||||
Advapi32 advapi32;
|
Advapi32.SERVICE_STATUS serviceStatus;
|
||||||
Advapi32.SERVICE_STATUS serviceStatus;
|
|
||||||
|
advapi32 = Advapi32.INSTANCE;
|
||||||
advapi32 = Advapi32.INSTANCE;
|
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
serviceStatus.dwServiceType = WINNT.SERVICE_WIN32_OWN_PROCESS;
|
||||||
serviceStatus.dwServiceType = WINNT.SERVICE_WIN32_OWN_PROCESS;
|
serviceStatus.dwControlsAccepted = WINSVC.SERVICE_ACCEPT_STOP | WINSVC.SERVICE_ACCEPT_SHUTDOWN;
|
||||||
serviceStatus.dwControlsAccepted = WINSVC.SERVICE_ACCEPT_STOP | WINSVC.SERVICE_ACCEPT_SHUTDOWN;
|
serviceStatus.dwWin32ExitCode = win32ExitCode;
|
||||||
serviceStatus.dwWin32ExitCode = win32ExitCode;
|
serviceStatus.dwWaitHint = waitHint;
|
||||||
serviceStatus.dwWaitHint = waitHint;
|
serviceStatus.dwCurrentState = status;
|
||||||
serviceStatus.dwCurrentState = status;
|
|
||||||
|
advapi32.SetServiceStatus(serviceStatusHandle, serviceStatus);
|
||||||
advapi32.SetServiceStatus(serviceStatusHandle, serviceStatus);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Called when service is starting.
|
||||||
* Called when service is starting.
|
*/
|
||||||
*/
|
public abstract void onStart();
|
||||||
public abstract void onStart();
|
|
||||||
|
/*
|
||||||
/*
|
* Called when service should stop.
|
||||||
* Called when service should stop.
|
*/
|
||||||
*/
|
public abstract void onStop();
|
||||||
public abstract void onStop();
|
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
* Implementation of the service main function.
|
||||||
* Implementation of the service main function.
|
*/
|
||||||
*/
|
private class ServiceMain implements Advapi32.SERVICE_MAIN_FUNCTION {
|
||||||
private class ServiceMain implements Advapi32.SERVICE_MAIN_FUNCTION {
|
|
||||||
|
/**
|
||||||
/**
|
* Called when the service is starting.
|
||||||
* Called when the service is starting.
|
*
|
||||||
*
|
* @param dwArgc number of arguments
|
||||||
* @param dwArgc number of arguments
|
* @param lpszArgv pointer to arguments
|
||||||
* @param lpszArgv pointer to arguments
|
*/
|
||||||
*/
|
public void callback(int dwArgc, Pointer lpszArgv) {
|
||||||
public void callback(int dwArgc, Pointer lpszArgv) {
|
Advapi32 advapi32;
|
||||||
Advapi32 advapi32;
|
|
||||||
|
advapi32 = Advapi32.INSTANCE;
|
||||||
advapi32 = Advapi32.INSTANCE;
|
|
||||||
|
serviceControl = new ServiceControl();
|
||||||
serviceControl = new ServiceControl();
|
serviceStatusHandle = advapi32.RegisterServiceCtrlHandlerEx(serviceName, serviceControl, null);
|
||||||
serviceStatusHandle = advapi32.RegisterServiceCtrlHandlerEx(serviceName, serviceControl, null);
|
|
||||||
|
reportStatus(WINSVC.SERVICE_START_PENDING, WINERROR.NO_ERROR, 3000);
|
||||||
reportStatus(WINSVC.SERVICE_START_PENDING, WINERROR.NO_ERROR, 3000);
|
reportStatus(WINSVC.SERVICE_RUNNING, WINERROR.NO_ERROR, 0);
|
||||||
reportStatus(WINSVC.SERVICE_RUNNING, WINERROR.NO_ERROR, 0);
|
|
||||||
|
onStart();
|
||||||
onStart();
|
|
||||||
|
try {
|
||||||
try {
|
synchronized(waitObject) {
|
||||||
synchronized(waitObject) {
|
waitObject.wait();
|
||||||
waitObject.wait();
|
}
|
||||||
}
|
} catch (InterruptedException ex) {
|
||||||
} catch (InterruptedException ex) {
|
}
|
||||||
}
|
reportStatus(WINSVC.SERVICE_STOPPED, WINERROR.NO_ERROR, 0);
|
||||||
reportStatus(WINSVC.SERVICE_STOPPED, WINERROR.NO_ERROR, 0);
|
|
||||||
|
// Avoid returning from ServiceMain, which will cause a crash
|
||||||
// Avoid returning from ServiceMain, which will cause a crash
|
// See http://support.microsoft.com/kb/201349, which recommends
|
||||||
// See http://support.microsoft.com/kb/201349, which recommends
|
// having init() wait for this thread.
|
||||||
// having init() wait for this thread.
|
// Waiting on this thread in init() won't fix the crash, though.
|
||||||
// Waiting on this thread in init() won't fix the crash, though.
|
//System.exit(0);
|
||||||
//System.exit(0);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
* Implementation of the service control function.
|
||||||
* Implementation of the service control function.
|
*/
|
||||||
*/
|
private class ServiceControl implements Advapi32.HandlerEx {
|
||||||
private class ServiceControl implements Advapi32.HandlerEx {
|
|
||||||
|
/**
|
||||||
/**
|
* Called when the service get a control code.
|
||||||
* Called when the service get a control code.
|
*
|
||||||
*
|
* @param dwControl
|
||||||
* @param dwControl
|
* @param dwEventType
|
||||||
* @param dwEventType
|
* @param lpEventData
|
||||||
* @param lpEventData
|
* @param lpContext
|
||||||
* @param lpContext
|
*/
|
||||||
*/
|
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext) {
|
||||||
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext) {
|
switch(dwControl) {
|
||||||
switch(dwControl) {
|
case WINSVC.SERVICE_CONTROL_STOP:
|
||||||
case WINSVC.SERVICE_CONTROL_STOP:
|
case WINSVC.SERVICE_CONTROL_SHUTDOWN:
|
||||||
case WINSVC.SERVICE_CONTROL_SHUTDOWN:
|
reportStatus(WINSVC.SERVICE_STOP_PENDING, WINERROR.NO_ERROR, 5000);
|
||||||
reportStatus(WINSVC.SERVICE_STOP_PENDING, WINERROR.NO_ERROR, 5000);
|
onStop();
|
||||||
onStop();
|
synchronized(waitObject) {
|
||||||
synchronized(waitObject) {
|
waitObject.notifyAll();
|
||||||
waitObject.notifyAll();
|
}
|
||||||
}
|
}
|
||||||
}
|
return WINERROR.NO_ERROR;
|
||||||
return WINERROR.NO_ERROR;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# placeholder
|
||||||
|
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" output="build.eclipse/contrib-test-classes" path="test"/>
|
<classpathentry kind="src" output="build.eclipse/contrib-test-classes" path="test"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/jna"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
|
||||||
<classpathentry kind="lib" path="/jna/dist/jna.jar"/>
|
<classpathentry kind="lib" path="/jnalib/dist/jna.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
<?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>
|
||||||
+67
-59
@@ -1,59 +1,67 @@
|
|||||||
application.args=
|
application.args=
|
||||||
build.classes.dir=${build.dir}/classes
|
build.classes.dir=${build.dir}/classes
|
||||||
build.classes.excludes=**/*.java
|
build.classes.excludes=**/*.java
|
||||||
# This directory is removed when the project is cleaned:
|
# This directory is removed when the project is cleaned:
|
||||||
build.dir=build
|
build.dir=build
|
||||||
build.generated.dir=${build.dir}/generated
|
build.generated.dir=${build.dir}/generated
|
||||||
# Only compile against the classpath explicitly listed here:
|
# Only compile against the classpath explicitly listed here:
|
||||||
build.sysclasspath=ignore
|
build.sysclasspath=ignore
|
||||||
build.test.classes.dir=${build.dir}/test/classes
|
build.test.classes.dir=${build.dir}/test/classes
|
||||||
build.test.results.dir=${build.dir}/test/results
|
build.test.results.dir=${build.dir}/test/results
|
||||||
debug.classpath=\
|
debug.classpath=\
|
||||||
${run.classpath}
|
${run.classpath}
|
||||||
debug.test.classpath=\
|
debug.test.classpath=\
|
||||||
${run.test.classpath}
|
${run.test.classpath}
|
||||||
# This directory is removed when the project is cleaned:
|
# This directory is removed when the project is cleaned:
|
||||||
dist.dir=dist
|
dist.dir=dist
|
||||||
dist.jar=${dist.dir}/platform.jar
|
dist.jar=${dist.dir}/jna-platform.jar
|
||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
file.reference.jna.jar=../../../build/jna.jar
|
file.reference.jna.jar=../../build/jna.jar
|
||||||
libs.junit.classpath=../../../lib/junit.jar
|
file.reference.jna-test.jar=../../build/jna-test.jar
|
||||||
jar.compress=false
|
libs.junit.classpath=../../lib/junit.jar
|
||||||
javac.classpath=\
|
jar.compress=false
|
||||||
${file.reference.jna.jar};
|
javac.classpath=\
|
||||||
# Space-separated list of extra javac options
|
${file.reference.jna.jar}:\
|
||||||
javac.compilerargs=
|
${file.reference.jna.build}/test-classes
|
||||||
javac.deprecation=false
|
# Space-separated list of extra javac options
|
||||||
javac.source=1.5
|
javac.compilerargs=
|
||||||
javac.target=1.5
|
javac.deprecation=false
|
||||||
javac.test.classpath=\
|
javac.source=1.5
|
||||||
${javac.classpath}:\
|
javac.target=1.5
|
||||||
${build.classes.dir}:\
|
javac.test.classpath=\
|
||||||
${libs.junit.classpath}
|
${javac.classpath}:\
|
||||||
javadoc.additionalparam=
|
${file.reference.jna-test.jar}:\
|
||||||
javadoc.author=false
|
${build.classes.dir}:\
|
||||||
javadoc.encoding=
|
${libs.junit.classpath}
|
||||||
javadoc.noindex=false
|
javadoc.additionalparam=
|
||||||
javadoc.nonavbar=false
|
javadoc.author=false
|
||||||
javadoc.notree=false
|
javadoc.encoding=
|
||||||
javadoc.private=false
|
javadoc.noindex=false
|
||||||
javadoc.splitindex=true
|
javadoc.nonavbar=false
|
||||||
javadoc.use=true
|
javadoc.notree=false
|
||||||
javadoc.version=false
|
javadoc.private=false
|
||||||
javadoc.windowtitle=
|
javadoc.splitindex=true
|
||||||
main.class=
|
javadoc.use=true
|
||||||
manifest.file=manifest.mf
|
javadoc.version=false
|
||||||
meta.inf.dir=${src.dir}/META-INF
|
javadoc.windowtitle=
|
||||||
platform.active=default_platform
|
main.class=
|
||||||
run.classpath=\
|
manifest.file=manifest.mf
|
||||||
${javac.classpath}:\
|
meta.inf.dir=${src.dir}/META-INF
|
||||||
${build.classes.dir}
|
platform.active=default_platform
|
||||||
# Space-separated list of JVM arguments used when running the project
|
run.classpath=\
|
||||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
${javac.classpath}:\
|
||||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
${build.classes.dir}
|
||||||
run.jvmargs=
|
# Space-separated list of JVM arguments used when running the project
|
||||||
run.test.classpath=\
|
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||||
${javac.test.classpath}:\
|
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||||
${build.test.classes.dir}
|
run.jvmargs=
|
||||||
src.dir=src
|
run.test.classpath=\
|
||||||
test.src.dir=test
|
${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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+10
-9
@@ -20,6 +20,7 @@ import com.sun.jna.Platform;
|
|||||||
import com.sun.jna.platform.unix.X11;
|
import com.sun.jna.platform.unix.X11;
|
||||||
import com.sun.jna.platform.unix.X11.Display;
|
import com.sun.jna.platform.unix.X11.Display;
|
||||||
import com.sun.jna.platform.win32.User32;
|
import com.sun.jna.platform.win32.User32;
|
||||||
|
import com.sun.jna.platform.win32.WinUser;
|
||||||
|
|
||||||
/** Provide access to the local keyboard state. Note that this is meaningless
|
/** Provide access to the local keyboard state. Note that this is meaningless
|
||||||
* on a headless system and some VNC setups.
|
* on a headless system and some VNC setups.
|
||||||
@@ -71,30 +72,30 @@ public class KeyboardUtils {
|
|||||||
}
|
}
|
||||||
if (code == KeyEvent.VK_SHIFT) {
|
if (code == KeyEvent.VK_SHIFT) {
|
||||||
if ((loc & KeyEvent.KEY_LOCATION_RIGHT) != 0) {
|
if ((loc & KeyEvent.KEY_LOCATION_RIGHT) != 0) {
|
||||||
return User32.VK_RSHIFT;
|
return WinUser.VK_RSHIFT;
|
||||||
}
|
}
|
||||||
if ((loc & KeyEvent.KEY_LOCATION_LEFT) != 0) {
|
if ((loc & KeyEvent.KEY_LOCATION_LEFT) != 0) {
|
||||||
return User32.VK_LSHIFT;
|
return WinUser.VK_LSHIFT;
|
||||||
}
|
}
|
||||||
return User32.VK_SHIFT;
|
return WinUser.VK_SHIFT;
|
||||||
}
|
}
|
||||||
if (code == KeyEvent.VK_CONTROL) {
|
if (code == KeyEvent.VK_CONTROL) {
|
||||||
if ((loc & KeyEvent.KEY_LOCATION_RIGHT) != 0) {
|
if ((loc & KeyEvent.KEY_LOCATION_RIGHT) != 0) {
|
||||||
return User32.VK_RCONTROL;
|
return WinUser.VK_RCONTROL;
|
||||||
}
|
}
|
||||||
if ((loc & KeyEvent.KEY_LOCATION_LEFT) != 0) {
|
if ((loc & KeyEvent.KEY_LOCATION_LEFT) != 0) {
|
||||||
return User32.VK_LCONTROL;
|
return WinUser.VK_LCONTROL;
|
||||||
}
|
}
|
||||||
return User32.VK_CONTROL;
|
return WinUser.VK_CONTROL;
|
||||||
}
|
}
|
||||||
if (code == KeyEvent.VK_ALT) {
|
if (code == KeyEvent.VK_ALT) {
|
||||||
if ((loc & KeyEvent.KEY_LOCATION_RIGHT) != 0) {
|
if ((loc & KeyEvent.KEY_LOCATION_RIGHT) != 0) {
|
||||||
return User32.VK_RMENU;
|
return WinUser.VK_RMENU;
|
||||||
}
|
}
|
||||||
if ((loc & KeyEvent.KEY_LOCATION_LEFT) != 0) {
|
if ((loc & KeyEvent.KEY_LOCATION_LEFT) != 0) {
|
||||||
return User32.VK_LMENU;
|
return WinUser.VK_LMENU;
|
||||||
}
|
}
|
||||||
return User32.VK_MENU;
|
return WinUser.VK_MENU;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
+17
-17
@@ -44,7 +44,7 @@ public class RasterRangesUtils {
|
|||||||
0x0008, 0x0004, 0x0002, 0x0001
|
0x0008, 0x0004, 0x0002, 0x0001
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Comparator COMPARATOR = new Comparator() {
|
private static final Comparator<Object> COMPARATOR = new Comparator<Object>() {
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
return ((Rectangle)o1).x - ((Rectangle)o2).x;
|
return ((Rectangle)o1).x - ((Rectangle)o2).x;
|
||||||
}
|
}
|
||||||
@@ -116,11 +116,11 @@ public class RasterRangesUtils {
|
|||||||
* @return true if the output succeeded, false otherwise
|
* @return true if the output succeeded, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean outputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int w, int h, RangesOutput out) {
|
public static boolean outputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int w, int h, RangesOutput out) {
|
||||||
Set rects = new HashSet();
|
Set<Rectangle> rects = new HashSet<Rectangle>();
|
||||||
Set prevLine = Collections.EMPTY_SET;
|
Set<Rectangle> prevLine = Collections.EMPTY_SET;
|
||||||
int scanlineBytes = binaryBits.length / h;
|
int scanlineBytes = binaryBits.length / h;
|
||||||
for (int row = 0; row < h; row++) {
|
for (int row = 0; row < h; row++) {
|
||||||
Set curLine = new TreeSet(COMPARATOR);
|
Set<Rectangle> curLine = new TreeSet<Rectangle>(COMPARATOR);
|
||||||
int rowOffsetBytes = row * scanlineBytes;
|
int rowOffsetBytes = row * scanlineBytes;
|
||||||
int startCol = -1;
|
int startCol = -1;
|
||||||
// Look at each batch of 8 columns in this row
|
// Look at each batch of 8 columns in this row
|
||||||
@@ -163,14 +163,14 @@ public class RasterRangesUtils {
|
|||||||
// end of last region
|
// end of last region
|
||||||
curLine.add(new Rectangle(startCol, row, w - startCol, 1));
|
curLine.add(new Rectangle(startCol, row, w - startCol, 1));
|
||||||
}
|
}
|
||||||
Set unmerged = mergeRects(prevLine, curLine);
|
Set<Rectangle> unmerged = mergeRects(prevLine, curLine);
|
||||||
rects.addAll(unmerged);
|
rects.addAll(unmerged);
|
||||||
prevLine = curLine;
|
prevLine = curLine;
|
||||||
}
|
}
|
||||||
// Add anything left over
|
// Add anything left over
|
||||||
rects.addAll(prevLine);
|
rects.addAll(prevLine);
|
||||||
for (Iterator i=rects.iterator();i.hasNext();) {
|
for (Iterator<Rectangle> i=rects.iterator();i.hasNext();) {
|
||||||
Rectangle r = (Rectangle)i.next();
|
Rectangle r = i.next();
|
||||||
if (!out.outputRange(r.x, r.y, r.width, r.height)) {
|
if (!out.outputRange(r.x, r.y, r.width, r.height)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -189,10 +189,10 @@ public class RasterRangesUtils {
|
|||||||
* @return true if the output succeeded, false otherwise
|
* @return true if the output succeeded, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean outputOccupiedRanges(int[] pixels, int w, int h, int occupationMask, RangesOutput out) {
|
public static boolean outputOccupiedRanges(int[] pixels, int w, int h, int occupationMask, RangesOutput out) {
|
||||||
Set rects = new HashSet();
|
Set<Rectangle> rects = new HashSet<Rectangle>();
|
||||||
Set prevLine = Collections.EMPTY_SET;
|
Set<Rectangle> prevLine = Collections.EMPTY_SET;
|
||||||
for (int row = 0; row < h; row++) {
|
for (int row = 0; row < h; row++) {
|
||||||
Set curLine = new TreeSet(COMPARATOR);
|
Set<Rectangle> curLine = new TreeSet<Rectangle>(COMPARATOR);
|
||||||
int idxOffset = row * w;
|
int idxOffset = row * w;
|
||||||
int startCol = -1;
|
int startCol = -1;
|
||||||
|
|
||||||
@@ -213,14 +213,14 @@ public class RasterRangesUtils {
|
|||||||
// end of last region of current row
|
// end of last region of current row
|
||||||
curLine.add(new Rectangle(startCol, row, w-startCol, 1));
|
curLine.add(new Rectangle(startCol, row, w-startCol, 1));
|
||||||
}
|
}
|
||||||
Set unmerged = mergeRects(prevLine, curLine);
|
Set<Rectangle> unmerged = mergeRects(prevLine, curLine);
|
||||||
rects.addAll(unmerged);
|
rects.addAll(unmerged);
|
||||||
prevLine = curLine;
|
prevLine = curLine;
|
||||||
}
|
}
|
||||||
// Add anything left over
|
// Add anything left over
|
||||||
rects.addAll(prevLine);
|
rects.addAll(prevLine);
|
||||||
for (Iterator i=rects.iterator();i.hasNext();) {
|
for (Iterator<Rectangle> i=rects.iterator();i.hasNext();) {
|
||||||
Rectangle r = (Rectangle)i.next();
|
Rectangle r = i.next();
|
||||||
if (!out.outputRange(r.x, r.y, r.width, r.height)) {
|
if (!out.outputRange(r.x, r.y, r.width, r.height)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -228,11 +228,11 @@ public class RasterRangesUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set mergeRects(Set prev, Set current) {
|
private static Set<Rectangle> mergeRects(Set<Rectangle> prev, Set<Rectangle> current) {
|
||||||
Set unmerged = new HashSet(prev);
|
Set<Rectangle> unmerged = new HashSet<Rectangle>(prev);
|
||||||
if (!prev.isEmpty() && !current.isEmpty()) {
|
if (!prev.isEmpty() && !current.isEmpty()) {
|
||||||
Rectangle[] pr = (Rectangle[])prev.toArray(new Rectangle[prev.size()]);
|
Rectangle[] pr = prev.toArray(new Rectangle[prev.size()]);
|
||||||
Rectangle[] cr = (Rectangle[])current.toArray(new Rectangle[current.size()]);
|
Rectangle[] cr = current.toArray(new Rectangle[current.size()]);
|
||||||
int ipr = 0;
|
int ipr = 0;
|
||||||
int icr = 0;
|
int icr = 0;
|
||||||
while (ipr < pr.length && icr < cr.length) {
|
while (ipr < pr.length && icr < cr.length) {
|
||||||
+52
-45
@@ -71,15 +71,17 @@ import com.sun.jna.platform.unix.X11.Xext;
|
|||||||
import com.sun.jna.platform.unix.X11.Xrender.XRenderPictFormat;
|
import com.sun.jna.platform.unix.X11.Xrender.XRenderPictFormat;
|
||||||
import com.sun.jna.platform.win32.GDI32;
|
import com.sun.jna.platform.win32.GDI32;
|
||||||
import com.sun.jna.platform.win32.User32;
|
import com.sun.jna.platform.win32.User32;
|
||||||
import com.sun.jna.platform.win32.GDI32.BITMAPINFO;
|
import com.sun.jna.platform.win32.WinDef.HBITMAP;
|
||||||
import com.sun.jna.platform.win32.User32.BLENDFUNCTION;
|
import com.sun.jna.platform.win32.WinDef.HDC;
|
||||||
import com.sun.jna.platform.win32.User32.POINT;
|
import com.sun.jna.platform.win32.WinDef.HRGN;
|
||||||
import com.sun.jna.platform.win32.User32.SIZE;
|
import com.sun.jna.platform.win32.WinDef.HWND;
|
||||||
import com.sun.jna.platform.win32.W32API.HANDLE;
|
import com.sun.jna.platform.win32.WinGDI;
|
||||||
import com.sun.jna.platform.win32.W32API.HBITMAP;
|
import com.sun.jna.platform.win32.WinGDI.BITMAPINFO;
|
||||||
import com.sun.jna.platform.win32.W32API.HDC;
|
import com.sun.jna.platform.win32.WinNT.HANDLE;
|
||||||
import com.sun.jna.platform.win32.W32API.HRGN;
|
import com.sun.jna.platform.win32.WinUser;
|
||||||
import com.sun.jna.platform.win32.W32API.HWND;
|
import com.sun.jna.platform.win32.WinUser.BLENDFUNCTION;
|
||||||
|
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.ByteByReference;
|
||||||
import com.sun.jna.ptr.IntByReference;
|
import com.sun.jna.ptr.IntByReference;
|
||||||
import com.sun.jna.ptr.PointerByReference;
|
import com.sun.jna.ptr.PointerByReference;
|
||||||
@@ -149,6 +151,7 @@ public class WindowUtils {
|
|||||||
* </pre></code>
|
* </pre></code>
|
||||||
*/
|
*/
|
||||||
private static class HeavyweightForcer extends Window {
|
private static class HeavyweightForcer extends Window {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private final boolean packed;
|
private final boolean packed;
|
||||||
|
|
||||||
public HeavyweightForcer(Window parent) {
|
public HeavyweightForcer(Window parent) {
|
||||||
@@ -174,6 +177,7 @@ public class WindowUtils {
|
|||||||
* invoked whenever any part of the ancestor window is repainted.
|
* invoked whenever any part of the ancestor window is repainted.
|
||||||
*/
|
*/
|
||||||
protected static class RepaintTrigger extends JComponent {
|
protected static class RepaintTrigger extends JComponent {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected class Listener
|
protected class Listener
|
||||||
extends WindowAdapter
|
extends WindowAdapter
|
||||||
@@ -264,6 +268,7 @@ public class WindowUtils {
|
|||||||
public static abstract class NativeWindowUtils {
|
public static abstract class NativeWindowUtils {
|
||||||
protected abstract class TransparentContentPane
|
protected abstract class TransparentContentPane
|
||||||
extends JPanel implements AWTEventListener {
|
extends JPanel implements AWTEventListener {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private boolean transparent;
|
private boolean transparent;
|
||||||
public TransparentContentPane(Container oldContent) {
|
public TransparentContentPane(Container oldContent) {
|
||||||
super(new BorderLayout());
|
super(new BorderLayout());
|
||||||
@@ -639,27 +644,27 @@ public class WindowUtils {
|
|||||||
public void run() {
|
public void run() {
|
||||||
HWND hWnd = getHWnd(w);
|
HWND hWnd = getHWnd(w);
|
||||||
User32 user = User32.INSTANCE;
|
User32 user = User32.INSTANCE;
|
||||||
int flags = user.GetWindowLong(hWnd, User32.GWL_EXSTYLE);
|
int flags = user.GetWindowLong(hWnd, WinUser.GWL_EXSTYLE);
|
||||||
byte level = (byte)((int)(255 * alpha) & 0xFF);
|
byte level = (byte)((int)(255 * alpha) & 0xFF);
|
||||||
if (usingUpdateLayeredWindow(w)) {
|
if (usingUpdateLayeredWindow(w)) {
|
||||||
// If already using UpdateLayeredWindow, continue to
|
// If already using UpdateLayeredWindow, continue to
|
||||||
// do so
|
// do so
|
||||||
User32.BLENDFUNCTION blend = new User32.BLENDFUNCTION();
|
BLENDFUNCTION blend = new BLENDFUNCTION();
|
||||||
blend.SourceConstantAlpha = level;
|
blend.SourceConstantAlpha = level;
|
||||||
blend.AlphaFormat = User32.AC_SRC_ALPHA;
|
blend.AlphaFormat = WinUser.AC_SRC_ALPHA;
|
||||||
user.UpdateLayeredWindow(hWnd, null, null, null, null,
|
user.UpdateLayeredWindow(hWnd, null, null, null, null,
|
||||||
null, 0, blend,
|
null, 0, blend,
|
||||||
User32.ULW_ALPHA);
|
WinUser.ULW_ALPHA);
|
||||||
}
|
}
|
||||||
else if (alpha == 1f) {
|
else if (alpha == 1f) {
|
||||||
flags &= ~User32.WS_EX_LAYERED;
|
flags &= ~WinUser.WS_EX_LAYERED;
|
||||||
user.SetWindowLong(hWnd, User32.GWL_EXSTYLE, flags);
|
user.SetWindowLong(hWnd, WinUser.GWL_EXSTYLE, flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
flags |= User32.WS_EX_LAYERED;
|
flags |= WinUser.WS_EX_LAYERED;
|
||||||
user.SetWindowLong(hWnd, User32.GWL_EXSTYLE, flags);
|
user.SetWindowLong(hWnd, WinUser.GWL_EXSTYLE, flags);
|
||||||
user.SetLayeredWindowAttributes(hWnd, 0, level,
|
user.SetLayeredWindowAttributes(hWnd, 0, level,
|
||||||
User32.LWA_ALPHA);
|
WinUser.LWA_ALPHA);
|
||||||
}
|
}
|
||||||
setForceHeavyweightPopups(w, alpha != 1f);
|
setForceHeavyweightPopups(w, alpha != 1f);
|
||||||
storeAlpha(w, level);
|
storeAlpha(w, level);
|
||||||
@@ -672,6 +677,7 @@ public class WindowUtils {
|
|||||||
* when the window is transparent.
|
* when the window is transparent.
|
||||||
*/
|
*/
|
||||||
private class W32TransparentContentPane extends TransparentContentPane {
|
private class W32TransparentContentPane extends TransparentContentPane {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private HDC memDC;
|
private HDC memDC;
|
||||||
private HBITMAP hBitmap;
|
private HBITMAP hBitmap;
|
||||||
private Pointer pbits;
|
private Pointer pbits;
|
||||||
@@ -728,12 +734,12 @@ public class WindowUtils {
|
|||||||
bmi.bmiHeader.biHeight = wh;
|
bmi.bmiHeader.biHeight = wh;
|
||||||
bmi.bmiHeader.biPlanes = 1;
|
bmi.bmiHeader.biPlanes = 1;
|
||||||
bmi.bmiHeader.biBitCount = 32;
|
bmi.bmiHeader.biBitCount = 32;
|
||||||
bmi.bmiHeader.biCompression = GDI32.BI_RGB;
|
bmi.bmiHeader.biCompression = WinGDI.BI_RGB;
|
||||||
bmi.bmiHeader.biSizeImage = ww * wh * 4;
|
bmi.bmiHeader.biSizeImage = ww * wh * 4;
|
||||||
PointerByReference ppbits = new PointerByReference();
|
PointerByReference ppbits = new PointerByReference();
|
||||||
hBitmap = gdi.CreateDIBSection(memDC, bmi,
|
hBitmap = gdi.CreateDIBSection(memDC, bmi,
|
||||||
GDI32.DIB_RGB_COLORS,
|
WinGDI.DIB_RGB_COLORS,
|
||||||
ppbits, null, 0);
|
ppbits, null, 0);
|
||||||
pbits = ppbits.getValue();
|
pbits = ppbits.getValue();
|
||||||
bitmapSize = new Dimension(ww, wh);
|
bitmapSize = new Dimension(ww, wh);
|
||||||
}
|
}
|
||||||
@@ -769,18 +775,17 @@ public class WindowUtils {
|
|||||||
try {
|
try {
|
||||||
// GetLayeredwindowAttributes supported WinXP and later
|
// GetLayeredwindowAttributes supported WinXP and later
|
||||||
if (user.GetLayeredWindowAttributes(hWnd, null, bref, iref)
|
if (user.GetLayeredWindowAttributes(hWnd, null, bref, iref)
|
||||||
&& (iref.getValue() & User32.LWA_ALPHA) != 0) {
|
&& (iref.getValue() & WinUser.LWA_ALPHA) != 0) {
|
||||||
level = bref.getValue();
|
level = bref.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(UnsatisfiedLinkError e) {
|
catch(UnsatisfiedLinkError e) {
|
||||||
}
|
}
|
||||||
blend.SourceConstantAlpha = level;
|
blend.SourceConstantAlpha = level;
|
||||||
blend.AlphaFormat = User32.AC_SRC_ALPHA;
|
blend.AlphaFormat = WinUser.AC_SRC_ALPHA;
|
||||||
user.UpdateLayeredWindow(hWnd, screenDC, winLoc, winSize, memDC,
|
user.UpdateLayeredWindow(hWnd, screenDC, winLoc, winSize, memDC,
|
||||||
srcLoc, 0, blend, User32.ULW_ALPHA);
|
srcLoc, 0, blend, WinUser.ULW_ALPHA);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
user.ReleaseDC(null, screenDC);
|
user.ReleaseDC(null, screenDC);
|
||||||
if (memDC != null && oldBitmap != null) {
|
if (memDC != null && oldBitmap != null) {
|
||||||
gdi.SelectObject(memDC, oldBitmap);
|
gdi.SelectObject(memDC, oldBitmap);
|
||||||
@@ -808,7 +813,7 @@ public class WindowUtils {
|
|||||||
public void run() {
|
public void run() {
|
||||||
User32 user = User32.INSTANCE;
|
User32 user = User32.INSTANCE;
|
||||||
HWND hWnd = getHWnd(w);
|
HWND hWnd = getHWnd(w);
|
||||||
int flags = user.GetWindowLong(hWnd, User32.GWL_EXSTYLE);
|
int flags = user.GetWindowLong(hWnd, WinUser.GWL_EXSTYLE);
|
||||||
JRootPane root = ((RootPaneContainer)w).getRootPane();
|
JRootPane root = ((RootPaneContainer)w).getRootPane();
|
||||||
JLayeredPane lp = root.getLayeredPane();
|
JLayeredPane lp = root.getLayeredPane();
|
||||||
Container content = root.getContentPane();
|
Container content = root.getContentPane();
|
||||||
@@ -823,12 +828,12 @@ public class WindowUtils {
|
|||||||
JLayeredPane.DRAG_LAYER);
|
JLayeredPane.DRAG_LAYER);
|
||||||
}
|
}
|
||||||
if (transparent && !usingUpdateLayeredWindow(w)) {
|
if (transparent && !usingUpdateLayeredWindow(w)) {
|
||||||
flags |= User32.WS_EX_LAYERED;
|
flags |= WinUser.WS_EX_LAYERED;
|
||||||
user.SetWindowLong(hWnd, User32.GWL_EXSTYLE, flags);
|
user.SetWindowLong(hWnd, WinUser.GWL_EXSTYLE, flags);
|
||||||
}
|
}
|
||||||
else if (!transparent && usingUpdateLayeredWindow(w)) {
|
else if (!transparent && usingUpdateLayeredWindow(w)) {
|
||||||
flags &= ~User32.WS_EX_LAYERED;
|
flags &= ~WinUser.WS_EX_LAYERED;
|
||||||
user.SetWindowLong(hWnd, User32.GWL_EXSTYLE, flags);
|
user.SetWindowLong(hWnd, WinUser.GWL_EXSTYLE, flags);
|
||||||
}
|
}
|
||||||
setLayersTransparent(w, transparent);
|
setLayersTransparent(w, transparent);
|
||||||
setForceHeavyweightPopups(w, transparent);
|
setForceHeavyweightPopups(w, transparent);
|
||||||
@@ -869,11 +874,11 @@ public class WindowUtils {
|
|||||||
GDI32 gdi = GDI32.INSTANCE;
|
GDI32 gdi = GDI32.INSTANCE;
|
||||||
PathIterator pi = area.getPathIterator(null);
|
PathIterator pi = area.getPathIterator(null);
|
||||||
int mode = pi.getWindingRule() == PathIterator.WIND_NON_ZERO
|
int mode = pi.getWindingRule() == PathIterator.WIND_NON_ZERO
|
||||||
? GDI32.WINDING: GDI32.ALTERNATE;
|
? WinGDI.WINDING: WinGDI.ALTERNATE;
|
||||||
float[] coords = new float[6];
|
float[] coords = new float[6];
|
||||||
List points = new ArrayList();
|
List<POINT> points = new ArrayList<POINT>();
|
||||||
int size = 0;
|
int size = 0;
|
||||||
List sizes = new ArrayList();
|
List<Integer> sizes = new ArrayList<Integer>();
|
||||||
while (!pi.isDone()) {
|
while (!pi.isDone()) {
|
||||||
int type = pi.currentSegment(coords);
|
int type = pi.currentSegment(coords);
|
||||||
if (type == PathIterator.SEG_MOVETO) {
|
if (type == PathIterator.SEG_MOVETO) {
|
||||||
@@ -893,14 +898,14 @@ public class WindowUtils {
|
|||||||
pi.next();
|
pi.next();
|
||||||
}
|
}
|
||||||
POINT[] lppt = (POINT[])new POINT().toArray(points.size());
|
POINT[] lppt = (POINT[])new POINT().toArray(points.size());
|
||||||
POINT[] pts = (POINT[])points.toArray(new POINT[points.size()]);
|
POINT[] pts = points.toArray(new POINT[points.size()]);
|
||||||
for (int i=0;i < lppt.length;i++) {
|
for (int i=0;i < lppt.length;i++) {
|
||||||
lppt[i].x = pts[i].x;
|
lppt[i].x = pts[i].x;
|
||||||
lppt[i].y = pts[i].y;
|
lppt[i].y = pts[i].y;
|
||||||
}
|
}
|
||||||
int[] counts = new int[sizes.size()];
|
int[] counts = new int[sizes.size()];
|
||||||
for (int i=0;i < counts.length;i++) {
|
for (int i=0;i < counts.length;i++) {
|
||||||
counts[i] = ((Integer)sizes.get(i)).intValue();
|
counts[i] = sizes.get(i).intValue();
|
||||||
}
|
}
|
||||||
HRGN hrgn = gdi.CreatePolyPolygonRgn(lppt, counts, counts.length, mode);
|
HRGN hrgn = gdi.CreatePolyPolygonRgn(lppt, counts, counts.length, mode);
|
||||||
setWindowRegion(w, hrgn);
|
setWindowRegion(w, hrgn);
|
||||||
@@ -917,7 +922,7 @@ public class WindowUtils {
|
|||||||
public boolean outputRange(int x, int y, int w, int h) {
|
public boolean outputRange(int x, int y, int w, int h) {
|
||||||
GDI32 gdi = GDI32.INSTANCE;
|
GDI32 gdi = GDI32.INSTANCE;
|
||||||
gdi.SetRectRgn(tempRgn, x, y, x + w, y + h);
|
gdi.SetRectRgn(tempRgn, x, y, x + w, y + h);
|
||||||
return gdi.CombineRgn(region, region, tempRgn, GDI32.RGN_OR) != GDI32.ERROR;
|
return gdi.CombineRgn(region, region, tempRgn, WinGDI.RGN_OR) != WinGDI.ERROR;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1008,7 +1013,7 @@ public class WindowUtils {
|
|||||||
fixWindowDragging(w, "setWindowAlpha");
|
fixWindowDragging(w, "setWindowAlpha");
|
||||||
}
|
}
|
||||||
whenDisplayable(w, new Runnable() {
|
whenDisplayable(w, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
Object peer = w.getPeer();
|
Object peer = w.getPeer();
|
||||||
try {
|
try {
|
||||||
peer.getClass().getMethod("setAlpha", new Class[]{
|
peer.getClass().getMethod("setAlpha", new Class[]{
|
||||||
@@ -1049,6 +1054,7 @@ public class WindowUtils {
|
|||||||
* @author Olivier Chafik
|
* @author Olivier Chafik
|
||||||
*/
|
*/
|
||||||
private static class OSXMaskingContentPane extends JPanel {
|
private static class OSXMaskingContentPane extends JPanel {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private Shape shape;
|
private Shape shape;
|
||||||
|
|
||||||
public OSXMaskingContentPane(Component oldContent) {
|
public OSXMaskingContentPane(Component oldContent) {
|
||||||
@@ -1123,7 +1129,7 @@ public class WindowUtils {
|
|||||||
}
|
}
|
||||||
x11.XSetForeground(dpy, gc, new NativeLong(0));
|
x11.XSetForeground(dpy, gc, new NativeLong(0));
|
||||||
x11.XFillRectangle(dpy, pm, gc, 0, 0, width, height);
|
x11.XFillRectangle(dpy, pm, gc, 0, 0, width, height);
|
||||||
final List rlist = new ArrayList();
|
final List<Rectangle> rlist = new ArrayList<Rectangle>();
|
||||||
try {
|
try {
|
||||||
RasterRangesUtils.outputOccupiedRanges(raster, new RasterRangesUtils.RangesOutput() {
|
RasterRangesUtils.outputOccupiedRanges(raster, new RasterRangesUtils.RangesOutput() {
|
||||||
public boolean outputRange(int x, int y, int w, int h) {
|
public boolean outputRange(int x, int y, int w, int h) {
|
||||||
@@ -1134,7 +1140,7 @@ public class WindowUtils {
|
|||||||
X11.XRectangle[] rects = (X11.XRectangle[])
|
X11.XRectangle[] rects = (X11.XRectangle[])
|
||||||
new X11.XRectangle().toArray(rlist.size());
|
new X11.XRectangle().toArray(rlist.size());
|
||||||
for (int i=0;i < rects.length;i++) {
|
for (int i=0;i < rects.length;i++) {
|
||||||
Rectangle r = (Rectangle)rlist.get(i);
|
Rectangle r = rlist.get(i);
|
||||||
rects[i].x = (short)r.x;
|
rects[i].x = (short)r.x;
|
||||||
rects[i].y = (short)r.y;
|
rects[i].y = (short)r.y;
|
||||||
rects[i].width = (short)r.width;
|
rects[i].width = (short)r.width;
|
||||||
@@ -1229,7 +1235,7 @@ public class WindowUtils {
|
|||||||
IntByReference pcount = new IntByReference();
|
IntByReference pcount = new IntByReference();
|
||||||
info = x11.XGetVisualInfo(dpy, mask, template, pcount);
|
info = x11.XGetVisualInfo(dpy, mask, template, pcount);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
List list = new ArrayList();
|
List<X11.VisualID> list = new ArrayList<X11.VisualID>();
|
||||||
XVisualInfo[] infos =
|
XVisualInfo[] infos =
|
||||||
(XVisualInfo[])info.toArray(pcount.getValue());
|
(XVisualInfo[])info.toArray(pcount.getValue());
|
||||||
for (int i = 0; i < infos.length; i++) {
|
for (int i = 0; i < infos.length; i++) {
|
||||||
@@ -1269,9 +1275,9 @@ public class WindowUtils {
|
|||||||
x11.XQueryTree(dpy, win, rootp, parentp, childrenp, countp);
|
x11.XQueryTree(dpy, win, rootp, parentp, childrenp, countp);
|
||||||
Pointer p = childrenp.getValue();
|
Pointer p = childrenp.getValue();
|
||||||
int[] ids = p.getIntArray(0, countp.getValue());
|
int[] ids = p.getIntArray(0, countp.getValue());
|
||||||
for (int i=0;i < ids.length;i++) {
|
for (int id : ids) {
|
||||||
// TODO: more verification of correct window?
|
// TODO: more verification of correct window?
|
||||||
X11.Window child = new X11.Window(ids[i]);
|
X11.Window child = new X11.Window(id);
|
||||||
X11.XWindowAttributes xwa = new X11.XWindowAttributes();
|
X11.XWindowAttributes xwa = new X11.XWindowAttributes();
|
||||||
x11.XGetWindowAttributes(dpy, child, xwa);
|
x11.XGetWindowAttributes(dpy, child, xwa);
|
||||||
offset.x = -xwa.x;
|
offset.x = -xwa.x;
|
||||||
@@ -1333,6 +1339,7 @@ public class WindowUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class X11TransparentContentPane extends TransparentContentPane {
|
private class X11TransparentContentPane extends TransparentContentPane {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public X11TransparentContentPane(Container oldContent) {
|
public X11TransparentContentPane(Container oldContent) {
|
||||||
super(oldContent);
|
super(oldContent);
|
||||||
@@ -1344,7 +1351,7 @@ public class WindowUtils {
|
|||||||
// Painting directly to the original Graphics
|
// Painting directly to the original Graphics
|
||||||
// fails to properly composite unless the destination
|
// fails to properly composite unless the destination
|
||||||
// is pure black. Too bad.
|
// is pure black. Too bad.
|
||||||
protected void paintDirect(BufferedImage buf, Rectangle bounds) {
|
protected void paintDirect(BufferedImage buf, Rectangle bounds) {
|
||||||
Window window = SwingUtilities.getWindowAncestor(this);
|
Window window = SwingUtilities.getWindowAncestor(this);
|
||||||
X11 x11 = X11.INSTANCE;
|
X11 x11 = X11.INSTANCE;
|
||||||
X11.Display dpy = x11.XOpenDisplay(null);
|
X11.Display dpy = x11.XOpenDisplay(null);
|
||||||
@@ -1356,7 +1363,7 @@ public class WindowUtils {
|
|||||||
Raster raster = buf.getData();
|
Raster raster = buf.getData();
|
||||||
int w = bounds.width;
|
int w = bounds.width;
|
||||||
int h = bounds.height;
|
int h = bounds.height;
|
||||||
if (buffer == null || buffer.getSize() != w*h*4) {
|
if (buffer == null || buffer.size() != w*h*4) {
|
||||||
buffer = new Memory(w*h*4);
|
buffer = new Memory(w*h*4);
|
||||||
pixels = new int[w*h];
|
pixels = new int[w*h];
|
||||||
}
|
}
|
||||||
+2
-2
@@ -180,7 +180,7 @@ public abstract class DragHandler
|
|||||||
private Component dragSource;
|
private Component dragSource;
|
||||||
private GhostedDragImage ghost;
|
private GhostedDragImage ghost;
|
||||||
private Point imageOffset;
|
private Point imageOffset;
|
||||||
private Dimension maxGhostSize = MAX_GHOST_SIZE;
|
private Dimension maxGhostSize = MAX_GHOST_SIZE;
|
||||||
private float ghostAlpha = DEFAULT_GHOST_ALPHA;
|
private float ghostAlpha = DEFAULT_GHOST_ALPHA;
|
||||||
|
|
||||||
/** Enable drags from the given component, supporting the actions in
|
/** Enable drags from the given component, supporting the actions in
|
||||||
@@ -530,4 +530,4 @@ public abstract class DragHandler
|
|||||||
}
|
}
|
||||||
updateCursor(e);
|
updateCursor(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -88,7 +88,7 @@ import java.util.Set;
|
|||||||
public abstract class DropHandler implements DropTargetListener {
|
public abstract class DropHandler implements DropTargetListener {
|
||||||
|
|
||||||
private int acceptedActions;
|
private int acceptedActions;
|
||||||
private List acceptedFlavors;
|
private List<DataFlavor> acceptedFlavors;
|
||||||
private DropTarget dropTarget;
|
private DropTarget dropTarget;
|
||||||
private boolean active = true;
|
private boolean active = true;
|
||||||
private DropTargetPainter painter;
|
private DropTargetPainter painter;
|
||||||
@@ -347,7 +347,7 @@ public abstract class DropHandler implements DropTargetListener {
|
|||||||
* constructor.
|
* constructor.
|
||||||
*/
|
*/
|
||||||
protected boolean isSupported(DataFlavor[] flavors) {
|
protected boolean isSupported(DataFlavor[] flavors) {
|
||||||
Set set = new HashSet(Arrays.asList(flavors));
|
Set<DataFlavor> set = new HashSet<DataFlavor>(Arrays.asList(flavors));
|
||||||
set.retainAll(acceptedFlavors);
|
set.retainAll(acceptedFlavors);
|
||||||
return !set.isEmpty();
|
return !set.isEmpty();
|
||||||
}
|
}
|
||||||
+1
@@ -56,6 +56,7 @@ public class GhostedDragImage {
|
|||||||
// FIXME ensure gc is compatible (X11)
|
// FIXME ensure gc is compatible (X11)
|
||||||
GraphicsConfiguration gc = parent.getGraphicsConfiguration();
|
GraphicsConfiguration gc = parent.getGraphicsConfiguration();
|
||||||
dragImage = new Window(JOptionPane.getRootFrame(), gc) {
|
dragImage = new Window(JOptionPane.getRootFrame(), gc) {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
icon.paintIcon(this, g, 0, 0);
|
icon.paintIcon(this, g, 0, 0);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2010 Timothy Wall
|
||||||
|
-->
|
||||||
|
</head>
|
||||||
|
<body bgcolor="white">
|
||||||
|
|
||||||
|
<!-- One sentence summary -->
|
||||||
|
Provides integrated, extended drag and drop functionality,
|
||||||
|
allowing ghosted drag images to be used on all platforms.
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Denis Tulskiy
|
||||||
|
*
|
||||||
|
* This program 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* version 3 along with this work. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Denis Tulskiy
|
||||||
|
* Date: 7/25/11
|
||||||
|
*/
|
||||||
|
public interface Carbon extends Library {
|
||||||
|
public static Carbon INSTANCE = (Carbon) Native.loadLibrary("Carbon", Carbon.class);
|
||||||
|
|
||||||
|
public static final int cmdKey = 0x0100;
|
||||||
|
public static final int shiftKey = 0x0200;
|
||||||
|
public static final int optionKey = 0x0800;
|
||||||
|
public static final int controlKey = 0x1000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtains the event target reference for the standard toolbox dispatcher
|
||||||
|
*/
|
||||||
|
public Pointer GetEventDispatcherTarget();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs an event handler on a specified event target.
|
||||||
|
*/
|
||||||
|
public int InstallEventHandler(Pointer inTarget, EventHandlerProcPtr inHandler, int inNumTypes, EventTypeSpec[] inList, Pointer inUserData, PointerByReference outRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a global hot key.
|
||||||
|
*/
|
||||||
|
public int RegisterEventHotKey(int inHotKeyCode, int inHotKeyModifiers, EventHotKeyID.ByValue inHotKeyID, Pointer inTarget, int inOptions, PointerByReference outRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtains a parameter from the specified event.
|
||||||
|
*/
|
||||||
|
public int GetEventParameter(Pointer inEvent, int inName, int inDesiredType, Pointer outActualType, int inBufferSize, IntBuffer outActualSize, EventHotKeyID outData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified event handler
|
||||||
|
*/
|
||||||
|
public int RemoveEventHandler(Pointer inHandlerRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters a global hot key.
|
||||||
|
*/
|
||||||
|
public int UnregisterEventHotKey(Pointer inHotKey);
|
||||||
|
|
||||||
|
public class EventTypeSpec extends Structure {
|
||||||
|
public int eventClass;
|
||||||
|
public int eventKind;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "eventClass", "eventKind" }); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class EventHotKeyID extends Structure {
|
||||||
|
public int signature;
|
||||||
|
public int id;
|
||||||
|
|
||||||
|
public static class ByValue extends EventHotKeyID implements Structure.ByValue { }
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "signature", "id" }); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface EventHandlerProcPtr extends Callback {
|
||||||
|
public int callback(Pointer inHandlerCallRef, Pointer inEvent, Pointer inUserData);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2010 Timothy Wall
|
||||||
|
-->
|
||||||
|
</head>
|
||||||
|
<body bgcolor="white">
|
||||||
|
|
||||||
|
<!-- One sentence summary -->
|
||||||
|
Provides common library mappings for the OS X platform.
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2010 Timothy Wall
|
||||||
|
-->
|
||||||
|
</head>
|
||||||
|
<body bgcolor="white">
|
||||||
|
|
||||||
|
<!-- One sentence summary -->
|
||||||
|
Provides cross-platform utilities based on platform-specific libraries.
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+209
-12
@@ -12,6 +12,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.sun.jna.platform.unix;
|
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.FromNativeContext;
|
||||||
import com.sun.jna.Library;
|
import com.sun.jna.Library;
|
||||||
import com.sun.jna.Native;
|
import com.sun.jna.Native;
|
||||||
@@ -29,12 +33,14 @@ import com.sun.jna.ptr.PointerByReference;
|
|||||||
public interface X11 extends Library {
|
public interface X11 extends Library {
|
||||||
|
|
||||||
class VisualID extends NativeLong {
|
class VisualID extends NativeLong {
|
||||||
public VisualID() { }
|
private static final long serialVersionUID = 1L;
|
||||||
|
public VisualID() { }
|
||||||
public VisualID(long value) { super(value); }
|
public VisualID(long value) { super(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class XID extends NativeLong {
|
class XID extends NativeLong {
|
||||||
public static final XID None = null;
|
private static final long serialVersionUID = 1L;
|
||||||
|
public static final XID None = null;
|
||||||
public XID() { this(0); }
|
public XID() { this(0); }
|
||||||
public XID(long id) { super(id); }
|
public XID(long id) { super(id); }
|
||||||
protected boolean isNone(Object o) {
|
protected boolean isNone(Object o) {
|
||||||
@@ -52,6 +58,7 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Atom extends XID {
|
class Atom extends XID {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public static final Atom None = null;
|
public static final Atom None = null;
|
||||||
public Atom() { }
|
public Atom() { }
|
||||||
public Atom(long id) { super(id); }
|
public Atom(long id) { super(id); }
|
||||||
@@ -143,6 +150,7 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Colormap extends XID {
|
class Colormap extends XID {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public static final Colormap None = null;
|
public static final Colormap None = null;
|
||||||
public Colormap() { }
|
public Colormap() { }
|
||||||
public Colormap(long id) { super(id); }
|
public Colormap(long id) { super(id); }
|
||||||
@@ -153,6 +161,7 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Font extends XID {
|
class Font extends XID {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public static final Font None = null;
|
public static final Font None = null;
|
||||||
public Font() { }
|
public Font() { }
|
||||||
public Font(long id) { super(id); }
|
public Font(long id) { super(id); }
|
||||||
@@ -163,6 +172,7 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Cursor extends XID {
|
class Cursor extends XID {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public static final Cursor None = null;
|
public static final Cursor None = null;
|
||||||
public Cursor() { }
|
public Cursor() { }
|
||||||
public Cursor(long id) { super(id); }
|
public Cursor(long id) { super(id); }
|
||||||
@@ -173,6 +183,7 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class KeySym extends XID {
|
class KeySym extends XID {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public static final KeySym None = null;
|
public static final KeySym None = null;
|
||||||
public KeySym() { }
|
public KeySym() { }
|
||||||
public KeySym(long id) { super(id); }
|
public KeySym(long id) { super(id); }
|
||||||
@@ -183,6 +194,7 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Drawable extends XID {
|
class Drawable extends XID {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public static final Drawable None = null;
|
public static final Drawable None = null;
|
||||||
public Drawable() { }
|
public Drawable() { }
|
||||||
public Drawable(long id) { super(id); }
|
public Drawable(long id) { super(id); }
|
||||||
@@ -193,7 +205,8 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Window extends Drawable {
|
class Window extends Drawable {
|
||||||
public static final Window None = null;
|
private static final long serialVersionUID = 1L;
|
||||||
|
public static final Window None = null;
|
||||||
public Window() { }
|
public Window() { }
|
||||||
public Window(long id) { super(id); }
|
public Window(long id) { super(id); }
|
||||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||||
@@ -211,7 +224,8 @@ public interface X11 extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Pixmap extends Drawable {
|
class Pixmap extends Drawable {
|
||||||
public static final Pixmap None = null;
|
private static final long serialVersionUID = 1L;
|
||||||
|
public static final Pixmap None = null;
|
||||||
public Pixmap() { }
|
public Pixmap() { }
|
||||||
public Pixmap(long id) { super(id); }
|
public Pixmap(long id) { super(id); }
|
||||||
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
public Object fromNative(Object nativeValue, FromNativeContext context) {
|
||||||
@@ -266,8 +280,12 @@ public interface X11 extends Library {
|
|||||||
public short green, greenMask;
|
public short green, greenMask;
|
||||||
public short blue, blueMask;
|
public short blue, blueMask;
|
||||||
public short alpha, alphaMask;
|
public short alpha, alphaMask;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "red", "redMask", "green", "greenMask", "blue", "blueMask", "alpha", "alphaMask" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
class PictFormat extends NativeLong {
|
class PictFormat extends NativeLong {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public PictFormat(long value) { super(value); }
|
public PictFormat(long value) { super(value); }
|
||||||
public PictFormat() { }
|
public PictFormat() { }
|
||||||
}
|
}
|
||||||
@@ -277,6 +295,9 @@ public interface X11 extends Library {
|
|||||||
public int depth;
|
public int depth;
|
||||||
public XRenderDirectFormat direct;
|
public XRenderDirectFormat direct;
|
||||||
public Colormap colormap;
|
public Colormap colormap;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "id", "type", "depth", "direct", "colormap" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int PictTypeIndexed = 0x0;
|
int PictTypeIndexed = 0x0;
|
||||||
int PictTypeDirect = 0x1;
|
int PictTypeDirect = 0x1;
|
||||||
@@ -325,12 +346,18 @@ public interface X11 extends Library {
|
|||||||
class XInputClassInfoByReference extends Structure implements Structure.ByReference {
|
class XInputClassInfoByReference extends Structure implements Structure.ByReference {
|
||||||
public byte input_class;
|
public byte input_class;
|
||||||
public byte event_type_base;
|
public byte event_type_base;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "input_class", "event_type_base" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XDeviceByReference extends Structure implements Structure.ByReference {
|
class XDeviceByReference extends Structure implements Structure.ByReference {
|
||||||
public XID device_id;
|
public XID device_id;
|
||||||
public int num_classes;
|
public int num_classes;
|
||||||
public XInputClassInfoByReference classes;
|
public XInputClassInfoByReference classes;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "device_id", "num_classes", "classes" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
X11 INSTANCE = (X11)Native.loadLibrary("X11", X11.class);
|
X11 INSTANCE = (X11)Native.loadLibrary("X11", X11.class);
|
||||||
@@ -358,6 +385,9 @@ public interface X11 extends Library {
|
|||||||
public int icon_x, icon_y;
|
public int icon_x, icon_y;
|
||||||
public Pixmap icon_mask;
|
public Pixmap icon_mask;
|
||||||
public XID window_group;
|
public XID 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" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -373,6 +403,9 @@ public interface X11 extends Library {
|
|||||||
public Atom encoding;
|
public Atom encoding;
|
||||||
public int format;
|
public int format;
|
||||||
public NativeLong nitems;
|
public NativeLong nitems;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "value", "encoding", "format", "nitems" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -401,10 +434,14 @@ public interface X11 extends Library {
|
|||||||
public static class Aspect extends Structure {
|
public static class Aspect extends Structure {
|
||||||
public int x; // numerator
|
public int x; // numerator
|
||||||
public int y; // denominator
|
public int y; // denominator
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "x", "y" }); }
|
||||||
}
|
}
|
||||||
public Aspect min_aspect, max_aspect;
|
public Aspect min_aspect, max_aspect;
|
||||||
public int base_width, base_height;
|
public int base_width, base_height;
|
||||||
public int win_gravity;
|
public int 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" }); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -458,6 +495,9 @@ public interface X11 extends Library {
|
|||||||
public NativeLong do_not_propagate_mask;
|
public NativeLong do_not_propagate_mask;
|
||||||
public boolean override_redirect;
|
public boolean override_redirect;
|
||||||
public Screen screen;
|
public Screen 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" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -495,6 +535,9 @@ public interface X11 extends Library {
|
|||||||
public boolean override_redirect;
|
public boolean override_redirect;
|
||||||
public Colormap colormap;
|
public Colormap colormap;
|
||||||
public Cursor cursor;
|
public Cursor 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;
|
int XK_0 = 0x30;
|
||||||
@@ -537,10 +580,16 @@ public interface X11 extends Library {
|
|||||||
public NativeLong blue_mask;
|
public NativeLong blue_mask;
|
||||||
public int colormap_size;
|
public int colormap_size;
|
||||||
public int bits_per_rgb;
|
public int 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 {
|
class XPoint extends Structure {
|
||||||
public short x, y;
|
public short x, y;
|
||||||
public XPoint() { }
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "x", "y" });
|
||||||
|
}
|
||||||
|
public XPoint() { this((short)0, (short)0); }
|
||||||
public XPoint(short x, short y) {
|
public XPoint(short x, short y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
@@ -549,7 +598,10 @@ public interface X11 extends Library {
|
|||||||
class XRectangle extends Structure {
|
class XRectangle extends Structure {
|
||||||
public short x, y;
|
public short x, y;
|
||||||
public short width, height;
|
public short width, height;
|
||||||
public XRectangle() { }
|
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) {
|
public XRectangle(short x, short y, short width, short height) {
|
||||||
this.x = x; this.y = y;
|
this.x = x; this.y = y;
|
||||||
this.width = width; this.height = height;
|
this.width = width; this.height = height;
|
||||||
@@ -693,6 +745,9 @@ public interface X11 extends Library {
|
|||||||
public Pixmap clip_mask; /* bitmap clipping; other calls for rects */
|
public Pixmap clip_mask; /* bitmap clipping; other calls for rects */
|
||||||
public int dash_offset; /* patterned/dashed line information */
|
public int dash_offset; /* patterned/dashed line information */
|
||||||
public byte dashes;
|
public byte 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);
|
GC XCreateGC(Display display, Drawable drawable, NativeLong mask, XGCValues values);
|
||||||
int XSetFillRule(Display display, GC gc, int fill_rule);
|
int XSetFillRule(Display display, GC gc, int fill_rule);
|
||||||
@@ -931,8 +986,8 @@ public interface X11 extends Library {
|
|||||||
int SyncBoth = 7;
|
int SyncBoth = 7;
|
||||||
|
|
||||||
/* Used in SetInputFocus, GetInputFocus */
|
/* Used in SetInputFocus, GetInputFocus */
|
||||||
int RevertToNone = (int)None;
|
int RevertToNone = None;
|
||||||
int RevertToPointerRoot = (int)PointerRoot;
|
int RevertToPointerRoot = PointerRoot;
|
||||||
int RevertToParent = 2;
|
int RevertToParent = 2;
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
@@ -1318,6 +1373,9 @@ public interface X11 extends Library {
|
|||||||
public int send_event; // true if this came from a SendEvent request
|
public int send_event; // true if this came from a SendEvent request
|
||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public Window window; // window on which event was requested in event mask
|
public Window window; // window on which event was requested in event mask
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XKeyEvent extends Structure {
|
class XKeyEvent extends Structure {
|
||||||
@@ -1334,6 +1392,9 @@ public interface X11 extends Library {
|
|||||||
public int state; // key or button mask
|
public int state; // key or button mask
|
||||||
public int keycode; // detail
|
public int keycode; // detail
|
||||||
public int same_screen; // same screen flag
|
public int same_screen; // same screen flag
|
||||||
|
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 {
|
class XButtonEvent extends Structure {
|
||||||
@@ -1350,6 +1411,9 @@ public interface X11 extends Library {
|
|||||||
public int state; // key or button mask
|
public int state; // key or button mask
|
||||||
public int button; // detail
|
public int button; // detail
|
||||||
public int same_screen; // same screen flag
|
public int same_screen; // same screen flag
|
||||||
|
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 {
|
class XButtonPressedEvent extends XButtonEvent {
|
||||||
@@ -1367,6 +1431,9 @@ public interface X11 extends Library {
|
|||||||
public Atom message_type;
|
public Atom message_type;
|
||||||
public int format;
|
public int format;
|
||||||
public Data data;
|
public Data 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 static class Data extends Union {
|
||||||
public byte b[] = new byte[20];
|
public byte b[] = new byte[20];
|
||||||
@@ -1389,6 +1456,9 @@ public interface X11 extends Library {
|
|||||||
public int state; // key or button mask
|
public int state; // key or button mask
|
||||||
public byte is_hint; // detail
|
public byte is_hint; // detail
|
||||||
public int same_screen; // same screen flag
|
public int same_screen; // same screen flag
|
||||||
|
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 {
|
class XPointerMovedEvent extends XMotionEvent {
|
||||||
@@ -1412,8 +1482,11 @@ public interface X11 extends Library {
|
|||||||
* NotifyNonlinear,NotifyNonlinearVirtual
|
* NotifyNonlinear,NotifyNonlinearVirtual
|
||||||
*/
|
*/
|
||||||
public int same_screen; // same screen flag
|
public int same_screen; // same screen flag
|
||||||
public int focus; // intean focus
|
public int focus; // boolean focus
|
||||||
public int state; // key or button mask
|
public int state; // key or button mask
|
||||||
|
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 {
|
class XEnterWindowEvent extends XCrossingEvent {
|
||||||
@@ -1435,6 +1508,9 @@ public interface X11 extends Library {
|
|||||||
* NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
|
* NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
|
||||||
* NotifyPointerRoot, NotifyDetailNone
|
* NotifyPointerRoot, NotifyDetailNone
|
||||||
*/
|
*/
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "mode", "detail" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XFocusInEvent extends XFocusChangeEvent {
|
class XFocusInEvent extends XFocusChangeEvent {
|
||||||
@@ -1452,6 +1528,9 @@ public interface X11 extends Library {
|
|||||||
public int x, y;
|
public int x, y;
|
||||||
public int width, height;
|
public int width, height;
|
||||||
public int count; // if non-zero, at least this many more
|
public int count; // if non-zero, at least this many more
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "count" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XGraphicsExposeEvent extends Structure {
|
class XGraphicsExposeEvent extends Structure {
|
||||||
@@ -1465,6 +1544,9 @@ public interface X11 extends Library {
|
|||||||
public int count; // if non-zero, at least this many more
|
public int count; // if non-zero, at least this many more
|
||||||
public int major_code; // core is CopyArea or CopyPlane
|
public int major_code; // core is CopyArea or CopyPlane
|
||||||
public int minor_code; // not defined in the core
|
public int minor_code; // not defined in the core
|
||||||
|
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 {
|
class XNoExposeEvent extends Structure {
|
||||||
@@ -1475,6 +1557,9 @@ public interface X11 extends Library {
|
|||||||
public Drawable drawable;
|
public Drawable drawable;
|
||||||
public int major_code; // core is CopyArea or CopyPlane
|
public int major_code; // core is CopyArea or CopyPlane
|
||||||
public int minor_code; // not defined in the core
|
public int minor_code; // not defined in the core
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "drawable", "major_code", "minor_code" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XVisibilityEvent extends Structure {
|
class XVisibilityEvent extends Structure {
|
||||||
@@ -1484,6 +1569,9 @@ public interface X11 extends Library {
|
|||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public Window window;
|
public Window window;
|
||||||
public int state; // Visibility state
|
public int state; // Visibility state
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "state" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XCreateWindowEvent extends Structure {
|
class XCreateWindowEvent extends Structure {
|
||||||
@@ -1497,6 +1585,9 @@ public interface X11 extends Library {
|
|||||||
public int width, height; // size of window
|
public int width, height; // size of window
|
||||||
public int border_width; // border width
|
public int border_width; // border width
|
||||||
public int override_redirect; // creation should be overridden
|
public int override_redirect; // creation should be overridden
|
||||||
|
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 {
|
class XDestroyWindowEvent extends Structure {
|
||||||
@@ -1506,6 +1597,8 @@ public interface X11 extends Library {
|
|||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public Window event;
|
public Window event;
|
||||||
public Window window;
|
public Window window;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window" }); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class XUnmapEvent extends Structure {
|
class XUnmapEvent extends Structure {
|
||||||
@@ -1516,6 +1609,9 @@ public interface X11 extends Library {
|
|||||||
public Window event;
|
public Window event;
|
||||||
public Window window;
|
public Window window;
|
||||||
public int from_configure;
|
public int from_configure;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "from_configure" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XMapEvent extends Structure {
|
class XMapEvent extends Structure {
|
||||||
@@ -1525,7 +1621,10 @@ public interface X11 extends Library {
|
|||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public Window event;
|
public Window event;
|
||||||
public Window window;
|
public Window window;
|
||||||
public int override_redirect; // intean, is override set...
|
public int override_redirect; // boolean, is override set...
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "override_redirect" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XMapRequestEvent extends Structure {
|
class XMapRequestEvent extends Structure {
|
||||||
@@ -1535,6 +1634,9 @@ public interface X11 extends Library {
|
|||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public Window parent;
|
public Window parent;
|
||||||
public Window window;
|
public Window window;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XReparentEvent extends Structure {
|
class XReparentEvent extends Structure {
|
||||||
@@ -1547,6 +1649,9 @@ public interface X11 extends Library {
|
|||||||
public Window parent;
|
public Window parent;
|
||||||
public int x, y;
|
public int x, y;
|
||||||
public int override_redirect;
|
public int 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 {
|
class XConfigureEvent extends Structure {
|
||||||
@@ -1561,6 +1666,9 @@ public interface X11 extends Library {
|
|||||||
public int border_width;
|
public int border_width;
|
||||||
public Window above;
|
public Window above;
|
||||||
public int override_redirect;
|
public int 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 {
|
class XGravityEvent extends Structure {
|
||||||
@@ -1571,6 +1679,9 @@ public interface X11 extends Library {
|
|||||||
public Window event;
|
public Window event;
|
||||||
public Window window;
|
public Window window;
|
||||||
public int x, y;
|
public int x, y;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "x", "y" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XResizeRequestEvent extends Structure {
|
class XResizeRequestEvent extends Structure {
|
||||||
@@ -1580,6 +1691,9 @@ public interface X11 extends Library {
|
|||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public Window window;
|
public Window window;
|
||||||
public int width, height;
|
public int width, height;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "width", "height" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XConfigureRequestEvent extends Structure {
|
class XConfigureRequestEvent extends Structure {
|
||||||
@@ -1595,6 +1709,9 @@ public interface X11 extends Library {
|
|||||||
public Window above;
|
public Window above;
|
||||||
public int detail; // Above, Below, TopIf, BottomIf, Opposite
|
public int detail; // Above, Below, TopIf, BottomIf, Opposite
|
||||||
public NativeLong value_mask;
|
public NativeLong 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 {
|
class XCirculateEvent extends Structure {
|
||||||
@@ -1605,6 +1722,9 @@ public interface X11 extends Library {
|
|||||||
public Window event;
|
public Window event;
|
||||||
public Window window;
|
public Window window;
|
||||||
public int place; // PlaceOnTop, PlaceOnBottom
|
public int place; // PlaceOnTop, PlaceOnBottom
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "place" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XCirculateRequestEvent extends Structure {
|
class XCirculateRequestEvent extends Structure {
|
||||||
@@ -1615,6 +1735,9 @@ public interface X11 extends Library {
|
|||||||
public Window parent;
|
public Window parent;
|
||||||
public Window window;
|
public Window window;
|
||||||
public int place; // PlaceOnTop, PlaceOnBottom
|
public int place; // PlaceOnTop, PlaceOnBottom
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window", "place" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XPropertyEvent extends Structure {
|
class XPropertyEvent extends Structure {
|
||||||
@@ -1626,6 +1749,9 @@ public interface X11 extends Library {
|
|||||||
public Atom atom;
|
public Atom atom;
|
||||||
public NativeLong time;
|
public NativeLong time;
|
||||||
public int state; // NewValue, Deleted
|
public int state; // NewValue, Deleted
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "atom", "time", "state" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XSelectionClearEvent extends Structure {
|
class XSelectionClearEvent extends Structure {
|
||||||
@@ -1636,6 +1762,9 @@ public interface X11 extends Library {
|
|||||||
public Window window;
|
public Window window;
|
||||||
public Atom selection;
|
public Atom selection;
|
||||||
public NativeLong time;
|
public NativeLong time;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "selection", "time" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XSelectionRequestEvent extends Structure {
|
class XSelectionRequestEvent extends Structure {
|
||||||
@@ -1647,8 +1776,11 @@ public interface X11 extends Library {
|
|||||||
public Window requestor;
|
public Window requestor;
|
||||||
public Atom selection;
|
public Atom selection;
|
||||||
public Atom target;
|
public Atom target;
|
||||||
Atom property;
|
public Atom property;
|
||||||
public NativeLong time;
|
public NativeLong time;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "owner", "requestor", "selection", "target", "property", "time" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XSelectionEvent extends Structure {
|
class XSelectionEvent extends Structure {
|
||||||
@@ -1661,6 +1793,9 @@ public interface X11 extends Library {
|
|||||||
public Atom target;
|
public Atom target;
|
||||||
public Atom property; // ATOM or None
|
public Atom property; // ATOM or None
|
||||||
public NativeLong time;
|
public NativeLong time;
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "requestor", "selection", "target", "property", "time" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XColormapEvent extends Structure {
|
class XColormapEvent extends Structure {
|
||||||
@@ -1672,6 +1807,9 @@ public interface X11 extends Library {
|
|||||||
public Colormap colormap; // COLORMAP or None
|
public Colormap colormap; // COLORMAP or None
|
||||||
public int c_new; // C++
|
public int c_new; // C++
|
||||||
public int state; // ColormapInstalled, ColormapUninstalled
|
public int state; // ColormapInstalled, ColormapUninstalled
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "colormap", "c_new", "state" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XMappingEvent extends Structure {
|
class XMappingEvent extends Structure {
|
||||||
@@ -1683,16 +1821,22 @@ public interface X11 extends Library {
|
|||||||
public int request; // one of MappingModifier, MappingKeyboard, MappingPointer
|
public int request; // one of MappingModifier, MappingKeyboard, MappingPointer
|
||||||
public int first_keycode; // first keycode
|
public int first_keycode; // first keycode
|
||||||
public int count; // defines range of change w. first_keycode*/
|
public int count; // defines range of change w. first_keycode*/
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "request", "first_keycode", "count" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XErrorEvent extends Structure {
|
class XErrorEvent extends Structure {
|
||||||
public int type;
|
public int type;
|
||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public XID resourceid; // resource id
|
|
||||||
public NativeLong serial; // serial number of failed request
|
public NativeLong serial; // serial number of failed request
|
||||||
public byte error_code; // error code of failed request
|
public byte error_code; // error code of failed request
|
||||||
public byte request_code; // Major op-code of failed request
|
public byte request_code; // Major op-code of failed request
|
||||||
public byte minor_code; // Minor op-code of failed request
|
public byte minor_code; // Minor op-code of failed request
|
||||||
|
public XID resourceid; // resource id
|
||||||
|
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
|
// generated on EnterWindow and FocusIn when KeyMapState selected
|
||||||
@@ -1703,6 +1847,9 @@ public interface X11 extends Library {
|
|||||||
public Display display; // Display the event was read from
|
public Display display; // Display the event was read from
|
||||||
public Window window;
|
public Window window;
|
||||||
public byte key_vector[] = new byte[32];
|
public byte key_vector[] = new byte[32];
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "key_vector" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int XSelectInput(Display display, Window window, NativeLong eventMask);
|
int XSelectInput(Display display, Window window, NativeLong eventMask);
|
||||||
@@ -1757,6 +1904,18 @@ public interface X11 extends Library {
|
|||||||
int width, int height);
|
int width, int height);
|
||||||
int XDestroyImage(XImage image);
|
int XDestroyImage(XImage image);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs an error handler
|
||||||
|
*
|
||||||
|
* @param handler Specifies the program's supplied error handler
|
||||||
|
* @return The previous error handler
|
||||||
|
*/
|
||||||
|
XErrorHandler XSetErrorHandler(XErrorHandler handler);
|
||||||
|
|
||||||
|
public interface XErrorHandler extends Callback {
|
||||||
|
public int apply(Display display, XErrorEvent errorEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* KeySyms, Keycodes, Keymaps
|
* KeySyms, Keycodes, Keymaps
|
||||||
@@ -1767,6 +1926,33 @@ public interface X11 extends Library {
|
|||||||
byte XKeysymToKeycode(Display display, KeySym keysym);
|
byte XKeysymToKeycode(Display display, KeySym keysym);
|
||||||
KeySym XKeycodeToKeysym(Display display, byte keycode, int index);
|
KeySym XKeycodeToKeysym(Display display, byte keycode, int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Establishes a passive grab on the keyboard
|
||||||
|
*
|
||||||
|
* @param display Specifies the connection to the X server.
|
||||||
|
* @param keyCode Specifies the KeyCode or {@link #AnyKey}.
|
||||||
|
* @param modifiers Specifies the set of keymasks or {@link #AnyModifier}.
|
||||||
|
* The mask is the bitwise inclusive OR of the valid keymask bits.
|
||||||
|
* @param grab_window Specifies the grab window.
|
||||||
|
* @param ownerEvents Specifies a Boolean value that indicates whether the keyboard events are to be reported as usual.
|
||||||
|
* @param pointerMode Specifies further processing of pointer events. You can pass {@link #GrabModeSync} or {@link #GrabModeAsync}.
|
||||||
|
* @param keyBoardMode Specifies further processing of keyboard events. You can pass {@link #GrabModeSync} or {@link #GrabModeAsync}.
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
int XGrabKey(Display display, int keyCode, int modifiers, Window grab_window, int ownerEvents, int pointerMode, int keyBoardMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The XUngrabKey() function releases the key combination on the specified window if it was grabbed by this client.
|
||||||
|
*
|
||||||
|
* @param display Specifies the connection to the X server.
|
||||||
|
* @param keyCode Specifies the KeyCode or {@link #AnyKey}.
|
||||||
|
* @param modifiers Specifies the set of keymasks or {@link #AnyModifier}.
|
||||||
|
* The mask is the bitwise inclusive OR of the valid keymask bits
|
||||||
|
* @param grab_window Specifies the grab window.
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
int XUngrabKey(Display display, int keyCode, int modifiers, Window grab_window);
|
||||||
|
|
||||||
//int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym *keysyms, int num_codes);
|
//int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym *keysyms, int num_codes);
|
||||||
/** Defines the symbols for the specified number of KeyCodes starting with first_keycode. The symbols for KeyCodes outside this range remain unchanged. The number of elements in keysyms must be: num_codes * keysyms_per_keycode. The specified first_keycode must be greater than or equal to min_keycode returned by XDisplayKeycodes, or a BadValue error results. In addition, the following expression must be less than or equal to max_keycode as returned by XDisplayKeycodes, or a BadValue error results: first_keycode + num_codes - 1. */
|
/** Defines the symbols for the specified number of KeyCodes starting with first_keycode. The symbols for KeyCodes outside this range remain unchanged. The number of elements in keysyms must be: num_codes * keysyms_per_keycode. The specified first_keycode must be greater than or equal to min_keycode returned by XDisplayKeycodes, or a BadValue error results. In addition, the following expression must be less than or equal to max_keycode as returned by XDisplayKeycodes, or a BadValue error results: first_keycode + num_codes - 1. */
|
||||||
int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym[] keysyms, int num_codes);
|
int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym[] keysyms, int num_codes);
|
||||||
@@ -1808,6 +1994,9 @@ public interface X11 extends Library {
|
|||||||
class XModifierKeymapRef extends Structure implements Structure.ByReference{
|
class XModifierKeymapRef extends Structure implements Structure.ByReference{
|
||||||
public int max_keypermod; /* The server's max # of keys per modifier */
|
public int max_keypermod; /* The server's max # of keys per modifier */
|
||||||
public Pointer modifiermap; /* An 8 by max_keypermod array of modifiers */
|
public Pointer modifiermap; /* An 8 by max_keypermod array of modifiers */
|
||||||
|
protected List getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "max_keypermod", "modifiermap" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class XKeyboardControlRef extends Structure implements Structure.ByReference {
|
class XKeyboardControlRef extends Structure implements Structure.ByReference {
|
||||||
@@ -1828,6 +2017,10 @@ public interface X11 extends Library {
|
|||||||
/** AutoRepeatModeOff, AutoRepeatModeOn, AutoRepeatModeDefault. */
|
/** AutoRepeatModeOff, AutoRepeatModeOn, AutoRepeatModeDefault. */
|
||||||
public int auto_repeat_mode;
|
public int 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() {
|
public String toString() {
|
||||||
return "XKeyboardControlByReference{" +
|
return "XKeyboardControlByReference{" +
|
||||||
"key_click_percent=" + key_click_percent +
|
"key_click_percent=" + key_click_percent +
|
||||||
@@ -1858,6 +2051,10 @@ 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. */
|
/** 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];
|
public byte auto_repeats[] = new byte[32];
|
||||||
|
|
||||||
|
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() {
|
public String toString() {
|
||||||
return "XKeyboardStateByReference{" +
|
return "XKeyboardStateByReference{" +
|
||||||
"key_click_percent=" + key_click_percent +
|
"key_click_percent=" + key_click_percent +
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2010 Timothy Wall
|
||||||
|
-->
|
||||||
|
</head>
|
||||||
|
<body bgcolor="white">
|
||||||
|
|
||||||
|
<!-- One sentence summary -->
|
||||||
|
Provides common library mappings for Unix and X11-based platforms.
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
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