Okay -- Using the DLL function requires you to understand the difference between passing data by reference (i.e. a pointer to the data/value) and passing the actual data value. All parameters passed to the DLL are passed on the stack and that consists of a series of 32/64 bit values so its important to get these right.
Generally if you are calling a DLL function:
- if you are asked to pass a simple value such as a number or bit mask they want it passed by value.
- if you are passing a string or structure they want the value passed by reference which is a pointer to the data.
Okay -- So looking at the OpenProcess function it wants 3 values a DWORD with the Access requested, an indicator if you want it Inherted, and a DWORD with the Process ID. All of these are simple values/bit masks so all need to be passed as values.
This means, given the values you requested the DLL method call would be:
sts = DLL("Kernel32","OpenProcess", 1, 0, 40364)PxPlus will place these value in the stack and call the specified function.
If you need to pass a pointer to a structure or buffer to a string or such, you create a string to contain the values and simply put the string name in the DLL call in order to have its addressed passed.
It should also be noted that on Windows, functions that work with text often have two definitions, one definition passing 8-BIT ASCII data and one passing 16-Bit Unicode (wide) characters. For example the FindWindow function actually exists as FindWindowA -- where you can pass a sting containing ASCII data or FindWindowW -- where you can pass a string containing 16 Bit UNICODE. For the most part, when calling these functions from PxPlus you want the ASCII (xxxxA) function.
Lastly, remember when passing strings, that the functions often want Null terminated strings; that is a string whose last character is $00$ so make sure to add this to the end of whatever string you pass or if receiving a string only use the data up the $00$ byte.