• 0

Help Creating a Patch


Question

Hi! I found some info in this forum about patching a program but not a complete guide.. Lets say i have 1.exe .This exe contains some textboxes.. i want to create a second exe (2.exe) which will be able to patch all or one value of textbox in the 1.exe.

As i said i found in this forum info about creating the 2.exe BUT in an exe which was build with microsoft studio 2010(vb.net or c# etc..) i cannot find strings using w32dasm.. My plan was to open w32dasm and find the address of the string that i want to replace and then patch the address with 2.exe...

So HOW to find the address of a string/textbox.text(value) of an exe?

i can find the strings of an exe which was build by vb6 but not from an exe which was build by vb.net 2010..

Please help me..

Thanks!

Link to comment
https://www.neowin.net/forum/topic/1107347-help-creating-a-patch/
Share on other sites

Recommended Posts

  • 0

I believe what you are referring to is program disassembly, not patching. Generally, a patch is generated using 'diff' and applied using 'patch', a process commonly known as patching. The assumption with patch is usually that you have access to the full source code of the program, which it sounds like you do not. It does not actually help you modify the program in any way.

As for disassembly, it sounds like you don't quite have a firm grasp on the basic concepts yet. I recommend that you read this primer on x86 program disassembly. While it won't specifically answer your question, it should at least give you a better understanding of how programs work and how to find program elements in assembly.

Finally, I believe that your specific problem may have something to do with the utility you are using. While w32dasm has been an excellent win32 disassembler for many years, it is no longer supported (since the last release in 2003) and has a few limitations. The most prominent of which are that it cannot disassemble 64-bit executables and does not work with managed languages, such as .NET and Java. Most likely the reason you can disassemble VB6 executables but not VB.NET 2010 is because after Visual Basic 6, Microsoft transitioned it to use the .NET Framework, hence the name.

  • 0
  On 22/09/2012 at 20:06, articuno1au said:

Why not just recompile the application with the changes you want?

because i want the user to be able to do it.. i make a project for someone.. he wants to "generate" an exe with his own specifications..

so the 1.exe will be the program with NULL values in textboxes.. and the 2.exe will be "patcher"..it will update the textboxe's values of 1.exe.. then he can use the 1.exe with these values.. you understand me? Thanks!

  • 0

Perhaps consider changing the source files rather than the exe?

Generate an exe to read your source files, find the specific classes, open them in a stream reader and replace the text you need changed.

eg: Textbox1.Text = Null; -> Textbox1.Text = "Whatever";

Then the user himself merely has to recompile.

I don't know that what you want done is possible in .net. It might be, but I don't know of a way..

  • 0
  On 22/09/2012 at 20:09, nouser said:

because i want the user to be able to do it.. i make a project for someone.. he wants to "generate" an exe with his own specifications..

so the 1.exe will be the program with NULL values in textboxes.. and the 2.exe will be "patcher"..it will update the textboxe's values of 1.exe.. then he can use the 1.exe with these values.. you understand me? Thanks!

Are you telling me that you want your user to learn how to use a disassembler?! I suspect not, but I'm having a little trouble figuring out exactly what you are planning on using the disassembler for now.

If you want the user to be able to generate a customized executable so that it can be distributed with user-defined settings and no external configuration file, you are probably going about it the wrong way. It would probably be easiest to generate a configuration file (such as XML or INI) when the user saves his settings. It would be easiest to have the user simply distribute this file with the executable so his defaults can easily be loaded. If everything must be contained in a single executable, the easiest option is to use an installer, such as NSIS, to package both together and extract them when executed. Another option, which I have looked into but never actually implemented, would be to embed the configuration file into a copy of your executable as a resource, then instruct the program to look for the resource every time it is run.

  • 0

Let me explain you.first of all thanks everyone!!

I work to someone online and make a program for him. He will sell the program to MANY people.. Someone will HAVE to buy 2 programs because the guy im working to, do not want to compile the project all the time and he wants his customers to be able to MAKE THEIR EXE WITH THEIR VALUES :)

so someone will buy these 2 programs.

1.exe is the standard program with NULL VALUES

2.exe is a program which will run and have 3 textboxes. Customer will add in first textfiled his Phone,second textfield his Email and third textfield his address. The he will click CREATE EXE button and the 1.exe will get these values to HIS 3 textfields..now everytime someone openes 1.exe it will contain these values and it will not be null..

:)

  • 0
  On 22/09/2012 at 20:13, n_K said:

