|
|
Comments and Discussions
|
|
 |
|

|
Is it possible to remove a reference to public key token inside .baml resource embedded into assembly?
it's simple to remove the outer .dll level pubkeytoken, but reosource one......
any ideas?
good luck!
|
|
|
|

|
I removed Strong-Names from a DLL within a program using this tool, and it does not run anymore; it crashes on startup. When I click Debug I get "A strongly-named assembly is required". I tried also patching the main executable but the result is the same. I even tried ticking all the assembly names and "Patching references" on both files (DLL and executable). Should I do it on _ALL_ the DLLs of the program? Is there a way to find the offending file?
|
|
|
|

|
Cant reflexil in reflector addin do this
|
|
|
|
|

|
Hi,
I had to change a .NET .dll to have 32-bit flags so it could run on 32-bit instance of Amazon EC2. Nothing would work until I used your utility to switch off signing. Awesome utility - thanks!
|
|
|
|

|
Is it possible to sign to an assembly that was compiled without strong name or replace a sign of an assembly that was signed using the same approach?
|
|
|
|

|
Hi Vasili,
please, take a look at previously posted questions under this article (on 2nd comments page). This question has already been asked, but has not a quick answer, it all depends on what kind of assembly you're working on. .NET Framework SN tool can sign and resign an existing DLL, but that one should not use particular programming tricks (like Reflection). Decompiling and reassembling thru ILDasm/ILAsm can be another try, but those are unsupported. You can also have a look at Mono Cecil project.
Hope this helps!
Causing an automatic reboot is a feature for a program, not a bug.
|
|
|
|

|
Oh, sorry, I missed the second page Thanks a lot
|
|
|
|

|
System.DivideByZeroException was unhandled
Message=Attempted to divide by zero.
Source=StrongNameRemove
StackTrace:
at vu.ch.argee.WindowsAPI.WrapperClasses.ManagedFileMappingAdaptor.GetAllocationGranularityOffset(UInt64& value) in D:\Chrome\StrongNameRemove21_src\vu.ch.argee.MemoryMapping\ManagedFileMappingAdaptor.cs:line 326
at vu.ch.argee.MemoryMapping.FileMappingView.Initialize(IntPtr fileMappingObjectHandle, MappingAccess viewAccess, UInt64 fileOffset, UInt32 numberOfBytesToMap) in D:\Chrome\StrongNameRemove21_src\vu.ch.argee.MemoryMapping\FileMappingView.cs:line 147
at vu.ch.argee.MemoryMapping.FileMappingView..ctor(FileMapping fileMapping) in D:\Chrome\StrongNameRemove21_src\vu.ch.argee.MemoryMapping\FileMappingView.cs:line 46
at StrongNameRemove.Utility.PatchAssemblyStrongSigning(String fileName, UInt32 cliHeaderFlag, Int64 cliHeaderFlagOffset, Int64 strongNameSignatureOffset, Int64 publicKeyIndexOffset, UInt32 assemblyFlag, Int64 assemblyFlagOffset, Int32 blobIndexSize) in D:\Chrome\StrongNameRemove21_src\Utility.cs:line 329
at StrongNameRemove.MainForm.btnPatch_Click(Object sender, EventArgs e) in D:\Chrome\StrongNameRemove21_src\MainForm.cs:line 241
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at StrongNameRemove.Program.Main(String[] args) in D:\Chrome\StrongNameRemove21_src\Program.cs:line 23
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
|
|
|
|

|
Thank you giammin for reporting this crash. This is related to MMF code. I've submitted a new version of application (2.2) and code to CodeProject. Just wait until they publish and approve it. Thank you for your patience and time.
Causing an automatic reboot is a feature for a program, not a bug.
|
|
|
|

|
thank you for your quick reply!
let me know if you need more info about
|
|
|
|

|
Just a heads up - ran on Win 7 x64, got a failure, copied program and target files to 32bit xp virtual box and it ran fine. Thanks.
|
|
|
|

|
I encountered the same issue. Changing the platform target to x86 allows it to run on Windows 7 x64 without crashing.
|
|
|
|

|
This crash is related to MMF library. Completely removed in version 2.2.
Causing an automatic reboot is a feature for a program, not a bug.
|
|
|
|

