Dword() are idapython's functions and every try to assign a value to a function call in python will end up with "SyntaxError: can't assign to function call".
These 3 functions you have mentioned are used to read the value of a given address, whether it's a byte, word or a dword. You can't use them to set a value to an address.
In order to modify a memory location you can use one of the following functions:
Prior IDA 7.0:
Change value of a program byte
If debugger was active then the debugged process memory will be patched too
Change value of a program word (2 bytes)
Change value of a double word
Change a byte in the debugged process memory only
In case you want to get the original byte that was existed before any changes occurred, you should use:
Get original value of program byte
Since IDA 7.0 has arrived idapython made some changes that worth to mention.
The names of the functions has changed to
get_original_byte() accordingly, but, as for now, you still can use the old names since "IDA 7.0/Python/idc_bc695.py", which is responsible to compatibility, contains a wrapper to these functions.
Moreover, another function was added:
Change value of a quad word
PatchQword() won't work for you since it was not existed in older versions so there's no reason to create it as a wrapper to
patch_qword() for compatibility.
Patching a single byte is very intuitive:
from idaapi import *
new_value = 0xCC
This will edit the IDB file to set the value of 0x67643021 to 0xCC. This won't affect the origianl file. In case that you only want to edit the value of the address in the memory and not in the IDB file, you should use
PatchDbgByte() instead of
If you want your changes to affect the original file you'll need to make it by yourself like this:
new_value = 0xCC
# Open the file
f = open("my_binary.exe", "rb+")
# Seek to the address you want to patch
# Write the new value to this address
# Close the file
You can check fwrapper.py by Alexander Hanel and ida-patcher by Peter Kacherginsky to see some code examples that you may find helpful.