public void TestNtStringWriteToString() { const string testStr = "TestString"; using (NtStringWrite write = new NtStringWrite(testStr)) { Assert.AreEqual(testStr, write.ToString()); } }
public void TestNtStringReadToString() { const string testStr = "TestString"; using (NtStringWrite write = new NtStringWrite(testStr)) { NtStringRead read = new NtStringRead(write.str, write.len); Assert.AreEqual(testStr, read.ToString()); GC.KeepAlive(write); } }
internal static bool SetEntryStringArray(string name, string[] value, bool force = false) { UIntPtr size; byte[] namePtr = CreateUTF8String(name, out size); NtStringWrite[] ntStrings = new NtStringWrite[value.Length]; for (int i = 0; i < value.Length; i++) { ntStrings[i] = new NtStringWrite(value[i]); } int retVal = Interop.NT_SetEntryStringArray(namePtr, size, ntStrings, (UIntPtr)ntStrings.Length, force ? 1 : 0); foreach (var ntString in ntStrings) { ntString.Dispose(); } return(retVal != 0); }
internal static bool SetEntryStringArray(string name, string[] value, bool force = false) { UIntPtr size; byte[] namePtr = CreateUTF8String(name, out size); NtStringWrite[] ntStrings = new NtStringWrite[value.Length]; for (int i = 0; i < value.Length; i++) { ntStrings[i] = new NtStringWrite(value[i]); } int retVal = Interop.NT_SetEntryStringArray(namePtr, size, ntStrings, (UIntPtr)ntStrings.Length, force ? 1 : 0); foreach (var ntString in ntStrings) { ntString.Dispose(); } return retVal != 0; }
public void TestNtStringWriteCreateAndDispose() { NtStringWrite write = new NtStringWrite("TestString"); write.Dispose(); }
public void TestNtStringWriteArray() { object obj = new NtStringWrite[6]; Assert.DoesNotThrow(() => GCHandle.Alloc(obj, GCHandleType.Pinned).Free()); }