tgstation-server
The /tg/station 13 server suite
NativeMethods.cs
Go to the documentation of this file.
1 using System;
2 using System.Runtime.InteropServices;
3 using System.Text;
4 
5 namespace Tgstation.Server.Host
6 {
10  static class NativeMethods
11  {
15  [Flags]
16  public enum CreateSymbolicLinkFlags : int
17  {
18  None = 0,
19  Directory = 1,
20  AllowUnprivilegedCreate = 2
21  }
22 
26  [DllImport("user32.dll")]
27  public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId);
28 
32  [DllImport("user32.dll", CharSet = CharSet.Unicode)]
33  public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
34 
38  [DllImport("user32.dll")]
39  public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);
40 
44  public delegate bool EnumWindowProc(IntPtr hwnd, IntPtr lParam);
45 
49  [DllImport("user32.dll")]
50  public static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr lParam);
51 
55  [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
56  public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
57 
61  [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
62  public static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr phToken);
63 
67  [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
68  public static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, CreateSymbolicLinkFlags dwFlags);
69  }
70 }
CreateSymbolicLinkFlags
See https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-createsymboliclinka#param...
Native methods used by the code