public static extern int AdjustTokenPrivileges(
     HANDLE TokenHandle,
     int DisableAllPrivileges,
     PTOKEN_PRIVILEGES NewState,
     uint BufferLength,
     PTOKEN_PRIVILEGES PreviousState,
     out uint ReturnLength);
Example #2
0
        public GraphicsPlus(HDC hdc,
                 HANDLE hdevice)
        {
            GpGraphics Graphics = new GpGraphics();

            lastResult = NativeMethods.GdipCreateFromHDC2(hdc, hdevice, out Graphics);

            SetNativeGraphics(Graphics);
        }
Example #3
0
		public static void GetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE objectType,
			SECURITY_INFORMATION securityInfo,
			out Sid sidOwner,
			out Sid sidGroup,
			out Dacl dacl,
			out Sacl sacl,
			out SecurityDescriptor secDesc)
		{
			sidOwner = null;
			sidGroup = null;
			dacl = null;
			sacl = null;
			secDesc = null;

			IntPtr ptrOwnerSid = IntPtr.Zero;
			IntPtr ptrGroupSid = IntPtr.Zero;
			IntPtr ptrDacl = IntPtr.Zero;
			IntPtr ptrSacl = IntPtr.Zero;
			IntPtr ptrSecDesc = IntPtr.Zero;

			DWORD rc = Win32.GetSecurityInfo(handle, objectType, securityInfo,
				ref ptrOwnerSid, ref ptrGroupSid, ref ptrDacl, ref ptrSacl, ref ptrSecDesc);

			if (rc != Win32.ERROR_SUCCESS)
			{
				Win32.SetLastError(rc);
				Win32.ThrowLastError();
			}

			try
			{
				if (ptrOwnerSid != IntPtr.Zero)
					sidOwner = new Sid(ptrOwnerSid);

				if (ptrGroupSid != IntPtr.Zero)
					sidGroup = new Sid(ptrGroupSid);

				if (ptrDacl != IntPtr.Zero)
					dacl = new Dacl(ptrDacl);

				if (ptrSacl != IntPtr.Zero)
					sacl = new Sacl(ptrSacl);

				if (ptrSecDesc != IntPtr.Zero)
					secDesc = new SecurityDescriptor(ptrSecDesc, true);
			}
			catch
			{
				if (ptrSecDesc != IntPtr.Zero)
					Win32.LocalFree(ptrSecDesc);
				throw;
			}
		}
		public static SecurityDescriptor GetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE objectType,
			SECURITY_INFORMATION securityInfo)
		{
			Sid sidOwner;
			Sid sidGroup;
			Dacl dacl;
			Sacl sacl;
			SecurityDescriptor secDesc;
			Win32Helpers.GetSecurityInfo(handle, objectType, securityInfo,
				out sidOwner, out sidGroup, out dacl, out sacl,	out secDesc);

			return secDesc;
		}
 public static extern int AppPolicyGetClrCompat(HANDLE processToken, AppPolicyClrCompat *policy);
 public static extern int AppPolicyGetWindowingModel(HANDLE processToken, AppPolicyWindowingModel *policy);
Example #7
0
 internal static extern INT GetRawInputDeviceInfo(
     HANDLE Device,
     [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
     [In, Out] RawInputDeviceInfo Data,
     [In, Out] ref INT Size
 );
 public static extern bool ReleaseMutex(HANDLE hMutex);
 public static extern bool FindClose(HANDLE hFindFile);
Example #10
0
		public static extern BOOL OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, [Out] out HANDLE TokenHandle);
 public static extern int GetPackageFamilyNameFromToken(HANDLE token, [NativeTypeName("UINT32 *")] uint *packageFamilyNameLength, [NativeTypeName("PWSTR")] ushort *packageFamilyName);
 public static extern int GetPackageFamilyName(HANDLE hProcess, [NativeTypeName("UINT32 *")] uint *packageFamilyNameLength, [NativeTypeName("PWSTR")] ushort *packageFamilyName);
 public static extern int GetPackageId(HANDLE hProcess, [NativeTypeName("UINT32 *")] uint *bufferLength, byte *buffer);
 public static extern int AppPolicyGetCreateFileAccess(HANDLE processToken, AppPolicyCreateFileAccess *policy);
 public static extern int AppPolicyGetProcessTerminationMethod(HANDLE processToken, AppPolicyProcessTerminationMethod *policy);
 public static extern int AppPolicyGetShowDeveloperDiagnostic(HANDLE processToken, AppPolicyShowDeveloperDiagnostic *policy);
 public static extern int AppPolicyGetThreadInitializationType(HANDLE processToken, AppPolicyThreadInitializationType *policy);
