|Just another Perl shrine|
Re: Access and decrypt Chrome cookies on Windowsby bliako (Monsignor)
|on Nov 30, 2022 at 11:35 UTC||Need Help??|
In my limited understanding of pack(), $pDataOut simulates a memory pointer pointing to address 0. LL 2 longs: 0 and 0. Now I don't know what the size of a memory pointer in windows 32/64bit is and how does that relate to the size of a long according to Perl's pack().
I think the problem is that you need to allocate memory for receiving the decrypted data in, via the API call's last parameter (#7). Thankfully I run a totally windows-free environment, so I can't try it, but perhaps replacing the above with:my $pDataOut = " "x1000; # just saying, this will allocate at least 1000 bytes I guess
Once you jump over this hurdle, let's see how to read that memory you get back.
Edit: fixed below as it was referring to CryptProtectData
Edit: Oh I get it perhaps $pDataOut just creates "enough" space to receive a memory pointer to the decrypted data, so it does not matter where it points to (re: 0LL). So, perhaps the size of a memory pointer in your system is not equal to the size of 2 Perl/pack longs. Try bigger!
Edit2: Yep, this can be possible as in the doc it does not say that you need to allocate it, only to free it, so the API allocates it for you, so just increase the size of pDataOut?:
p.s. Cookie, cookie, give me a cookie hehehe I was seriously told off at my alma mater for recreating this, now that its memory has faded I would be expelled.