Example #1
0
 public static extern BOOL GetFileSecurity(
     LPCTSTR lpFileName,
     SECURITY_INFORMATION RequestedInformation,
     PSECURITY_DESCRIPTOR pSecurityDescriptor,
     DWORD nLength,
     out DWORD lpnLengthNeeded
     );
Example #2
0
 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);
Example #3
0
 public static extern SafeFileHandle CreateFile(
     LPCTSTR lpFileName,
     DWORD dwDesiredAccess,
     DWORD dwShareMode,
     LPSECURITY_ATTRIBUTES lpSecurityAttributes,
     DWORD dwCreationDisposition,
     DWORD dwFlagsAndAttributes,
     HANDLE hTemplateFile);
Example #4
0
 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);
Example #5
0
 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
     );
Example #6
0
        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;
        }
Example #7
0
 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);
 }
Example #8
0
 internal static extern DWORD DsBindWithCred(
     LPCTSTR DomainControllerName,
     LPCTSTR DnsDomainName,
     RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
     out HANDLE phDS
     );
Example #9
0
		public static extern BOOL LookupPrivilegeValue(LPCTSTR lpSystemName, LPCTSTR lpName, out LUID lpLuid);
Example #10
0
 int AddService(LPCTSTR lpszBinaryPathName);
Example #11
0
 public static extern HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName);
Example #12
0
 public static extern HCURSOR LoadCursor(HINSTANCE hInstance, LPCTSTR lpCursorName);
Example #13
0
		public static extern BOOL GetFileSecurity(
			LPCTSTR lpFileName, 
			SECURITY_INFORMATION RequestedInformation, 
			PSECURITY_DESCRIPTOR pSecurityDescriptor, 
			DWORD nLength, 
			out DWORD lpnLengthNeeded
			);
Example #14
0
 public static extern DWORD_PTR SHGetFileInfo(LPCTSTR pszPath, DWORD dwFileAttributes, ref SHFILEINFO psfi, UINT cbFileInfo, ShGetFileIconFlags uFlags);
Example #15
0
 public static extern BOOL SetFileSecurity(
     LPCTSTR lpFileName,                       // file name
     SECURITY_INFORMATION SecurityInformation, // contents
     PSECURITY_DESCRIPTOR pSecurityDescriptor  // SD
     );
Example #16
0
 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));
 }
Example #17
0
 public static extern BOOL ConvertStringSidToSid(LPCTSTR StringSid, out IntPtr Sid);
Example #18
0
 internal static extern short UnregisterClass([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR className, IntPtr instance);
Example #19
0
 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);
Example #20
0
 public static extern BOOL EnumDisplayDevices([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpDevice,
                                              DWORD iDevNum, [In, Out] WindowsDisplayDevice lpDisplayDevice, DWORD dwFlags);
Example #21
0
 internal static extern BOOL SetWindowText(HWND hWnd, LPCTSTR lpString);
Example #22
0
 public static extern LONG RegOpenKey(
     HKEY hKey,
     LPCTSTR lpSubKey,
     out HKEY phkResult
     );
Example #23
0
 public static extern BOOL SetFileSecurity(
     LPCTSTR lpFileName, // file name
     SECURITY_INFORMATION SecurityInformation, // contents
     PSECURITY_DESCRIPTOR pSecurityDescriptor // SD
     );
Example #24
0
 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);
Example #25
0
 internal static extern DWORD DsBind(
     LPCTSTR DomainControllerName,
     LPCTSTR DnsDomainName,
     out HANDLE phDS
     );
 static void Show(LPCTSTR lpszMessage)
 {
     ::MessageBoxW(NULL, lpszMessage, L"Message", 0);
Example #27
0
		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);
Example #28
0
 public static extern LONG RegOpenKey(
     HKEY hKey,
     LPCTSTR lpSubKey,
     out HKEY phkResult
     );
Example #29
0
 internal static extern DWORD DsMakePasswordCredentials(
     LPCTSTR User,
     LPCTSTR Domain,
     LPCTSTR Password,
     out RPC_AUTH_IDENTITY_HANDLE pAuthIdentity
     );
Example #30
0
 public static extern BOOL EnumDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpszDeviceName, DWORD iModeNum,
                                                 [In, Out] DeviceMode lpDevMode, DWORD dwFlags);
Example #31
-1
		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);