|
-
Jan 30th, 2020, 11:10 AM
#11
Thread Starter
Hyperactive Member
Re: using VbTrickThreading-master examples without the typelibs for Callback and Mar
 Originally Posted by jsvenu
Dear xiaoyao,
Just put msgbox in CreateVBHeaderCopy module function as follows:
' // Create copy of VBHeader and other structures
' // The first four bytes contain thread ID. We use that ID to clean unused headers
Code:
Private Function CreateVBHeaderCopy() As Long
Dim pHeader As Long
Dim pOldProjInfo As Long
Dim pProjInfo As Long
Dim pObjTable As Long
Dim pOldObjTable As Long
Dim lDifference As Long
Dim lIndex As Long
Dim pNames(3) As Long
Dim lModulesCount As Long
Dim pDescriptors As Long
Dim pOldDesc As Long
Dim pVarBlock As Long
Dim lSizeOfHeaders As Long
' // Get size of all headers
lSizeOfHeaders = &H6A + &H23C + &H54 + &HC + 4
GetMem4 ByVal pVBHeader + &H30, pOldProjInfo
GetMem4 ByVal pOldProjInfo + &H4, pOldObjTable
GetMem4 ByVal pOldObjTable + &H30, pOldDesc
GetMem2 ByVal pOldObjTable + &H2A, lModulesCount
MsgBox "lModulesCount " & lModulesCount
lSizeOfHeaders = lSizeOfHeaders + &H30 * lModulesCount
MsgBox "lSizeOfHeaders " & lSizeOfHeaders
' // Allocate memory for header
Do
pHeader = HeapAlloc(hHeadersHeap, HEAP_ZERO_MEMORY, lSizeOfHeaders)
regards,
JSVenu
Dear xiaoyao,
The following are the values at runtime in CreateVBHeaderCopy module function for lModulesCount and lSizeOfHeaders
lModulesCount 8
lSizeOfHeaders 1162 (48A)
So we have
pHeader = HeapAlloc(hHeadersHeap, HEAP_ZERO_MEMORY, lSizeOfHeaders) as
pHeader = HeapAlloc(hHeadersHeap, HEAP_ZERO_MEMORY, &H48A)
Hope this helps you.
regards,
JSVenu
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|