-1

This is more of a blanket question than specific, but in my case I have a program I was given, but unfortunately it's broken. (It worked before, which was a while ago)

The program is a C# WPF .exe, but I'm just learning programming and I have no clue how to fix it. I can view the code behind it, I think, when I decompile it (dotPeek, but it seems to be read only), but I've no clue how to edit and recompile the program to work just like previously. I tried googling but I wasn't sure what terms would answer this question and the ones I've used proved fruitless.

Tl;dr - how to modify programs (especially C# WPF .exe)

Atlas
  • 143
  • 10
  • 2
    _" how to modify programs (especially C# WPF .exe)"_ You'll need to get the source code / project of that program. Fixing it from decompilation will end up in more effort than writing it from scratch, probably. – Fildor Oct 09 '17 at 13:59
  • Another question would be: What is the error? Could it be fixed through proper configuration, maybe? Do you have ownership of code? If it is not your code and it is closed source, you may even run into license issues when reverse-engineering it. – Fildor Oct 09 '17 at 14:03
  • 3
    Programs don't tend to break of their own accord - beyond getting corrupted - if that is the case then decompiling wont work. So you need to understand why it has stopped working - it is likely that a decompile & recompile will not work. What has changed from when it worked to when it stopped working (maybe operating system version or PC)? Can you go back to a state where it was working ? – PaulF Oct 09 '17 at 14:03
  • The program is dependent on mysql, but a lot of changes have been happening behind the scenes and the program wasn't used much for a while. I am not sure if you can fix this without delving into source. Sigh – Atlas Oct 09 '17 at 14:05
  • So what you are seeing is that the SQL-Schemas don't match the program's expected Schemas any more? In that case you may have to change the code, but really, **you need the original sources**. – Fildor Oct 09 '17 at 14:10
  • Even though it seems broad, this is actually a pretty good question, especially for folks who are new to programming and not sure what is possible and what route to take. – Stewbob Oct 09 '17 at 14:10
  • @Stewbob hence the wording of my question. Hoping some poor schmuck will stumble on this post when attempting the same. – Atlas Oct 09 '17 at 15:03

1 Answers1

2

Incorporated comments from @PaulF:

Programs don't tend to break of their own accord - beyond getting corrupted - if that is the case then decompiling wont work. So you need to understand why it has stopped working - it is likely that a decompile & recompile will not work. What has changed from when it worked to when it stopped working (maybe operating system version or PC)? Can you go back to a state where it was working ?

If that's not the issue, then:

Do you have access to the source code? If not, you cannot make it work without re-writing it and re-deploying it, which isn't a bad thing. Then you would be able to have the source code and hopefully source control it.

dotPeek allows you to see decompiled code, but you cannot do anything to the file safely.

Those are about your only three options:

  1. Figure out what dependencies/configurations have changed
  2. Get the source and modify that
  3. Re-write it
Stewbob
  • 16,759
  • 9
  • 63
  • 107
  • 1
    If the source code is not available there are several other tools mentioned here, I haven't used any so cannot advise on how good they are : https://reverseengineering.stackexchange.com/questions/77/is-there-any-way-to-decompile-a-net-assembly-or-program – PaulF Oct 09 '17 at 14:16