www.clickteam.com

Use install creator or patch maker, loads of companies use them to make game patches and it does what you're after (differential patching)

That is AWESOME! I have never seen something like that before, but I really like it.

I'm not sure it solves the problem at hand though. On second thought, maybe it could be used for this purpose, I'm just not sure exactly how yet.

  • 0
  On 22/09/2012 at 20:27, nouser said:

Let me explain you.first of all thanks everyone!!

I work to someone online and make a program for him. He will sell the program to MANY people.. Someone will HAVE to buy 2 programs because the guy im working to, do not want to compile the project all the time and he wants his customers to be able to MAKE THEIR EXE WITH THEIR VALUES :)

so someone will buy these 2 programs.

1.exe is the standard program with NULL VALUES

2.exe is a program which will run and have 3 textboxes. Customer will add in first textfiled his Phone,second textfield his Email and third textfield his address. The he will click CREATE EXE button and the 1.exe will get these values to HIS 3 textfields..now everytime someone openes 1.exe it will contain these values and it will not be null..

:)

How are the values saved by 1.exe?

Can you just create an XML config file with your settings in it?

Sorry, this just seems like reinventing the wheel to me >.<

  • 0
  On 22/09/2012 at 20:40, n_K said:

Yeah just use XML or INI or SQL or anything like that, you can even embed it into the EXE (if needed) and just extract it when the program runs (have a header like #####SECRETHEADER) to look for and get the data after that.

Exactly what I was going to suggest next. You beat me to it. Needless to say, I agree.

  • 0

You can definitely embed resources into the exe.

The issue is that the guy compiling it would have to create the config file each time he compiled it.

You could even use internal variables and just have the guy edit them in.. Probably easier if you are taking that approach..

  • 0

i need these resources to be editable by the user via an other exe... :/

i have seen what i am asking in trojans in the looong past. user could put his ip/dns and create an exe..i think it was being done with patching.. i was too young..i just remember that..i want something similar..basically i want that thing but not for trojan lol thanks

  • 0


<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Settings>
<ServerPath>C:\Server\whatever.exe</ServerPath>
<PortNumber>8420</PortNumber>
<PortCheck>true</PortCheck>
<AutoStart>true</AutoStart>
</Settings>
</ArrayOfSettings>[/CODE]

That's how I do it. Simply create a structure (or class) containing your settings.

[CODE]
public struct Settings
{
public string ServerPath;
public int PortNumber;
public bool PortCheck;
public bool AutoStart;
}
[/CODE]

Then:

[CODE]
var xmlSerializer = new XmlSerializer(typeof (Settings[]));
var sWriter = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "Settings.xml", false);
xmlSerializer.Serialize(sWriter, settingsArray);
sWriter.Close();
[/CODE]

to write the settings out of the program, or the deserialize method to read the settings into the program.

This way the .exe is distributed all on it's own, but your program can create a settings file to work off of.

If the user needs to make changes, they can simply make a change in the .xml file (or in your application, or in a separate application that only makes the file etc etc etc)

You can embed this file as a resource and read it out of the resource instead of as a filesystem request. Then you just make the executable take the values and save them.. Might defy the point though >.>

EDIT::

I consulted with an expert on the subject, and he said it's possible, but it's a butt load of pain to do. He said that once values are changed in the initial compile, it becomes next to impossible to find in C++, and only marginally better in CLI language.

  • 0
  On 22/09/2012 at 20:55, articuno1au said:


<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Settings>
<ServerPath>C:\Server\whatever.exe</ServerPath>
<PortNumber>8420</PortNumber>
<PortCheck>true</PortCheck>
<AutoStart>true</AutoStart>
</Settings>
</ArrayOfSettings>[/CODE]

That's how I do it. Simply create a structure (or class) containing your settings.

[CODE]
public struct Settings
{
public string ServerPath;
public int PortNumber;
public bool PortCheck;
public bool AutoStart;
}
[/CODE]

Then:

[CODE]
var xmlSerializer = new XmlSerializer(typeof (Settings[]));
var sWriter = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "Settings.xml", false);
xmlSerializer.Serialize(sWriter, settingsArray);
sWriter.Close();
[/CODE]

to write the settings out of the program, or the deserialize method to read the settings into the program.

This way the .exe is distributed all on it's own, but your program can create a settings file to work off of.

If the user needs to make changes, they can simply make a change in the .xml file (or in your application, or in a separate application that only makes the file etc etc etc)

