Page 1 of 1

Replacing MemoryEx plug built-in functions

Posted: Fri Sep 06, 2013 8:22 pm
by AMSPeople
Is it possible to replace this function:

Code: Select all

__PtrToArray = function (pBuf)
	local tRet = {};
	local nOffset = 0;
	local nLen, pData, hData
	while true do
		nLen = tonumber(DLL.CallFunction("kernel32.dll", "lstrlenA", pBuf + nOffset, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL));
		if (nLen == 0) then break; end
		pData = MemoryEx.DefineStruct{STRING("char", 1 + nLen, 1, MEMEX_ASCII)};
		hData = MemoryEx.AssignStruct(pBuf + nOffset, pData);
		tRet[#tRet + 1] = hData.char;
		hData:Close();
		nOffset = nOffset + (1 + nLen);
	end
	return (#tRet > 0) and tRet or nil;
end
actions built into the APM?

Re: Replacing MemoryEx plug built-in functions

Posted: Fri Sep 06, 2013 8:40 pm
by Serkan
yes ,with less code

Re: Replacing MemoryEx plug built-in functions

Posted: Fri Sep 06, 2013 8:46 pm
by AMSPeople
All right. And you can code ? And then I can not understand some action due to the lack of examples for them.

Re: Replacing MemoryEx plug built-in functions

Posted: Fri Sep 06, 2013 9:23 pm
by Serkan
If you download and open Windows Button sample you will see a function called UpdateProperties
you can see how it is done in that function , there are two actions for char array to string and string to char array

More examples will be posted here soon