Example #18
0
		public static extern BOOL WriteProcessMemory(HANDLE hProcess, LPVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, out SIZE_T lpNumberOfBytesWritten);
Example #19
0
		public static extern BOOL AdjustTokenPrivileges(HANDLE TokenHandle,
			[MarshalAs(UnmanagedType.Bool)] BOOL DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, DWORD BufferLength,
			out TOKEN_PRIVILEGES PreviousState, out DWORD ReturnLength);
 public static extern int GetApplicationUserModelId(HANDLE hProcess, [NativeTypeName("UINT32 *")] uint *applicationUserModelIdLength, [NativeTypeName("PWSTR")] ushort *applicationUserModelId);
Example #21
0
		public static void SetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE ObjectType,
			SECURITY_INFORMATION SecurityInfo,
			Sid sidOwner,
			Sid sidGroup,
			Dacl dacl,
			Sacl sacl)
		{
			UnsafeSetSecurityInfo (handle, ObjectType, SecurityInfo,
				sidOwner, sidGroup, dacl, sacl);
		}
 public static extern int GetApplicationUserModelIdFromToken(HANDLE token, [NativeTypeName("UINT32 *")] uint *applicationUserModelIdLength, [NativeTypeName("PWSTR")] ushort *applicationUserModelId);
Example #23
0
 public static extern bool DeferWindowPos(HANDLE hWndPosInfo, HWND hWnd, HWND hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
Example #24
0
 public static void CheckCall(HANDLE funcResult)
 {
     CheckCall(!IsNullHandle(funcResult));
 }
Example #25
0
 public static extern HINSTANCE LoadLibraryEx(string stModuleName, HANDLE hFile, uint dwFlags);
Example #26
0
 public static bool IsNullHandle(HANDLE ptr) => (ptr == IntPtr.Zero);
Example #27
0
 public static extern bool SetProcessWorkingSetSize(HANDLE hProcess, IntPtr min, IntPtr max);
Example #28
0
 public static extern int CloseHandle(HANDLE handle);
Example #29
0
 public static GraphicsPlus FromHDC(HDC hdc,
                          HANDLE hdevice)
 {
     return new GraphicsPlus(hdc, hdevice);
 }
Example #30
0
		public static extern BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode);
Example #31
0
 public static extern int OpenProcessToken(HANDLE hProcess, TokenAccessType dwDesiredAccess, out HANDLE hToken);
 public static extern int AppPolicyGetMediaFoundationCodecLoading(HANDLE processToken, AppPolicyMediaFoundationCodecLoading *policy);
Example #33
0
		public static extern DWORD SuspendThread(HANDLE hThread);
Example #34
0
 public static extern int NtClose(HANDLE Handle);
Example #35
0
		public static extern BOOL TerminateThread(HANDLE hThread, DWORD dwExitCode);
Example #36
0
 public static extern int NtRenameKey(HANDLE KeyHandle, [NativeTypeName("PUNICODE_STRING")] UNICODE_STRING *NewName);
Example #37
0
		public static string GetFinalPathNameByHandle(HANDLE handle, DWORD dwFlags)
		{
			var pathLength = GetFinalPathNameByHandle(handle, null, 0, dwFlags);
			NativeMethods.CheckWin32(pathLength > 0);
			var pathBuilder = new StringBuilder((int)pathLength);
			pathBuilder.Length = (int)pathLength;
			NativeMethods.CheckWin32(GetFinalPathNameByHandle(handle, pathBuilder, pathLength, dwFlags) > 0);
			return pathBuilder.ToString();
		}
