'Working on a large application on Windows that uses the Win32::Lanman module. On XP, 2003, and 2007, the code works as written. On Win2008R2, it doesn't. We haven't tested on a huge number of machines, so I'm not sure the OS version is relevant. Maybe? Maybe not?
Anyway, in the main application the problem code looks like:
-----------------
unless (Win32::Lanman::NetLocalGroupEnum('', \@arrayOfHashes))
{
my $error = Win32::FormatMessage Win32::Lanman::GetLastError;
$error = Win32::Lanman::GetLastError if ($error eq "");
throw Error::Simple($error);
}
-----------------
We're hoping @arrayOfHashes would contain an array of groups on the machine. It doesn't and we get an error "The specified procedure could not be found."
I initially thought there was something wrong with Win32::Lanman or how we were using it. So, I wrote a little test like these:
-----------------
package getGroups;
use strict;
use Win32::Lanman;
sub getGroupsViaLanman {
my $arrayRef = shift;
if (Win32::Lanman::NetLocalGroupEnum('', $arrayRef)){
print "Package Array: " . Dumper($arrayRef) . "\n";
return $arrayRef;
}
else {
my $error = Win32::Lanman::GetLastError();
print "ERROR: failed to get groups via Win32::Lanman::NetLocalGro
+upsEnum ---> " . Win32::FormatMessage Win32::Lanman::GetLastError()
+. "\n";
exit;
}
}
1;
-----------------
and
-----------------
#!perl
use strict;
use getGroups;
my @results;
getGroups::getGroupsViaLanman(\@results);
use Data::Dumper;
print "GROUPS: " . Dumper(@results) . "\n";
-----------------
That works. So, Win32::Lanman and the general approach to using it work. Ergo, we must be doing something in our larger application that is stepping on something that Win32::Lanman is using.
I copied that last chunk of code into our main application, replacing the previous version and the problem persists. So, my call to Win32::Lanman::NetLocalGroupsEnum works in my trivial test and fails when the same code (verbatim) is used in the main application.
How do I figure out what that is without resorting to a brute force exercise of reviewing code, printing voluminous debug, and .... divide and conquer?
I generally live in a Linux/UNIX world. This is happening on a 64bit Windows machine. Could the 64 vs 32 bit wrinkles in windows (e.g. view of registries and such) effect this?
...'Heading off to start dissecting Win32::Lanman...
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.