Example #1
0
        //-----------------------------------------------------------------------------
        // Function: CleanupGroup
        //
        // Purpose:  Clean up all the global variables associated with this group.
        //
        // Returns:  nothing
        //
        internal void CleanupGroup()
        {
            if (g_hPeerEvent != null)
            {
                g_hPeerEvent.Dispose();
                g_hPeerEvent = null;
            }

            if (g_hEvent != null)
            {
                g_hEvent.Dispose();
                g_hEvent = null;
            }

            if (g_hWait != null)
            {
                g_hWait.Dispose();
                g_hWait = null;
            }

            if (!g_hGroup.IsNull)
            {
                PeerGroupClose(g_hGroup);
                g_hGroup = HGROUP.NULL;
            }
        }
 public void Dispose()
 {
     if (connectEndEvent is not null)
     {
         connectEndEvent.Dispose();
         connectEndEvent = null;
     }
 }
        public void Dispose()
        {
            m_hCallbackComplete?.Dispose();
            m_hCallbackComplete = default;

            if (m_LockCreated)
            {
                DeleteCriticalSection(ref m_Lock);
                m_LockCreated = false;
            }
        }
Example #4
0
        // Clean up the used resources
        public void Dispose()
        {
            if (!m_command.IsNull)
            {
                WSManCloseCommand(m_command, 0, m_async);
                WaitForSingleObject(m_event, INFINITE);
                if (Win32Error.NO_ERROR != m_errorCode)
                {
                    wprintf("WSManCloseCommand failed: {0}\n", m_errorCode);
                }
                else
                {
                    m_command = default;
                }
            }

            if (!m_shell.IsNull)
            {
                WSManCloseShell(m_shell, 0, m_async);
                WaitForSingleObject(m_event, INFINITE);
                if (Win32Error.NO_ERROR != m_errorCode)
                {
                    wprintf("WSManCloseShell failed: {0}\n", m_errorCode);
                }
                else
                {
                    m_shell = default;
                }
            }

            // Frees memory of session and closes all related operations before returning
            m_session?.Dispose();

            // deinitializes the Winrm client stack; all operations will finish before this API will return
            m_apiHandle?.Dispose();

            m_event?.Dispose();
            m_ReceiveEvent?.Dispose();

            m_bSetup   = false;
            m_bExecute = false;
        }
        public void Dispose()
        {
            ChatEndpoint  = null;
            RenderClient  = null;
            CaptureClient = null;
            AudioClient   = null;

            if (ChatThread is not null)
            {
                ChatThread.Dispose();
                ChatThread = default;
            }
            if (ShutdownEvent is not null)
            {
                ShutdownEvent.Dispose();
                ShutdownEvent = null;
            }
            if (AudioSamplesReadyEvent is not null)
            {
                AudioSamplesReadyEvent.Dispose();
                AudioSamplesReadyEvent = null;
            }
        }