220 references to SafeNativeMethods
WsatUI (220)
Configuration\CertificateManager.cs (20)
36
int ret =
SafeNativeMethods
.RegOpenKeyEx(
40
SafeNativeMethods
.KEY_READ,
42
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS)
47
storeHandle =
SafeNativeMethods
.CertOpenStore_ptr(
48
SafeNativeMethods
.CERT_STORE_PROV_REG,
51
SafeNativeMethods
.CERT_STORE_OPEN_EXISTING_FLAG |
52
SafeNativeMethods
.CERT_STORE_READONLY_FLAG,
77
int ret =
SafeNativeMethods
.RegConnectRegistry(
81
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS)
86
ret =
SafeNativeMethods
.RegOpenKeyEx(
90
SafeNativeMethods
.KEY_READ,
92
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS)
97
storeHandle =
SafeNativeMethods
.CertOpenStore_ptr(
98
SafeNativeMethods
.CERT_STORE_PROV_REG,
100
SafeNativeMethods
.CERT_REGISTRY_STORE_REMOTE_FLAG |
101
SafeNativeMethods
.CERT_STORE_READONLY_FLAG |
102
SafeNativeMethods
.CERT_STORE_OPEN_EXISTING_FLAG,
223
current =
SafeNativeMethods
.CertFindCertificateInStore(
225
SafeNativeMethods
.X509_ASN_ENCODING,
227
SafeNativeMethods
.CERT_FIND_ANY,
Configuration\ClusterRegistryConfigurationProvider.cs (19)
32
SafeHKey rootKey =
SafeNativeMethods
.GetClusterResourceKey(hResource,
51
int ret =
SafeNativeMethods
.ClusterRegCreateKey(rootKey,
53
SafeNativeMethods
.REG_OPTION_NON_VOLATILE,
58
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS)
89
int ret =
SafeNativeMethods
.ClusterRegCreateKey(hKey,
91
SafeNativeMethods
.REG_OPTION_NON_VOLATILE,
96
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS)
113
int ret =
SafeNativeMethods
.ClusterRegQueryValue(this.hKey,
119
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS || ret ==
SafeNativeMethods
.ERROR_MORE_DATA)
127
ret =
SafeNativeMethods
.ClusterRegQueryValue(this.hKey,
132
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS)
150
int ret =
SafeNativeMethods
.ClusterRegSetValue(this.hKey,
155
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS)
301
ret =
SafeNativeMethods
.ClusterRegGetKeySecurity(hKey, SecurityInfos.DiscretionaryAcl, binarySecurityDescriptor, ref dwSize);
302
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS)
306
else if (ret ==
SafeNativeMethods
.ERROR_INSUFFICIENT_BUFFER)
358
ret =
SafeNativeMethods
.ClusterRegSetKeySecurity(hKey, SecurityInfos.DiscretionaryAcl, newBinarySecurityDescriptor);
359
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS)
Configuration\ClusterSafeNativeMethods.cs (6)
36
[DllImport(
SafeNativeMethods
.ClusApi)]
48
[DllImport(
SafeNativeMethods
.ClusApi)]
60
[DllImport(
SafeNativeMethods
.ClusApi)]
66
return ClusterCloseEnum(handle) ==
SafeNativeMethods
.ERROR_SUCCESS;
72
[DllImport(
SafeNativeMethods
.ClusApi)]
78
return ClusterRegCloseKey(handle) ==
SafeNativeMethods
.ERROR_SUCCESS;
Configuration\ETWSafeNativeMethods.cs (8)
74
[MarshalAs(UnmanagedType.ByValArray, SizeConst =
SafeNativeMethods
.MaxTraceLoggerNameLen)]
76
[MarshalAs(UnmanagedType.ByValArray, SizeConst =
SafeNativeMethods
.MaxTraceFileNameLen)]
109
Tail.LoggerName = new char[
SafeNativeMethods
.MaxTraceLoggerNameLen];
110
Tail.LogFileName = new char[
SafeNativeMethods
.MaxTraceFileNameLen];
115
if (loggerNameChars.Length <
SafeNativeMethods
.MaxTraceLoggerNameLen)
121
Array.Copy(loggerNameChars, 0, Tail.LoggerName, 0,
SafeNativeMethods
.MaxTraceLoggerNameLen - 1);
128
if (logFileNameChars.Length <
SafeNativeMethods
.MaxTraceFileNameLen)
134
Array.Copy(logFileNameChars, 0, Tail.LogFileName, 0,
SafeNativeMethods
.MaxTraceFileNameLen - 1);
Configuration\ETWWsatTraceSession.cs (24)
34
uint err =
SafeNativeMethods
.FlushTrace(0, WsatTraceSessionName, ref properties);
36
if (err !=
SafeNativeMethods
.ERROR_SUCCESS)
38
if (err ==
SafeNativeMethods
.ERROR_ACCESS_DENIED)
65
uint err =
SafeNativeMethods
.EnableTrace(0, 0, 0, ref providerGuid, sessionHandle);
67
if (err ==
SafeNativeMethods
.ERROR_SUCCESS)
70
err =
SafeNativeMethods
.StopTrace(0, WsatTraceSessionName, ref properties);
74
if (err !=
SafeNativeMethods
.ERROR_SUCCESS || IsSessionExist())
76
if (err ==
SafeNativeMethods
.ERROR_ACCESS_DENIED)
95
uint err =
SafeNativeMethods
.QueryTrace(0, WsatTraceSessionName, ref properties);
97
if (err ==
SafeNativeMethods
.ERROR_SUCCESS)
184
if (logFileName.Length >=
SafeNativeMethods
.MaxTraceFileNameLen)
249
properties.Head.Wnode.Flags =
SafeNativeMethods
.WNODE_FLAG_TRACED_GUID;
253
properties.Head.LogFileMode =
SafeNativeMethods
.EVENT_TRACE_FILE_MODE_CIRCULAR |
SafeNativeMethods
.EVENT_TRACE_USE_PAGED_MEMORY;
257
uint err =
SafeNativeMethods
.StartTrace(out sessionHandle, WsatTraceSessionName, ref properties);
259
if (err !=
SafeNativeMethods
.ERROR_SUCCESS)
263
case
SafeNativeMethods
.ERROR_BAD_PATHNAME:
266
case
SafeNativeMethods
.ERROR_DISK_FULL:
269
case
SafeNativeMethods
.ERROR_FILE_NOT_FOUND:
272
case
SafeNativeMethods
.ERROR_PATH_NOT_FOUND:
282
err =
SafeNativeMethods
.EnableTrace(1, 0, 0, ref providerGuid, sessionHandle);
284
if (err !=
SafeNativeMethods
.ERROR_SUCCESS)
288
SafeNativeMethods
.StopTrace(0, WsatTraceSessionName, ref properties2);
290
if (err ==
SafeNativeMethods
.ERROR_ACCESS_DENIED)
Configuration\MsdtcClusterUtils.cs (32)
26
SafeHCluster hCluster =
SafeNativeMethods
.OpenCluster(Utilities.IsLocalMachineName(machineName) ? null : machineName);
41
SafeHCluster hCluster =
SafeNativeMethods
.OpenCluster(Utilities.IsLocalMachineName(machineName) ? null : machineName);
50
SafeHClusEnum hEnum =
SafeNativeMethods
.ClusterOpenEnum(hCluster, ClusterEnum.Resource);
91
SafeHCluster hCluster =
SafeNativeMethods
.OpenCluster(null);
108
SafeHClusEnum hEnum =
SafeNativeMethods
.ClusterOpenEnum(hCluster, ClusterEnum.Resource);
151
int ret =
SafeNativeMethods
.GetClusterInformation(
156
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS || ret ==
SafeNativeMethods
.ERROR_MORE_DATA)
158
if (ret ==
SafeNativeMethods
.ERROR_MORE_DATA)
161
ret =
SafeNativeMethods
.GetClusterInformation(
166
if (ret !=
SafeNativeMethods
.ERROR_SUCCESS)
204
if (
SafeNativeMethods
.GetClusterResourceNetworkName(hResource, sb, ref cch))
222
uint ret =
SafeNativeMethods
.ClusterEnum(hEnum, index, out type, null, ref cch);
223
if (ret ==
SafeNativeMethods
.ERROR_NO_MORE_ITEMS)
227
else if (ret ==
SafeNativeMethods
.ERROR_SUCCESS || ret ==
SafeNativeMethods
.ERROR_MORE_DATA)
230
ret =
SafeNativeMethods
.ClusterEnum(hEnum, index, out type, sb, ref cch);
232
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS)
237
hResource =
SafeNativeMethods
.OpenClusterResource(hCluster, resourceName);
255
SafeHClusEnum hEnum =
SafeNativeMethods
.ClusterOpenEnum(hCluster, ClusterEnum.Node);
269
ret =
SafeNativeMethods
.ClusterEnum(hEnum, index, out type, null, ref cch);
270
if (ret ==
SafeNativeMethods
.ERROR_NO_MORE_ITEMS)
274
else if (ret ==
SafeNativeMethods
.ERROR_SUCCESS || ret ==
SafeNativeMethods
.ERROR_MORE_DATA)
277
ret =
SafeNativeMethods
.ClusterEnum(hEnum, index, out type, sb, ref cch);
278
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS)
285
} while (ret ==
SafeNativeMethods
.ERROR_SUCCESS);
295
uint ret =
SafeNativeMethods
.ClusterResourceControl(hResource,
304
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS || ret ==
SafeNativeMethods
.ERROR_MORE_DATA)
307
ret =
SafeNativeMethods
.ClusterResourceControl(hResource,
316
if (ret ==
SafeNativeMethods
.ERROR_SUCCESS)
Configuration\MsdtcWrapper.cs (7)
80
SafeNativeMethods
.OLE_TM_CONFIG_PARAMS_V2 configParams = new
SafeNativeMethods
.OLE_TM_CONFIG_PARAMS_V2();
81
configParams.dwVersion =
SafeNativeMethods
.OLE_TM_CONFIG_VERSION_2;
84
hr =
SafeNativeMethods
.DtcGetTransactionManagerEx_WithConfigParams(
88
SafeNativeMethods
.OLE_TM_FLAG_NONE,
94
hr =
SafeNativeMethods
.DtcGetTransactionManagerEx(
98
SafeNativeMethods
.OLE_TM_FLAG_NONE,
Configuration\QfeChecker.cs (8)
27
int hr =
SafeNativeMethods
.CoInitializeEx(IntPtr.Zero,
SafeNativeMethods
.COINIT_APARTMENTTHREADED);
34
hr =
SafeNativeMethods
.CoGetClassObject(new Guid(CLSID_CGatewayProtocol),
35
SafeNativeMethods
.CLSCTX.CLSCTX_INPROC_SERVER,
51
SafeNativeMethods
.CoUninitialize();
67
int ret =
SafeNativeMethods
.RegOpenKeyEx(
71
SafeNativeMethods
.KEY_WOW64_64KEY |
SafeNativeMethods
.KEY_QUERY_VALUE,
Configuration\SafeCertificateContext.cs (1)
32
int r =
SafeNativeMethods
.CertFreeCertificateContext(handle);
Configuration\SafeCertificateStore.cs (1)
35
return
SafeNativeMethods
.CertCloseStore(handle, 0);
Configuration\SafeLocalAllocation.cs (5)
22
IntPtr pointer =
SafeNativeMethods
.LocalAlloc(
SafeNativeMethods
.LMEM_ZEROINIT, size);
33
IntPtr pointer =
SafeNativeMethods
.LocalAlloc(
SafeNativeMethods
.LMEM_ZEROINIT, Marshal.SizeOf(source));
55
IntPtr r =
SafeNativeMethods
.LocalFree(handle);
Configuration\SafeRegistryKey.cs (1)
30
int r =
SafeNativeMethods
.RegCloseKey(handle);
Configuration\Utilities.cs (15)
50
int hr =
SafeNativeMethods
.NetWkstaGetInfo(
55
if (hr ==
SafeNativeMethods
.NERR_Success && workstationPtr != IntPtr.Zero)
59
SafeNativeMethods
.WKSTA_INFO_100 workstationInfo = (
SafeNativeMethods
.WKSTA_INFO_100)Marshal.PtrToStructure(workstationPtr, typeof(
SafeNativeMethods
.WKSTA_INFO_100));
65
hr =
SafeNativeMethods
.NetApiBufferFree(workstationPtr);
158
IntPtr comResDll =
SafeNativeMethods
.LoadLibrary(comResDllName);
167
len =
SafeNativeMethods
.LoadString(comResDll, IDS_MYCOMPUTER, sb, size);
176
SafeNativeMethods
.FreeLibrary(comResDll);
201
int retCode =
SafeNativeMethods
.NoError;
205
retCode =
SafeNativeMethods
.HttpInitialize(new HttpApiVersion(1, 0),
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
206
SafeNativeMethods
.HttpTerminate(
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
207
if (retCode !=
SafeNativeMethods
.NoError)
Configuration\WsatServiceAddress.cs (23)
43
int retVal =
SafeNativeMethods
.NoError;
47
retVal =
SafeNativeMethods
.HttpInitialize(HttpWrapper.HttpApiVersion1,
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
49
if (
SafeNativeMethods
.NoError == retVal)
60
retVal =
SafeNativeMethods
.HttpSetServiceConfiguration_UrlAcl(IntPtr.Zero,
66
if (
SafeNativeMethods
.ErrorAlreadyExists == retVal)
68
retVal =
SafeNativeMethods
.HttpDeleteServiceConfiguration_UrlAcl(IntPtr.Zero,
74
if (
SafeNativeMethods
.NoError == retVal)
76
retVal =
SafeNativeMethods
.HttpSetServiceConfiguration_UrlAcl(IntPtr.Zero,
87
SafeNativeMethods
.HttpTerminate(
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
90
if (
SafeNativeMethods
.NoError != retVal)
92
if (
SafeNativeMethods
.ErrorAlreadyExists == retVal)
108
int retVal =
SafeNativeMethods
.NoError;
111
retVal =
SafeNativeMethods
.HttpInitialize(HttpWrapper.HttpApiVersion1,
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
112
if (
SafeNativeMethods
.NoError == retVal)
123
retVal =
SafeNativeMethods
.HttpDeleteServiceConfiguration_UrlAcl(IntPtr.Zero,
132
SafeNativeMethods
.HttpTerminate(
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
135
if (retVal !=
SafeNativeMethods
.NoError && retVal !=
SafeNativeMethods
.FileNotFound && retVal !=
SafeNativeMethods
.ErrorInvalidParameter)
Configuration\WsatServiceCertificate.cs (25)
43
int retVal =
SafeNativeMethods
.NoError;
48
retVal =
SafeNativeMethods
.HttpInitialize(HttpWrapper.HttpApiVersion1,
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
49
if (
SafeNativeMethods
.NoError == retVal)
57
sslConf.ParamDesc.DefaultFlags =
SafeNativeMethods
.HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT;
68
retVal =
SafeNativeMethods
.HttpSetServiceConfiguration_Ssl(IntPtr.Zero,
72
if (
SafeNativeMethods
.ErrorAlreadyExists == retVal)
74
retVal =
SafeNativeMethods
.HttpDeleteServiceConfiguration_Ssl(IntPtr.Zero,
80
if (
SafeNativeMethods
.NoError == retVal)
82
retVal =
SafeNativeMethods
.HttpSetServiceConfiguration_Ssl(IntPtr.Zero,
100
SafeNativeMethods
.HttpTerminate(
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
103
if (
SafeNativeMethods
.NoError != retVal)
105
if (
SafeNativeMethods
.ErrorAlreadyExists == retVal)
120
int retVal =
SafeNativeMethods
.NoError;
125
retVal =
SafeNativeMethods
.HttpInitialize(HttpWrapper.HttpApiVersion1,
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
126
if (
SafeNativeMethods
.NoError == retVal)
134
sslConf.ParamDesc.DefaultFlags =
SafeNativeMethods
.HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT;
144
retVal =
SafeNativeMethods
.HttpDeleteServiceConfiguration_Ssl(IntPtr.Zero,
159
SafeNativeMethods
.HttpTerminate(
SafeNativeMethods
.HTTP_INITIALIZE_CONFIG, IntPtr.Zero);
162
if (retVal !=
SafeNativeMethods
.NoError && retVal !=
SafeNativeMethods
.FileNotFound && retVal !=
SafeNativeMethods
.ErrorInvalidParameter)
MMCUI\ACLWrapper.cs (1)
26
int result =
SafeNativeMethods
.EditSecurity(hwndOwner, psi);
MMCUI\SafePropertyPage.cs (2)
21
SetHandle(
SafeNativeMethods
.CreatePropertySheetPage(ref psp));
26
return
SafeNativeMethods
.DestroyPropertySheetPage(handle);
MMCUI\WSATControl.cs (6)
212
SafeNativeMethods
.SendMessage(propSheetDialog, PSM.CHANGED, propPage, IntPtr.Zero);
316
SafeCertificateContext certContext =
SafeNativeMethods
.CryptUIDlgSelectCertificateFromStore(
321
SafeNativeMethods
.CRYPTUI_SELECT_LOCATION_COLUMN,
363
crt =
SafeNativeMethods
.CertFindCertificateInStore(
365
SafeNativeMethods
.X509_ASN_ENCODING,
367
SafeNativeMethods
.CERT_FIND_ANY,
MMCUI\WSATPropertySheet.cs (12)
155
stg.unionmember =
SafeNativeMethods
.GlobalAlloc(
SafeNativeMethods
.GMEM_SHARE, 255);
175
SafeNativeMethods
.ReleaseStgMedium(ref stg);
232
SafeNativeMethods
.DWL_MSGRESULT,
245
SafeNativeMethods
.DWL_MSGRESULT,
267
IntPtr parent =
SafeNativeMethods
.GetParent(windowUnmanagedParent);
276
SafeNativeMethods
.SetParent(wsatControl.Handle, this.windowUnmanagedParent);
302
header.hwndFrom !=
SafeNativeMethods
.GetParent(windowUnmanagedParent))
332
result =
SafeNativeMethods
.SetWindowLongPtr(hWnd, nIndex, dwNewLong);
338
int intResult =
SafeNativeMethods
.SetWindowLong(hWnd, nIndex, (int)dwNewLong);
348
result =
SafeNativeMethods
.SetWindowLongPtr(hWnd, nIndex, dwNewLong);
353
int intResult =
SafeNativeMethods
.SetWindowLong(hWnd, nIndex, (int)dwNewLong);
MMCUI\WsatSecurityModel.cs (4)
93
SafeNativeMethods
.MapGenericMask(out generic.Mask, ref ServiceGenericMapping);
112
bool ret =
SafeNativeMethods
.ConvertSecurityDescriptorToStringSecurityDescriptorW(
127
SafeNativeMethods
.LocalFree(pszSD);
196
bool ret =
SafeNativeMethods
.ConvertStringSecurityDescriptorToSecurityDescriptor(