Windows PSAPI - 3 files [1/1]

sleek cslush at gmail.com
Sun Sep 7 12:10:42 PDT 2008


Sergey,

Right now you are my friggin hero! I greatly appreciate your contribution 
here. I just replaced the necessary pieces in my code and it now works 
exactly as expected! Thanks so much for the help!

"Sergey Gromov" <snake.scaly at gmail.com> wrote in message 
news:MPG.232e5cf6426b533d9896bc at news.digitalmars.com...
> sleek <cslush at gmail.com> wrote:
>> Sergey,
>>
>> Thanks for the response. Lucky for me, I actually fixed those first 
>> couple
>> bugs you mentioned after looking at the code a bit more. Unluckily for 
>> me,
>> it still sounds like I'm somewhat screwed. Does anyone else out there 
>> have
>> any info as to how I can use PSAPI from D?
>
> See attached.  These are the correct import library and fixed bindings.
>
> It wasn't easy to create the library though.  First I've got Psapi.h
> from Microsoft Platform SDK and modified it as suggested in this
> article:
>
>    http://support.microsoft.com/kb/131313
>
> Then I went the hard way which is of no interest.  The right way is to
> compile the header into an obj file and then dump its symbols.  The
> compiler to use depends on what tools you've got handy.  I've got the
> complete Microsoft SDK so I used
>
>    cl -c psapi.c
>    dumpbin /symbols psapi.obj >psapi.def
>
> Remove everything except the names, add 'LIBRARY "psapi.dll"' and
> 'EXPORTS' at the top, and you're almost done with the .def file.
> "Almost" because functions in actual DLL are not mangled, so you need to
> specify an internal name.  Use any regular expression tool to convert
> "_Anything at digits" into "_Anything at digits = Anything".  That's it.  Now
> use
>
>    implib psapi psapi.def
>
> to produce the correct import library.
>
> I wonder if there is an easier way. 




More information about the Digitalmars-d-learn mailing list