View Single Post
 
Old 06-23-2014, 07:41 PM
CoolBlue's Avatar
CoolBlue CoolBlue is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: Jun 2014
Location: Australia
Posts: 40
CoolBlue is on a distinguished road
Default Slow "comparison/replace" script

Quote:
Originally Posted by whatsup View Post
O_o, quite interesting

May I ask you a few questions about your new function of the last upload?
1.
Code:
Public Const coBytes As Long = 4 * 8
You changed to 32 Bytes, just for purpose of demonstration or is there any particular reason?
The main reason is that the object structures are generaly more than one worrd so I wanted to see what was there in the structure to see if I could notice any patterns now that the byte order is fixed.
The Mem_Read for VarPtr is still set to 4 (it should be set to POINTER_LENGTH in fact).
Quote:
Originally Posted by whatsup View Post
2.
That's still the problem, that we don't know what data-structure we're really facing, isn't it?
Well, the data structures are interesting but not relevant to the test we are doing. But anyway, we now have a method for seeing the data properly (not scrambled by endian coding) so we can look at some standard structures like VB Variant structure for example to see if we can get some clue.
The main point is that we can confirm the relationship between VarPtr and ObjPtr for objects. We can confirm that the Loal Object, is just a LongPtr containing the address of the referenced object or zero, depending on if its been set or not.
Before I unscrambled the bytes, it was not obvious that the Mem_Read from VarPtr was in fact the address of the global object. But now we are clear on that.
So, using your Mod01 as an example, it means that we can say with 100% confidence that, after runtime:
If Mem_ReadHex_Words(lng_objPtr, 4) = 0 then
objwks is set to Nothing

If Mem_ReadHex_Words(lng_objPtr, 4) = ObjPtr(Sheet1) then
objwks has not been properly released

If Mem_ReadHex_Words(lng_objPtr, 4) <> ObjPtr(Sheet1) then
objwks has been properly released

Thus solving the problem that you raised earlier about ObjPtr returning the same thing for the local and global variables.
Quote:
Originally Posted by whatsup View Post
3.
Curiousity - I've never seen this before:
Code:
wordCount = Length \ wordLength
For divisions I use / you as well as I see in the following line. Therefore I wonder what's the joke on this?
/ is divide and \ is div or integer divide
Run this code...
Code:
Sub testIntDiv()
Debug.Print 3 / 5
Debug.Print 3 \ 5
End Sub
I use it like this:
if p / q = p\ q then p is divisible by q

Last edited by CoolBlue; 06-24-2014 at 07:30 PM.
Reply With Quote