ThreadingHelper.cs 885 B

123456789101112131415161718192021222324
  1. /* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Runtime.InteropServices;
  9. using System.Threading;
  10. namespace SMBLibrary.Win32
  11. {
  12. public class ThreadingHelper
  13. {
  14. [DllImport("kernel32.dll", SetLastError = true)]
  15. public static extern uint GetCurrentThreadId();
  16. [DllImport("kernel32.dll", SetLastError = true)]
  17. public static extern IntPtr OpenThread(uint desiredAccess, bool inheritHandle, uint threadId);
  18. [DllImport("kernel32.dll", SetLastError = true)]
  19. public static extern bool CloseHandle(IntPtr handle);
  20. }
  21. }