Hello fellow monks,

The background to this is that I want to do some low-level poking of the Windows registry on 64bit Windows (it's related to the WOW64 registry reflection nonsense).

I'm going to use Win32API::Registry to return the handle to a key, which I'll then use with Win32::API to call RegQueryReflectionKey() which is exposed through AdvApi32.dll.

So, I thought I'd start small and write up a few lines to make sure Win32API::Registry works as I think it should:

use strict; use warnings; use Win32API::Registry 0.22 qw ( :ALL ); my $sSubKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlog +on\\DefaultDomainName\\"; my $ohSubKey; RegOpenKeyEx( HKEY_LOCAL_MACHINE, $sSubKey, 0, KEY_READ, $ohSubKey ) o +r die regLastError(); print "$ohSubKey\n";

When I run this, it dies with the error:

The system cannot find the file specified at xx.pl line 12.

So, my question is this, am I doing something wrong? If I use regmon from sysinternals it shows that the Perl process is querying and opening the key (and the key certainly exists) - so why is it breaking and not returning a handle?

CPAN says the latest version of 0.23, but I can only find 0.22 even with all the extra PPM registries I have added in... Incidentally, Win32::TieRegistry works just fine, which I think is just a wrapper around Win32API::Registry.


In reply to Win32API::Registry Troubles by puploki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.