Rob-- / memoryjs

Read and write process memory in Node.js (Windows API functions exposed via Node bindings)
MIT License
632 stars 86 forks source link

null-terminator hasn't been found after 1 million characters #59

Closed elnur0000 closed 4 years ago

elnur0000 commented 4 years ago

Hi, is there any way to set a maximum character count when reading strings? or maybe there is a workaround for this issue?

Rob-- commented 4 years ago

Are you sure the string you're reading is over 1,000,000 characters? To be honest, my implementation of this was pretty poor and arbitrary. If you're sure the string you're reading could exceed 1 million characters, simply edit this line and recompile the library.

In the future, an optional parameter should be implemented to pass the maximum character limit over.

elnur0000 commented 4 years ago

sry I asked the question poorly no it's not over 1 million characters, but I am trying to read only 5 out of it so instead of waiting for null-terminator, which doesn't exist for some reason, I was trying to find a way to set the max character count

Rob-- commented 4 years ago

There is probably various ways to terminate a string. I have only implemented one way which is why it may not be able to find that string. Do you know anything about what type of string it is?

As for your original question, there is currently no way to read the string then if it has no null terminator. You could implement a string reader function yourself where you read char by char manually until you satisfy some property that determines when the string terminates? That is all this library is doing after all when attempting to read a string.

elnur0000 commented 4 years ago

I think it's a c++ string, which probably doesn't store null terminator in memory? thanks for the answer Rob, It's all clear now