I've tried to bind a 64bit executable (I'm using Win7 x64) using bind.exe which seemed perfectly happy to bind the 64 bit exe and its output using the verbose option seemed reasonable. In spite of that, it resulted in an executable that crashes during initialization - various pointers pointed to the "wrong" place and "no place".
Just in case, I tried binding the imports using CFF Explorer but, the result and the problem(s) were the same.
My question or better stated, my request is: does someone have an authoritative answer as to whether or not a 64 bit executable can or cannot have its imports bound and the reason(s) why ? If the answer is affirmative, the question is how ?
Thank you for your help.
The answer is yes. The imports of a 64bit executable can be bound. There are a number of dlls in Windows 7 64bit that are bound.
However, the bind.exe distributed with MS VS2017 does not bind 64bit executables correctly (at least not at the time of this writing.)
I have not come across a way to correctly bind 64bit executables. Therefore, the "how" stays unanswered.
Related
This question already has an answer here:
How to tell if program is running on x86/x64 or ARM Linux platforms
(1 answer)
Closed 4 years ago.
I want to create a C code that somehow contains two separated blocks. I want to use a function or a tool that extracts the CPU model, and based on that, the program decides which block of code it executes. I only have the idea and I don't know how to implement it !
The first block of code will be executed on an Intel i7 and the second should be executed on ARM Cortex A53.
PS : I am a beginner and I have nothing to do with hardware and similar stuff. Thank you for your help :)
As clearly pointed out, first off you cant have a C program that runs to a point to determine ARM from x86 as that code has to already be ARM or x86. These are different instruction sets. You can use say python or JAVA or some other scripty/virtual machine language. But then you have a COMPILE time decision to build for one target or the other, at that point you already know which target as you are actually running code on it, so if this is strictly ARM vs X86 there is no reason to check runtime. Thats not to say that each architecture and/or system will have a way to check the architecture and flavor you are on ARMv6 vs ARMv7, for example, but not necessarily ARMv7 32 bit vs ARMv8 64 bit although you technically can run aarch32 and aarch64 instruction sets on most ARMv8s just not intermixed, have to have the os or execution level changes yourself to switch between them.
You do understand there are different incompatible instruction sets, specifically the ones you described and C code is compiled to one or the other. So you cannot have a program in C compiled for a target that can detect the other target. You have already selected the target before you get to this point. Now there are emulators, but they tend to target one architecture as well. There are/were products from specific vendors that would emulate one instruction set and convert it runtime to the other, over time as you re-run that code it continues to convert it. You could try that, but you still have to be running code for the right target on the right logic/emulator, and then have a now special detection that is not the norm to find the true underlaying architecture, not the faked emulator.
I suspect you are thinking you can have one architecture specific module that detects the architecture to run architecture specific code. This does not work with C in general, does not make sense to try, thus there probably isnt a good tool for this. In particular since the solution for such a thing is either you build this into the binary file format and the operating system picks because it knows, or you wrap your binary with a target independent language like Python or JAVA or scripty language like perl, bash, etc. that can independent of target determine the architecture (in that case solutions vary widely specific to operating system and language for starters) and then choose which binary to run.
There are many ways to achieve what you want. To check which model is present you first have to read which model you have. how to do that varies between Windows and Linux. i found this SO-topic helpful and it might also be a good start for your research: How to check CPU name, model, speed on Windows/Linux C?
I am working on one migration project from x32 bit to x64.
Here I am using this code:
{$L com_1.obj}
{$L com_is1.obj}
{$L com_2.obj}
But while compiling code I am getting error as
[dcc64 Error] XXX.dpr(919): E2045 Bad object file format: 'E:\MyProj\com_sha.obj'
I am not able to trace why it is happening.
Is it due to 32 bit obj file used for compiling x64 bit delphi project?
If it is I have also tried to create a obj file with x64 bit environment.
Can anyone please help me on this?
I am using Delphi 10 Seattle.
You cannot use a 32 bit object with the 64 bit compiler. You must recompile your code with a 64 bit compiler.
You can use a number of different compilers to do this. Although I have heard of people succeeding with gcc I have never managed to do that. I believe that the modern Clang based Embarcadero compiler can be used, but I personally have no experience of that. I have always used the Microsoft compiler to create 64 bit objects. And certainly this is how Embarcadero themselves have done it for libraries like zlib that they link to their RTL.
Yes you need to convert those .obj files to 64 bit.
Converting 32-bit Delphi Applications to 64-bit Windows states:
64-bit External .obj Files: If you expect your 64-bit Windows application to link to an external .obj file, keep in mind that you will need a 64-bit version of the .obj file to link with a 64-bit Windows application.
I am having trouble moving my WPF project from 32 bit to 64 bit. I recently realized I need my program to be able to use more than 2gb of memory.
What I did was I changed my project's platform target from Any CPU (with preferred 32 bit checked) to x64.
I then got an error stating “XXX” does not exist in the namespace “XXX" and realized it was probably because I did not change the CPU target for my other libraries.
Then when I launched the program in my developer machine, it works perfectly fine using both visual studio and Click Once installing after deploying. However, when I test the deployed executable using a few different 64 bit machine, the program starts behaving erratically with some functions not working properly.
I have no idea how to debug since it works perfectly fine in my developer machine but not on any other computer? Am I not changing the target platform correctly?
The assembly ITSELF built by youself when targeting "Any CPU", but you should check out every third-party assemblies that used in your project if they are targeting "x86". If you change the target of your own project to "x64", make sure all of the dependencies are for "Any CPU" or "x64".
I just set up Interix on my new workstation here at the lab. Originally, I was just going to set up the x64 tools (you know, the ones from Interop), but when I did that, some things didn't work. Then I went ahead and installed the x86 tools. I'm assuming the 32-bit tools are getting used.
I went ahead and transferred over a file I was working on with Interix on an x86 machine. Basic C program, nothing fancy. Just something we're working on in class. I can open it using NEdit and Vim and the like, but it won't compile, no matter what shell I issue the gcc command in. Here's the error I'm getting:
gcc: error trying to exec 'cc1': execvp: No such file or directory
As I'm relatively new to POSIX-compliant systems, I'm not sure how to fix this. Can one of you fine individuals tell me how to fix this in layman's terms?
EDIT:
If you're looking to do UNIX work on Windows... just use Cygwin. I'm editing this to tell you this because you are probably lost and looking up answers on Google. Windows 8 removed Interix anyways.
For many years we have been using xp_pcre for regular expressions in sql server:
xp_pcre - Regular Expressions in T-SQL
I've just migrated to a new 64 bit vista development machine and have installed xp pcre. Unfortunately when i try to use the sprocs I get the following error: Could not load the DLL xp_pcre.dll, or one of the DLLs it references. Reason: 193(%1 is not a valid Win32 application.).
Has anyone had any success installing xp_pcre on a 64 bit machine running vista? Any advice? Thanks in advance,
Shane
Since it's a compiled DLL, you would probably have to recompile it to get a 64 bit DLL, that could be run on your 64 bit machine. Since nothing at that page has been updated since 2005, it's unlikely there is an already a prebuilt version for 64 bit. However, since the source code is included, you could, if you have VS for C++, with a 64 bit compiler, compile it yourself and try to get it working that way.