Vanara

A set of .NET libraries for Windows implementing PInvoke calls to many native Windows APIs with supporting wrappers.

MIT License

Stars
1.7K
Committers
26

Bot releases are hidden (Show)

Vanara - Release Notes - 3.2.15

Published by dahall about 4 years ago

Additions

  • Initial implementation of P2P.dll
  • Added NetworkDeviceConnections to Computer class to manage connection to remote shares and printers. Same functionality as command line 'net use'.

Fixes

  • Fixed NullReferenceException for WindowsIdentity to WindowsImpersonatedIdentity
  • Fixed incorrect parameters being passed to NetDfsSetClientInfo and NetDfsSetInfo
  • Fixed bug in WindowsIdentity.Run extension method causing method to be called twice if identity was null
  • Added parameter attributes and Win32Error.WNetThrowIfFailed extension method and assoc exception
  • For WNetEnumResources helper method, added better error handling, set initial buffer to page size, and fixed bug in loop
  • Fixed #158 with errors with IServiceProvider definition causing faults in ExplorerBrowser
  • Added DangerousGetInterface() method to expose the underlying IExplorerBrowser interface. Use with caution. #159
  • Call to closeMethod in GenericSafeHandle. (#161, #160)
Vanara - Release Notes - 3.2.14

Published by dahall about 4 years ago

Additions
Completed initial work on DbgHelp library that also includes ImageHlp.dll functions
Completed initial work for Magnification.dll
Added LoadCursor overload with ResourceId param
Added class StandardCursor with values IDC_xx for LoadCursor
Added CreateWindow "macro".
Added overloads for DialogBox and DialogBoxParam that take ResourceId params instead of strings.
Added LibHelper class with Is64BitProcess and DoesWin32MethodExist methods
Added User32 EnumChildWindows and GetChildWindow methods
Enhanced AttributedControlDesigner to allow for event filtering.
Added ShellFolder.IShellFolder property to expose underlying COM interface
Added IntPtr SendMessage<TEnum, TWP>(HWND hWnd, TEnum msg, TWP wParam, IntPtr lParam = default)

Fixes
BREAKING CHANGE: Corrected GetClientRect to have 'out rect' param rather than by ref.
BREAKING CHANGE: Corrected invalid WindowStyles.WS_SIZEFRAME changing to WS_THICKFRAME
Changed errant IpHlpLib fields from FILETIME to SYSTEMTIME per #154
Added missing WindowStyles values
Changed WIN_CERTIFICATE.bCertificate from IntPtr to byte
Changed RedirectedDesignerPropertyAttribute to RedirectedDesignerItemAttribute so it could be applied to events and methods.
Addressed #155 by adding GetMonitorInfo overload that accepts MONITORINFOEX
Lots of fixes for ShellNamespaceTreeControl (#153). Still not perfect (keyboard movement could be improved), but much better.
Fixed ShellFileOperations throws an exception during the process of moving lnk files (#156)

Vanara - Release Notes - 3.2.13

Published by dahall about 4 years ago

Additions

  • Added missing XXPseudoConsole functions from consoleapi.h
  • Added ShellFileOperations.AnyOperationAborted and OwnerWindow properties.
  • Added ShellFileOperationDialog with tests a property ShellFileOperations.CustomProgressDialog to receive an instance of that dialog.
  • Completed work on BindContext which wraps IBindCtx
  • Added support for ShellItemPropertyStore to be created with a PROPERTYKEY filter or an ICreateObject
  • Added missing structures (BCRYPT_OID_LIST, BCRYPT_MULTI_OBJECT_LENGTH_STRUCT, BCRYPT_KEY_LENGTHS_STRUCT) associated with BCrypt.PropertyName
  • Added AssociateStringAttribute to associate a string with a code element.
  • Added IShellFolder.GetUIObjectOf<T> extension method overload to accept IntPtr[]
  • Added ShellItem.InvokeVerb method and test
  • Added more well-known Clipboard format strings to ShellClipboardFormat
  • Extended all MarshalToPtr methods with lock and unlock pointer functions and optional parameters.
  • Made SafeAllocatedMemoryHandle.GetBytes() public
  • Added FILEDESCRIPTOR.nFileSize property to combine high/low fields
  • Added improved registry key closing to registration classes
  • Added Vanara.Windows.Shell.NativeClipboard to expose native clipboard functions that are not routed through COM and DataObject.

Fixes

  • Changed CreatePseudoConsole HANDLE params to HFILE after some research. The function will take HFILE and HPIPE instances.
  • BREAKING CHANGE: Changed return values of all methods in IFileOperationProgressSink to HRESULT since this is a user implemented interface.
  • BREAKING CHANGE: Due to performance, changed IMemoryMethods and ISimpleMemoryMethods to contain method signatures instead of properties of method delegates. Then changed all derived memory classes to new interface definition. I believe most of this only affects internal classes so hopefully not a huge effect on your code.
  • Fixed (#152) bug in base class SafeMemoryHandleExt that caused ToString(int...) to fail if memory size was not specifically set (like in parameter assignment).
  • Fixed ShellNamespaceTreeControl.SelectedItem designer error
Vanara - Release Notes - 3.2.12

Published by dahall over 4 years ago

Additions

  • Added ShellFolder.BindToObject and BindToStorage methods
  • Added support for drag/drop to ShellNamespaceTreeControl
  • Add zero copy GetIpNetTable2.

Fixes

  • Corrected #144 by replacing LPStr marshaled string field lpVerb and making it a ResourceId type.
  • Fixed bug in UntypedNativeMemoryEnumerator where enumerated type was not set.
  • Optimized parameter enumerations and fixed bug in ShellFileOperation.UpdateProgress event (#146)
  • For all COM IEnumXX interfaces, fixed the Next method's array parameter so that it references the size on input, not output. This prevents a bug when implementing these interfaces. Thanks to @wangfu91 for finding this and submitting #143.
  • Changed compiler option on IEnumNextworkXX interfaces and array parameter on Next methods along with unit test.
  • Fixed enumeration failures with EnumServiceStatus, EnumServiceStatusEx and EnumDependentServices (#145)
Vanara - Release Notes - 3.2.11

Published by dahall over 4 years ago

Additions

  • New Win10 2004 functions
  • String methods to ShellFileOperations
  • KnownFolderIdExt.GetIShellFolder method
  • Missing FILEOP_FLAGS values
  • Missing CoClass values for IShellFolder
  • Vanara.Windows.Shell.RecycleBin class
  • More BHID mappings for ShellItem.GetHandler calls.
  • FileInUseHandler to wrap functionality of IFileIsInUse interface for a single file.

Fixes

  • Methods and structures that reference DNS_QUERY_OPTION
Vanara - Release Notes - 3.2.10

Published by dahall over 4 years ago

Additions

  • Added interfaces from comcat.h to Ole32 lib
  • Added all remaining shobjidl_core.h interfaces to Shell32 and SearchApi
  • Added WallpaperManager to Vanara.Windows.Shell to manage wallpapers.

Fixes

  • Fixed bug in COLORREF when setting from a Color.
  • Corrected IShellDispatchX.NameSpace method parameter (#131)
Vanara - Release Notes - 3.2.9

Published by dahall over 4 years ago

Additions

  • Added support for Span and ReadOnlySpan
    • Added AsSpan and AsBytes methods to SafeAllocatedMemoryHandle for frameworks supporting Span.
    • Added SafeAllocatedMemoryHandle.AsReadOnlySpan extension method and changed Span methods to use IntPtr extensions.
    • Added SafeMemoryHandleExt.AsRef method for getting a Span of a structure from the memory.
    • Added IntPtr.AsSpan and IntPtr.AsReadOnlySpan extension
  • Added new SafeMemStruct class that wraps a structure into memory with Span support. Added assoc. unit test.
    • Added SafeCoTaskMemStruct and SafeHGlobalStruct derivations of SafeMemStruct
  • Add NO_ERROR constant. (#119)
  • Added DirectWrite, DXGI and WIC references to Vanara.PInvoke.Graphics
  • Added remaining, supported interfaces from shobjidl.h
  • Added DnsGetCacheDataTable w/ unit test (#121)
  • Added IPersistSerializedPropStorage and IPropertyStoreCapabilities COM interfaces
  • Added IPropertyBag2 and supporting elements
  • Added SafeMibEntryBase.TableAsSpan property and SafeMibTableHandle AsReadOnlySpan method (for supported platforms)
  • Added MemoryPropertyStore with stream r/w support representing a property store that lives separate from a ShellItem
  • Added PROPVARIANT_IMMUTABLE as a pure structure that can be used in arrays where the class equivalent breaks marshaling.
  • Added PowerBroadcastType enum and POWERBROADCAST_SETTING struct for WM_POWERBROADCAST messages
  • Added ReadOnlyPropertyStore as the base object wrapping IPropertyStore.
  • Added SafeGuidPtr for instances where GUID is optional.
  • To ShellItemChangeWatcher, added attributes to properties, added Path property tied to Item property for use in designer (#124).
  • Added UNICODE_STRING.ToString() overload
  • Added NtQueryInformationProcess (#123) and supporting constants and structures along with unit test.
  • Added classes to enumerate on pointer elements (NativeMemoryEnumerator and UntypedNativeMemoryEnumerator).
  • Added missing HRESULT Facility enum values

Fixes

  • BREAKING CHANGE: Changed default behavior of ShellItem.Properties so that it is read-only. It was failing for all shell items that didn't have their own properties. To get previous behavior, simply set "shellItem.Properties.ReadOnly = false" before setting properties.
  • BREAKING CHANGE: FIxed UNICODE_STRING so it would work across process boundries (thanks @Enigmatrix) and tested. Now #123 is implemented.
  • BREAKING CHANGE: Changed ShellItemPropertyStore.Descriptions to get a dictionary of PropertyDescription items rather than the PropertyDescriptionList that was already available from ShellItem. Added improved execption when IPropertyStore instance cannot be created due to a shell item with no r/w support.
  • To ShellItemChangeWatcher, fixed bug with PIDLs and memory reads (#124).
  • Fixed bugs in DeviceNotifyCallbackRoutine and PowerSettingRegisterNotification declarations (#122)
  • Fixed crashes on ShellItemChangeWatcher with unrecognized events.
  • Fixed incorrect parameters for file mapping functions and added HSECTION and SafeHSECTION handles.
  • Fixed packing of SHQUERYRBINFO (#127)
  • Moved SafeAllocatedMemoryHandle.Dump back under DEBUG only build.
  • Fixed multiple problems with TrackBarEx in designer and runtime.
Vanara - Release Notes - 3.2.7

Published by dahall over 4 years ago

Breaking Changes

  • Changed NLM_SOCKADDR to a class and changed all parameters that were IntPtr to that class where called.
  • Changed functions of all **Events interfaces to return HRESULT and removed invalid CoClass attributes.
  • Corrected spelling of SOCKET_ADDRESS.lpSockaddr.
  • Changed underlying type of HRESULT and NTStatus to Int32 and Win32Error to UInt32 (reversed) due to a major miss on my part in reading the header files. Sorry everyone.
  • Changed all Winsock2 Int32 return values to Win32Error values.

Additions

  • Added CldApi.dll functions, constants and structures along with basic unit test.
  • Added ProjectedFSLib.dll functions, constants and structures
  • Added WinSockIOControlCode class.
  • Added WSASocket overload for optional param.
  • Added SafeWSA class to call and cleanup WSA init.
  • Added conversion operators to SOCKADDR_STORAGE.
  • Added NLM_UNKNOWN_DATAPLAN_STATUS const to NLM_DATAPLAN_STATUS.
  • Added SOCKADDR.GetAddressBytes method
  • Added CORRELATION_VECTOR structure to Shared
  • Added new Win10 error constants
  • Added Macros methods to deal with LARGE_INTEGER (Int64) values.
  • Added NTStatus.NTSTATUS_FROM_WIN32 function and implicit operator from Win32Error to NTStatus using that function.
  • Added IExplorerCommand and supporting interfaces and constants
  • Added IEquatable implementation to HRESULT and FromExcpetion, HRESULT_FROM_NT and HRESULT_FROM_WIN32 methods
  • Added IEquatable implementation to NTStatus

Fixes

  • Fixed TypeLoadException by 'DSREG_JOIN_INFO' (#117)
  • Fixed problem (#118) with TASKDIALOGCONFIG not working under x64 builds.
  • Changed error struct's GetHashValue to return raw value.
  • Removed XML comments build for unit tests using Directory.Build.targets
  • Fixed issues in HRESULT and NTStatus when converting from UInt32 and FormatMessage when no message was found.
Vanara - Release Notes - 3.2.5

Published by dahall over 4 years ago

Fixes

  • Fixed TypeLoadException with CRYPTUI_WIZ_DIGITAL_SIGN_INFO_UNION (#115) which resulted in a slightly less usable structure. If one wishes to use the pwszFileName field, they will have to use a pointer to a Unicode string instead of the string.
  • Fixed multiple bugs in DnsApi mostly stemming from trying to use structures in callback delegates.
Vanara - Release Notes - 3.2.4

Published by dahall over 4 years ago

Solution layout changes

  • Moved much of the individual project file detail to root Directory.Build.* files for consistency. Fixed build errors due to bad or missing project tags. Cleaned up project files.
  • Fixed almost all the XML doc and obsolete warnings so to get a clean build
  • Fixed AppVeyor build so that it actually would build and now provides a NuGet feed (see README page) with access to early release pacakges.

Additions

  • Added Vanara.PInvoke.DnsApi and supporting unit test supporting dnsapi.dll.
  • Added ISimpleMemoryMethods (subset of IMemoryMethods with just alloc and free) and MemoryMethodsFromSimple<TSimple> which implements most of IMemoryMethods using just the methods from ISimpleMemoryMethods.
  • Added GenericStringMarshalerBase and GenericStringMarshaler as custom string marshalers that can be typed against an IMemoryMethods implementation. The converted LocalStringMarshaler and CoTaskMemStringMarshaler to use that new class.
  • Introduced base class for SafeAnysizeStruct to enable reuse with objects that don't use a single field to determine the length of the array.
  • Added GET_X_LPARAM and GET_Y_LPARAM to Macros class and fixed HIWORD and LOWORD functions to use unchecked to not lose values. (#114)
  • Added missing PROPERTYKEY constants
  • Added interface and struct from NotificationActivationCallback.h
  • Added SafeEventHandle explict IntPtr operator and IntPtr parameter overloads for SetEvent and ResetEvent.
  • Added ObjectIdentifiers static class with constants used by WinEventProc. (#113)

Fixes

  • BREAKING CHANGE: Changed PROPERTYKEY.GetCononicalName to GetCanonicalName (fixed misspelling)
  • Fixed bug in ThumbnailToolbarButtonCollection
Vanara - Release Notes - 3.2.3

Published by dahall over 4 years ago

Additions

  • Added PInvoke libs for wlanapi.dll and wcmapi.dll.
  • Added SOCKET.ToString overload.
  • Added implicit IntPtr operator and CreateFromStructure method to SOCKADDR.
  • Added socket method overload to take uint as protocol.
  • Updated methods to use string overload of CertFindCertificateInStore

Fixes

  • Major changes to SizeT which could affect anticipated behavior: All conversions to ordinals now look for max value and will return converted value's max value. No more invalid conversions.
  • Fixed (#109) problem with SafePSECURITY_DESCRIPTOR not disposing using LocalFree by changing default constructor.
  • Changed WSAQUERYSET.dwNameSpace to NS enum and added constructor to take a namespace.
  • Changed WSAQUERYSET2W strings to be marshaled strings.
  • BREAKING CHANGE: Fixed spelling of items in BackgroundCopyCost
  • Fixed XML comments
Vanara - Release Notes - 3.2.2

Published by dahall over 4 years ago

Additions

  • Added functions from cryptdlg.dll and cryptnet.dll to Vanara.PInvoke.Cryptography
  • Added remaining functions from wingdi.h and winppi.h to Vanara.PInvoke.Gdi32
  • Added remaining functions from winsock2.h to Vanara.PInvoke.Ws2_32

Fixes

  • Removed ScriptXXX function from Vanara.PInvoke.Gdi32 as they were actually exported from it
Vanara - Release Notes - 3.2.1

Published by dahall over 4 years ago

Additions

  • Added all functions for Crypt32.dll, CryptUI.dll to Vanara.PInvoke.Cryptography.
  • Completed crypt functions from AdvApi32.dll in Vanara.PInvoke.Security.
  • Updated NTStatus struct to expose ToHRESULT() method
  • Added IntPtr overload for all WinCon functions currently using StringBuilder param (#107)

Fixes

  • Lots of XML documentation
  • Corrected other build issues related to project files
  • Added missing French resources to Vanara.Core
Vanara - Release Notes - 3.2.0

Published by dahall over 4 years ago

Additions

  • Added ability to put MRU "Clear All" menu item at top (#104), ability to give "Clear All" menu an icon (#103), and provided callback to provide file icons (#102).
  • Finished initial work on TaskbarButton form extender that fully enables all interactions with the taskbar button in the UI.
  • Added INameSpaceTreeControl and supporting interfaces.
  • Added IShellItemFilter
  • Added constructor to MENUITEMINFO and changed dwItemData type to IntPtr.
  • Added GetItem and SetItem extension methods to TreeNode
  • Added ShellNamespaceTreeControl and supporting test code
  • Update lzexpand.h file and included in Kernel32
  • Added DMPAPER_USER to DMPAPER enum (#106)
  • Added extension methods for IPropertyStore
  • Added constants for messages and errors related to task bar items.
  • Added IObjectArray.ToArray extension method
  • Added simpler version of Shell32.AssocCreate.
  • Added PathEx.GetShortPath method
  • Allow for ShellItem to function even if it doesn't have a IShellItem reference
  • BREAKING CHANGES: Allow for ShellLink to function even if not persisted, added Equals functions, add DataFlags and Title property, changed Description to use just a string, removed FullPath property (duplicative and confusing), added Title to ToString, made SaveAs method public.
  • BREAKING CHANGE: Major overhaul of shell registration settings. Removed some methods from ShellRegistrar to static methods in registration classes. Completed documentation and enhanced used of collections. Added registration classes for applications and file types.

Fixes

  • Removed unused type parameters in generic SendMessage methods
  • Fixed bugs in the storage and reading of integer resource identifiers.
  • Cleaned up memory use and COM object releases in PropertyStore
  • Fixed IconLocation.ToString to display properly.
  • Fixed capture and display problems in IndirectResource, and IndirectString.RawValue and ToString for when non-lookup string supplied.
  • Updated DisabledItemComboBox with better dispoal handling
  • Fixed exceptions thrown by ControlPanel methods by providing HRESULT from underlying COM shell object (#105).
  • Changed call at ComReleaser.Dispose to ReleaseComObject instead of FinalReleaseComObject.
Vanara - Release Notes - 3.1.9

Published by dahall almost 5 years ago

Additions

  • Added new functions from olectl.h
  • Added Windows 1903 functions from Kernel32 and User32

Fixes

  • Fixed bug when using SafeAnysizeStruct (#101)
Vanara - Release Notes - 3.1.8

Published by dahall almost 5 years ago

Additions

  • Completed addition of all functions and interfaces for UrlMon.dll, Opc.dll, and wia_xp.h (OleAut32.dll)
  • Added OLEMISC, tagSECURITY_ATTRIBUTES (structure), TYSPEC and uCLSSPEC
Vanara - Release Notes - 3.1.7

Published by dahall almost 5 years ago

Additions

  • Upgraded all projects to support SourceLink and .NET Core 3.1.
  • Added new assemblies for UserEnv.dll, Url.dll, UrlMon.dll and Opc.dll
  • Added all functions from WinSpool.drv, PrntvPt.dll and Xps Print Interfaces to Vanara.PInvoke.Printing.
  • Added all GDI print functions to Vanara.PInvoke.Gdi32.

Fixes

  • Fixed problem with some functions trying to use PIDL[], which can't be marshaled, by using IntPtr[].
  • Fixed memory leaks in BITS and its unit tests.
  • Breaking change: Fixed IEnumIDList.Next method declaration to support multiple items.
  • Added missing CLSCTX values
  • Addressed a number of minor user submitted bugs
Vanara - Release Notes - 3.1.6

Published by dahall almost 5 years ago

Additions

  • Added Vanara.PInvoke.Printing project to include, for now, winspool.h functions
  • Adding missing kerberos related structures to Vanara.PInvoke.Security
  • Added IsMarshalable method and converted most uses of IsBlittable to it.
  • Added EnumInheritance and InheritsFrom extension methods.
  • Added ISerializable support as last option for pushing and pulling from memory pointers

Fixes

  • Fixed overruns on IntPtr write functions
  • Potentially Breaking Change: Moved DEVMODE and supporting enums out from Gdi32 class to items under the Vanara.PInvoke namespace. Moved DM_SPECVERSION to const value under DEVMODE struct.
  • Fixed MarshalToPtr(Array ... method to not throw casting exception.
Vanara - Release Notes - 3.1.5

Published by dahall almost 5 years ago

Fixes

  • Fixed overflow problem when marshaling arrays and enumerations
  • Fixed bug with POLICY_AUDIT_EVENTS_INFO when using 64-bit builds.
Vanara - Release Notes - 3.1.4

Published by dahall almost 5 years ago

Additions

  • Added generic helper functions for LSA query and set functions.
  • Added CorrespondingTypeAttrribute.CanGet method to pull when enum is not found
  • Added SafeAnysizeStructMarshaler which is a IVanaraMarshaler implementation for SafeAnysizeStruct. Converted structures from using IVanaraMarshaler to using SafeAnysizeStructMarshaler attribute
  • Added attributes and strong types to functions and interfaces from ShObjIdl.h
  • Updated ShellTypeArray constructor with strong type param
  • Added IKnownFolderManager GetIKnownFolder and Name extension methods.
  • Completed work on ExplorerBrowser control and added test project.
  • Added error handling for EditSecurityAdvanced in ShowDialog
    *Added extension methods for IShellFolder

Fixes

  • Removed IMarshalDirective and created IVanaraMarshaler with supporting attribute and helper class. Converted structures that supported IMarshalDirective to IVanaraMarshaler
  • Reworked memory manipulation functions in InteropExtensions and IntPtrConverter to use new marshaling directives and to drive consistency of use across libs (i.e. call same method to do same work).
  • Fixed bug in MatchesLookupPattern (#71)
  • Changed IKnownFolderManager.GetFolderIds extension method to return GUIDs, like the interface method and added GetKnownFolderIds to get the equivalent KNOWNFOLDERID values.
  • Fixed FreeKnownFolderDefinitionFields.
  • Fixed bugs in IPAddressBox and MAKEIPADDRESS
  • Fixed bugs in VistaTypeExtender and EnumComboBox
  • Fixed TypeLoad error (#72) for PROPSPECunion.
  • BREAKING CHANGE: Fixed problems with STRRET and its use in IShellFolder::GetDisplayNameOf. #73