[FFI newbie] Windows process info from Squeak
Bert Freudenberg
bert at impara.de
Thu Feb 2 13:40:49 UTC 2006
Am 02.02.2006 um 12:30 schrieb Valdas Bucinskas:
> Hello,
>
> Wow, your examples are really interesting and helps incredibly much.
> I modified your your last example slightly, incorporating RAMs used
> by the
> process. And then tried to find the .exe that calls the process. It
> appears,
> the method GetModuleBaseName from psapi.dll should be used, which is
> described in
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
> perfmon/bas
> e/getmodulebasename.asp.
> It gives the method declaration is
> DWORD GetModuleBaseName(
> HANDLE hProcess,
> HMODULE hModule,
> LPTSTR lpBaseName,
> DWORD nSize
> );
> What I miss now is the knowledge, how do I convert types from c++
> like into
> Sueak ones. I guess hProcess corresponds to Win32Handle, lpBaseName
> corresponds to char*, and nSize corresponds to long.
> GetModuleBaseName
> returns long.
> 1. But what does hModule correspond to?
> My guess
> <apicall: long 'GetModuleBaseName' (Win32Handle Win32Handle char*
> long)
> module: 'psapi.dll'>
> throughs Error 13, which is 'The data is invalid.'
You have to check what HMODULE actually is. Look in the
documentation, the header files, or some cpp output.
Or guess ;-)
> 2. Should a class similar to Win32Handle be created in order to
> hModule
> typecasting work?
My guess would be hModule is just a handle as well (it starts with an
h, and Windows API uses Simonyi's ["the Hungarian"] notation), so try
Win32Handle as type. Or just "long", because Windows handles are ints
in the end, right? We only deal with bits here, no compiler clue
cudgel needed.
- Bert -
More information about the Squeak-dev
mailing list
|