Example #38
0
 public static extern int NtNotifyChangeMultipleKeys(HANDLE MasterKeyHandle, [NativeTypeName("ULONG")] uint Count, [NativeTypeName("OBJECT_ATTRIBUTES []")] OBJECT_ATTRIBUTES *SubordinateObjects, HANDLE Event, [NativeTypeName("PIO_APC_ROUTINE")] delegate *unmanaged <void *, IO_STATUS_BLOCK *, uint, void> ApcRoutine, [NativeTypeName("PVOID")] void *ApcContext, [NativeTypeName("PIO_STATUS_BLOCK")] IO_STATUS_BLOCK *IoStatusBlock, [NativeTypeName("ULONG")] uint CompletionFilter, [NativeTypeName("BOOLEAN")] byte WatchTree, [NativeTypeName("PVOID")] void *Buffer, [NativeTypeName("ULONG")] uint BufferSize, [NativeTypeName("BOOLEAN")] byte Asynchronous);
Example #39
0
		public static extern BOOL AdjustTokenPrivileges(HANDLE TokenHandle,
			[MarshalAs(UnmanagedType.Bool)] BOOL DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, DWORD BufferLength,
			IntPtr PreviousState = default(IntPtr), IntPtr ReturnLength = default(IntPtr));
Example #40
0
 public static extern Win32Error DavDeleteConnection(HANDLE ConnectionHandle);
Example #41
0
/*
 *	TYPELIB
 *
 *	Copyright 1997	Marcus Meissner
 *		      1999  Rein Klazes
 *		      2000  Francois Jacques
 *		      2001  Huw D M Davies for CodeWeavers
 *		      2004  Alastair Bridgewater
 *		      2005  Robert Shearman, for CodeWeavers
 *		      2013  Andrew Eikum for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 *
 * --------------------------------------------------------------------------------------
 * Known problems (2000, Francois Jacques)
 *
 * - Tested using OLEVIEW (Platform SDK tool) only.
 *
 * - dual interface dispinterfaces. vtable-interface ITypeInfo instances are
 *   creating by doing a straight copy of the dispinterface instance and just changing
 *   its typekind. Pointed structures aren't copied - only the address of the pointers.
 *
 * - locale stuff is partially implemented but hasn't been tested.
 *
 * - typelib file is still read in its entirety, but it is released now.
 *
 * --------------------------------------------------------------------------------------
 *  Known problems left from previous implementation (1999, Rein Klazes) :
 *
 * -. Data structures are straightforward, but slow for look-ups.
 * -. (related) nothing is hashed
 * -. Most error return values are just guessed not checked with windows
 *      behaviour.
 * -. lousy fatal error handling
 *
 */

//#include "precomp.h"

//#include <winternl.h>
//#include <lzexpand.h>

//#include "typelib.h"

//WINE_DEFAULT_DEBUG_CHANNEL(ole);
//WINE_DECLARE_DEBUG_CHANNEL(typelib);

