Hi there, I think you need to change the code to: int *pointer = (int*) 0x00003b9c; int ValueAtAddress = *pointer; This is because C++ is strongly typed - and 0x00003b9c is a constant. The compiler assumes you were trying to create a "const int *" and made a typo - the (int*) "casts" the value into the required type. Thanks, Neil Humphreys.
humps
Posts
-
How to monitor the value at a specific address say 0x003b9c -
reading a memory address using c++You can use the * operator. But you have to tell C++ what sort of data to expect at the address, so it knows what type of variable to create, e.g.: int memoryAddressValue = *((int *)memoryAddress); if you know an int is at the address (which occupies 4 bytes, so this call reads the address and the next 3 addresses). Memory addresses are just bytes or data, so their meaning is open to interpretation ! This call casts the address to a pointer to an integer - (int*)memoryAddress - and then reads the value from memory - * operator. Note: if the process doesn't have access to the address (which usually means the address is not the address of one of its variables on the stack, or is not part of the heap space defined by calling new/malloc etc) then expect an access violation exception. Thanks, Neil Humphreys.
-
Binary Data ManipulationHi All, I have an arbitrarily large block of binary data (a sequence of bytes). I want to write a function: int FindBit(BYTE* fisrtByte, int numBytes) that can be passed a pointer to the start of the data (firstByte), and the number of bytes of data (numBytes), and find the first occurrence of a "1" bit. e.g., if I pass a pointer to the following 3 bytes of binary data: 00001101 10110101 10110101 I need the function to return 5 - because the first non-zero bit is in position 5. Has anyone ever done something similar? Is there an efficient way to do this ? ;) Thanks, Neil Humphreys.
-
NamedPipe ServerI have a named pipe server, created using CreateNamedPipe(). Has anyone any idea how can I make it disallow remote clients (so only pipe clients on the same system as the server are allowed to connect to it) ? Many thanks for any help. Thanks, Neil Humphreys.
-
WinSOCK and HTTP POST - how to send/receive data?Hi Peter, Looks like you may have forgotten to account for "Name=" in the Content-Length. Name.length() is actually the length of your content minus the length of the string "Name=". Hope this helps... Thanks, Neil Humphreys.
-
auto login websiteThe problem is almost cetainly because the site is expecting a POST of the username and password, which can't just be stuffed on the end of the URL. A post looks something like this (the exact names of the fields USERNAME and PASSWORD could maybe be determined by viewing the source of your particular web page). POST /logon HTTP/1.1 Host: peer200:6002 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: https://peer200:6002/logon Content-Type: application/x-www-form-urlencoded Content-Length: 54 USERNAME=Administrator&PASSWORD=xxxxxxxx&SUBMIT=SUBMIT Thanks, Neil Humphreys.
-
WinSOCK and HTTP POST - how to send/receive data?Dude I think you are just missing the Content-Length specification in your POST request header. This is needed so the server knows when the content-data ends (\r\n\r\n is only the terminator for the header). Try sending something like this to the server: POST /logon HTTP/1.1 Host: peer200:6002 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: https://peer200:6002/logon Content-Type: application/x-www-form-urlencoded Content-Length: 54 USERNAME=Administrator&PASSWORD=xxxxxxxx&SUBMIT=SUBMIT ...here the length of the content data (USERNAME ....SUBMIT is exactly 54 bytes). Hope this helps ! Thanks, Neil Humphreys.
-
HTTP Post Data ProcessingThanks for the reply. Your article is a web client, which writes POST requests (presumably). However, I am after web server code, which reads POST requests. :sigh: Thanks, Neil Humphreys.
-
Neural Network CodeJenny If you ever succeed with this, can I have my brain backed up as well ? I can provide a blank DVD. Thanks, Neil Humphreys.
-
Need API to access the user group to which a currently logged in user belongsHi there, Do you mean you want to list the groups of the user running your program? I think the process is (sorry I don't have any example code): ImpersonateSelf() - to generate an access token for the current process OpenThreadToken() - to open the access token GetTokenInformation() specifying TokenPrimaryGroup or TokenGroup as one of the parameters - to get a data structure with group information Then walk the structure from this last function, looking for the group SID or SIDs. Finally, to convert a SID to an actual text group name, use: LookupAccountSid() Hope this is a pointer in the right direction ! Thanks, Neil Humphreys.
-
HTTP Post Data ProcessingHi, I am looking for some neat code to process HTTP Post request content data - i.e. tidy up all those '+'s and '%'s, and split the POST content string into variable name / variable value pairs. I could try this myself, but I do hate reinventing wheels ... can anyone suggest some code to do this ? Thanks, Neil Humphreys.
-
Checking Namedpipe AccessHi I am creating a named pipe server with CreateNamedPipe(). Once a client connects, I use ImpersonateNamedPipeClient() and OpenThreadToken() to get the client's logon token. I then use LookupAccountSid() to get the client user account details. All standard stuff. *BUT* what I would like to do at this point is determine whether the client connected from a session logged on locally at the server, OR from another system. I *think* I need to check the logon type (LOGON32_LOGON_INTERACTIVE) but I have no idea how. Has anyone any idea how to do this? Many thanks, Neil Humphreys :confused:
-
IScriptControlPtr bad multithreaded behaviour?The reason I didn't use the script engines directly is - I didn't know about them! I am just a beginner with this to be honest. Thanks for bringing it to my attention, it definitely looks like the way to go. cheers, Neil
-
IScriptControlPtr bad multithreaded behaviour?Thanks for your reply, Mike. I suspected this might be the case. When you say "The msscript.ocx control is registered with the Apartment threading model" ... is this documented somewhere on the web? I spent some time searching, but don't recall that particular chestnut :-( It might be nice to have some definitive documentation for once, rather then relying on Google and trial and error!!!!
-
IScriptControlPtr bad multithreaded behaviour?I have a VC++ program in which two IScriptControlPtr smart pointers are created in thread "1". Thread "2" calls the Run() method against the first IScriptControlPtr, and thread "3" calls the Run() method against the second one. All three threads call CoInitializeEx(NULL,COINIT_MULTITHREADED) first. What I am finding is, thread 2 (or 3) blocks until thread 3 (or 2) has finished, even though they are running against separate IScriptControlPtr objects (and no other thread is trying to access these smart pointers). Has anyone seen this behaviour before / is this to be expected? Is there perhaps bad multithreaded handling in msscript.ocx? (I am using version 1.0.0.7615). Many thanks, Neil.
-
Performance Monitoring on Windows NTI would like to programmatically monitor objects, via RegQueryValueEx() / HKEY_PERFORMANCE_DATA. After hours trawling through all the documentation I could find on the web, two things are still confusing me: (1) If I want to monitor a particular object, e.g. Processor, how do I know which object number to pass to RegQueryValueEx() ? I could look up the reg value HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\[LANG]\Counter, but then I cannot assume the string "Processor" is unique (what's to stop a 3rd party app registering its own object or counter called "Processor"?) And obviously the object IDs (numbers) themselves will not be the same on every system (so you can't just hardcode them..) What am I missing here? (2) For my own understanding, where in the registry is the information stored that links object IDs to the performance APIs that they relate to? i.e. When you call RegQueryValueEx(HKEY_PERFORMANCE_DATA,..), Windows has to work out which DLL relates to the object number passed .. so where does it look up the:confused: information ? Many thanks, I'm stumped !! Neil Humphreys.