|
Hi,
- We have application common.dll using Nhibernate 1.0.2 that uses log4net.dll version 1.2.9.
- We also use xxx.dll that MUST use log4net.dll version of 1.2.10.
At the moment we can't used xxx.dll in the aplication while it would mean we have to use two log4net.dlls.
We try to remove signed dll with your application doing next, while we try to insert log4net.dll v 1.2.10 into our application and trick nhiberante.
1. Remove strong naming from log4net.ddl v.1.2.10
2. We used for nhibernate.dll to point to unsigned assembly log4net v 1.2.10
But the Nhibernate discard to load log4net v 1.2.10.
"[System.IO.FileLoadException] {"Could not load file or assembly
'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)":"log4net, Version=1.2.9.0, Culture=neutral,
PublicKeyToken=null"} System.IO.FileLoadException"
Can it be that also version of referenced dll is checked.
Thank you for your help.
Regards,
Dusan
|
|
|
|

|
This one seems a little challenge. I really don't see how removing strong naming can help with your problem. Even if you could reference log4net 1.2.10 from nHibernate, xxx.dll should be patched too, because it would try to load a signed log4net dll. Moreover, removing strong signing from log4net 1.2.10, doesn't mean nHibernate can load it, even if patched, because it would look at another version (previous 1.2.9) - this can be patched too, but probably something wouldn't work at runtime, because subtle differences in log4net implementation.
At last, I would try another approach: keep your application ad xxx.dll as they are. Start from nHibernate source code (same version you are working on or a recent one) and modify that, removing references to log4net 1.2.9 and adding 1.2.10. If nHibernate can compile without problems, you would get an nHibernate custom version using log4net 1.2.10, but also signed. If it can't compile anymore, you should try to understand how to upgrade it to new log4net methods (I'm not using log4net, so don't know how it changed from 1.2.9 to 1.2.10). Maybe you can also ask some help from nHibernate community and request them to bind to new log4net version.
My general idea is to avoid byte patching if using open source code projects (and you are lucky enough to use them).
Hope this helps!
Causing an automatic reboot is a feature for a program, not a bug.
|
|
|
|

|
Hi,
Thank you for very quick response. We have try to solve this as you proposed, but the compilation of NHibernate goes Ok, but in runtime we got problems, not with log4net but with nhibernate!
We still investigate this problem ...
Thanks once more for help...
|
|
|
|

|
Imagine there are three assemblies. Assembly A, assembly B and assembly C. Assembly C is referenced by assembly B and assembly B is referenced by assembly A. All assemblies are signed. If you unsign assembly B, your utility offers to unsign assembly C too by clicking on button "Patch references". But! If you want assembly B to work, you must patch the reference to it in assembly A too. And that is something your utility cannot do. At least programaticaly. Now I must find all assemblies referencing assembly B and patch them manually (or using your utility).
|
|
|
|

|
That is an intended problem and not so easy to solve. It's easy to know what assemplies are referenced by a DLL, but it's not immediate to know who is using current DLL (it could require scanning all DLL/EXE in a folder of perhaps complete disk). This could surely be done, but it's far away from my proof of concept tool.
Causing an automatic reboot is a feature for a program, not a bug.
|
|
|
|

|
Hi!
I found two small bugs, which I fixed locally:
1) If the selected file's path contains spaces, upon restarting elevated, the path is considered as several arguments.
Fix: In VistaSecurity.cs, method RestartElevated(string arguments):
startInfo.Arguments = string.Format("\"{0}\"", arguments);
2) In non-English Windows installations, the name of the administrator role can be different.
Fix: In VistaSecurity.cs, method IsAdmin():
return p.IsInRole(WindowsBuiltInRole.Administrator);
|
|
|
|

|
Thank you for spotting those out!
Causing an automatic reboot is a feature for a program, not a bug.
|
|
|
|
|

|
The article is great, but the application didn't work with me.
Any way, I've managed to patch the exe file manually. And I have this error on running the exe
"Could not load file or assembly 'Name, Version=1.0.869.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
Also, I've altered its PublicKeyOrToken in the assembly ref of the exe to be null, as I edited this dll.
Got any clue what I've done wrong or what's missing ?!!
Familiarity sometimes keeps us from seeing the obvious.
|
|
|
|

|
This is normal exception from CLR when something is not correctly patched. Maybe it's another DLL reference or some DLL loading by reflection. You could send me an example by e-mail of what you are doing and I'll try to understand why my application is not working for you.
Causing an automatic reboot is a feature for a program, not a bug.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
This article describes how to remove Strong Signing from .NET assemblies without recompiling code.
| Type | Article |
| Licence | CPOL |
| First Posted | 28 Aug 2006 |
| Views | 117,687 |
| Downloads | 3,733 |
| Bookmarked | 161 times |
|
|