How much work is it to figure out which sections of the executable to export?
Would it be realistic to be able to export a modern-ish (2008-2015) Win32 game into objects and then compile/link it into a full executable again with less than a few hours work?
> How much work is it to figure out which sections of the executable to export?
As long as you do not cut across a variable or a function, you can export pretty much however you want, you don't have to follow the original object file boundaries. What to export is a separate matter and requires some knowledge about the program. Having debugging symbols makes this much easier, otherwise by the time you've made the Ghidra database accurate enough for exportation you'll usually have an idea of where's what.
> Would it be realistic to be able to export a modern-ish (2008-2015) Win32 game into objects and then compile/link it into a full executable again with less than a few hours work?
About the user report in my submission, they first raised an issue in early July and by mid-August they got a fully working, functionally identical relinked executable. To be fair, the COFF exporter had a lot of bugs that needed to be fixed and the i386 analyzer needed some touch-ups, things that somebody else should hopefully won't stumble over now.
I don't know how long it would take, but unless you have debugging symbols and are really lucky it will take more than a few hours of work. A skilled reverse-engineer can probably manage to get something executing in that timeframe (even if it crashes halfway during the first loading screen), but it's one of these tasks that you won't know when it will be done until it is done.
> As long as you do not cut across a variable or a function, you can export pretty much however you want, you don't have to follow the original object file boundaries.
Would it be possible to export basically the entire program at once and then slice off individual functions one by one?
Do you have any guides/examples of the
> Decompilation projects, by splitting a program into multiple object files and reimplementing these Ship of Theseus-style
> Would it be possible to export basically the entire program at once and then slice off individual functions one by one?
Yes. The exporters can handle whatever meaningful address selection you can throw at them, including multiple disjoint ranges within the same section. So you can keep carving holes inside your selection until nothing remains of the original program.
> Do you have any guides/examples of the Ship of Theseus-style style project?
Not quite. My own decompilation project is on a hiatus due to one version tracking session too many in a row, so I only have one article on this so far [1] and the way I've done it is a bit wonky.
Another user has recently started a decompilation project [2] with a better framework than I've used in that article, but no actual decompilation has taken place there yet. Incidentally, that would also make for a good modding framework, if one decides to not write functionally identical replacement code.
> Yes. The exporters can handle whatever meaningful address selection you can throw at them, including multiple disjoint ranges within the same section. So you can keep carving holes inside your selection until nothing remains of the original program.
Will this also work without painstakingly reversing things in the binary, say in the case of a giant game executable?
If possible, I would be very interested in a simple tutorial that takes an arbitrary Windows executable, delinks it and replaces a single function, without all the extra steps necessary to run it on the PS1.
It might even be preferable if it worked with MingW, since I'm on Linux as well.
> Will this also work without painstakingly reversing things in the binary, say in the case of a giant game executable?
You can get away with a Ghidra database that isn't accurate, as long as you know what you're doing. Basically, as long as the analyzers manage to identify all of the relocation spots inside your exportation, the rest doesn't matter that much. You can even get away with missing relocation spots inside your exportation, if you don't end up executing that code or accessing that data at run-time (if you do, then exotic undefined behavior ensues).
The most important thing here is getting references right and addresses typed as pointers (the type itself doesn't matter). I'm not going to discuss this into more details than that, because it would require a deep understanding of the internal algorithms of the extension. Any shortfall between a less-than-accurate Ghidra database and experience will be filled in by luck.
> If possible, I would be very interested in a simple tutorial that takes an arbitrary Windows executable, delinks it and replaces a single function, without all the extra steps necessary to run it on the PS1.
It's essentially the same steps regardless of the platform. Select the bits you want in your object file, run the analyzer, invoke the exporter, use the linker to create a new program.
I've made my Ghidra extension as user-friendly as possible, the rest is standard native development stuff (up to the point where you hit exotic undefined behavior and can't figure it out at a glance, hopefully you're well acquainted with your debugger if that happens).
> It might even be preferable if it worked with MingW, since I'm on Linux as well.
Actually, I've created a native port of a proprietary, statically-linked, Linux a.out i386 to Windows with MinGW [1] using my delinker. It was back when I didn't have a COFF object file exporter either, so it was the only toolchain for that target that could ingest ELF object files.
That being said, MinGW and MSVC are reportedly only compatible at the C ABI level. Mixing and matching different toolchains can increase the odds of something going wrong, so you're probably better off using the toolchain that the program was originally built with (hopefully it runs on Wine).
PS: remember that you are throwing your CS 101 handbook into the trashbin when you're using a delinker (and its teacher is unlikely to be of much help).
For heap-allocated objects, there is a way to do borrow checks at runtime if you want (there's something called constraint references, explained in https://verdagon.dev/blog/raii-next-steps.)
For structs that I do not want to heap-allocate, they're usually POD types and in arrays (which you can bound check), so there's not much to think about borrowing. The more concerning issue I usually have is about about initializing the values correctly (which usually Rust doesn't help, when reasoning about performance-sensitive code).
> For structs that I do not want to heap-allocate, they're usually POD types and in arrays (which you can bound check), so there's not much to think about borrowing.
Both situations which also apply to Rust. Whenever the borrow checker complains you can do exactly the same thing.
> The more concerning issue I usually have is about about initializing the values correctly (which usually Rust doesn't help, when reasoning about performance-sensitive code).
You can use a type-state machine, where the only way to construct the final value is by calling all of the appropriate methods that change the type parameters on the Self type. When that gets compiled it ends up as either a single memcopy of values, or you can make the Self type hold a MaybeUninit value to make the partial construction with no copy at the end possible. I actually implemented that for fun and as it turns out already existing crates that held every field in an Option and then built the final value from those ended up being faster. C'est la vie.
I don't think it is fair to conflate the "abstract machine" of C with the virtual machine. There is no software virtualization at work when running C code, it is compiled directly to assembly.
> And how is these countries joining NATO benefiting the existing NATO members?
Stability in Europe. The west doesn't want refugees from whatever country Russia decided to invade this week to show up on their doorstep all the time, or the supply chain interruptions that happen when war constantly breaks out. You might remember that NATO arose almost immediately after World War 2 which had a rather negative effect on Europe and European influence in the world.
> Obviously, Russia has nothing more to lose given the sanctions, so, the only thing left is a direct NATO conforntation,
Russia has plenty more to lose. Namely every major European power and the US unloading all their armaments on Russian cities that are very close to the border.
> but it seems that the West is more afraid of such conflict than Putin, who believes that this is inevitable and that if you're faced with an inevitable flight, it's better to strike first.
This is an absolutely unrealistic take. Russia _can not_ win major combat against NATO in any shape or form. They couldn't do it with their made up propaganda army and they certainly can't do it with their actual army.
> It all looks rosy now, but remember just a few years ago when Turkey shot down a Russian jet on the Syrian border and almost led to NATO involvement?
Remember when Russia invaded Ukraine and it didn't lead to NATO involvement? We have direct evidence that a European country can be attacked without NATO immediately jumping in to help. If Russia "only" wanted the Eastern "wilderness" of Finland, do you think the other European powers would immediately send in their own troops?
There's a reason that the smaller European countries that border Russia haven't been attacked and absorbed yet, and that's because they're NATO members.
Being a NATO member clearly has more upsides than downsides.
> We have direct evidence that a European country can be attacked without NATO immediately jumping in to help. If Russia "only" wanted the Eastern "wilderness" of Finland, do you think the other European powers would immediately send in their own troops?
So while the exact action is not specified there, an attack on Finland might already very well mean that some NATO states (and by implication all of NATO) would get involved in the situation you're describing.
> there is the Mutual Defence Clause (article 42.7 of the Treaty [of Lisbon]
Article 42.7 “leaves more room for interpretation than one might expect for a clause in a legally binding text” [1].
If Finland and Sweden turned down NATO membership and then suffered territorial degradation, I doubt the U.S. would step in. That, in turn, might motivate EU members to exercise their opt outs or neutrality caveats, or find that all that can be done within their power is send non-lethal aid.
To expand on this: It also explicitly provides for an opt-out to preserve the neutrality of countries like Sweden and Ireland, such a clause being added at their insistence.
I suspect that when the rubber hits the road nothing would happen, are Western European countries going to get into a potential nuclear exchange with Russia defending an EU member that's got a carve-out allowing them not to do the same for them?
That doesn't apply for Finland in the same way, but I'd still expect more of a "thoughts and prayers" response from the EU than anything else.
Well, I'm pretty sure Europe is capable of sending nuclear missiles that would destroy any FOB Russia set in Finland (this wouldn't trigger Russia doctrine of only using nukes to defend its territory, not its troops).
Invasion would become way to costly for a demographically challenged country.
Would EU countries waste their nukes in attrition of RU troops on aligned soil? There aren't that many (by official figures). I'm guessing most countries would prefer not to escalate to nukes unless their own territory was threatened.
This is not how NATO works, and very likely not how the mutual defense clause works. Article 5 doesn't apply if you send your soldiers on some mission (e.g. defending Finland) on your own accord and Russia kills them. The EU clause is generally interpreted - from what I've read - to not require other EU members to offer direct military support to the attacked nation.
> Article 5 doesn't apply if you send your soldiers on some mission (e.g. defending Finland) on your own accord and Russia kills them.
That depends where you send them, as Article 5 has geographical constraints specified in Article 6 (there is no general exceptions for troops being attacked after being voluntarily sent “somewhere”.)
Moreover, even without triggering Article 5, an attack on NATO member troops in the Euro-Atlantic region but outside the territory specified in Article 6 would probably be a trigger for regional security consultations under Article 4, which have produced more NATO interventions than Article 5.
Just because the EU gets involved, doesn't mean NATO will follow suit.
There's an argument that EU is the aggressor for the purposes of Article 5 if it comes to the aid of a non-NATO member. The USA and other non-EU members would have the option to sit that one out, if they wanted. Alternatively, they could offer support to only NATO members.
This is probably part of what's spurring NATO membership. I bet most Fins and Swedes thought that the USA would deploy forces the event of a conflict. Now they see that American policy will be aid only, regardless of the death and destruction.
> There's an argument that EU is the aggressor for the purposes of Article 5
There is no such thing as “an aggressor for purpose of Article 5“; and the only case to be made for an “aggressor” status that would obviate Article 5 commitments is an aggressor under international law (that is, someone engaging in aggressive war in violation of the UN Charter, North Atlantic Treaty, and customary international law.)
Participating in individual or mutual self-defense action outside the scope of NATO doesn't void Article 5 (we know, because it didn't, despite definitely being part of the scenario, in the only actual Article 5 invocation in history.)
Mutual defensive pacts are not transitive. Germany being in NATO does not mean that every country Germany has a defense pact with is de facto in NATO.
Finland probably doesn't want to find out the hard way how the USA is going to decide to roll here. Being a NATO member removes all doubt as to what happens.
The EU defense clause is no NATO replacement and in a state of war it is highly unclear would it even merit material transfers. Currently it's more of a gesture or suggestion for future collaboration.
Unfortunately, no, not by implication. Chapter 5 only means defending a country that's attacked. So if Russia invades Finland, and say France send troops to defend it, and Russia retaliates against France, then US, UK, and Turkey are not obliged to defend France. As far as NATO is concerned it's France's affair.
In reality of course the the non-EU NATO members will probably decide to get involved one way or the other, but they are not legally bound to it.
> Chapter 5 only means defending a country that's attacked.
This is true, but there are no limitations on the circumstances of the attack. For instance, if the US was fighting a low-grade global war with an Afghanistan-based terrorist network that has not previously attacked the US anywhere covered by Article 5 because of the geographic constraints of Article 6, and in retaliation for the acts of the US in that war that global terrorist network attacked, say, New York and D.C., then Article 5 would apply, there is no “well, you chose to fight them for other reasons before they attacked you” exclusion.
Now, if Russia only retaliated against French troops in Finland, Article 6 would geographically exclude Article 5 applicability.
I think there is a pretty large chance countries like Germany figure out some way to ignore that. IMO the only thing keeping a European country exempt from Russian military action is the presence of US forces.
>Remember when Russia invaded Ukraine and it didn't lead to NATO involvement? We have direct evidence that a European country can be attacked without NATO immediately jumping in to help.
Yes, because Turkey is in NATO and Ukraine isn't. It has nothing to do with Ukraine being in Europe. Not all of Europe is in NATO, and not all of NATO is in Europe.
I don't understand this argument. Turkey is a NATO country, Ukraine is not a member? So, why would it lead to NATO involvement. If Russia had attacked turkey due to Turkey's strike on Russia Jet it would be debacle.
If Finnish land helped Russian national interests, it would have been taken in 1944 or 1945. By early 1943, Russia was pushing back Germany, and Finland would not have been a problem.
Finland would be in more danger if it joined NATO, not less.
"Finland would be in more danger if it joined NATO, not less."
What nonsense is this.
Russians respect force. The more the better. NATO gives Finnish Defense Forces enough credibility to deter any Russian aggression specifically targeting Finland for the next 50 years at least by making the cost of invasion psychologically and analytically too high.
It has a lot of upsides for the military establishment, remember when Russia was not a threat and NATO decided to have 3 trainings in Ukraine and start talks about a Russia bordering country joining a Russia enemy conglomerate? Remember when a bordering state of US tried to put enemy weapons on their territory and the US almost deleting that state from earth logs?
I think US right now, especially if this announcement is true is the main european Enemy, US is expanding it's world oversight by expanding NATO on European borders at expense of European stability, this is due to the shallowness of european leaders
This is about Russia attempting a genocide of the Ukrainian people.
This is not the first time Russian state attempted such a thing. Holodomor was an engineered famine with the intent of destroying Ukraine. And now they are at it again https://en.wikipedia.org/wiki/Holodomor
Generally as a state Russia is just horrible to all of the nations at it's borders it feels it has enough force to subjugate.
They are not idiots - they realize NATO would never invade Russia.
However, what NATO would have done, is give Ukrainian so much force projection capability within their territory Russia could never threaten them militarily again.
This about a narcissistic bully wanting to subjugate as many people by fear under it's thumb as possible.
But one training can still be seen as a threat on the border of a superpower? IS Army.mil news credible enough for US people outside the reach of russian propaganda? Does it reply your question when was US training on the border of Russia? Can we accept US as a enemy of europe? Or better, can we accept the fact that US is only giving important to ITS own interests without care of the safety of anyone else? (makes sense, it should be european leaders representing europeans interests), but someone should be able to say, european leaders currently suck, damaging their people in order to represent US interests in ukraine
Yes but you asked me when was the time when NATO trained on the border with Russia, now you move the goalpost? I think Russian invading Crimea is despiseful and the referendum is fake because there was no campaign or anything, but I also understand that superpowers earn different treatments due to the fact that they can cause nuclear blasts and end the world in minutes. Russia invaded Crimea when the political sentiment in Ukraine started considering the sentiment of joining NATO/EU, https://en.wikipedia.org/wiki/Revolution_of_Dignity#United_S...
I think the issue is that US has been involved in the political environment of a EU bordering country, without any opposition from European leaders.
> Yes but you asked me when was the time when NATO trained on the border with Russia
No, I asked, and I will quote directly, “When was this time that Russia wasn't a threat and Ukraine was having trainings with NATO?”
That was the claim: that NATO conducted multiple trainings with Ukraine when Russia was not a threat, and that this was the casus belli for Russian aggression. Leaving aside that this would not be legitimate casus belli in any case, it is simply factually false: all the NATO trainings occurred during the war, after Russian aggression against Ukraine began. There cannot retroactively justify the aggression.
This is absurd. US has been the guarantor of European peace and indenpendence after the second world war.
European union basically started as a Washington think tank project.
Yes, US wants to advance it's own interests. No, it does not make US enemy of "Europe". Which is a silly way to put it. "Europe" is not a single polity or a state (not yet at least). It is still a collection of independent nation states. Most of which want to be aligned with US.
Nobody is forcing them to be aligned with US.
China or Russia would be happy to welcome them into their fold of corrupt autocracy.
Europe and US are strongly aligned economically, culturally and politically, while the world around them turns authoritarian.
Sure, they sometimes play against each other.
But, US and the nations of Europe are first and foremost allies.
The fact that you think that a union of european states is a product of US think thank is straight bullshit, like that even if you don't know that there were italian politicians saying that union of european states would be the best way to have stability in europe in 1800s (Like Giacomo Matteotti in Italy, but I'm sure others in other nations had the same idea), you would still have to ignore the fact that in 1920 we had already a league of nations
> Not undefined. Ukrainians. Some of whom died for their convictions.
Thank you. So a group of Ukrainians organised a coup against a legitimately elected president instead of substituting him with another legitimately elected individual at the next election cycle. This is a valuable insight for everyone who claims that Ukraine is a democratic state.
> Nonsense. Who else would control Ukraine except Ukrainians themselves?
Was there a referendum for joining the EU or was it a political program? You know, at least something that would resemble the UK referendum for leaving the EU. Otherwise how else do you know what the majority of Ukrainians want long-term as a nation?
> It was a part of struggle of open society versus autocracy.
oh yes, the open society of the Panama and Pandora papers [1][2]. Two consecutive presidents that can't help themselves from being anti-autocracy.
"the open society of the Panama and Pandora papers [1][2]. Two consecutive presidents that can't help themselves from being anti-autocracy."
Western institutions stand firm. The fact that you have even heard of panama papers is a proof of this fact.
Democracy is not a joke, it is standing fast. Regardless of the attempts of the autocracies to claim otherwise, or sow dissent by nefarious "whataboutism".
Nobody is "good", everyone does mistakes. They key to understand in the west is the belief of the people in the institutions, and the self correcting dynamic a western style of government instills into a nation.
To get a high level understanding of the situation I recommend Darren Acemoglus "why nations fail" which tries (and in my mind succeeds) in explaining what distinguishes western style of government from more closed autocracies (and how and why it's better in many ways, even though not perfect).
ghostwriter does seem to repeat all of the well known Kremlin talk points. If anyone is unsure what Putinist propaganda specifically is like just read through his messages in this discussion, he is iterating on the familiar themes. Whataboutism, denying Ukrainian statehood, etc.
Everyone is of course free to express their opinion on this forum and that's why I cherish this site so much.
I mean why should it be reported? If someone is agreeing with a policy then it would consistently agreeing with such policies? Like it has been 2 months that European leaders have fought for US interests but do you see people saying “ok you can’t trust this politicians anymore cuz they’ve protected us interests for a while already”, I’m Italian without any interest in Russia and still if you check my history I am more against the only country who dropped 2 atomic bombs killing 200k civilians , than Russia, am I not repliable?
I don't even agree with the policy. I'm just trying to get to the truth instead of blindly following the media narrative. No claim about war crimes should pass without further thorough investigation. I don't understand why my previous post had to be flagged. It is a matter of fact that the western media for the most part has lost any interest in investigating and covering the Kramatorsk shelling after the rocket's serial number had been revealed in a footage of an Italian media [1]. One would think that once you have the number it would be relatively easy for NATO to precisely identify and name the perpetrator, but the media is silent on that matter since two days ago.
"I'm just trying to get to the truth instead of blindly following the media narrative."
The simple truth is that Russia is currently engaged in a genocidal war with the intent of erasing Ukrainian people, which utilizes intentional terror on the civilian population. Everything else can be approximated based on that information.
This is one of the few clear cut conflicts between unspeakable evil and a distinct people who are being eradicated real time.
The ethics of the situation are exactly as clear cut as a Hollywood movie. Russia is the big bad. The Ukraine are the hero. And they are dying by the thousands.
> The simple truth is that Russia is currently engaged in a genocidal war with the intent of erasing Ukrainian people
If that were true then Melitopol would be the first erased Ukrainian city, but we see that's not true [1]. Perhaps it's because Azov battalion didn't have a chance to position their artillery on the backyards of civilian flat blocks in that city.
> This is one of the few clear cut conflicts between unspeakable evil and a distinct people who are being eradicated real time.
No it's not, there are far fewer civilian casualties in Ukraine than in Iraq during active months of 2003 alone [2]. Neither NATO nor UN nor the western world in general identifies civilian casualties in Iraq as victims of a genocide.
UN has a specific definition of genocide: it's "acts committed with intent to destroy, in whole or in part, a national, ethnical, racial or religious group."
But a “substantial part of the populace” is “also guilty” and would require “reeducation” and “ideological repressions” lasting “at least a generation” and would “inevitably mean de-Ukrainization.”
The intent to destroy Ukrainian identity, and the actions taken so far, is what makes this look like a genocide. Not the relative number of victims.
Of course until "an official body" declares this a genocide - which is not 100% sure - we can always pretend it's just "a normal war".
The media is silent because it is bullshit.
They don't report stupid Soviet lies.
I am a machinist. Do you know how easy it is to fake serial number stampings?
One guy with a hammer and number set.
Are Russians that stupid?
They think a serial number is some kind of authenticator?
Heck from the pictures I saw it was spray painted on.
> I am a machinist. Do you know how easy it is to fake serial number stampings? One guy with a hammer and number set.
And you, as a machinist, know it as a matter of fact that this particular serial number on that particular engine block was fabricated? What are your proofs of the claim? Could you name a single media outlet or a single investigative journalist who is collecting evidence of that potential fabrication at the moment?
What kind of mental gymnastics are you jumping thru to think a full-scale foreign invasion is acceptable because a president that's suites your political wills gets ousted thru civil protests?
In a parallel universe where Trudeau promised closer ties to the EU and pivoted mid-term to get closer to the USA, would the USA be entitled to invade and annex us should we decide to throw him out?
People died there. 67 of the protesters died after being shot. They were killed. However, 18 police officers died, too - and probably not to friendly fire. That seems to suggest there was violence involved. Most of that violence was done by the police. Still, that death toll on the police side cannot be just an accident. There was fighting happening there. The police used violence, but the protesters reciprocated in kind.
I'm not saying who was right or wrong. Obviously, 750 people with gunshot wounds is too much for any police action. The officers evidently failed to get the situation under control, and, of course, they are paid to do just that, so the large part of responsibility lies with them. They shouldn't have needed to shot to kill. But, the protesters also could have gone home. Or they could have stayed there, but without resorting to violence (though they would be tortured and some of them would get killed anyway). What actually happened, though, resembled regular urban warfare, if Wikipedia description is to be trusted. One side was out-armed, the other outnumbered, but there definitely were two opposing forces, fighting for territory, taking and re-taking important points, moving wounded to the rear, making surprise attacks or night raids, and fighting them off, involving third parties, and so on.
Again, none of that justifies the invasion by Russia. Annexation of territory, and the war that ensued are both Russia's responsibility and crime. Obviously, Russia is an aggressor here, and it violated sovereignty of Ukraine, no matter the reasons. I'm writing this much about the obvious, because last time I pointed this out I got into a lengthy, very frustrating, discussion with someone who accused me of being on Moscow's payroll. I'm not. I'm not justifying any action of Russia, and I'm not endorsing their aggression, and I don't feel (at very least) like I advance their agenda.
But. More than hundred dead and more than a thousand wounded is not, in my opinion, (EDIT: just a) "civil protest".
Civil unrest is more what I meant, with those people much in mind, felt like a better term than coup. But I don't think "protest" is necessarily wrong, it doesn't count out violent ones AFAIK (lethally repressed, riots, etc), i.e :
Why would US invade Canada for wanting closer ties with EU? Like EU is damaging its population for US interests? Like you maybe misunderstood my point, but it is enemy entities that are not liked on the border of superpower, let Canada say that they want to join CSTO and see what happens
They got invaded the day after a president that turned the country away from the EU to Russia was ousted, not NATO to CSTO. They're getting shelled for exercising economic sovereignty, not military ones.
If Canada was to get wrecked for joining the Schengen Area (or somehow the EU or China's RCEP), which FWIW I don't see happening, it in no way would justify one or the other superpower pre-emptively crushing sovereign countries. Just like other cases of the US encroaching on foreign countries for dubious reasons don't excuse or justify Ukraine in any way.
You probably think that you do, but in reality you don't.
Large corporations have been proven to fix wages for tech workers[1]. There's literally no way that you could have any possible way of bargaining your way around that as a single person.
>>There's literally no way that you could have any possible way of bargaining your way around that as a single person.
Actually you do, by walking across the street and getting a big fat raise to join a different company. That is one of many reasons engineers by and large don't feel a need to have someone else bargain for them - they negotiate with their feet.
Sure, but there's no guarantee they'll do that in every case or at every employer. Here there was a smoking gun, so the government could easily act on it; do you think that'd be the case for everyone in our field?
Would it be realistic to be able to export a modern-ish (2008-2015) Win32 game into objects and then compile/link it into a full executable again with less than a few hours work?