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