Skip to content

Commit

Permalink
Fix inconsistencies in order of GeneratedDllImport fields (dotnet#60049)
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung authored Oct 6, 2021
1 parent b4773b0 commit d81945e
Show file tree
Hide file tree
Showing 88 changed files with 153 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static partial class Sys
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_INotifyInit", SetLastError = true)]
internal static partial SafeFileHandle INotifyInit();

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_INotifyAddWatch", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_INotifyAddWatch", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial int INotifyAddWatch(SafeFileHandle fd, string pathName, uint mask);

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_INotifyRemoveWatch", SetLastError = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal enum AccessMode : int
R_OK = 4, /* Check for read */
}

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Access", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Access", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial int Access(string path, AccessMode mode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal static unsafe int ForkAndExecProcess(
}
}

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ForkAndExecProcess", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ForkAndExecProcess", CharSet = CharSet.Ansi, SetLastError = true)]
private static unsafe partial int ForkAndExecProcess(
string filename, byte** argv, byte** envp, string? cwd,
int redirectStdin, int redirectStdout, int redirectStderr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal static partial class Sys
} while (true);
}

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetGroupList", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetGroupList", CharSet = CharSet.Ansi, SetLastError = true)]
private static unsafe partial int GetGroupList(string name, uint group, uint* groups, int* ngroups);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPeerUserName", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPeerUserName", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial string GetPeerUserName(SafeHandle socket);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal unsafe struct Passwd
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwUidR", SetLastError = false)]
internal static unsafe partial int GetPwUidR(uint uid, out Passwd pwd, byte* buf, int bufLen);

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwNamR", SetLastError = false, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwNamR", CharSet = CharSet.Ansi, SetLastError = false)]
internal static unsafe partial int GetPwNamR(string name, out Passwd pwd, byte* buf, int bufLen);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Open", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Open", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial SafeFileHandle Open(string filename, OpenFlags flags, int mode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal enum PathConfName : int
PC_VDISABLE = 9,
}

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PathConf", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PathConf", CharSet = CharSet.Ansi, SetLastError = true)]
private static partial int PathConf(string path, PathConfName name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static partial class Sys
/// </summary>
/// <param name="path">The path to the file system object</param>
/// <returns>Returns the result string on success and null on failure</returns>
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_RealPath", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_RealPath", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial string RealPath(string path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal static partial class Sys
/// success; if the return value is equal to the size then the result may have been truncated.
/// On failure, returns a negative value.
/// </returns>
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", CharSet = CharSet.Ansi, SetLastError = true)]
internal static unsafe partial int SNPrintF(byte* str, int size, string format, string arg1);

/// <summary>
Expand All @@ -47,7 +47,7 @@ internal static partial class Sys
/// success; if the return value is equal to the size then the result may have been truncated.
/// On failure, returns a negative value.
/// </returns>
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF", CharSet = CharSet.Ansi, SetLastError = true)]
internal static unsafe partial int SNPrintF(byte* str, int size, string format, int arg1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ internal static partial class Interop
{
internal static partial class Sys
{
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ShmOpen", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ShmOpen", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial SafeFileHandle ShmOpen(string name, OpenFlags flags, int mode);

[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ShmUnlink", SetLastError = true, CharSet = CharSet.Ansi)]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ShmUnlink", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial int ShmUnlink(string name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertSecurityDescriptorToStringSecurityDescriptorW",
CallingConvention = CallingConvention.Winapi, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static partial bool ConvertSdToStringSd(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertSecurityDescriptorToStringSecurityDescriptorW",
CallingConvention = CallingConvention.Winapi, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static extern bool ConvertSdToStringSd(
#endif
byte[] securityDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW",
CallingConvention = CallingConvention.Winapi, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static partial bool ConvertStringSdToSd(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW",
CallingConvention = CallingConvention.Winapi, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static extern bool ConvertStringSdToSd(
#endif
string stringSd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ internal static partial class Interop
internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", SetLastError = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int ConvertStringSidToSid(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int ConvertStringSidToSid(
#endif
string stringSid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class Interop
{
internal static partial class Advapi32
{
[GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true, EntryPoint = "CreateProcessWithLogonW")]
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CreateProcessWithLogonW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static unsafe partial bool CreateProcessWithLogonW(
string userName,
string domain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ internal static partial class Interop
internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "CreateWellKnownSid", SetLastError = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "CreateWellKnownSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int CreateWellKnownSid(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "CreateWellKnownSid", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "CreateWellKnownSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int CreateWellKnownSid(
#endif
int sidType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ internal enum CryptAcquireContextFlags : uint
}

#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "CryptAcquireContextW")]
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CryptAcquireContextW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool CryptAcquireContext(
#else
[DllImport(Libraries.Advapi32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "CryptAcquireContextW")]
[DllImport(Libraries.Advapi32, EntryPoint = "CryptAcquireContextW", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool CryptAcquireContext(
#endif
out SafeProvHandle phProv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal enum CryptSignAndVerifyHashFlags : int
CRYPT_X931_FORMAT = 0x00000004, // Not supported
}

[GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "CryptSignHashW")]
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CryptSignHashW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool CryptSignHash(
SafeHashHandle hHash,
KeySpec dwKeySpec,
Expand All @@ -33,7 +33,7 @@ public static partial bool CryptSignHash(
byte[]? pbSignature,
ref int pdwSigLen);

[GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "CryptVerifySignatureW")]
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CryptVerifySignatureW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool CryptVerifySignature(
SafeHashHandle hHash,
byte[] pbSignature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ internal static partial class Advapi32
/// WARNING: This method does not implicitly handle long paths. Use EncryptFile.
/// </summary>
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", SetLastError = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool EncryptFilePrivate(string lpFileName);
#else
[DllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern bool EncryptFilePrivate(string lpFileName);
#endif

Expand All @@ -29,10 +29,10 @@ internal static bool EncryptFile(string path)
/// WARNING: This method does not implicitly handle long paths. Use DecryptFile.
/// </summary>
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", SetLastError = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool DecryptFileFilePrivate(
#else
[DllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern bool DecryptFileFilePrivate(
#endif
string lpFileName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class Interop
internal static partial class Advapi32
{
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "GetSecurityDescriptorLength", CallingConvention = CallingConvention.Winapi,
ExactSpelling = true, CharSet = CharSet.Unicode)]
CharSet = CharSet.Unicode, ExactSpelling = true)]
internal static extern /*DWORD*/ uint GetSecurityDescriptorLength(IntPtr byteArray);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ internal static partial class Interop
internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetNamedSecurityInfoW", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetNamedSecurityInfoW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static partial uint GetSecurityInfoByName(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "GetNamedSecurityInfoW", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "GetNamedSecurityInfoW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static extern /*DWORD*/ uint GetSecurityInfoByName(
#endif
string name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ internal static partial class Interop
internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetWindowsAccountDomainSid", SetLastError = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetWindowsAccountDomainSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int GetWindowsAccountDomainSid(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "GetWindowsAccountDomainSid", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "GetWindowsAccountDomainSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int GetWindowsAccountDomainSid(
#endif
byte[] sid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ internal static partial class Interop
internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "EqualDomainSid", SetLastError = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "EqualDomainSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int IsEqualDomainSid(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "EqualDomainSid", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "EqualDomainSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int IsEqualDomainSid(
#endif
byte[] sid1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ internal static partial class Interop
internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "IsWellKnownSid", SetLastError = true, CharSet = CharSet.Unicode)]
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "IsWellKnownSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int IsWellKnownSid(
#else
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "IsWellKnownSid", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, EntryPoint = "IsWellKnownSid", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int IsWellKnownSid(
#endif
byte[] sid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ internal static partial class Interop
internal static partial class Advapi32
{
#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "LookupPrivilegeValueW")]
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "LookupPrivilegeValueW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool LookupPrivilegeValue(
#else
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false, EntryPoint = "LookupPrivilegeValueW")]
[DllImport(Libraries.Advapi32, EntryPoint = "LookupPrivilegeValueW", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
internal static extern bool LookupPrivilegeValue(
#endif
[MarshalAs(UnmanagedType.LPTStr)] string? lpSystemName, [MarshalAs(UnmanagedType.LPTStr)] string lpName, out LUID lpLuid);
Expand Down
Loading

0 comments on commit d81945e

Please sign in to comment.