diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..18d70f0 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0b24f96 --- /dev/null +++ b/.gitignore @@ -0,0 +1,157 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets +!packages/*/build/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store +/src/main/c/windows/*.sln diff --git a/.project b/.project new file mode 100644 index 0000000..32895d4 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + javasysmon + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/dis/javasysmon-0.3.6.jar b/dis/javasysmon-0.3.6.jar new file mode 100644 index 0000000..388a5f3 Binary files /dev/null and b/dis/javasysmon-0.3.6.jar differ diff --git a/lib/native/javasysmon.dll b/lib/native/javasysmon.dll index be45615..79c02f9 100755 Binary files a/lib/native/javasysmon.dll and b/lib/native/javasysmon.dll differ diff --git a/lib/native/javasysmon64xp.dll b/lib/native/javasysmon64xp.dll new file mode 100644 index 0000000..d92b550 Binary files /dev/null and b/lib/native/javasysmon64xp.dll differ diff --git a/src/main/c/windows/javasysmon.vcxproj b/src/main/c/windows/javasysmon.vcxproj new file mode 100644 index 0000000..907d904 --- /dev/null +++ b/src/main/c/windows/javasysmon.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {22558A60-E8D0-4329-8DAF-2AB6241A475C} + Win32Proj + + + + DynamicLibrary + v120 + + + DynamicLibrary + v120 + + + DynamicLibrary + v120_xp + + + DynamicLibrary + v120 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.21005.1 + + + Debug\ + Debug\ + true + $(VC_IncludePath);$(WindowsSDK_IncludePath); + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + false + + + Release\ + Release\ + true + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + + Disabled + C:\Program Files\Java\jdk1.7.0_60\include\win32;C:\Program Files\Java\jdk1.7.0_60\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;JAVASYSMON_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + EditAndContinue + + + true + Windows + false + + MachineX86 + + + + + X64 + + + Disabled + C:\Program Files\Java\jdk1.6.0_17\include\win32;C:\Program Files\Java\jdk1.6.0_17\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;JAVASYSMON_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + + + true + Windows + MachineX64 + + + + + C:\Program Files\Java\jdk1.7.0_60\include;C:\Program Files\Java\jdk1.7.0_60\include\win32;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;JAVASYSMON_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + + Level3 + ProgramDatabase + CompileAsC + + + psapi.lib;user32.lib;gdi32.lib;kernel32.lib;advapi32.lib;glu32.lib;%(AdditionalDependencies) + false + Windows + true + true + false + + MachineX86 + + + + + X64 + + + C:\Program Files\Java\jdk1.7.0_60\include\win32;C:\Program Files\Java\jdk1.7.0_60\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;JAVASYSMON_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + + Level3 + ProgramDatabase + + + x64\psapi.lib;%(AdditionalDependencies) + true + Windows + true + true + MachineX64 + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/c/windows/javasysmon.vcxproj.filters b/src/main/c/windows/javasysmon.vcxproj.filters new file mode 100644 index 0000000..96d595c --- /dev/null +++ b/src/main/c/windows/javasysmon.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/src/main/java/com/jezhumble/javasysmon/WindowsMonitor.java b/src/main/java/com/jezhumble/javasysmon/WindowsMonitor.java index 9ca4cf6..a97a11d 100644 --- a/src/main/java/com/jezhumble/javasysmon/WindowsMonitor.java +++ b/src/main/java/com/jezhumble/javasysmon/WindowsMonitor.java @@ -6,7 +6,17 @@ class WindowsMonitor implements Monitor { static { if (System.getProperty("os.name").toLowerCase().startsWith("windows")) { if (System.getProperty("os.arch").indexOf("64") > -1) { - new NativeLibraryLoader().loadLibrary("javasysmon64.dll"); + // Windows 7 - lower versions switch + float windowsVersion = Float.parseFloat(System.getProperty("os.version")); + float windows7Version = 6.1f; + if(Math.abs(windows7Version - windowsVersion) > 0.01) + { + new NativeLibraryLoader().loadLibrary("javasysmon64xp.dll"); + } + else + { + new NativeLibraryLoader().loadLibrary("javasysmon64.dll"); + } } else { new NativeLibraryLoader().loadLibrary("javasysmon.dll"); }