114 references to AllocHGlobal
Microsoft.AspNetCore.Server.HttpSys (1)
NativeInterop\RequestQueue.cs (1)
58pSecurityDescriptor = Marshal.AllocHGlobal(securityDescriptorBytes.Length);
Microsoft.CodeAnalysis.Workspaces (1)
Serialization\SerializerService_Reference.cs (1)
490var unmanagedMemory = Marshal.AllocHGlobal(length);
Microsoft.Diagnostics.DataContractReader.Legacy (2)
NativeStringHolder.cs (2)
39_vtablePtr = Marshal.AllocHGlobal(IntPtr.Size); 43_objectPtr = Marshal.AllocHGlobal(IntPtr.Size);
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Windows\Network\WindowsTcpStateInfo.cs (1)
121tcpTable = Marshal.AllocHGlobal((int)size);
Microsoft.ML.Vision (1)
ImageClassificationTrainer.cs (1)
1554IntPtr tstringPtr = Marshal.AllocHGlobal(sizeOfTString);
NuGet.Packaging (3)
Signing\Cms\HeapBlockRetainer.cs (1)
24var hBlock = new SafeLocalAllocHandle(Marshal.AllocHGlobal(cbSize));
Signing\Cms\NativeUtility.cs (2)
50using (var signerInfoHandle = new SafeLocalAllocHandle(Marshal.AllocHGlobal(Marshal.SizeOf(signerInfo)))) 57using (var certificatesHandle = new SafeLocalAllocHandle(Marshal.AllocHGlobal(Marshal.SizeOf(certificateBlobs[0]) * certificateBlobs.Length)))
PresentationFramework (9)
MS\Internal\Printing\PrintDlgExMarshaler.cs (6)
490pdex.lpPageRanges = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.PRINTPAGERANGE))); 530unmanagedBuffer = Marshal.AllocHGlobal(cbBufferSize); 569pdex.lpPageRanges = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.PRINTPAGERANGE))); 609unmanagedBuffer = Marshal.AllocHGlobal(cbBufferSize); 724hDevNames = Marshal.AllocHGlobal(cbDevNames); 815IntPtr hDevMode = Marshal.AllocHGlobal(devModeData.Length);
MS\Internal\WindowsRuntime\Generated\WinRT\IInspectable.cs (1)
45AbiToProjectionVftablePtr = Marshal.AllocHGlobal(Marshal.SizeOf<Vftbl>());
MS\Internal\WindowsRuntime\Generated\WinRT\Interop\IUnknownVftbl.cs (1)
25AbiToProjectionVftblPtr = Marshal.AllocHGlobal(Marshal.SizeOf<IUnknownVftbl>());
System\Windows\Documents\NLGSpellerInterop.cs (1)
189IntPtr inputArray = Marshal.AllocHGlobal(count * 2);
PresentationUI (1)
MS\Internal\Documents\PeoplePickerWrapper.cs (1)
325_ptrToDsObjectNames = Marshal.AllocHGlobal(data.Length);
System.Diagnostics.EventLog (12)
System\Diagnostics\Reader\NativeWrapper.cs (12)
370buffer = Marshal.AllocHGlobal((int)bufferNeeded); 399buffer = Marshal.AllocHGlobal((int)bufferNeeded); 429buffer = Marshal.AllocHGlobal((int)bufferNeeded); 458buffer = Marshal.AllocHGlobal((int)bufferNeeded); 539buffer = Marshal.AllocHGlobal((int)bufferNeeded); 569buffer = Marshal.AllocHGlobal((int)bufferNeeded); 599buffer = Marshal.AllocHGlobal((int)bufferNeeded); 774buffer = Marshal.AllocHGlobal((int)bufferNeeded); 807buffer = Marshal.AllocHGlobal((int)bufferNeeded); 908buffer = Marshal.AllocHGlobal((int)bufferNeeded); 1008buffer = Marshal.AllocHGlobal(bufferNeeded * 2); 1058buffer = Marshal.AllocHGlobal((int)bufferNeeded);
System.Diagnostics.PerformanceCounter (1)
System\Diagnostics\PerformanceData\CounterSetInstanceCounterDataSet.cs (1)
125_dataBlock = (byte*)Marshal.AllocHGlobal(_instance._counterSet._idToCounter.Count * sizeof(long));
System.DirectoryServices (27)
System\DirectoryServices\ActiveDirectory\DirectoryServer.cs (1)
698unmanagedGuid = Marshal.AllocHGlobal(structSize);
System\DirectoryServices\ActiveDirectory\ForestTrustRelationshipInformation.cs (8)
110records = Marshal.AllocHGlobal(count * IntPtr.Size); 118fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 137tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 166tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 199tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 221record.Data.Buffer = Marshal.AllocHGlobal(record.Data.Length); 225tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 238forestInfo = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_INFORMATION>());
System\DirectoryServices\ActiveDirectory\TrustHelper.cs (10)
221newInfo = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX)); 360ptr = Marshal.AllocHGlobal(IntPtr.Size); 460fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 475unmanagedAuthData = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_AUTH_INFORMATION>()); 613fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 628unmanagedAuthData = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_AUTH_INFORMATION>()); 648newBuffer = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION)); 739fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 754unmanagedAuthData = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_AUTH_INFORMATION>()); 789newBuffer = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION));
System\DirectoryServices\ActiveDirectory\Utils.cs (6)
123IntPtr ptr = Marshal.AllocHGlobal(IntPtr.Size); 217IntPtr ptr = Marshal.AllocHGlobal(IntPtr.Size); 2093pBuffer = Marshal.AllocHGlobal((int)neededBufferSize); 2118IntPtr pCopyOfUserSid = Marshal.AllocHGlobal(userSidLength); 2175IntPtr pCopyOfSid = Marshal.AllocHGlobal(sidLength); 2306pBytes = Marshal.AllocHGlobal(bytes.Length);
System\DirectoryServices\DirectorySearcher.cs (2)
847IntPtr vlvPtr = Marshal.AllocHGlobal(Marshal.SizeOf<AdsVLV>()); 898IntPtr ptr = Marshal.AllocHGlobal(structSize * prefs.Length);
System.DirectoryServices.AccountManagement (5)
System\DirectoryServices\AccountManagement\AuthZSet.cs (1)
110pBuffer = Marshal.AllocHGlobal(bufferSize);
System\DirectoryServices\AccountManagement\Utils.cs (4)
153pBytes = Marshal.AllocHGlobal(bytes.Length); 411pBuffer = Marshal.AllocHGlobal((int)neededBufferSize); 440IntPtr pCopyOfUserSid = Marshal.AllocHGlobal(userSidLength); 510IntPtr pCopyOfSid = Marshal.AllocHGlobal(sidLength);
System.DirectoryServices.Protocols (16)
System\DirectoryServices\Protocols\common\BerConverter.cs (4)
324berValue.bv_val = Marshal.AllocHGlobal(value.Length); 469IntPtr tmp = Marshal.AllocHGlobal(tempValue.Length); 543managedBervalArray[i].bv_val = Marshal.AllocHGlobal(byteArray.Length); 548IntPtr valPtr = Marshal.AllocHGlobal(structSize);
System\DirectoryServices\Protocols\common\utils.cs (1)
44IntPtr intPtrArray = Marshal.AllocHGlobal(IntPtr.Size * size);
System\DirectoryServices\Protocols\ldap\LdapConnection.cs (8)
534IntPtr controlPtr = Marshal.AllocHGlobal(structSize); 550IntPtr controlPtr = Marshal.AllocHGlobal(structSize); 612bv_val = Marshal.AllocHGlobal(byteArray.Length) 644IntPtr controlPtr = Marshal.AllocHGlobal(modStructSize); 678bv_val = Marshal.AllocHGlobal(val.Length) 1225bv_val = Marshal.AllocHGlobal(sizeof(byte) * byteControlValue.Length) 1313bv_val = Marshal.AllocHGlobal(byteArray.Length) 1330controlPtr = Marshal.AllocHGlobal(structSize);
System\DirectoryServices\Protocols\ldap\LdapConnection.Linux.cs (1)
140IntPtr ptrToDefaults = Marshal.AllocHGlobal(Marshal.SizeOf(defaults));
System\DirectoryServices\Protocols\ldap\LdapSessionOptions.cs (2)
581IntPtr controlPtr = Marshal.AllocHGlobal(structSize); 597IntPtr controlPtr = Marshal.AllocHGlobal(structSize);
System.Drawing.Common (17)
System\Drawing\Imaging\EncoderParameter.cs (16)
69_parameterValue = Marshal.AllocHGlobal(sizeof(byte)); 84_parameterValue = Marshal.AllocHGlobal(sizeof(byte)); 96_parameterValue = Marshal.AllocHGlobal(sizeof(short)); 108_parameterValue = Marshal.AllocHGlobal(sizeof(int)); 120_parameterValue = Marshal.AllocHGlobal(2 * sizeof(int)); 133_parameterValue = Marshal.AllocHGlobal(2 * sizeof(int)); 151_parameterValue = Marshal.AllocHGlobal(4 * sizeof(int)); 177_parameterValue = Marshal.AllocHGlobal(_numberOfValues); 190_parameterValue = Marshal.AllocHGlobal(_numberOfValues); 202_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * sizeof(short))); 214_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * sizeof(int))); 234_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 2 * sizeof(int))); 254_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 2 * sizeof(int))); 281_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 4 * sizeof(int))); 310_parameterValue = Marshal.AllocHGlobal(bytes); 336_parameterValue = Marshal.AllocHGlobal(bytes);
System\Drawing\Imaging\EncoderParameters.cs (1)
21GdiPlus.EncoderParameters* native = (GdiPlus.EncoderParameters*)Marshal.AllocHGlobal(
System.Management (2)
System\Management\ManagementObject.cs (2)
1475ppwbemCallResult = Marshal.AllocHGlobal(IntPtr.Size); 1768ppwbemCallResult = Marshal.AllocHGlobal(IntPtr.Size);
System.Net.Http.WinHttpHandler (1)
System\Net\Http\WinHttpChannelBinding.cs (1)
25IntPtr data = Marshal.AllocHGlobal((int)dataSize);
System.Net.Security (1)
System\Net\Security\Pal.Managed\SafeChannelBindingHandle.cs (1)
39handle = Marshal.AllocHGlobal(SecChannelBindingSize + _cbtPrefixByteArraySize + CertHashMaxSize);
System.Private.CoreLib (3)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (1)
1074IntPtr ptr = AllocHGlobal(checked(nb + 1));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Security\SecureString.cs (2)
371ptr = Marshal.AllocHGlobal(byteLength); 430buffer.SetHandle(Marshal.AllocHGlobal(byteLength));
System.Reflection.Metadata (1)
System\Reflection\Internal\MemoryBlocks\NativeHeapMemoryBlock.cs (1)
32_pointer = Marshal.AllocHGlobal(size);
System.Security.Cryptography (3)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (1)
47handle = Marshal.AllocHGlobal(spanLen * sizeof(char));
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeUnicodeStringHandle.cs (1)
36handle = Marshal.AllocHGlobal(cb);
System\Security\Cryptography\X509Certificates\SafeLocalAllocHandle.cs (1)
17h.SetHandle(Marshal.AllocHGlobal(cb));
System.Security.Principal.Windows (1)
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeLocalAllocHandle.cs (1)
18h.SetHandle(Marshal.AllocHGlobal(cb));
System.ServiceProcess.ServiceController (1)
System\ServiceProcess\ServiceBase.cs (1)
584IntPtr entriesPointer = Marshal.AllocHGlobal(checked((services.Length + 1) * sizeof(SERVICE_TABLE_ENTRY)));
System.Speech (1)
Internal\HGlobalSafeHandle.cs (1)
42SetHandle(Marshal.AllocHGlobal(size));
System.Text.Encoding.CodePages (1)
System\Text\BaseCodePageEncoding.cs (1)
369byte* pNativeMemory = (byte*)Marshal.AllocHGlobal(iSize);
System.Windows.Forms (1)
System\Windows\Forms\Controls\ListView\ListView.cs (1)
4162hGlobalColumns = Marshal.AllocHGlobal((int)(lvItem.cColumns * sizeof(int)));
System.Windows.Forms.Design (1)
System\Drawing\Design\ColorEditor.CustomColorDialog.cs (1)
28_hInstance = Marshal.AllocHGlobal(size);