コード例 #1
0
        public CcmErrorCode GetSessionInfo(int sessionId, out CcmIcaSession sessionInfo)
        {
            var ptr = IntPtr.Zero;

            var result = Environment.Is64BitProcess ?
                         CcmSdk64.CCMGetSessionInfo(sessionId, ref ptr) :
                         CcmSdk32.CCMGetSessionInfo(sessionId, ref ptr);

            sessionInfo = Marshal.PtrToStructure <CcmIcaSession>(ptr);

            _ = Environment.Is64BitProcess ?
                CcmSdk64.CCMFreeICASession(1U, ptr) :
                CcmSdk32.CCMFreeICASession(1U, ptr);

            return((CcmErrorCode)result);
        }
コード例 #2
0
        public CcmErrorCode EnumerateSessions(out CcmIcaSession[] sessions)
        {
            var ptrSize = Marshal.SizeOf(typeof(CcmIcaSession));
            var ptr     = IntPtr.Zero;

            var result = Environment.Is64BitProcess ?
                         CcmSdk64.CCMEnumerateSessions(out var count, ref ptr) :
                         CcmSdk32.CCMEnumerateSessions(out count, ref ptr);

            sessions = new CcmIcaSession[count];
            for (int i = 0; i < count; i++)
            {
                var nPtr = IntPtr.Add(ptr, i * ptrSize);
                sessions[i] = Marshal.PtrToStructure <CcmIcaSession>(nPtr);
            }

            _ = Environment.Is64BitProcess ?
                CcmSdk64.CCMFreeICASession(count, ptr) :
                CcmSdk32.CCMFreeICASession(count, ptr);

            return((CcmErrorCode)result);
        }