dahall
affe76ff74
Added Append overloaded methods to SafeMemStruct to extend memory and write in bytes, memory or objects and return a pointer to the newly written element. Also added GetFieldAddress method to get the location of a field in the structure's memory.
2021-01-20 16:56:09 -07:00
dahall
c5c0833b98
Added binary negate overload to BOOL and BOOLEAN
2021-01-14 11:15:16 -07:00
dahall
e1cfb9c8ce
Added ISafeMemoryHandle.GetBytes method that was already implemented all implemented classes
2021-01-11 11:19:15 -07:00
dahall
bf89a972a2
Added Null field to SafeCoTaskMemStruct<T> and SafeCoTaskMemStruct<T>
2020-12-30 20:47:14 -07:00
dahall
76fc958c10
Abstracted out read-only methods from SafeAllocatedMemoryHandl into SafeAllocatedMemoryHandleBase
2020-12-22 16:26:27 -07:00
dahall
f1b7e7c363
Added more detail to error msg in VanaraMarshalerAttribute
2020-12-17 15:42:50 -07:00
dahall
5dd910e41c
Added time_t class with conversion support to/from DateTime
2020-11-19 14:47:13 -07:00
dahall
57219c7cc9
Fixed code with new warnings -- no functionality change
2020-11-14 13:36:32 -07:00
dahall
ab4f3c5bd2
Removed explicit exception re-throw to prevent warning
2020-11-14 10:11:47 -07:00
dahall
8344b80f2a
Moved DECIMAL to Ole
2020-11-11 19:57:15 -07:00
dahall
9a52915d58
Added OLE based DECIMAL struct
2020-11-10 09:44:27 -07:00
dahall
30167bc6ca
Fixed bug with CorrespondingTypeAttribute.GetAttrForEnum with default action
2020-10-22 14:31:33 -06:00
dahall
a8ef6e11c8
Added NativeMemoryStream.ReadToPtr and WriteFromPtr methods to interact with allocated memory.
2020-09-10 10:13:56 -06:00
NN
80bfe2ce20
Call to closeMethod in GenericSafeHandle. ( #161 )
2020-08-27 10:25:14 -06:00
dahall
c5814672d5
Added protected size and offset values
2020-08-19 20:51:11 -06:00
dahall
c88d9feb3c
Added LibHelper class with Is64BitProcess and DoesWin32MethodExist methods
2020-08-05 10:36:37 -06:00
dahall
1564c3d702
Made SafeAllocatedMemoryHandle.GetBytes() public
2020-07-22 18:23:37 -06:00
dahall
091352956e
Fixed ( #152 ) bug in base class SafeMemoryHandleExt that caused ToString(int...) to fail if memory size was not specifically set (like in parameter assignment).
2020-07-20 10:44:01 -06:00
dahall
e701d99c1b
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.
2020-07-20 09:48:32 -06:00
dahall
b3842a902a
Fixed compile warning for unused variable in Convert
2020-07-13 07:56:43 -06:00
NN
9e5e73b27c
Throw the exception with stack ( #148 )
2020-07-12 07:55:22 -06:00
dahall
f0976ae924
Added implicit conversion operator to SafeCoTaskMemStruct and SafeHGlobalStruct from nullable struct.
2020-05-27 22:14:24 -06:00
dahall
8b5979d17c
Added SafeCoTaskMemStruct and SafeHGlobalStruct derivations of SafeMemoryStruct
2020-05-26 06:41:40 -06:00
dahall
fb90105165
Added SafeGuidPtr for instances where GUID is optional.
2020-05-20 12:25:55 -06:00
dahall
b309678901
Fixed sizing to include enums
2020-05-20 12:25:19 -06:00
dahall
f67c02dc14
Added SafeAllocatedMemoryHandle.AsReadOnlySpan extension method and changed Span methods to use IntPtr extensions.
2020-05-16 08:56:21 -06:00
dahall
30aabcaaed
Added Equals(TStruct) method to SafeMemStruct to prevent boxing when comparing. (Thanks @NN)
2020-05-15 06:46:55 -06:00
dahall
4216d271d9
Added new SafeMemStruct class that wraps a structure into memory with Span support. Added assoc. unit test.
2020-05-14 17:56:28 -06:00
dahall
ab42b87b0c
Moved SafeAllocatedMemoryHandle.Dump back under DEBUG only build. Added AsSpan and AsBytes methods to SafeAllocatedMemoryHandle for frameworks supporting Span<T>. Added SafeMemoryHandleExt.AsRef<T> method for getting a Span of a structure from the memory.
2020-05-14 17:53:35 -06:00
dahall
a59b4bfba7
Added ISimpleMemoryMethods (subset of IMemoryMethods with just alloc and free) and MemoryMethodsFromSimple<TSimple> which implements most of IMemoryMethods using just the methods from ISimpleMemoryMethods.
2020-04-07 14:34:28 -06:00
dahall
814833852b
Major changes 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.
2020-03-31 16:00:36 -06:00
dahall
8d10011a6f
Changed call at disposal to just ReleaseComObject insted of FinalReleaseComObject.
2020-02-26 15:15:31 -07:00
David Hall
c3121e6ecb
Fixed passing byte[] into GetSize
2019-12-10 06:54:55 -07:00
David Hall
89d17b5241
Added ISerializable support as last option for pushing and pulling from memory pointers
2019-12-09 07:22:20 -07:00
David Hall
38baa53cc1
Unfinished work on object marshaler
2019-12-06 17:09:56 -07:00
David Hall
61fe0f30d8
Changed Marshal.SizeOf to InteropExtensions.SizeOf to account for IVanaraMarshaler instances
2019-11-25 19:36:46 -07:00
David Hall
ce3dc1a0fe
Removed blittable constraint on ToArray and ToEnumerable
2019-11-21 16:33:39 -07:00
David Hall
a94e60820b
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).
2019-11-19 12:52:44 -07:00
David Hall
2892d1e677
Added cookie handler to marshaler and attribute
2019-11-16 15:48:44 -07:00
David Hall
79ad7b8452
Added CanGet method to pull when enum is not found
2019-11-16 15:47:02 -07:00
David Hall
ba49b74b73
Removed IMarshalDirective and created IVanaraMarshaler with supporting attribute and helper class.
2019-11-13 23:02:11 -05:00
David Hall
4143c8767e
Added IMarshalDirective interface as a means for IntPtrConverter.Convert to handle odd marshal behavior
2019-11-03 16:00:13 -07:00
David Hall
9ade2c8bd1
Added copy constructor to SafeMemoryHandle and consolidated initialization
2019-10-31 11:47:04 -06:00
David Hall
bb3435550f
Added SafeAllocatedMemoryHandle.TakeOwnership method to take control of the allocated memory.
2019-10-29 10:44:02 -06:00
David Hall
6eee431d3e
Added properties as supportable type for CorrespondingType
2019-10-26 10:22:48 -06:00
David Hall
a8e15280e1
Added workaround for missing function in .NET Std 2.0
2019-10-23 12:20:52 -06:00
David Hall
8d21d70f91
Added class to invoke methods on dynamic COM IDispatch.
2019-10-23 12:04:44 -06:00
David Hall
05bd6d2098
Changed Write method to take structure as 'in' param.
2019-10-17 09:13:45 -06:00
David Hall
1b472f58be
Added SizeT.Zero value.
2019-10-17 09:13:00 -06:00
David Hall
77d4e5c49a
Fixed XML doc errors
2019-10-11 10:34:50 -06:00
David Hall
4f087df55c
Added non-generic CanGet/Set methods.
2019-10-08 20:13:17 -06:00
David Hall
cca953eb5f
Fixed bug #66 that forces all SafeMemString string representations to Empty when a size not known (like as a return value from a COM object).
2019-10-08 13:29:30 -06:00
David Hall
bce17ac78f
Added CanSet method that gets the corresponding enum value given a type
2019-10-07 18:43:55 -06:00
David Hall
740bd61ac5
Added ToString method that includes an offset parameter.
2019-09-27 13:32:19 -06:00
David Hall
1491e32f80
Made ISafeMemoryHandle derive from IDisposable
2019-09-19 12:22:21 -06:00
David Hall
c009606359
Added Set method to SafeMemString to allow for a new string to be set on the condition it is of same or lesser length.
2019-09-16 07:55:18 -06:00
David Hall
4322becff6
Added better documentation
2019-09-05 19:59:25 -06:00
David Hall
3a1d6548b3
Added BOOL and BOOLEAN types
2019-08-27 09:05:48 -06:00
David Hall
4a25d8dc25
Added comparison operators and methods
2019-08-27 08:41:39 -06:00
David Hall
15ffe13254
Added ability to get CharSet and resize by setting Capacity property.
2019-08-23 11:52:14 -06:00
David Hall
9d4758ed5d
Added Write methods to SafeMemoryHandleExt. Added size checking from InteropExtension methods. Added offset param to ToStructure.
2019-08-21 10:18:07 -06:00
David Hall
c3521b7742
MAJOR BREAKING CHANGEs:
...
1) Obsoleted Vanara.Extensions.InteropExtensions.StructureToPtr for a name change to MarshalToPtr for consistency.
2) Added parameter to all methods reading memory that allows developer to indicate size of allocated memory they read from.
3) Enabled the ability to read/write enum values from memory in all extension methods.
4) Added Write methods for writing to memory
2019-08-17 21:13:57 -06:00
David Hall
fb62105f42
Added TypeConverter, MinValue/MaxValue fields, comparison operators, and fixed inconsistent handling of Int32 conversions.
2019-08-17 16:07:02 -06:00
David Hall
246b53dd69
Fixed bug in CanSet method
2019-08-17 16:05:22 -06:00
David Hall
a23ac2d587
Fixed bug when handling enums
2019-08-15 00:16:05 -07:00
David Hall
602f847bd8
Fixed bug in CanGet method when value supported more than one type.
2019-08-15 00:15:43 -07:00
David Hall
ae0251ded9
Changed structure input parameter to CreateFromStructure to 'in' for memory classes
2019-07-27 13:05:10 -06:00
David Hall
683280a945
Updated constructors of all SafeAllocatedMemory derivatives to use SizeT instead of int for the size parameter.
2019-07-27 12:48:33 -06:00
David Hall
42630dd833
BREAKING CHANGE: Changed type of SafeAllocatedMemoryHandle.Size property from int to SizeT so that it more easily converts to different types used in memory size functions.
2019-07-25 19:46:45 -06:00
David Hall
893efef823
Moved into InteropServices
2019-07-25 18:53:21 -06:00
David Hall
499f10c996
Changed validation check to ensure boundary is a power of 2.
2019-07-25 12:01:46 -06:00
David Hall
6235cd776e
Added SafeAllocatedMemoryHandle derived class for managed aligned memory buffers.
2019-07-25 10:49:18 -06:00
David Hall
0fef11ebb1
Made SafeMemoryHandle conversion to IntPtr implicit instead of explicit. In practice, I have found this to be a constant conversion need.
2019-07-25 10:48:43 -06:00
David Hall
b471f81899
Fixed bug in new code
2019-07-24 15:23:22 -06:00
David Hall
b4dde29d90
Simplified and extended GetCorrespondingTypes methods
2019-07-24 12:55:23 -06:00
David Hall
64b2911d5e
BREAKING CHANGE: Changed CorrepsondingAction to CorrespondingAction due to misspelling.
2019-07-12 09:49:54 -06:00
David Hall
63c67871aa
Added DebuggerDisplayAttribute for all classes to show pointer and string values.
2019-07-08 11:37:32 -06:00
David Hall
a360548771
Added Equals override and new GuidPtr structure.
2019-07-03 14:44:16 -06:00
David Hall
c374ab2cff
Added ability to read nullable structure, fixed bug in WriteObject
2019-07-03 14:43:47 -06:00
David Hall
7ce7b96209
* Derived SafeCoTaskMemString from base class SafeMemString derived from SafeMemHandle<T>.
...
* BREAKING CHANGE: Removed CharCapacity and made Capacity show char allocation. Size (from parent) shows byte capacity. Mimics StringBuilder.
2019-06-25 17:10:57 -06:00
David Hall
3415cac1dc
Added implicit operator from IntPtr
2019-06-07 10:59:03 -06:00
David Hall
d191144a51
Change implicit string conversion to get 'null' for IntPtr.Zero
2019-06-04 16:01:43 -06:00
David Hall
1f6d4f4384
Added .NET Stream wrapper for COM IStream instances.
2019-05-08 09:25:15 -06:00
David Hall
51c888f4da
Added FromNullable static creator
2019-05-08 09:24:39 -06:00
David Hall
15f05e2924
Added factory to make instancing ComReleaser easier and changed implicit operators to explicit.
2019-05-08 09:24:00 -06:00
David Hall
111d8478ad
Improved handling of 'null' in ToString methods
2019-04-28 09:46:59 -06:00
David Hall
9c97ccfd14
Fixed bug in GetBytes method
2019-04-24 08:24:18 -06:00
David Hall
5548ff6c71
Changed generic constraint on Write methods to struct instead of unmanaged
2019-04-10 13:11:06 -06:00
David Hall
34d48333d6
Corrected documentation errors
2019-04-10 11:28:19 -06:00
David Hall
9ed6c463c7
WIP on new generic marshaler
2019-04-08 12:08:29 -06:00
David Hall
8cfcee658d
Added much improved native memory stream implementation over MarshalingStream. Use NativeMemoryStream moving forward. It is saver and more function rich.
2019-04-08 12:03:20 -06:00
David Hall
65e1440ec0
Ensured that space in newly allocated memory is zeroed by default. Fixed handling of Size manipulation to zero out bytes added. (bug: it zeroed out everything)
2019-04-08 11:54:24 -06:00
David Hall
51edbded7c
Added static Instance properties to IMemoryMethods implementations
2019-04-08 11:42:16 -06:00
David Hall
180dc255d8
Added 'Obsolete' attribute to push users to NativeMemoryStream
2019-04-08 11:41:26 -06:00
David Hall
f18f91950d
Fixes for handling null pointer and bool
2019-04-08 11:40:43 -06:00
David Hall
178701d505
Added string handling to all Convert methods
2019-03-25 17:39:29 -07:00
David Hall
dc83d5d0b4
Moved Dump, GetBytes and IntPtr operator to SafeAllocatedMemory base class. Added byte* and SafeBuffer operators to SafeAllocatedMemory.
2019-03-25 17:38:42 -07:00
David Hall
8281580a28
Added null checking to Contains method
2019-03-25 17:36:39 -07:00
David Hall
38b45d9192
Added methods to simplify safely converting from a pointer to a type. Handles blittable and serializable types.
2019-03-07 09:25:12 -07:00
David Hall
9612664387
Fixed Write methods to better handle string types
2019-03-07 09:22:40 -07:00