You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both the Reboot Message and run a program Command properties get corrupted (show random characters).
This appears to be due to incorrect memory/pointer allocation of ServiceFailureActionsInfo ( SERVICE_FAILURE_ACTIONS and SC_ACTION[] ).
The text was updated successfully, but these errors were encountered:
FYI: I've created my own recovery actions code and have found it works if I use the below code to allocate memory and return a pointer the SC_ACTION list.
Hopefully this will help you identify the issue.
private static SafeMemoryHandle StructureArrayToPtr<SC_ACTION>(IList<SC_ACTION> structureArray)
{
if (structureArray == null || !structureArray.Any())
return new SafeMemoryHandle();
var elementSize = Marshal.SizeOf(typeof(SC_ACTION));
var arrayLength = structureArray.Count;
// Allocate enough unmanaged memory to hold the struct array and collect a pointer to it.
var totalArraySize = elementSize * arrayLength;
var pointerToStruct = new SafeMemoryHandle(Marshal.AllocHGlobal(totalArraySize));
// Populate the allocated memory with each structure.
for (var i = 0; i < arrayLength; i++)
{
var offset = elementSize * i;
var elementPointer = IntPtr.Add(pointerToStruct, offset);
Marshal.StructureToPtr(structureArray[i], elementPointer, false);
}
return pointerToStruct;
}
Both the Reboot Message and run a program Command properties get corrupted (show random characters).
This appears to be due to incorrect memory/pointer allocation of ServiceFailureActionsInfo ( SERVICE_FAILURE_ACTIONS and SC_ACTION[] ).
The text was updated successfully, but these errors were encountered: