#1
|
||||
|
||||
how can i check bad pointer on asm?
ok i guys im have soft that im need to patch it crash..so it just get bad pointer and crashes i tryed to check for bad pointer in similiar way:
CMP DWORD PTR DS:[EAX],0 JE @SkipFunction but it already fails to read for comparexD so what should i do ? |
#2
|
|||
|
|||
Use VirtualQuery http://msdn.microsoft.com/en-us/library/windows/desktop/aa366902(v=vs.85).aspx
|
#3
|
|||
|
|||
The "proper" API is IsBadReadPtr(), but keep in mind that any registered Vectored Exception Handler will gain control if the pointer is bad.
|
#4
|
|||
|
|||
@qkumba
Actually, that API is fundamentally broken because it is not free of side effects, e.g., consider the case where you use that API on a guard page. After using that API, that page won't be a guard page anymore! Due to race conditions, there is no general safe way to test if a pointer is valid, other than making sure it is only obtained for safe addresses. Pretty much any address can become invalid after you tested the pointer, and vice versa. The right question would be to ask: what are you actually trying to do? |
#5
|
||||
|
||||
The API is also deprecated, and you shouldnt use for a variety of reasons. The truth is that there is no way of checking for a pointer that once was valid and now might be invalid.
Whatever returns the pointer should make sure there is no way of passing an invalid pointer, and should return 0 if there is a problem of some sort. |
#6
|
||||
|
||||
thanks for the reply but i already slove this
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Resolving Stack Pointer problem | java3ever | General Discussion | 1 | 06-20-2017 13:57 |
Help Me - CRC Check and FileSize Check | byvs | General Discussion | 11 | 07-31-2003 13:32 |
CRC Check - Help Me!! | byvs | General Discussion | 1 | 06-19-2002 13:13 |