Reputation: 77
I'm pretty new to hexadecimal and Windows Debugger commands. I'm trying to write a python script in which I call the '.writemem function, providing a filename, a start address, and a number of bytes to write. Here's what I have so far:
cmdstr = ".writemem " + filename + " " + startAddress + " L" + size
dbgCommand(cmdstr)
where beginAddress is a string of the start address in hexadecimal form, and size is also a hexadecimal string. The lone 'L' is meant to indicate that I don't want to specify a range of addresses, and will instead specify a start and a size.
The few examples I've found of this command being run have all omitted the '0x' from the beginning of both strings, and I was wondering if I needed to do that. I'm a little afraid to run it and see, since writemem is a dangerous function to play around with. Any ideas how to format this hexadecimal?
Upvotes: 0
Views: 735
Reputation: 59513
By default WinDbg treats numbers as hex, so the 0x
prefix is optional. However, I'd prefer to be more explicit and just keep the 0x
prefix.
You can try that with the ?
command:
0:003> ? f
Evaluate expression: 15 = 00000000`0000000f
0:003> ? 0xf
Evaluate expression: 15 = 00000000`0000000f
If you want to use decimal values, you can use the 0n
prefix:
0:003> ? 0n15
Evaluate expression: 15 = 00000000`0000000f
Just as a side note: be aware of the range limit and use the L?
syntax for regions larger than 512 kB.
Upvotes: 2