836 references to NativeMethods
System (836)
compmod\microsoft\win32\NativeMethods.cs (1)
1164internal static extern SafeFileMappingHandle CreateFileMapping(IntPtr hFile, NativeMethods.SECURITY_ATTRIBUTES lpFileMappingAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string lpName);
compmod\microsoft\win32\safehandles\SafeUserTokenHandle.cs (1)
44internal extern static bool DuplicateTokenEx(SafeHandle hToken, int access, NativeMethods.SECURITY_ATTRIBUTES tokenAttributes, int impersonationLevel, int tokenType, out SafeUserTokenHandle hNewToken);
compmod\microsoft\win32\SafeNativeMethods.cs (5)
54public static extern bool GetTextMetrics(IntPtr hDC, [In, Out] NativeMethods.TEXTMETRIC tm); 185NativeMethods.PDH_RAW_COUNTER pRawValue1, 186NativeMethods.PDH_RAW_COUNTER pRawValue2, 187NativeMethods.PDH_FMT_COUNTERVALUE pFmtValue 223internal static extern SafeWaitHandle CreateSemaphore(NativeMethods.SECURITY_ATTRIBUTES lpSecurityAttributes, int initialCount, int maximumCount, String name);
compmod\microsoft\win32\SessionSwitchReason.cs (9)
22ConsoleConnect = NativeMethods.WTS_CONSOLE_CONNECT, 27ConsoleDisconnect = NativeMethods.WTS_CONSOLE_DISCONNECT, 32RemoteConnect = NativeMethods.WTS_REMOTE_CONNECT, 37RemoteDisconnect = NativeMethods.WTS_REMOTE_DISCONNECT, 42SessionLogon = NativeMethods.WTS_SESSION_LOGON, 47SessionLogoff = NativeMethods.WTS_SESSION_LOGOFF, 52SessionLock = NativeMethods.WTS_SESSION_LOCK, 57SessionUnlock = NativeMethods.WTS_SESSION_UNLOCK, 62SessionRemoteControl = NativeMethods.WTS_SESSION_REMOTE_CONTROL
compmod\microsoft\win32\SystemEvents.cs (164)
53private static volatile NativeMethods.WNDCLASS staticwndclass; 72private NativeMethods.WndProc windowProc; 73private NativeMethods.ConHndlr consoleHandler; 124NativeMethods.USEROBJECTFLAGS flags = new NativeMethods.USEROBJECTFLAGS(); 126if (UnsafeNativeMethods.GetUserObjectInformation(new HandleRef(null, hwinsta), NativeMethods.UOI_FLAGS, flags, Marshal.SizeOf(flags), ref lengthNeeded)) { 127if ((flags.dwFlags & NativeMethods.WSF_VISIBLE) == 0) { 366case NativeMethods.CTRL_LOGOFF_EVENT: 367OnSessionEnded((IntPtr) 1, (IntPtr) NativeMethods.ENDSESSION_LOGOFF); 370case NativeMethods.CTRL_SHUTDOWN_EVENT: 378private NativeMethods.WNDCLASS WndClass { 393NativeMethods.WNDCLASS tempwndclass = new NativeMethods.WNDCLASS(); 394tempwndclass.hbrBackground = (IntPtr)(NativeMethods.COLOR_WINDOW + 1); 397windowProc = new NativeMethods.WndProc(this.WindowProc); 436NativeMethods.WNDCLASS_I wndclassi = new NativeMethods.WNDCLASS_I(); 463} while (atom == 0 && Marshal.GetLastWin32Error() == NativeMethods.ERROR_CLASS_ALREADY_EXISTS); 474NativeMethods.WS_POPUP, 4750, 0, 0, 0, NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, 494NativeMethods.WM_CREATETIMER, (IntPtr)interval, IntPtr.Zero); 519UnsafeNativeMethods.SetWindowLong(href, NativeMethods.GWL_WNDPROC, new HandleRef(this, DefWndProc)); 523UnsafeNativeMethods.SetClassLong(href, NativeMethods.GCL_WNDPROC, DefWndProc); 532UnsafeNativeMethods.PostMessage(href, NativeMethods.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); 608UnsafeNativeMethods.WTSRegisterSessionNotification(new HandleRef(systemEvents, systemEvents.windowHandle), NativeMethods.NOTIFY_FOR_THIS_SESSION); 620if (msg == NativeMethods.WM_SETTINGCHANGE) { 630case NativeMethods.SPI_SETACCESSTIMEOUT: 631case NativeMethods.SPI_SETFILTERKEYS: 632case NativeMethods.SPI_SETHIGHCONTRAST: 633case NativeMethods.SPI_SETMOUSEKEYS: 634case NativeMethods.SPI_SETSCREENREADER: 635case NativeMethods.SPI_SETSERIALKEYS: 636case NativeMethods.SPI_SETSHOWSOUNDS: 637case NativeMethods.SPI_SETSOUNDSENTRY: 638case NativeMethods.SPI_SETSTICKYKEYS: 639case NativeMethods.SPI_SETTOGGLEKEYS: 643case NativeMethods.SPI_SETDESKWALLPAPER: 644case NativeMethods.SPI_SETFONTSMOOTHING: 645case NativeMethods.SPI_SETCURSORS: 646case NativeMethods.SPI_SETDESKPATTERN: 647case NativeMethods.SPI_SETGRIDGRANULARITY: 648case NativeMethods.SPI_SETWORKAREA: 652case NativeMethods.SPI_ICONHORIZONTALSPACING: 653case NativeMethods.SPI_ICONVERTICALSPACING: 654case NativeMethods.SPI_SETICONMETRICS: 655case NativeMethods.SPI_SETICONS: 656case NativeMethods.SPI_SETICONTITLELOGFONT: 657case NativeMethods.SPI_SETICONTITLEWRAP: 661case NativeMethods.SPI_SETDOUBLECLICKTIME: 662case NativeMethods.SPI_SETDOUBLECLKHEIGHT: 663case NativeMethods.SPI_SETDOUBLECLKWIDTH: 664case NativeMethods.SPI_SETMOUSE: 665case NativeMethods.SPI_SETMOUSEBUTTONSWAP: 666case NativeMethods.SPI_SETMOUSEHOVERHEIGHT: 667case NativeMethods.SPI_SETMOUSEHOVERTIME: 668case NativeMethods.SPI_SETMOUSESPEED: 669case NativeMethods.SPI_SETMOUSETRAILS: 670case NativeMethods.SPI_SETSNAPTODEFBUTTON: 671case NativeMethods.SPI_SETWHEELSCROLLLINES: 672case NativeMethods.SPI_SETCURSORSHADOW: 673case NativeMethods.SPI_SETHOTTRACKING: 674case NativeMethods.SPI_SETTOOLTIPANIMATION: 675case NativeMethods.SPI_SETTOOLTIPFADE: 679case NativeMethods.SPI_SETKEYBOARDDELAY: 680case NativeMethods.SPI_SETKEYBOARDPREF: 681case NativeMethods.SPI_SETKEYBOARDSPEED: 682case NativeMethods.SPI_SETLANGTOGGLE: 686case NativeMethods.SPI_SETMENUDROPALIGNMENT: 687case NativeMethods.SPI_SETMENUFADE: 688case NativeMethods.SPI_SETMENUSHOWDELAY: 689case NativeMethods.SPI_SETMENUANIMATION: 690case NativeMethods.SPI_SETSELECTIONFADE: 694case NativeMethods.SPI_SETLOWPOWERACTIVE: 695case NativeMethods.SPI_SETLOWPOWERTIMEOUT: 696case NativeMethods.SPI_SETPOWEROFFACTIVE: 697case NativeMethods.SPI_SETPOWEROFFTIMEOUT: 701case NativeMethods.SPI_SETSCREENSAVEACTIVE: 702case NativeMethods.SPI_SETSCREENSAVERRUNNING: 703case NativeMethods.SPI_SETSCREENSAVETIMEOUT: 707case NativeMethods.SPI_SETKEYBOARDCUES: 708case NativeMethods.SPI_SETCOMBOBOXANIMATION: 709case NativeMethods.SPI_SETLISTBOXSMOOTHSCROLLING: 710case NativeMethods.SPI_SETGRADIENTCAPTIONS: 711case NativeMethods.SPI_SETUIEFFECTS: 712case NativeMethods.SPI_SETACTIVEWINDOWTRACKING: 713case NativeMethods.SPI_SETACTIVEWNDTRKZORDER: 714case NativeMethods.SPI_SETACTIVEWNDTRKTIMEOUT: 715case NativeMethods.SPI_SETANIMATION: 716case NativeMethods.SPI_SETBORDER: 717case NativeMethods.SPI_SETCARETWIDTH: 718case NativeMethods.SPI_SETDRAGFULLWINDOWS: 719case NativeMethods.SPI_SETDRAGHEIGHT: 720case NativeMethods.SPI_SETDRAGWIDTH: 721case NativeMethods.SPI_SETFOREGROUNDFLASHCOUNT: 722case NativeMethods.SPI_SETFOREGROUNDLOCKTIMEOUT: 723case NativeMethods.SPI_SETMINIMIZEDMETRICS: 724case NativeMethods.SPI_SETNONCLIENTMETRICS: 725case NativeMethods.SPI_SETSHOWIMEUI: 731else if (msg == NativeMethods.WM_SYSCOLORCHANGE) { 744consoleHandler = new NativeMethods.ConHndlr(this.ConsoleHandlerProc); 844NativeMethods.WM_KILLTIMER, timerId, IntPtr.Zero); 857IntPtr res = UnsafeNativeMethods.SetTimer(new HandleRef(this, windowHandle), new HandleRef(this, timerId), (int) wParam, NativeMethods.NullHandleRef); 904case NativeMethods.PBT_APMSUSPEND: 905case NativeMethods.PBT_APMSTANDBY: 909case NativeMethods.PBT_APMRESUMECRITICAL: 910case NativeMethods.PBT_APMRESUMESUSPEND: 911case NativeMethods.PBT_APMRESUMESTANDBY: 915case NativeMethods.PBT_APMBATTERYLOW: 916case NativeMethods.PBT_APMPOWERSTATUSCHANGE: 917case NativeMethods.PBT_APMOEMEVENT: 941if (((unchecked ((int)(long) lParam)) & NativeMethods.ENDSESSION_LOGOFF) != 0) { 960if ((((long)lParam) & NativeMethods.ENDSESSION_LOGOFF) != 0) { 1254StringBuilder sb = new StringBuilder(NativeMethods.MAX_PATH); 1255UnsafeNativeMethods.GetModuleFileName(NativeMethods.NullHandleRef, sb, sb.Capacity); 1263executablePath = NativeMethods.GetLocalPath(ecb); 1414UnsafeNativeMethods.PostMessage(new HandleRef(systemEvents, systemEvents.windowHandle), NativeMethods.WM_QUIT, IntPtr.Zero, IntPtr.Zero); 1441case NativeMethods.WM_SETTINGCHANGE: 1450UnsafeNativeMethods.PostMessage(new HandleRef(this, windowHandle), NativeMethods.WM_REFLECT + msg, wParam, newStringPtr); 1452case NativeMethods.WM_WTSSESSION_CHANGE: 1455case NativeMethods.WM_SYSCOLORCHANGE: 1456case NativeMethods.WM_COMPACTING: 1457case NativeMethods.WM_DISPLAYCHANGE: 1458case NativeMethods.WM_FONTCHANGE: 1459case NativeMethods.WM_PALETTECHANGED: 1460case NativeMethods.WM_TIMECHANGE: 1461case NativeMethods.WM_TIMER: 1462case NativeMethods.WM_THEMECHANGED: 1463UnsafeNativeMethods.PostMessage(new HandleRef(this, windowHandle), NativeMethods.WM_REFLECT + msg, wParam, lParam); 1466case NativeMethods.WM_CREATETIMER: 1469case NativeMethods.WM_KILLTIMER: 1472case NativeMethods.WM_REFLECT + NativeMethods.WM_SETTINGCHANGE: 1474OnUserPreferenceChanging(msg - NativeMethods.WM_REFLECT, wParam, lParam); 1475OnUserPreferenceChanged(msg - NativeMethods.WM_REFLECT, wParam, lParam); 1489case NativeMethods.WM_REFLECT + NativeMethods.WM_SYSCOLORCHANGE: 1490OnUserPreferenceChanging(msg - NativeMethods.WM_REFLECT, wParam, lParam); 1491OnUserPreferenceChanged(msg - NativeMethods.WM_REFLECT, wParam, lParam); 1494case NativeMethods.WM_REFLECT + NativeMethods.WM_THEMECHANGED: 1498case NativeMethods.WM_QUERYENDSESSION: 1501case NativeMethods.WM_ENDSESSION: 1505case NativeMethods.WM_POWERBROADCAST: 1510case NativeMethods.WM_REFLECT + NativeMethods.WM_COMPACTING: 1514case NativeMethods.WM_REFLECT + NativeMethods.WM_DISPLAYCHANGE: 1519case NativeMethods.WM_REFLECT + NativeMethods.WM_FONTCHANGE: 1523case NativeMethods.WM_REFLECT + NativeMethods.WM_PALETTECHANGED: 1527case NativeMethods.WM_REFLECT + NativeMethods.WM_TIMECHANGE: 1531case NativeMethods.WM_REFLECT + NativeMethods.WM_TIMER: 1562NativeMethods.MSG msg = new NativeMethods.MSG(); 1571int ret = UnsafeNativeMethods.MsgWaitForMultipleObjectsEx(0, IntPtr.Zero, 100, NativeMethods.QS_ALLINPUT, NativeMethods.MWMO_INPUTAVAILABLE); 1573if (ret == NativeMethods.WAIT_TIMEOUT) { 1577while (UnsafeNativeMethods.PeekMessage(ref msg, NativeMethods.NullHandleRef, 0, 0, NativeMethods.PM_REMOVE)) 1579if (msg.message == NativeMethods.WM_QUIT) {
compmod\microsoft\win32\UnsafeNativeMethods.cs (7)
57public static extern bool GetUserObjectInformation(HandleRef hObj, int nIndex, [MarshalAs(UnmanagedType.LPStruct)] NativeMethods.USEROBJECTFLAGS pvBuffer, int nLength, ref int lpnLengthNeeded); 74public static extern bool GetClassInfo(HandleRef hInst, string lpszClass, [In, Out] NativeMethods.WNDCLASS_I wc); 135public static extern short RegisterClass(NativeMethods.WNDCLASS wc); 148public static extern bool SetConsoleCtrlHandler(NativeMethods.ConHndlr handler, int add); 163public static extern int DispatchMessage([In] ref NativeMethods.MSG msg); 167public static extern bool PeekMessage([In, Out] ref NativeMethods.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove); 178public static extern bool TranslateMessage([In, Out] ref NativeMethods.MSG msg);
compmod\system\codedom\compiler\Executor.cs (19)
174NativeMethods.STARTUPINFO si = new NativeMethods.STARTUPINFO(); 180si.dwFlags = NativeMethods.STARTF_USESTDHANDLES | NativeMethods.STARTF_USESHOWWINDOW; 181si.wShowWindow = NativeMethods.SW_HIDE; 185si.hStdInput = new SafeFileHandle(UnsafeNativeMethods.GetStdHandle(NativeMethods.STD_INPUT_HANDLE), false); 219success = NativeMethods.CreateProcess( 230if ( pi.hProcess!= (IntPtr)0 && pi.hProcess!= (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 232if ( pi.hThread != (IntPtr)0 && pi.hThread != (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 242NativeMethods.TOKEN_ALL_ACCESS, 244NativeMethods.IMPERSONATION_LEVEL_SecurityImpersonation, 245NativeMethods.TOKEN_TYPE_TokenPrimary, 253success = NativeMethods.CreateProcessAsUser( 265if ( pi.hProcess!= (IntPtr)0 && pi.hProcess!= (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 267if ( pi.hThread != (IntPtr)0 && pi.hThread != (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 301throw new ExternalException(SR.GetString(SR.ExecTimeout, cmd), NativeMethods.WAIT_TIMEOUT); 305int status = NativeMethods.STILL_ACTIVE; 306if (!NativeMethods.GetExitCodeProcess(procSH, out status)) { 321if (err == NativeMethods.ERROR_NOT_ENOUGH_MEMORY)
compmod\system\codedom\compiler\TempFiles.cs (5)
227uint HR_ERROR_FILE_EXISTS = unchecked(((uint)0x80070000) | NativeMethods.ERROR_FILE_EXISTS); 364SafeLocalMemHandle.ConvertStringSecurityDescriptorToSecurityDescriptor(sddl, NativeMethods.SDDL_REVISION_1, out acl, IntPtr.Zero); 367NativeMethods.CreateDirectory(directory, acl); 375SafeLocalMemHandle.ConvertStringSecurityDescriptorToSecurityDescriptor(sddl, NativeMethods.SDDL_REVISION_1, out acl, IntPtr.Zero); 377NativeMethods.SetNamedSecurityInfo(directory, acl);
compmod\system\componentmodel\design\CheckoutException.cs (1)
37public readonly static CheckoutException Canceled = new CheckoutException(SR.GetString(SR.CHECKOUTCanceled), NativeMethods.E_ABORT);
compmod\system\diagnostics\assertwrapper.cs (5)
19using NativeMethods = Microsoft.Win32.NativeMethods; 210IntPtr hFont = SafeNativeMethods.GetStockObject(NativeMethods.DEFAULT_GUI_FONT); 212NativeMethods.TEXTMETRIC tm = new NativeMethods.TEXTMETRIC(); 218int cy = UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CYSCREEN);
compmod\System\Runtime\InteropServices\StandardOleMarshalObject.cs (5)
48if (NativeMethods.S_OK == UnsafeNativeMethods.CoGetStandardMarshal(ref riid, pUnk, dwDestContext, IntPtr.Zero, mshlflags, out pStandardMarshal)) 68return NativeMethods.S_OK; 125return NativeMethods.E_NOTIMPL; 135return NativeMethods.E_NOTIMPL; 145return NativeMethods.E_NOTIMPL;
net\System\Net\_WinHttpWebProxyDataBuilder.cs (1)
50if (errorCode == Microsoft.Win32.NativeMethods.ERROR_NOT_ENOUGH_MEMORY)
net\System\Net\UnsafeNativeMethods.cs (1)
655Microsoft.Win32.NativeMethods.SECURITY_ATTRIBUTES pSecurityAttributes, uint flags, out HttpRequestQueueV2Handle pReqQueueHandle);
net\System\Net\WinHttpWebProxyFinder.cs (1)
246if (errorCode == NativeMethods.ERROR_NOT_ENOUGH_MEMORY)
services\io\system\io\FileSystemWatcher.cs (2)
736NativeMethods.NullHandleRef); 979directoryHandle = NativeMethods.CreateFile(directory, // Directory name
services\monitoring\system\diagnosticts\CounterSampleCalculator.cs (58)
68if ((newCounterType != NativeMethods.PERF_RAW_FRACTION) && 69(newCounterType != NativeMethods.PERF_COUNTER_RAWCOUNT) && 70(newCounterType != NativeMethods.PERF_COUNTER_RAWCOUNT_HEX) && 71(newCounterType != NativeMethods.PERF_COUNTER_LARGE_RAWCOUNT) && 72(newCounterType != NativeMethods.PERF_COUNTER_LARGE_RAWCOUNT_HEX) && 73(newCounterType != NativeMethods.PERF_COUNTER_MULTI_BASE)) { 84if (newCounterType == NativeMethods.PERF_ELAPSED_TIME) 87NativeMethods.PDH_RAW_COUNTER newPdhValue = new NativeMethods.PDH_RAW_COUNTER(); 88NativeMethods.PDH_RAW_COUNTER oldPdhValue = new NativeMethods.PDH_RAW_COUNTER(); 94NativeMethods.PDH_FMT_COUNTERVALUE pdhFormattedValue= new NativeMethods.PDH_FMT_COUNTERVALUE(); 96int result = SafeNativeMethods.FormatFromRawValue((uint) newCounterType, NativeMethods.PDH_FMT_DOUBLE | NativeMethods.PDH_FMT_NOSCALE | NativeMethods.PDH_FMT_NOCAP100, 99if (result != NativeMethods.ERROR_SUCCESS) { 101if (result == NativeMethods.PDH_CALC_NEGATIVE_VALUE || result == NativeMethods.PDH_CALC_NEGATIVE_DENOMINATOR || result == NativeMethods.PDH_NO_DATA) 114private static void FillInValues(CounterSample oldSample, CounterSample newSample, NativeMethods.PDH_RAW_COUNTER oldPdhValue, NativeMethods.PDH_RAW_COUNTER newPdhValue) { 118case NativeMethods.PERF_COUNTER_COUNTER: 119case NativeMethods.PERF_COUNTER_QUEUELEN_TYPE: 120case NativeMethods.PERF_SAMPLE_COUNTER: 121case NativeMethods.PERF_OBJ_TIME_TIMER: 122case NativeMethods.PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE: 130case NativeMethods.PERF_COUNTER_100NS_QUEUELEN_TYPE: 138case NativeMethods.PERF_COUNTER_TIMER: 139case NativeMethods.PERF_COUNTER_TIMER_INV: 140case NativeMethods.PERF_COUNTER_BULK_COUNT: 141case NativeMethods.PERF_COUNTER_LARGE_QUEUELEN_TYPE: 142case NativeMethods.PERF_COUNTER_MULTI_TIMER: 143case NativeMethods.PERF_COUNTER_MULTI_TIMER_INV: 149if (newCounterType == NativeMethods.PERF_COUNTER_MULTI_TIMER || newCounterType == NativeMethods.PERF_COUNTER_MULTI_TIMER_INV) { 158if ((newCounterType & NativeMethods.PERF_MULTI_COUNTER) == NativeMethods.PERF_MULTI_COUNTER) { 168case NativeMethods.PERF_COUNTER_RAWCOUNT: 169case NativeMethods.PERF_COUNTER_RAWCOUNT_HEX: 170case NativeMethods.PERF_COUNTER_DELTA: 171case NativeMethods.PERF_COUNTER_LARGE_RAWCOUNT: 172case NativeMethods.PERF_COUNTER_LARGE_RAWCOUNT_HEX: 173case NativeMethods.PERF_COUNTER_LARGE_DELTA: 183case NativeMethods.PERF_100NSEC_TIMER: 184case NativeMethods.PERF_100NSEC_TIMER_INV: 185case NativeMethods.PERF_100NSEC_MULTI_TIMER: 186case NativeMethods.PERF_100NSEC_MULTI_TIMER_INV: 192if ((newCounterType & NativeMethods.PERF_MULTI_COUNTER) == NativeMethods.PERF_MULTI_COUNTER) { 200case NativeMethods.PERF_SAMPLE_FRACTION: 201case NativeMethods.PERF_RAW_FRACTION: 202case NativeMethods.PERF_LARGE_RAW_FRACTION: 203case NativeMethods.PERF_PRECISION_SYSTEM_TIMER: 204case NativeMethods.PERF_PRECISION_100NS_TIMER: 205case NativeMethods.PERF_PRECISION_OBJECT_TIMER: 206case NativeMethods.PERF_AVERAGE_TIMER: 207case NativeMethods.PERF_AVERAGE_BULK:
services\monitoring\system\diagnosticts\EventLog.cs (9)
1042NativeMethods.RTL_OSVERSIONINFOEX osv = new NativeMethods.RTL_OSVERSIONINFOEX(); 1044int ret = NativeMethods.RtlGetVersion(out osv); 1286int flags = NativeMethods.FORMAT_MESSAGE_FROM_HMODULE | NativeMethods.FORMAT_MESSAGE_ARGUMENT_ARRAY; 1296flags |= NativeMethods.FORMAT_MESSAGE_IGNORE_INSERTS; 1304int lastError = NativeMethods.ERROR_INSUFFICIENT_BUFFER; 1305while (msgLen == 0 && lastError == NativeMethods.ERROR_INSUFFICIENT_BUFFER) { 1317if (lastError == NativeMethods.ERROR_INSUFFICIENT_BUFFER)
services\monitoring\system\diagnosticts\EventLogInternal.cs (20)
632bool success = UnsafeNativeMethods.ClearEventLog(readHandle, NativeMethods.NullHandleRef); 637if (error != NativeMethods.ERROR_FILE_NOT_FOUND) 845hModule = SafeLibraryHandle.LoadLibraryEx(dllName, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_AS_DATAFILE); 850hModule = SafeLibraryHandle.LoadLibraryEx(dllName, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_AS_DATAFILE); 896bool success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, 907if (error == NativeMethods.ERROR_INSUFFICIENT_BUFFER || error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) { 909if (error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) { 920success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, 1078flags = NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ; 1082flags = NativeMethods.BACKWARDS_READ | NativeMethods.SEEK_READ; 1099if (error == NativeMethods.ERROR_INSUFFICIENT_BUFFER || error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) { 1100if (error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) { 1113success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, index,
services\monitoring\system\diagnosticts\FileVersionInfo.cs (12)
156return (fileFlags & NativeMethods.VS_FF_DEBUG) != 0; 166return (fileFlags & NativeMethods.VS_FF_PATCHED) != 0; 175return (fileFlags & NativeMethods.VS_FF_PRIVATEBUILD) != 0; 185return (fileFlags & NativeMethods.VS_FF_PRERELEASE) != 0; 194return (fileFlags & NativeMethods.VS_FF_SPECIALBUILD) != 0; 326private static NativeMethods.VS_FIXEDFILEINFO GetFixedFileInfo(IntPtr memPtr) { 331NativeMethods.VS_FIXEDFILEINFO fixedFileInfo = new NativeMethods.VS_FIXEDFILEINFO(); 336return new NativeMethods.VS_FIXEDFILEINFO(); 399NativeMethods.VS_FIXEDFILEINFO ffi = GetFixedFileInfo(memIntPtr); 495return NativeMethods.Util.HIWORD(dword); 499return NativeMethods.Util.LOWORD(dword);
services\monitoring\system\diagnosticts\PerformanceCounterCategory.cs (16)
324if ( (currentSampleType == NativeMethods.PERF_AVERAGE_BULK) || 325(currentSampleType == NativeMethods.PERF_100NSEC_MULTI_TIMER) || 326(currentSampleType == NativeMethods.PERF_100NSEC_MULTI_TIMER_INV) || 327(currentSampleType == NativeMethods.PERF_COUNTER_MULTI_TIMER) || 328(currentSampleType == NativeMethods.PERF_COUNTER_MULTI_TIMER_INV) || 329(currentSampleType == NativeMethods.PERF_RAW_FRACTION) || 330(currentSampleType == NativeMethods.PERF_SAMPLE_FRACTION) || 331(currentSampleType == NativeMethods.PERF_AVERAGE_TIMER)) { 350(currentSampleType != NativeMethods.PERF_AVERAGE_BULK) && 351(currentSampleType != NativeMethods.PERF_100NSEC_MULTI_TIMER) && 352(currentSampleType != NativeMethods.PERF_100NSEC_MULTI_TIMER_INV) && 353(currentSampleType != NativeMethods.PERF_COUNTER_MULTI_TIMER) && 354(currentSampleType != NativeMethods.PERF_COUNTER_MULTI_TIMER_INV) && 355(currentSampleType != NativeMethods.PERF_RAW_FRACTION) && 356(currentSampleType != NativeMethods.PERF_SAMPLE_FRACTION) && 357(currentSampleType != NativeMethods.PERF_AVERAGE_TIMER))
services\monitoring\system\diagnosticts\PerformanceCounterLib.cs (40)
103NativeMethods.PERF_DATA_BLOCK dataBlock = new NativeMethods.PERF_DATA_BLOCK(); 115NativeMethods.PERF_OBJECT_TYPE perfObject = new NativeMethods.PERF_OBJECT_TYPE(); 128NativeMethods.PERF_COUNTER_DEFINITION perfCounter = new NativeMethods.PERF_COUNTER_DEFINITION(); 1065return (type == NativeMethods.PERF_AVERAGE_BASE || 1066type == NativeMethods.PERF_COUNTER_MULTI_BASE || 1067type == NativeMethods.PERF_RAW_BASE || 1068type == NativeMethods.PERF_LARGE_RAW_BASE || 1069type == NativeMethods.PERF_SAMPLE_BASE); 1158if (res == NativeMethods.ERROR_ACCESS_DENIED) { 1200throw new Win32Exception(NativeMethods.ERROR_ACCESS_DENIED); 1240case NativeMethods.RPC_S_CALL_FAILED: 1241case NativeMethods.ERROR_INVALID_HANDLE: 1242case NativeMethods.RPC_S_SERVER_UNAVAILABLE: 1244goto case NativeMethods.WAIT_TIMEOUT; 1246case NativeMethods.WAIT_TIMEOUT: 1247case NativeMethods.ERROR_NOT_READY: 1248case NativeMethods.ERROR_LOCK_FAILED: 1249case NativeMethods.ERROR_BUSY: 1280internal CategoryEntry(NativeMethods.PERF_OBJECT_TYPE perfObject) { 1304NativeMethods.PERF_DATA_BLOCK dataBlock = new NativeMethods.PERF_DATA_BLOCK(); 1322NativeMethods.PERF_OBJECT_TYPE perfObject = null; 1325perfObject = new NativeMethods.PERF_OBJECT_TYPE(); 1355NativeMethods.PERF_COUNTER_DEFINITION perfCounter = new NativeMethods.PERF_COUNTER_DEFINITION(); 1363if (currentSampleType != NativeMethods.PERF_COUNTER_NODATA) 1387NativeMethods.PERF_INSTANCE_DEFINITION perfInstance = new NativeMethods.PERF_INSTANCE_DEFINITION(); 1429NativeMethods.PERF_DATA_BLOCK dataBlock = new NativeMethods.PERF_DATA_BLOCK(); 1434NativeMethods.PERF_OBJECT_TYPE perfObject = null; 1437perfObject = new NativeMethods.PERF_OBJECT_TYPE(); 1460NativeMethods.PERF_COUNTER_DEFINITION perfCounter = new NativeMethods.PERF_COUNTER_DEFINITION(); 1467NativeMethods.PERF_INSTANCE_DEFINITION perfInstance = new NativeMethods.PERF_INSTANCE_DEFINITION(); 1535internal CounterDefinitionSample(NativeMethods.PERF_COUNTER_DEFINITION perfCounter, CategorySample categorySample, int instanceNumber) {
services\monitoring\system\diagnosticts\PerformanceCounterType.cs (28)
18NumberOfItems32 = NativeMethods.PERF_COUNTER_RAWCOUNT, 19NumberOfItems64 = NativeMethods.PERF_COUNTER_LARGE_RAWCOUNT, 20NumberOfItemsHEX32 = NativeMethods.PERF_COUNTER_RAWCOUNT_HEX, 21NumberOfItemsHEX64 = NativeMethods.PERF_COUNTER_LARGE_RAWCOUNT_HEX, 22RateOfCountsPerSecond32 = NativeMethods.PERF_COUNTER_COUNTER, 23RateOfCountsPerSecond64 = NativeMethods.PERF_COUNTER_BULK_COUNT, 24CountPerTimeInterval32 = NativeMethods.PERF_COUNTER_QUEUELEN_TYPE, 25CountPerTimeInterval64 = NativeMethods.PERF_COUNTER_LARGE_QUEUELEN_TYPE, 26RawFraction = NativeMethods.PERF_RAW_FRACTION, 27RawBase = NativeMethods.PERF_RAW_BASE, 29AverageTimer32 = NativeMethods.PERF_AVERAGE_TIMER, 30AverageBase = NativeMethods.PERF_AVERAGE_BASE, 31AverageCount64 = NativeMethods.PERF_AVERAGE_BULK, 33SampleFraction = NativeMethods.PERF_SAMPLE_FRACTION, 34SampleCounter = NativeMethods.PERF_SAMPLE_COUNTER, 35SampleBase = NativeMethods.PERF_SAMPLE_BASE, 37CounterTimer = NativeMethods.PERF_COUNTER_TIMER, 38CounterTimerInverse = NativeMethods.PERF_COUNTER_TIMER_INV, 39Timer100Ns = NativeMethods.PERF_100NSEC_TIMER, 40Timer100NsInverse = NativeMethods.PERF_100NSEC_TIMER_INV, 41ElapsedTime = NativeMethods.PERF_ELAPSED_TIME, 42CounterMultiTimer = NativeMethods.PERF_COUNTER_MULTI_TIMER, 43CounterMultiTimerInverse= NativeMethods.PERF_COUNTER_MULTI_TIMER_INV, 44CounterMultiTimer100Ns = NativeMethods.PERF_100NSEC_MULTI_TIMER, 45CounterMultiTimer100NsInverse = NativeMethods.PERF_100NSEC_MULTI_TIMER_INV, 46CounterMultiBase = NativeMethods.PERF_COUNTER_MULTI_BASE, 48CounterDelta32 = NativeMethods.PERF_COUNTER_DELTA, 49CounterDelta64 = NativeMethods.PERF_COUNTER_LARGE_DELTA
services\monitoring\system\diagnosticts\Process.cs (128)
154this.m_processAccess = NativeMethods.PROCESS_ALL_ACCESS; 167this.m_processAccess = NativeMethods.PROCESS_ALL_ACCESS; 229handle = GetProcessHandle(NativeMethods.PROCESS_QUERY_INFORMATION | NativeMethods.SYNCHRONIZE, false); 243if (NativeMethods.GetExitCodeProcess(handle, out exitCode) && exitCode != NativeMethods.STILL_ACTIVE) { 270if (!NativeMethods.GetExitCodeProcess(handle, out exitCode)) 296int access = NativeMethods.PROCESS_QUERY_INFORMATION; 299access = NativeMethods.PROCESS_QUERY_LIMITED_INFORMATION; 309if (!NativeMethods.GetProcessTimes(handle, 457int length = NativeMethods.GetWindowTextLength(new HandleRef(this, handle)) * 2; 459NativeMethods.GetWindowText(new HandleRef(this, handle), builder, builder.Capacity); 730handle = GetProcessHandle(NativeMethods.PROCESS_QUERY_INFORMATION); 732if (!NativeMethods.GetProcessPriorityBoost(handle, out disabled)) { 748handle = GetProcessHandle(NativeMethods.PROCESS_SET_INFORMATION); 749if (!NativeMethods.SetProcessPriorityBoost(handle, !value)) 772handle = GetProcessHandle(NativeMethods.PROCESS_QUERY_INFORMATION); 773int value = NativeMethods.GetPriorityClass(handle); 802handle = GetProcessHandle(NativeMethods.PROCESS_SET_INFORMATION); 803if (!NativeMethods.SetPriorityClass(handle, (int)value)) { 903handle = GetProcessHandle(NativeMethods.PROCESS_QUERY_INFORMATION); 906if (!NativeMethods.GetProcessAffinityMask(handle, out processAffinity, out systemAffinity)) 922handle = GetProcessHandle(NativeMethods.PROCESS_SET_INFORMATION); 923if (!NativeMethods.SetProcessAffinityMask(handle, value)) 953responding = NativeMethods.SendMessageTimeout(new HandleRef(this, mainWindow), NativeMethods.WM_NULL, IntPtr.Zero, IntPtr.Zero, NativeMethods.SMTO_ABORTIFHUNG, 5000, out result) != (IntPtr)0; 1242int style = NativeMethods.GetWindowLong(new HandleRef(this, mainWindowHandle), NativeMethods.GWL_STYLE); 1243if ((style & NativeMethods.WS_DISABLED) != 0) return false; 1244NativeMethods.PostMessage(new HandleRef(this, mainWindowHandle), NativeMethods.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); 1435handle = GetProcessHandle(NativeMethods.PROCESS_QUERY_INFORMATION); 1438if (!NativeMethods.GetProcessWorkingSetSize(handle, out min, out max)) { 1453SetPrivilege("SeDebugPrivilege", NativeMethods.SE_PRIVILEGE_ENABLED); 1461NativeMethods.LUID debugValue = new NativeMethods.LUID(); 1464IntPtr processHandle = NativeMethods.GetCurrentProcess(); 1468if (!NativeMethods.OpenProcessToken(new HandleRef(null, processHandle), NativeMethods.TOKEN_ADJUST_PRIVILEGES, out hToken)) { 1473if (!NativeMethods.LookupPrivilegeValue(null, privilegeName, out debugValue)) { 1477NativeMethods.TokenPrivileges tkp = new NativeMethods.TokenPrivileges(); 1481NativeMethods.AdjustTokenPrivileges(new HandleRef(null, hToken), false, tkp, 0, IntPtr.Zero, IntPtr.Zero); 1485if (Marshal.GetLastWin32Error() != NativeMethods.ERROR_SUCCESS) { 1625return new Process(".", false, NativeMethods.GetCurrentProcessId(), null); 1701if (throwIfExited && (access & NativeMethods.PROCESS_QUERY_INFORMATION) != 0) { 1702if (NativeMethods.GetExitCodeProcess(handle, out exitCode) && exitCode != NativeMethods.STILL_ACTIVE) { 1726return OpenProcessHandle(NativeMethods.PROCESS_ALL_ACCESS); 1817handle = GetProcessHandle(NativeMethods.PROCESS_QUERY_INFORMATION | NativeMethods.PROCESS_SET_QUOTA); 1820if (!NativeMethods.GetProcessWorkingSetSize(handle, out min, out max)) { 1841if (!NativeMethods.SetProcessWorkingSetSize(handle, min, max)) { 1846if (!NativeMethods.GetProcessWorkingSetSize(handle, out min, out max)) { 1891private static void CreatePipeWithSecurityAttributes(out SafeFileHandle hReadPipe, out SafeFileHandle hWritePipe, NativeMethods.SECURITY_ATTRIBUTES lpPipeAttributes, int nSize) { 1892bool ret = NativeMethods.CreatePipe(out hReadPipe, out hWritePipe, lpPipeAttributes, nSize); 1908NativeMethods.SECURITY_ATTRIBUTES securityAttributesParent = new NativeMethods.SECURITY_ATTRIBUTES(); 1927if (!NativeMethods.DuplicateHandle(new HandleRef(this, NativeMethods.GetCurrentProcess()), 1929new HandleRef(this, NativeMethods.GetCurrentProcess()), 1933NativeMethods.DUPLICATE_SAME_ACCESS)) { 1995NativeMethods.STARTUPINFO startupInfo = new NativeMethods.STARTUPINFO(); 2013startupInfo.hStdInput = new SafeFileHandle(NativeMethods.GetStdHandle(NativeMethods.STD_INPUT_HANDLE), false); 2019startupInfo.hStdOutput = new SafeFileHandle(NativeMethods.GetStdHandle(NativeMethods.STD_OUTPUT_HANDLE), false); 2025startupInfo.hStdError = new SafeFileHandle(NativeMethods.GetStdHandle(NativeMethods.STD_ERROR_HANDLE), false); 2028startupInfo.dwFlags = NativeMethods.STARTF_USESTDHANDLES; 2034if (startInfo.CreateNoWindow) creationFlags |= NativeMethods.CREATE_NO_WINDOW; 2043creationFlags |= NativeMethods.CREATE_UNICODE_ENVIRONMENT; 2062NativeMethods.LogonFlags logonFlags = (NativeMethods.LogonFlags)0; 2064logonFlags = NativeMethods.LogonFlags.LOGON_WITH_PROFILE; 2079retVal = NativeMethods.CreateProcessWithLogonW( 2094if ( processInfo.hProcess!= (IntPtr)0 && processInfo.hProcess!= (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 2096if ( processInfo.hThread != (IntPtr)0 && processInfo.hThread != (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 2100if (errorCode == NativeMethods.ERROR_BAD_EXE_FORMAT || errorCode == NativeMethods.ERROR_EXE_MACHINE_TYPE_MISMATCH) { 2115retVal = NativeMethods.CreateProcess ( 2129if ( processInfo.hProcess!= (IntPtr)0 && processInfo.hProcess!= (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 2131if ( processInfo.hThread != (IntPtr)0 && processInfo.hThread != (IntPtr)NativeMethods.INVALID_HANDLE_VALUE) 2135if (errorCode == NativeMethods.ERROR_BAD_EXE_FORMAT || errorCode == NativeMethods.ERROR_EXE_MACHINE_TYPE_MISMATCH) { 2208NativeMethods.ShellExecuteInfo shellExecuteInfo = new NativeMethods.ShellExecuteInfo(); 2209shellExecuteInfo.fMask = NativeMethods.SEE_MASK_NOCLOSEPROCESS; 2214shellExecuteInfo.fMask |= NativeMethods.SEE_MASK_FLAG_NO_UI; 2219shellExecuteInfo.nShow = NativeMethods.SW_HIDE; 2222shellExecuteInfo.nShow = NativeMethods.SW_SHOWMINIMIZED; 2225shellExecuteInfo.nShow = NativeMethods.SW_SHOWMAXIMIZED; 2228shellExecuteInfo.nShow = NativeMethods.SW_SHOWNORMAL; 2243shellExecuteInfo.fMask |= NativeMethods.SEE_MASK_FLAG_DDEWAIT; 2250case NativeMethods.SE_ERR_FNF: error = NativeMethods.ERROR_FILE_NOT_FOUND; break; 2251case NativeMethods.SE_ERR_PNF: error = NativeMethods.ERROR_PATH_NOT_FOUND; break; 2252case NativeMethods.SE_ERR_ACCESSDENIED: error = NativeMethods.ERROR_ACCESS_DENIED; break; 2253case NativeMethods.SE_ERR_OOM: error = NativeMethods.ERROR_NOT_ENOUGH_MEMORY; break; 2254case NativeMethods.SE_ERR_DDEFAIL: 2255case NativeMethods.SE_ERR_DDEBUSY: 2256case NativeMethods.SE_ERR_DDETIMEOUT: error = NativeMethods.ERROR_DDE_FAIL; break; 2257case NativeMethods.SE_ERR_SHARE: error = NativeMethods.ERROR_SHARING_VIOLATION; break; 2258case NativeMethods.SE_ERR_NOASSOC: error = NativeMethods.ERROR_NO_ASSOCIATION; break; 2259case NativeMethods.SE_ERR_DLLNOTFOUND: error = NativeMethods.ERROR_DLL_NOT_FOUND; break; 2263if( error == NativeMethods.ERROR_BAD_EXE_FORMAT || error == NativeMethods.ERROR_EXE_MACHINE_TYPE_MISMATCH) { 2369handle = GetProcessHandle(NativeMethods.PROCESS_TERMINATE); 2370if (!NativeMethods.TerminateProcess(handle, -1)) 2431handle = GetProcessHandle(NativeMethods.SYNCHRONIZE, false); 2497handle = GetProcessHandle(NativeMethods.SYNCHRONIZE | NativeMethods.PROCESS_QUERY_INFORMATION); 2498int ret = NativeMethods.WaitForInputIdle(handle, milliseconds); 2500case NativeMethods.WAIT_OBJECT_0: 2503case NativeMethods.WAIT_TIMEOUT: 2506case NativeMethods.WAIT_FAILED: 2834private NativeMethods.ShellExecuteInfo _executeInfo; 2838public ShellExecuteHelper(NativeMethods.ShellExecuteInfo executeInfo) { 2845if (!(_succeeded = NativeMethods.ShellExecuteEx(_executeInfo))) {
services\monitoring\system\diagnosticts\ProcessManager.cs (84)
38NativeMethods.EnumThreadWindowsCallback callback = new NativeMethods.EnumThreadWindowsCallback(this.EnumWindowsCallback); 39NativeMethods.EnumWindows(callback, IntPtr.Zero); 49if (NativeMethods.GetWindow(new HandleRef(this, handle), NativeMethods.GW_OWNER) != (IntPtr)0 || !NativeMethods.IsWindowVisible(new HandleRef(this, handle))) 70NativeMethods.GetWindowThreadProcessId(new HandleRef(this, handle), out processId); 100NativeMethods.LUID luid = new NativeMethods.LUID(); 101if (!NativeMethods.LookupPrivilegeValue(null, "SeDebugPrivilege", out luid)) { 107if( !NativeMethods.OpenProcessToken( 108new HandleRef(null, NativeMethods.GetCurrentProcess()), 114NativeMethods.TokenPrivileges tp = new NativeMethods.TokenPrivileges(); 117tp.Attributes = NativeMethods.SE_PRIVILEGE_ENABLED; 120NativeMethods.AdjustTokenPrivileges(new HandleRef(null,tokenHandle), false, tp, 0, IntPtr.Zero, IntPtr.Zero); 264SafeProcessHandle processHandle = NativeMethods.OpenProcess(access, false, processId); 290SafeThreadHandle threadHandle = NativeMethods.OpenThread(access, false, threadId); 293if (result == NativeMethods.ERROR_INVALID_PARAMETER) 356handle = NativeMethods.CreateToolhelp32Snapshot(NativeMethods.TH32CS_SNAPPROCESS | NativeMethods.TH32CS_SNAPTHREAD, 0); 358int entrySize = (int)Marshal.SizeOf(typeof(NativeMethods.WinProcessEntry)); 359int bufferSize = entrySize + NativeMethods.WinProcessEntry.sizeofFileName; 367if (NativeMethods.Process32First(handleRef, bufferPtr)) { 369NativeMethods.WinProcessEntry process = new NativeMethods.WinProcessEntry(); 381while (NativeMethods.Process32Next(handleRef, bufferPtr)); 384NativeMethods.WinThreadEntry thread = new NativeMethods.WinThreadEntry(); 386if (NativeMethods.Thread32First(handleRef, thread)) { 395while (NativeMethods.Thread32Next(handleRef, thread)); 426handle = NativeMethods.CreateToolhelp32Snapshot(NativeMethods.TH32CS_SNAPMODULE, processId); 428int entrySize = Marshal.SizeOf(typeof(NativeMethods.WinModuleEntry)); 429int bufferSize = entrySize + NativeMethods.WinModuleEntry.sizeofFileName + NativeMethods.WinModuleEntry.sizeofModuleName; 437if (NativeMethods.Module32First(handleRef, bufferPtr)) { 439NativeMethods.WinModuleEntry module = new NativeMethods.WinModuleEntry(); 443moduleInfo.fileName = Marshal.PtrToStringAnsi((IntPtr)((long)bufferPtr + entrySize + NativeMethods.WinModuleEntry.sizeofModuleName)); 450while (NativeMethods.Module32Next(handleRef, bufferPtr)); 535if (!NativeMethods.EnumProcesses(processIds, processIds.Length * 4, out size)) 579processHandle = ProcessManager.OpenProcess(processId, NativeMethods.PROCESS_QUERY_INFORMATION | NativeMethods.PROCESS_VM_READ, true); 588enumResult = NativeMethods.EnumProcessModules(processHandle, moduleHandlesArrayHandle.AddrOfPinnedObject(), moduleHandles.Length * IntPtr.Size, ref moduleCount); 613hCurProcess = ProcessManager.OpenProcess(NativeMethods.GetCurrentProcessId(), NativeMethods.PROCESS_QUERY_INFORMATION, true); 628throw new Win32Exception(NativeMethods.ERROR_PARTIAL_COPY, SR.GetString(SR.EnumProcessModuleFailedDueToWow)); 640enumResult = NativeMethods.EnumProcessModules(processHandle, moduleHandlesArrayHandle.AddrOfPinnedObject(), moduleHandles.Length * IntPtr.Size, ref moduleCount); 668NativeMethods.NtModuleInfo ntModuleInfo = new NativeMethods.NtModuleInfo(); 669if (!NativeMethods.GetModuleInformation(processHandle, new HandleRef(null, moduleHandle), ntModuleInfo, Marshal.SizeOf(ntModuleInfo))) 676ret = NativeMethods.GetModuleBaseName(processHandle, new HandleRef(null, moduleHandle), baseName, baseName.Capacity * 2); 681ret = NativeMethods.GetModuleFileNameEx(processHandle, new HandleRef(null, moduleHandle), fileName, fileName.Capacity * 2); 702if (e.NativeErrorCode == NativeMethods.ERROR_INVALID_HANDLE || e.NativeErrorCode == NativeMethods.ERROR_PARTIAL_COPY) 736NativeMethods.NtProcessBasicInfo info = new NativeMethods.NtProcessBasicInfo(); 737int status = NativeMethods.NtQueryInformationProcess(processHandle, NativeMethods.NtQueryProcessBasicInfo, info, (int)Marshal.SizeOf(info), null); 799NativeMethods.PERF_DATA_BLOCK dataBlock = new NativeMethods.PERF_DATA_BLOCK(); 802NativeMethods.PERF_INSTANCE_DEFINITION instance = new NativeMethods.PERF_INSTANCE_DEFINITION(); 803NativeMethods.PERF_COUNTER_BLOCK counterBlock = new NativeMethods.PERF_COUNTER_BLOCK(); 805NativeMethods.PERF_OBJECT_TYPE type = new NativeMethods.PERF_OBJECT_TYPE(); 812NativeMethods.PERF_COUNTER_DEFINITION counter = new NativeMethods.PERF_COUNTER_DEFINITION(); 823NativeMethods.PERF_COUNTER_DEFINITION[] counters = new NativeMethods.PERF_COUNTER_DEFINITION[counterList.Count]; 889static ThreadInfo GetThreadInfo(NativeMethods.PERF_OBJECT_TYPE type, IntPtr instancePtr, NativeMethods.PERF_COUNTER_DEFINITION[] counters) { 892NativeMethods.PERF_COUNTER_DEFINITION counter = counters[i]; 948static ProcessInfo GetProcessInfo(NativeMethods.PERF_OBJECT_TYPE type, IntPtr instancePtr, NativeMethods.PERF_COUNTER_DEFINITION[] counters) { 951NativeMethods.PERF_COUNTER_DEFINITION counter = counters[i]; 1005if ((counterType & NativeMethods.NtPerfCounterSizeLarge) != 0) 1092status = NativeMethods.NtQuerySystemInformation( 1093NativeMethods.NtQuerySystemProcessInformation, 1098if ((uint)status == NativeMethods.STATUS_INFO_LENGTH_MISMATCH) 1104} while ((uint)status == NativeMethods.STATUS_INFO_LENGTH_MISMATCH);
services\monitoring\system\diagnosticts\ProcessThread.cs (15)
118threadHandle = OpenThreadHandle(NativeMethods.THREAD_SET_INFORMATION); 119if (NativeMethods.SetThreadIdealProcessor(threadHandle, value) < 0) { 139threadHandle = OpenThreadHandle(NativeMethods.THREAD_QUERY_INFORMATION); 141if (!NativeMethods.GetThreadPriorityBoost(threadHandle, out disabled)) { 156threadHandle = OpenThreadHandle(NativeMethods.THREAD_SET_INFORMATION); 157if (!NativeMethods.SetThreadPriorityBoost(threadHandle, !value)) 179threadHandle = OpenThreadHandle(NativeMethods.THREAD_QUERY_INFORMATION); 180int value = NativeMethods.GetThreadPriority(threadHandle); 198threadHandle = OpenThreadHandle(NativeMethods.THREAD_SET_INFORMATION); 199if (!NativeMethods.SetThreadPriority(threadHandle, (int)value)) { 359threadHandle = OpenThreadHandle(NativeMethods.THREAD_SET_INFORMATION | NativeMethods.THREAD_QUERY_INFORMATION); 360if (NativeMethods.SetThreadAffinityMask(threadHandle, new HandleRef(this, value)) == IntPtr.Zero) { 375threadHandle = OpenThreadHandle(NativeMethods.THREAD_QUERY_INFORMATION); 377if (!NativeMethods.GetThreadTimes(threadHandle,
services\monitoring\system\diagnosticts\processwaithandle.cs (4)
15bool succeeded = NativeMethods.DuplicateHandle( 16new HandleRef(this, NativeMethods.GetCurrentProcess()), 18new HandleRef(this, NativeMethods.GetCurrentProcess()), 22NativeMethods.DUPLICATE_SAME_ACCESS);
services\monitoring\system\diagnosticts\SharedPerformanceCounter.cs (21)
51int pid = NativeMethods.GetCurrentProcessId(); 60using (SafeProcessHandle procHandle = SafeProcessHandle.OpenProcess(NativeMethods.PROCESS_QUERY_INFORMATION, false, pid)) { 63NativeMethods.GetProcessTimes(procHandle, out startTime, out temp, out temp, out temp); 1212using (SafeProcessHandle procHandle = SafeProcessHandle.OpenProcess(NativeMethods.PROCESS_QUERY_INFORMATION, false, pid)) { 1214if ((error == NativeMethods.ERROR_INVALID_PARAMETER) && procHandle.IsInvalid) { 1227if (NativeMethods.GetProcessTimes(procHandle, out processStartTime, out temp, out temp, out temp)) { 1239using (SafeProcessHandle procHandle = SafeProcessHandle.OpenProcess(NativeMethods.SYNCHRONIZE, false, pid)) { 1563if (!SafeLocalMemHandle.ConvertStringSecurityDescriptorToSecurityDescriptor(sddlString, NativeMethods.SDDL_REVISION_1, 1567NativeMethods.SECURITY_ATTRIBUTES securityAttributes = new NativeMethods.SECURITY_ATTRIBUTES(); 1587fileMappingHandle = NativeMethods.CreateFileMapping((IntPtr)(-1), securityAttributes, 1588NativeMethods.PAGE_READWRITE, 0, fileMappingSize, mappingName); 1590if ((Marshal.GetLastWin32Error() != NativeMethods.ERROR_ACCESS_DENIED) || !fileMappingHandle.IsInvalid) { 1596fileMappingHandle = NativeMethods.OpenFileMapping(NativeMethods.FILE_MAP_WRITE, false, mappingName); 1598if ((Marshal.GetLastWin32Error() != NativeMethods.ERROR_FILE_NOT_FOUND) || !fileMappingHandle.IsInvalid) { 1617fileViewAddress = SafeFileMapViewHandle.MapViewOfFile(fileMappingHandle, NativeMethods.FILE_MAP_WRITE, 0,0, UIntPtr.Zero); 1622NativeMethods.MEMORY_BASIC_INFORMATION meminfo = new NativeMethods.MEMORY_BASIC_INFORMATION(); 1623if (NativeMethods.VirtualQuery(fileViewAddress, ref meminfo, (IntPtr) sizeof(NativeMethods.MEMORY_BASIC_INFORMATION)) == IntPtr.Zero)
services\monitoring\system\diagnosticts\SharedUtils.cs (3)
179case NativeMethods.WAIT_OBJECT_0: 180case NativeMethods.WAIT_ABANDONED: 186case NativeMethods.WAIT_TIMEOUT:
sys\system\io\ports\InternalResources.cs (8)
38int result = SafeNativeMethods.FormatMessage(NativeMethods.FORMAT_MESSAGE_IGNORE_INSERTS | 39NativeMethods.FORMAT_MESSAGE_FROM_SYSTEM | NativeMethods.FORMAT_MESSAGE_ARGUMENT_ARRAY, 106case NativeMethods.ERROR_FILE_NOT_FOUND: 107case NativeMethods.ERROR_PATH_NOT_FOUND: 113case NativeMethods.ERROR_ACCESS_DENIED: 119case NativeMethods.ERROR_FILENAME_EXCED_RANGE: 122case NativeMethods.ERROR_SHARING_VIOLATION:
sys\system\io\ports\Parity.cs (5)
22 None = NativeMethods.NOPARITY, 23 Odd = NativeMethods.ODDPARITY, 24Even = NativeMethods.EVENPARITY, 25 Mark = NativeMethods.MARKPARITY, 26 Space = NativeMethods.SPACEPARITY
sys\system\io\ports\SerialErrors.cs (5)
22TXFull = NativeMethods.CE_TXFULL, 23RXOver = NativeMethods.CE_RXOVER, 24Overrun = NativeMethods.CE_OVERRUN, 25RXParity = NativeMethods.CE_PARITY, 26Frame = NativeMethods.CE_FRAME,
sys\system\io\ports\SerialPinChanges.cs (5)
23 CtsChanged = NativeMethods.EV_CTS, 24 DsrChanged = NativeMethods.EV_DSR, 25 CDChanged = NativeMethods.EV_RLSD, 26 Ring = NativeMethods.EV_RING, 27 Break = NativeMethods.EV_BREAK,
sys\system\io\ports\SerialReceived.cs (2)
23 Chars = NativeMethods.EV_RXCHAR, 24 Eof = NativeMethods.EV_RXFLAG,
sys\system\io\ports\SerialStream.cs (133)
216int fNullFlag = GetDcbFlag(NativeMethods.FNULL); 220SetDcbFlag(NativeMethods.FNULL, value ? 1 : 0); 224SetDcbFlag(NativeMethods.FNULL, fNullOld); 234int fDtrControl = GetDcbFlag(NativeMethods.FDTRCONTROL); 236return (fDtrControl == NativeMethods.DTR_CONTROL_ENABLE); 241int fDtrControlOld = GetDcbFlag(NativeMethods.FDTRCONTROL); 243SetDcbFlag(NativeMethods.FDTRCONTROL, value ? NativeMethods.DTR_CONTROL_ENABLE : NativeMethods.DTR_CONTROL_DISABLE); 246SetDcbFlag(NativeMethods.FDTRCONTROL, fDtrControlOld); 251if (!UnsafeNativeMethods.EscapeCommFunction(_handle, value ? NativeMethods.SETDTR : NativeMethods.CLRDTR)) 271int fInOutXOld = GetDcbFlag(NativeMethods.FINX); 272int fOutxCtsFlowOld = GetDcbFlag(NativeMethods.FOUTXCTSFLOW); 273int fRtsControlOld = GetDcbFlag(NativeMethods.FRTSCONTROL); 277SetDcbFlag(NativeMethods.FINX, fInXOutXFlag); 278SetDcbFlag(NativeMethods.FOUTX, fInXOutXFlag); 280SetDcbFlag(NativeMethods.FOUTXCTSFLOW, (handshake == Handshake.RequestToSend || 286SetDcbFlag(NativeMethods.FRTSCONTROL, NativeMethods.RTS_CONTROL_HANDSHAKE); 290SetDcbFlag(NativeMethods.FRTSCONTROL, NativeMethods.RTS_CONTROL_ENABLE); 293SetDcbFlag(NativeMethods.FRTSCONTROL, NativeMethods.RTS_CONTROL_DISABLE); 299SetDcbFlag(NativeMethods.FINX, fInOutXOld); 300SetDcbFlag(NativeMethods.FOUTX, fInOutXOld); 301SetDcbFlag(NativeMethods.FOUTXCTSFLOW, fOutxCtsFlowOld); 302SetDcbFlag(NativeMethods.FRTSCONTROL, fRtsControlOld); 330int fParityOld = GetDcbFlag(NativeMethods.FPARITY); 332int fErrorCharOld = GetDcbFlag(NativeMethods.FERRORCHAR); 336SetDcbFlag(NativeMethods.FPARITY, parityFlag); 339SetDcbFlag(NativeMethods.FERRORCHAR, (parityReplace != '\0') ? 1 : 0); 344SetDcbFlag(NativeMethods.FERRORCHAR, 0); 350SetDcbFlag(NativeMethods.FPARITY, fParityOld); 353SetDcbFlag(NativeMethods.FERRORCHAR, fErrorCharOld); 373int fErrorCharOld = GetDcbFlag(NativeMethods.FERRORCHAR); 376if (GetDcbFlag(NativeMethods.FPARITY) == 1) 378SetDcbFlag(NativeMethods.FERRORCHAR, (parityReplace != '\0')? 1 : 0); 383SetDcbFlag(NativeMethods.FERRORCHAR, 0); 391SetDcbFlag(NativeMethods.FERRORCHAR, fErrorCharOld); 435commTimeouts.ReadIntervalTimeout = NativeMethods.MAXDWORD; 440commTimeouts.ReadTotalTimeoutMultiplier = NativeMethods.MAXDWORD; 441commTimeouts.ReadIntervalTimeout = NativeMethods.MAXDWORD; 444commTimeouts.ReadTotalTimeoutMultiplier = NativeMethods.MAXDWORD; 445commTimeouts.ReadIntervalTimeout = NativeMethods.MAXDWORD; 461int fRtsControl = GetDcbFlag(NativeMethods.FRTSCONTROL); 462if (fRtsControl == NativeMethods.RTS_CONTROL_HANDSHAKE) 465return (fRtsControl == NativeMethods.RTS_CONTROL_ENABLE); 473int fRtsControlOld = GetDcbFlag(NativeMethods.FRTSCONTROL); 477SetDcbFlag(NativeMethods.FRTSCONTROL, NativeMethods.RTS_CONTROL_ENABLE); 479SetDcbFlag(NativeMethods.FRTSCONTROL, NativeMethods.RTS_CONTROL_DISABLE); 483SetDcbFlag(NativeMethods.FRTSCONTROL, fRtsControlOld); 489if (!UnsafeNativeMethods.EscapeCommFunction(_handle, value ? NativeMethods.SETRTS : NativeMethods.CLRRTS)) 520if (value == StopBits.One) nativeValue = (byte) NativeMethods.ONESTOPBIT; 521else if (value == StopBits.OnePointFive) nativeValue = (byte) NativeMethods.ONE5STOPBITS; 522else nativeValue = (byte) NativeMethods.TWOSTOPBITS; 576return (NativeMethods.MS_RLSD_ON & pinStatus) != 0; 588return (NativeMethods.MS_CTS_ON & pinStatus) != 0; 601return (NativeMethods.MS_DSR_ON & pinStatus) != 0; 655NativeMethods.GENERIC_READ | NativeMethods.GENERIC_WRITE, 701if ((errorCode == NativeMethods.ERROR_INVALID_PARAMETER) || (errorCode == NativeMethods.ERROR_INVALID_HANDLE)) 722this.rtsEnable = (GetDcbFlag(NativeMethods.FRTSCONTROL) == NativeMethods.RTS_CONTROL_ENABLE); 734commTimeouts.ReadIntervalTimeout = NativeMethods.MAXDWORD; 739commTimeouts.ReadTotalTimeoutMultiplier = NativeMethods.MAXDWORD; 740commTimeouts.ReadIntervalTimeout = NativeMethods.MAXDWORD; 743commTimeouts.ReadTotalTimeoutMultiplier = NativeMethods.MAXDWORD; 744commTimeouts.ReadIntervalTimeout = NativeMethods.MAXDWORD; 764UnsafeNativeMethods.SetCommMask(_handle, NativeMethods.ALL_EVENTS); 805if (!UnsafeNativeMethods.EscapeCommFunction(_handle, NativeMethods.CLRDTR)) 816if ((hr == NativeMethods.ERROR_ACCESS_DENIED || hr == NativeMethods.ERROR_BAD_COMMAND || hr == ERROR_DEVICE_REMOVED) && !disposing) { 934if (UnsafeNativeMethods.PurgeComm(_handle, NativeMethods.PURGE_RXCLEAR | NativeMethods.PURGE_RXABORT) == false) 941if (UnsafeNativeMethods.PurgeComm(_handle, NativeMethods.PURGE_TXCLEAR | NativeMethods.PURGE_TXABORT) == false) 1201if (hr == NativeMethods.ERROR_COUNTER_TIMEOUT) 1242if (Marshal.GetLastWin32Error() == NativeMethods.ERROR_COUNTER_TIMEOUT) 1281dcb.StopBits = NativeMethods.ONESTOPBIT; 1284dcb.StopBits = NativeMethods.ONE5STOPBITS; 1287dcb.StopBits = NativeMethods.TWOSTOPBITS; 1298SetDcbFlag(NativeMethods.FPARITY, ((parity == Parity.None) ? 0 : 1)); 1300SetDcbFlag(NativeMethods.FBINARY, 1); // always true for communications resources 1305SetDcbFlag(NativeMethods.FOUTXCTSFLOW, ((handshake == Handshake.RequestToSend || 1308SetDcbFlag(NativeMethods.FOUTXDSRFLOW, 0); // dsrTimeout is always set to 0. 1309SetDcbFlag(NativeMethods.FDTRCONTROL, NativeMethods.DTR_CONTROL_DISABLE); 1310SetDcbFlag(NativeMethods.FDSRSENSITIVITY, 0); // this should remain off 1311SetDcbFlag(NativeMethods.FINX, (handshake == Handshake.XOnXOff || handshake == Handshake.RequestToSendXOnXOff) ? 1 : 0); 1312SetDcbFlag(NativeMethods.FOUTX,(handshake == Handshake.XOnXOff || handshake == Handshake.RequestToSendXOnXOff) ? 1 : 0); 1317SetDcbFlag(NativeMethods.FERRORCHAR, (parityReplace != '\0') ? 1 : 0); 1322SetDcbFlag(NativeMethods.FERRORCHAR, 0); 1328SetDcbFlag(NativeMethods.FNULL, discardNull ? 1 : 0); 1337SetDcbFlag(NativeMethods.FRTSCONTROL, NativeMethods.RTS_CONTROL_HANDSHAKE); 1339else if (GetDcbFlag(NativeMethods.FRTSCONTROL) == NativeMethods.RTS_CONTROL_HANDSHAKE) 1341SetDcbFlag(NativeMethods.FRTSCONTROL, NativeMethods.RTS_CONTROL_DISABLE); 1344dcb.XonChar = NativeMethods.DEFAULTXONCHAR; // may be exposed later but for now, constant 1345dcb.XoffChar = NativeMethods.DEFAULTXOFFCHAR; 1351dcb.EofChar = NativeMethods.EOFCHAR; 1355dcb.EvtChar = NativeMethods.EOFCHAR; 1371Debug.Assert(whichFlag >= NativeMethods.FBINARY && whichFlag <= NativeMethods.FDUMMY2, "GetDcbFlag needs to fit into enum!"); 1373if (whichFlag == NativeMethods.FDTRCONTROL || whichFlag == NativeMethods.FRTSCONTROL) 1377else if (whichFlag == NativeMethods.FDUMMY2) 1398Debug.Assert(whichFlag >= NativeMethods.FBINARY && whichFlag <= NativeMethods.FDUMMY2, "SetDcbFlag needs to fit into enum!"); 1400if (whichFlag == NativeMethods.FDTRCONTROL || whichFlag == NativeMethods.FRTSCONTROL) 1404else if (whichFlag == NativeMethods.FDUMMY2) 1466if (hr != NativeMethods.ERROR_IO_PENDING) 1468if (hr == NativeMethods.ERROR_HANDLE_EOF) 1519if (hr != NativeMethods.ERROR_IO_PENDING) 1522if (hr == NativeMethods.ERROR_HANDLE_EOF) 1571if (hr == NativeMethods.ERROR_INVALID_HANDLE) 1620if (hr == NativeMethods.ERROR_INVALID_HANDLE) 1745if (hr == NativeMethods.ERROR_ACCESS_DENIED || hr == NativeMethods.ERROR_BAD_COMMAND || hr == ERROR_DEVICE_REMOVED) { 1749if (hr == NativeMethods.ERROR_IO_PENDING) 1764while (error == NativeMethods.ERROR_IO_INCOMPLETE && !ShutdownLoop && !success); 1769if (! ( (error == NativeMethods.ERROR_IO_INCOMPLETE || error == NativeMethods.ERROR_INVALID_PARAMETER) && ShutdownLoop)) 1773else if (hr != NativeMethods.ERROR_INVALID_PARAMETER) { 1815if ((nativeEvents & (NativeMethods.EV_ERR | NativeMethods.EV_RXCHAR)) != 0) {
sys\system\security\accesscontrol\semaphoresecurity.cs (3)
136case NativeMethods.ERROR_INVALID_NAME: 137case NativeMethods.ERROR_INVALID_HANDLE: 138case NativeMethods.ERROR_FILE_NOT_FOUND:
sys\system\threading\semaphore.cs (10)
75if(null != name && 0 != name.Length && NativeMethods.ERROR_INVALID_HANDLE == errorCode) 125NativeMethods.SECURITY_ATTRIBUTES secAttrs = null; 126secAttrs = new NativeMethods.SECURITY_ATTRIBUTES(); 143if(null != name && 0 != name.Length && NativeMethods.ERROR_INVALID_HANDLE == errorCode) 147createdNew = errorCode != NativeMethods.ERROR_ALREADY_EXISTS; 192InternalResources.WinIOError(NativeMethods.ERROR_PATH_NOT_FOUND, string.Empty); 277if (NativeMethods.ERROR_FILE_NOT_FOUND == errorCode || NativeMethods.ERROR_INVALID_NAME == errorCode) 279if (NativeMethods.ERROR_PATH_NOT_FOUND == errorCode) 281if (null != name && 0 != name.Length && NativeMethods.ERROR_INVALID_HANDLE == errorCode)