Dear VB and/or VB.NET gurus,
I'm working on the project of converting vb code to vb.net. In code base it used winsock, the auto converted code got chocked on a function called Subclass_initialization, which obviously a copy of modSocketMaster from
I'm trying to figure out what that Subclass_initialization is doing, i got baffled when i read this part, what is that hardcoded sHex for?
That SubClass_Initialize function was called by InitiateProcesses() in the same module. Why subclassing is used in this case, just trying to initiate the winsock process?
I'm working on the project of converting vb code to vb.net. In code base it used winsock, the auto converted code got chocked on a function called Subclass_initialization, which obviously a copy of modSocketMaster from
HTML Code:
http://read.pudn.com/downloads66/sourcecode/comm/236312/GPRSWAP/modSocketMaster.bas__.htm
Code:
'Store the hex pair machine code representation in sHex
sHex = "5850505589E55753515231C0EB0EE8xxxxx01x83F802742285C074258B45103D0008000074433D01080000745BE8200000005A595B5FC9C21400E813000000EBF168xxxxx02x6AFCFF750CE8xxxxx03xEBE0FF7518FF7514FF7510FF750C68xxxxx04xE8xxxxx05xC3BBxxxxx06x8B4514BFxxxxx07x89D9F2AF75B629CB4B8B1C9Dxxxxx08xEB1DBBxxxxx09x8B4514BFxxxxx0Ax89D9F2AF759729CB4B8B1C9Dxxxxx0Bx895D088B1B8B5B1C89D85A595B5FC9FFE0"
nLen = Len(sHex) 'Length of hex pair string
'Convert the string from hex pairs to bytes and store in the ASCII string opcode buffer
For i = 1 To nLen Step 2 'For each pair of hex characters
sCode = sCode & ChrB$(Val("&H" & Mid$(sHex, i, 2))) 'Convert a pair of hex characters to a byte and append to the ASCII string
Next i 'Next pair
nLen = LenB(sCode) 'Get the machine code length
nAddrSubclass = api_GlobalAlloc(0, nLen) 'Allocate fixed memory for machine code buffer
Debug.Print "OK Subclass memory allocated at: " & nAddrSubclass
'Copy the code to allocated memory
Call api_CopyMemory(ByVal nAddrSubclass, ByVal StrPtr(sCode), nLen)