Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 68d7e94c57618cd7354bd1d71e5d4dc2bf6f90ae @pke committed Feb 22, 2010
Showing with 2,744 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +7 −0 com.sun.jna.examples.win32/.classpath
  3. +28 −0 com.sun.jna.examples.win32/.project
  4. +72 −0 com.sun.jna.examples.win32/.settings/org.eclipse.jdt.core.prefs
  5. +31 −0 com.sun.jna.examples.win32/.settings/org.eclipse.pde.prefs
  6. +11 −0 com.sun.jna.examples.win32/META-INF/MANIFEST.MF
  7. +7 −0 com.sun.jna.examples.win32/build.properties
  8. +37 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/ComCtl32.java
  9. +141 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/GDI32.java
  10. +472 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/Kernel32.java
  11. +90 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/Kernel32Helper.java
  12. +15 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/Psapi.java
  13. +338 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/User32.java
  14. +57 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/Utils.java
  15. +264 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/W32API.java
  16. +7 −0 com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/W32Errors.java
  17. +7 −0 file.monitor.core/.classpath
  18. +28 −0 file.monitor.core/.project
  19. +8 −0 file.monitor.core/.settings/org.eclipse.jdt.core.prefs
  20. +4 −0 file.monitor.core/.settings/org.eclipse.pde.core.prefs
  21. +11 −0 file.monitor.core/META-INF/MANIFEST.MF
  22. +6 −0 file.monitor.core/OSGI-INF/l10n/bundle.properties
  23. +6 −0 file.monitor.core/build.properties
  24. +60 −0 file.monitor.core/src/file/monitor/core/AbstractFileMonitor.java
  25. +46 −0 file.monitor.core/src/file/monitor/core/FileEvent.java
  26. +18 −0 file.monitor.core/src/file/monitor/core/FileInfo.java
  27. +13 −0 file.monitor.core/src/file/monitor/core/FileListener.java
  28. +54 −0 file.monitor.core/src/file/monitor/core/FileMonitor.java
  29. +7 −0 file.monitor.osgi.event/.classpath
  30. +33 −0 file.monitor.osgi.event/.project
  31. +8 −0 file.monitor.osgi.event/.settings/org.eclipse.jdt.core.prefs
  32. +4 −0 file.monitor.osgi.event/.settings/org.eclipse.pde.core.prefs
  33. +13 −0 file.monitor.osgi.event/META-INF/MANIFEST.MF
  34. +8 −0 file.monitor.osgi.event/OSGI-INF/FileListener.xml
  35. +4 −0 file.monitor.osgi.event/OSGI-INF/l10n/bundle.properties
  36. +5 −0 file.monitor.osgi.event/build.properties
  37. +21 −0 file.monitor.osgi.event/src/file/monitor/osgi/event/FileMonitorEventContants.java
  38. +52 −0 file.monitor.osgi.event/src/file/monitor/osgi/event/internal/FileListenerImpl.java
  39. +7 −0 file.monitor.osgi.example.event/.classpath
  40. +33 −0 file.monitor.osgi.example.event/.project
  41. +8 −0 file.monitor.osgi.example.event/.settings/org.eclipse.jdt.core.prefs
  42. +4 −0 file.monitor.osgi.example.event/.settings/org.eclipse.pde.core.prefs
  43. +10 −0 file.monitor.osgi.example.event/META-INF/MANIFEST.MF
  44. +9 −0 file.monitor.osgi.example.event/OSGI-INF/FileEventHandler.xml
  45. +2 −0 file.monitor.osgi.example.event/OSGI-INF/l10n/bundle.properties
  46. +5 −0 file.monitor.osgi.example.event/build.properties
  47. +29 −0 file.monitor.osgi.example.event/src/file/monitor/osgi/example/event/internal/FileEventHandler.java
  48. +7 −0 file.monitor.osgi.example.log/.classpath
  49. +33 −0 file.monitor.osgi.example.log/.project
  50. +8 −0 file.monitor.osgi.example.log/.settings/org.eclipse.jdt.core.prefs
  51. +4 −0 file.monitor.osgi.example.log/.settings/org.eclipse.pde.core.prefs
  52. +9 −0 file.monitor.osgi.example.log/META-INF/MANIFEST.MF
  53. +9 −0 file.monitor.osgi.example.log/OSGI-INF/FileListener.xml
  54. +2 −0 file.monitor.osgi.example.log/OSGI-INF/l10n/bundle.properties
  55. +5 −0 file.monitor.osgi.example.log/build.properties
  56. +27 −0 file.monitor.osgi.example.log/src/file/monitor/osgi/example/log/internal/FileListenerImpl.java
  57. +7 −0 file.monitor.osgi.win32.component/.classpath
  58. +33 −0 file.monitor.osgi.win32.component/.project
  59. +8 −0 file.monitor.osgi.win32.component/.settings/org.eclipse.jdt.core.prefs
  60. +4 −0 file.monitor.osgi.win32.component/.settings/org.eclipse.pde.core.prefs
  61. +23 −0 file.monitor.osgi.win32.component/FileMonitor.launch
  62. +13 −0 file.monitor.osgi.win32.component/META-INF/MANIFEST.MF
  63. +8 −0 file.monitor.osgi.win32.component/OSGI-INF/FileMonitorComponent.xml
  64. +3 −0 file.monitor.osgi.win32.component/OSGI-INF/l10n/bundle.properties
  65. +9 −0 file.monitor.osgi.win32.component/build.properties
  66. +75 −0 ...tor.osgi.win32.component/src/file/monitor/osgi/win32/component/internal/FileMonitorComponent.java
  67. +11 −0 file.monitor.target/.project
  68. +19 −0 file.monitor.target/Example.target
  69. BIN file.monitor.target/pax-logging-api-1.4-sources.jar
  70. BIN file.monitor.target/pax-logging-api-1.4.jar
  71. BIN file.monitor.target/pax-logging-service-1.4-sources.jar
  72. BIN file.monitor.target/pax-logging-service-1.4.jar
  73. +7 −0 file.monitor.win32/.classpath
  74. +33 −0 file.monitor.win32/.project
  75. +8 −0 file.monitor.win32/.settings/org.eclipse.jdt.core.prefs
  76. +4 −0 file.monitor.win32/.settings/org.eclipse.pde.core.prefs
  77. +15 −0 file.monitor.win32/META-INF/MANIFEST.MF
  78. +3 −0 file.monitor.win32/OSGI-INF/l10n/bundle.properties
  79. +5 −0 file.monitor.win32/build.properties
  80. +208 −0 file.monitor.win32/src/file/monitor/win32/WindowsFileMonitor.java
  81. +37 −0 file.monitor.win32/src/file/monitor/win32/internal/Win32FileInfo.java
