Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ private void SetUserData(IntPtr userHandle,
info.UserAccountControl = uac;

buffer = Marshal.AllocHGlobal(ClrFacade.SizeOf<USER_ALL_INFORMATION>());
ClrFacade.StructureToPtr<USER_ALL_INFORMATION>(info, buffer, false);
Marshal.StructureToPtr<USER_ALL_INFORMATION>(info, buffer, false);

status = SamApi.SamSetInformationUser(userHandle,
USER_INFORMATION_CLASS.UserAllInformation,
Expand Down Expand Up @@ -2393,7 +2393,7 @@ private void SetSamDacl(IntPtr objectHandle, RawAcl rawAcl)

if (rawAcl != null && rawAcl.BinaryLength > 0)
{
ClrFacade.StructureToPtr<SECURITY_DESCRIPTOR>(sd, ipsd, false);
Marshal.StructureToPtr<SECURITY_DESCRIPTOR>(sd, ipsd, false);

// put the DACL into unmanaged memory
var length = rawAcl.BinaryLength;
Expand Down Expand Up @@ -2601,7 +2601,7 @@ private void SetUserPassword(IntPtr userHandle,
info.PasswordExpired = setPwExpire;

buffer = Marshal.AllocHGlobal(Marshal.SizeOf(info));
ClrFacade.StructureToPtr<USER_SET_PASSWORD_INFORMATION>(info, buffer, false);
Marshal.StructureToPtr<USER_SET_PASSWORD_INFORMATION>(info, buffer, false);

var status = SamApi.SamSetInformationUser(userHandle,
USER_INFORMATION_CLASS.UserSetPasswordInformation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public static int InitPlugin(
// If there are any non-critical exceptions (e.g. we are running on CLR prior to 4.6.2), we won't be able to use long paths
}
#endif
ClrFacade.StructureToPtr<WSManPluginEntryDelegates.WSManPluginEntryDelegatesInternal>(workerPtrs.UnmanagedStruct, wkrPtrs, false);
Marshal.StructureToPtr<WSManPluginEntryDelegates.WSManPluginEntryDelegatesInternal>(workerPtrs.UnmanagedStruct, wkrPtrs, false);
return WSManPluginConstants.ExitCodeSuccess;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8561,7 +8561,7 @@ internal static bool DeleteJunction(string junctionPath)
// Using the wrong one results in mismatched-tag error.

REPARSE_GUID_DATA_BUFFER junctionData = new REPARSE_GUID_DATA_BUFFER();
ClrFacade.StructureToPtr<REPARSE_GUID_DATA_BUFFER>(junctionData, outBuffer, false);
Marshal.StructureToPtr<REPARSE_GUID_DATA_BUFFER>(junctionData, outBuffer, false);

result = DeviceIoControl(dangerousHandle, FSCTL_GET_REPARSE_POINT, IntPtr.Zero, 0,
outBuffer, inOutBufferSize, out bytesReturned, IntPtr.Zero);
Expand All @@ -8575,7 +8575,7 @@ internal static bool DeleteJunction(string junctionPath)
junctionData.ReparseDataLength = 0;
junctionData.DataBuffer = new char[MAX_REPARSE_SIZE];

ClrFacade.StructureToPtr<REPARSE_GUID_DATA_BUFFER>(junctionData, inBuffer, false);
Marshal.StructureToPtr<REPARSE_GUID_DATA_BUFFER>(junctionData, inBuffer, false);

// To delete a reparse point:
// ReparseDataLength must be 0
Expand Down
11 changes: 0 additions & 11 deletions src/System.Management.Automation/utils/ClrFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,6 @@ internal static T PtrToStructure<T>(IntPtr ptr)
return Marshal.PtrToStructure<T>(ptr);
}

/// <summary>
/// Wraps Marshal.StructureToPtr to hide differences between the CLRs.
/// </summary>
internal static void StructureToPtr<T>(
T structure,
IntPtr ptr,
bool deleteOld)
{
Marshal.StructureToPtr<T>(structure, ptr, deleteOld);
}

#endregion Marshal

#region Assembly
Expand Down