Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
InitializeProcThreadAttributeList (kernel32)
.
C# Signature:
[DllImport("kernel32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool InitializeProcThreadAttributeList(
IntPtr lpAttributeList,
int dwAttributeCount,
int dwFlags,
ref IntPtr lpSize);
Boo Signature:
[DllImport("kernel32.dll", SetLastError : true)]
def InitializeProcThreadAttributeList(
lpAttributeList as IntPtr,
dwAttributeCount as Int32,
dwFlags as Int32,
ref lpSize as IntPtr) as bool:
pass
VB Signature:
Declare Function InitializeProcThreadAttributeList Lib "kernel32.dll" (TODO) As TODO
User-Defined Types:
None.
Alternative Managed API:
Do you know one? Please contribute it!
Notes:
Call it once to get the required size, allocate that memory, call it again to initialize.
Save the attribute list to the STARTUPINFOEX struct, use UpdateProcThreadAttribute to fill in the now-reserved attribute entries.
Save the attribute list to the STARTUPINFOEX struct, use UpdateProcThreadAddtributeList to fill in the now-reserved attribute entries.
private static IntPtr InitializeProcThreadAttributeList(int attributeCount)
{
const int reserved = 0;
var size = IntPtr.Zero;
bool wasInitialized = InitializeProcThreadAttributeList(IntPtr.Zero, attributeCount, reserved, ref size);
if (wasInitialized || size == IntPtr.Zero)
{
throw new Exception(string.Format("Couldn't get the size of the attribute list for {0} attributes", attributeCount));
}
IntPtr lpAttributeList = Marshal.AllocHGlobal(size);
if (lpAttributeList == IntPtr.Zero)
{
throw new Exception("Couldn't reserve space for a new attribute list");
}
wasInitialized = InitializeProcThreadAttributeList(lpAttributeList, attributeCount, reserved, ref size);
if (!wasInitialized)
{
throw new Exception("Couldn't create new attribute list");
}
return lpAttributeList;
}
Add attributes to an initialized proc thread attribute list
7/20/2021 7:58:04 AM - -84.74.145.231
Click to read this page
1/22/2015 10:41:09 PM - zackrun-131.107.192.170
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).