private static int EncodingByteArrayHelper(BerSafeHandle berElement, byte[] tempValue, char fmt)
 {
     if (tempValue != null)
     {
         IntPtr destination = Marshal.AllocHGlobal(tempValue.Length);
         Marshal.Copy(tempValue, 0, destination, tempValue.Length);
         HGlobalMemHandle handle = new HGlobalMemHandle(destination);
         return(Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), handle, tempValue.Length));
     }
     return(Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle(IntPtr.Zero), 0));
 }
Exemple #2
0
        private static int EncodingByteArrayHelper(BerSafeHandle berElement, byte[] tempValue, char fmt)
        {
            int num;

            if (tempValue == null)
            {
                num = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle((IntPtr)0), 0);
            }
            else
            {
                IntPtr intPtr = Marshal.AllocHGlobal((int)tempValue.Length);
                Marshal.Copy(tempValue, 0, intPtr, (int)tempValue.Length);
                HGlobalMemHandle hGlobalMemHandle = new HGlobalMemHandle(intPtr);
                num = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), hGlobalMemHandle, (int)tempValue.Length);
            }
            return(num);
        }
Exemple #3
0
        private static int EncodingByteArrayHelper(SafeBerHandle berElement, byte[] tempValue, char fmt)
        {
            int error = 0;

            // one byte array, one int arguments
            if (tempValue != null)
            {
                IntPtr tmp = Marshal.AllocHGlobal(tempValue.Length);
                Marshal.Copy(tempValue, 0, tmp, tempValue.Length);
                HGlobalMemHandle memHandle = new HGlobalMemHandle(tmp);
                error = BerPal.PrintByteArray(berElement, new string(fmt, 1), memHandle, tempValue.Length);
            }
            else
            {
                HGlobalMemHandle memHandle = new HGlobalMemHandle(HGlobalMemHandle._dummyPointer);
                error = BerPal.PrintByteArray(berElement, new string(fmt, 1), memHandle, 0);
            }

            return(error);
        }
Exemple #4
0
        private static int EncodingByteArrayHelper(BerSafeHandle berElement, byte[] tempValue, char fmt)
        {
            int error = 0;

            // one byte array, one int arguments
            if (tempValue != null)
            {
                IntPtr tmp = Marshal.AllocHGlobal(tempValue.Length);
                Marshal.Copy(tempValue, 0, tmp, tempValue.Length);
                HGlobalMemHandle memHandle = new HGlobalMemHandle(tmp);

                error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), memHandle, tempValue.Length);
            }
            else
            {
                error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle(IntPtr.Zero), 0);
            }

            return(error);
        }
Exemple #5
0
        private static int EncodingByteArrayHelper(BerSafeHandle berElement, byte[] tempValue, char fmt)
        {
            int error = 0;

            // one byte array, one int arguments
            //if (tempValue != null)
            //{

            tempValue = tempValue ?? new byte[0]; //openLdap ber_printf doesn't cope well with null values

            IntPtr tmp = Marshal.AllocHGlobal(tempValue.Length);

            Marshal.Copy(tempValue, 0, tmp, tempValue.Length);
            HGlobalMemHandle memHandle = new HGlobalMemHandle(tmp);

            error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), memHandle, tempValue.Length);
            //}
            //else
            //{
            //    error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle(IntPtr.Zero), 0);
            //}

            return(error);
        }
 public static extern int ber_printf_bytearray(BerSafeHandle berElement, string format, HGlobalMemHandle value, int length);
 private static int EncodingByteArrayHelper(BerSafeHandle berElement, byte[] tempValue, char fmt)
 {
     if (tempValue != null)
     {
         IntPtr destination = Marshal.AllocHGlobal(tempValue.Length);
         Marshal.Copy(tempValue, 0, destination, tempValue.Length);
         HGlobalMemHandle handle = new HGlobalMemHandle(destination);
         return Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), handle, tempValue.Length);
     }
     return Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle(IntPtr.Zero), 0);
 }
Exemple #8
0
 internal static int PrintByteArray(SafeBerHandle berElement, string format, HGlobalMemHandle value, int length) => Interop.Ldap.ber_printf_bytearray(berElement, format, value, length);
Exemple #9
0
 public static extern int ber_printf_bytearray(BerSafeHandle berElement, string format, HGlobalMemHandle value, int length);
Exemple #10
0
 internal static int PrintByteArray(SafeBerHandle berElement, string format, HGlobalMemHandle value, uint length, nuint _) => Interop.Ldap.ber_printf(berElement, format, __arglist(value, length));
Exemple #11
0
		private static int EncodingByteArrayHelper(BerSafeHandle berElement, byte[] tempValue, char fmt)
		{
			int num;
			if (tempValue == null)
			{
				num = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle((IntPtr)0), 0);
			}
			else
			{
				IntPtr intPtr = Marshal.AllocHGlobal((int)tempValue.Length);
				Marshal.Copy(tempValue, 0, intPtr, (int)tempValue.Length);
				HGlobalMemHandle hGlobalMemHandle = new HGlobalMemHandle(intPtr);
				num = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), hGlobalMemHandle, (int)tempValue.Length);
			}
			return num;
		}
Exemple #12
0
        private static int EncodingByteArrayHelper(BerSafeHandle berElement, byte[] tempValue, char fmt)
        {
            int error = 0;

            // one byte array, one int arguments
            if (tempValue != null)
            {
                IntPtr tmp = Marshal.AllocHGlobal(tempValue.Length);
                Marshal.Copy(tempValue, 0, tmp, tempValue.Length);
                HGlobalMemHandle memHandle = new HGlobalMemHandle(tmp);

                error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), memHandle, tempValue.Length);
            }
            else
            {
                error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle((IntPtr)0), 0);
            }

            return error;
        }