@@ -0,0 +1,7 @@
+# Eclipse workspace metadata
+/.metadata
+
+External Plug-in Libraries/
+
+# Eclipse compiler output
+bin/
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.sun.jna.examples.win32</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,72 @@
+#Tue Feb 09 12:19:26 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
@@ -0,0 +1,31 @@
+#Tue Feb 09 12:19:26 CET 2010
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Win32 Example implementations
+Bundle-SymbolicName: com.sun.jna.examples.win32
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: SUN
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: com.sun.jna.examples.win32;version="1.0.0"
+Import-Package: com.sun.jna,
+ com.sun.jna.ptr,
+ com.sun.jna.win32
@@ -0,0 +1,7 @@
+source.. = src/
+bin.includes = .classpath,\
+ .project,\
+ .settings/,\
+ build.properties,\
+ META-INF/,\
+ .
@@ -0,0 +1,37 @@
+package com.sun.jna.examples.win32;
+
+import com.sun.jna.Native;
+import com.sun.jna.Structure;
+
+/**
+ * Incomplete interface to the Common Controls Library (comctl32.dll)
+ *
+ * @author <a href="mailto:phil.kursawe@gmail.com">Philipp Kursawe</a>
+ *
+ */
+public interface ComCtl32 extends W32API {
+ ComCtl32 INSTANCE = (ComCtl32) Native.loadLibrary("comctl32",
+ ComCtl32.class, DEFAULT_OPTIONS);
+
+ class TCITEM extends Structure {
+ public int mask;
+ public int dwState;
+ public int dwStateMask;
+ public int pszText;
+ public int cchTextMax;
+ public int iImage;
+ public LPARAM lParam;
+ }
+
+ int TCIF_TEXT = 0x0001;
+ int TCIF_IMAGE = 0x0002;
+ int TCIF_PARAM = 0x0008;
+ int TCIF_STATE = 0x0010;
+ int TCM_GETITEMA = ComCtl32.TCM_FIRST + 5;
+ int TCM_GETITEMW = ComCtl32.TCM_FIRST + 60;
+ int TCM_GETITEM = UNICODE_OPTIONS.equals(DEFAULT_OPTIONS) ? TCM_GETITEMW
+ : TCM_GETITEMA;
+ int TCM_FIRST = 0x1300;
+ int TCM_GETITEMCOUNT = TCM_FIRST + 4;
+
+}
@@ -0,0 +1,141 @@
+/* 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.
+ * <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.
+ */
+package com.sun.jna.examples.win32;
+
+import java.awt.Rectangle;
+
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import com.sun.jna.examples.win32.User32.POINT;
+import com.sun.jna.ptr.PointerByReference;
+
+/** Definition (incomplete) of <code>gdi32.dll</code>. */
+public interface GDI32 extends W32API {
+
+ GDI32 INSTANCE = (GDI32)
+ Native.loadLibrary("gdi32", GDI32.class, DEFAULT_OPTIONS);
+
+ class RECT extends Structure {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+ public Rectangle toRectangle() {
+ return new Rectangle(left, top, right-left, bottom-top);
+ }
+ public String toString() {
+ return "[(" + left + "," + top + ")(" + right + "," + bottom + ")]";
+ }
+ }
+
+ int RDH_RECTANGLES = 1;
+ class RGNDATAHEADER extends Structure {
+ public int dwSize = size();
+ public int iType = RDH_RECTANGLES; // required
+ public int nCount;
+ public int nRgnSize;
+ public RECT rcBound;
+ }
+ class RGNDATA extends Structure {
+ public RGNDATAHEADER rdh;
+ public byte[] Buffer;
+ public RGNDATA(int bufferSize) {
+ Buffer = new byte[bufferSize];
+ allocateMemory();
+ }
+ }
+
+ public HRGN ExtCreateRegion(Pointer lpXform, int nCount, RGNDATA lpRgnData);
+
+ int RGN_AND = 1;
+ int RGN_OR = 2;
+ int RGN_XOR = 3;
+ int RGN_DIFF = 4;
+ int RGN_COPY = 5;
+
+ int ERROR = 0;
+ int NULLREGION = 1;
+ int SIMPLEREGION = 2;
+ int COMPLEXREGION = 3;
+ int CombineRgn(HRGN hrgnDest, HRGN hrgnSrc1, HRGN hrgnSrc2, int fnCombineMode);
+
+ HRGN CreateRectRgn(int nLeftRect, int nTopRect,
+ int nRightRect, int nBottomRect);
+
+ HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect,
+ int nRightRect, int nBottomRect,
+ int nWidthEllipse,
+ int nHeightEllipse);
+ int ALTERNATE = 1;
+ int WINDING = 2;
+ HRGN CreatePolyPolygonRgn(POINT[] lppt, int[] lpPolyCounts, int nCount, int fnPolyFillMode);
+
+ boolean SetRectRgn(HRGN hrgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
+
+ int SetPixel(HDC hDC, int x, int y, int crColor);
+
+ HDC CreateCompatibleDC(HDC hDC);
+ boolean DeleteDC(HDC hDC);
+
+ int BI_RGB = 0;
+ int BI_RLE8 = 1;
+ int BI_RLE4 = 2;
+ int BI_BITFIELDS = 3;
+ int BI_JPEG = 4;
+ int BI_PNG = 5;
+ class BITMAPINFOHEADER extends Structure {
+ public int biSize = size();
+ public int biWidth;
+ public int biHeight;
+ public short biPlanes;
+ public short biBitCount;
+ public int biCompression;
+ public int biSizeImage;
+ public int biXPelsPerMeter;
+ public int biYPelsPerMeter;
+ public int biClrUsed;
+ public int biClrImportant;
+ }
+ class RGBQUAD extends Structure {
+ public byte rgbBlue;
+ public byte rgbGreen;
+ public byte rgbRed;
+ public byte rgbReserved = 0;
+ }
+ class BITMAPINFO extends Structure {
+ public BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
+ //RGBQUAD:
+ //byte rgbBlue;
+ //byte rgbGreen;
+ //byte rgbRed;
+ //byte rgbReserved = 0;
+ int[] bmiColors = new int[1];
+ public BITMAPINFO() { this(1); }
+ public BITMAPINFO(int size) {
+ bmiColors = new int[size];
+ allocateMemory();
+ }
+ }
+ int DIB_RGB_COLORS = 0;
+ int DIB_PAL_COLORS = 1;
+ HBITMAP CreateDIBitmap(HDC hDC, BITMAPINFOHEADER lpbmih, int fdwInit,
+ Pointer lpbInit, BITMAPINFO lpbmi, int fuUsage);
+ HBITMAP CreateDIBSection(HDC hDC, BITMAPINFO pbmi, int iUsage,
+ PointerByReference ppvBits, Pointer hSection,
+ int dwOffset);
+ HBITMAP CreateCompatibleBitmap(HDC hDC, int width, int height);
+
+ HANDLE SelectObject(HDC hDC, HANDLE hGDIObj);
+ boolean DeleteObject(HANDLE p);
+}
Oops, something went wrong.

0 comments on commit 68d7e94

Please sign in to comment.