Replacing MemoryEx plug built-in functions

General discussion forum for Ams Plugin Maker
Post Reply
AMSPeople
Registered User
Posts: 11
Joined: Fri Sep 06, 2013 7:54 pm

Replacing MemoryEx plug built-in functions

Post 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?
User avatar
Serkan
Developer
Developer
Posts: 214
Joined: Thu Jul 04, 2013 8:44 pm
Location: Windows.h
Contact:

Post by Serkan »

yes ,with less code
AMSPeople
Registered User
Posts: 11
Joined: Fri Sep 06, 2013 7:54 pm

Post by AMSPeople »

All right. And you can code ? And then I can not understand some action due to the lack of examples for them.
User avatar
Serkan
Developer
Developer
Posts: 214
Joined: Thu Jul 04, 2013 8:44 pm
Location: Windows.h
Contact:

Post 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
Post Reply