You can embed this file as a resource and read it out of the resource instead of as a filesystem request. Then you just make the executable take the values and save them.. Might defy the point though >.>

EDIT::

I consulted with an expert on the subject, and he said it's possible, but it's a butt load of pain to do. He said that once values are changed in the initial compile, it becomes next to impossible to find in C++, and only marginally better in CLI language.

thanks for your reply,that way is not standalone..the xml file HAS to be in the same folder with the exe..right? correct me if im wrong

  • 0
  On 22/09/2012 at 21:06, nouser said:

thanks for your reply,that way is not standalone..the xml file HAS to be in the same folder with the exe..right? correct me if im wrong

Yep.

Once you embed a resource, you can't access it easily as a user.

Hell, you can't access it easily outside of the application even if you wrote the application.

There really isn't a good way to do this :\

Best bet sounds like settings the values pre compile and just using constants >.>

  • 0

check here: https://www.neowin.net/forum/topic/1021544-help-me-making-a-patch-vbnet/

this guy asks how to patch an exe.. so this is enough heplfull..also someone else there posted a project about patching an other exe.. BUT in my exe i cannot find what is the offset address that need to be patched.. a vb6 exe shows the strings in w32dams.. vb.net exe file wont show the strings in w32dasm so i cannot get the address.. i tried other than w32dasm(as you mentioned w32dasm is old..) but still i cannot see the strings in order to get their address and change them...

  • 0

Compile with null values.

Compile a new exe with a different value.

Compare the two exes in binary (Google it), that should identify where the variables are stored in CLI.

Write a binary editor to insert the values.

Waste 5+ hours perfecting the above >.>

  • 0
  On 22/09/2012 at 21:30, articuno1au said:

Compile with null values.

Compile a new exe with a different value.

Compare the two exes in binary (Google it), that should identify where the variables are stored in CLI.

Write a binary editor to insert the values.

Waste 5+ hours perfecting the above >.>

