I find that I can write to memory as

[addr] = value

As given by the documentation at http://help.x64dbg.com/en/latest/introduction/Input.html

And while I could work around my problem as dividing the string into several byte writes, that looks kind of ugly! Every character would be:

byte:[addr] = charactercode

I have not found any way except for manually entering into the memory editor to write a string/unicode string into memory. Am I missing something or is this really basic feature missing from X64dbg ?

In case there is another workaround. The problem I am trying to solve is I want to set a value for GetEnvironmentVariable() for a variable that does not exist by writing a string into the buffer. I want this to happen when a breakpoint is reached by breakpoint commands.

So basically if there was any way to force setting environment variable or write a string into memory when a breakpoint is hit. I could work with that!

  • As a comment I will add that one can convert a string to bytes and add as this as well. "set addr, #deadbabecafebeef#" But that still requires that I convert my string to hex. I would like to not have to do that. – Sharky Sep 18 '19 at 13:34
  • I can now rule out the solution above as well. It became too long and now X86dbg splits it into several rows even though it is only one long row in the script file. Since X86dbg splits the line it becomes several commands where they will mostly all fail. – Sharky Sep 18 '19 at 14:13
  • An undocumented command "strset" together with "strcpy" can be used to set a string and copy it into memory like this 'strset strvar, "abcd efgh" ; strcpy ecx, strvar'. Still no way of generating a utf8 string and copying so the hunt goes on. – Sharky Sep 18 '19 at 14:38
  • I highly recommend writing a simple plugin that will do the job for you. You can easily add your own commands, see plugins.x64dbg.com – mrexodia Sep 23 '19 at 21:13
  • Thanks @mrexodia! I'll have a look at plugins. Been meaning to get into it anyway. Since I have you here :-) Would features like this make it into master if I were to submit a PR at some time in feature? Been meaning to have a look at the x64dbg source as well. I usually prefer to extend base program functionality over plugins as I always forget which plugins I need but the base program is always there. – Sharky Oct 13 '19 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.