134 references to UnsafeNativeMethods
System (134)
compmod\microsoft\win32\SystemEvents.cs (39)
119hwinsta = UnsafeNativeMethods.GetProcessWindowStation(); 126if (UnsafeNativeMethods.GetUserObjectInformation(new HandleRef(null, hwinsta), NativeMethods.UOI_FLAGS, flags, Marshal.SizeOf(flags), ref lengthNeeded)) { 385IntPtr hInstance = UnsafeNativeMethods.GetModuleHandle(null); 414defWindowProc = UnsafeNativeMethods.GetProcAddress(new HandleRef(this, UnsafeNativeMethods.GetModuleHandle("user32.dll")), defproc); 437IntPtr hInstance = UnsafeNativeMethods.GetModuleHandle(null); 439if (!UnsafeNativeMethods.GetClassInfo(new HandleRef(this, hInstance), WndClass.lpszClassName, wndclassi)) { 441if (UnsafeNativeMethods.RegisterClass(WndClass) == 0) { 455if (0 != UnsafeNativeMethods.UnregisterClass(WndClass.lpszClassName, new HandleRef(null, UnsafeNativeMethods.GetModuleHandle(null)))) { 456atom = UnsafeNativeMethods.RegisterClass(WndClass); 462atom = UnsafeNativeMethods.RegisterClass(WndClass); 470IntPtr hwnd = UnsafeNativeMethods.CreateWindowEx( 493IntPtr timerId = UnsafeNativeMethods.SendMessage(new HandleRef(systemEvents, systemEvents.windowHandle), 508UnsafeNativeMethods.WTSUnRegisterSessionNotification(new HandleRef(systemEvents, systemEvents.windowHandle)); 518if (UnsafeNativeMethods.IsWindow(href) && DefWndProc != IntPtr.Zero) { 519UnsafeNativeMethods.SetWindowLong(href, NativeMethods.GWL_WNDPROC, new HandleRef(this, DefWndProc)); 523UnsafeNativeMethods.SetClassLong(href, NativeMethods.GCL_WNDPROC, DefWndProc); 531if (UnsafeNativeMethods.IsWindow(href) && !UnsafeNativeMethods.DestroyWindow(href)) { 532UnsafeNativeMethods.PostMessage(href, NativeMethods.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); 535IntPtr hInstance = UnsafeNativeMethods.GetModuleHandle(null); 536UnsafeNativeMethods.UnregisterClass(className, new HandleRef(this, hInstance)); 541UnsafeNativeMethods.SetConsoleCtrlHandler(consoleHandler, 0); 608UnsafeNativeMethods.WTSRegisterSessionNotification(new HandleRef(systemEvents, systemEvents.windowHandle), NativeMethods.NOTIFY_FOR_THIS_SESSION); 745if (!UnsafeNativeMethods.SetConsoleCtrlHandler(consoleHandler, 1)) { 833UnsafeNativeMethods.PostMessage(new HandleRef(systemEvents, systemEvents.windowHandle), threadCallbackMessage, IntPtr.Zero, IntPtr.Zero); 843int res = (int) UnsafeNativeMethods.SendMessage(new HandleRef(systemEvents, systemEvents.windowHandle), 857IntPtr res = UnsafeNativeMethods.SetTimer(new HandleRef(this, windowHandle), new HandleRef(this, timerId), (int) wParam, NativeMethods.NullHandleRef); 891bool res = UnsafeNativeMethods.KillTimer(new HandleRef(this, windowHandle), new HandleRef(this, wParam)); 1255UnsafeNativeMethods.GetModuleFileName(NativeMethods.NullHandleRef, sb, sb.Capacity); 1414UnsafeNativeMethods.PostMessage(new HandleRef(systemEvents, systemEvents.windowHandle), NativeMethods.WM_QUIT, IntPtr.Zero, IntPtr.Zero); 1450UnsafeNativeMethods.PostMessage(new HandleRef(this, windowHandle), NativeMethods.WM_REFLECT + msg, wParam, newStringPtr); 1463UnsafeNativeMethods.PostMessage(new HandleRef(this, windowHandle), NativeMethods.WM_REFLECT + msg, wParam, lParam); 1545return UnsafeNativeMethods.DefWindowProc(hWnd, msg, wParam, lParam); 1571int ret = UnsafeNativeMethods.MsgWaitForMultipleObjectsEx(0, IntPtr.Zero, 100, NativeMethods.QS_ALLINPUT, NativeMethods.MWMO_INPUTAVAILABLE); 1577while (UnsafeNativeMethods.PeekMessage(ref msg, NativeMethods.NullHandleRef, 0, 0, NativeMethods.PM_REMOVE)) 1584UnsafeNativeMethods.TranslateMessage(ref msg); 1585UnsafeNativeMethods.DispatchMessage(ref msg);
compmod\system\codedom\compiler\Executor.cs (1)
185si.hStdInput = new SafeFileHandle(UnsafeNativeMethods.GetStdHandle(NativeMethods.STD_INPUT_HANDLE), false);
compmod\system\diagnostics\assertwrapper.cs (6)
137if (!UnsafeNativeMethods.IsPackagedProcess.Value) 211IntPtr hdc = UnsafeNativeMethods.GetDC(IntPtr.Zero); 213hFont = UnsafeNativeMethods.SelectObject(hdc, hFont); 215UnsafeNativeMethods.SelectObject(hdc, hFont); 216UnsafeNativeMethods.ReleaseDC(IntPtr.Zero, hdc); 218int cy = UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CYSCREEN);
compmod\System\Runtime\InteropServices\StandardOleMarshalObject.cs (8)
23public class StandardOleMarshalObject : MarshalByRefObject, UnsafeNativeMethods.IMarshal 48if (NativeMethods.S_OK == UnsafeNativeMethods.CoGetStandardMarshal(ref riid, pUnk, dwDestContext, IntPtr.Zero, mshlflags, out pStandardMarshal)) 65int UnsafeNativeMethods.IMarshal.GetUnmarshalClass(ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags, out Guid pCid) 74unsafe int UnsafeNativeMethods.IMarshal.GetMarshalSizeMax(ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags, out int pSize) 97unsafe int UnsafeNativeMethods.IMarshal.MarshalInterface(IntPtr pStm, ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags) 120int UnsafeNativeMethods.IMarshal.UnmarshalInterface(IntPtr pStm, ref Guid riid, out IntPtr ppv) 131int UnsafeNativeMethods.IMarshal.ReleaseMarshalData(IntPtr pStm) 141int UnsafeNativeMethods.IMarshal.DisconnectObject(int dwReserved)
net\System\Net\_SecureChannel.cs (1)
1007&& ComNetOS.IsWin8orLater && Microsoft.Win32.UnsafeNativeMethods.IsPackagedProcess.Value)
services\io\system\io\FileSystemWatcher.cs (8)
729ok = UnsafeNativeMethods.ReadDirectoryChangesW(directoryHandle, 980UnsafeNativeMethods.FILE_LIST_DIRECTORY, // access (read-write) mode 981UnsafeNativeMethods.FILE_SHARE_READ | 982UnsafeNativeMethods.FILE_SHARE_DELETE | 983UnsafeNativeMethods.FILE_SHARE_WRITE, // share mode 985UnsafeNativeMethods.OPEN_EXISTING, // how to create 986UnsafeNativeMethods.FILE_FLAG_BACKUP_SEMANTICS | 987UnsafeNativeMethods.FILE_FLAG_OVERLAPPED, // file attributes
services\monitoring\system\diagnosticts\EventLogEntry.cs (1)
378if(UnsafeNativeMethods.LookupAccountSid(MachineName, sid, bufUserName, ref userNameLen, bufDomainName, ref domainNameLen, ref sidNameUse) != 0) {
services\monitoring\system\diagnosticts\EventLogInternal.cs (9)
213bool success = UnsafeNativeMethods.GetNumberOfEventLogRecords(readHandle, out count); 476bool success = UnsafeNativeMethods.GetOldestEventLogRecord(readHandle, out num); 568bool success = UnsafeNativeMethods.NotifyChangeEventLog(info.handleOwner.ReadHandle, info.waitHandle.SafeWaitHandle); 632bool success = UnsafeNativeMethods.ClearEventLog(readHandle, NativeMethods.NullHandleRef); 896bool success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, 920success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, 1089bool success = UnsafeNativeMethods.ReadEventLog(readHandle, flags, index, 1113success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, index, 1718bool success = UnsafeNativeMethods.ReportEvent(writeHandle, (short) type, category, eventID,
services\monitoring\system\diagnosticts\FileVersionInfo.cs (6)
330if (UnsafeNativeMethods.VerQueryValue(new HandleRef(null, memPtr), "\\", ref memRef, out memLen)) { 343UnsafeNativeMethods.VerLanguageName( langid, lang, lang.Capacity ); 355if (UnsafeNativeMethods.VerQueryValue(new HandleRef(null, memPtr), name, ref memRef, out memLen)) { 370if (UnsafeNativeMethods.VerQueryValue(new HandleRef(null, memPtr), "\\VarFileInfo\\Translation", ref memRef, out memLen)) { 460int infoSize = UnsafeNativeMethods.GetFileVersionInfoSize(fileName, out handle); 467if (UnsafeNativeMethods.GetFileVersionInfo(fileName, 0, infoSize, new HandleRef(null, memIntPtr))) {
sys\System\EnvironmentHelpers.cs (2)
41if (!UnsafeNativeMethods.GetTokenInformation(wi.Token, UnsafeNativeMethods.TokenIsAppContainer, new IntPtr(dwIsAppContainerPtr), sizeof(int), out dwLength)) {
sys\system\io\ports\SerialStream.cs (53)
73private UnsafeNativeMethods.DCB dcb; 74private UnsafeNativeMethods.COMMTIMEOUTS commTimeouts; 75private UnsafeNativeMethods.COMSTAT comStat; 76private UnsafeNativeMethods.COMMPROP commProp; 165if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 178if (UnsafeNativeMethods.SetCommBreak(_handle) == false) 183if (UnsafeNativeMethods.ClearCommBreak(_handle) == false) 201if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 222if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 244if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 251if (!UnsafeNativeMethods.EscapeCommFunction(_handle, value ? NativeMethods.SETDTR : NativeMethods.CLRDTR)) 296if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 347if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 388if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 448if (UnsafeNativeMethods.SetCommTimeouts(_handle, ref commTimeouts) == false) 481if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 489if (!UnsafeNativeMethods.EscapeCommFunction(_handle, value ? NativeMethods.SETRTS : NativeMethods.CLRRTS)) 529if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 556if (UnsafeNativeMethods.SetCommTimeouts(_handle, ref commTimeouts) == false) 573if (UnsafeNativeMethods.GetCommModemStatus(_handle, ref pinStatus) == false) 586if (UnsafeNativeMethods.GetCommModemStatus(_handle, ref pinStatus) == false) 598if (UnsafeNativeMethods.GetCommModemStatus(_handle, ref pinStatus) == false) 612if (UnsafeNativeMethods.ClearCommError(_handle, ref errorCode, ref comStat) == false) 626if (UnsafeNativeMethods.ClearCommError(_handle, ref errorCode, ref comStat) == false) 642int flags = UnsafeNativeMethods.FILE_FLAG_OVERLAPPED; 645flags = UnsafeNativeMethods.FILE_ATTRIBUTE_NORMAL; 654SafeFileHandle tempHandle = UnsafeNativeMethods.CreateFile("\\\\.\\" + portName, 658UnsafeNativeMethods.OPEN_EXISTING, // comm devices must use OPEN_EXISTING 669int fileType = UnsafeNativeMethods.GetFileType(tempHandle); 672if ((fileType != UnsafeNativeMethods.FILE_TYPE_CHAR) && (fileType != UnsafeNativeMethods.FILE_TYPE_UNKNOWN)) 692commProp = new UnsafeNativeMethods.COMMPROP(); 695if (!UnsafeNativeMethods.GetCommProperties(_handle, ref commProp) 696|| !UnsafeNativeMethods.GetCommModemStatus(_handle, ref pinStatus)) 710comStat = new UnsafeNativeMethods.COMSTAT(); 713dcb = new UnsafeNativeMethods.DCB(); 751if (UnsafeNativeMethods.SetCommTimeouts(_handle, ref commTimeouts) == false) 764UnsafeNativeMethods.SetCommMask(_handle, NativeMethods.ALL_EVENTS); 804UnsafeNativeMethods.SetCommMask(_handle, 0); 805if (!UnsafeNativeMethods.EscapeCommFunction(_handle, NativeMethods.CLRDTR)) 934if (UnsafeNativeMethods.PurgeComm(_handle, NativeMethods.PURGE_RXCLEAR | NativeMethods.PURGE_RXABORT) == false) 941if (UnsafeNativeMethods.PurgeComm(_handle, NativeMethods.PURGE_TXCLEAR | NativeMethods.PURGE_TXABORT) == false) 1071UnsafeNativeMethods.FlushFileBuffers(_handle); 1158if (!UnsafeNativeMethods.SetupComm(_handle, readBufferSize, writeBufferSize)) 1267if (UnsafeNativeMethods.GetCommState(_handle, ref dcb) == false) 1358if (UnsafeNativeMethods.SetCommState(_handle, ref dcb) == false) 1554r = UnsafeNativeMethods.ReadFile(_handle, p + offset, count, IntPtr.Zero, overlapped); 1556r = UnsafeNativeMethods.ReadFile(_handle, p + offset, count, out numBytesRead, IntPtr.Zero); 1604r = UnsafeNativeMethods.WriteFile(_handle, p + offset, count, IntPtr.Zero, overlapped); 1606r = UnsafeNativeMethods.WriteFile(_handle, p + offset, count, out numBytesWritten, IntPtr.Zero); 1739if (UnsafeNativeMethods.WaitCommEvent(handle, eventsOccurredPtr, intOverlapped) == false) 1761success = UnsafeNativeMethods.GetOverlappedResult(handle, intOverlapped, ref unused, false); 1817if (UnsafeNativeMethods.ClearCommError(handle, ref errors, IntPtr.Zero) == false) {