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