122 references to SafeNativeMethods
System.ServiceModel (122)
System\ServiceModel\ComIntegration\ComPlusAuthorization.cs (15)
33if (!SafeNativeMethods.GetTokenInformation(token, infoClass, SafeHGlobalHandle.InvalidHandle, 0, out length)) 44if (!SafeNativeMethods.GetTokenInformation(token, infoClass, buffer, length, out length)) 105if (!SafeNativeMethods.ImpersonateAnonymousUserOnCurrentThread(SafeNativeMethods.GetCurrentThread())) 112bool isSuccess = SafeNativeMethods.OpenCurrentThreadToken(SafeNativeMethods.GetCurrentThread(), TokenAccessLevels.Query, true, out tokenHandle); 117revertSuccess = SafeNativeMethods.RevertToSelf(); 131revertSuccess = SafeNativeMethods.RevertToSelf(); 150bool revertSuccess = SafeNativeMethods.RevertToSelf(); 180bool isSuccess = SafeNativeMethods.GetCurrentProcessToken(SafeNativeMethods.GetCurrentProcess(), TokenAccessLevels.Query, out tokenHandle); 308if (!SafeNativeMethods.DuplicateTokenEx(clientIdentityToken, 324if (!SafeNativeMethods.AccessCheck(BinaryForm, (ImpersonationToken != null) ? ImpersonationToken : clientIdentityToken, 443oldSecurityObject = SafeNativeMethods.CoSwitchCallContext(secCtx); 594IntPtr secCtx = SafeNativeMethods.CoSwitchCallContext(oldSecurityObject);
System\ServiceModel\ComIntegration\ComPlusDiagnosticTraceRecords.cs (7)
187comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo); 199System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId()); 220comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo); 233instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, guidContextTrsansactionID); 239instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity); 251instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, 262instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity,
System\ServiceModel\ComIntegration\ComPlusInstanceContextInitializer.cs (1)
69activity = (IServiceActivity)SafeNativeMethods.CoCreateActivity(
System\ServiceModel\ComIntegration\ComPlusInstanceProvider.cs (1)
83result = SafeNativeMethods.CoCreateInstance(
System\ServiceModel\ComIntegration\ComPlusSynchronizationContext.cs (1)
77comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(ComPlusActivityTrace.IID_IComThreadingInfo);
System\ServiceModel\ComIntegration\ComPlusThreadInitializer.cs (2)
181SafeNativeMethods.GetCurrentThreadId().ToString(CultureInfo.InvariantCulture), 241SafeNativeMethods.GetCurrentThreadId().ToString(CultureInfo.InvariantCulture),
System\ServiceModel\ComIntegration\DispatchProxy.cs (6)
413int dimensionsOfSafeArray = SafeNativeMethods.SafeArrayGetDim(pSafeArray); 417int sizeofElement = SafeNativeMethods.SafeArrayGetElemsize(pSafeArray); 421int lBound = SafeNativeMethods.SafeArrayGetLBound(pSafeArray, 1); 425int uBound = SafeNativeMethods.SafeArrayGetUBound(pSafeArray, 1); 427IntPtr pRawData = SafeNativeMethods.SafeArrayAccessData(pSafeArray); 485SafeNativeMethods.SafeArrayUnaccessData(pSafeArray);
System\ServiceModel\ComIntegration\PersistStreamTypeWrapper.cs (9)
48Int32 sizeOfByteArray = (SafeNativeMethods.GlobalSize(hGlobal)).ToInt32(); 52IntPtr pBuff = SafeNativeMethods.GlobalLock(hGlobal); 62SafeNativeMethods.GlobalUnlock(hGlobal); 75IStream stream = SafeNativeMethods.CreateStreamOnHGlobal(SafeHGlobalHandle.InvalidHandle, false); 79SafeHGlobalHandle hGlobal = SafeNativeMethods.GetHGlobalFromStream(stream); 101IntPtr pBuff = SafeNativeMethods.GlobalLock(hGlobal); 107IStream stream = SafeNativeMethods.CreateStreamOnHGlobal(hGlobal, false); 119SafeNativeMethods.GlobalUnlock(hGlobal); 125IPersistStream persistableObject = SafeNativeMethods.CoCreateInstance(
System\ServiceModel\ComIntegration\SafeNativeMethods.cs (64)
580int status = SafeNativeMethods.RegOpenKeyEx(HKEY_LOCAL_MACHINE, @"Software\Classes", 0, SafeNativeMethods.KEY_READ, out regHandle); 581if (status != SafeNativeMethods.ERROR_SUCCESS) 590throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_INVALID_HANDLE)); 601int status = SafeNativeMethods.RegOpenKeyEx(HKEY_LOCAL_MACHINE, @"Software\Classes", 0, SafeNativeMethods.KEY_READ | SafeNativeMethods.KEY_WOW64_64KEY, out regHandle); 602if (status != SafeNativeMethods.ERROR_SUCCESS) 611throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_INVALID_HANDLE)); 621int status = SafeNativeMethods.RegOpenKeyEx(HKEY_LOCAL_MACHINE, @"Software\Classes", 0, SafeNativeMethods.KEY_READ | SafeNativeMethods.KEY_WOW64_32KEY, out regHandle); 622if (status != SafeNativeMethods.ERROR_SUCCESS) 631throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_INVALID_HANDLE)); 647throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_NOT_SUPPORTED)); 666throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_NOT_SUPPORTED)); 674int status = SafeNativeMethods.RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, SafeNativeMethods.KEY_READ, out regHandle); 675if (status != SafeNativeMethods.ERROR_SUCCESS) 684throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_INVALID_HANDLE)); 694int status = SafeNativeMethods.RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, SafeNativeMethods.KEY_READ | SafeNativeMethods.KEY_WOW64_64KEY, out regHandle); 695if (status != SafeNativeMethods.ERROR_SUCCESS) 704throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_INVALID_HANDLE)); 713int status = SafeNativeMethods.RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, SafeNativeMethods.KEY_READ | SafeNativeMethods.KEY_WOW64_32KEY, out regHandle); 714if (status != SafeNativeMethods.ERROR_SUCCESS) 723throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(SafeNativeMethods.ERROR_INVALID_HANDLE)); 732int samDesired = SafeNativeMethods.KEY_READ | SafeNativeMethods.KEY_WOW64_64KEY; 736samDesired |= SafeNativeMethods.KEY_WRITE; 739int status = SafeNativeMethods.RegOpenKeyEx(HKEY_LOCAL_MACHINE, subKey, 0, samDesired, out regHandle); 740if (status != SafeNativeMethods.ERROR_SUCCESS || regHandle == null || regHandle.IsInvalid) 761int status = SafeNativeMethods.RegDeleteKey(this, key); 762if (status == SafeNativeMethods.ERROR_SUCCESS) 770int status = SafeNativeMethods.RegSetValueEx(this, valName, 0, SafeNativeMethods.REG_SZ, value, (value.Length * 2) + 2); 771if (status != SafeNativeMethods.ERROR_SUCCESS) 779int status = SafeNativeMethods.RegOpenKeyEx(this, subkey, 0, SafeNativeMethods.KEY_READ, out regHandle); 780if (status != SafeNativeMethods.ERROR_SUCCESS || regHandle == null || regHandle.IsInvalid) 792int ret = SafeNativeMethods.RegQueryValueEx(this, valName, null, ref type, (byte[])null, ref datasize); 793if (ret == SafeNativeMethods.ERROR_SUCCESS) 794if (type == SafeNativeMethods.REG_SZ) 797ret = SafeNativeMethods.RegQueryValueEx(this, valName, null, ref type, (byte[])blob, ref datasize); 811ret = SafeNativeMethods.RegEnumKey(this, index, null, ref lengthInChars); 812if (ret == SafeNativeMethods.ERROR_MORE_DATA) 815ret = SafeNativeMethods.RegEnumKey(this, index, keyName, ref lengthInChars); 816if (ret == SafeNativeMethods.ERROR_SUCCESS) 821while (ret == SafeNativeMethods.ERROR_SUCCESS); 831int ret = SafeNativeMethods.RegQueryValueEx(this, valName, null, ref type, (byte[])null, ref datasize); 832if (SafeNativeMethods.ERROR_SUCCESS == ret) 835ret = SafeNativeMethods.RegQueryValueEx(this, valName, null, ref type, (byte[])blob, ref datasize); 837if (SafeNativeMethods.ERROR_SUCCESS == ret) 844case (SafeNativeMethods.REG_BINARY): 848case (SafeNativeMethods.REG_DWORD): 855case (SafeNativeMethods.REG_MULTI_SZ): 859case (SafeNativeMethods.REG_QWORD): 866case (SafeNativeMethods.REG_EXPAND_SZ): 867case (SafeNativeMethods.REG_SZ): 882if (SafeNativeMethods.RegCloseKey(handle) == SafeNativeMethods.ERROR_SUCCESS)
System\ServiceModel\ComIntegration\TypeCacheManager.cs (1)
153int hr = SafeNativeMethods.LoadRegTypeLib(ref typeLibraryID, major, minor, lcidLocalIndependent, out otlb);
System\ServiceModel\Dispatcher\SecurityImpersonationBehavior.cs (8)
31using SafeNativeMethods = System.ServiceModel.ComIntegration.SafeNativeMethods; 401if (!SafeNativeMethods.TranslateName(shortDomainName, EXTENDED_NAME_FORMAT.NameSamCompatible, EXTENDED_NAME_FORMAT.NameCanonical, 408if (!SafeNativeMethods.TranslateName(shortDomainName, EXTENDED_NAME_FORMAT.NameSamCompatible, EXTENDED_NAME_FORMAT.NameCanonical, 491IntPtr threadHandle = SafeNativeMethods.GetCurrentThread(); 493if (!SafeNativeMethods.OpenCurrentThreadToken(threadHandle, TokenAccessLevels.Impersonate, true, out tokenHandle)) 507if (!SafeNativeMethods.ImpersonateAnonymousUserOnCurrentThread(threadHandle)) 532Fx.Assert(this.threadHandle == SafeNativeMethods.GetCurrentThread(), ""); 536if (!SafeNativeMethods.SetCurrentThreadToken(IntPtr.Zero, this.tokenHandle))
System\ServiceModel\Security\Tokens\IssuedSecurityTokenProvider.cs (3)
28using SafeNativeMethods = System.ServiceModel.ComIntegration.SafeNativeMethods; 1068if (!SafeNativeMethods.OpenCurrentThreadToken( 1069SafeNativeMethods.GetCurrentThread(),
System\ServiceModel\UpnEndpointIdentity.cs (4)
111int result = SafeNativeMethods.DsGetDcName(null, null, IntPtr.Zero, null, (uint)DSFlags.DS_DIRECTORY_SERVICE_REQUIRED, out pDomainControllerInfo); 119SafeNativeMethods.NetApiBufferFree(pDomainControllerInfo); 143if (!SafeNativeMethods.TranslateName(shortDomainName, EXTENDED_NAME_FORMAT.NameSamCompatible, EXTENDED_NAME_FORMAT.NameCanonical, 150if (!SafeNativeMethods.TranslateName(shortDomainName, EXTENDED_NAME_FORMAT.NameSamCompatible, EXTENDED_NAME_FORMAT.NameCanonical,