in the past i used to patch some exe's from other people to change the program title(window title) just for fun.. the thing is that from old exes you could be able to read the string's offset address using w32dasm..but with new exes i cannot do that.. thats what im looking for..a program that will give me the address of the strings!

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Would you be open to allowing users to ignore/block staff/moderators here? When trying to do so now, you cannot add a mod/global mod to your ignore/block list. Curious why this is setup this way, is there any way around this?
    • If youre going to delete my comment from this thread, calling out your poor attitude, you should also remove this comment.
    • Is there any reason to think that an updated version of Linux is any less secure than Windows 11? If a govt has 30,000 PCs that won't support Win 11, then the choices are to remain on Win 10 with no security support, throw all 30,000 PCs in a landfill and buy new hardware and software, or keep the hardware and deploy open source software. Option #1 is obviously the worst. Option #2 probably costs $100s of millions and a great deal of e-waste. Option #3 is a matter of software support and personnel learning curve. This one isn't that hard to solve and it comes with a massive financial reward. Since France figured it out, so can anybody.
    • Some ewoks are Wonka's employees eyewitnessing dung
    • Windows 11 gets improved context menus, seconds for calendar clock, and more in new builds by Taras Buria Microsoft is finishing this week with two more builds for Windows Insiders in the Dev and Beta Channels. If you are in the former, you can download 26200.5651, while the latter received 26120.4441. These updates introduce some welcome improvements for context menus, calendar clock, Recall, Settings app, and more. Starting with Copilot+ PCs, users with Snapdragon-powered PCs (Intel and AMD support is coming soon) can try the new agent in Settings. You can type what you would like to change into the Settings app's search box, and the agent will do it for you. For example, you can say something like "my mouse pointer is too small," and the app will show you suggestions and offer to adjust settings on your behalf. Note: This feature is only available in the Dev build. In the European Economic Area, Recall now prompts users to save a unique code, which is required for exporting snapshots to share them with third-party apps or websites. This code is shown only once during the initial setup experience, so be sure to save it in a reliable place. Note: Today's updates will reset Recall and all your snapshots. Other Recall improvements (available in all countries where Recall is available) include the ability to reset Recall and all its data, a new default value for maximum storage duration (90 days instead of unlimited), and various tips to help you learn about Recall features. Microsoft is also introducing new features for Click to Do. You can now send text or images to Microsoft 365 Copilot. Click to Do can now let you take actions on an email address to schedule meetings or send messages in Teams. Next, we have a much-requested feature coming from Windows 10 to 11: Seconds for the calendar clock. The clock that appears in the calendar flyout can now display seconds if you want it to. Note that, unlike Windows 10, this feature is customizable: you can toggle seconds on or off in date and time settings. Here are other noteworthy changes in builds 26200.5651 and 26120.4441: Context menus now have dividers for common file actions When sharing files with OneDrive, Windows will offer additional sharing options like Nearby Sharing or third-party apps. Windows activation and expiration dialogs now feature modernized visuals. And here is what was fixed (these are rolling out gradually): [Recall (Preview)] The following fixes are rolling out for Recall on Copilot+ PCs: Fixed an issue causing Recall to crash for some Insiders in the last couple flights. [File Explorer] Fixed an issue when opening folders starting from outside of File Explorer, where File Explorer would open it in a new tab, but the tab wasn’t put in focus. Fixed a memory leak impacting some people when navigating through File Explorer folders, impacting performance and reliability over time. We’ve done some more work to improve the performance of extracting archive files – this will particularly help in the case of copy pasting large numbers of files out of large 7z or .rar archives. [Start menu] Fixed an issue for Insiders with the new Start menu, where it was displaying in the wrong direction when using an Arabic or Hebrew display language. Fixed an issue for Insiders with the updated Start menu, where the Move to front / Move right / Move left options from the context menu for pinned apps weren’t working. [Settings] Fixed an underlying issue which was causing some Insiders to see the Settings navigation pane entries in English rather than their preferred language in the last couple flights. [Other] Fixed an underlying issue which was causing fonts in certain app menu items to unexpectedly appear corrupted or overlapped for some people. This also impacted typing in Word – where when using Hebrew a period may unexpectedly show as a 3, and in Thai typing space may show a 2. Fixed an issue where running a script on a remote SMB share might take an unexpectedly long time if the share was an older Windows Server version like Windows Server 2019. And here is the list of known issues: [General] After you do a PC reset under Settings > System > Recovery, your build version may incorrectly show as Build 26100 instead of Build 26120. This will not prevent you from getting future Beta Channel updates, which will resolve this issue. The option to reset your PC under Settings > System > Recovery will not work on this build. Some Windows Insiders may experience a rollback trying to install this update with a 0x80070005 in Windows Update. We’re working on a fix. [Start menu] The following are known issues for Windows Insiders with the new Start menu: Using touch to navigate the new Start menu may not work reliably. For example, it currently does not support the swipe-up gesture. Drag and drop capabilities are limited from “All” to “Pinned.” In some cases, duplicate entries may appear in folders on the Start menu. [Xbox Controllers] Some Insiders are experiencing an issue where using their Xbox Controller via Bluetooth is causing their PC to bugcheck. Here is how to resolve the issue. Open Device Manager by searching for it via the search box on your taskbar. Once Device Manager is open, click on “View” and then “Devices by Driver”. Find the driver named “oemXXX.inf (XboxGameControllerDriver.inf)” where the “XXX” will be a specific number on your PC. Right-click on that driver and click “Uninstall”. [Click to Do (Preview)] The following known issues will be fixed in future updates to Windows Insiders: Windows Insiders on AMD or Intel™-powered Copilot+ PCs may experience long wait times on the first attempt to perform intelligent text actions in Click to Do after a new build or model update. [Improved Windows Search] [REMINDER] For improved Windows Search on Copilot+ PCs, it is recommended that you plug in your Copilot+ PC for the initial search indexing to get completed. You can check your search indexing status under Settings > Privacy & security > Searching Windows. [File Explorer] The following are known issues for AI actions in File Explorer: Narrator scan mode may not work properly in the action result canvas window for the Summarize AI action for Microsoft 365 files when reading bulleted lists. As a workaround, you can use Caps + Right key to navigate. [Widgets] Until we complete support for pinning in the new widgets board experience, pinning reverts you back to the previous experience You can find the announcement post here (Dev) and here (Beta).
  • Recent Achievements

    • First Post
      NeoToad777 earned a badge
      First Post
    • Week One Done
      JoeV earned a badge
      Week One Done
    • One Month Later
      VAT Services in UAE earned a badge
      One Month Later
    • First Post
      LsDmT earned a badge
      First Post
    • Week One Done
      evershinefacilityservice earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      573
    2. 2
      ATLien_0
      251
    3. 3
      +Edouard
      162
    4. 4
      +FloatingFatMan
      150
    5. 5
      Michael Scrip
      113
  • Tell a friend

    Love Neowin? Tell a friend!