Comparar commits
522 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| f88d243071 | |||
| feb7b88279 | |||
| 070b47e825 | |||
| c1289c07be | |||
| e68fd9dfaf | |||
| f23a4bf9d5 | |||
| b769daec0c | |||
| 4e36f71f3a | |||
| 25db8ccfa7 | |||
| 5c2923c0af | |||
| 018ad7f2c0 | |||
| c1a7fd7267 | |||
| 3c086de42c | |||
| b48390fc1e | |||
| 136fe02333 | |||
| 5f9d100b2d | |||
| 176f3f32d4 | |||
| 2667202a3f | |||
| 245eb88b40 | |||
| d51479c357 | |||
| 7a583b1aaa | |||
| eaff9bd176 | |||
| da4d941906 | |||
| ed94e60da3 | |||
| 2fe6c956b4 | |||
| 559c7d7f13 | |||
| 6b7f2eeadb | |||
| 7bda1b3d0e | |||
| d516b01c75 | |||
| 08c579f0cb | |||
| c231069066 | |||
| ec16947808 | |||
| 2d61573175 | |||
| 507c065c0e | |||
| cf6b6299e0 | |||
| 862a746170 | |||
| 14717ce21f | |||
| 72aade4f8f | |||
| fbf75539f9 | |||
| 879402d020 | |||
| 7296f2213d | |||
| fb243c6cf5 | |||
| 20d1a720ce | |||
| ea12e0755b | |||
| 83cc22a24c | |||
| c795c80439 | |||
| edab625da6 | |||
| 9f9240391b | |||
| 4fbbc6b42a | |||
| cdbc379608 | |||
| bfeac30452 | |||
| 2e7d188afa | |||
| d291bd52cd | |||
| d8e8fd09a6 | |||
| d66471e4c0 | |||
| bb7d364f45 | |||
| f9f8474e7f | |||
| e2cac3a280 | |||
| d6b5c2c797 | |||
| c0e51cb47f | |||
| 03f054b474 | |||
| 511676e0e9 | |||
| 94ac8af162 | |||
| a814936bd7 | |||
| e42b2ca09d | |||
| 7be159d0c2 | |||
| c53c384096 | |||
| 6a52c22a02 | |||
| 6f30debd34 | |||
| d400921e17 | |||
| e95b37e5de | |||
| b9cc27c1ad | |||
| c8852f7c44 | |||
| 18b0700337 | |||
| 8d535e72c7 | |||
| 2f51fc68cb | |||
| 1f1972bf0e | |||
| e91fbd35c2 | |||
| f46c5ffc2b | |||
| a9f90b508a | |||
| 7dd96c6978 | |||
| 0c888d992b | |||
| 14da21e9f9 | |||
| 019e861539 | |||
| 79d208096b | |||
| 28c4c5fef5 | |||
| 5e211134d5 | |||
| 310e829d70 | |||
| 3d0040a183 | |||
| bbb0501f76 | |||
| 641b7aa3ad | |||
| 1572b12f75 | |||
| 689ddc493f | |||
| cb05293c11 | |||
| d5e2ee902d | |||
| b9995b2ad0 | |||
| bd243519df | |||
| f11614bc27 | |||
| 58a5185c20 | |||
| e92ff82c19 | |||
| c4c07d7878 | |||
| e07ed3082d | |||
| 5728822dad | |||
| fd13022f7c | |||
| 296eaec0e6 | |||
| 8b8672214c | |||
| 2f662bcf6d | |||
| 35f12b7027 | |||
| 719fab1ad2 | |||
| 67ffdd5168 | |||
| afc3fe3687 | |||
| 14dbeda4ed | |||
| f5ee066cc0 | |||
| ad65bcccfb | |||
| fab66d7d49 | |||
| d78c38e4e2 | |||
| 21cecef8ef | |||
| 3e8511fbc6 | |||
| 21863e190d | |||
| fb84300563 | |||
| a8de00b8e5 | |||
| 5fd52be589 | |||
| 6335fef0b1 | |||
| 3455742d89 | |||
| 6ba364f64f | |||
| 164da6cf1c | |||
| 1b6bc6342e | |||
| bde74fdccf | |||
| 6dd612162d | |||
| 2ff4d20fad | |||
| fbcd02ae6e | |||
| 6de51cdf5a | |||
| e97b1df6ee | |||
| 65d68b8d70 | |||
| f915ec7e05 | |||
| 44b4bc0cac | |||
| 2a6ac9a20d | |||
| 076298e343 | |||
| 1c3ab0f80f | |||
| a0ae2836d9 | |||
| 2309762aca | |||
| e4d89f7087 | |||
| 44c41b6faf | |||
| 8003de03ec | |||
| c5ae6a3cbb | |||
| 4581cb2f61 | |||
| 804795c5f8 | |||
| c2c1f81ea5 | |||
| 14481ee346 | |||
| aea387ce02 | |||
| 4ddad49369 | |||
| 224f18fef4 | |||
| 2390543445 | |||
| 473d48b39b | |||
| a947dfdac5 | |||
| a064b2a0e1 | |||
| 3755747fda | |||
| 57ded8d803 | |||
| aa5fc9b3d8 | |||
| afb3a7cc84 | |||
| 76f7b189fa | |||
| d330f19292 | |||
| b14ccb8eab | |||
| d873f6f6be | |||
| 7f0d465e98 | |||
| 9889489355 | |||
| 09b23cfc1d | |||
| 213ed15c70 | |||
| ff3d76fd42 | |||
| 7e0a412c4f | |||
| 39e6a58604 | |||
| 853cc722a1 | |||
| 3f5023068c | |||
| ebb8e89456 | |||
| a098b44f4c | |||
| 10d1e51393 | |||
| 9bcc884276 | |||
| a044a56b1c | |||
| 59bb61a366 | |||
| f2981454cb | |||
| 39dccddb60 | |||
| 3afaa9a34a | |||
| 65f40c35a2 | |||
| 0a1ab12a8d | |||
| e1539266e6 | |||
| 7c5e60b5f4 | |||
| e72ed5eeaa | |||
| bd78c9c331 | |||
| 84d3253f86 | |||
| 964c5b93f8 | |||
| 6c194233a5 | |||
| 8360bf1cd0 | |||
| d578b89619 | |||
| dee20f8e45 | |||
| 4130e1972d | |||
| 1ff9c604bb | |||
| 211060eb8f | |||
| 78d9c638ba | |||
| afaf338160 | |||
| 9e9c4aeb77 | |||
| 8efc0b1f40 | |||
| 1df51398ae | |||
| cd2277cc79 | |||
| 164e6fe04b | |||
| c365ee7577 | |||
| f22c38bbd9 | |||
| 03e9ee321a | |||
| 95f31151ec | |||
| 198ed1ef85 | |||
| 4f17e1f142 | |||
| ff9454da44 | |||
| ea14ae85e8 | |||
| 52891f8a93 | |||
| c8f1bde8e2 | |||
| 6a6e7f862f | |||
| d52fbed05c | |||
| 322052ce65 | |||
| af18df2bc2 | |||
| 236c939132 | |||
| c411f140f3 | |||
| 3d56106b07 | |||
| 8c01954c50 | |||
| fed646a207 | |||
| d76441cf71 | |||
| ee6696fdf4 | |||
| c6265c36a9 | |||
| cc5e41bf32 | |||
| 049d8386ff | |||
| 3b7efa4e74 | |||
| d992ac54a2 | |||
| 2d3fb36420 | |||
| 30ff28e1d8 | |||
| 09f8f310f4 | |||
| 53d7b16564 | |||
| 18dd85d6cb | |||
| 74ee6ea8b4 | |||
| 2541679dbd | |||
| cbb062cc35 | |||
| 8cf8878425 | |||
| 24b72070c0 | |||
| d72c49e556 | |||
| 3000dc237f | |||
| 1fbf9dc44f | |||
| 90af15ef5c | |||
| 55e4a5aa15 | |||
| a0c80f279b | |||
| 8195e0e11d | |||
| 56b3f8cef0 | |||
| 28a00f61ff | |||
| 7f2ea33a80 | |||
| 92ff23e77f | |||
| 58fb8ca2df | |||
| cc3fbd975c | |||
| e449a43bbe | |||
| 71c792f51b | |||
| 7c7c9f3272 | |||
| ed62e48b95 | |||
| 17d9e9e68d | |||
| 6972a4ffda | |||
| 1833aa0fb9 | |||
| f1fb139b4e | |||
| 5cb470331d | |||
| 269deef6db | |||
| 42695e7250 | |||
| a6e56b97f6 | |||
| 747d6c32d4 | |||
| eab6e41cde | |||
| 69dbe845f4 | |||
| f498318c07 | |||
| 630b9c0ac4 | |||
| 0cad4386fa | |||
| 09cb76f264 | |||
| 2e3a48ccdd | |||
| 5e4814d992 | |||
| 5c0cc6f153 | |||
| 857fe3de46 | |||
| e2214f8adb | |||
| 1106229a57 | |||
| bc9d0be295 | |||
| 3b836249fe | |||
| a26e394061 | |||
| b8099539f0 | |||
| dc411e8f99 | |||
| 404585d134 | |||
| 19ce713188 | |||
| 89284fe55f | |||
| ba022c338a | |||
| 097e5f3924 | |||
| ed2c518d96 | |||
| 0e5843995f | |||
| 5b9cd52784 | |||
| 2db72615b5 | |||
| f6ab3edc23 | |||
| cef6194628 | |||
| 53f387b203 | |||
| 4fbcb5b5fb | |||
| 8e7652ef6a | |||
| 83038cf24a | |||
| b00ff3e98f | |||
| da2773e02a | |||
| 01d71b7bed | |||
| 19afda0069 | |||
| 9e1196444e | |||
| f38364b399 | |||
| 36849e7716 | |||
| b764162526 | |||
| a3d9aa8501 | |||
| c71480eaf8 | |||
| 9af9291b73 | |||
| 68ce0c383e | |||
| 75af086be8 | |||
| 1ac92cca9b | |||
| be72fbab29 | |||
| 70150bdf45 | |||
| 6b452bafae | |||
| 8ddac835b6 | |||
| 69043d0293 | |||
| a82e6c354e | |||
| 84e8de6e9f | |||
| 3aeecc9eb1 | |||
| 00d0b59cd1 | |||
| bda487e870 | |||
| c1d28ba8d5 | |||
| 5feacad4a5 | |||
| 10ea848900 | |||
| d14178be4c | |||
| 3f5b1375ab | |||
| eaf444eabc | |||
| 6309741522 | |||
| 9dc9a293f3 | |||
| f2c2a4fce9 | |||
| c0b69e57d5 | |||
| 59a259f4d3 | |||
| 3de1eb36d3 | |||
| c3813b6d7f | |||
| 8d27f68baa | |||
| ff3cd68b8c | |||
| cadeba6cb5 | |||
| 0739e7dc00 | |||
| edfdfd2e85 | |||
| 7b7a42f221 | |||
| 4b18d1f73d | |||
| c3042afaf3 | |||
| b0304e9679 | |||
| 2e7e03d014 | |||
| aea706c528 | |||
| 0cfe60e9d1 | |||
| 14e2e92e86 | |||
| 884402787b | |||
| 01c78756af | |||
| 7086846465 | |||
| 838d4ad920 | |||
| 7e37eaaf77 | |||
| 07cc7a3719 | |||
| 2b9be16ffa | |||
| 9458d88f67 | |||
| 6a34124175 | |||
| 39c8792ece | |||
| 1d04af52e3 | |||
| 26e9509c9b | |||
| 9c157d3215 | |||
| d22de05b0b | |||
| 1fe3dc7c20 | |||
| f7c0bc613a | |||
| c7fa2da826 | |||
| da11bece0f | |||
| e3399b11ed | |||
| 115ab36fce | |||
| f8c7a245bf | |||
| ce806772f0 | |||
| dcc1f6b4f1 | |||
| 2829f5941a | |||
| cd98813de5 | |||
| e4a91de766 | |||
| 3425a763bc | |||
| 2340e7a777 | |||
| 5cbe2058c1 | |||
| c6dddbd02b | |||
| 5ffc0c3748 | |||
| bd29f83ee9 | |||
| 9474f853f8 | |||
| 0c25275ec2 | |||
| 39228c27ed | |||
| 5e93cc704d | |||
| b509af8959 | |||
| d57e96dc56 | |||
| b01d6d1982 | |||
| 35b6ded138 | |||
| acc46605f2 | |||
| 16d1996ed0 | |||
| 92a515c33e | |||
| e4363160ba | |||
| 1dc2781d2b | |||
| bb27735fe6 | |||
| b2a54c100c | |||
| 25723e7141 | |||
| 70758199c7 | |||
| e8bb12563f | |||
| d66a8e32c3 | |||
| 7c3b7fd6b5 | |||
| 1a2f93a8b3 | |||
| 944c95cf7a | |||
| 00fa972430 | |||
| f5179e6794 | |||
| 80e2b5a749 | |||
| 7063d9996f | |||
| bdfeb13f0d | |||
| 69205de17d | |||
| 260d513fea | |||
| 3704031875 | |||
| 8406f5f48f | |||
| 23a9e73212 | |||
| 429e37d3ad | |||
| 51e79c4283 | |||
| affcab04e2 | |||
| 59689d5522 | |||
| b13c84cf46 | |||
| 265289f679 | |||
| fb5036cd6d | |||
| 40bec108e7 | |||
| b922048fa8 | |||
| affca4b92d | |||
| 3e53d8752e | |||
| 4d92f6c8e7 | |||
| 0e185fa11a | |||
| f73986bd21 | |||
| 0208f68fe5 | |||
| 01adb0e638 | |||
| 1edd456322 | |||
| c9b5428008 | |||
| d5fa5633d5 | |||
| ac35bfc6fc | |||
| f7942975fe | |||
| 59aa6bb1bf | |||
| 45a45ab990 | |||
| 4db74cbea8 | |||
| c3e1101ffa | |||
| 7e0cc12e92 | |||
| 2d7dc885ec | |||
| a0525f03ee | |||
| 2b30dfb314 | |||
| bf41e64840 | |||
| 4d39ddee67 | |||
| d58b032b41 | |||
| 91e5478df6 | |||
| bd0768f877 | |||
| 49d345f767 | |||
| 12ac48fc79 | |||
| 6b91c41da8 | |||
| 2b59579e35 | |||
| 6cbdf3f3a3 | |||
| 1d1dc81104 | |||
| f045a2367f | |||
| 6257f07d1a | |||
| 4232af563c | |||
| 961543615c | |||
| aeb0abab87 | |||
| 77fe243556 | |||
| d4970cf452 | |||
| f0b1462f2d | |||
| 27e52f33ba | |||
| fadab28eb6 | |||
| b5e44c8dfa | |||
| f359848d1a | |||
| c30df49e15 | |||
| 675561bb9a | |||
| abc0bbf381 | |||
| e332366d15 | |||
| d420424039 | |||
| f4932dd020 | |||
| 085520ddc8 | |||
| 77175b3f72 | |||
| 2544e45a0b | |||
| 6002211b1c | |||
| ccabd2b16b | |||
| e680ecfbfc | |||
| e7ba089659 | |||
| 0cd4aa24e2 | |||
| 5826120fbd | |||
| 220aa4b27d | |||
| 1c3adc892c | |||
| 4af66bb62f | |||
| 5435965f90 | |||
| 6fdb7de0fe | |||
| bc7144b01b | |||
| e57279831e | |||
| 7247436b5f | |||
| a8b0d40ff9 | |||
| f893d22733 | |||
| 688ddfeced | |||
| f9e40776d4 | |||
| 8c1d2eb47f | |||
| 1359dfc658 | |||
| 6e2de5eee3 | |||
| 8807355af3 | |||
| f7e9f91ade | |||
| c4860de618 | |||
| c578b58314 | |||
| acdb200512 | |||
| e75be655ce | |||
| d6669a0dd5 | |||
| 4819d52b00 | |||
| 2dbf801eb4 | |||
| d170961701 | |||
| c7747d9769 | |||
| dd2aa9a8de | |||
| 4e9452abed | |||
| 6d3b2bddaf | |||
| ebc6a9c28a | |||
| 78ffc52a8b | |||
| b4d77e827d | |||
| bfb73f08fd | |||
| af8b7f037c | |||
| 334f0b0609 | |||
| 3ab5cb4a1d | |||
| d2a9eb5a8b | |||
| bc75c54bd3 | |||
| d3782ec816 | |||
| 8d8d3843c4 | |||
| 49634f3bf2 | |||
| c64a84c769 | |||
| 9813273b07 |
@@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" output="jna/build.eclipse/test-classes" path="contrib/platform/test"/>
|
||||
<classpathentry kind="src" path="contrib/platform/src"/>
|
||||
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||
|
||||
@@ -8,3 +8,10 @@ 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
|
||||
|
||||
+29
-4
@@ -1,14 +1,39 @@
|
||||
Release 3.5.0
|
||||
=============
|
||||
|
||||
Features
|
||||
--------
|
||||
* `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.getEnvironmentVaraible` - [@dblock](https://github.com/dblock).
|
||||
* 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.
|
||||
* Provide ant -Dheadless=true to run unit tests headless.
|
||||
* Added windows dev environment instructions.
|
||||
* 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
|
||||
---------
|
||||
|
||||
+29
-27
@@ -3,7 +3,7 @@
|
||||
Java Native Access (JNA)
|
||||
========================
|
||||
|
||||
The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://twall.github.com/jna/3.4.2/javadoc/). Please read the [overview](http://twall.github.com/jna/3.4.2/javadoc/overview-summary.html#overview_description).
|
||||
The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://twall.github.com/jna/3.5.0/javadoc/). Please read the [overview](http://twall.github.com/jna/3.5.0/javadoc/overview-summary.html#overview_description).
|
||||
|
||||
JNA provides Java programs easy access to native shared libraries (DLLs on Windows) without writing anything but Java code—no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes. Access is dynamic at runtime without code generation.
|
||||
|
||||
@@ -18,15 +18,10 @@ JNA includes a platform library with many native functions already mapped as wel
|
||||
Download
|
||||
========
|
||||
|
||||
Version 3.4.2
|
||||
Version 3.5.0
|
||||
|
||||
* [jna.jar](jna/blob/3.4.2/dist/jna.jar?raw=true)
|
||||
* [platform.jar](jna/blob/3.4.2/dist/platform.jar?raw=true)
|
||||
|
||||
Version 3.4.1
|
||||
|
||||
* [jna.jar](jna/blob/3.4.1/dist/jna.jar?raw=true)
|
||||
* [platform.jar](jna/blob/3.4.1/dist/platform.jar?raw=true)
|
||||
* [jna.jar](jna/blob/3.5.0/dist/jna.jar?raw=true)
|
||||
* [platform.jar](jna/blob/3.5.0/dist/platform.jar?raw=true)
|
||||
|
||||
Features
|
||||
========
|
||||
@@ -42,7 +37,7 @@ Features
|
||||
* Nested structures and arrays
|
||||
* Wide (wchar_t-based) strings
|
||||
* Native long support (32- or 64-bit as appropriate)
|
||||
* Demo applications
|
||||
* [Demo applications/examples](https://github.com/twall/jna/tree/master/contrib)
|
||||
* Supported on 1.4 or later JVMs, including JavaME (earlier VMs may work with stubbed NIO support)
|
||||
* Customizable marshalling/unmarshalling (argument and return value conversions)
|
||||
* Customizable mapping from Java method to native function name, and customizable invocation to simulate C preprocessor function macros
|
||||
@@ -73,31 +68,39 @@ For commercial support, please contact twalljava [at] java [dot] net.
|
||||
Using the Library
|
||||
=================
|
||||
|
||||
* [Getting Started](jna/tree/master/www/GettingStarted.md)
|
||||
* [Mapping between Java and Native](jna/tree/master/www/Mappings.md)
|
||||
* [Using Pointers and Arrays](jna/tree/master/www/PointersAndArrays.md)
|
||||
* [Using Structures and Unions](jna/tree/master/www/StructuresAndUnions.md)
|
||||
* [Using By-Reference Arguments](jna/tree/master/www/ByRefArguments.md)
|
||||
* [Customization of Type Mapping](jna/tree/master/www/CustomMappings.md)
|
||||
* [Callbacks/Function Pointers/Closures](jna/tree/master/www/CallbacksAndClosures.md)
|
||||
* [Dynamically Typed Languages (JRuby/Jython)](jna/tree/master/www/DynamicallyTypedLanguages.md)
|
||||
* [Platform Library](jna/tree/master/www/PlatformLibrary.md)
|
||||
* [Direct Method Mapping](jna/tree/master/www/DirectMapping.md) (Optimization)
|
||||
* [Frequently Asked Questions (FAQ)](jna/tree/master/www/FrequentlyAskedQuestions.md)
|
||||
* [Setting up a Windows Development Environment](jna/tree/master/www/WindowsDevelopmentEnvironment.md)
|
||||
* [Avoiding Crashes](http://twall.github.com/jna/3.4.2/javadoc/overview-summary.html#crash-protection)
|
||||
* [Getting Started](https://github.com/twall/jna/blob/master/www/GettingStarted.md)
|
||||
* [Mapping between Java and Native](https://github.com/twall/jna/blob/master/www/Mappings.md)
|
||||
* [Using Pointers and Arrays](https://github.com/twall/jna/blob/master/www/PointersAndArrays.md)
|
||||
* [Using Structures and Unions](https://github.com/twall/jna/blob/master/www/StructuresAndUnions.md)
|
||||
* [Using By-Reference Arguments](https://github.com/twall/jna/blob/master/www/ByRefArguments.md)
|
||||
* [Customization of Type Mapping](https://github.com/twall/jna/blob/master/www/CustomMappings.md)
|
||||
* [Callbacks/Function Pointers/Closures](https://github.com/twall/jna/blob/master/www/CallbacksAndClosures.md)
|
||||
* [Dynamically Typed Languages (JRuby/Jython)](https://github.com/twall/jna/blob/master/www/DynamicallyTypedLanguages.md)
|
||||
* [Platform Library](https://github.com/twall/jna/blob/master/www/PlatformLibrary.md)
|
||||
* [Direct Method Mapping](https://github.com/twall/jna/blob/master/www/DirectMapping.md) (Optimization)
|
||||
* [Frequently Asked Questions (FAQ)](https://github.com/twall/jna/blob/master/www/FrequentlyAskedQuestions.md)
|
||||
* [Avoiding Crashes](http://twall.github.com/jna/3.5.0/javadoc/overview-summary.html#crash-protection)
|
||||
|
||||
Primary Documentation (JavaDoc)
|
||||
===============================
|
||||
|
||||
The definitive JNA reference is in the [JavaDoc](http://twall.github.com/jna/3.4.2/javadoc/).
|
||||
The definitive JNA reference is in the [JavaDoc](http://twall.github.com/jna/3.5.0/javadoc/).
|
||||
|
||||
Developers
|
||||
==========
|
||||
|
||||
* [Contributing to JNA](https://github.com/twall/jna/blob/master/www/Contributing.md).
|
||||
* [Setting up a Windows Development Environment](https://github.com/twall/jna/blob/master/www/WindowsDevelopmentEnvironment.md)
|
||||
* [Setting up an Android Development Environment](https://github.com/twall/jna/blob/master/www/AndroidDevelopmentEnvironment.md)
|
||||
* [Releasing JNA](https://github.com/twall/jna/blob/master/www/ReleasingJNA.md)
|
||||
* [Publishing to Maven Central](https://github.com/twall/jna/blob/master/www/PublishingToMavenCentral.md)
|
||||
|
||||
Contributing
|
||||
============
|
||||
|
||||
You're encouraged to contribute to JNA. Fork the code from [github.com/twall/jna](https://github.com/twall/jna) and submit pull requests.
|
||||
You're encouraged to contribute to JNA. Fork the code from [https://github.com/twall/jna](https://github.com/twall/jna) and submit pull requests.
|
||||
|
||||
For more informationon setting up a development environment see [Contributing to JNA](jna/tree/master/www/Contributing.md).
|
||||
For more information on setting up a development environment see [Contributing to JNA](https://github.com/twall/jna/blob/master/www/Contributing.md).
|
||||
|
||||
If you are interested in paid support, feel free to say so on the [jna-users mailing list](http://groups.google.com/group/jna-users). Most simple questions will be answered on the list, but more complicated work, new features or target platforms can be negotiated with any of the JNA developers (this is how several of JNA's features came into being). You may even encounter other users with the same need and be able to cost share the new development.
|
||||
|
||||
@@ -107,4 +110,3 @@ License
|
||||
This library is provided under the LGPL, version 2.1 or later. Alternative license arrangements are negotiable.
|
||||
|
||||
*NOTE: Oracle is not sponsoring this project, even though the package name (com.sun.jna) might imply otherwise.*
|
||||
|
||||
|
||||
+287
-220
@@ -9,7 +9,8 @@
|
||||
support it).
|
||||
|
||||
Cross-compile by specifying -Dos.prefix={name-arch} to ant
|
||||
(cross-compile currently only configured/tested on w32ce-arm)
|
||||
(cross-compile currently only configured/tested on w32ce-arm and
|
||||
android-arm)
|
||||
|
||||
Use -Dskip-native to skip building native parts.
|
||||
Use -Dheadless to run tests headless
|
||||
@@ -28,6 +29,7 @@
|
||||
<!-- (all build-related props should go in -dynamic-properties) -->
|
||||
<property name="name" value="jna"/>
|
||||
<property name="jar" value="${name}.jar"/>
|
||||
<property name="minjar" value="${name}-min.jar"/>
|
||||
<property name="testjar" value="${name}-test.jar"/>
|
||||
<property name="debug" value="true"/>
|
||||
<property name="debug.native" value="false"/>
|
||||
@@ -49,17 +51,17 @@
|
||||
<buildnumber/>
|
||||
<!-- JNA library release version -->
|
||||
<property name="jna.major" value="3"/>
|
||||
<property name="jna.minor" value="4"/>
|
||||
<property name="jna.revision" value="2"/>
|
||||
<property name="jna.minor" value="5"/>
|
||||
<property name="jna.revision" value="0"/>
|
||||
<property name="jna.build" value="${build.number}"/>
|
||||
<property name="jna.version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
|
||||
<!-- jnidispatch library release version -->
|
||||
<property name="jni.major" value="3"/>
|
||||
<property name="jni.minor" value="4"/>
|
||||
<property name="jni.minor" value="5"/>
|
||||
<property name="jni.revision" value="0"/>
|
||||
<property name="jni.build" value="${build.number}"/>
|
||||
<property name="jni.version" value="${jni.major}.${jni.minor}.${jni.revision}"/>
|
||||
<property name="jni.md5" value="4c69bcf40b30785215211b5a5dad211e"/>
|
||||
<property name="jni.md5" value="60417f69d77e4d8d693b43391a4a5b91"/>
|
||||
<property name="spec.title" value="Java Native Access (JNA)"/>
|
||||
<property name="spec.vendor" value="${vendor}"/>
|
||||
<property name="spec.version" value="${jna.major}"/>
|
||||
@@ -73,31 +75,32 @@
|
||||
<condition property="test.compatibility" value="1.4">
|
||||
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
||||
</condition>
|
||||
<condition property="tests.exclude-patterns" value="**/VarArgsTest.java,**/AnnotatedLibraryTest.java,**/WebStartTest.java,**/PointerBufferTest.java,**/HeadlessLoadLibraryTest.java,**/StructureBufferFieldTest.java,**/PerformanceTest.java,**/*BufferArgumentsMarshalTest.java">
|
||||
<condition property="tests.exclude-patterns" value="**/VarArgsTest.java,**/AnnotatedLibraryTest.java,**/WebStartTest.java,**/PointerBufferTest.java,**/HeadlessLoadLibraryTest.java,**/StructureBufferFieldTest.java,**/PerformanceTest.java,**/*BufferArgumentsMarshalTest.java" else="**/wince/*.java">
|
||||
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
||||
</condition>
|
||||
<property name="test.compatibility" value="1.5"/>
|
||||
<property name="dist-jar" value="${dist}/jna.jar"/>
|
||||
<property name="dist-jar" value="${dist}/${jar}"/>
|
||||
|
||||
<!-- Maven -->
|
||||
<!-- define Maven coordinates -->
|
||||
<property name="groupId" value="net.java.dev.jna" />
|
||||
<property name="artifactId" value="jna" />
|
||||
<property name="version" value="${jna.major}.${jna.minor}.${jna.revision}" />
|
||||
|
||||
<property name="maven-javadoc-jar" value="${dist}/${artifactId}-${version}-javadoc.jar" />
|
||||
<property name="maven-sources-jar" value="${dist}/src-mvn.zip" />
|
||||
<property name="maven-javadoc-jar" value="${dist}/${artifactId}-${jna.version}-javadoc.jar" />
|
||||
<property name="maven-sources-jar" value="${dist}/${artifactId}-${jna.version}-sources.jar" />
|
||||
|
||||
<property name="platform-jar" value="${dist}/platform.jar"/>
|
||||
<property name="platform-javadoc-jar" value="${dist}/platforms-javadoc.jar" />
|
||||
<property name="platform-sources-jar" value="${dist}/platforms-sources.jar" />
|
||||
<property name="platform-javadoc-jar" value="${dist}/platform-${jna.version}-javadoc.jar" />
|
||||
<property name="platform-sources-jar" value="${dist}/platform-${jna.version}-sources.jar" />
|
||||
|
||||
<property name="pom" value="pom-jna.xml" />
|
||||
<property name="pom-platform" value="pom-platform.xml" />
|
||||
|
||||
<!-- defined maven snapshots and staging repository id and url -->
|
||||
<property name="maven-snapshots-repository-id" value="snapshots.java.net" />
|
||||
<property name="maven-snapshots-repository-url" value="https://maven.java.net/content/repositories/snapshots" />
|
||||
<property name="maven-snapshots-repository-url" value="https://maven.java.net/content/repositories/snapshots/" />
|
||||
<property name="maven-staging-repository-id" value="staging.java.net" />
|
||||
<property name="maven-staging-repository-url" value="https://maven.java.net/service/local/staging/deploy/maven2" />
|
||||
<property name="maven-staging-repository-url" value="https://maven.java.net/service/local/staging/deploy/maven2/" />
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<property name="build.compiler.emacs" value="true"/>
|
||||
@@ -113,6 +116,11 @@
|
||||
<replaceregexp match="(<version>).*(</version>)"
|
||||
replace="\1${jna.version}\2"
|
||||
file="${pom}"/>
|
||||
|
||||
<replaceregexp match="(<version>).*(</version>)"
|
||||
replace="\1${jna.version}\2"
|
||||
file="${pom-platform}"/>
|
||||
|
||||
<replaceregexp match='VERSION = ".*";'
|
||||
replace='VERSION = "${jna.version}";'
|
||||
file="src/com/sun/jna/Native.java"/>
|
||||
@@ -123,16 +131,26 @@
|
||||
<condition property="jar.omitted" value="**/*jnidispatch*" else="jnilib-included">
|
||||
<isset property="omit-jnilib"/>
|
||||
</condition>
|
||||
<condition property="cross-compile" value="true">
|
||||
<isset property="os.prefix"/>
|
||||
</condition>
|
||||
<!-- Keep cross-compiled natives separate from normal builds -->
|
||||
<condition property="native.subdir" value="native-${os.prefix}" else="native">
|
||||
<isset property="cross-compile"/>
|
||||
</condition>
|
||||
<condition property="vm.arch" value="-d64" else="">
|
||||
<or>
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" trim="true"/>
|
||||
<equals arg1="${com.ibm.vm.bitmode}" arg2="64" trim="true"/>
|
||||
<os arch="x86_64"/>
|
||||
<os arch="amd64"/>
|
||||
<os arch="sparcv9"/>
|
||||
<os arch="ppc64"/>
|
||||
<os arch="ia64"/>
|
||||
</or>
|
||||
<and>
|
||||
<not><equals arg1="${os.prefix}" arg2="android-arm" trim="true"/></not>
|
||||
<or>
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" trim="true"/>
|
||||
<equals arg1="${com.ibm.vm.bitmode}" arg2="64" trim="true"/>
|
||||
<os arch="x86_64"/>
|
||||
<os arch="amd64"/>
|
||||
<os arch="sparcv9"/>
|
||||
<os arch="ppc64"/>
|
||||
<os arch="ia64"/>
|
||||
</or>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="ld.preload" value="LD_PRELOAD_64" else="LD_PRELOAD">
|
||||
<and>
|
||||
@@ -195,7 +213,7 @@
|
||||
<not><equals arg1="${libjsig}" arg2=""/></not>
|
||||
</condition>
|
||||
<property name="native.jar" value="${os.prefix}.jar"/>
|
||||
<property name="build.native" location="${build}/native"/>
|
||||
<property name="build.native" location="${build}/${native.subdir}"/>
|
||||
<property name="md5.file" location="${build.native}/jni.checksum"/>
|
||||
|
||||
<mkdir dir="${build}"/>
|
||||
@@ -211,6 +229,10 @@
|
||||
<echo>java.home=${java.home}</echo>
|
||||
<echo>java.library.path=${java.library.path}</echo>
|
||||
<echo>os.prefix=${os.prefix}</echo>
|
||||
<echo>os.name=${os.name}</echo>
|
||||
<echo>os.arch=${os.arch}</echo>
|
||||
<echo>build=${build}</echo>
|
||||
<echo>build.native=${build.native}</echo>
|
||||
|
||||
</target>
|
||||
|
||||
@@ -251,6 +273,7 @@
|
||||
<uptodate property="-jar" targetfile="${build}/${jar}">
|
||||
<srcfiles dir="${classes}">
|
||||
<patternset id="jar-compiled">
|
||||
<include name="lib/armeabi/*"/>
|
||||
<include name="com/sun/jna/*"/>
|
||||
<include name="com/sun/jna/**/*"/>
|
||||
</patternset>
|
||||
@@ -259,7 +282,10 @@
|
||||
</target>
|
||||
<target name="jar" depends="-setup,native,:jar" unless="-jar"
|
||||
description="Build primary jar">
|
||||
<jar jarfile="${build}/${jar}">
|
||||
<!-- Bundle native components with primary jar to facilitate
|
||||
easy distribution to common platforms.
|
||||
-->
|
||||
<jar jarfile="${build}/${jar}" duplicate="preserve">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="com.sun.jna.Native"/>
|
||||
<attribute name="Manifest-Version" value="1.0"/>
|
||||
@@ -269,11 +295,134 @@
|
||||
<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"/>
|
||||
<attribute name="Bundle-Description" value="JNA Library"/>
|
||||
<attribute name="Bundle-SymbolicName" value="com.sun.jna"/>
|
||||
<attribute name="Bundle-Version" value="${spec.version}"/>
|
||||
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.4"/>
|
||||
<attribute name="Bundle-Vendor" value="${vendor}"/>
|
||||
<attribute name="Bundle-ActivationPolicy" value="lazy"/>
|
||||
<attribute name="Export-Package" value="com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32"/>
|
||||
<!-- Note that no terminal "*" is included in this list,
|
||||
which will force failure on unsupported platforms.
|
||||
-->
|
||||
<attribute name="Bundle-NativeCode"
|
||||
value="
|
||||
com/sun/jna/win32-x86/jnidispatch.dll;
|
||||
processor=x86;osname=win32,
|
||||
com/sun/jna/win32-amd64/jnidispatch.dll;
|
||||
processor=x86-64;osname=win32,
|
||||
com/sun/jna/w32ce-arm/jnidispatch.dll;
|
||||
processor=arm;osname=wince,
|
||||
|
||||
com/sun/jna/sunos-x86/libjnidispatch.so;
|
||||
processor=x86;osname=sunos,
|
||||
com/sun/jna/sunos-amd64/libjnidispatch.so;
|
||||
processor=x86-64;osname=sunos,
|
||||
com/sun/jna/sunos-sparc/libjnidispatch.so;
|
||||
processor=sparc;osname=sunos,
|
||||
com/sun/jna/sunos-sparcv9/libjnidispatch.so;
|
||||
processor=sparcv9;osname=sunos,
|
||||
|
||||
com/sun/jna/aix-ppc/libjnidispatch.a;
|
||||
processor=ppc;osname=aix,
|
||||
com/sun/jna/aix-ppc64/libjnidispatch.a;
|
||||
processor=ppc64;osname=aix,
|
||||
|
||||
com/sun/jna/linux-ppc/libjnidispatch.so;
|
||||
processor=ppc;osname=linux,
|
||||
com/sun/jna/linux-ppc64/libjnidispatch.so;
|
||||
processor=ppc64;osname=linux,
|
||||
com/sun/jna/linux-i386/libjnidispatch.so;
|
||||
processor=x86;osname=linux,
|
||||
com/sun/jna/linux-amd64/libjnidispatch.so;
|
||||
processor=x86-64;osname=linux,
|
||||
com/sun/jna/linux-arm/libjnidispatch.so;
|
||||
processor=arm;osname=linux,
|
||||
com/sun/jna/linux-ia64/libjnidispatch.so;
|
||||
processor=ia64;osname=linux,
|
||||
|
||||
com/sun/jna/openbsd-i386/libjnidispatch.so;
|
||||
processor=x86;osname=openbsd,
|
||||
com/sun/jna/freebsd-i386/libjnidispatch.so;
|
||||
processor=x86;osname=freebsd,
|
||||
com/sun/jna/freebsd-amd64/libjnidispatch.so;
|
||||
processor=x86-64;osname=freebsd,
|
||||
|
||||
com/sun/jna/darwin/libjnidispatch.jnilib;
|
||||
osname=macos
|
||||
"/>
|
||||
</manifest>
|
||||
<fileset dir="${classes}" excludes="${jar.omitted}">
|
||||
<patternset refid="jar-compiled"/>
|
||||
</fileset>
|
||||
<zipfileset src="${lib.native}/win32-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/win32-x86"/>
|
||||
<zipfileset src="${lib.native}/aix-ppc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/aix-ppc"/>
|
||||
<zipfileset src="${lib.native}/aix-ppc64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/aix-ppc64"/>
|
||||
<zipfileset src="${lib.native}/darwin.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/darwin"/>
|
||||
<zipfileset src="${lib.native}/linux-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-i386"/>
|
||||
<zipfileset src="${lib.native}/linux-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-amd64"/>
|
||||
<zipfileset src="${lib.native}/linux-arm.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-arm"/>
|
||||
<zipfileset src="${lib.native}/linux-ia64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-ia64"/>
|
||||
<zipfileset src="${lib.native}/linux-ppc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-ppc"/>
|
||||
<zipfileset src="${lib.native}/linux-ppc64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-ppc64"/>
|
||||
<zipfileset src="${lib.native}/sunos-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-x86"/>
|
||||
<zipfileset src="${lib.native}/sunos-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-amd64"/>
|
||||
<zipfileset src="${lib.native}/sunos-sparc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-sparc"/>
|
||||
<zipfileset src="${lib.native}/sunos-sparcv9.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-sparcv9"/>
|
||||
<zipfileset src="${lib.native}/freebsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-i386"/>
|
||||
<zipfileset src="${lib.native}/freebsd-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-amd64"/>
|
||||
<zipfileset src="${lib.native}/openbsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/openbsd-i386"/>
|
||||
<zipfileset src="${lib.native}/win32-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/win32-amd64"/>
|
||||
<zipfileset src="${lib.native}/w32ce-arm.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/w32ce-arm"/>
|
||||
</jar>
|
||||
<zip zipfile="${build}/${minjar}">
|
||||
<zipfileset src="${build}/${jar}" excludes="**/*jnidispatch*"/>
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="platform-jar" depends="jar">
|
||||
@@ -287,8 +436,7 @@
|
||||
</subant>
|
||||
<!-- Sources package as required by maven -->
|
||||
<zip zipfile="${platform-sources-jar}">
|
||||
<zipfileset dir="${src}" includes="**/*.java,**/*.html,**/*.png"/>
|
||||
<zipfileset dir="${contrib}/platform" includes="**/*.java"/>
|
||||
<zipfileset dir="${contrib}/platform/src" />
|
||||
</zip>
|
||||
<jar jarfile="${platform-javadoc-jar}">
|
||||
<fileset dir="${javadoc}" />
|
||||
@@ -308,6 +456,7 @@
|
||||
<javah classpath="${classes}" destdir="${build.native}" force="yes">
|
||||
<class name="com.sun.jna.Function"/>
|
||||
<class name="com.sun.jna.Native"/>
|
||||
<class name="com.sun.jna.win32.DLLCallback"/>
|
||||
</javah>
|
||||
<condition property="grep" value="/usr/sfw/bin/ggrep">
|
||||
<os name="SunOS"/>
|
||||
@@ -367,6 +516,7 @@
|
||||
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-amd64.jar" overwrite="true"/>
|
||||
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-sparc.jar" overwrite="true"/>
|
||||
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-sparcv9.jar" overwrite="true"/>
|
||||
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/android-arm.jar" overwrite="true"/>
|
||||
<delete failOnError="false" includeEmptyDirs="true">
|
||||
<fileset dir="${build.native}" includes="*.o,*jnidispatch*"/>
|
||||
</delete>
|
||||
@@ -412,11 +562,19 @@
|
||||
replace="CHECKSUM=${jni.md5} ${comment}"
|
||||
file="native/Makefile" byline="true"/>
|
||||
<!-- Handle cross-compilation -->
|
||||
<condition property="make.OS" value="OS=w32ce" else="IGNORE=">
|
||||
<condition property="make.OS" value="OS=w32ce">
|
||||
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
||||
</condition>
|
||||
<condition property="make.OS" value="OS=android">
|
||||
<equals arg1="${os.prefix}" arg2="android-arm"/>
|
||||
</condition>
|
||||
<property name="make.OS" value="IGNORE="/>
|
||||
<!-- Ensure Makefile ARCH property properly set -->
|
||||
<condition property="ARCH" value="arm">
|
||||
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
||||
</condition>
|
||||
<condition property="ARCH" value="arm">
|
||||
<equals arg1="${os.prefix}" arg2="w32ce-arm"/>
|
||||
<equals arg1="${os.prefix}" arg2="android-arm"/>
|
||||
</condition>
|
||||
<condition property="ARCH" value="ppc">
|
||||
<equals arg1="${os.prefix}" arg2="aix-ppc"/>
|
||||
@@ -438,19 +596,28 @@
|
||||
</condition>
|
||||
<condition property="make.SDKROOT"
|
||||
value="SDKROOT=/Developer/SDKs/MacOSX10.6.sdk">
|
||||
<available file="/Developer/SDKs/MacOSX10.6.sdk"/>
|
||||
<and>
|
||||
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
||||
<available file="/Developer/SDKs/MacOSX10.6.sdk"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="make.SDKROOT"
|
||||
value="SDKROOT=/Developer/SDKs/MacOSX10.5.sdk">
|
||||
<available file="/Developer/SDKs/MacOSX10.5.sdk"/>
|
||||
<and>
|
||||
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
||||
<available file="/Developer/SDKs/MacOSX10.5.sdk"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="make.SDKROOT"
|
||||
value="SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk" else="IGNORE=">
|
||||
<available file="/Developer/SDKs/MacOSX10.4u.sdk"/>
|
||||
<and>
|
||||
<equals arg1="${os.prefix}" arg2="darwin" trim="true"/>
|
||||
<available file="/Developer/SDKs/MacOSX10.4u.sdk"/>
|
||||
</and>
|
||||
</condition>
|
||||
<!-- Windows' drive letters and spaces in absolute paths wreak havoc on
|
||||
make -->
|
||||
<condition property="make.BUILD" value="BUILD=../${build}/native" else="BUILD=${build.native}">
|
||||
<condition property="make.BUILD" value="BUILD=../${build}/${native.subdir}" else="BUILD=${build.native}">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition property="make.PATH" value="PATH=/opt/csw/bin:/usr/sfw/bin:/usr/bin:/usr/ccs/bin" else="IGNORE=">
|
||||
@@ -470,6 +637,14 @@
|
||||
<os name="AIX"/>
|
||||
</or>
|
||||
</condition>
|
||||
<!-- Allow explicit override of make variables -->
|
||||
<condition property="make.OPTS" value="${EXTRA_MAKE_OPTS}" else="IGNORE=">
|
||||
<isset property="EXTRA_MAKE_OPTS"/>
|
||||
</condition>
|
||||
<!-- Native resource path within jna.jar -->
|
||||
<condition property="native.path" value="lib/armeabi" else="com/sun/jna/${os.prefix}">
|
||||
<equals arg1="${os.prefix}" arg2="android-arm"/>
|
||||
</condition>
|
||||
|
||||
<!-- Default make program -->
|
||||
<property name="make" value="make"/>
|
||||
@@ -486,16 +661,17 @@
|
||||
<arg value="${make.ARCH}"/>
|
||||
<arg value="${make.PATH}"/>
|
||||
<arg value="${make.OS}"/>
|
||||
<arg line="${make.OPTS}"/>
|
||||
<arg value="JNA_JNI_VERSION=${jni.version}"/>
|
||||
<arg value="CHECKSUM=${jni.md5}"/>
|
||||
</exec>
|
||||
<mkdir dir="${classes}/com/sun/jna/${os.prefix}"/>
|
||||
<copy todir="${classes}/com/sun/jna/${os.prefix}">
|
||||
<mkdir dir="${classes}/${native.path}"/>
|
||||
<copy todir="${classes}/${native.path}">
|
||||
<fileset dir="${build.native}"
|
||||
includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
</copy>
|
||||
<mkdir dir="${eclipse.classes}/com/sun/jna/${os.prefix}"/>
|
||||
<copy todir="${eclipse.classes}/com/sun/jna/${os.prefix}"
|
||||
<mkdir dir="${eclipse.classes}/${native.path}"/>
|
||||
<copy todir="${eclipse.classes}/${native.path}"
|
||||
failonerror="false">
|
||||
<fileset dir="${build.native}"
|
||||
includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
@@ -541,31 +717,38 @@
|
||||
<fileset dir="${build.native}" includes="*jnidispatch.*"/>
|
||||
</jar>
|
||||
<signjar alias="jna" keystore="jna.keystore" storepass="jnadev" lazy="true">
|
||||
<fileset dir="${build}/jws" includes="jna.jar,jna-test.jar,junit.jar,jnidispatch.jar,clover.jar"/>
|
||||
<fileset dir="${build}/jws" includes="${jar},${testjar},junit.jar,jnidispatch.jar,clover.jar"/>
|
||||
</signjar>
|
||||
</target>
|
||||
|
||||
<target name="android-test-setup" depends="compile-tests"
|
||||
description="Configure tests for running on an Android emulator">
|
||||
<!-- 'shared' should be the path to a folder mounted as the mobile
|
||||
device/simulator storage card. -->
|
||||
<property name="shared" value="shared"/>
|
||||
</target>
|
||||
|
||||
<target name="wince-test-setup" depends="compile-tests"
|
||||
description="Configure tests for running on a Windows Mobile device">
|
||||
description="Configure tests for running on the WM emulator">
|
||||
<!-- 'shared' should be the path to a folder mounted as the mobile
|
||||
device/simulator storage card. -->
|
||||
<property name="shared" value="shared"/>
|
||||
<!-- w32ce arm testing -->
|
||||
<jar jarfile="${shared}/test.jar">
|
||||
<zipfileset src="${build}/jna.jar"/>
|
||||
<zipfileset src="${build}/jna-test.jar"/>
|
||||
<zipfileset src="${build}/${jar}"/>
|
||||
<zipfileset src="${build}/${testjar}"/>
|
||||
</jar>
|
||||
<copy todir="${shared}" file="${build}/jna.jar"/>
|
||||
<copy todir="${shared}" file="${build}/native/jnidispatch.dll"/>
|
||||
<copy todir="${shared}" file="${build}/native/testlib.dll"/>
|
||||
<copy todir="${shared}" file="${build}/native/testlib2.dll"/>
|
||||
<copy todir="${shared}" file="${build}/${jar}"/>
|
||||
<copy todir="${shared}" file="${build.native}/jnidispatch.dll"/>
|
||||
<copy todir="${shared}" file="${build.native}/testlib.dll"/>
|
||||
<copy todir="${shared}" file="${build.native}/testlib2.dll"/>
|
||||
<copy todir="${shared}" file="w32ce-test.lnk"/>
|
||||
<chmod file="${shared}/*.dll" perm="+x"/>
|
||||
</target>
|
||||
|
||||
<!-- When running tests from an IDE, be sure to set jna.library.path -->
|
||||
<!-- to where the test library (testlib) is found. -->
|
||||
<target name="test" depends="jar,compile-tests"
|
||||
<target name="test" depends="jar,compile-tests" unless="cross-compile"
|
||||
description="Run all unit tests">
|
||||
<property name="test.fork" value="yes"/>
|
||||
<property name="reports.junit" location="${reports}/junit"/>
|
||||
@@ -595,10 +778,15 @@
|
||||
<property name="tests.platform" value=""/>
|
||||
<property name="tests.exclude" value=""/>
|
||||
<property name="tests.exclude-patterns" value=""/>
|
||||
<property name="headless" value="false"/>
|
||||
<condition property="java.awt.headless" value="true">
|
||||
<isset property="headless"/>
|
||||
</condition>
|
||||
<propertyset id="headless">
|
||||
<propertyref prefix="java.awt.headless"/>
|
||||
</propertyset>
|
||||
<junit fork="${test.fork}" failureproperty="testfailure" tempdir="${build}">
|
||||
<!-- optionally run headless -->
|
||||
<sysproperty key="java.awt.headless" value="${headless}"/>
|
||||
<syspropertyset refid="headless"/>
|
||||
<!-- avoid VM conflicts with JNA protected mode -->
|
||||
<env key="${ld.preload.name}" file="${libjsig}"/>
|
||||
<sysproperty key="jna.library.path" file="${build.native}"/>
|
||||
@@ -712,149 +900,11 @@
|
||||
<target name="dist" depends="jar,javadoc,contrib-jars,compile-tests,native"
|
||||
description="Build distribution files">
|
||||
<copy todir="${dist}">
|
||||
<fileset dir="${build}">
|
||||
<include name="${native.jar}"/>
|
||||
</fileset>
|
||||
<fileset dir="${build}" includes="${jar},${minjar}"/>
|
||||
<fileset dir="${contrib}/platform/dist" includes="platform.jar"/>
|
||||
<fileset dir="${lib.native}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<jar jarfile="${dist-jar}" duplicate="preserve">
|
||||
<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"/>
|
||||
<attribute name="Bundle-Description" value="JNA Library"/>
|
||||
<attribute name="Bundle-SymbolicName" value="com.sun.jna"/>
|
||||
<attribute name="Bundle-Version" value="${spec.version}"/>
|
||||
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.4"/>
|
||||
<attribute name="Bundle-Vendor" value="${vendor}"/>
|
||||
<attribute name="Bundle-ActivationPolicy" value="lazy"/>
|
||||
<attribute name="Export-Package" value="com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32"/>
|
||||
<!-- Note that no terminal "*" is included in this list,
|
||||
which will force failure on unsupported platforms.
|
||||
-->
|
||||
<attribute name="Bundle-NativeCode"
|
||||
value="
|
||||
com/sun/jna/win32-x86/jnidispatch.dll;
|
||||
processor=x86;osname=win32,
|
||||
com/sun/jna/win32-amd64/jnidispatch.dll;
|
||||
processor=x86-64;osname=win32,
|
||||
com/sun/jna/w32ce-arm/jnidispatch.dll;
|
||||
processor=arm;osname=wince,
|
||||
|
||||
com/sun/jna/sunos-x86/libjnidispatch.so;
|
||||
processor=x86;osname=sunos,
|
||||
com/sun/jna/sunos-amd64/libjnidispatch.so;
|
||||
processor=x86-64;osname=sunos,
|
||||
com/sun/jna/sunos-sparc/libjnidispatch.so;
|
||||
processor=sparc;osname=sunos,
|
||||
com/sun/jna/sunos-sparcv9/libjnidispatch.so;
|
||||
processor=sparcv9;osname=sunos,
|
||||
|
||||
com/sun/jna/aix-ppc/libjnidispatch.a;
|
||||
processor=ppc;osname=aix,
|
||||
com/sun/jna/aix-ppc64/libjnidispatch.a;
|
||||
processor=ppc64;osname=aix,
|
||||
|
||||
com/sun/jna/linux-ppc/libjnidispatch.so;
|
||||
processor=ppc;osname=linux,
|
||||
com/sun/jna/linux-ppc64/libjnidispatch.so;
|
||||
processor=ppc64;osname=linux,
|
||||
com/sun/jna/linux-i386/libjnidispatch.so;
|
||||
processor=x86;osname=linux,
|
||||
com/sun/jna/linux-amd64/libjnidispatch.so;
|
||||
processor=x86-64;osname=linux,
|
||||
com/sun/jna/linux-arm/libjnidispatch.so;
|
||||
processor=arm;osname=linux,
|
||||
com/sun/jna/linux-ia64/libjnidispatch.so;
|
||||
processor=ia64;osname=linux,
|
||||
|
||||
com/sun/jna/openbsd-i386/libjnidispatch.so;
|
||||
processor=x86;osname=openbsd,
|
||||
com/sun/jna/freebsd-i386/libjnidispatch.so;
|
||||
processor=x86;osname=freebsd,
|
||||
com/sun/jna/freebsd-amd64/libjnidispatch.so;
|
||||
processor=x86-64;osname=freebsd,
|
||||
|
||||
com/sun/jna/darwin/libjnidispatch.jnilib;
|
||||
osname=macos
|
||||
"/>
|
||||
</manifest>
|
||||
<zipfileset src="${build}/${jar}"/>
|
||||
<zipfileset src="${lib.native}/win32-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/win32-x86"/>
|
||||
<zipfileset src="${lib.native}/aix-ppc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/aix-ppc"/>
|
||||
<zipfileset src="${lib.native}/aix-ppc64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/aix-ppc64"/>
|
||||
<zipfileset src="${lib.native}/darwin.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/darwin"/>
|
||||
<zipfileset src="${lib.native}/linux-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-i386"/>
|
||||
<zipfileset src="${lib.native}/linux-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-amd64"/>
|
||||
<zipfileset src="${lib.native}/linux-arm.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-arm"/>
|
||||
<zipfileset src="${lib.native}/linux-ia64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-ia64"/>
|
||||
<zipfileset src="${lib.native}/linux-ppc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-ppc"/>
|
||||
<zipfileset src="${lib.native}/linux-ppc64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-ppc64"/>
|
||||
<zipfileset src="${lib.native}/sunos-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-x86"/>
|
||||
<zipfileset src="${lib.native}/sunos-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-amd64"/>
|
||||
<zipfileset src="${lib.native}/sunos-sparc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-sparc"/>
|
||||
<zipfileset src="${lib.native}/sunos-sparcv9.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-sparcv9"/>
|
||||
<zipfileset src="${lib.native}/freebsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-i386"/>
|
||||
<zipfileset src="${lib.native}/freebsd-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-amd64"/>
|
||||
<zipfileset src="${lib.native}/openbsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/openbsd-i386"/>
|
||||
<zipfileset src="${lib.native}/win32-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/win32-amd64"/>
|
||||
<zipfileset src="${lib.native}/w32ce-arm.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/w32ce-arm"/>
|
||||
</jar>
|
||||
<copy todir="${dist}">
|
||||
<fileset dir="${contrib}/platform/dist">
|
||||
<include name="platform.jar" />
|
||||
<exclude name="out-of-date.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${dist}/jnacontrib" flatten="true">
|
||||
@@ -887,8 +937,7 @@ osname=macos
|
||||
</zip>
|
||||
<!-- Sources package as required by maven -->
|
||||
<zip zipfile="${maven-sources-jar}">
|
||||
<zipfileset dir="${src}" includes="**/*.java,**/*.html,**/*.png"/>
|
||||
<zipfileset dir="${contrib}/platform" includes="**/*.java"/>
|
||||
<zipfileset dir="${src}" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
@@ -906,79 +955,97 @@ osname=macos
|
||||
</subant>
|
||||
</target>
|
||||
|
||||
<target name="deploy" depends="dist,platform-jar" description="deploy snapshot version to Maven snapshot repository">
|
||||
<artifact:mvn>
|
||||
|
||||
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
|
||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
|
||||
uri="antlib:org.apache.maven.artifact.ant"
|
||||
classpathref="maven-ant-tasks.classpath" />
|
||||
|
||||
<!-- NOTE: The 'deploy' target works only if the version (jna.version in build.xml) ends in '-SNAPSHOT'. -->
|
||||
<target name="deploy" depends="dist" description="deploy snapshot version to Maven snapshot repository">
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file"/>
|
||||
<arg value="-Durl=${maven-snapshots-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-snapshots-repository-id}"/>
|
||||
<arg value="-DpomFile=${pom}"/>
|
||||
<arg value="-Dfile=${dist-jar}"/>
|
||||
</artifact:mvn>
|
||||
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file"/>
|
||||
<arg value="-Durl=${maven-snapshots-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-snapshots-repository-id}"/>
|
||||
<arg value="-DpomFile=${pom-platform}"/>
|
||||
<arg value="-Dfile=${platform-jar}"/>
|
||||
</artifact:mvn>
|
||||
</target>
|
||||
|
||||
<!-- before this, update project version (both build.xml and ${pom}) from SNAPSHOT to RELEASE -->
|
||||
|
||||
<property name="version-maven-gpg-plugin" value="1.4"/>
|
||||
|
||||
<target name="stage" depends="dist" description="deploy release version to Maven staging repository">
|
||||
<!-- sign and deploy the main artifact -->
|
||||
<artifact:mvn>
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file"/>
|
||||
<!-- sign and deploy the jna artifact -->
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
||||
<arg value="-Durl=${maven-staging-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
||||
<arg value="-DpomFile=${pom}"/>
|
||||
<arg value="-Dfile=${dist-jar}"/>
|
||||
<arg value="-Pgpg"/>
|
||||
<arg value="-Dgpg.useagent=true"/>
|
||||
</artifact:mvn>
|
||||
|
||||
<!-- sign and deploy the sources artifact -->
|
||||
<artifact:mvn>
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file"/>
|
||||
<!-- sign and deploy the jna sources artifact -->
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
||||
<arg value="-Durl=${maven-staging-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
||||
<arg value="-DpomFile=${pom}"/>
|
||||
<arg value="-Dfile=${maven-sources-jar}"/>
|
||||
<arg value="-Dclassifier=sources"/>
|
||||
<arg value="-Pgpg"/>
|
||||
<arg value="-Dgpg.useagent=true"/>
|
||||
</artifact:mvn>
|
||||
|
||||
<!-- sign and deploy the javadoc artifact -->
|
||||
<artifact:mvn>
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file"/>
|
||||
<!-- sign and deploy the jna javadoc artifact -->
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
||||
<arg value="-Durl=${maven-staging-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
||||
<arg value="-DpomFile=${pom}"/>
|
||||
<arg value="-Dfile=${maven-javadoc-jar}"/>
|
||||
<arg value="-Dclassifier=javadoc"/>
|
||||
<arg value="-Pgpg"/>
|
||||
<arg value="-Dgpg.useagent=true"/>
|
||||
</artifact:mvn>
|
||||
|
||||
<artifact:mvn>
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file"/>
|
||||
<!-- sign and deploy the platform artifact -->
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
||||
<arg value="-Durl=${maven-staging-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
||||
<arg value="-DpomFile=pom-platform.xml"/>
|
||||
<arg value="-DpomFile=${pom-platform}"/>
|
||||
<arg value="-Dfile=${platform-jar}"/>
|
||||
<arg value="-Pgpg"/>
|
||||
<arg value="-Dgpg.useagent=true"/>
|
||||
</artifact:mvn>
|
||||
|
||||
<!-- sign and deploy the sources artifact -->
|
||||
<artifact:mvn>
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file"/>
|
||||
<!-- sign and deploy the platform sources artifact -->
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
||||
<arg value="-Durl=${maven-staging-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
||||
<arg value="-DpomFile=pom-platform.xml"/>
|
||||
<arg value="-DpomFile=${pom-platform}"/>
|
||||
<arg value="-Dfile=${platform-sources-jar}"/>
|
||||
<arg value="-Dclassifier=sources"/>
|
||||
<arg value="-Pgpg"/>
|
||||
<arg value="-Dgpg.useagent=true"/>
|
||||
</artifact:mvn>
|
||||
|
||||
<!-- sign and deploy the javadoc artifact -->
|
||||
<artifact:mvn>
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file"/>
|
||||
<!-- sign and deploy the platform javadoc artifact -->
|
||||
<artifact:mvn failonerror="true">
|
||||
<arg value="org.apache.maven.plugins:maven-gpg-plugin:${version-maven-gpg-plugin}:sign-and-deploy-file"/>
|
||||
<arg value="-Durl=${maven-staging-repository-url}"/>
|
||||
<arg value="-DrepositoryId=${maven-staging-repository-id}"/>
|
||||
<arg value="-DpomFile=pom-platform.xml"/>
|
||||
<arg value="-DpomFile=${pom-platform}"/>
|
||||
<arg value="-Dfile=${platform-javadoc-jar}"/>
|
||||
<arg value="-Dclassifier=javadoc"/>
|
||||
<arg value="-Pgpg"/>
|
||||
<arg value="-Dgpg.useagent=true"/>
|
||||
</artifact:mvn>
|
||||
|
||||
</target>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-alphamask.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.AlphaMaskDemo" />
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
@@ -45,29 +43,24 @@
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-balloonmanager.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.BalloonManagerDemo" />
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
@@ -45,29 +43,26 @@
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-balloontips.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.FilteredTextField" />
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
@@ -45,29 +43,26 @@
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-dnd.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.GhostedDragImageDemo" />
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
@@ -45,29 +43,26 @@
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -9,204 +9,188 @@
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.ptr.*;
|
||||
import com.sun.jna.win32.*;
|
||||
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);
|
||||
public interface Advapi32 extends StdCallLibrary {
|
||||
Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32",
|
||||
Advapi32.class, W32APIOptions.UNICODE_OPTIONS);
|
||||
|
||||
interface SERVICE_MAIN_FUNCTION extends StdCallCallback {
|
||||
/*
|
||||
VOID WINAPI ServiceMain(
|
||||
DWORD dwArgc,
|
||||
LPTSTR* lpszArgv
|
||||
);*/
|
||||
public void callback(int dwArgc, Pointer lpszArgv);
|
||||
}
|
||||
* SC_HANDLE WINAPI OpenSCManager( LPCTSTR lpMachineName, LPCTSTR
|
||||
* lpDatabaseName, DWORD dwDesiredAccess );
|
||||
*/
|
||||
public Pointer OpenSCManager(String lpMachineName, WString lpDatabaseName,
|
||||
int dwDesiredAccess);
|
||||
|
||||
interface Handler extends StdCallCallback {
|
||||
/*
|
||||
VOID WINAPI Handler(
|
||||
DWORD fdwControl
|
||||
);*/
|
||||
public void callback(int fdwControl);
|
||||
}
|
||||
|
||||
interface HandlerEx extends StdCallCallback {
|
||||
* BOOL WINAPI CloseServiceHandle( SC_HANDLE hSCObject );
|
||||
*/
|
||||
public boolean CloseServiceHandle(Pointer hSCObject);
|
||||
|
||||
/*
|
||||
DWORD WINAPI HandlerEx(
|
||||
DWORD dwControl,
|
||||
DWORD dwEventType,
|
||||
LPVOID lpEventData,
|
||||
LPVOID lpContext
|
||||
);*/
|
||||
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext);
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_STATUS {
|
||||
DWORD dwServiceType;
|
||||
DWORD dwCurrentState;
|
||||
DWORD dwControlsAccepted;
|
||||
DWORD dwWin32ExitCode;
|
||||
DWORD dwServiceSpecificExitCode;
|
||||
DWORD dwCheckPoint;
|
||||
DWORD dwWaitHint;
|
||||
} SERVICE_STATUS,
|
||||
*LPSERVICE_STATUS;*/
|
||||
public static class SERVICE_STATUS extends Structure {
|
||||
public int dwServiceType;
|
||||
public int dwCurrentState;
|
||||
public int dwControlsAccepted;
|
||||
public int dwWin32ExitCode;
|
||||
public int dwServiceSpecificExitCode;
|
||||
public int dwCheckPoint;
|
||||
public int dwWaitHint;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_TABLE_ENTRY {
|
||||
LPTSTR lpServiceName;
|
||||
LPSERVICE_MAIN_FUNCTION lpServiceProc;
|
||||
} SERVICE_TABLE_ENTRY,
|
||||
*LPSERVICE_TABLE_ENTRY;*/
|
||||
public static class SERVICE_TABLE_ENTRY extends Structure {
|
||||
public String lpServiceName;
|
||||
public SERVICE_MAIN_FUNCTION lpServiceProc;
|
||||
}
|
||||
|
||||
public static class ChangeServiceConfig2Info extends Structure {
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_DESCRIPTION {
|
||||
LPTSTR lpDescription;
|
||||
} SERVICE_DESCRIPTION,
|
||||
*LPSERVICE_DESCRIPTION;*/
|
||||
public static class SERVICE_DESCRIPTION extends ChangeServiceConfig2Info {
|
||||
public String lpDescription;
|
||||
}
|
||||
* 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" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
|
||||
package com.sun.jna.platform.mac;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Callback;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/**
|
||||
* Author: Denis Tulskiy
|
||||
* Date: 7/25/11
|
||||
@@ -70,7 +72,8 @@ public interface Carbon {
|
||||
public class EventTypeSpec extends Structure {
|
||||
public int eventClass;
|
||||
public int eventKind;
|
||||
{ setFieldOrder(new String[] { "eventClass", "eventKind" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "eventClass", "eventKind" }); }
|
||||
}
|
||||
|
||||
public static class EventHotKeyID extends Structure {
|
||||
@@ -78,7 +81,8 @@ public interface Carbon {
|
||||
public int id;
|
||||
|
||||
public static class ByValue extends EventHotKeyID implements Structure.ByValue { }
|
||||
{ setFieldOrder(new String[] { "signature", "id" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "signature", "id" }); }
|
||||
}
|
||||
|
||||
public static interface EventHandlerProcPtr extends Callback {
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.unix;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Callback;
|
||||
import com.sun.jna.FromNativeContext;
|
||||
import com.sun.jna.Library;
|
||||
@@ -277,7 +280,9 @@ public interface X11 extends Library {
|
||||
public short green, greenMask;
|
||||
public short blue, blueMask;
|
||||
public short alpha, alphaMask;
|
||||
{ setFieldOrder(new String[] { "red", "redMask", "green", "greenMask", "blue", "blueMask", "alpha", "alphaMask" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "red", "redMask", "green", "greenMask", "blue", "blueMask", "alpha", "alphaMask" });
|
||||
}
|
||||
}
|
||||
class PictFormat extends NativeLong {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -290,7 +295,9 @@ public interface X11 extends Library {
|
||||
public int depth;
|
||||
public XRenderDirectFormat direct;
|
||||
public Colormap colormap;
|
||||
{ setFieldOrder(new String[] { "id", "type", "depth", "direct", "colormap" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "id", "type", "depth", "direct", "colormap" });
|
||||
}
|
||||
}
|
||||
int PictTypeIndexed = 0x0;
|
||||
int PictTypeDirect = 0x1;
|
||||
@@ -339,14 +346,18 @@ public interface X11 extends Library {
|
||||
class XInputClassInfoByReference extends Structure implements Structure.ByReference {
|
||||
public byte input_class;
|
||||
public byte event_type_base;
|
||||
{ setFieldOrder(new String[] { "input_class", "event_type_base" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "input_class", "event_type_base" });
|
||||
}
|
||||
}
|
||||
|
||||
class XDeviceByReference extends Structure implements Structure.ByReference {
|
||||
public XID device_id;
|
||||
public int num_classes;
|
||||
public XInputClassInfoByReference classes;
|
||||
{ setFieldOrder(new String[] { "device_id", "num_classes", "classes" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "device_id", "num_classes", "classes" });
|
||||
}
|
||||
}
|
||||
|
||||
X11 INSTANCE = (X11)Native.loadLibrary("X11", X11.class);
|
||||
@@ -374,7 +385,9 @@ public interface X11 extends Library {
|
||||
public int icon_x, icon_y;
|
||||
public Pixmap icon_mask;
|
||||
public XID window_group;
|
||||
{ setFieldOrder(new String[] { "flags", "input", "initial_state", "icon_pixmap", "icon_window", "icon_x", "icon_y", "icon_mask", "window_group" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "flags", "input", "initial_state", "icon_pixmap", "icon_window", "icon_x", "icon_y", "icon_mask", "window_group" });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -390,7 +403,9 @@ public interface X11 extends Library {
|
||||
public Atom encoding;
|
||||
public int format;
|
||||
public NativeLong nitems;
|
||||
{ setFieldOrder(new String[] { "value", "encoding", "format", "nitems" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "value", "encoding", "format", "nitems" });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -419,12 +434,14 @@ public interface X11 extends Library {
|
||||
public static class Aspect extends Structure {
|
||||
public int x; // numerator
|
||||
public int y; // denominator
|
||||
{ setFieldOrder(new String[] { "x", "y" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y" }); }
|
||||
}
|
||||
public Aspect min_aspect, max_aspect;
|
||||
public int base_width, base_height;
|
||||
public int win_gravity;
|
||||
{ setFieldOrder(new String[] { "flags", "x", "y", "width", "height", "min_width", "min_height", "max_width", "max_height", "width_inc", "height_inc", "min_aspect", "max_aspect", "base_width", "base_height", "win_gravity" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "flags", "x", "y", "width", "height", "min_width", "min_height", "max_width", "max_height", "width_inc", "height_inc", "min_aspect", "max_aspect", "base_width", "base_height", "win_gravity" }); }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -478,7 +495,9 @@ public interface X11 extends Library {
|
||||
public NativeLong do_not_propagate_mask;
|
||||
public boolean override_redirect;
|
||||
public Screen screen;
|
||||
{ setFieldOrder(new String[] { "x", "y", "width", "height", "border_width", "depth", "visual", "root", "c_class", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "colormap", "map_installed", "map_state", "all_event_masks", "your_event_mask", "do_not_propagate_mask", "override_redirect", "screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y", "width", "height", "border_width", "depth", "visual", "root", "c_class", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "colormap", "map_installed", "map_state", "all_event_masks", "your_event_mask", "do_not_propagate_mask", "override_redirect", "screen" });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -516,7 +535,9 @@ public interface X11 extends Library {
|
||||
public boolean override_redirect;
|
||||
public Colormap colormap;
|
||||
public Cursor cursor;
|
||||
{ setFieldOrder(new String[] { "background_pixmap", "background_pixel", "border_pixmap", "border_pixel", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "event_mask", "do_not_propagate_mask", "override_redirect", "colormap", "cursor" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "background_pixmap", "background_pixel", "border_pixmap", "border_pixel", "bit_gravity", "win_gravity", "backing_store", "backing_planes", "backing_pixel", "save_under", "event_mask", "do_not_propagate_mask", "override_redirect", "colormap", "cursor" });
|
||||
}
|
||||
}
|
||||
|
||||
int XK_0 = 0x30;
|
||||
@@ -559,25 +580,31 @@ public interface X11 extends Library {
|
||||
public NativeLong blue_mask;
|
||||
public int colormap_size;
|
||||
public int bits_per_rgb;
|
||||
{ setFieldOrder(new String[] { "visual", "visualid", "screen", "depth", "c_class", "red_mask", "green_mask", "blue_mask", "colormap_size", "bits_per_rgb" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "visual", "visualid", "screen", "depth", "c_class", "red_mask", "green_mask", "blue_mask", "colormap_size", "bits_per_rgb" });
|
||||
}
|
||||
}
|
||||
class XPoint extends Structure {
|
||||
public short x, y;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y" });
|
||||
}
|
||||
public XPoint() { this((short)0, (short)0); }
|
||||
public XPoint(short x, short y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
setFieldOrder(new String[] { "x", "y" });
|
||||
}
|
||||
}
|
||||
class XRectangle extends Structure {
|
||||
public short x, y;
|
||||
public short width, height;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y", "width", "height" });
|
||||
}
|
||||
public XRectangle() { this((short)0, (short)0, (short)0, (short)0); }
|
||||
public XRectangle(short x, short y, short width, short height) {
|
||||
this.x = x; this.y = y;
|
||||
this.width = width; this.height = height;
|
||||
setFieldOrder(new String[] { "x", "y", "width", "height" });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,7 +745,9 @@ public interface X11 extends Library {
|
||||
public Pixmap clip_mask; /* bitmap clipping; other calls for rects */
|
||||
public int dash_offset; /* patterned/dashed line information */
|
||||
public byte dashes;
|
||||
{ setFieldOrder(new String[] { "function", "plane_mask", "foreground", "background", "line_width", "line_style", "cap_style", "join_style", "fill_style", "fill_rule", "arc_mode", "tile", "stipple", "ts_x_origin", "ts_y_origin", "font", "subwindow_mode", "graphics_exposures", "clip_x_origin", "clip_y_origin", "clip_mask", "dash_offset", "dashes" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "function", "plane_mask", "foreground", "background", "line_width", "line_style", "cap_style", "join_style", "fill_style", "fill_rule", "arc_mode", "tile", "stipple", "ts_x_origin", "ts_y_origin", "font", "subwindow_mode", "graphics_exposures", "clip_x_origin", "clip_y_origin", "clip_mask", "dash_offset", "dashes" });
|
||||
}
|
||||
}
|
||||
GC XCreateGC(Display display, Drawable drawable, NativeLong mask, XGCValues values);
|
||||
int XSetFillRule(Display display, GC gc, int fill_rule);
|
||||
@@ -1344,7 +1373,9 @@ public interface X11 extends Library {
|
||||
public int send_event; // true if this came from a SendEvent request
|
||||
public Display display; // Display the event was read from
|
||||
public Window window; // window on which event was requested in event mask
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window" });
|
||||
}
|
||||
}
|
||||
|
||||
class XKeyEvent extends Structure {
|
||||
@@ -1361,7 +1392,9 @@ public interface X11 extends Library {
|
||||
public int state; // key or button mask
|
||||
public int keycode; // detail
|
||||
public int same_screen; // same screen flag
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "keycode", "same_screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "keycode", "same_screen" });
|
||||
}
|
||||
}
|
||||
|
||||
class XButtonEvent extends Structure {
|
||||
@@ -1378,7 +1411,9 @@ public interface X11 extends Library {
|
||||
public int state; // key or button mask
|
||||
public int button; // detail
|
||||
public int same_screen; // same screen flag
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "button", "same_screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "button", "same_screen" });
|
||||
}
|
||||
}
|
||||
|
||||
class XButtonPressedEvent extends XButtonEvent {
|
||||
@@ -1396,7 +1431,9 @@ public interface X11 extends Library {
|
||||
public Atom message_type;
|
||||
public int format;
|
||||
public Data data;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "message_type", "format", "data" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "message_type", "format", "data" });
|
||||
}
|
||||
|
||||
public static class Data extends Union {
|
||||
public byte b[] = new byte[20];
|
||||
@@ -1419,7 +1456,9 @@ public interface X11 extends Library {
|
||||
public int state; // key or button mask
|
||||
public byte is_hint; // detail
|
||||
public int same_screen; // same screen flag
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "is_hint", "same_screen" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "state", "is_hint", "same_screen" });
|
||||
}
|
||||
}
|
||||
|
||||
class XPointerMovedEvent extends XMotionEvent {
|
||||
@@ -1445,7 +1484,9 @@ public interface X11 extends Library {
|
||||
public int same_screen; // same screen flag
|
||||
public int focus; // boolean focus
|
||||
public int state; // key or button mask
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "mode", "detail", "same_screen", "focus", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "root", "subwindow", "time", "x", "y", "x_root", "y_root", "mode", "detail", "same_screen", "focus", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XEnterWindowEvent extends XCrossingEvent {
|
||||
@@ -1467,7 +1508,9 @@ public interface X11 extends Library {
|
||||
* NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
|
||||
* NotifyPointerRoot, NotifyDetailNone
|
||||
*/
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "mode", "detail" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "mode", "detail" });
|
||||
}
|
||||
}
|
||||
|
||||
class XFocusInEvent extends XFocusChangeEvent {
|
||||
@@ -1485,7 +1528,9 @@ public interface X11 extends Library {
|
||||
public int x, y;
|
||||
public int width, height;
|
||||
public int count; // if non-zero, at least this many more
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "count" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "count" });
|
||||
}
|
||||
}
|
||||
|
||||
class XGraphicsExposeEvent extends Structure {
|
||||
@@ -1499,7 +1544,9 @@ public interface X11 extends Library {
|
||||
public int count; // if non-zero, at least this many more
|
||||
public int major_code; // core is CopyArea or CopyPlane
|
||||
public int minor_code; // not defined in the core
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "drawable", "x", "y", "width", "height", "count", "major_code", "minor_code" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "drawable", "x", "y", "width", "height", "count", "major_code", "minor_code" });
|
||||
}
|
||||
}
|
||||
|
||||
class XNoExposeEvent extends Structure {
|
||||
@@ -1510,7 +1557,9 @@ public interface X11 extends Library {
|
||||
public Drawable drawable;
|
||||
public int major_code; // core is CopyArea or CopyPlane
|
||||
public int minor_code; // not defined in the core
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "drawable", "major_code", "minor_code" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "drawable", "major_code", "minor_code" });
|
||||
}
|
||||
}
|
||||
|
||||
class XVisibilityEvent extends Structure {
|
||||
@@ -1520,7 +1569,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window window;
|
||||
public int state; // Visibility state
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XCreateWindowEvent extends Structure {
|
||||
@@ -1534,7 +1585,9 @@ public interface X11 extends Library {
|
||||
public int width, height; // size of window
|
||||
public int border_width; // border width
|
||||
public int override_redirect; // creation should be overridden
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "parent", "window", "x", "y", "width", "height", "border_width", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window", "x", "y", "width", "height", "border_width", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XDestroyWindowEvent extends Structure {
|
||||
@@ -1544,7 +1597,8 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window event;
|
||||
public Window window;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window" }); }
|
||||
}
|
||||
|
||||
class XUnmapEvent extends Structure {
|
||||
@@ -1555,7 +1609,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int from_configure;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "from_configure" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "from_configure" });
|
||||
}
|
||||
}
|
||||
|
||||
class XMapEvent extends Structure {
|
||||
@@ -1566,7 +1622,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int override_redirect; // boolean, is override set...
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XMapRequestEvent extends Structure {
|
||||
@@ -1576,7 +1634,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window parent;
|
||||
public Window window;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window" });
|
||||
}
|
||||
}
|
||||
|
||||
class XReparentEvent extends Structure {
|
||||
@@ -1589,7 +1649,9 @@ public interface X11 extends Library {
|
||||
public Window parent;
|
||||
public int x, y;
|
||||
public int override_redirect;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XConfigureEvent extends Structure {
|
||||
@@ -1604,7 +1666,9 @@ public interface X11 extends Library {
|
||||
public int border_width;
|
||||
public Window above;
|
||||
public int override_redirect;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "border_width", "above", "override_redirect" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "border_width", "above", "override_redirect" });
|
||||
}
|
||||
}
|
||||
|
||||
class XGravityEvent extends Structure {
|
||||
@@ -1615,7 +1679,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int x, y;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y" });
|
||||
}
|
||||
}
|
||||
|
||||
class XResizeRequestEvent extends Structure {
|
||||
@@ -1625,7 +1691,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window window;
|
||||
public int width, height;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "width", "height" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "width", "height" });
|
||||
}
|
||||
}
|
||||
|
||||
class XConfigureRequestEvent extends Structure {
|
||||
@@ -1641,7 +1709,9 @@ public interface X11 extends Library {
|
||||
public Window above;
|
||||
public int detail; // Above, Below, TopIf, BottomIf, Opposite
|
||||
public NativeLong value_mask;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "above", "detail", "value_mask" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "x", "y", "width", "height", "above", "detail", "value_mask" });
|
||||
}
|
||||
}
|
||||
|
||||
class XCirculateEvent extends Structure {
|
||||
@@ -1652,7 +1722,9 @@ public interface X11 extends Library {
|
||||
public Window event;
|
||||
public Window window;
|
||||
public int place; // PlaceOnTop, PlaceOnBottom
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "event", "window", "place" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "event", "window", "place" });
|
||||
}
|
||||
}
|
||||
|
||||
class XCirculateRequestEvent extends Structure {
|
||||
@@ -1663,7 +1735,9 @@ public interface X11 extends Library {
|
||||
public Window parent;
|
||||
public Window window;
|
||||
public int place; // PlaceOnTop, PlaceOnBottom
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "parent", "window", "place" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "parent", "window", "place" });
|
||||
}
|
||||
}
|
||||
|
||||
class XPropertyEvent extends Structure {
|
||||
@@ -1675,7 +1749,9 @@ public interface X11 extends Library {
|
||||
public Atom atom;
|
||||
public NativeLong time;
|
||||
public int state; // NewValue, Deleted
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "atom", "time", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "atom", "time", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XSelectionClearEvent extends Structure {
|
||||
@@ -1686,7 +1762,9 @@ public interface X11 extends Library {
|
||||
public Window window;
|
||||
public Atom selection;
|
||||
public NativeLong time;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "selection", "time" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "selection", "time" });
|
||||
}
|
||||
}
|
||||
|
||||
class XSelectionRequestEvent extends Structure {
|
||||
@@ -1700,7 +1778,9 @@ public interface X11 extends Library {
|
||||
public Atom target;
|
||||
public Atom property;
|
||||
public NativeLong time;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "owner", "requestor", "selection", "target", "property", "time" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "owner", "requestor", "selection", "target", "property", "time" });
|
||||
}
|
||||
}
|
||||
|
||||
class XSelectionEvent extends Structure {
|
||||
@@ -1713,7 +1793,9 @@ public interface X11 extends Library {
|
||||
public Atom target;
|
||||
public Atom property; // ATOM or None
|
||||
public NativeLong time;
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "requestor", "selection", "target", "property", "time" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "requestor", "selection", "target", "property", "time" });
|
||||
}
|
||||
}
|
||||
|
||||
class XColormapEvent extends Structure {
|
||||
@@ -1725,7 +1807,9 @@ public interface X11 extends Library {
|
||||
public Colormap colormap; // COLORMAP or None
|
||||
public int c_new; // C++
|
||||
public int state; // ColormapInstalled, ColormapUninstalled
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "colormap", "c_new", "state" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "colormap", "c_new", "state" });
|
||||
}
|
||||
}
|
||||
|
||||
class XMappingEvent extends Structure {
|
||||
@@ -1737,7 +1821,9 @@ public interface X11 extends Library {
|
||||
public int request; // one of MappingModifier, MappingKeyboard, MappingPointer
|
||||
public int first_keycode; // first keycode
|
||||
public int count; // defines range of change w. first_keycode*/
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "request", "first_keycode", "count" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "request", "first_keycode", "count" });
|
||||
}
|
||||
}
|
||||
|
||||
class XErrorEvent extends Structure {
|
||||
@@ -1748,7 +1834,9 @@ public interface X11 extends Library {
|
||||
public byte request_code; // Major op-code of failed request
|
||||
public byte minor_code; // Minor op-code of failed request
|
||||
public XID resourceid; // resource id
|
||||
{ setFieldOrder(new String[] { "type", "display", "serial", "error_code", "request_code", "minor_code", "resourceid" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "display", "serial", "error_code", "request_code", "minor_code", "resourceid" });
|
||||
}
|
||||
}
|
||||
|
||||
// generated on EnterWindow and FocusIn when KeyMapState selected
|
||||
@@ -1759,7 +1847,9 @@ public interface X11 extends Library {
|
||||
public Display display; // Display the event was read from
|
||||
public Window window;
|
||||
public byte key_vector[] = new byte[32];
|
||||
{ setFieldOrder(new String[] { "type", "serial", "send_event", "display", "window", "key_vector" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "serial", "send_event", "display", "window", "key_vector" });
|
||||
}
|
||||
}
|
||||
|
||||
int XSelectInput(Display display, Window window, NativeLong eventMask);
|
||||
@@ -1904,7 +1994,9 @@ public interface X11 extends Library {
|
||||
class XModifierKeymapRef extends Structure implements Structure.ByReference{
|
||||
public int max_keypermod; /* The server's max # of keys per modifier */
|
||||
public Pointer modifiermap; /* An 8 by max_keypermod array of modifiers */
|
||||
{ setFieldOrder(new String[] { "max_keypermod", "modifiermap" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "max_keypermod", "modifiermap" });
|
||||
}
|
||||
}
|
||||
|
||||
class XKeyboardControlRef extends Structure implements Structure.ByReference {
|
||||
@@ -1925,7 +2017,9 @@ public interface X11 extends Library {
|
||||
/** AutoRepeatModeOff, AutoRepeatModeOn, AutoRepeatModeDefault. */
|
||||
public int auto_repeat_mode;
|
||||
|
||||
{ setFieldOrder(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led", "led_mode", "key", "auto_repeat_mode" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led", "led_mode", "key", "auto_repeat_mode" });
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "XKeyboardControlByReference{" +
|
||||
@@ -1957,7 +2051,9 @@ public interface X11 extends Library {
|
||||
/** Bit vector. Each bit set to 1 indicates that auto-repeat is enabled for the corresponding key. The vector is represented as 32 bytes. Byte N (from 0) contains the bits for keys 8N to 8N + 7 with the least significant bit in the byte representing key 8N. */
|
||||
public byte auto_repeats[] = new byte[32];
|
||||
|
||||
{ setFieldOrder(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led_mask", "global_auto_repeat", "auto_repeats" }); }
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "key_click_percent", "bell_percent", "bell_pitch", "bell_duration", "led_mask", "global_auto_repeat", "auto_repeats" });
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "XKeyboardStateByReference{" +
|
||||
|
||||
@@ -1261,7 +1261,32 @@ public abstract class Advapi32Util {
|
||||
}
|
||||
|
||||
String nameString = Native.toString(name);
|
||||
|
||||
|
||||
if(lpcbData.getValue() == 0) {
|
||||
switch (lpType.getValue()) {
|
||||
case WinNT.REG_BINARY: {
|
||||
keyValues.put(nameString, new byte[0]);
|
||||
break;
|
||||
}
|
||||
case WinNT.REG_SZ:
|
||||
case WinNT.REG_EXPAND_SZ: {
|
||||
keyValues.put(nameString, new char[0]);
|
||||
break;
|
||||
}
|
||||
case WinNT.REG_MULTI_SZ: {
|
||||
keyValues.put(nameString, new String[0]);
|
||||
break;
|
||||
}
|
||||
case WinNT.REG_NONE: {
|
||||
keyValues.put(nameString, null);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new RuntimeException("Unsupported empty type: " + lpType.getValue());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Memory byteData = new Memory(lpcbData.getValue());
|
||||
byteData.write(0, data, 0, lpcbData.getValue());
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.WString;
|
||||
@@ -100,6 +103,10 @@ public interface DsGetDC extends StdCallLibrary {
|
||||
* subnet that the computer is in with a valid site.
|
||||
*/
|
||||
public WString ClientSiteName;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "DomainControllerName", "DomainControllerAddress", "DomainGuid", "DomainName", "DnsForestName", "Flags", "DcSiteName", "ClientSiteName"});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,6 +119,10 @@ public interface DsGetDC extends StdCallLibrary {
|
||||
}
|
||||
|
||||
public DOMAIN_CONTROLLER_INFO.ByReference dci;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dci" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +167,6 @@ public interface DsGetDC extends StdCallLibrary {
|
||||
public static class DS_DOMAIN_TRUSTS extends Structure {
|
||||
|
||||
public static class ByReference extends DS_DOMAIN_TRUSTS implements Structure.ByReference {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,6 +204,10 @@ public interface DsGetDC extends StdCallLibrary {
|
||||
* Contains the GUID of the domain represented by this structure.
|
||||
*/
|
||||
public GUID DomainGuid;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "NetbiosDomainName", "DnsDomainName", "Flags", "ParentIndex", "TrustType", "TrustAttributes", "DomainSid", "DomainGuid" });
|
||||
}
|
||||
|
||||
public DS_DOMAIN_TRUSTS() {
|
||||
}
|
||||
@@ -202,26 +216,4 @@ public interface DsGetDC extends StdCallLibrary {
|
||||
super(p);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A pointer to an array of DS_DOMAIN_TRUSTS.
|
||||
*/
|
||||
public static class PDS_DOMAIN_TRUSTS extends Structure {
|
||||
public static class ByReference extends PDS_DOMAIN_TRUSTS implements Structure.ByReference {
|
||||
|
||||
}
|
||||
|
||||
public DS_DOMAIN_TRUSTS.ByReference t;
|
||||
|
||||
/**
|
||||
* Returns domain trusts.
|
||||
* @param count
|
||||
* Number of domain trusts.
|
||||
* @return
|
||||
* An array of domain trusts.
|
||||
*/
|
||||
public DS_DOMAIN_TRUSTS[] getTrusts(int count) {
|
||||
return (DS_DOMAIN_TRUSTS[]) t.toArray(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
|
||||
@@ -89,5 +92,9 @@ public interface Guid {
|
||||
public short Data2;
|
||||
public short Data3;
|
||||
public byte[] Data4 = new byte[8];
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "Data1", "Data2", "Data3", "Data4" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.WString;
|
||||
@@ -36,6 +39,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
}
|
||||
|
||||
public WString lgrui0_name;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "lgrui0_name" });
|
||||
}
|
||||
}
|
||||
|
||||
public static class LOCALGROUP_INFO_1 extends Structure {
|
||||
@@ -50,6 +57,9 @@ public interface LMAccess extends StdCallLibrary {
|
||||
|
||||
public WString lgrui1_name;
|
||||
public WString lgrui1_comment;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "lgrui1_name", "lgrui1_comment" });
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -80,6 +90,9 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* Pointer to a Unicode string that specifies the name of the user account.
|
||||
*/
|
||||
public WString usri0_name;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "usri0_name" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,6 +149,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* logon script file.
|
||||
*/
|
||||
public WString usri1_script_path;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "usri1_name", "usri1_password", "usri1_password_age", "usri1_priv", "usri1_home_dir", "usri1_comment", "usri1_flags", "usri1_script_path" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +223,11 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* A pointer to a SID structure that contains the security identifier (SID)
|
||||
* that uniquely identifies the user. The NetUserAdd and NetUserSetInfo functions ignore this member.
|
||||
*/
|
||||
public PSID.ByReference usri23_user_sid;
|
||||
public PSID.ByReference usri23_user_sid;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "usri23_name", "usri23_full_name", "usri23_comment", "usri23_flags", "usri23_user_sid" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,6 +247,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* Pointer to a null-terminated Unicode character string that specifies a name.
|
||||
*/
|
||||
public WString grui0_name;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "grui0_name" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,6 +270,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* Pointer to a Unicode string specifying the name of a local group to which the user belongs.
|
||||
*/
|
||||
public WString lgrui0_name;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "lgrui0_name" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,6 +296,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* the name of the global group.
|
||||
*/
|
||||
public WString grpi0_name;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "grpi0_name" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,6 +327,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* string. The comment can contain MAXCOMMENTSZ characters.
|
||||
*/
|
||||
public WString grpi1_comment;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "grpi1_name", "grpi1_comment" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,6 +368,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* and SE_GROUP_ENABLED_BY_DEFAULT.
|
||||
*/
|
||||
public int grpi2_attributes;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "grpi2_name", "grpi2_comment", "grpi2_group_id", "grpi2_attributes" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,6 +409,10 @@ public interface LMAccess extends StdCallLibrary {
|
||||
* SE_GROUP_ENABLED_BY_DEFAULT.
|
||||
*/
|
||||
public int grpi3_attributes;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "grpi3_name", "grpi3_comment", "grpi3_group_id", "grpi3_attributes" });
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
@@ -52,6 +55,10 @@ public interface NTSecApi extends StdCallLibrary {
|
||||
*/
|
||||
public Pointer Buffer;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "Length", "MaximumLength", "Buffer" });
|
||||
}
|
||||
|
||||
/**
|
||||
* String representation of the buffer.
|
||||
* @return
|
||||
@@ -97,11 +104,18 @@ public interface NTSecApi extends StdCallLibrary {
|
||||
public PSID.ByReference Sid;
|
||||
public LSA_UNICODE_STRING DnsName;
|
||||
public LSA_UNICODE_STRING NetbiosName;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "Sid", "DnsName", "NetbiosName" });
|
||||
}
|
||||
}
|
||||
|
||||
public static class LSA_FOREST_TRUST_BINARY_DATA extends Structure {
|
||||
public int Length;
|
||||
public Pointer Buffer;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "Length", "Buffer" });
|
||||
}
|
||||
}
|
||||
|
||||
public static class LSA_FOREST_TRUST_RECORD extends Structure {
|
||||
@@ -145,6 +159,10 @@ public interface NTSecApi extends StdCallLibrary {
|
||||
*/
|
||||
public UNION u;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "Flags", "ForestTrustType", "Time", "u" });
|
||||
}
|
||||
|
||||
public void read() {
|
||||
super.read();
|
||||
|
||||
@@ -170,7 +188,11 @@ public interface NTSecApi extends StdCallLibrary {
|
||||
|
||||
}
|
||||
|
||||
public LSA_FOREST_TRUST_RECORD.ByReference tr;
|
||||
public LSA_FOREST_TRUST_RECORD.ByReference tr;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "tr" });
|
||||
}
|
||||
}
|
||||
|
||||
public static class LSA_FOREST_TRUST_INFORMATION extends Structure {
|
||||
@@ -190,6 +212,10 @@ public interface NTSecApi extends StdCallLibrary {
|
||||
*/
|
||||
public PLSA_FOREST_TRUST_RECORD.ByReference Entries;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "RecordCount", "Entries" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of LSA_FOREST_TRUST_RECORD entries.
|
||||
* @return
|
||||
@@ -209,6 +235,10 @@ public interface NTSecApi extends StdCallLibrary {
|
||||
|
||||
}
|
||||
|
||||
public LSA_FOREST_TRUST_INFORMATION.ByReference fti;
|
||||
public LSA_FOREST_TRUST_INFORMATION.ByReference fti;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "fti" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.platform.win32.DsGetDC.PDOMAIN_CONTROLLER_INFO;
|
||||
import com.sun.jna.platform.win32.DsGetDC.PDS_DOMAIN_TRUSTS;
|
||||
import com.sun.jna.platform.win32.Guid.GUID;
|
||||
import com.sun.jna.platform.win32.NTSecApi.PLSA_FOREST_TRUST_INFORMATION;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
@@ -616,34 +616,34 @@ public abstract class Netapi32Util {
|
||||
* An array of domain trusts.
|
||||
*/
|
||||
public static DomainTrust[] getDomainTrusts(String serverName) {
|
||||
IntByReference domainCount = new IntByReference();
|
||||
IntByReference domainTrustCount = new IntByReference();
|
||||
PointerByReference domainsPointerRef = new PointerByReference();
|
||||
int rc = Netapi32.INSTANCE.DsEnumerateDomainTrusts(serverName,
|
||||
DsGetDC.DS_DOMAIN_VALID_FLAGS, domainsPointerRef, domainCount);
|
||||
DsGetDC.DS_DOMAIN_VALID_FLAGS, domainsPointerRef, domainTrustCount);
|
||||
if(W32Errors.NO_ERROR != rc) {
|
||||
throw new Win32Exception(rc);
|
||||
}
|
||||
try {
|
||||
DS_DOMAIN_TRUSTS domains = new DS_DOMAIN_TRUSTS(domainsPointerRef.getValue());
|
||||
int domainCountValue = domainCount.getValue();
|
||||
ArrayList<DomainTrust> trusts = new ArrayList<DomainTrust>(domainCountValue);
|
||||
for(DS_DOMAIN_TRUSTS trust : (DS_DOMAIN_TRUSTS[]) domains.toArray(new DS_DOMAIN_TRUSTS[domainCountValue])) {
|
||||
DS_DOMAIN_TRUSTS domainTrustRefs = new DS_DOMAIN_TRUSTS(domainsPointerRef.getValue());
|
||||
DS_DOMAIN_TRUSTS[] domainTrusts = (DS_DOMAIN_TRUSTS[]) domainTrustRefs.toArray(new DS_DOMAIN_TRUSTS[domainTrustCount.getValue()]);
|
||||
ArrayList<DomainTrust> trusts = new ArrayList<DomainTrust>(domainTrustCount.getValue());
|
||||
for(DS_DOMAIN_TRUSTS domainTrust : domainTrusts) {
|
||||
DomainTrust t = new DomainTrust();
|
||||
if (trust.DnsDomainName != null) {
|
||||
t.DnsDomainName = trust.DnsDomainName.toString();
|
||||
if (domainTrust.DnsDomainName != null) {
|
||||
t.DnsDomainName = domainTrust.DnsDomainName.toString();
|
||||
}
|
||||
if (trust.NetbiosDomainName != null) {
|
||||
t.NetbiosDomainName = trust.NetbiosDomainName.toString();
|
||||
if (domainTrust.NetbiosDomainName != null) {
|
||||
t.NetbiosDomainName = domainTrust.NetbiosDomainName.toString();
|
||||
}
|
||||
t.DomainSid = trust.DomainSid;
|
||||
if (trust.DomainSid != null) {
|
||||
t.DomainSidString = Advapi32Util.convertSidToStringSid(trust.DomainSid);
|
||||
t.DomainSid = domainTrust.DomainSid;
|
||||
if (domainTrust.DomainSid != null) {
|
||||
t.DomainSidString = Advapi32Util.convertSidToStringSid(domainTrust.DomainSid);
|
||||
}
|
||||
t.DomainGuid = trust.DomainGuid;
|
||||
if (trust.DomainGuid != null) {
|
||||
t.DomainGuidString = Ole32Util.getStringFromGUID(trust.DomainGuid);
|
||||
t.DomainGuid = domainTrust.DomainGuid;
|
||||
if (domainTrust.DomainGuid != null) {
|
||||
t.DomainGuidString = Ole32Util.getStringFromGUID(domainTrust.DomainGuid);
|
||||
}
|
||||
t.flags = trust.Flags;
|
||||
t.flags = domainTrust.Flags;
|
||||
trusts.add(t);
|
||||
}
|
||||
return trusts.toArray(new DomainTrust[0]);
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
@@ -282,6 +285,10 @@ public interface SetupApi extends StdCallLibrary {
|
||||
* Reserved. Do not use.
|
||||
*/
|
||||
public Pointer Reserved;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbSize", "InterfaceClassGuid", "Flags", "Reserved" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,5 +337,9 @@ public interface SetupApi extends StdCallLibrary {
|
||||
* Reserved. For internal use only.
|
||||
*/
|
||||
public Pointer Reserved;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbSize", "InterfaceClassGuid", "DevInst", "Reserved" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Platform;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
@@ -98,6 +101,10 @@ public interface ShellAPI extends StdCallLibrary {
|
||||
* A pointer to the title of a progress dialog box. This is a null-terminated string.
|
||||
*/
|
||||
public WString lpszProgressTitle;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "hwnd", "wFunc", "pFrom", "pTo", "fFlags", "fAnyOperationsAborted", "pNameMappings", "lpszProgressTitle" });
|
||||
}
|
||||
|
||||
/** Use this to encode <code>pFrom/pTo</code> paths. */
|
||||
public String encodePaths(String[] paths) {
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
@@ -136,17 +139,18 @@ public interface Sspi extends StdCallLibrary {
|
||||
public static class SecHandle extends Structure {
|
||||
public Pointer dwLower;
|
||||
public Pointer dwUpper;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwLower", "dwUpper" });
|
||||
}
|
||||
|
||||
public static class ByReference extends SecHandle implements Structure.ByReference {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An empty SecHandle.
|
||||
*/
|
||||
public SecHandle() {
|
||||
dwLower = null;
|
||||
dwUpper = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,16 +169,18 @@ public interface Sspi extends StdCallLibrary {
|
||||
public static class PSecHandle extends Structure {
|
||||
|
||||
public static class ByReference extends PSecHandle implements Structure.ByReference {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The first entry in an array of SecPkgInfo structures.
|
||||
*/
|
||||
public SecHandle.ByReference secHandle;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "secHandle" });
|
||||
}
|
||||
|
||||
public PSecHandle() {
|
||||
|
||||
}
|
||||
|
||||
public PSecHandle(SecHandle h) {
|
||||
@@ -209,7 +215,6 @@ public interface Sspi extends StdCallLibrary {
|
||||
* Create a SECBUFFER_EMPTY SecBuffer.
|
||||
*/
|
||||
public ByReference() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,19 +250,20 @@ public interface Sspi extends StdCallLibrary {
|
||||
* Bit flags that indicate the type of buffer. Must be one of the values of
|
||||
* the SecBufferType enumeration.
|
||||
*/
|
||||
public int BufferType;
|
||||
public int BufferType = SECBUFFER_EMPTY;
|
||||
/**
|
||||
* A pointer to a buffer.
|
||||
*/
|
||||
public Pointer pvBuffer;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbBuffer", "BufferType", "pvBuffer" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new SECBUFFER_EMPTY buffer.
|
||||
*/
|
||||
public SecBuffer() {
|
||||
cbBuffer = 0;
|
||||
pvBuffer = null;
|
||||
BufferType = SECBUFFER_EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,7 +277,6 @@ public interface Sspi extends StdCallLibrary {
|
||||
cbBuffer = size;
|
||||
pvBuffer = new Memory(size);
|
||||
BufferType = type;
|
||||
allocateMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +291,6 @@ public interface Sspi extends StdCallLibrary {
|
||||
pvBuffer = new Memory(token.length);
|
||||
pvBuffer.write(0, token, 0, token.length);
|
||||
BufferType = type;
|
||||
allocateMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,7 +299,7 @@ public interface Sspi extends StdCallLibrary {
|
||||
* Raw buffer bytes.
|
||||
*/
|
||||
public byte[] getBytes() {
|
||||
return pvBuffer.getByteArray(0, cbBuffer);
|
||||
return pvBuffer == null ? null : pvBuffer.getByteArray(0, cbBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,6 +318,10 @@ public interface Sspi extends StdCallLibrary {
|
||||
*/
|
||||
public SecBuffer.ByReference[] pBuffers;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "ulVersion", "cBuffers", "pBuffers" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new SecBufferDesc with one SECBUFFER_EMPTY buffer.
|
||||
*/
|
||||
@@ -370,13 +378,15 @@ public interface Sspi extends StdCallLibrary {
|
||||
public static class SECURITY_INTEGER extends Structure {
|
||||
public int dwLower;
|
||||
public int dwUpper;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwLower", "dwUpper" });
|
||||
}
|
||||
|
||||
/**
|
||||
* An security integer of 0.
|
||||
*/
|
||||
public SECURITY_INTEGER() {
|
||||
dwLower = 0;
|
||||
dwUpper = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,7 +394,6 @@ public interface Sspi extends StdCallLibrary {
|
||||
* A timestamp.
|
||||
*/
|
||||
public static class TimeStamp extends SECURITY_INTEGER {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,8 +410,11 @@ public interface Sspi extends StdCallLibrary {
|
||||
*/
|
||||
public SecPkgInfo.ByReference pPkgInfo;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "pPkgInfo" });
|
||||
}
|
||||
|
||||
public PSecPkgInfo() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -423,7 +435,6 @@ public interface Sspi extends StdCallLibrary {
|
||||
* A reference pointer to a SecPkgInfo structure.
|
||||
*/
|
||||
public static class ByReference extends SecPkgInfo implements Structure.ByReference {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,7 +444,7 @@ public interface Sspi extends StdCallLibrary {
|
||||
/**
|
||||
* Specifies the version of the package protocol. Must be 1.
|
||||
*/
|
||||
public short wVersion;
|
||||
public short wVersion = 1;
|
||||
/**
|
||||
* Specifies a DCE RPC identifier, if appropriate. If the package does not implement one of
|
||||
* the DCE registered security systems, the reserved value SECPKG_ID_NONE is used.
|
||||
@@ -453,14 +464,14 @@ public interface Sspi extends StdCallLibrary {
|
||||
*/
|
||||
public WString Comment;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "fCapabilities", "wVersion", "wRPCID", "cbMaxToken", "Name", "Comment" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new package info.
|
||||
*/
|
||||
public SecPkgInfo() {
|
||||
fCapabilities = 0;
|
||||
wVersion = 1;
|
||||
wRPCID = 0;
|
||||
cbMaxToken = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
@@ -135,5 +138,9 @@ public interface Tlhelp32 extends StdCallLibrary {
|
||||
* retrieve the full path of the executable file for a 64-bit process.
|
||||
*/
|
||||
public char[] szExeFile = new char[WinDef.MAX_PATH];
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwSize", "cntUsage", "th32ProcessID", "th32DefaultHeapID", "th32ModuleID", "cntThreads", "th32ParentProcessID", "pcPriClassBase", "dwFlags", "szExeFile" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
@@ -113,5 +116,9 @@ public interface VerRsrc extends StdCallLibrary {
|
||||
* The least significant 32 bits of the file's 64-bit binary creation date and time stamp.
|
||||
*/
|
||||
public WinDef.DWORD dwFileDateLS;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwSignature", "dwStrucVersion", "dwFileVersionMS", "dwFileVersionLS", "dwProductVersionMS", "dwProductVersionLS", "dwFileFlagsMask", "dwFileFlags", "dwFileOS", "dwFileType", "dwFileSubtype", "dwFileDateMS", "dwFileDateLS" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
@@ -61,6 +64,10 @@ public interface Wdm extends StdCallLibrary {
|
||||
* The string is not null-terminated.
|
||||
*/
|
||||
public char[] Name;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "LastWriteTime", "TitleIndex", "NameLength", "Name" });
|
||||
}
|
||||
/**
|
||||
* Name of the key.
|
||||
* @return String.
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Platform;
|
||||
import com.sun.jna.Pointer;
|
||||
@@ -169,7 +171,11 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
*/
|
||||
public static class FILETIME extends Structure {
|
||||
public int dwLowDateTime;
|
||||
public int dwHighDateTime;
|
||||
public int dwHighDateTime;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwLowDateTime", "dwHighDateTime" });
|
||||
}
|
||||
|
||||
public static class ByReference extends FILETIME implements Structure.ByReference {
|
||||
public ByReference() {
|
||||
@@ -292,6 +298,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
public short wSecond;
|
||||
// The millisecond. The valid values for this member are 0 through 999.
|
||||
public short wMilliseconds;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "wYear", "wMonth", "wDayOfWeek", "wDay", "wHour", "wMinute", "wSecond", "wMilliseconds" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,6 +390,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
public int Offset;
|
||||
public int OffsetHigh;
|
||||
public HANDLE hEvent;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "Internal", "InternalHigh", "Offset", "OffsetHigh", "hEvent" });
|
||||
}
|
||||
}
|
||||
|
||||
int INFINITE = 0xFFFFFFFF;
|
||||
@@ -412,6 +426,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
* Reserved for future use.
|
||||
*/
|
||||
public WORD wReserved;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "wProcessorArchitecture", "wReserved" });
|
||||
}
|
||||
}
|
||||
|
||||
/** Unnamed inner union. */
|
||||
@@ -482,6 +500,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
* Architecture-dependent processor revision.
|
||||
*/
|
||||
public WORD wProcessorRevision;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "processorArchitecture", "dwPageSize", "lpMinimumApplicationAddress", "lpMaximumApplicationAddress", "dwActiveProcessorMask", "dwNumberOfProcessors", "dwProcessorType", "dwAllocationGranularity", "wProcessorLevel", "wProcessorRevision"});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,6 +553,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
*/
|
||||
public DWORDLONG ullAvailExtendedVirtual;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwLength", "dwMemoryLoad", "ullTotalPhys", "ullAvailPhys", "ullTotalPageFile", "ullAvailPageFile", "ullTotalVirtual", "ullAvailVirtual", "ullAvailExtendedVirtual" });
|
||||
}
|
||||
|
||||
public MEMORYSTATUSEX() {
|
||||
dwLength = new DWORD(size());
|
||||
}
|
||||
@@ -560,6 +586,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
*/
|
||||
public boolean bInheritHandle;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwLength", "lpSecurityDescriptor", "bInheritHandle" });
|
||||
}
|
||||
|
||||
public SECURITY_ATTRIBUTES() {
|
||||
dwLength = new DWORD(size());
|
||||
}
|
||||
@@ -732,6 +762,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
*/
|
||||
public HANDLE hStdError;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cb", "lpReserved", "lpDesktop", "lpTitle", "dwX", "dwY", "dwXSize", "dwYSize", "dwXCountChars", "dwYCountChars", "dwFillAttribute", "dwFlags", "wShowWindow", "cbReserved2", "lpReserved2", "hStdInput", "hStdOutput", "hStdError" });
|
||||
}
|
||||
|
||||
public STARTUPINFO() {
|
||||
cb = new DWORD(size());
|
||||
}
|
||||
@@ -773,6 +807,10 @@ public interface WinBase extends StdCallLibrary, WinDef, BaseTSD {
|
||||
* identifier may be reused.
|
||||
*/
|
||||
public DWORD dwThreadId;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "hProcess", "hThread", "dwProcessId", "dwThreadId" });
|
||||
}
|
||||
|
||||
public static class ByReference extends PROCESS_INFORMATION implements Structure.ByReference {
|
||||
public ByReference() {
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
@@ -59,6 +62,9 @@ public interface WinCrypt extends StdCallLibrary {
|
||||
*/
|
||||
public Pointer pbData;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbData", "pbData" });
|
||||
}
|
||||
/**
|
||||
* Get byte data.
|
||||
* @return
|
||||
@@ -100,6 +106,10 @@ public interface WinCrypt extends StdCallLibrary {
|
||||
* A string containing the text of a prompt to be displayed.
|
||||
*/
|
||||
public String szPrompt;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbSize", "dwPromptFlags", "hwndApp", "szPrompt" });
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.IntegerType;
|
||||
import com.sun.jna.Native;
|
||||
@@ -63,7 +65,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
* Low WORD.
|
||||
*/
|
||||
public WORD getLow() {
|
||||
return new WORD(longValue() & 0xFF);
|
||||
return new WORD(longValue() & 0xFFFF);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +74,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
* High WORD.
|
||||
*/
|
||||
public WORD getHigh() {
|
||||
return new WORD((longValue() >> 16) & 0xFF);
|
||||
return new WORD((longValue() >> 16) & 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,6 +325,10 @@ public interface WinDef extends StdCallLibrary {
|
||||
public int right;
|
||||
public int bottom;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "left", "top", "right", "bottom" });
|
||||
}
|
||||
|
||||
public Rectangle toRectangle() {
|
||||
return new Rectangle(left, top, right-left, bottom-top);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.platform.win32.WinDef.RECT;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
@@ -30,11 +33,20 @@ public interface WinGDI extends StdCallLibrary {
|
||||
public int nCount;
|
||||
public int nRgnSize;
|
||||
public RECT rcBound;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwSize", "iType", "nCount", "nRgnSize", "rcBound" });
|
||||
}
|
||||
}
|
||||
|
||||
public class RGNDATA extends Structure {
|
||||
public RGNDATAHEADER rdh;
|
||||
public byte[] Buffer;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "rdh", "Buffer" });
|
||||
}
|
||||
|
||||
public RGNDATA(int bufferSize) {
|
||||
Buffer = new byte[bufferSize];
|
||||
allocateMemory();
|
||||
@@ -74,6 +86,9 @@ public interface WinGDI extends StdCallLibrary {
|
||||
public int biYPelsPerMeter;
|
||||
public int biClrUsed;
|
||||
public int biClrImportant;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "biSize", "biWidth", "biHeight", "biPlanes", "biBitCount", "biCompression", "biSizeImage", "biXPelsPerMeter", "biYPelsPerMeter", "biClrUsed", "biClrImportant" });
|
||||
}
|
||||
}
|
||||
|
||||
public class RGBQUAD extends Structure {
|
||||
@@ -81,11 +96,17 @@ public interface WinGDI extends StdCallLibrary {
|
||||
public byte rgbGreen;
|
||||
public byte rgbRed;
|
||||
public byte rgbReserved = 0;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "rgbBlue", "rgbGreen", "rgbRed", "rgbReserved" });
|
||||
}
|
||||
}
|
||||
|
||||
public class BITMAPINFO extends Structure {
|
||||
public BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
|
||||
public RGBQUAD[] bmiColors = new RGBQUAD[1];
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "bmiHeader", "bmiColors" });
|
||||
}
|
||||
public BITMAPINFO() { this(1); }
|
||||
public BITMAPINFO(int size) {
|
||||
bmiColors = new RGBQUAD[size];
|
||||
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.Union;
|
||||
@@ -63,6 +66,10 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public HWND hwndMoveSize;
|
||||
public HWND hwndCaret;
|
||||
public RECT rcCaret;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbSize", "flags", "hwndActive", "hwndFocus", "hwndCapture", "hwndMenuOwner", "hwndMoveSize", "hwndCaret", "rcCaret" });
|
||||
}
|
||||
}
|
||||
|
||||
public class WINDOWINFO extends Structure {
|
||||
@@ -76,6 +83,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public int cyWindowBorders;
|
||||
public short atomWindowType;
|
||||
public short wCreatorVersion;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbSize", "rcWindow", "rcClient", "dwStyle", "dwExStyle", "dwWindowStatus", "cxWindowBorders", "cyWindowBorders", "atomWindowType", "wCreatorVersion" });
|
||||
}
|
||||
}
|
||||
|
||||
int GWL_EXSTYLE = -20;
|
||||
@@ -112,6 +122,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "x", "y" });
|
||||
}
|
||||
}
|
||||
|
||||
public class MSG extends Structure {
|
||||
@@ -121,6 +134,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public LPARAM lParam;
|
||||
public int time;
|
||||
public POINT pt;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "hWnd", "message", "wParam", "lParam", "time", "pt" });
|
||||
}
|
||||
}
|
||||
|
||||
public class FLASHWINFO extends Structure {
|
||||
@@ -129,6 +145,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public int dwFlags;
|
||||
public int uCount;
|
||||
public int dwTimeout;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbSize", "hWnd", "dwFlags", "uCount", "dwTimeout" });
|
||||
}
|
||||
}
|
||||
|
||||
public interface WNDENUMPROC extends StdCallCallback {
|
||||
@@ -148,6 +167,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
this.cx = w;
|
||||
this.cy = h;
|
||||
}
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cx", "cy" });
|
||||
}
|
||||
}
|
||||
|
||||
int AC_SRC_OVER = 0x00;
|
||||
@@ -160,6 +182,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public byte BlendFlags = 0; // only valid value
|
||||
public byte SourceConstantAlpha;
|
||||
public byte AlphaFormat;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "BlendOp", "BlendFlags", "SourceConstantAlpha", "AlphaFormat"});
|
||||
}
|
||||
}
|
||||
|
||||
int VK_SHIFT = 16;
|
||||
@@ -259,6 +284,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public int flags;
|
||||
public int time;
|
||||
public ULONG_PTR dwExtraInfo;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "vkCode", "scanCode", "flags", "time", "dwExtraInfo" });
|
||||
}
|
||||
}
|
||||
|
||||
int SM_CXSCREEN = 0;
|
||||
@@ -485,6 +513,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public WinDef.DWORD uMsg;
|
||||
public WinDef.WORD wParamL;
|
||||
public WinDef.WORD wParamH;
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "uMsg", "wParamL", "wParamH" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -516,7 +547,10 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
public WinDef.DWORD type;
|
||||
public INPUT_UNION input = new INPUT_UNION();
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "type", "input" });
|
||||
}
|
||||
|
||||
public static class INPUT_UNION extends Union {
|
||||
|
||||
public INPUT_UNION() {
|
||||
@@ -604,6 +638,10 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
* information.
|
||||
*/
|
||||
public BaseTSD.ULONG_PTR dwExtraInfo;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "wVk", "wScan", "dwFlags", "time", "dwExtraInfo" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -634,6 +672,10 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
public WinDef.DWORD dwFlags;
|
||||
public WinDef.DWORD time;
|
||||
public BaseTSD.ULONG_PTR dwExtraInfo;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dx", "dy", "mouseData", "dwFlags", "time", "dwExtraInfo" });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -644,5 +686,9 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
||||
|
||||
// Tick count of when the last input event was received.
|
||||
public int dwTime;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "cbSize", "dwTime" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
@@ -61,5 +64,9 @@ public interface Winioctl extends StdCallLibrary {
|
||||
* The partition number of the device, if the device can be partitioned. Otherwise, this member is -1.
|
||||
*/
|
||||
public int PartitionNumber;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "DeviceType", "DeviceNumber", "PartitionNumber" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
@@ -86,9 +89,12 @@ public interface Winspool extends StdCallLibrary {
|
||||
public String pDescription;
|
||||
public String pName;
|
||||
public String pComment;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "Flags", "pDescription", "pName", "pComment" });
|
||||
}
|
||||
|
||||
public PRINTER_INFO_1() {
|
||||
|
||||
}
|
||||
|
||||
public PRINTER_INFO_1(int size) {
|
||||
@@ -100,9 +106,12 @@ public interface Winspool extends StdCallLibrary {
|
||||
public String pPrinterName;
|
||||
public String pServerName;
|
||||
public DWORD Attributes;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "pPrinterName", "pServerName", "Attributes" });
|
||||
}
|
||||
|
||||
public PRINTER_INFO_4() {
|
||||
|
||||
}
|
||||
|
||||
public PRINTER_INFO_4(int size) {
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.platform.win32.WinNT.HANDLE;
|
||||
@@ -97,6 +100,10 @@ public interface Winsvc extends StdCallLibrary {
|
||||
*/
|
||||
public int dwWaitHint;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwServiceType", "dwCurrentState", "dwControlsAccepted", "dwWin32ExitCode", "dwServiceSpecificExitCode", "dwCheckPoint", "dwWaitHint" });
|
||||
}
|
||||
|
||||
public SERVICE_STATUS() {
|
||||
super();
|
||||
}
|
||||
@@ -181,6 +188,10 @@ public interface Winsvc extends StdCallLibrary {
|
||||
*/
|
||||
public int dwServiceFlags;
|
||||
|
||||
protected List getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "dwServiceType", "dwCurrentState", "dwControlsAccepted", "dwWin32ExitCode", "dwServiceSpecificExitCode", "dwCheckPoint", "dwWaitHint", "dwProcessId", "dwServiceFlags" });
|
||||
}
|
||||
|
||||
public SERVICE_STATUS_PROCESS() {
|
||||
}
|
||||
|
||||
|
||||
@@ -732,7 +732,10 @@ public class Advapi32Test extends TestCase {
|
||||
assertTrue(Advapi32.INSTANCE.CloseServiceHandle(handle));
|
||||
|
||||
assertNull(Advapi32.INSTANCE.OpenSCManager("invalidMachineName", null, Winsvc.SC_MANAGER_CONNECT));
|
||||
assertEquals(W32Errors.RPC_S_SERVER_UNAVAILABLE, Kernel32.INSTANCE.GetLastError());
|
||||
int err = Kernel32.INSTANCE.GetLastError();
|
||||
assertTrue("Unexpected error in OpenSCManager: " + err,
|
||||
err == W32Errors.RPC_S_SERVER_UNAVAILABLE
|
||||
|| err == W32Errors.RPC_S_INVALID_NET_ADDR);
|
||||
|
||||
assertNull(Advapi32.INSTANCE.OpenSCManager(null, "invalidDatabase", Winsvc.SC_MANAGER_CONNECT));
|
||||
assertEquals(W32Errors.ERROR_INVALID_NAME, Kernel32.INSTANCE.GetLastError());
|
||||
|
||||
@@ -26,6 +26,8 @@ import com.sun.jna.platform.win32.WinNT.HANDLEByReference;
|
||||
import com.sun.jna.platform.win32.WinNT.PSID;
|
||||
import com.sun.jna.platform.win32.WinNT.SID_NAME_USE;
|
||||
import com.sun.jna.platform.win32.WinNT.WELL_KNOWN_SID_TYPE;
|
||||
import com.sun.jna.platform.win32.WinReg.HKEY;
|
||||
import com.sun.jna.platform.win32.WinReg.HKEYByReference;
|
||||
|
||||
/**
|
||||
* @author dblock[at]dblock[dot]org
|
||||
@@ -296,8 +298,9 @@ public class Advapi32UtilTest extends TestCase {
|
||||
Advapi32Util.registrySetStringArray(WinReg.HKEY_CURRENT_USER, "Software\\JNA", "StringArray", stringsWritten);
|
||||
String[] emptyArray = new String[0];
|
||||
Advapi32Util.registrySetStringArray(WinReg.HKEY_CURRENT_USER, "Software\\JNA", "EmptyStringArray", emptyArray);
|
||||
Advapi32Util.registrySetBinaryValue(WinReg.HKEY_CURRENT_USER, "Software\\JNA", "EmptyBinary", new byte[0]);
|
||||
TreeMap<String, Object> values = Advapi32Util.registryGetValues(WinReg.HKEY_CURRENT_USER, "Software\\JNA");
|
||||
assertEquals(6, values.keySet().size());
|
||||
assertEquals(7, values.keySet().size());
|
||||
assertEquals("FourtyTwo" + uu, values.get("42" + uu));
|
||||
assertEquals(42, values.get("FourtyTwo" + uu));
|
||||
assertEquals("%TEMP%", values.get("ExpandableString"));
|
||||
@@ -315,6 +318,46 @@ public class Advapi32UtilTest extends TestCase {
|
||||
assertEquals(0, stringsRead.length);
|
||||
Advapi32Util.registryDeleteKey(WinReg.HKEY_CURRENT_USER, "Software", "JNA");
|
||||
}
|
||||
|
||||
public void testRegistryGetEmptyValues() {
|
||||
HKEY root = WinReg.HKEY_CURRENT_USER;
|
||||
String keyPath = "Software\\JNA";
|
||||
Advapi32Util.registryCreateKey(root, "Software", "JNA");
|
||||
doTestRegistryGetEmptyValues(root, keyPath, WinNT.REG_BINARY);
|
||||
doTestRegistryGetEmptyValues(root, keyPath, WinNT.REG_EXPAND_SZ);
|
||||
doTestRegistryGetEmptyValues(root, keyPath, WinNT.REG_MULTI_SZ);
|
||||
doTestRegistryGetEmptyValues(root, keyPath, WinNT.REG_NONE);
|
||||
doTestRegistryGetEmptyValues(root, keyPath, WinNT.REG_SZ);
|
||||
Advapi32Util.registryDeleteKey(root, "Software", "JNA");
|
||||
}
|
||||
|
||||
private void doTestRegistryGetEmptyValues(HKEY root, String keyPath, int valueType) {
|
||||
String valueName = "EmptyValue";
|
||||
registrySetEmptyValue(root, keyPath, valueName, valueType);
|
||||
Map<String, Object> values = Advapi32Util.registryGetValues(root, keyPath);
|
||||
assertEquals(1, values.size());
|
||||
assertTrue(values.containsKey(valueName));
|
||||
}
|
||||
|
||||
private static void registrySetEmptyValue(HKEY root, String keyPath, String name, final int valueType) {
|
||||
HKEYByReference phkKey = new HKEYByReference();
|
||||
int rc = Advapi32.INSTANCE.RegOpenKeyEx(root, keyPath, 0, WinNT.KEY_READ | WinNT.KEY_WRITE, phkKey);
|
||||
if (rc != W32Errors.ERROR_SUCCESS) {
|
||||
throw new Win32Exception(rc);
|
||||
}
|
||||
try {
|
||||
char[] data = new char[0];
|
||||
rc = Advapi32.INSTANCE.RegSetValueEx(phkKey.getValue(), name, 0, valueType, data, 0);
|
||||
if (rc != W32Errors.ERROR_SUCCESS) {
|
||||
throw new Win32Exception(rc);
|
||||
}
|
||||
} finally {
|
||||
rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
|
||||
if (rc != W32Errors.ERROR_SUCCESS) {
|
||||
throw new Win32Exception(rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsWellKnownSid() {
|
||||
String everyoneString = "S-1-1-0";
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna.platform.win32;
|
||||
package com.sun.jna.platform.win32;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.sun.jna.WString;
|
||||
import com.sun.jna.platform.win32.DsGetDC.DS_DOMAIN_TRUSTS;
|
||||
import com.sun.jna.platform.win32.DsGetDC.PDOMAIN_CONTROLLER_INFO;
|
||||
import com.sun.jna.platform.win32.DsGetDC.PDS_DOMAIN_TRUSTS;
|
||||
import com.sun.jna.platform.win32.LMAccess.GROUP_INFO_2;
|
||||
import com.sun.jna.platform.win32.LMAccess.GROUP_USERS_INFO_0;
|
||||
import com.sun.jna.platform.win32.LMAccess.LOCALGROUP_USERS_INFO_0;
|
||||
@@ -234,23 +233,24 @@ public class Netapi32Test extends TestCase {
|
||||
if (Netapi32Util.getJoinStatus() != LMJoin.NETSETUP_JOIN_STATUS.NetSetupDomainName)
|
||||
return;
|
||||
|
||||
IntByReference domainCount = new IntByReference();
|
||||
PDS_DOMAIN_TRUSTS.ByReference domains = new PDS_DOMAIN_TRUSTS.ByReference();
|
||||
assertEquals(W32Errors.NO_ERROR, Netapi32.INSTANCE.DsEnumerateDomainTrusts(
|
||||
null, DsGetDC.DS_DOMAIN_VALID_FLAGS, domains, domainCount));
|
||||
IntByReference domainTrustCount = new IntByReference();
|
||||
PointerByReference domainsPointerRef = new PointerByReference();
|
||||
assertEquals(W32Errors.NO_ERROR, Netapi32.INSTANCE.DsEnumerateDomainTrusts(null,
|
||||
DsGetDC.DS_DOMAIN_VALID_FLAGS, domainsPointerRef, domainTrustCount));
|
||||
assertTrue(domainTrustCount.getValue() >= 0);
|
||||
|
||||
assertTrue(domainCount.getValue() >= 0);
|
||||
|
||||
DS_DOMAIN_TRUSTS[] trusts = domains.getTrusts(domainCount.getValue());
|
||||
for(DS_DOMAIN_TRUSTS trust : trusts) {
|
||||
assertTrue(trust.NetbiosDomainName.length() > 0);
|
||||
DS_DOMAIN_TRUSTS domainTrustRefs = new DS_DOMAIN_TRUSTS(domainsPointerRef.getValue());
|
||||
DS_DOMAIN_TRUSTS[] domainTrusts = (DS_DOMAIN_TRUSTS[]) domainTrustRefs.toArray(new DS_DOMAIN_TRUSTS[domainTrustCount.getValue()]);
|
||||
|
||||
for(DS_DOMAIN_TRUSTS trust : domainTrusts) {
|
||||
assertTrue(trust.DnsDomainName.length() > 0);
|
||||
assertTrue(Advapi32.INSTANCE.IsValidSid(trust.DomainSid));
|
||||
assertTrue(Advapi32Util.convertSidToStringSid(trust.DomainSid).startsWith("S-"));
|
||||
assertTrue(Ole32Util.getStringFromGUID(trust.DomainGuid).startsWith("{"));
|
||||
}
|
||||
|
||||
assertEquals(W32Errors.ERROR_SUCCESS, Netapi32.INSTANCE.NetApiBufferFree(
|
||||
domains.getPointer()));
|
||||
|
||||
assertEquals(W32Errors.ERROR_SUCCESS, Netapi32.INSTANCE.NetApiBufferFree(domainTrustRefs.getPointer()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,12 @@ public class VersionTest extends TestCase {
|
||||
|
||||
public void testGetFileVersion() {
|
||||
String systemRoot = System.getenv("SystemRoot");
|
||||
File notepad = new File(systemRoot + "\\write.exe");
|
||||
File file = new File(systemRoot + "\\regedit.exe");
|
||||
if (!file.exists()) {
|
||||
fail("Can't obtain file version, file " + file + " is missing");
|
||||
}
|
||||
|
||||
int size = Version.INSTANCE.GetFileVersionInfoSize(notepad.getAbsolutePath(), null);
|
||||
int size = Version.INSTANCE.GetFileVersionInfoSize(file.getAbsolutePath(), null);
|
||||
assertTrue(size > 0);
|
||||
|
||||
Pointer buffer = Kernel32.INSTANCE.LocalAlloc(WinBase.LMEM_ZEROINIT, size);
|
||||
@@ -35,7 +38,7 @@ public class VersionTest extends TestCase {
|
||||
|
||||
try
|
||||
{
|
||||
assertTrue(Version.INSTANCE.GetFileVersionInfo(notepad.getAbsolutePath(), 0, size, buffer));
|
||||
assertTrue(Version.INSTANCE.GetFileVersionInfo(file.getAbsolutePath(), 0, size, buffer));
|
||||
|
||||
IntByReference outputSize = new IntByReference();
|
||||
PointerByReference pointer = new PointerByReference();
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-shapedwindow.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.ShapedWindowDemo" />
|
||||
|
||||
@@ -37,7 +36,6 @@
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
@@ -45,29 +43,26 @@
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes/com"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
<project name="jnacontrib.w32keyhook" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.w32keyhook.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="src"/>
|
||||
<property name="src" location="."/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
<property name="jna-dist" location="../../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-w32keyhook.jar"/>
|
||||
<property name="file.reference.jna.build" location="../../build"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
<property name="main-class" value="KeyHook" />
|
||||
<property name="main-class" value="com.sun.jna.contrib.demo.KeyHook" />
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
@@ -37,7 +36,6 @@
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
@@ -45,25 +43,26 @@
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}">
|
||||
<fileset dir="${src}">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes" />
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}/com">
|
||||
<fileset dir="${src}/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main-class}"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes" />
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}" />
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
+81
-66
@@ -1,67 +1,82 @@
|
||||
import com.sun.jna.platform.win32.Kernel32;
|
||||
import com.sun.jna.platform.win32.User32;
|
||||
import com.sun.jna.platform.win32.WinUser;
|
||||
import com.sun.jna.platform.win32.WinDef.HMODULE;
|
||||
import com.sun.jna.platform.win32.WinDef.LRESULT;
|
||||
import com.sun.jna.platform.win32.WinDef.WPARAM;
|
||||
import com.sun.jna.platform.win32.WinUser.HHOOK;
|
||||
import com.sun.jna.platform.win32.WinUser.KBDLLHOOKSTRUCT;
|
||||
import com.sun.jna.platform.win32.WinUser.LowLevelKeyboardProc;
|
||||
import com.sun.jna.platform.win32.WinUser.MSG;
|
||||
|
||||
/** Sample implementation of a low-level keyboard hook on W32. */
|
||||
public class KeyHook {
|
||||
private static volatile boolean quit;
|
||||
private static HHOOK hhk;
|
||||
private static LowLevelKeyboardProc keyboardHook;
|
||||
|
||||
public static void main(String[] args) {
|
||||
final User32 lib = User32.INSTANCE;
|
||||
HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle(null);
|
||||
keyboardHook = new LowLevelKeyboardProc() {
|
||||
public LRESULT callback(int nCode, WPARAM wParam, KBDLLHOOKSTRUCT info) {
|
||||
if (nCode >= 0) {
|
||||
switch(wParam.intValue()) {
|
||||
case WinUser.WM_KEYUP:
|
||||
case WinUser.WM_KEYDOWN:
|
||||
case WinUser.WM_SYSKEYUP:
|
||||
case WinUser.WM_SYSKEYDOWN:
|
||||
System.err.println("in callback, key=" + info.vkCode);
|
||||
if (info.vkCode == 81) {
|
||||
quit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return lib.CallNextHookEx(hhk, nCode, wParam, info.getPointer());
|
||||
}
|
||||
};
|
||||
hhk = lib.SetWindowsHookEx(WinUser.WH_KEYBOARD_LL, keyboardHook, hMod, 0);
|
||||
System.out.println("Keyboard hook installed, type anywhere, 'q' to quit");
|
||||
new Thread() {
|
||||
public void run() {
|
||||
while (!quit) {
|
||||
try { Thread.sleep(10); } catch(Exception e) { }
|
||||
}
|
||||
System.err.println("unhook and exit");
|
||||
lib.UnhookWindowsHookEx(hhk);
|
||||
System.exit(0);
|
||||
}
|
||||
}.start();
|
||||
|
||||
// This bit never returns from GetMessage
|
||||
int result;
|
||||
MSG msg = new MSG();
|
||||
while ((result = lib.GetMessage(msg, null, 0, 0)) != 0) {
|
||||
if (result == -1) {
|
||||
System.err.println("error in get message");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.err.println("got message");
|
||||
lib.TranslateMessage(msg);
|
||||
lib.DispatchMessage(msg);
|
||||
}
|
||||
}
|
||||
lib.UnhookWindowsHookEx(hhk);
|
||||
}
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package com.sun.jna.contrib.demo;
|
||||
|
||||
import com.sun.jna.platform.win32.Kernel32;
|
||||
import com.sun.jna.platform.win32.User32;
|
||||
import com.sun.jna.platform.win32.WinUser;
|
||||
import com.sun.jna.platform.win32.WinDef.HMODULE;
|
||||
import com.sun.jna.platform.win32.WinDef.LRESULT;
|
||||
import com.sun.jna.platform.win32.WinDef.WPARAM;
|
||||
import com.sun.jna.platform.win32.WinUser.HHOOK;
|
||||
import com.sun.jna.platform.win32.WinUser.KBDLLHOOKSTRUCT;
|
||||
import com.sun.jna.platform.win32.WinUser.LowLevelKeyboardProc;
|
||||
import com.sun.jna.platform.win32.WinUser.MSG;
|
||||
|
||||
/** Sample implementation of a low-level keyboard hook on W32. */
|
||||
public class KeyHook {
|
||||
private static volatile boolean quit;
|
||||
private static HHOOK hhk;
|
||||
private static LowLevelKeyboardProc keyboardHook;
|
||||
|
||||
public static void main(String[] args) {
|
||||
final User32 lib = User32.INSTANCE;
|
||||
HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle(null);
|
||||
keyboardHook = new LowLevelKeyboardProc() {
|
||||
public LRESULT callback(int nCode, WPARAM wParam, KBDLLHOOKSTRUCT info) {
|
||||
if (nCode >= 0) {
|
||||
switch(wParam.intValue()) {
|
||||
case WinUser.WM_KEYUP:
|
||||
case WinUser.WM_KEYDOWN:
|
||||
case WinUser.WM_SYSKEYUP:
|
||||
case WinUser.WM_SYSKEYDOWN:
|
||||
System.err.println("in callback, key=" + info.vkCode);
|
||||
if (info.vkCode == 81) {
|
||||
quit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return lib.CallNextHookEx(hhk, nCode, wParam, info.getPointer());
|
||||
}
|
||||
};
|
||||
hhk = lib.SetWindowsHookEx(WinUser.WH_KEYBOARD_LL, keyboardHook, hMod, 0);
|
||||
System.out.println("Keyboard hook installed, type anywhere, 'q' to quit");
|
||||
new Thread() {
|
||||
public void run() {
|
||||
while (!quit) {
|
||||
try { Thread.sleep(10); } catch(Exception e) { }
|
||||
}
|
||||
System.err.println("unhook and exit");
|
||||
lib.UnhookWindowsHookEx(hhk);
|
||||
System.exit(0);
|
||||
}
|
||||
}.start();
|
||||
|
||||
// This bit never returns from GetMessage
|
||||
int result;
|
||||
MSG msg = new MSG();
|
||||
while ((result = lib.GetMessage(msg, null, 0, 0)) != 0) {
|
||||
if (result == -1) {
|
||||
System.err.println("error in get message");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.err.println("got message");
|
||||
lib.TranslateMessage(msg);
|
||||
lib.DispatchMessage(msg);
|
||||
}
|
||||
}
|
||||
lib.UnhookWindowsHookEx(hhk);
|
||||
}
|
||||
}
|
||||
+13
-17
@@ -6,9 +6,9 @@
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-src" location="../../src"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="jar" location="${build}/demo-x11.jar"/>
|
||||
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
|
||||
|
||||
<path id="classpath">
|
||||
<fileset file="${file.reference.jna.jar}"/>
|
||||
@@ -45,7 +45,6 @@
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${classes}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
|
||||
encoding="UTF-8" debug="on" includeantruntime="false">
|
||||
@@ -53,29 +52,26 @@
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}">
|
||||
<fileset dir="src">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
<!-- jna -->
|
||||
<fileset dir="${file.reference.jna.build}/classes/com">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${classes}">
|
||||
<fileset dir="${src}">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<jar jarfile="${jar}" basedir="${classes}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="jnacontrib.x11.demos.XDesktopDemo"/>
|
||||
</manifest>
|
||||
<!-- platform -->
|
||||
<fileset dir="../platform/build/classes"/>
|
||||
<!-- jna -->
|
||||
<zipfileset src="${file.reference.jna.jar}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
+54
-18
@@ -16,14 +16,21 @@
|
||||
# Solaris (i386/amd64/sparc/sparcv9)
|
||||
# AIX (ppc/ppc64)
|
||||
# FreeBSD/OpenBSD/NetBSD (i386/amd64)
|
||||
# Android (arm)
|
||||
#
|
||||
# Built, but with outstanding bugs (not necessarily within JNA):
|
||||
#
|
||||
# Linux (ppc64/ia64)
|
||||
#
|
||||
# The w32ce build requires cegcc and phoneME for cross-compilation; if these
|
||||
# tools are available on the path than "ant -Dos.prefix=w32ce-arm" should
|
||||
# tools are available on the path then "ant -Dos.prefix=w32ce-arm" should
|
||||
# result in a proper build.
|
||||
#
|
||||
# The android build requires the android SDK+NDK for cross-compilation;
|
||||
# make the tools available on the path and compile with
|
||||
# "ant -Dos.prefix=android-arm". Put the NDK tools in the path and adjust
|
||||
# NDK_PLATFORM below or set it in your environment.
|
||||
#
|
||||
|
||||
# Systems which support POSIX signals may be able to support VM crash
|
||||
# protection simply by defining HAVE_PROTECTION. This option has been only
|
||||
@@ -39,8 +46,8 @@ OS=$(shell uname | sed -e 's/CYGWIN.*/win32/g' \
|
||||
-e 's/AIX.*/aix/g' \
|
||||
-e 's/Linux.*/linux/g')
|
||||
|
||||
JNA_JNI_VERSION=3.4.0 # auto-generated by ant
|
||||
CHECKSUM=4c69bcf40b30785215211b5a5dad211e # auto-generated by ant
|
||||
JNA_JNI_VERSION=3.5.0 # auto-generated by ant
|
||||
CHECKSUM=60417f69d77e4d8d693b43391a4a5b91 # auto-generated by ant
|
||||
|
||||
JAVA_INCLUDES=-I"$(JAVA_HOME)/include" \
|
||||
-I"$(JAVA_HOME)/include/$(OS)"
|
||||
@@ -50,6 +57,7 @@ JAVAH=$(BUILD)
|
||||
INSTALLDIR=../build/$(OS)
|
||||
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(BUILD)/callback.o $(EXTRAOBJS)
|
||||
RSRC=$(BUILD)/rsrc.o
|
||||
DLLCB=$(BUILD)/dll-callback.o
|
||||
ifneq ($(DYNAMIC_LIBFFI),true)
|
||||
FFI_SRC=$(shell pwd)/libffi
|
||||
FFI_BUILD=$(BUILD)/libffi
|
||||
@@ -96,6 +104,25 @@ endif
|
||||
STRIP=strip -x
|
||||
# end defaults
|
||||
|
||||
# Android build (cross-compile) requires the android SDK+NDK.
|
||||
# Ensure the following tools are in your path and adjust NDK_PLATFORM as needed
|
||||
ifeq ($(OS),android)
|
||||
CC=arm-linux-androideabi-gcc
|
||||
CPP=arm-linux-androideabi-cpp
|
||||
LD=arm-linux-androideabi-gcc
|
||||
RANLIB=arm-linux-androideabi-ranlib
|
||||
STRIP=arm-linux-androideabi-strip -x
|
||||
CDEFINES=-DNO_JAWT -DNO_WEAK_GLOBALS -DFFI_MMAP_EXEC_WRIT=1 -DFFI_MMAP_EXEC_SELINUX=0
|
||||
COPT+=-fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -march=armv5te -mtune=xscale -msoft-float
|
||||
NDK_PLATFORM?=/Developer/Applications/android-ndk-r7c/platforms/android-14
|
||||
JAVA_INCLUDES=
|
||||
CINCLUDES+=-I"$(NDK_PLATFORM)/arch-arm/usr/include" # -I/usr/include
|
||||
LIBS=-nostdlib -L"$(NDK_PLATFORM)/arch-arm/usr/lib/" -lgcc -lc -ldl -lm
|
||||
LDFLAGS+=-Wl,-shared,-Bsymbolic
|
||||
FFI_ENV=CPP="$(CPP)" CC="$(CC)" CFLAGS="$(COPT) $(CDEBUG) $(CINCLUDES)" CPPFLAGS="$(CDEFINES) $(CINCLUDES)" LIBS="$(LIBS)" RANLIB="$(RANLIB)"
|
||||
FFI_CONFIG=--enable-static --disable-shared --with-pic=yes --host=arm-linux-eabi
|
||||
endif
|
||||
|
||||
# W32CE build requires cegcc cross-compiler and phoneME JavaME implementation
|
||||
# cegcc: http://sf.net/projects/cegcc
|
||||
# phoneme: http://davy.preuveneers.net/
|
||||
@@ -121,7 +148,7 @@ endif
|
||||
|
||||
ifeq ($(OS),win32)
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
CDEFINES=-DHAVE_PROTECTION -DPSAPI_VERSION=1
|
||||
CDEFINES=-DHAVE_PROTECTION -DPSAPI_VERSION=1 -DFFI_BUILDING
|
||||
LIBS=-lpsapi
|
||||
WINDRES=windres
|
||||
EXTRAOBJS=$(RSRC)
|
||||
@@ -129,10 +156,11 @@ STRIP=@echo
|
||||
LIBPFX=
|
||||
LIBSFX=.dll
|
||||
|
||||
ifneq ($(ARCH),amd64)
|
||||
ifeq ($(CC),gcc)
|
||||
# -mno-cygwin is only available on GCC 3; GCC 4 requires an explicit mingw
|
||||
# installation
|
||||
GCC_VERSION = $(shell gcc --version | sed -n 's/.*\([34]\)[0-9.]*.*/\1/p')
|
||||
GCC_VERSION = $(shell gcc --version | sed -n 's/.*(GCC) \([0-9]\)\.[0-9.]*.*/\1/p')
|
||||
ifeq ($(GCC_VERSION),3)
|
||||
NOCYGWIN=-mno-cygwin
|
||||
else
|
||||
@@ -142,17 +170,21 @@ CC += $(NOCYGWIN)
|
||||
LD += $(NOCYGWIN) -Wl,--add-stdcall-alias
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),amd64)
|
||||
else
|
||||
|
||||
# Uncomment to enable MINGW64 cross compiler; ensure mingw32-gcc is in PATH
|
||||
# Should build properly as of 111121, but lacks SEH, so MSVC build is preferred
|
||||
#MINGW=x86_64-w64-mingw32-gcc
|
||||
# Set CC to $(MINGW) to enable mingw64 cross compiler; ensure $(MINGW) is in
|
||||
# PATH. Should build properly as of 111121, but lacks SEH, so MSVC build is
|
||||
# preferred
|
||||
MINGW_PREFIX?=x86_64-w64-mingw32-
|
||||
MINGW=$(MINGW_PREFIX)gcc
|
||||
# Still need windres from mingw distribution
|
||||
WINDRES=x86_64-w64-mingw32-windres
|
||||
WINDRES=$(MINGW_PREFIX)windres
|
||||
# To build entirely with mingw64, uncomment this line
|
||||
#CC=$(MINGW)
|
||||
|
||||
ifneq ($(MINGW),)
|
||||
ifeq ($(CC),$(MINGW))
|
||||
# No SEH under mingw64
|
||||
CDEFINES=-DPSAPI_VERSION=1
|
||||
CC = $(MINGW)
|
||||
LD = $(CC)
|
||||
LDFLAGS=-o $@ -shared
|
||||
LIBS= -lmingwex -lpsapi -lkernel32 -lmsvcrt
|
||||
@@ -165,8 +197,9 @@ LD=$(FFI_SRC)/../ld.sh -m64
|
||||
COPT=
|
||||
LIBS=psapi.lib
|
||||
ARSFX=.lib
|
||||
FFI_CONFIG+=--host=x86_64-pc-mingw32 && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
|
||||
FFI_ENV+=LD="$(LD) cpp=$(CPP)"
|
||||
FFI_CONFIG+=--host=x86_64-w64-mingw32 && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
|
||||
FFI_ENV+=LD="$(LD)" CPP="$(CPP)"
|
||||
EXTRAOBJS+=$(DLLCB)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -206,7 +239,7 @@ ifeq ($(OS),aix)
|
||||
LIBSFX=.a
|
||||
PCFLAGS+=-fPIC
|
||||
CDEFINES+=-DHAVE_PROTECTION -DNO_JAWT -Wall -D_AIX -DPOWERPC_AIX
|
||||
COPT+=-D_AIX -DPOWERPC_AIX -mxl-compat -g
|
||||
COPT+=-D_AIX -DPOWERPC_AIX -mxl-compat
|
||||
LDFLAGS+=-Wl,-lc128,-lc,-lm,-lpthread
|
||||
FFI_ENV+=AR_FLAGS="-X32_64 cru"
|
||||
STRIP=echo strip -X32_64
|
||||
@@ -284,7 +317,7 @@ endif
|
||||
# Unfortunately, we have to use different libffi include files depending on
|
||||
# the target, so we can't do a simple universal build on darwin. Do
|
||||
# separate builds, then merge the results.
|
||||
$(BUILD)/%.o : %.c dispatch.h $(FFI_LIB)
|
||||
$(BUILD)/%.o : %.c dispatch.h protect.h $(FFI_LIB)
|
||||
@mkdir -p $(BUILD)
|
||||
ifneq ($(SDKROOT),)
|
||||
$(CC) -arch $(ARCH) $(CFLAGS) -c $< -o $@.$(ARCH)
|
||||
@@ -302,6 +335,9 @@ install:
|
||||
mkdir $(INSTALLDIR)
|
||||
cp $(LIBRARY) $(INSTALLDIR)
|
||||
|
||||
$(DLLCB): dll-callback.c
|
||||
$(MINGW) -DDEFINE_CALLBACKS -c $< $(COUT)
|
||||
|
||||
$(RSRC): $(BUILD)/jnidispatch.rc
|
||||
$(WINDRES) -i $< -o $@ \
|
||||
|| (echo > $@.c && $(CC) $(CFLAGS) -c $@.c $(COUT))
|
||||
@@ -319,10 +355,10 @@ else
|
||||
TESTDEP=$(TESTLIB)
|
||||
endif
|
||||
$(TESTLIB2): $(BUILD)/testlib2.o
|
||||
$(LD) $(LDFLAGS) $< $(TESTDEP)
|
||||
$(LD) $(LDFLAGS) $< $(TESTDEP) $(LIBS)
|
||||
|
||||
ifneq ($(DYNAMIC_LIBFFI),true)
|
||||
$(FFI_LIB):
|
||||
$(FFI_LIB):
|
||||
@mkdir -p $(FFI_BUILD)
|
||||
@if [ ! -f $(FFI_BUILD)/Makefile ]; then \
|
||||
echo "Configuring libffi ($(ARCH))"; \
|
||||
|
||||
+12
-2
@@ -1,3 +1,13 @@
|
||||
--- libffi notes ---
|
||||
All JNA customizations to date have been merged to upstream libffi. This
|
||||
source tree has been synched to http://github.com/atgreen/libffi.
|
||||
The libffi subdirectory is managed as a subtree. Use subtree merging
|
||||
to update from upstream, e.g.
|
||||
|
||||
$ git pull -s subtree libffi master (or other branch, if necessary)
|
||||
|
||||
The libffi subdirectory was originally mapped as follows:
|
||||
|
||||
$ git remote add -f libffi git@github.com:atgreen/libffi.git
|
||||
$ git merge -s ours --no-commit libffi/master
|
||||
$ git read-tree --prefix=native/libffi -u libffi/master
|
||||
$ git commit -m "Merge libffi as subtree"
|
||||
|
||||
|
||||
+178
-33
@@ -12,6 +12,7 @@
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
@@ -30,14 +31,54 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static void callback_dispatch(ffi_cif*, void*, void**, void*);
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
||||
#include "com_sun_jna_win32_DLLCallback.h"
|
||||
#ifdef _WIN64
|
||||
#ifdef _MSC_VER
|
||||
/* See dll-callback.c (compiled with mingw64) for actual definitions; no
|
||||
inline asm support for MSVC and no RIP-relative instructions allowed in
|
||||
ML64.
|
||||
*/
|
||||
#define ASMFN(X) extern void asmfn ## X ()
|
||||
#else
|
||||
#include "dll-callback.c"
|
||||
#endif
|
||||
#else /* _WIN64 */
|
||||
#ifdef _MSC_VER
|
||||
// FIXME is "PROC NEAR" correct?
|
||||
#define ASMFN(X) extern void asmfn ## X(); \
|
||||
__asm asmfn ## X PROC NEAR \
|
||||
__asm jmp fn[X]
|
||||
#else
|
||||
#define ASMFN(X) extern void asmfn ## X (); asm(".globl _asmfn" #X "\n\
|
||||
_asmfn" #X ":\n\
|
||||
jmp *(_fn+4*" #X ")")
|
||||
#endif
|
||||
#endif /* _WIN64 */
|
||||
|
||||
// Allocatable trampoline targets
|
||||
#define DLL_FPTRS com_sun_jna_win32_DLLCallback_DLL_FPTRS
|
||||
void (*fn[DLL_FPTRS])();
|
||||
|
||||
ASMFN(0);ASMFN(1);ASMFN(2);ASMFN(3);ASMFN(4);ASMFN(5);ASMFN(6);ASMFN(7);
|
||||
ASMFN(8);ASMFN(9);ASMFN(10);ASMFN(11);ASMFN(12);ASMFN(13);ASMFN(14);ASMFN(15);
|
||||
|
||||
static void * const dll_fptrs[] = {
|
||||
&asmfn0, &asmfn1, &asmfn2, &asmfn3, &asmfn4, &asmfn5, &asmfn6, &asmfn7,
|
||||
&asmfn8, &asmfn9, &asmfn10, &asmfn11, &asmfn12, &asmfn13, &asmfn14, &asmfn15,
|
||||
};
|
||||
|
||||
#endif /* _WIN32 && !_WIN32_WCE */
|
||||
|
||||
static void callback_dispatch(ffi_cif*, void*, void**, void*);
|
||||
static jclass classObject;
|
||||
|
||||
callback*
|
||||
create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
jobjectArray param_types, jclass return_type,
|
||||
callconv_t calling_convention, jboolean direct) {
|
||||
callconv_t calling_convention, jint options) {
|
||||
jboolean direct = options & CB_OPTION_DIRECT;
|
||||
jboolean in_dll = options & CB_OPTION_IN_DLL;
|
||||
callback* cb;
|
||||
ffi_abi abi = FFI_DEFAULT_ABI;
|
||||
ffi_abi java_abi = FFI_DEFAULT_ABI;
|
||||
@@ -60,6 +101,7 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
|
||||
cb = (callback *)malloc(sizeof(callback));
|
||||
cb->closure = ffi_closure_alloc(sizeof(ffi_closure), &cb->x_closure);
|
||||
cb->saved_x_closure = cb->x_closure;
|
||||
cb->object = (*env)->NewWeakGlobalRef(env, obj);
|
||||
cb->methodID = (*env)->FromReflectedMethod(env, method);
|
||||
|
||||
@@ -81,6 +123,9 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
cb->arg_classes[i] = (*env)->NewWeakGlobalRef(env, cls);
|
||||
cvt = 1;
|
||||
}
|
||||
else {
|
||||
cb->arg_classes[i] = NULL;
|
||||
}
|
||||
|
||||
jtype = get_jtype(env, cls);
|
||||
if (jtype == -1) {
|
||||
@@ -91,6 +136,9 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
}
|
||||
cb->arg_jtypes[i] = (char)jtype;
|
||||
cb->java_arg_types[i+3] = cb->arg_types[i] = get_ffi_type(env, cls, cb->arg_jtypes[i]);
|
||||
if (!cb->java_arg_types[i+3]) {
|
||||
goto failure_cleanup;
|
||||
}
|
||||
if (cb->flags[i] == CVT_NATIVE_MAPPED
|
||||
|| cb->flags[i] == CVT_POINTER_TYPE
|
||||
|| cb->flags[i] == CVT_INTEGER_TYPE) {
|
||||
@@ -106,6 +154,9 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
cb->arg_jtypes[i] = (char)jtype;
|
||||
cb->java_arg_types[i+3] = &ffi_type_pointer;
|
||||
cb->arg_types[i] = get_ffi_type(env, ncls, cb->arg_jtypes[i]);
|
||||
if (!cb->arg_types[i]) {
|
||||
goto failure_cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (cb->arg_types[i]->type == FFI_TYPE_FLOAT) {
|
||||
@@ -138,6 +189,7 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
if (calling_convention == CALLCONV_STDCALL) {
|
||||
abi = FFI_STDCALL;
|
||||
}
|
||||
// Calling into Java on win32 *always* uses stdcall
|
||||
java_abi = FFI_STDCALL;
|
||||
#endif // _WIN32
|
||||
|
||||
@@ -166,21 +218,39 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
rtype = '*';
|
||||
}
|
||||
switch(rtype) {
|
||||
case 'V': cb->fptr = (*env)->CallVoidMethod; break;
|
||||
case 'Z': cb->fptr = (*env)->CallBooleanMethod; break;
|
||||
case 'B': cb->fptr = (*env)->CallByteMethod; break;
|
||||
case 'S': cb->fptr = (*env)->CallShortMethod; break;
|
||||
case 'C': cb->fptr = (*env)->CallCharMethod; break;
|
||||
case 'I': cb->fptr = (*env)->CallIntMethod; break;
|
||||
case 'J': cb->fptr = (*env)->CallLongMethod; break;
|
||||
case 'F': cb->fptr = (*env)->CallFloatMethod; break;
|
||||
case 'D': cb->fptr = (*env)->CallDoubleMethod; break;
|
||||
default: cb->fptr = (*env)->CallObjectMethod; break;
|
||||
#define OFFSETOF(ENV,METHOD) ((size_t)((char *)&(*(ENV))->METHOD - (char *)(*(ENV))))
|
||||
case 'V': cb->fptr_offset = OFFSETOF(env, CallVoidMethod); break;
|
||||
case 'Z': cb->fptr_offset = OFFSETOF(env, CallBooleanMethod); break;
|
||||
case 'B': cb->fptr_offset = OFFSETOF(env, CallByteMethod); break;
|
||||
case 'S': cb->fptr_offset = OFFSETOF(env, CallShortMethod); break;
|
||||
case 'C': cb->fptr_offset = OFFSETOF(env, CallCharMethod); break;
|
||||
case 'I': cb->fptr_offset = OFFSETOF(env, CallIntMethod); break;
|
||||
case 'J': cb->fptr_offset = OFFSETOF(env, CallLongMethod); break;
|
||||
case 'F': cb->fptr_offset = OFFSETOF(env, CallFloatMethod); break;
|
||||
case 'D': cb->fptr_offset = OFFSETOF(env, CallDoubleMethod); break;
|
||||
default: cb->fptr_offset = OFFSETOF(env, CallObjectMethod); break;
|
||||
}
|
||||
status = ffi_prep_cif(&cb->java_cif, java_abi, argc+3, java_ffi_rtype, cb->java_arg_types);
|
||||
if (!ffi_error(env, "callback setup (2)", status)) {
|
||||
ffi_prep_closure_loc(cb->closure, &cb->cif, callback_dispatch, cb,
|
||||
cb->x_closure);
|
||||
#ifdef DLL_FPTRS
|
||||
// Find an available function pointer and assign it
|
||||
if (in_dll) {
|
||||
for (i=0;i < DLL_FPTRS;i++) {
|
||||
if (fn[i] == NULL) {
|
||||
fn[i] = cb->x_closure;
|
||||
cb->x_closure = dll_fptrs[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == DLL_FPTRS) {
|
||||
throw_type = EOutOfMemory;
|
||||
throw_msg = "No more DLL callback slots available";
|
||||
goto failure_cleanup;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return cb;
|
||||
}
|
||||
}
|
||||
@@ -195,20 +265,31 @@ create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
}
|
||||
void
|
||||
free_callback(JNIEnv* env, callback *cb) {
|
||||
int i;
|
||||
(*env)->DeleteWeakGlobalRef(env, cb->object);
|
||||
ffi_closure_free(cb->closure);
|
||||
free(cb->arg_types);
|
||||
if (cb->arg_classes) {
|
||||
unsigned i;
|
||||
for (i=0;i < cb->cif.nargs;i++) {
|
||||
(*env)->DeleteWeakGlobalRef(env, cb->arg_classes[i]);
|
||||
if (cb->arg_classes[i]) {
|
||||
(*env)->DeleteWeakGlobalRef(env, cb->arg_classes[i]);
|
||||
}
|
||||
}
|
||||
free(cb->arg_classes);
|
||||
}
|
||||
free(cb->java_arg_types);
|
||||
if (cb->flags)
|
||||
if (cb->flags) {
|
||||
free(cb->flags);
|
||||
}
|
||||
free(cb->arg_jtypes);
|
||||
#ifdef DLL_FPTRS
|
||||
for (i=0;i < DLL_FPTRS;i++) {
|
||||
if (fn[i] == cb->saved_x_closure) {
|
||||
fn[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
free(cb);
|
||||
}
|
||||
|
||||
@@ -269,36 +350,32 @@ callback_invoke(JNIEnv* env, callback *cb, ffi_cif* cif, void *resp, void **cbar
|
||||
case CVT_INTEGER_TYPE:
|
||||
case CVT_POINTER_TYPE:
|
||||
case CVT_NATIVE_MAPPED:
|
||||
*((void **)args[i+3]) = fromNative(env, cb->arg_classes[i], cif->arg_types[i], args[i+3], JNI_FALSE);
|
||||
// Make sure we have space enough for the new argument
|
||||
args[i+3] = alloca(sizeof(void *));
|
||||
*((void **)args[i+3]) = fromNative(env, cb->arg_classes[i], cif->arg_types[i], cbargs[i], JNI_FALSE);
|
||||
break;
|
||||
case CVT_POINTER:
|
||||
*((void **)args[i+3]) = newJavaPointer(env, *(void **)args[i+3]);
|
||||
*((void **)args[i+3]) = newJavaPointer(env, *(void **)cbargs[i]);
|
||||
break;
|
||||
case CVT_STRING:
|
||||
*((void **)args[i+3]) = newJavaString(env, *(void **)args[i+3], JNI_FALSE);
|
||||
*((void **)args[i+3]) = newJavaString(env, *(void **)cbargs[i], JNI_FALSE);
|
||||
break;
|
||||
case CVT_WSTRING:
|
||||
*((void **)args[i+3]) = newJavaWString(env, *(void **)args[i+3]);
|
||||
*((void **)args[i+3]) = newJavaWString(env, *(void **)cbargs[i]);
|
||||
break;
|
||||
case CVT_STRUCTURE:
|
||||
*((void **)args[i+3]) = newJavaStructure(env, *(void **)args[i+3], cb->arg_classes[i], JNI_FALSE);
|
||||
*((void **)args[i+3]) = newJavaStructure(env, *(void **)cbargs[i], cb->arg_classes[i], JNI_FALSE);
|
||||
break;
|
||||
case CVT_STRUCTURE_BYVAL:
|
||||
{
|
||||
void *ptr = args[i+3];
|
||||
args[i+3] = alloca(sizeof(void *));
|
||||
*((void **)args[i+3]) = newJavaStructure(env, ptr, cb->arg_classes[i], JNI_TRUE);
|
||||
}
|
||||
args[i+3] = alloca(sizeof(void *));
|
||||
*((void **)args[i+3]) = newJavaStructure(env, cbargs[i], cb->arg_classes[i], JNI_TRUE);
|
||||
break;
|
||||
case CVT_CALLBACK:
|
||||
*((void **)args[i+3]) = newJavaCallback(env, *(void **)args[i+3], cb->arg_classes[i]);
|
||||
*((void **)args[i+3]) = newJavaCallback(env, *(void **)cbargs[i], cb->arg_classes[i]);
|
||||
break;
|
||||
case CVT_FLOAT:
|
||||
{
|
||||
void *ptr = alloca(sizeof(double));
|
||||
*(double *)ptr = *(float*)args[i+3];
|
||||
args[i+3] = ptr;
|
||||
}
|
||||
args[i+3] = alloca(sizeof(double));
|
||||
*((double *)args[i+3]) = *(float*)cbargs[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -310,15 +387,18 @@ callback_invoke(JNIEnv* env, callback *cb, ffi_cif* cif, void *resp, void **cbar
|
||||
else if (cb->cif.rtype->size > cif->rtype->size) {
|
||||
resp = alloca(cb->cif.rtype->size);
|
||||
}
|
||||
ffi_call(&cb->java_cif, FFI_FN(cb->fptr), resp, args);
|
||||
#define FPTR(ENV,OFFSET) (*(void **)((char *)(*(ENV)) + OFFSET))
|
||||
#define JNI_FN(X) ((void (*)(void))(X))
|
||||
ffi_call(&cb->java_cif, JNI_FN(FPTR(env, cb->fptr_offset)), resp, args);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
jthrowable throwable = (*env)->ExceptionOccurred(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
if (!handle_exception(env, self, throwable)) {
|
||||
fprintf(stderr, "JNA: error handling callback exception, continuing\n");
|
||||
}
|
||||
if (cif->rtype->type != FFI_TYPE_VOID)
|
||||
if (cif->rtype->type != FFI_TYPE_VOID) {
|
||||
memset(oldresp, 0, cif->rtype->size);
|
||||
}
|
||||
}
|
||||
else switch(cb->rflag) {
|
||||
case CVT_INTEGER_TYPE:
|
||||
@@ -360,7 +440,7 @@ callback_invoke(JNIEnv* env, callback *cb, ffi_cif* cif, void *resp, void **cbar
|
||||
if (cb->flags) {
|
||||
for (i=0;i < cif->nargs;i++) {
|
||||
if (cb->flags[i] == CVT_STRUCTURE) {
|
||||
writeStructure(env, *(void **)args[i+3]);
|
||||
writeStructure(env, *(void **)cbargs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -391,6 +471,67 @@ callback_invoke(JNIEnv* env, callback *cb, ffi_cif* cif, void *resp, void **cbar
|
||||
}
|
||||
}
|
||||
|
||||
// Handle automatic thread cleanup
|
||||
static void detach_thread(void* data) {
|
||||
if (data != NULL) {
|
||||
JavaVM* jvm = (JavaVM *)data;
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static DWORD dwTlsIndex;
|
||||
BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
dwTlsIndex = TlsAlloc();
|
||||
if (dwTlsIndex == TLS_OUT_OF_INDEXES) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
TlsFree(dwTlsIndex);
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH: {
|
||||
detach_thread(TlsGetValue(dwTlsIndex));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
static pthread_key_t key;
|
||||
static void make_key() {
|
||||
pthread_key_create(&key, detach_thread);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Set up to detach the thread when it exits, or clear any handlers if the
|
||||
argument is NULL.
|
||||
*/
|
||||
static void
|
||||
jvm_detach_on_exit(JavaVM* jvm) {
|
||||
#ifdef _WIN32
|
||||
TlsSetValue(dwTlsIndex, (void *)jvm);
|
||||
#else
|
||||
static pthread_once_t key_once = PTHREAD_ONCE_INIT;
|
||||
pthread_once(&key_once, make_key);
|
||||
if (!jvm || pthread_getspecific(key) == NULL) {
|
||||
pthread_setspecific(key, jvm);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
callback_dispatch(ffi_cif* cif, void* resp, void** cbargs, void* user_data) {
|
||||
callback* cb = ((callback *)user_data);
|
||||
@@ -453,6 +594,10 @@ callback_dispatch(ffi_cif* cif, void* resp, void** cbargs, void* user_data) {
|
||||
|
||||
if (detach) {
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
jvm_detach_on_exit(NULL);
|
||||
}
|
||||
else if (!was_attached) {
|
||||
jvm_detach_on_exit(jvm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+26
-10
@@ -6,12 +6,13 @@
|
||||
#
|
||||
|
||||
nowarn="/wd4127 /wd4820 /wd4706 /wd4100 /wd4255 /wd4668"
|
||||
args="/nologo /EHac /W3 /LD $nowarn" # /WX
|
||||
args="/nologo /EHac /W3 $nowarn" # /WX
|
||||
#md="/MD"
|
||||
|
||||
cl="cl"
|
||||
ml="ml"
|
||||
|
||||
if [ -z "$INCLUDE" -o -z "$LIB" ]; then
|
||||
if [ -z "$INCLUDE" -a -z "$Include" -o -z "$LIB" -a -z "$Lib" ]; then
|
||||
exit "INCLUDE and LIB must be set for CL.EXE to function properly"
|
||||
fi
|
||||
|
||||
@@ -35,18 +36,26 @@ do
|
||||
shift 1
|
||||
;;
|
||||
-m32)
|
||||
if echo $PATH | grep x64_amd64; then
|
||||
if echo $PATH | grep amd64 >& /dev/null; then
|
||||
echo "Wrong CL.EXE in path; use 32-bit version"
|
||||
exit 1
|
||||
fi
|
||||
if echo $LIB | grep amd64 >& /dev/null; then
|
||||
echo "Wrong paths in LIB; use 32-bit version"
|
||||
exit 1
|
||||
fi
|
||||
ml=ml
|
||||
shift 1
|
||||
;;
|
||||
-m64)
|
||||
if ! echo $PATH | grep x64_amd64; then
|
||||
if ! echo $PATH | grep amd64 >& /dev/null; then
|
||||
echo "Wrong CL.EXE in path; use 64-bit version"
|
||||
exit 1
|
||||
fi
|
||||
if ! echo $LIB | grep amd64 >& /dev/null; then
|
||||
echo "Wrong paths in LIB; use 64-bit version"
|
||||
exit 1
|
||||
fi
|
||||
ml=ml64
|
||||
shift 1
|
||||
;;
|
||||
@@ -57,7 +66,7 @@ do
|
||||
-g)
|
||||
# using /RTC1 instead of /GZ
|
||||
args="$args /Od /D_DEBUG /RTC1 /Zi"
|
||||
md=/MDd
|
||||
# md=/MDd
|
||||
shift 1
|
||||
;;
|
||||
-c)
|
||||
@@ -66,6 +75,10 @@ do
|
||||
single=/c
|
||||
shift 1
|
||||
;;
|
||||
-shared)
|
||||
args="$args /LD"
|
||||
shift 1
|
||||
;;
|
||||
-D*=*)
|
||||
name="$(echo $1|sed 's/-D\([^=][^=]*\)=.*/\1/g')"
|
||||
value="$(echo $1|sed 's/-D[^=][^=]*=//g')"
|
||||
@@ -119,6 +132,9 @@ do
|
||||
file=$(cygpath -m "$2")
|
||||
outdir=$(dirname "$file")
|
||||
base=$(basename "$file"|sed 's/\.[^.]*//g')
|
||||
if [ -n "$assembly" ]; then
|
||||
target="$file"
|
||||
fi
|
||||
if [ -n "$single" ]; then
|
||||
output="/Fo$file"
|
||||
else
|
||||
@@ -134,8 +150,8 @@ do
|
||||
*.S)
|
||||
file=$(cygpath -m "$1")
|
||||
src=$(echo $file|sed -e 's/.S$/.asm/g' -e 's%\\%/%g')
|
||||
echo "$cl /EP $includes $defines \"$file\" > \"$src\""
|
||||
"$cl" /nologo /EP $includes $defines "$file" > "$src" || exit $?
|
||||
echo "$cl /nologo /EP $includes $defines \"$file\" > \"$src\""
|
||||
eval "$cl /nologo /EP $includes $defines \"$file\"" > "$src" || exit $?
|
||||
md=""
|
||||
cl="$ml"
|
||||
output=$(echo $output | sed 's%/F[dpa][^ ]*%%g')
|
||||
@@ -161,12 +177,12 @@ do
|
||||
done
|
||||
|
||||
args="$md $args"
|
||||
echo "$cl $args (INCLUDE=$INCLUDE LIB=$LIB)"
|
||||
eval "\"$cl\" $args"
|
||||
echo "$cl $args"
|
||||
eval "$cl $args"
|
||||
result=$?
|
||||
# @#!%@!# ml64 broken output
|
||||
if [ -n "$assembly" ]; then
|
||||
mv $src $outdir
|
||||
mv *.obj $outdir
|
||||
mv *.obj $target
|
||||
fi
|
||||
exit $result
|
||||
|
||||
+78
-43
@@ -2,7 +2,7 @@
|
||||
* @(#)dispatch.c 1.9 98/03/22
|
||||
*
|
||||
* Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright (c) 2007-2011 Timothy Wall. All Rights Reserved.
|
||||
* Copyright (c) 2007-2012 Timothy Wall. All Rights Reserved.
|
||||
* Copyright (c) 2007 Wayne Meissner. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -16,11 +16,6 @@
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* JNI native methods supporting the infrastructure for shared
|
||||
* dispatchers.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4201 ) /* nameless struct/union (jni_md.h) */
|
||||
@@ -42,13 +37,13 @@
|
||||
*/
|
||||
#ifdef _WIN32_WCE
|
||||
#include <tlhelp32.h>
|
||||
#define LOAD_OPTS 0 /* altered search path unsupported on CE */
|
||||
#define DEFAULT_LOAD_OPTS 0 /* altered search path unsupported on CE */
|
||||
#undef GetProcAddress
|
||||
#define GetProcAddress GetProcAddressA
|
||||
#else
|
||||
#define LOAD_OPTS LOAD_WITH_ALTERED_SEARCH_PATH
|
||||
#define DEFAULT_LOAD_OPTS LOAD_WITH_ALTERED_SEARCH_PATH
|
||||
#endif
|
||||
#define LOAD_LIBRARY(NAME) (NAME ? LoadLibraryExW(NAME, NULL, LOAD_OPTS) : GetModuleHandleW(NULL))
|
||||
#define LOAD_LIBRARY(NAME,OPTS) (NAME ? LoadLibraryExW(NAME, NULL, OPTS) : GetModuleHandleW(NULL))
|
||||
#define LOAD_ERROR(BUF,LEN) w32_format_error(GetLastError(), BUF, LEN)
|
||||
#define STR_ERROR(CODE,BUF,LEN) w32_format_error(CODE, BUF, LEN)
|
||||
#define FREE_LIBRARY(HANDLE) (((HANDLE)==GetModuleHandleW(NULL) || FreeLibrary(HANDLE))?0:-1)
|
||||
@@ -64,7 +59,8 @@
|
||||
#else
|
||||
#define NAME2CSTR(ENV,JSTR) newCString(ENV,JSTR)
|
||||
#endif
|
||||
#define LOAD_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY|RTLD_GLOBAL)
|
||||
#define DEFAULT_LOAD_OPTS (RTLD_LAZY|RTLD_GLOBAL)
|
||||
#define LOAD_LIBRARY(NAME,OPTS) dlopen(NAME, OPTS)
|
||||
#define LOAD_ERROR(BUF,LEN) (snprintf(BUF, LEN, "%s", dlerror()), BUF)
|
||||
#define STR_ERROR(CODE,BUF,LEN) (strerror_r(CODE, BUF, LEN), BUF)
|
||||
#define FREE_LIBRARY(HANDLE) dlclose(HANDLE)
|
||||
@@ -76,7 +72,8 @@
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
#undef LOAD_LIBRARY
|
||||
#define LOAD_LIBRARY(NAME) dlopen(NAME, RTLD_MEMBER| RTLD_LAZY | RTLD_GLOBAL)
|
||||
#define DEFAULT_LOAD_OPTS (RTLD_MEMBER| RTLD_LAZY | RTLD_GLOBAL)
|
||||
#define LOAD_LIBRARY(NAME,OPTS) dlopen(NAME, OPTS)
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -91,6 +88,15 @@
|
||||
|
||||
#include "dispatch.h"
|
||||
|
||||
/* Native memory fault protection */
|
||||
#ifdef HAVE_PROTECTION
|
||||
#define PROTECT is_protected()
|
||||
#endif
|
||||
#include "protect.h"
|
||||
#define ON_ERROR() throwByName(env, EError, "Invalid memory access")
|
||||
#define PSTART() PROTECTED_START()
|
||||
#define PEND() PROTECTED_END(ON_ERROR())
|
||||
|
||||
#ifdef HAVE_PROTECTION
|
||||
static int _protect;
|
||||
#undef PROTECT
|
||||
@@ -98,7 +104,7 @@ static int _protect;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -624,7 +630,6 @@ getChars(JNIEnv* env, wchar_t* volatile dst, jcharArray chars, volatile jint off
|
||||
static void
|
||||
setChars(JNIEnv* env, wchar_t* src, jcharArray chars, volatile jint off, volatile jint len) {
|
||||
jchar* buf = (jchar*)src;
|
||||
int malloced = 0;
|
||||
PSTART();
|
||||
|
||||
if (sizeof(jchar) == sizeof(wchar_t)) {
|
||||
@@ -826,13 +831,17 @@ newJavaStructure(JNIEnv *env, void *data, jclass type, jboolean new_memory)
|
||||
volatile jobject obj = (*env)->CallStaticObjectMethod(env, classStructure, MID_Structure_newInstance, type);
|
||||
if (obj != NULL) {
|
||||
ffi_type* rtype = getStructureType(env, obj);
|
||||
if (new_memory) {
|
||||
MEMCPY(getStructureAddress(env, obj), data, rtype->size);
|
||||
if (rtype) {
|
||||
if (new_memory) {
|
||||
MEMCPY(getStructureAddress(env, obj), data, rtype->size);
|
||||
}
|
||||
else {
|
||||
(*env)->CallVoidMethod(env, obj, MID_Structure_useMemory, newJavaPointer(env, data));
|
||||
}
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
(*env)->CallVoidMethod(env, obj, MID_Structure_read);
|
||||
}
|
||||
}
|
||||
else {
|
||||
(*env)->CallVoidMethod(env, obj, MID_Structure_useMemory, newJavaPointer(env, data));
|
||||
}
|
||||
(*env)->CallVoidMethod(env, obj, MID_Structure_read);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "JNA: failed to create structure\n");
|
||||
@@ -860,7 +869,9 @@ getNativeString(JNIEnv* env, jstring s, jboolean wide) {
|
||||
jobject ptr = (*env)->CallStaticObjectMethod(env, classCallbackReference,
|
||||
MID_CallbackReference_getNativeString,
|
||||
s, wide);
|
||||
return getNativeAddress(env, ptr);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
return getNativeAddress(env, ptr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -975,7 +986,9 @@ void *
|
||||
getStructureAddress(JNIEnv *env, jobject obj) {
|
||||
if (obj != NULL) {
|
||||
jobject ptr = (*env)->GetObjectField(env, obj, FID_Structure_memory);
|
||||
return getNativeAddress(env, ptr);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
return getNativeAddress(env, ptr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -991,7 +1004,9 @@ void *
|
||||
getCallbackAddress(JNIEnv *env, jobject obj) {
|
||||
if (obj != NULL) {
|
||||
jobject ptr = (*env)->CallStaticObjectMethod(env, classCallbackReference, MID_CallbackReference_getFunctionPointer, obj, JNI_TRUE);
|
||||
return getNativeAddress(env, ptr);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
return getNativeAddress(env, ptr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1041,7 +1056,9 @@ void
|
||||
toNative(JNIEnv* env, jobject obj, void* valuep, size_t size, jboolean promote) {
|
||||
if (obj != NULL) {
|
||||
jobject arg = (*env)->CallObjectMethod(env, obj, MID_NativeMapped_toNative);
|
||||
extract_value(env, arg, valuep, size, promote);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
extract_value(env, arg, valuep, size, promote);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MEMSET(valuep, 0, size);
|
||||
@@ -1052,7 +1069,9 @@ static void
|
||||
toNativeTypeMapped(JNIEnv* env, jobject obj, void* valuep, size_t size, jobject to_native) {
|
||||
if (obj != NULL) {
|
||||
jobject arg = (*env)->CallStaticObjectMethod(env, classNative, MID_Native_toNativeTypeMapped, to_native, obj);
|
||||
extract_value(env, arg, valuep, size, JNI_FALSE);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
extract_value(env, arg, valuep, size, JNI_FALSE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MEMSET(valuep, 0, size);
|
||||
@@ -1063,12 +1082,16 @@ static void
|
||||
fromNativeTypeMapped(JNIEnv* env, jobject from_native, void* resp, ffi_type* type, jclass javaClass, void* result) {
|
||||
int jtype = get_jtype_from_ffi_type(type);
|
||||
jobject value = new_object(env, (char)jtype, resp, JNI_TRUE);
|
||||
jobject obj = (*env)->CallStaticObjectMethod(env, classNative,
|
||||
MID_Native_fromNativeTypeMapped,
|
||||
from_native, value, javaClass);
|
||||
// Must extract primitive types
|
||||
if (type->type != FFI_TYPE_POINTER) {
|
||||
extract_value(env, obj, result, type->size, JNI_TRUE);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
jobject obj = (*env)->CallStaticObjectMethod(env, classNative,
|
||||
MID_Native_fromNativeTypeMapped,
|
||||
from_native, value, javaClass);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
// Must extract primitive types
|
||||
if (type->type != FFI_TYPE_POINTER) {
|
||||
extract_value(env, obj, result, type->size, JNI_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,9 +1099,12 @@ jobject
|
||||
fromNative(JNIEnv* env, jclass javaClass, ffi_type* type, void* resp, jboolean promote) {
|
||||
int jtype = get_jtype_from_ffi_type(type);
|
||||
jobject value = new_object(env, (char)jtype, resp, promote);
|
||||
return (*env)->CallStaticObjectMethod(env, classNative,
|
||||
MID_Native_fromNative,
|
||||
javaClass, value);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
return (*env)->CallStaticObjectMethod(env, classNative,
|
||||
MID_Native_fromNative,
|
||||
javaClass, value);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1087,7 +1113,9 @@ getStructureType(JNIEnv *env, jobject obj) {
|
||||
jlong typeInfo = (*env)->GetLongField(env, obj, FID_Structure_typeInfo);
|
||||
if (!typeInfo) {
|
||||
(*env)->CallObjectMethod(env, obj, MID_Structure_getTypeInfo);
|
||||
typeInfo = (*env)->GetLongField(env, obj, FID_Structure_typeInfo);
|
||||
if (!(*env)->ExceptionCheck(env)) {
|
||||
typeInfo = (*env)->GetLongField(env, obj, FID_Structure_typeInfo);
|
||||
}
|
||||
}
|
||||
return (ffi_type*)L2A(typeInfo);
|
||||
}
|
||||
@@ -1513,7 +1541,10 @@ get_ffi_type(JNIEnv* env, jclass cls, char jtype) {
|
||||
case 's': {
|
||||
jobject s = (*env)->CallStaticObjectMethod(env, classStructure,
|
||||
MID_Structure_newInstance, cls);
|
||||
return getStructureType(env, s);
|
||||
if (s) {
|
||||
return getStructureType(env, s);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
case '*':
|
||||
default:
|
||||
@@ -1686,6 +1717,9 @@ method_handler(ffi_cif* cif, void* volatile resp, void** argp, void *cdata) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (data->rflag == CVT_NATIVE_MAPPED) {
|
||||
@@ -1759,7 +1793,7 @@ method_handler(ffi_cif* cif, void* volatile resp, void** argp, void *cdata) {
|
||||
for (i=0;i < data->cif.nargs;i++) {
|
||||
switch(data->flags[i]) {
|
||||
case CVT_STRUCTURE:
|
||||
if (objects[i]) {
|
||||
if (objects[i] && !(*env)->ExceptionCheck(env)) {
|
||||
(*env)->CallVoidMethod(env, objects[i], MID_Structure_read);
|
||||
}
|
||||
break;
|
||||
@@ -1960,9 +1994,10 @@ Java_com_sun_jna_Native_createNativeCallback(JNIEnv *env,
|
||||
jobjectArray param_types,
|
||||
jclass return_type,
|
||||
jint call_conv,
|
||||
jboolean direct) {
|
||||
jint options) {
|
||||
callback* cb =
|
||||
create_callback(env, obj, method, param_types, return_type, call_conv, direct);
|
||||
create_callback(env, obj, method, param_types, return_type,
|
||||
call_conv, options);
|
||||
|
||||
return A2L(cb);
|
||||
}
|
||||
@@ -1977,10 +2012,10 @@ Java_com_sun_jna_Native_freeNativeCallback(JNIEnv *env,
|
||||
/*
|
||||
* Class: Native
|
||||
* Method: open
|
||||
* Signature: (Ljava/lang/String;)J
|
||||
* Signature: (Ljava/lang/String;I)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_com_sun_jna_Native_open(JNIEnv *env, jclass UNUSED(cls), jstring lib){
|
||||
Java_com_sun_jna_Native_open(JNIEnv *env, jclass UNUSED(cls), jstring lib, jint flags){
|
||||
/* dlopen on Unix allows NULL to mean "current process" */
|
||||
const STRTYPE libname = NULL;
|
||||
void *handle = NULL;
|
||||
@@ -1991,7 +2026,7 @@ Java_com_sun_jna_Native_open(JNIEnv *env, jclass UNUSED(cls), jstring lib){
|
||||
}
|
||||
}
|
||||
|
||||
handle = (void *)LOAD_LIBRARY(libname);
|
||||
handle = (void *)LOAD_LIBRARY(libname, flags != -1 ? flags : DEFAULT_LOAD_OPTS);
|
||||
if (!handle) {
|
||||
char buf[1024];
|
||||
throwByName(env, EUnsatisfiedLink, LOAD_ERROR(buf, sizeof(buf)));
|
||||
@@ -2814,7 +2849,7 @@ Java_com_sun_jna_Native_getWindowHandle0(JNIEnv *env, jclass UNUSED(classp), job
|
||||
#undef JAWT_NAME
|
||||
#define JAWT_NAME path
|
||||
#endif
|
||||
if ((jawt_handle = LOAD_LIBRARY(JAWT_NAME)) == NULL) {
|
||||
if ((jawt_handle = LOAD_LIBRARY(JAWT_NAME, DEFAULT_LOAD_OPTS)) == NULL) {
|
||||
char msg[1024];
|
||||
throwByName(env, EUnsatisfiedLink, LOAD_ERROR(msg, sizeof(msg)));
|
||||
return -1;
|
||||
@@ -2949,8 +2984,8 @@ Java_com_sun_jna_Native_getPreserveLastError(JNIEnv *UNUSED(env), jclass UNUSED(
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_sun_jna_Native_setLastError(JNIEnv *env, jclass UNUSED(classp), jint code) {
|
||||
SET_LAST_ERROR(code);
|
||||
update_last_error(env, code);
|
||||
SET_LAST_ERROR(code);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
|
||||
+11
-2
@@ -46,6 +46,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CB_OPTION_DIRECT com_sun_jna_Native_CB_OPTION_DIRECT
|
||||
#define CB_OPTION_IN_DLL com_sun_jna_Native_CB_OPTION_IN_DLL
|
||||
|
||||
/* These are the calling conventions an invocation can handle. */
|
||||
typedef enum _callconv {
|
||||
CALLCONV_C = com_sun_jna_Function_C_CONVENTION,
|
||||
@@ -107,7 +110,8 @@ typedef struct _callback {
|
||||
jmethodID methodID;
|
||||
char* arg_jtypes;
|
||||
jboolean direct;
|
||||
void* fptr;
|
||||
size_t fptr_offset;
|
||||
void* saved_x_closure;
|
||||
} callback;
|
||||
|
||||
#if defined(SOLARIS2) || defined(__GNUC__)
|
||||
@@ -167,7 +171,7 @@ extern const char* jnidispatch_callback_init(JNIEnv*);
|
||||
extern void jnidispatch_callback_dispose(JNIEnv*);
|
||||
extern callback* create_callback(JNIEnv*, jobject, jobject,
|
||||
jobjectArray, jclass,
|
||||
callconv_t, jboolean);
|
||||
callconv_t, jint);
|
||||
extern void free_callback(JNIEnv*, callback*);
|
||||
extern void extract_value(JNIEnv*, jobject, void*, size_t, jboolean);
|
||||
extern jobject new_object(JNIEnv*, char, void*, jboolean);
|
||||
@@ -200,6 +204,11 @@ extern jobject initializeThread(callback*,AttachOptions*);
|
||||
extern int lastError();
|
||||
extern void setLastError(int err);
|
||||
|
||||
#ifdef NO_WEAK_GLOBALS
|
||||
#define NewWeakGlobalRef NewGlobalRef
|
||||
#define DeleteWeakGlobalRef DeleteGlobalRef
|
||||
#endif
|
||||
|
||||
/* Native memory fault protection */
|
||||
#ifdef HAVE_PROTECTION
|
||||
#define PROTECT is_protected()
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Copyright (c) 2007-2012 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.
|
||||
* <p/>
|
||||
* 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.
|
||||
*/
|
||||
/* Must use mingw64 to compile this assembly code. ml64 can't generate the
|
||||
RIP-relative jumps we need.
|
||||
*/
|
||||
#define ASMFN(X) extern void asmfn ## X (); asm(".globl asmfn" #X "\n\
|
||||
asmfn" #X ":\n\
|
||||
jmp *fn+8*" #X "(%rip)")
|
||||
|
||||
#ifdef DEFINE_CALLBACKS
|
||||
extern void (*fn[])();
|
||||
ASMFN(0);ASMFN(1);ASMFN(2);ASMFN(3);ASMFN(4);ASMFN(5);ASMFN(6);ASMFN(7);
|
||||
ASMFN(8);ASMFN(9);ASMFN(10);ASMFN(11);ASMFN(12);ASMFN(13);ASMFN(14);ASMFN(15);
|
||||
#endif /* DEFINE_CALLBACKS */
|
||||
+11
-3
@@ -5,7 +5,7 @@
|
||||
#args="/pdbtype:sept"
|
||||
args="/nologo /opt:REF /incremental:no /subsystem:console /nodefaultlib:msvcrtd"
|
||||
|
||||
if [ -z "$LIB" ]; then
|
||||
if [ -z "$LIB" -a "$Lib" ]; then
|
||||
exit "LIB must be set for LINK.EXE to function properly"
|
||||
fi
|
||||
|
||||
@@ -15,17 +15,25 @@ do
|
||||
case $1
|
||||
in
|
||||
-m32)
|
||||
if echo $PATH | grep x64_amd64; then
|
||||
if echo $PATH | grep amd64; then
|
||||
echo "Wrong LINK.EXE in path; use 32-bit version"
|
||||
exit 1
|
||||
fi
|
||||
if echo $LIB | grep amd64; then
|
||||
echo "Wrong paths in LIB; use 32-bit version"
|
||||
exit 1
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-m64)
|
||||
if ! echo $PATH | grep x64_amd64; then
|
||||
if ! echo $PATH | grep amd64; then
|
||||
echo "Wrong LINK.EXE in path; use 64-bit version"
|
||||
exit 1
|
||||
fi
|
||||
if ! echo $LIB | grep amd64; then
|
||||
echo "Wrong paths in LIB; use 64-bit version"
|
||||
exit 1
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-g)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
.libs
|
||||
.deps
|
||||
*.o
|
||||
*.lo
|
||||
.dirstamp
|
||||
*.la
|
||||
Makefile
|
||||
config.log
|
||||
config.status
|
||||
*~
|
||||
fficonfig.h
|
||||
include/ffi.h
|
||||
include/ffitarget.h
|
||||
libffi.pc
|
||||
libtool
|
||||
stamp-h1
|
||||
libffi*gz
|
||||
autom4te.cache
|
||||
libffi.xcodeproj/xcuserdata
|
||||
libffi.xcodeproj/project.xcworkspace
|
||||
ios/
|
||||
osx/
|
||||
build_*/
|
||||
@@ -0,0 +1 @@
|
||||
2
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
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,457 @@
|
||||
/* -----------------------------------------------------------------*-C-*-
|
||||
libffi @VERSION@ - Copyright (c) 2011 Anthony Green
|
||||
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the ``Software''), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
The basic API is described in the README file.
|
||||
|
||||
The raw API is designed to bypass some of the argument packing
|
||||
and unpacking on architectures for which it can be avoided.
|
||||
|
||||
The closure API allows interpreted functions to be packaged up
|
||||
inside a C function pointer, so that they can be called as C functions,
|
||||
with no understanding on the client side that they are interpreted.
|
||||
It can also be used in other cases in which it is necessary to package
|
||||
up a user specified parameter and a function pointer as a single
|
||||
function pointer.
|
||||
|
||||
The closure API must be implemented in order to get its functionality,
|
||||
e.g. for use by gij. Routines are provided to emulate the raw API
|
||||
if the underlying platform doesn't allow faster implementation.
|
||||
|
||||
More details on the raw and cloure API can be found in:
|
||||
|
||||
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
|
||||
|
||||
and
|
||||
|
||||
http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
|
||||
-------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LIBFFI_H
|
||||
#define LIBFFI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Specify which architecture libffi is configured for. */
|
||||
#ifndef @TARGET@
|
||||
#define @TARGET@
|
||||
#endif
|
||||
|
||||
/* ---- System configuration information --------------------------------- */
|
||||
|
||||
#include <ffitarget.h>
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __attribute__(X)
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
|
||||
But we can find it either under the correct ANSI name, or under GNU
|
||||
C's internal name. */
|
||||
|
||||
#define FFI_64_BIT_MAX 9223372036854775807
|
||||
|
||||
#ifdef LONG_LONG_MAX
|
||||
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
|
||||
#else
|
||||
# ifdef LLONG_MAX
|
||||
# define FFI_LONG_LONG_MAX LLONG_MAX
|
||||
# ifdef _AIX52 /* or newer has C99 LLONG_MAX */
|
||||
# undef FFI_64_BIT_MAX
|
||||
# define FFI_64_BIT_MAX 9223372036854775807LL
|
||||
# endif /* _AIX52 or newer */
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
# endif
|
||||
# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */
|
||||
# ifndef __PPC64__
|
||||
# if defined (__IBMC__) || defined (__IBMCPP__)
|
||||
# define FFI_LONG_LONG_MAX LONGLONG_MAX
|
||||
# endif
|
||||
# endif /* __PPC64__ */
|
||||
# undef FFI_64_BIT_MAX
|
||||
# define FFI_64_BIT_MAX 9223372036854775807LL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The closure code assumes that this works on pointers, i.e. a size_t */
|
||||
/* can hold a pointer. */
|
||||
|
||||
typedef struct _ffi_type
|
||||
{
|
||||
size_t size;
|
||||
unsigned short alignment;
|
||||
unsigned short type;
|
||||
struct _ffi_type **elements;
|
||||
} ffi_type;
|
||||
|
||||
#ifndef LIBFFI_HIDE_BASIC_TYPES
|
||||
#if SCHAR_MAX == 127
|
||||
# define ffi_type_uchar ffi_type_uint8
|
||||
# define ffi_type_schar ffi_type_sint8
|
||||
#else
|
||||
#error "char size not supported"
|
||||
#endif
|
||||
|
||||
#if SHRT_MAX == 32767
|
||||
# define ffi_type_ushort ffi_type_uint16
|
||||
# define ffi_type_sshort ffi_type_sint16
|
||||
#elif SHRT_MAX == 2147483647
|
||||
# define ffi_type_ushort ffi_type_uint32
|
||||
# define ffi_type_sshort ffi_type_sint32
|
||||
#else
|
||||
#error "short size not supported"
|
||||
#endif
|
||||
|
||||
#if INT_MAX == 32767
|
||||
# define ffi_type_uint ffi_type_uint16
|
||||
# define ffi_type_sint ffi_type_sint16
|
||||
#elif INT_MAX == 2147483647
|
||||
# define ffi_type_uint ffi_type_uint32
|
||||
# define ffi_type_sint ffi_type_sint32
|
||||
#elif INT_MAX == 9223372036854775807
|
||||
# define ffi_type_uint ffi_type_uint64
|
||||
# define ffi_type_sint ffi_type_sint64
|
||||
#else
|
||||
#error "int size not supported"
|
||||
#endif
|
||||
|
||||
#if LONG_MAX == 2147483647
|
||||
# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
|
||||
#error "no 64-bit data type supported"
|
||||
# endif
|
||||
#elif LONG_MAX != FFI_64_BIT_MAX
|
||||
#error "long size not supported"
|
||||
#endif
|
||||
|
||||
#if LONG_MAX == 2147483647
|
||||
# define ffi_type_ulong ffi_type_uint32
|
||||
# define ffi_type_slong ffi_type_sint32
|
||||
#elif LONG_MAX == FFI_64_BIT_MAX
|
||||
# define ffi_type_ulong ffi_type_uint64
|
||||
# define ffi_type_slong ffi_type_sint64
|
||||
#else
|
||||
#error "long size not supported"
|
||||
#endif
|
||||
|
||||
/* Need minimal decorations for DLLs to works on Windows. */
|
||||
/* GCC has autoimport and autoexport. Rely on Libtool to */
|
||||
/* help MSVC export from a DLL, but always declare data */
|
||||
/* to be imported for MSVC clients. This costs an extra */
|
||||
/* indirection for MSVC clients using the static version */
|
||||
/* of the library, but don't worry about that. Besides, */
|
||||
/* as a workaround, they can define FFI_BUILDING if they */
|
||||
/* *know* they are going to link with the static library. */
|
||||
#if defined _MSC_VER && !defined FFI_BUILDING
|
||||
#define FFI_EXTERN extern __declspec(dllimport)
|
||||
#else
|
||||
#define FFI_EXTERN extern
|
||||
#endif
|
||||
|
||||
/* These are defined in types.c */
|
||||
FFI_EXTERN ffi_type ffi_type_void;
|
||||
FFI_EXTERN ffi_type ffi_type_uint8;
|
||||
FFI_EXTERN ffi_type ffi_type_sint8;
|
||||
FFI_EXTERN ffi_type ffi_type_uint16;
|
||||
FFI_EXTERN ffi_type ffi_type_sint16;
|
||||
FFI_EXTERN ffi_type ffi_type_uint32;
|
||||
FFI_EXTERN ffi_type ffi_type_sint32;
|
||||
FFI_EXTERN ffi_type ffi_type_uint64;
|
||||
FFI_EXTERN ffi_type ffi_type_sint64;
|
||||
FFI_EXTERN ffi_type ffi_type_float;
|
||||
FFI_EXTERN ffi_type ffi_type_double;
|
||||
FFI_EXTERN ffi_type ffi_type_pointer;
|
||||
|
||||
#if @HAVE_LONG_DOUBLE@
|
||||
FFI_EXTERN ffi_type ffi_type_longdouble;
|
||||
#else
|
||||
#define ffi_type_longdouble ffi_type_double
|
||||
#endif
|
||||
#endif /* LIBFFI_HIDE_BASIC_TYPES */
|
||||
|
||||
typedef enum {
|
||||
FFI_OK = 0,
|
||||
FFI_BAD_TYPEDEF,
|
||||
FFI_BAD_ABI
|
||||
} ffi_status;
|
||||
|
||||
typedef unsigned FFI_TYPE;
|
||||
|
||||
typedef struct {
|
||||
ffi_abi abi;
|
||||
unsigned nargs;
|
||||
ffi_type **arg_types;
|
||||
ffi_type *rtype;
|
||||
unsigned bytes;
|
||||
unsigned flags;
|
||||
#ifdef FFI_EXTRA_CIF_FIELDS
|
||||
FFI_EXTRA_CIF_FIELDS;
|
||||
#endif
|
||||
} ffi_cif;
|
||||
|
||||
/* Used internally, but overridden by some architectures */
|
||||
ffi_status ffi_prep_cif_core(ffi_cif *cif,
|
||||
ffi_abi abi,
|
||||
unsigned int isvariadic,
|
||||
unsigned int nfixedargs,
|
||||
unsigned int ntotalargs,
|
||||
ffi_type *rtype,
|
||||
ffi_type **atypes);
|
||||
|
||||
/* ---- Definitions for the raw API -------------------------------------- */
|
||||
|
||||
#ifndef FFI_SIZEOF_ARG
|
||||
# if LONG_MAX == 2147483647
|
||||
# define FFI_SIZEOF_ARG 4
|
||||
# elif LONG_MAX == FFI_64_BIT_MAX
|
||||
# define FFI_SIZEOF_ARG 8
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FFI_SIZEOF_JAVA_RAW
|
||||
# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
ffi_sarg sint;
|
||||
ffi_arg uint;
|
||||
float flt;
|
||||
char data[FFI_SIZEOF_ARG];
|
||||
void* ptr;
|
||||
} ffi_raw;
|
||||
|
||||
#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
|
||||
/* This is a special case for mips64/n32 ABI (and perhaps others) where
|
||||
sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */
|
||||
typedef union {
|
||||
signed int sint;
|
||||
unsigned int uint;
|
||||
float flt;
|
||||
char data[FFI_SIZEOF_JAVA_RAW];
|
||||
void* ptr;
|
||||
} ffi_java_raw;
|
||||
#else
|
||||
typedef ffi_raw ffi_java_raw;
|
||||
#endif
|
||||
|
||||
|
||||
void ffi_raw_call (ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
ffi_raw *avalue);
|
||||
|
||||
void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
||||
void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
||||
size_t ffi_raw_size (ffi_cif *cif);
|
||||
|
||||
/* This is analogous to the raw API, except it uses Java parameter */
|
||||
/* packing, even on 64-bit machines. I.e. on 64-bit machines */
|
||||
/* longs and doubles are followed by an empty 64-bit word. */
|
||||
|
||||
void ffi_java_raw_call (ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
ffi_java_raw *avalue);
|
||||
|
||||
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
|
||||
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
|
||||
size_t ffi_java_raw_size (ffi_cif *cif);
|
||||
|
||||
/* ---- Definitions for closures ----------------------------------------- */
|
||||
|
||||
#if FFI_CLOSURES
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__declspec(align(8))
|
||||
#endif
|
||||
typedef struct {
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
ffi_cif *cif;
|
||||
void (*fun)(ffi_cif*,void*,void**,void*);
|
||||
void *user_data;
|
||||
#ifdef __GNUC__
|
||||
} ffi_closure __attribute__((aligned (8)));
|
||||
#else
|
||||
} ffi_closure;
|
||||
# ifdef __sgi
|
||||
# pragma pack 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void *ffi_closure_alloc (size_t size, void **code);
|
||||
void ffi_closure_free (void *);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure (ffi_closure*,
|
||||
ffi_cif *,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure_loc (ffi_closure*,
|
||||
ffi_cif *,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data,
|
||||
void*codeloc);
|
||||
|
||||
#ifdef __sgi
|
||||
# pragma pack 8
|
||||
#endif
|
||||
typedef struct {
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
|
||||
ffi_cif *cif;
|
||||
|
||||
#if !FFI_NATIVE_RAW_API
|
||||
|
||||
/* if this is enabled, then a raw closure has the same layout
|
||||
as a regular closure. We use this to install an intermediate
|
||||
handler to do the transaltion, void** -> ffi_raw*. */
|
||||
|
||||
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||
void *this_closure;
|
||||
|
||||
#endif
|
||||
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
|
||||
void *user_data;
|
||||
|
||||
} ffi_raw_closure;
|
||||
|
||||
typedef struct {
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
|
||||
ffi_cif *cif;
|
||||
|
||||
#if !FFI_NATIVE_RAW_API
|
||||
|
||||
/* if this is enabled, then a raw closure has the same layout
|
||||
as a regular closure. We use this to install an intermediate
|
||||
handler to do the transaltion, void** -> ffi_raw*. */
|
||||
|
||||
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||
void *this_closure;
|
||||
|
||||
#endif
|
||||
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
|
||||
void *user_data;
|
||||
|
||||
} ffi_java_raw_closure;
|
||||
|
||||
ffi_status
|
||||
ffi_prep_raw_closure (ffi_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||
void *user_data);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_raw_closure_loc (ffi_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||
void *user_data,
|
||||
void *codeloc);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||
void *user_data);
|
||||
|
||||
ffi_status
|
||||
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||
void *user_data,
|
||||
void *codeloc);
|
||||
|
||||
#endif /* FFI_CLOSURES */
|
||||
|
||||
/* ---- Public interface definition -------------------------------------- */
|
||||
|
||||
ffi_status ffi_prep_cif(ffi_cif *cif,
|
||||
ffi_abi abi,
|
||||
unsigned int nargs,
|
||||
ffi_type *rtype,
|
||||
ffi_type **atypes);
|
||||
|
||||
ffi_status ffi_prep_cif_var(ffi_cif *cif,
|
||||
ffi_abi abi,
|
||||
unsigned int nfixedargs,
|
||||
unsigned int ntotalargs,
|
||||
ffi_type *rtype,
|
||||
ffi_type **atypes);
|
||||
|
||||
void ffi_call(ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
void **avalue);
|
||||
|
||||
/* Useful for eliminating compiler warnings */
|
||||
#define FFI_FN(f) ((void (*)(void))f)
|
||||
|
||||
/* ---- Definitions shared with assembly code ---------------------------- */
|
||||
|
||||
#endif
|
||||
|
||||
/* If these change, update src/mips/ffitarget.h. */
|
||||
#define FFI_TYPE_VOID 0
|
||||
#define FFI_TYPE_INT 1
|
||||
#define FFI_TYPE_FLOAT 2
|
||||
#define FFI_TYPE_DOUBLE 3
|
||||
#if @HAVE_LONG_DOUBLE@
|
||||
#define FFI_TYPE_LONGDOUBLE 4
|
||||
#else
|
||||
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
||||
#endif
|
||||
#define FFI_TYPE_UINT8 5
|
||||
#define FFI_TYPE_SINT8 6
|
||||
#define FFI_TYPE_UINT16 7
|
||||
#define FFI_TYPE_SINT16 8
|
||||
#define FFI_TYPE_UINT32 9
|
||||
#define FFI_TYPE_SINT32 10
|
||||
#define FFI_TYPE_UINT64 11
|
||||
#define FFI_TYPE_SINT64 12
|
||||
#define FFI_TYPE_STRUCT 13
|
||||
#define FFI_TYPE_POINTER 14
|
||||
|
||||
/* This should always refer to the last type code (for sanity checks) */
|
||||
#define FFI_TYPE_LAST FFI_TYPE_POINTER
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,505 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc.
|
||||
Copyright (c) 2011 Plausible Labs Cooperative, Inc.
|
||||
|
||||
ARM Foreign Function Interface
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#define LIBFFI_ASM
|
||||
#include <fficonfig.h>
|
||||
#include <ffi.h>
|
||||
#ifdef HAVE_MACHINE_ASM_H
|
||||
#include <machine/asm.h>
|
||||
#else
|
||||
#ifdef __USER_LABEL_PREFIX__
|
||||
#define CONCAT1(a, b) CONCAT2(a, b)
|
||||
#define CONCAT2(a, b) a ## b
|
||||
|
||||
/* Use the right prefix for global labels. */
|
||||
#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
|
||||
#else
|
||||
#define CNAME(x) x
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#define ENTRY(x) .globl CNAME(x); CNAME(x):
|
||||
#else
|
||||
#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
|
||||
#endif /* __APPLE__ */
|
||||
#endif
|
||||
|
||||
#ifdef __ELF__
|
||||
#define LSYM(x) .x
|
||||
#else
|
||||
#define LSYM(x) x
|
||||
#endif
|
||||
|
||||
/* Use the SOFTFP return value ABI on Mac OS X, as per the iOS ABI
|
||||
Function Call Guide */
|
||||
#ifdef __APPLE__
|
||||
#define __SOFTFP__
|
||||
#endif
|
||||
|
||||
/* We need a better way of testing for this, but for now, this is all
|
||||
we can do. */
|
||||
@ This selects the minimum architecture level required.
|
||||
#define __ARM_ARCH__ 3
|
||||
|
||||
#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
|
||||
# undef __ARM_ARCH__
|
||||
# define __ARM_ARCH__ 4
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
|
||||
|| defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
|
||||
|| defined(__ARM_ARCH_5TEJ__)
|
||||
# undef __ARM_ARCH__
|
||||
# define __ARM_ARCH__ 5
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
|
||||
|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
|
||||
|| defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
|
||||
|| defined(__ARM_ARCH_6M__)
|
||||
# undef __ARM_ARCH__
|
||||
# define __ARM_ARCH__ 6
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
|
||||
|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
|
||||
|| defined(__ARM_ARCH_7EM__)
|
||||
# undef __ARM_ARCH__
|
||||
# define __ARM_ARCH__ 7
|
||||
#endif
|
||||
|
||||
#if __ARM_ARCH__ >= 5
|
||||
# define call_reg(x) blx x
|
||||
#elif defined (__ARM_ARCH_4T__)
|
||||
# define call_reg(x) mov lr, pc ; bx x
|
||||
# if defined(__thumb__) || defined(__THUMB_INTERWORK__)
|
||||
# define __INTERWORKING__
|
||||
# endif
|
||||
#else
|
||||
# define call_reg(x) mov lr, pc ; mov pc, x
|
||||
#endif
|
||||
|
||||
/* Conditionally compile unwinder directives. */
|
||||
#ifdef __ARM_EABI__
|
||||
#define UNWIND
|
||||
#else
|
||||
#define UNWIND @
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
|
||||
.macro ARM_FUNC_START name
|
||||
.text
|
||||
.align 0
|
||||
.thumb
|
||||
.thumb_func
|
||||
#ifdef __APPLE__
|
||||
ENTRY($0)
|
||||
#else
|
||||
ENTRY(\name)
|
||||
#endif
|
||||
bx pc
|
||||
nop
|
||||
.arm
|
||||
UNWIND .fnstart
|
||||
/* A hook to tell gdb that we've switched to ARM mode. Also used to call
|
||||
directly from other local arm routines. */
|
||||
#ifdef __APPLE__
|
||||
_L__$0:
|
||||
#else
|
||||
_L__\name:
|
||||
#endif
|
||||
.endm
|
||||
#else
|
||||
.macro ARM_FUNC_START name
|
||||
.text
|
||||
.align 0
|
||||
.arm
|
||||
#ifdef __APPLE__
|
||||
ENTRY($0)
|
||||
#else
|
||||
ENTRY(\name)
|
||||
#endif
|
||||
UNWIND .fnstart
|
||||
.endm
|
||||
#endif
|
||||
|
||||
.macro RETLDM regs=, cond=, dirn=ia
|
||||
#if defined (__INTERWORKING__)
|
||||
.ifc "\regs",""
|
||||
ldr\cond lr, [sp], #4
|
||||
.else
|
||||
ldm\cond\dirn sp!, {\regs, lr}
|
||||
.endif
|
||||
bx\cond lr
|
||||
#else
|
||||
.ifc "\regs",""
|
||||
ldr\cond pc, [sp], #4
|
||||
.else
|
||||
ldm\cond\dirn sp!, {\regs, pc}
|
||||
.endif
|
||||
#endif
|
||||
.endm
|
||||
|
||||
@ r0: ffi_prep_args
|
||||
@ r1: &ecif
|
||||
@ r2: cif->bytes
|
||||
@ r3: fig->flags
|
||||
@ sp+0: ecif.rvalue
|
||||
|
||||
@ This assumes we are using gas.
|
||||
ARM_FUNC_START ffi_call_SYSV
|
||||
@ Save registers
|
||||
stmfd sp!, {r0-r3, fp, lr}
|
||||
UNWIND .save {r0-r3, fp, lr}
|
||||
mov fp, sp
|
||||
|
||||
UNWIND .setfp fp, sp
|
||||
|
||||
@ Make room for all of the new args.
|
||||
sub sp, fp, r2
|
||||
|
||||
@ Place all of the ffi_prep_args in position
|
||||
mov r0, sp
|
||||
@ r1 already set
|
||||
|
||||
@ Call ffi_prep_args(stack, &ecif)
|
||||
bl ffi_prep_args
|
||||
|
||||
@ move first 4 parameters in registers
|
||||
ldmia sp, {r0-r3}
|
||||
|
||||
@ and adjust stack
|
||||
sub lr, fp, sp @ cif->bytes == fp - sp
|
||||
ldr ip, [fp] @ load fn() in advance
|
||||
cmp lr, #16
|
||||
movhs lr, #16
|
||||
add sp, sp, lr
|
||||
|
||||
@ call (fn) (...)
|
||||
call_reg(ip)
|
||||
|
||||
@ Remove the space we pushed for the args
|
||||
mov sp, fp
|
||||
|
||||
@ Load r2 with the pointer to storage for the return value
|
||||
ldr r2, [sp, #24]
|
||||
|
||||
@ Load r3 with the return type code
|
||||
ldr r3, [sp, #12]
|
||||
|
||||
@ If the return value pointer is NULL, assume no return value.
|
||||
cmp r2, #0
|
||||
beq LSYM(Lepilogue)
|
||||
|
||||
@ return INT
|
||||
cmp r3, #FFI_TYPE_INT
|
||||
#if defined(__SOFTFP__) || defined(__ARM_EABI__)
|
||||
cmpne r3, #FFI_TYPE_FLOAT
|
||||
#endif
|
||||
streq r0, [r2]
|
||||
beq LSYM(Lepilogue)
|
||||
|
||||
@ return INT64
|
||||
cmp r3, #FFI_TYPE_SINT64
|
||||
#if defined(__SOFTFP__) || defined(__ARM_EABI__)
|
||||
cmpne r3, #FFI_TYPE_DOUBLE
|
||||
#endif
|
||||
stmeqia r2, {r0, r1}
|
||||
|
||||
#if !defined(__SOFTFP__) && !defined(__ARM_EABI__)
|
||||
beq LSYM(Lepilogue)
|
||||
|
||||
@ return FLOAT
|
||||
cmp r3, #FFI_TYPE_FLOAT
|
||||
stfeqs f0, [r2]
|
||||
beq LSYM(Lepilogue)
|
||||
|
||||
@ return DOUBLE or LONGDOUBLE
|
||||
cmp r3, #FFI_TYPE_DOUBLE
|
||||
stfeqd f0, [r2]
|
||||
#endif
|
||||
|
||||
LSYM(Lepilogue):
|
||||
#if defined (__INTERWORKING__)
|
||||
ldmia sp!, {r0-r3,fp, lr}
|
||||
bx lr
|
||||
#else
|
||||
ldmia sp!, {r0-r3,fp, pc}
|
||||
#endif
|
||||
|
||||
.ffi_call_SYSV_end:
|
||||
UNWIND .fnend
|
||||
#ifdef __ELF__
|
||||
.size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
unsigned int FFI_HIDDEN
|
||||
ffi_closure_SYSV_inner (closure, respp, args)
|
||||
ffi_closure *closure;
|
||||
void **respp;
|
||||
void *args;
|
||||
*/
|
||||
|
||||
ARM_FUNC_START ffi_closure_SYSV
|
||||
UNWIND .pad #16
|
||||
add ip, sp, #16
|
||||
stmfd sp!, {ip, lr}
|
||||
UNWIND .save {r0, lr}
|
||||
add r2, sp, #8
|
||||
UNWIND .pad #16
|
||||
sub sp, sp, #16
|
||||
str sp, [sp, #8]
|
||||
add r1, sp, #8
|
||||
bl CNAME(ffi_closure_SYSV_inner)
|
||||
cmp r0, #FFI_TYPE_INT
|
||||
beq .Lretint
|
||||
|
||||
cmp r0, #FFI_TYPE_FLOAT
|
||||
#if defined(__SOFTFP__) || defined(__ARM_EABI__)
|
||||
beq .Lretint
|
||||
#else
|
||||
beq .Lretfloat
|
||||
#endif
|
||||
|
||||
cmp r0, #FFI_TYPE_DOUBLE
|
||||
#if defined(__SOFTFP__) || defined(__ARM_EABI__)
|
||||
beq .Lretlonglong
|
||||
#else
|
||||
beq .Lretdouble
|
||||
#endif
|
||||
|
||||
cmp r0, #FFI_TYPE_LONGDOUBLE
|
||||
#if defined(__SOFTFP__) || defined(__ARM_EABI__)
|
||||
beq .Lretlonglong
|
||||
#else
|
||||
beq .Lretlongdouble
|
||||
#endif
|
||||
|
||||
cmp r0, #FFI_TYPE_SINT64
|
||||
beq .Lretlonglong
|
||||
.Lclosure_epilogue:
|
||||
add sp, sp, #16
|
||||
ldmfd sp, {sp, pc}
|
||||
.Lretint:
|
||||
ldr r0, [sp]
|
||||
b .Lclosure_epilogue
|
||||
.Lretlonglong:
|
||||
ldr r0, [sp]
|
||||
ldr r1, [sp, #4]
|
||||
b .Lclosure_epilogue
|
||||
|
||||
#if !defined(__SOFTFP__) && !defined(__ARM_EABI__)
|
||||
.Lretfloat:
|
||||
ldfs f0, [sp]
|
||||
b .Lclosure_epilogue
|
||||
.Lretdouble:
|
||||
ldfd f0, [sp]
|
||||
b .Lclosure_epilogue
|
||||
.Lretlongdouble:
|
||||
ldfd f0, [sp]
|
||||
b .Lclosure_epilogue
|
||||
#endif
|
||||
|
||||
.ffi_closure_SYSV_end:
|
||||
UNWIND .fnend
|
||||
#ifdef __ELF__
|
||||
.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
|
||||
#endif
|
||||
|
||||
|
||||
/* Below are VFP hard-float ABI call and closure implementations.
|
||||
Add VFP FPU directive here. This is only compiled into the library
|
||||
under EABI. */
|
||||
#ifdef __ARM_EABI__
|
||||
.fpu vfp
|
||||
|
||||
@ r0: fn
|
||||
@ r1: &ecif
|
||||
@ r2: cif->bytes
|
||||
@ r3: fig->flags
|
||||
@ sp+0: ecif.rvalue
|
||||
|
||||
ARM_FUNC_START ffi_call_VFP
|
||||
@ Save registers
|
||||
stmfd sp!, {r0-r3, fp, lr}
|
||||
UNWIND .save {r0-r3, fp, lr}
|
||||
mov fp, sp
|
||||
UNWIND .setfp fp, sp
|
||||
|
||||
@ Make room for all of the new args.
|
||||
sub sp, sp, r2
|
||||
|
||||
@ Make room for loading VFP args
|
||||
sub sp, sp, #64
|
||||
|
||||
@ Place all of the ffi_prep_args in position
|
||||
mov r0, sp
|
||||
@ r1 already set
|
||||
sub r2, fp, #64 @ VFP scratch space
|
||||
|
||||
@ Call ffi_prep_args(stack, &ecif, vfp_space)
|
||||
bl ffi_prep_args
|
||||
|
||||
@ Load VFP register args if needed
|
||||
cmp r0, #0
|
||||
beq LSYM(Lbase_args)
|
||||
|
||||
@ Load only d0 if possible
|
||||
cmp r0, #3
|
||||
sub ip, fp, #64
|
||||
flddle d0, [ip]
|
||||
fldmiadgt ip, {d0-d7}
|
||||
|
||||
LSYM(Lbase_args):
|
||||
@ move first 4 parameters in registers
|
||||
ldmia sp, {r0-r3}
|
||||
|
||||
@ and adjust stack
|
||||
sub lr, ip, sp @ cif->bytes == (fp - 64) - sp
|
||||
ldr ip, [fp] @ load fn() in advance
|
||||
cmp lr, #16
|
||||
movhs lr, #16
|
||||
add sp, sp, lr
|
||||
|
||||
@ call (fn) (...)
|
||||
call_reg(ip)
|
||||
|
||||
@ Remove the space we pushed for the args
|
||||
mov sp, fp
|
||||
|
||||
@ Load r2 with the pointer to storage for
|
||||
@ the return value
|
||||
ldr r2, [sp, #24]
|
||||
|
||||
@ Load r3 with the return type code
|
||||
ldr r3, [sp, #12]
|
||||
|
||||
@ If the return value pointer is NULL,
|
||||
@ assume no return value.
|
||||
cmp r2, #0
|
||||
beq LSYM(Lepilogue_vfp)
|
||||
|
||||
cmp r3, #FFI_TYPE_INT
|
||||
streq r0, [r2]
|
||||
beq LSYM(Lepilogue_vfp)
|
||||
|
||||
cmp r3, #FFI_TYPE_SINT64
|
||||
stmeqia r2, {r0, r1}
|
||||
beq LSYM(Lepilogue_vfp)
|
||||
|
||||
cmp r3, #FFI_TYPE_FLOAT
|
||||
fstseq s0, [r2]
|
||||
beq LSYM(Lepilogue_vfp)
|
||||
|
||||
cmp r3, #FFI_TYPE_DOUBLE
|
||||
fstdeq d0, [r2]
|
||||
beq LSYM(Lepilogue_vfp)
|
||||
|
||||
cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT
|
||||
cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE
|
||||
fstmiadeq r2, {d0-d3}
|
||||
|
||||
LSYM(Lepilogue_vfp):
|
||||
RETLDM "r0-r3,fp"
|
||||
|
||||
.ffi_call_VFP_end:
|
||||
UNWIND .fnend
|
||||
.size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP)
|
||||
|
||||
|
||||
ARM_FUNC_START ffi_closure_VFP
|
||||
fstmfdd sp!, {d0-d7}
|
||||
@ r0-r3, then d0-d7
|
||||
UNWIND .pad #80
|
||||
add ip, sp, #80
|
||||
stmfd sp!, {ip, lr}
|
||||
UNWIND .save {r0, lr}
|
||||
add r2, sp, #72
|
||||
add r3, sp, #8
|
||||
UNWIND .pad #72
|
||||
sub sp, sp, #72
|
||||
str sp, [sp, #64]
|
||||
add r1, sp, #64
|
||||
bl ffi_closure_SYSV_inner
|
||||
|
||||
cmp r0, #FFI_TYPE_INT
|
||||
beq .Lretint_vfp
|
||||
|
||||
cmp r0, #FFI_TYPE_FLOAT
|
||||
beq .Lretfloat_vfp
|
||||
|
||||
cmp r0, #FFI_TYPE_DOUBLE
|
||||
cmpne r0, #FFI_TYPE_LONGDOUBLE
|
||||
beq .Lretdouble_vfp
|
||||
|
||||
cmp r0, #FFI_TYPE_SINT64
|
||||
beq .Lretlonglong_vfp
|
||||
|
||||
cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT
|
||||
beq .Lretfloat_struct_vfp
|
||||
|
||||
cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE
|
||||
beq .Lretdouble_struct_vfp
|
||||
|
||||
.Lclosure_epilogue_vfp:
|
||||
add sp, sp, #72
|
||||
ldmfd sp, {sp, pc}
|
||||
|
||||
.Lretfloat_vfp:
|
||||
flds s0, [sp]
|
||||
b .Lclosure_epilogue_vfp
|
||||
.Lretdouble_vfp:
|
||||
fldd d0, [sp]
|
||||
b .Lclosure_epilogue_vfp
|
||||
.Lretint_vfp:
|
||||
ldr r0, [sp]
|
||||
b .Lclosure_epilogue_vfp
|
||||
.Lretlonglong_vfp:
|
||||
ldmia sp, {r0, r1}
|
||||
b .Lclosure_epilogue_vfp
|
||||
.Lretfloat_struct_vfp:
|
||||
fldmiad sp, {d0-d1}
|
||||
b .Lclosure_epilogue_vfp
|
||||
.Lretdouble_struct_vfp:
|
||||
fldmiad sp, {d0-d3}
|
||||
b .Lclosure_epilogue_vfp
|
||||
|
||||
.ffi_closure_VFP_end:
|
||||
UNWIND .fnend
|
||||
.size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
|
||||
#endif
|
||||
|
||||
ENTRY(ffi_arm_trampoline)
|
||||
stmfd sp!, {r0-r3}
|
||||
ldr r0, [pc]
|
||||
ldr pc, [pc]
|
||||
|
||||
#if defined __ELF__ && defined __linux__
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
||||
@@ -0,0 +1,841 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc.
|
||||
Copyright (c) 2002 Ranjit Mathew
|
||||
Copyright (c) 2002 Bo Thorsen
|
||||
Copyright (c) 2002 Roger Sayle
|
||||
Copyright (C) 2008, 2010 Free Software Foundation, Inc.
|
||||
|
||||
x86 Foreign Function Interface
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#if !defined(__x86_64__) || defined(_WIN64)
|
||||
|
||||
#ifdef _WIN64
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <ffi.h>
|
||||
#include <ffi_common.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* ffi_prep_args is called by the assembly routine once stack space
|
||||
has been allocated for the function's arguments */
|
||||
|
||||
void ffi_prep_args(char *stack, extended_cif *ecif)
|
||||
{
|
||||
register unsigned int i;
|
||||
register void **p_argv;
|
||||
register char *argp;
|
||||
register ffi_type **p_arg;
|
||||
#ifdef X86_WIN32
|
||||
size_t p_stack_args[2];
|
||||
void *p_stack_data[2];
|
||||
char *argp2 = stack;
|
||||
int stack_args_count = 0;
|
||||
int cabi = ecif->cif->abi;
|
||||
#endif
|
||||
|
||||
argp = stack;
|
||||
|
||||
if ((ecif->cif->flags == FFI_TYPE_STRUCT
|
||||
|| ecif->cif->flags == FFI_TYPE_MS_STRUCT)
|
||||
#ifdef X86_WIN64
|
||||
&& (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2
|
||||
&& ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
*(void **) argp = ecif->rvalue;
|
||||
#ifdef X86_WIN32
|
||||
/* For fastcall/thiscall this is first register-passed
|
||||
argument. */
|
||||
if (cabi == FFI_THISCALL || cabi == FFI_FASTCALL)
|
||||
{
|
||||
p_stack_args[stack_args_count] = sizeof (void*);
|
||||
p_stack_data[stack_args_count] = argp;
|
||||
++stack_args_count;
|
||||
}
|
||||
#endif
|
||||
argp += sizeof(void*);
|
||||
}
|
||||
|
||||
p_argv = ecif->avalue;
|
||||
|
||||
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
|
||||
i != 0;
|
||||
i--, p_arg++)
|
||||
{
|
||||
size_t z;
|
||||
|
||||
/* Align if necessary */
|
||||
if ((sizeof(void*) - 1) & (size_t) argp)
|
||||
argp = (char *) ALIGN(argp, sizeof(void*));
|
||||
|
||||
z = (*p_arg)->size;
|
||||
#ifdef X86_WIN64
|
||||
if (z > sizeof(ffi_arg)
|
||||
|| ((*p_arg)->type == FFI_TYPE_STRUCT
|
||||
&& (z != 1 && z != 2 && z != 4 && z != 8))
|
||||
#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE
|
||||
|| ((*p_arg)->type == FFI_TYPE_LONGDOUBLE)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
z = sizeof(ffi_arg);
|
||||
*(void **)argp = *p_argv;
|
||||
}
|
||||
else if ((*p_arg)->type == FFI_TYPE_FLOAT)
|
||||
{
|
||||
memcpy(argp, *p_argv, z);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (z < sizeof(ffi_arg))
|
||||
{
|
||||
z = sizeof(ffi_arg);
|
||||
switch ((*p_arg)->type)
|
||||
{
|
||||
case FFI_TYPE_SINT8:
|
||||
*(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT8:
|
||||
*(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SINT16:
|
||||
*(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT16:
|
||||
*(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_SINT32:
|
||||
*(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT32:
|
||||
*(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv);
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
*(ffi_arg *) argp = *(ffi_arg *)(* p_argv);
|
||||
break;
|
||||
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(argp, *p_argv, z);
|
||||
}
|
||||
|
||||
#ifdef X86_WIN32
|
||||
/* For thiscall/fastcall convention register-passed arguments
|
||||
are the first two none-floating-point arguments with a size
|
||||
smaller or equal to sizeof (void*). */
|
||||
if ((cabi == FFI_THISCALL && stack_args_count < 1)
|
||||
|| (cabi == FFI_FASTCALL && stack_args_count < 2))
|
||||
{
|
||||
if (z <= 4
|
||||
&& ((*p_arg)->type != FFI_TYPE_FLOAT
|
||||
&& (*p_arg)->type != FFI_TYPE_STRUCT))
|
||||
{
|
||||
p_stack_args[stack_args_count] = z;
|
||||
p_stack_data[stack_args_count] = argp;
|
||||
++stack_args_count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
p_argv++;
|
||||
#ifdef X86_WIN64
|
||||
argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
|
||||
#else
|
||||
argp += z;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef X86_WIN32
|
||||
/* We need to move the register-passed arguments for thiscall/fastcall
|
||||
on top of stack, so that those can be moved to registers ecx/edx by
|
||||
call-handler. */
|
||||
if (stack_args_count > 0)
|
||||
{
|
||||
size_t zz = (p_stack_args[0] + 3) & ~3;
|
||||
char *h;
|
||||
|
||||
/* Move first argument to top-stack position. */
|
||||
if (p_stack_data[0] != argp2)
|
||||
{
|
||||
h = alloca (zz + 1);
|
||||
memcpy (h, p_stack_data[0], zz);
|
||||
memmove (argp2 + zz, argp2,
|
||||
(size_t) ((char *) p_stack_data[0] - (char*)argp2));
|
||||
memcpy (argp2, h, zz);
|
||||
}
|
||||
|
||||
argp2 += zz;
|
||||
--stack_args_count;
|
||||
if (zz > 4)
|
||||
stack_args_count = 0;
|
||||
|
||||
/* If we have a second argument, then move it on top
|
||||
after the first one. */
|
||||
if (stack_args_count > 0 && p_stack_data[1] != argp2)
|
||||
{
|
||||
zz = p_stack_args[1];
|
||||
zz = (zz + 3) & ~3;
|
||||
h = alloca (zz + 1);
|
||||
h = alloca (zz + 1);
|
||||
memcpy (h, p_stack_data[1], zz);
|
||||
memmove (argp2 + zz, argp2, (size_t) ((char*) p_stack_data[1] - (char*)argp2));
|
||||
memcpy (argp2, h, zz);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* Perform machine dependent cif processing */
|
||||
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
||||
{
|
||||
unsigned int i;
|
||||
ffi_type **ptr;
|
||||
|
||||
/* Set the return type flag */
|
||||
switch (cif->rtype->type)
|
||||
{
|
||||
case FFI_TYPE_VOID:
|
||||
case FFI_TYPE_UINT8:
|
||||
case FFI_TYPE_UINT16:
|
||||
case FFI_TYPE_SINT8:
|
||||
case FFI_TYPE_SINT16:
|
||||
#ifdef X86_WIN64
|
||||
case FFI_TYPE_UINT32:
|
||||
case FFI_TYPE_SINT32:
|
||||
#endif
|
||||
case FFI_TYPE_SINT64:
|
||||
case FFI_TYPE_FLOAT:
|
||||
case FFI_TYPE_DOUBLE:
|
||||
#ifndef X86_WIN64
|
||||
#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE
|
||||
case FFI_TYPE_LONGDOUBLE:
|
||||
#endif
|
||||
#endif
|
||||
cif->flags = (unsigned) cif->rtype->type;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_UINT64:
|
||||
#ifdef X86_WIN64
|
||||
case FFI_TYPE_POINTER:
|
||||
#endif
|
||||
cif->flags = FFI_TYPE_SINT64;
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
#ifndef X86
|
||||
if (cif->rtype->size == 1)
|
||||
{
|
||||
cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */
|
||||
}
|
||||
else if (cif->rtype->size == 2)
|
||||
{
|
||||
cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */
|
||||
}
|
||||
else if (cif->rtype->size == 4)
|
||||
{
|
||||
#ifdef X86_WIN64
|
||||
cif->flags = FFI_TYPE_SMALL_STRUCT_4B;
|
||||
#else
|
||||
cif->flags = FFI_TYPE_INT; /* same as int type */
|
||||
#endif
|
||||
}
|
||||
else if (cif->rtype->size == 8)
|
||||
{
|
||||
cif->flags = FFI_TYPE_SINT64; /* same as int64 type */
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (cif->abi == FFI_MS_CDECL)
|
||||
cif->flags = FFI_TYPE_MS_STRUCT;
|
||||
else
|
||||
cif->flags = FFI_TYPE_STRUCT;
|
||||
/* allocate space for return value pointer */
|
||||
cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef X86_WIN64
|
||||
cif->flags = FFI_TYPE_SINT64;
|
||||
break;
|
||||
case FFI_TYPE_INT:
|
||||
cif->flags = FFI_TYPE_SINT32;
|
||||
#else
|
||||
cif->flags = FFI_TYPE_INT;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
|
||||
{
|
||||
if (((*ptr)->alignment - 1) & cif->bytes)
|
||||
cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment);
|
||||
cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
|
||||
}
|
||||
|
||||
#ifdef X86_WIN64
|
||||
/* ensure space for storing four registers */
|
||||
cif->bytes += 4 * sizeof(ffi_arg);
|
||||
#endif
|
||||
|
||||
#ifdef X86_DARWIN
|
||||
cif->bytes = (cif->bytes + 15) & ~0xF;
|
||||
#endif
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
#ifdef X86_WIN64
|
||||
extern int
|
||||
ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *,
|
||||
unsigned, unsigned, unsigned *, void (*fn)(void));
|
||||
#elif defined(X86_WIN32)
|
||||
extern void
|
||||
ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *,
|
||||
unsigned, unsigned, unsigned, unsigned *, void (*fn)(void));
|
||||
#else
|
||||
extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *,
|
||||
unsigned, unsigned, unsigned *, void (*fn)(void));
|
||||
#endif
|
||||
|
||||
void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
|
||||
{
|
||||
extended_cif ecif;
|
||||
|
||||
ecif.cif = cif;
|
||||
ecif.avalue = avalue;
|
||||
|
||||
/* If the return value is a struct and we don't have a return */
|
||||
/* value address then we need to make one */
|
||||
|
||||
#ifdef X86_WIN64
|
||||
if (rvalue == NULL
|
||||
&& cif->flags == FFI_TYPE_STRUCT
|
||||
&& cif->rtype->size != 1 && cif->rtype->size != 2
|
||||
&& cif->rtype->size != 4 && cif->rtype->size != 8)
|
||||
{
|
||||
ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF);
|
||||
}
|
||||
#else
|
||||
if (rvalue == NULL
|
||||
&& (cif->flags == FFI_TYPE_STRUCT
|
||||
|| cif->flags == FFI_TYPE_MS_STRUCT))
|
||||
{
|
||||
ecif.rvalue = alloca(cif->rtype->size);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
ecif.rvalue = rvalue;
|
||||
|
||||
|
||||
switch (cif->abi)
|
||||
{
|
||||
#ifdef X86_WIN64
|
||||
case FFI_WIN64:
|
||||
ffi_call_win64(ffi_prep_args, &ecif, cif->bytes,
|
||||
cif->flags, ecif.rvalue, fn);
|
||||
break;
|
||||
#elif defined(X86_WIN32)
|
||||
case FFI_SYSV:
|
||||
case FFI_STDCALL:
|
||||
case FFI_MS_CDECL:
|
||||
ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags,
|
||||
ecif.rvalue, fn);
|
||||
break;
|
||||
case FFI_THISCALL:
|
||||
case FFI_FASTCALL:
|
||||
{
|
||||
unsigned int abi = cif->abi;
|
||||
unsigned int i, passed_regs = 0;
|
||||
|
||||
if (cif->flags == FFI_TYPE_STRUCT)
|
||||
++passed_regs;
|
||||
|
||||
for (i=0; i < cif->nargs && passed_regs < 2;i++)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
if (cif->arg_types[i]->type == FFI_TYPE_FLOAT
|
||||
|| cif->arg_types[i]->type == FFI_TYPE_STRUCT)
|
||||
continue;
|
||||
sz = (cif->arg_types[i]->size + 3) & ~3;
|
||||
if (sz == 0 || sz > 4)
|
||||
continue;
|
||||
++passed_regs;
|
||||
}
|
||||
if (passed_regs < 2 && abi == FFI_FASTCALL)
|
||||
abi = FFI_THISCALL;
|
||||
if (passed_regs < 1 && abi == FFI_THISCALL)
|
||||
abi = FFI_STDCALL;
|
||||
ffi_call_win32(ffi_prep_args, &ecif, abi, cif->bytes, cif->flags,
|
||||
ecif.rvalue, fn);
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case FFI_SYSV:
|
||||
ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue,
|
||||
fn);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** private members **/
|
||||
|
||||
/* The following __attribute__((regparm(1))) decorations will have no effect
|
||||
on MSVC - standard cdecl convention applies. */
|
||||
static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
|
||||
void** args, ffi_cif* cif);
|
||||
void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *)
|
||||
__attribute__ ((regparm(1)));
|
||||
unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *)
|
||||
__attribute__ ((regparm(1)));
|
||||
void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
|
||||
__attribute__ ((regparm(1)));
|
||||
#ifdef X86_WIN32
|
||||
void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *)
|
||||
__attribute__ ((regparm(1)));
|
||||
void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *)
|
||||
__attribute__ ((regparm(1)));
|
||||
void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *)
|
||||
__attribute__ ((regparm(1)));
|
||||
#endif
|
||||
#ifdef X86_WIN64
|
||||
void FFI_HIDDEN ffi_closure_win64 (ffi_closure *);
|
||||
#endif
|
||||
|
||||
/* This function is jumped to by the trampoline */
|
||||
|
||||
#ifdef X86_WIN64
|
||||
void * FFI_HIDDEN
|
||||
ffi_closure_win64_inner (ffi_closure *closure, void *args) {
|
||||
ffi_cif *cif;
|
||||
void **arg_area;
|
||||
void *result;
|
||||
void *resp = &result;
|
||||
|
||||
cif = closure->cif;
|
||||
arg_area = (void**) alloca (cif->nargs * sizeof (void*));
|
||||
|
||||
/* this call will initialize ARG_AREA, such that each
|
||||
* element in that array points to the corresponding
|
||||
* value on the stack; and if the function returns
|
||||
* a structure, it will change RESP to point to the
|
||||
* structure return address. */
|
||||
|
||||
ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif);
|
||||
|
||||
(closure->fun) (cif, resp, arg_area, closure->user_data);
|
||||
|
||||
/* The result is returned in rax. This does the right thing for
|
||||
result types except for floats; we have to 'mov xmm0, rax' in the
|
||||
caller to correct this.
|
||||
TODO: structure sizes of 3 5 6 7 are returned by reference, too!!!
|
||||
*/
|
||||
return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp;
|
||||
}
|
||||
|
||||
#else
|
||||
unsigned int FFI_HIDDEN __attribute__ ((regparm(1)))
|
||||
ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args)
|
||||
{
|
||||
/* our various things... */
|
||||
ffi_cif *cif;
|
||||
void **arg_area;
|
||||
|
||||
cif = closure->cif;
|
||||
arg_area = (void**) alloca (cif->nargs * sizeof (void*));
|
||||
|
||||
/* this call will initialize ARG_AREA, such that each
|
||||
* element in that array points to the corresponding
|
||||
* value on the stack; and if the function returns
|
||||
* a structure, it will change RESP to point to the
|
||||
* structure return address. */
|
||||
|
||||
ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif);
|
||||
|
||||
(closure->fun) (cif, *respp, arg_area, closure->user_data);
|
||||
|
||||
return cif->flags;
|
||||
}
|
||||
#endif /* !X86_WIN64 */
|
||||
|
||||
static void
|
||||
ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
|
||||
ffi_cif *cif)
|
||||
{
|
||||
register unsigned int i;
|
||||
register void **p_argv;
|
||||
register char *argp;
|
||||
register ffi_type **p_arg;
|
||||
|
||||
argp = stack;
|
||||
|
||||
#ifdef X86_WIN64
|
||||
if (cif->rtype->size > sizeof(ffi_arg)
|
||||
|| (cif->flags == FFI_TYPE_STRUCT
|
||||
&& (cif->rtype->size != 1 && cif->rtype->size != 2
|
||||
&& cif->rtype->size != 4 && cif->rtype->size != 8))) {
|
||||
*rvalue = *(void **) argp;
|
||||
argp += sizeof(void *);
|
||||
}
|
||||
#else
|
||||
if ( cif->flags == FFI_TYPE_STRUCT
|
||||
|| cif->flags == FFI_TYPE_MS_STRUCT ) {
|
||||
*rvalue = *(void **) argp;
|
||||
argp += sizeof(void *);
|
||||
}
|
||||
#endif
|
||||
|
||||
p_argv = avalue;
|
||||
|
||||
for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
|
||||
{
|
||||
size_t z;
|
||||
|
||||
/* Align if necessary */
|
||||
if ((sizeof(void*) - 1) & (size_t) argp) {
|
||||
argp = (char *) ALIGN(argp, sizeof(void*));
|
||||
}
|
||||
|
||||
#ifdef X86_WIN64
|
||||
if ((*p_arg)->size > sizeof(ffi_arg)
|
||||
|| ((*p_arg)->type == FFI_TYPE_STRUCT
|
||||
&& ((*p_arg)->size != 1 && (*p_arg)->size != 2
|
||||
&& (*p_arg)->size != 4 && (*p_arg)->size != 8)))
|
||||
{
|
||||
z = sizeof(void *);
|
||||
*p_argv = *(void **)argp;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
z = (*p_arg)->size;
|
||||
|
||||
/* because we're little endian, this is what it turns into. */
|
||||
|
||||
*p_argv = (void*) argp;
|
||||
}
|
||||
|
||||
p_argv++;
|
||||
#ifdef X86_WIN64
|
||||
argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
|
||||
#else
|
||||
argp += z;
|
||||
#endif
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \
|
||||
{ unsigned char *__tramp = (unsigned char*)(TRAMP); \
|
||||
void* __fun = (void*)(FUN); \
|
||||
void* __ctx = (void*)(CTX); \
|
||||
*(unsigned char*) &__tramp[0] = 0x41; \
|
||||
*(unsigned char*) &__tramp[1] = 0xbb; \
|
||||
*(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \
|
||||
*(unsigned char*) &__tramp[6] = 0x48; \
|
||||
*(unsigned char*) &__tramp[7] = 0xb8; \
|
||||
*(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \
|
||||
*(unsigned char *) &__tramp[16] = 0x49; \
|
||||
*(unsigned char *) &__tramp[17] = 0xba; \
|
||||
*(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \
|
||||
*(unsigned char *) &__tramp[26] = 0x41; \
|
||||
*(unsigned char *) &__tramp[27] = 0xff; \
|
||||
*(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \
|
||||
}
|
||||
|
||||
/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */
|
||||
|
||||
#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
|
||||
{ unsigned char *__tramp = (unsigned char*)(TRAMP); \
|
||||
unsigned int __fun = (unsigned int)(FUN); \
|
||||
unsigned int __ctx = (unsigned int)(CTX); \
|
||||
unsigned int __dis = __fun - (__ctx + 10); \
|
||||
*(unsigned char*) &__tramp[0] = 0xb8; \
|
||||
*(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \
|
||||
*(unsigned char *) &__tramp[5] = 0xe9; \
|
||||
*(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \
|
||||
}
|
||||
|
||||
#define FFI_INIT_TRAMPOLINE_THISCALL(TRAMP,FUN,CTX,SIZE) \
|
||||
{ unsigned char *__tramp = (unsigned char*)(TRAMP); \
|
||||
unsigned int __fun = (unsigned int)(FUN); \
|
||||
unsigned int __ctx = (unsigned int)(CTX); \
|
||||
unsigned int __dis = __fun - (__ctx + 49); \
|
||||
unsigned short __size = (unsigned short)(SIZE); \
|
||||
*(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \
|
||||
*(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \
|
||||
*(unsigned int *) &__tramp[8] = 0x04890424; /* mov %ecx, 4(%esp) */ \
|
||||
*(unsigned char*) &__tramp[12] = 0x24; /* mov %eax, (%esp) */ \
|
||||
*(unsigned char*) &__tramp[13] = 0xb8; \
|
||||
*(unsigned int *) &__tramp[14] = __size; /* mov __size, %eax */ \
|
||||
*(unsigned int *) &__tramp[18] = 0x08244c8d; /* lea 8(%esp), %ecx */ \
|
||||
*(unsigned int *) &__tramp[22] = 0x4802e8c1; /* shr $2, %eax ; dec %eax */ \
|
||||
*(unsigned short*) &__tramp[26] = 0x0b74; /* jz 1f */ \
|
||||
*(unsigned int *) &__tramp[28] = 0x8908518b; /* 2b: mov 8(%ecx), %edx */ \
|
||||
*(unsigned int *) &__tramp[32] = 0x04c18311; /* mov %edx, (%ecx) ; add $4, %ecx */ \
|
||||
*(unsigned char*) &__tramp[36] = 0x48; /* dec %eax */ \
|
||||
*(unsigned short*) &__tramp[37] = 0xf575; /* jnz 2b ; 1f: */ \
|
||||
*(unsigned char*) &__tramp[39] = 0xb8; \
|
||||
*(unsigned int*) &__tramp[40] = __ctx; /* movl __ctx, %eax */ \
|
||||
*(unsigned char *) &__tramp[44] = 0xe8; \
|
||||
*(unsigned int*) &__tramp[45] = __dis; /* call __fun */ \
|
||||
*(unsigned char*) &__tramp[49] = 0xc2; /* ret */ \
|
||||
*(unsigned short*) &__tramp[50] = (__size + 8); /* ret (__size + 8) */ \
|
||||
}
|
||||
|
||||
#define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \
|
||||
{ unsigned char *__tramp = (unsigned char*)(TRAMP); \
|
||||
unsigned int __fun = (unsigned int)(FUN); \
|
||||
unsigned int __ctx = (unsigned int)(CTX); \
|
||||
unsigned int __dis = __fun - (__ctx + 10); \
|
||||
unsigned short __size = (unsigned short)(SIZE); \
|
||||
*(unsigned char*) &__tramp[0] = 0xb8; \
|
||||
*(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \
|
||||
*(unsigned char *) &__tramp[5] = 0xe8; \
|
||||
*(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \
|
||||
*(unsigned char *) &__tramp[10] = 0xc2; \
|
||||
*(unsigned short*) &__tramp[11] = __size; /* ret __size */ \
|
||||
}
|
||||
|
||||
/* the cif must already be prep'ed */
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure_loc (ffi_closure* closure,
|
||||
ffi_cif* cif,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data,
|
||||
void *codeloc)
|
||||
{
|
||||
#ifdef X86_WIN64
|
||||
#define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE)
|
||||
#define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0)
|
||||
if (cif->abi == FFI_WIN64)
|
||||
{
|
||||
int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3);
|
||||
FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0],
|
||||
&ffi_closure_win64,
|
||||
codeloc, mask);
|
||||
/* make sure we can execute here */
|
||||
}
|
||||
#else
|
||||
if (cif->abi == FFI_SYSV)
|
||||
{
|
||||
FFI_INIT_TRAMPOLINE (&closure->tramp[0],
|
||||
&ffi_closure_SYSV,
|
||||
(void*)codeloc);
|
||||
}
|
||||
#ifdef X86_WIN32
|
||||
else if (cif->abi == FFI_THISCALL)
|
||||
{
|
||||
FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0],
|
||||
&ffi_closure_THISCALL,
|
||||
(void*)codeloc,
|
||||
cif->bytes);
|
||||
}
|
||||
else if (cif->abi == FFI_STDCALL)
|
||||
{
|
||||
FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0],
|
||||
&ffi_closure_STDCALL,
|
||||
(void*)codeloc, cif->bytes);
|
||||
}
|
||||
else if (cif->abi == FFI_MS_CDECL)
|
||||
{
|
||||
FFI_INIT_TRAMPOLINE (&closure->tramp[0],
|
||||
&ffi_closure_SYSV,
|
||||
(void*)codeloc);
|
||||
}
|
||||
#endif /* X86_WIN32 */
|
||||
#endif /* !X86_WIN64 */
|
||||
else
|
||||
{
|
||||
return FFI_BAD_ABI;
|
||||
}
|
||||
|
||||
closure->cif = cif;
|
||||
closure->user_data = user_data;
|
||||
closure->fun = fun;
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
/* ------- Native raw API support -------------------------------- */
|
||||
|
||||
#if !FFI_NO_RAW_API
|
||||
|
||||
ffi_status
|
||||
ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
|
||||
ffi_cif* cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||
void *user_data,
|
||||
void *codeloc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (cif->abi != FFI_SYSV) {
|
||||
#ifdef X86_WIN32
|
||||
if (cif->abi != FFI_THISCALL)
|
||||
#endif
|
||||
return FFI_BAD_ABI;
|
||||
}
|
||||
|
||||
/* we currently don't support certain kinds of arguments for raw
|
||||
closures. This should be implemented by a separate assembly
|
||||
language routine, since it would require argument processing,
|
||||
something we don't do now for performance. */
|
||||
|
||||
for (i = cif->nargs-1; i >= 0; i--)
|
||||
{
|
||||
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT);
|
||||
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
|
||||
}
|
||||
|
||||
#ifdef X86_WIN32
|
||||
if (cif->abi == FFI_SYSV)
|
||||
{
|
||||
#endif
|
||||
FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
|
||||
codeloc);
|
||||
#ifdef X86_WIN32
|
||||
}
|
||||
else if (cif->abi == FFI_THISCALL)
|
||||
{
|
||||
FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL,
|
||||
codeloc, cif->bytes);
|
||||
}
|
||||
#endif
|
||||
closure->cif = cif;
|
||||
closure->user_data = user_data;
|
||||
closure->fun = fun;
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
ffi_prep_args_raw(char *stack, extended_cif *ecif)
|
||||
{
|
||||
memcpy (stack, ecif->avalue, ecif->cif->bytes);
|
||||
}
|
||||
|
||||
/* we borrow this routine from libffi (it must be changed, though, to
|
||||
* actually call the function passed in the first argument. as of
|
||||
* libffi-1.20, this is not the case.)
|
||||
*/
|
||||
|
||||
void
|
||||
ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
|
||||
{
|
||||
extended_cif ecif;
|
||||
void **avalue = (void **)fake_avalue;
|
||||
|
||||
ecif.cif = cif;
|
||||
ecif.avalue = avalue;
|
||||
|
||||
/* If the return value is a struct and we don't have a return */
|
||||
/* value address then we need to make one */
|
||||
|
||||
if (rvalue == NULL
|
||||
&& (cif->flags == FFI_TYPE_STRUCT
|
||||
|| cif->flags == FFI_TYPE_MS_STRUCT))
|
||||
{
|
||||
ecif.rvalue = alloca(cif->rtype->size);
|
||||
}
|
||||
else
|
||||
ecif.rvalue = rvalue;
|
||||
|
||||
|
||||
switch (cif->abi)
|
||||
{
|
||||
#ifdef X86_WIN32
|
||||
case FFI_SYSV:
|
||||
case FFI_STDCALL:
|
||||
case FFI_MS_CDECL:
|
||||
ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags,
|
||||
ecif.rvalue, fn);
|
||||
break;
|
||||
case FFI_THISCALL:
|
||||
case FFI_FASTCALL:
|
||||
{
|
||||
unsigned int abi = cif->abi;
|
||||
unsigned int i, passed_regs = 0;
|
||||
|
||||
if (cif->flags == FFI_TYPE_STRUCT)
|
||||
++passed_regs;
|
||||
|
||||
for (i=0; i < cif->nargs && passed_regs < 2;i++)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
if (cif->arg_types[i]->type == FFI_TYPE_FLOAT
|
||||
|| cif->arg_types[i]->type == FFI_TYPE_STRUCT)
|
||||
continue;
|
||||
sz = (cif->arg_types[i]->size + 3) & ~3;
|
||||
if (sz == 0 || sz > 4)
|
||||
continue;
|
||||
++passed_regs;
|
||||
}
|
||||
if (passed_regs < 2 && abi == FFI_FASTCALL)
|
||||
cif->abi = abi = FFI_THISCALL;
|
||||
if (passed_regs < 1 && abi == FFI_THISCALL)
|
||||
cif->abi = abi = FFI_STDCALL;
|
||||
ffi_call_win32(ffi_prep_args_raw, &ecif, abi, cif->bytes, cif->flags,
|
||||
ecif.rvalue, fn);
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case FFI_SYSV:
|
||||
ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags,
|
||||
ecif.rvalue, fn);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
FFI_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !__x86_64__ || X86_WIN64 */
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
stand-alone
|
||||
aix-fix
|
||||
mint
|
||||
win32
|
||||
win32_tests
|
||||
vararg_float_test_fix
|
||||
vfp-eabi
|
||||
msvc-changes
|
||||
win32-return-sign
|
||||
apple-fixes
|
||||
dist-tests
|
||||
icc128
|
||||
x32libtool
|
||||
arm-test-fix
|
||||
xcode
|
||||
darwin-missing-semi
|
||||
xcode-improvements
|
||||
update-disty
|
||||
v3_0_11
|
||||
bfin
|
||||
ios-fix
|
||||
@@ -0,0 +1,64 @@
|
||||
/* Area: ffi_call, closure_call
|
||||
Purpose: Test doubles passed in variable argument lists.
|
||||
Limitations: none.
|
||||
PR: none.
|
||||
Originator: Blake Chaffin 6/6/2007 */
|
||||
|
||||
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
|
||||
/* { dg-output "" { xfail avr32*-*-* } } */
|
||||
/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */
|
||||
/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */
|
||||
|
||||
#include "ffitest.h"
|
||||
|
||||
static void
|
||||
cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp,
|
||||
void** args, void* userdata __UNUSED__)
|
||||
{
|
||||
char* format = *(char**)args[0];
|
||||
double doubleValue = *(double*)args[1];
|
||||
|
||||
*(ffi_arg*)resp = printf(format, doubleValue);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
ffi_cif cif;
|
||||
void *code;
|
||||
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
|
||||
void* args[3];
|
||||
ffi_type* arg_types[3];
|
||||
|
||||
char* format = "%.1f\n";
|
||||
double doubleArg = 7;
|
||||
ffi_arg res = 0;
|
||||
|
||||
arg_types[0] = &ffi_type_pointer;
|
||||
arg_types[1] = &ffi_type_double;
|
||||
arg_types[2] = NULL;
|
||||
|
||||
/* This printf call is variadic */
|
||||
CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint,
|
||||
arg_types) == FFI_OK);
|
||||
|
||||
args[0] = &format;
|
||||
args[1] = &doubleArg;
|
||||
args[2] = NULL;
|
||||
|
||||
ffi_call(&cif, FFI_FN(printf), &res, args);
|
||||
// { dg-output "7.0" }
|
||||
printf("res: %d\n", (int) res);
|
||||
// { dg-output "\nres: 4" }
|
||||
|
||||
/* The call to cls_double_va_fn is static, so have to use a normal prep_cif */
|
||||
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK);
|
||||
|
||||
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
|
||||
|
||||
res = ((int(*)(char*, double))(code))(format, doubleArg);
|
||||
// { dg-output "\n7.0" }
|
||||
printf("res: %d\n", (int) res);
|
||||
// { dg-output "\nres: 4" }
|
||||
|
||||
exit(0);
|
||||
}
|
||||
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