#1
|
|||
|
|||
How to repack a lib file, any tools for that?
I want to make a dll not dependent on the C Runtime,
normally that is easy enough, just exclude standard libs and don't use any thing that requires imports from clr, or import manually what you can from ntdll.dll and for x64, x86, arm and arm64 this approach works just fine. Howe ever it does not for arm64ec here some imports are missing which are no ware to be found in the ntdll, namely: __chkstk_arm64ec __icall_helper_arm64ec __os_arm64x_dispatch_icall __os_arm64x_dispatch_call_no_redirect __os_arm64x_dispatch_ret these are only to be found in libcmt.lib unpacking the lib (using 7zip) and adding a selection of extracted obj to my dll, namely: chkstk_arm64ec.obj chpev2_support.obj guard_check_arm64ec.obj guard_dispatch.obj icall_helper_arm64ec.obj vcall32_helper.obj made the linking not fail, just spit out the following warming LINK : warning LNK4294: missing EC Side version of load config symbol for ARM64X image but the created dll fails to load I tried including a couple more obj files from the lib but to no avail. Apparently there is some additional data in that lib, so I was thinking the best approach would be to use a copy of the lib with everything removed that I don't need. But I'm lacking a tool that would be able to edit a lib file, any one her knows of such a tool or tool chain that would allow me to achieve my goal? Last edited by DavidXanatos; 03-01-2022 at 22:15. |
#2
|
|||
|
|||
problem solved I gave up adding random obj files to early with
loadcfg.obj guard_support.obj added it works I attach a collection of all that's needed to build x86, x64, arm, arm64 and arm64ec binaries only dependent on the ntdll.dll |
The Following 4 Users Gave Reputation+1 to DavidXanatos For This Useful Post: | ||
The Following 3 Users Say Thank You to DavidXanatos For This Useful Post: | ||
#3
|
|||
|
|||
>>LINK : warning LNK4294: missing EC Side version of load config symbol for ARM64X image
Lib files for arm64ec contain an additional member /<ECSYMBOLS>/. PEAnatomist shows it too (lib-files and obj-files are supported with much details) __chkstk_arm64ec __icall_helper_arm64ec __os_arm64x_dispatch_icall __os_arm64x_dispatch_call_no_redirect __os_arm64x_dispatch_ret this is simply a variables initialized with functions pointers to fill a HybridPE header, like a loadconfig header ("loadcfg.c" in MS CRT source, available via VisaulStudio installer) |
The Following 3 Users Say Thank You to RamMerLabs For This Useful Post: | ||
#4
|
|||
|
|||
ah that's nice didn't know that MS is shipping those sources
|
#5
|
|||
|
|||
Here a improved version its a stand alone project that creates 2 (two) lib files booth need to be linked into the target project in order to work.
uCRT.lib provides implementations missing functions and NtCRT.lib provides missing imports from the ntdll.dll |
The Following User Gave Reputation+1 to DavidXanatos For This Useful Post: | ||
user1 (03-08-2022) |
The Following 2 Users Say Thank You to DavidXanatos For This Useful Post: | ||
MarcElBichon (03-07-2022), user1 (03-08-2022) |
Thread Tools | |
Display Modes | |
|
|