Beispiel #1
0
    def testReadByte(self):
        data = Marshal.AllocHGlobal(1)

        Marshal.WriteByte(data, 0)
        self.assertEquals(CPyMarshal.ReadByte(data), 0, "wrong")

        Marshal.WriteByte(data, 255)
        self.assertEquals(CPyMarshal.ReadByte(data), 255, "wrong")

        Marshal.FreeHGlobal(data)
Beispiel #2
0
 def ptrFromByteArray(self, bytes):
     testData = Marshal.AllocHGlobal(bytes.Length + 1)
     Marshal.Copy(bytes, 0, testData, bytes.Length)
     Marshal.WriteByte(OffsetPtr(testData, bytes.Length), 0)
     return testData