This repository was archived by the owner on Mar 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 180
Basic tests, fixes and better logging for keyfile crashes #3
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Switched from deprecated DllImports to ICLRStrongName, tests pass
- Loading branch information
commit f48773c0e8ba228bb7f871b1292a259f690bd79a
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| namespace System.Compiler | ||
| { | ||
| public static class ClrStrongName | ||
| { | ||
| private static IClrStrongName clrStrongName; | ||
| private static IClrStrongName GetClrStrongName() | ||
| { | ||
| return clrStrongName ?? (clrStrongName = | ||
| (IClrStrongName)RuntimeEnvironment.GetRuntimeInterfaceAsObject( | ||
| new Guid("B79B0ACD-F5CD-409b-B5A5-A16244610B92"), | ||
| typeof(IClrStrongName).GUID)); | ||
| } | ||
|
|
||
| public static void SignatureGeneration(string filePath, string keyContainer, byte[] keyBlob) | ||
| { | ||
| GetClrStrongName().StrongNameSignatureGeneration(filePath, keyContainer, keyBlob, keyBlob.Length, IntPtr.Zero, IntPtr.Zero); | ||
| } | ||
|
|
||
| [ComImport, ComConversionLoss, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("9FD93CCF-3280-4391-B3A9-96E1CDE77C8D")] | ||
| private interface IClrStrongName | ||
| { | ||
| void StrongNameSignatureGeneration( | ||
| [MarshalAs(UnmanagedType.LPWStr)] string pwzFilePath, | ||
| [MarshalAs(UnmanagedType.LPWStr)] string pwzKeyContainer, | ||
| [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] byte[] pbKeyBlob, | ||
| int cbKeyBlob, | ||
| IntPtr ppbSignatureBlob, | ||
| IntPtr pcbSignatureBlob); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future readers: this is a bad interface declaration because COM interface calls are made in .NET not by method name but rather method declaration order inside the interface. There are 16 missing method declarations that should have come lexically above
StrongNameSignatureGeneration. Therefore the first slot number is used instead of the seventeenth, and so, in spite of its name, the COM call ends up being toGetHashFromAssemblyFileinstead of toStrongNameSignatureGeneration.See the fix: #49