Reads an ASCII or Unicode string from the address space of the process. @see: L{peek_string} @type lpBaseAddress: int @param lpBaseAddress: Memory address to begin reading. @type nChars: int @param nChars: String length to read, in charac
(self, lpBaseAddress, nChars, fUnicode=False)
| 1909 | ## self.write(lpBaseAddress, data.raw) |
| 1910 | |
| 1911 | def read_string(self, lpBaseAddress, nChars, fUnicode=False): |
| 1912 | """ |
| 1913 | Reads an ASCII or Unicode string |
| 1914 | from the address space of the process. |
| 1915 | |
| 1916 | @see: L{peek_string} |
| 1917 | |
| 1918 | @type lpBaseAddress: int |
| 1919 | @param lpBaseAddress: Memory address to begin reading. |
| 1920 | |
| 1921 | @type nChars: int |
| 1922 | @param nChars: String length to read, in characters. |
| 1923 | Remember that Unicode strings have two byte characters. |
| 1924 | |
| 1925 | @type fUnicode: bool |
| 1926 | @param fUnicode: C{True} is the string is expected to be Unicode, |
| 1927 | C{False} if it's expected to be ANSI. |
| 1928 | |
| 1929 | @rtype: str, compat.unicode |
| 1930 | @return: String read from the process memory space. |
| 1931 | |
| 1932 | @raise WindowsError: On error an exception is raised. |
| 1933 | """ |
| 1934 | if fUnicode: |
| 1935 | nChars = nChars * 2 |
| 1936 | szString = self.read(lpBaseAddress, nChars) |
| 1937 | if fUnicode: |
| 1938 | szString = compat.unicode(szString, "U16", "ignore") |
| 1939 | return szString |
| 1940 | |
| 1941 | # ------------------------------------------------------------------------------ |
| 1942 |