#if __REACTOS__
/* FIXME: Vista+ */
//#define STATUS_SUCCESS ((NTSTATUS)0x00000000)
static BOOL WINAPI GetFileInformationByHandleEx( HANDLE handle, FILE_INFO_BY_HANDLE_CLASS class,
Example #42
0
 public static extern Win32Error DavFlushFile(HANDLE hFile);
Example #43
0
		internal unsafe static void UnsafeSetSecurityInfo(
			HANDLE handle,
			SE_OBJECT_TYPE ObjectType,
			SECURITY_INFORMATION SecurityInfo,
			Sid sidOwner,
			Sid sidGroup,
			Dacl dacl,
			Sacl sacl)
		{
			fixed(byte *pSidOwner = (sidOwner != null ? sidOwner.GetNativeSID() : null))
			{
				fixed(byte *pSidGroup = (sidGroup != null ? sidGroup.GetNativeSID() : null))
				{
					fixed(byte *pDacl = (dacl != null ? dacl.GetNativeACL() : null))
					{
						fixed(byte *pSacl = (sacl != null ? sacl.GetNativeACL() : null))
						{
							DWORD rc = Win32.SetSecurityInfo(handle, ObjectType, SecurityInfo,
								(IntPtr)pSidOwner, (IntPtr)pSidGroup, (IntPtr)pDacl, (IntPtr)pSacl);
							if (rc != Win32.ERROR_SUCCESS)
							{
								Win32.SetLastError(rc);
								Win32.ThrowLastError();
							}
						}
					}
				}
			}
		}
Example #44
0
 public static extern Win32Error DavGetExtendedError(HANDLE hFile, out Win32Error ExtError, StringBuilder ExtErrorString, ref uint cChSize);
Example #45
0
 public static extern bool CloseHandle(HANDLE hObject);
Example #46
0
 public static extern BOOL SetConsoleWindowInfo(HANDLE hConsoleOutput, BOOL bAbsolute, [NativeTypeName("const SMALL_RECT *")] SMALL_RECT *lpConsoleWindow);
Example #47
0
 public static extern bool EndDeferWindowPos(HANDLE hWndPosInfo);
Example #48
0
 public static extern BOOL WriteConsoleOutputCharacterW(HANDLE hConsoleOutput, [NativeTypeName("LPCWSTR")] ushort *lpCharacter, [NativeTypeName("DWORD")] uint nLength, COORD dwWriteCoord, [NativeTypeName("LPDWORD")] uint *lpNumberOfCharsWritten);
Example #49
0
 public static extern bool FindNextFile(HANDLE hndFindFile, [In, Out, MarshalAs(UnmanagedType.LPStruct)] WIN32_FIND_DATA lpFindFileData);
Example #50
0
 public static extern BOOL WriteConsoleOutputAttribute(HANDLE hConsoleOutput, [NativeTypeName("const WORD *")] ushort *lpAttribute, [NativeTypeName("DWORD")] uint nLength, COORD dwWriteCoord, [NativeTypeName("LPDWORD")] uint *lpNumberOfAttrsWritten);
Example #51
0
 public static extern int RegNotifyChangeKeyValue(HKEY hkey, bool bWatchSubtree, int dwNotifyFilter, HANDLE hEvent, bool fAsynchronous);
Example #52
0
 public static extern BOOL ReadConsoleOutputCharacterW(HANDLE hConsoleOutput, [NativeTypeName("LPWSTR")] ushort *lpCharacter, [NativeTypeName("DWORD")] uint nLength, COORD dwReadCoord, [NativeTypeName("LPDWORD")] uint *lpNumberOfCharsRead);
Example #53
0
 public static extern bool SetEvent(HANDLE hEvent);
Example #54
0
 public static extern BOOL ReadConsoleOutputAttribute(HANDLE hConsoleOutput, [NativeTypeName("LPWORD")] ushort *lpAttribute, [NativeTypeName("DWORD")] uint nLength, COORD dwReadCoord, [NativeTypeName("LPDWORD")] uint *lpNumberOfAttrsRead);
Example #55
0
 public static extern bool TerminateProcess(HANDLE hProcess, uint uExitCode);
Example #56
0
 public static extern BOOL FillConsoleOutputCharacterA(HANDLE hConsoleOutput, [NativeTypeName("CHAR")] sbyte cCharacter, [NativeTypeName("DWORD")] uint nLength, COORD dwWriteCoord, [NativeTypeName("LPDWORD")] uint *lpNumberOfCharsWritten);
Example #57
0
 public static extern HDEVNOTIFY RegisterDeviceNotification(HANDLE hRecipient,
     LPVOID NotificationFilter, DeviceNotification Flags);
Example #58
0
 public static extern BOOL WriteConsoleInputW(HANDLE hConsoleInput, [NativeTypeName("const INPUT_RECORD *")] INPUT_RECORD *lpBuffer, [NativeTypeName("DWORD")] uint nLength, [NativeTypeName("LPDWORD")] uint *lpNumberOfEventsWritten);
Example #59
0
 public static extern int TerminateProcess(HANDLE hProcess,int uExitCode);
 public static extern int AppPolicyGetLifecycleManagement(HANDLE processToken, AppPolicyLifecycleManagement *policy);