public static extern BOOL GetFileSecurity( LPCTSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, out DWORD lpnLengthNeeded );
public static extern DWORD SetNamedSecurityInfo( LPCTSTR pObjectName, //REVIEW: Why is it documented as LPTSTR SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID psidOwner, PSID psidGroup, PACL pDacl, PACL pSacl);
public static extern SafeFileHandle CreateFile( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
public static extern DWORD GetNamedSecurityInfo( LPCTSTR pObjectName, //REVIEW: Why is it documented as LPTSTR SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, ref PSID ppsidOwner, ref PSID ppsidGroup, ref PACL ppDacl, ref PACL ppSacl, ref PSECURITY_DESCRIPTOR ppSecurityDescriptor);
internal static extern DWORD DsGetDcName( [MarshalAs(UnmanagedType.LPTStr)] LPCTSTR ComputerName, [MarshalAs(UnmanagedType.LPTStr)] LPCTSTR DomainName, IntPtr DomainGuid, [MarshalAs(UnmanagedType.LPTStr)] LPCTSTR SiteName, DsGetDcFlags Flags, out IntPtr pDOMAIN_CONTROLLER_INFO //caller must free this struct with NetApiBufferFree );
private static void Execute <T>( ref T x, DWORD dwIoControlCode, LPCTSTR lpFileName, DWORD dwDesiredAccess = GENERIC_READ, DWORD dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ, LPSECURITY_ATTRIBUTES lpSecurityAttributes = default(LPSECURITY_ATTRIBUTES), DWORD dwCreationDisposition = OPEN_EXISTING, DWORD dwFlagsAndAttributes = 0, HANDLE hTemplateFile = default(IntPtr) ) { var hDevice = CreateFile( lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile ); if (null == hDevice || hDevice.IsInvalid) { throw new Win32Exception(Marshal.GetLastWin32Error()); } var nOutBufferSize = Marshal.SizeOf(typeof(T)); var lpOutBuffer = Marshal.AllocHGlobal(nOutBufferSize); var lpBytesReturned = default(DWORD); var NULL = IntPtr.Zero; var result = DeviceIoControl( hDevice, dwIoControlCode, NULL, 0, lpOutBuffer, nOutBufferSize, ref lpBytesReturned, NULL ); if (0 == result) { throw new Win32Exception(Marshal.GetLastWin32Error()); } x = (T)Marshal.PtrToStructure(lpOutBuffer, typeof(T)); Marshal.FreeHGlobal(lpOutBuffer); hDevice.Close(); hDevice.Dispose(); hDevice = null; }
public HWND Create(HWND hwndParent, LPCTSTR strName, DWORD dwStyle, DWORD dwExStyle, int x, int y, int cx, int cy, HMENU hMenu) { if (GetSuperClassName() != null && !RegisterSuperclass()) { return(IntPtr.Zero); } if (GetSuperClassName() == null && !RegisterWindowClass()) { return(IntPtr.Zero); } m_hWnd = NativeMethods.CreateWindowEx(dwExStyle, GetWindowClassName(), strName, dwStyle, x, y, cx, cy, hwndParent, hMenu, DuiUIManager.GetInstance(), m_pointer); Debug.Assert(m_hWnd != IntPtr.Zero); return(m_hWnd); }
internal static extern DWORD DsBindWithCred( LPCTSTR DomainControllerName, LPCTSTR DnsDomainName, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, out HANDLE phDS );
public static extern BOOL LookupPrivilegeValue(LPCTSTR lpSystemName, LPCTSTR lpName, out LUID lpLuid);
int AddService(LPCTSTR lpszBinaryPathName);
public static extern HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName);
public static extern HCURSOR LoadCursor(HINSTANCE hInstance, LPCTSTR lpCursorName);
public static extern DWORD_PTR SHGetFileInfo(LPCTSTR pszPath, DWORD dwFileAttributes, ref SHFILEINFO psfi, UINT cbFileInfo, ShGetFileIconFlags uFlags);
public static extern BOOL SetFileSecurity( LPCTSTR lpFileName, // file name SECURITY_INFORMATION SecurityInformation, // contents PSECURITY_DESCRIPTOR pSecurityDescriptor // SD );
public HWND CreateDuiWindow(HWND hwndParent, LPCTSTR pstrWindowName, DWORD dwStyle /*=0*/, DWORD dwExStyle /*=0*/) { return(Create(hwndParent, pstrWindowName, dwStyle, dwExStyle, 0, 0, 0, 0, IntPtr.Zero)); }
public static extern BOOL ConvertStringSidToSid(LPCTSTR StringSid, out IntPtr Sid);
internal static extern short UnregisterClass([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR className, IntPtr instance);
public static extern HWND CreateWindowEx( DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, Int32 x, Int32 y, Int32 nWidth, Int32 nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, [MarshalAs(UnmanagedType.AsAny)] object pvParam);
public static extern BOOL EnumDisplayDevices([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpDevice, DWORD iDevNum, [In, Out] WindowsDisplayDevice lpDisplayDevice, DWORD dwFlags);
internal static extern BOOL SetWindowText(HWND hWnd, LPCTSTR lpString);
public static extern LONG RegOpenKey( HKEY hKey, LPCTSTR lpSubKey, out HKEY phkResult );
private static extern HWND CreateWindowEx( DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, Int32 x, Int32 y, Int32 nWidth, Int32 nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
internal static extern DWORD DsBind( LPCTSTR DomainControllerName, LPCTSTR DnsDomainName, out HANDLE phDS );
static void Show(LPCTSTR lpszMessage) { ::MessageBoxW(NULL, lpszMessage, L"Message", 0);
internal static extern DWORD DsMakePasswordCredentials( LPCTSTR User, LPCTSTR Domain, LPCTSTR Password, out RPC_AUTH_IDENTITY_HANDLE pAuthIdentity );
public static extern BOOL EnumDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpszDeviceName, DWORD iModeNum, [In, Out] DeviceMode lpDevMode, DWORD dwFlags);
public static extern DWORD SetNamedSecurityInfo( LPCTSTR pObjectName, //REVIEW: Why is it documented as LPTSTR SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, [In,MarshalAs(UnmanagedType.LPArray)] byte[] psidOwner, [In,MarshalAs(UnmanagedType.LPArray)] byte[] psidGroup, [In,MarshalAs(UnmanagedType.LPArray)] byte[] pDacl, [In,MarshalAs(UnmanagedType.LPArray)] byte[] pSacl);