On 1/14/21 7:38 PM, Paul Procacci wrote:
I may have.

Regardless, I have written a proof of concept in 'C' which works.
My question isn't how to interface with the Windows Operating System because I have already done so in 'C' quite easily.

My question pertains to working around the bug as described here: https://github.com/rakudo/rakudo/issues/3633 <https://github.com/rakudo/rakudo/issues/3633>
Do you have any comments concerning this bug and/or the approach I'm taking?
Passing a flattened array of 260 int16's doesn't work so my approach is passing 65 non-flattened int64's.

The 65 int64's are in fact being utilized by the callee, yet I'm looking for a method to reconstruct this back into 260 wchar_t's (which has a width of 16)  w/ a simple method that doesn't include me walking the int64 and masking the chars out myself.
Does this exist.

Thanks,
~Paul

On Thu, Jan 14, 2021 at 9:58 PM ToddAndMargo via perl6-users <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:

    On 1/14/21 4:32 PM, Paul Procacci wrote:
     >
    
https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
    
<https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot>

     >
    
<https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
    
<https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot>>
     >
     > On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users
     > <perl6-us...@perl.org <mailto:perl6-us...@perl.org>
    <mailto:perl6-us...@perl.org <mailto:perl6-us...@perl.org>>> wrote:
     >
     >     On 1/14/21 3:42 PM, Paul Procacci wrote:
     >      > Let me preface this by saying if I were using a lower
    level language
     >      > (like C) I wouldn't have this problem; as I know how to
    shift and
     >     mask
     >      > accordingly.
     >      >
     >      > On raku however, how to do so *eloquantly* eludes me.
     >      >
     >      > I've defined a CStruct as follows:
     >      >
     >      > class test is repr('CStruct') {
     >      >
     >      >    has int64 $.a1;
     >      >
     >      >    has int64 $.a2;
     >      >
     >      >    ...
     >      >
     >      >    has int64 $.a65;
     >      >
     >      > }
     >      >
     >      > Under normal circumstances I would have defined the member as:
     >      > `HAS int16 @.a[260] is CArray` however that seems to be
    broken. See:
     >      >
     >      > https://github.com/rakudo/rakudo/issues/3633
    <https://github.com/rakudo/rakudo/issues/3633>
     >     <https://github.com/rakudo/rakudo/issues/3633
    <https://github.com/rakudo/rakudo/issues/3633>>
     >      > <https://github.com/rakudo/rakudo/issues/3633
    <https://github.com/rakudo/rakudo/issues/3633>
     >     <https://github.com/rakudo/rakudo/issues/3633
    <https://github.com/rakudo/rakudo/issues/3633>>>
     >      >
     >      > The function that gets called with these members $.a1 .. $.a65
     >     should
     >      > get filled with a wchar_t character array.
     >      >
     >      > Does raku employ a simple method of decoding the 4
    wchar_t's that
     >     get
     >      > placed into a int64 structure?  The characters I'd like to
     >     extract are
     >      > at bit positions [15:0], [31.16], [47:32], [63:48]
     >      >
     >      > I'm imagining something along the lines of:
     >      >
     >      > buf16.new( $.a1, ... $.a64);
     >      >
     >      > ... but that doesn't quite work like I would expect.
     >      >
     >      > Thanks,
     >      > ~Paul
     >
     >     Hi Paul,
     >
     >     Would you post the system call you are trying to
     >     interface with?
     >
     >     -T


    Did you see?

    
https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-viewing-processes
    
<https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-viewing-processes>

I am not following the bug.  :'(

Would you mind posting your C code?

And the output of your C code?


Reply via email to