How to pass hexadecimal numbers into a WinDBG command?

amanama93

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?

Thomas Weller

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 0xprefix.

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 0nprefix:

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

lstrip for hexadecimal numbers, how to?

From Dev

How to redirect windbg command to a file without echoing the output on the windbg console?

From Dev

How to use the ba command (Break on Access) in WinDbg?

From Dev

How to read hexadecimal numbers from input in C?

From Dev

How to add two hexadecimal numbers in a bash script

From Dev

How do the numbers and letters differ in hexadecimal colours?

From Dev

In Windbg how to get the whole content from !do Command

From Dev

!slist command in WinDBG

From Dev

!slist command in WinDBG

From Dev

How is saving a long array as reverse hexadecimal numbers faster?

From Dev

How to get the complete list of hexadecimal color numbers using a loop in javascript

From Dev

How can I convert all numbers in a string to hexadecimal using gsub?

From Dev

How to get the complete list of hexadecimal color numbers using a loop in javascript

From Dev

How to pass a numbers list to function using command line sys.argv Python3

From Dev

How to pass a numbers list to function using command line sys.argv Python3

From Dev

How to pass a numbers list to function using command line sys.argv Python3

From Dev

Hexadecimal numbers and logic operators

From Dev

Regex for matching hexadecimal numbers?

From Dev

How to get a random string of 32 hexadecimal digits through command line?

From Dev

How to use numbers in sed command?

From Dev

WinDbg runaway command output explained

From Dev

How to pass a terminal command as an argument to another command

From Dev

How to pass variables to parallel command

From Dev

how to pass object parameters in command?

From Dev

how to pass arguments to linux at command

From Dev

How to pass KeyEventArgs parameters to the command

From Dev

How to pass wildcards in command line

From Dev

How to pass arguments to 'source' command?

From Dev

How to pass output of command to sed

Related Related

  1. 1

    lstrip for hexadecimal numbers, how to?

  2. 2

    How to redirect windbg command to a file without echoing the output on the windbg console?

  3. 3

    How to use the ba command (Break on Access) in WinDbg?

  4. 4

    How to read hexadecimal numbers from input in C?

  5. 5

    How to add two hexadecimal numbers in a bash script

  6. 6

    How do the numbers and letters differ in hexadecimal colours?

  7. 7

    In Windbg how to get the whole content from !do Command

  8. 8

    !slist command in WinDBG

  9. 9

    !slist command in WinDBG

  10. 10

    How is saving a long array as reverse hexadecimal numbers faster?

  11. 11

    How to get the complete list of hexadecimal color numbers using a loop in javascript

  12. 12

    How can I convert all numbers in a string to hexadecimal using gsub?

  13. 13

    How to get the complete list of hexadecimal color numbers using a loop in javascript

  14. 14

    How to pass a numbers list to function using command line sys.argv Python3

  15. 15

    How to pass a numbers list to function using command line sys.argv Python3

  16. 16

    How to pass a numbers list to function using command line sys.argv Python3

  17. 17

    Hexadecimal numbers and logic operators

  18. 18

    Regex for matching hexadecimal numbers?

  19. 19

    How to get a random string of 32 hexadecimal digits through command line?

  20. 20

    How to use numbers in sed command?

  21. 21

    WinDbg runaway command output explained

  22. 22

    How to pass a terminal command as an argument to another command

  23. 23

    How to pass variables to parallel command

  24. 24

    how to pass object parameters in command?

  25. 25

    how to pass arguments to linux at command

  26. 26

    How to pass KeyEventArgs parameters to the command

  27. 27

    How to pass wildcards in command line

  28. 28

    How to pass arguments to 'source' command?

  29. 29

    How to pass output of command to sed

HotTag

Archive