RE: Pulling PERL Exectuable x86 vs x64
Jan, Thanks a lot!! That did the trick. Regards, Michael Cohen From: "Jan Dubois" To: Michael Cohen/Raleigh/IBM@IBMUS, Date: 02/22/2011 04:18 PM Subject:RE: Pulling PERL Exectuable x86 vs x64 Load Config.pm and look at $Config{ptrsize}. It is either 4 or 8, telling you that you are running 32-bit or 64-bit Perl. Cheers, -Jan From: perl-win32-users-boun...@listserv.activestate.com [ mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Michael Cohen Sent: Tuesday, February 22, 2011 1:06 PM To: perl-win32-users@listserv.ActiveState.com Subject: Pulling PERL Exectuable x86 vs x64 Is there a simple way to determine what flavor of PERL is running from within a program, specifically one that is wrapped within PERLAPP? In other words, I need to determine if the PERL is 32-bit or 64-bit, to determine if it is running in WoW64 or not. I realize it is easy to determine the flavor of the OS, but this is not that question. Regards, Michael Cohen ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Pulling PERL Exectuable x86 vs x64
Is there a simple way to determine what flavor of PERL is running from within a program, specifically one that is wrapped within PERLAPP? In other words, I need to determine if the PERL is 32-bit or 64-bit, to determine if it is running in WoW64 or not. I realize it is easy to determine the flavor of the OS, but this is not that question. Regards, Michael Cohen___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Invalid type 'Q' in pack
I am trying to replace an old and unsupported Win32 library. In doing so, I am attempting to get the following piece of code to work prior to adding it to my own library: Cut Here - #!/usr/bin/perl -w use strict; use Win32; use Win32::API; Win32::API::Struct->typedef('MEMORYSTATUSEX', qw( DWORD dwLength; DWORD dwMemoryLoad; DWORD64 ullTotalPhys; DWORD64 ullAvailPhys; DWORD64 ullTotalPageFile; DWORD64 ullAvailPageFile; DWORD64 ullTotalVirtual; DWORD64 ullAvailVirtual; DWORD64 ullAvailExtendedVirtual; )); Win32::API->Import('kernel32', 'BOOL GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)'); # my $memoryInfo = Win32::API::Struct->new('MEMORYSTATUSEX'); tie my %memoryInfo, 'Win32::API::Struct', 'MEMORYSTATUSEX'; my $rc = GlobalMemoryStatusEx(\%memoryInfo); printf ("TotalPhys = %d\n", $memoryInfo{ullTotalPhys}); print ("Finished\n"); Cut Here - When I try to run this program on a x86 version of ActivePerl 5.8.9 Build 828, I get the error: Invalid type 'Q' in pack at C:/Perl/lib/Win32/API/Struct.pm line 230. when it gets to line 25 (actual call of the Win32 API). Since I need to run this bit of code on both the 32-bit and 64-bit Windows, how can I get this to work? API Info: http://msdn.microsoft.com/en-us/library/aa366589 Regards, Michael Cohen ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Determining Vista Editions
To whomever knows the answer: I have been using the Win32::GetOSVersion() function for many years in order to pull the Windows OS level. However, I now have a new need to determine whether or not the OS is Windows Vista Home Basic (or for that matter, other various editions). I do not see how to pull that information from GetOSVersion(). From what I can find on the web, I somehow need to use the "GetProductInfo" call from the "kernel32" DLL. I have tried the following code to try to pull the information from my Vista 32 Ultimate, but cannot seem to get a valid response: Cut here #!/usr/bin/perl -w use Win32; use Win32::API; use strict; my @oslevel = Win32::GetOSVersion(); my ($osMaj, $osMin, $spMaj, $spMin); printf("OS String: %s\n", $oslevel[0]); printf("OS ID: %s\n", $oslevel[4]); printf("OS Major:%d\n", $osMaj = int($oslevel[1])); printf("OS Minor:%d\n", $osMin = int($oslevel[2])); printf("OS Build:%s\n", $oslevel[3]); printf("OS SP Major: %d\n", $spMaj = int($oslevel[5])); printf("OS SP Minor: %d\n", $spMin = int($oslevel[6])); printf("OS SuiteMask:0x%08x\n", $oslevel[7]); printf("OS ProductType: %s\n", $oslevel[8]); my $prodInfo = 0x; # initialize with invalid value my $prodInfoPtr = \$prodInfo; if (($oslevel[1] == 6) && ($oslevel[2] == 0)) { my $GetProductInfo = new Win32::API("kernel32", "GetProductInfo", "P", "I"); my $rc = $GetProductInfo->Call($osMaj, $osMin, $spMaj, $spMin, $prodInfoPtr); printf("\nRC = %d\n", $rc); printf("Product Info:0x%x\n", $prodInfo); printf("Product Info:0x%x\n", $$prodInfoPtr); } Cut here The information about this call is from this link: http://msdn.microsoft.com/en-us/library/ms724358(VS.85).aspx Since the response from the GetProductInfo() command is put into the DW pointer, I have initialized the variable to 0x to ensure it is a double; however, the variable does not appear to be updated via the GetProductInfo() command (it remains 0x) and the $rc is set to 1. FWIW, I have also tried to pass the variable directly (i.e., not the ptr). What am I doing wrong? Is there a better way to get this information instead of using the GetProductInfo() command from the "kernel32" DLL? Any help would greatly be appreciated. Regards, Michael Cohen___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::Process Help Needed - Main Process Exits While Children Run
I have a piece of code that has been running for a number of years, until now. My vendor changed the way they created a program, and that new program exits before its children's processes are finished. In the past, the following "snippette" has worked fine for me: my $progFullPath = "c:\\temp\\foobar.exe";# Not the real program my $commandLine = "foobar opt1 opt2"; # Again, just an example my $ProcessObj; Win32::Process::Create($ProcessObj, $progFullPath, $commandLine, 0, NORMAL_PRIORITY_CLASS, ".")|| die print Win32::FormatMessage( Win32::GetLastError() ); while (!($done)) { $done = 1 if ($ProcessObj->Wait(100)); $main->update; # TK update } As noted above, the "Wait(100)" would work fine if the parent program does not exit prematurely. However, now that that is no longer true: a) How do I determine all of the children processes on Windows (specifically XP at this point)? b) How do I wait until all children processes are finished? I have been searching the web for various options for several hours, and just cannot come up with one at this point. If anyone has any suggestions, pointers, solutions, etc., I would be most appreciative of your help. Regards, Michael Cohen___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Truncating decimal number
John, Have you thought of using the SPRINTF function? e.g.: my $temp1 = 10.25233006477356; my $temp2 = sprintf("%.6f", $temp1); print $temp2; >> 10.252330 I realize that the SPRINTF will round, but "not needing" and "not wanting" are two different situations. I use this function all the time, and it is easy to implement. If you do not "want" to round, than I don't know. Regards, Michael Cohen "John Townsend" <[EMAIL PROTECTED] om>To Sent by: <[EMAIL PROTECTED] perl-win32-users- ate.com> [EMAIL PROTECTED] cc ActiveState.com Chad Freeman <[EMAIL PROTECTED]> Subject Truncating decimal number 06/19/2007 06:50 PM I'm trying to truncate a number, 10.25233006477356, to 6 decimal points. E.g. 10.252330. I don't need to round the number, I just want it to drop everything after the 6th decimal point. This should be easy, but I'm drawing a blank. Thanks ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs <><><>___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Compiling Perl
Nelson, I have been using ActiveState's PerlApp program, which is part of their PDK for a number of years to do exactly what you want to do. It works well, with good documentation. Regards, Michael Cohen "Nelson R. Pardee" <[EMAIL PROTECTED] To > Active State Perl Sent by: <[EMAIL PROTECTED] perl-win32-users- ate.com> [EMAIL PROTECTED] cc ActiveState.com Subject Compiling Perl 03/20/2007 05:34 PM In order to avoid installing Perl on a bunch of PC's, I'd like to compiler a couple of Perl programs. Any recommendations? I didn't see anything recently in the archives but I might have missed it. Thanks in advance. Nelson --Nelson R. Pardee, Support Analyst, Information Technology & Services-- --Syracuse University, CST 4-191, Syracuse, NY 13244 -- --(315) 443-1079 [EMAIL PROTECTED] -- ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Help: Query All Network Drives - Available or Not
I have a problem trying to query all network drives that are currently used by my machine. If I perform a simple "net use" command, I get the following response: New connections will be remembered. Status Local Remote Network --- Unavailable L: \\rtpgsa.raleigh.ibm.com\rtpgsa Microsoft Windows Network Unavailable M: \\rtpgsa.raleigh.ibm.com\homes Microsoft Windows Network Unavailable P: \\MICOHEN3-AFS\projects Microsoft Windows Network Unavailable R: \\MICOHEN3-AFS\root Microsoft Windows Network Unavailable T: \\MICOHEN3-AFS\nt Microsoft Windows Network Unavailable U: \\MICOHEN3-AFS\user Microsoft Windows Network Unavailable V: \\MICOHEN3-AFS\vlib Microsoft Windows Network Disconnected X: \\squeaker\f$ Microsoft Windows Network Disconnected Y: \\squeaker\c$ Microsoft Windows Network OK Z: \\micohen2.raleigh.ibm.com\g$ Microsoft Windows Network The command completed successfully. However, if I use either the Win32::AdminMisc::GetDrives or Win32::FileOp::Mapped commands to query the network drives, I only get responses indicating the two drives, "X" and "Y", which in "net use" are "disconnected", and "Z", which is "OK". How do I get a list of ALL network drives, "Available", "Unavailable", and "Disconnected", without actually using the "net use" command? Thank you for your assistance! Regards, Michael Cohen ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Registry Updates Not Taking
John, This code had been running without a snag for almost 3 years. It only broke AFTER I added the InstallShield "Setup" code. I suspect that the "pointers" to the HKEY_* variables changed during the "setup" program, but my code does not pick up those changes, as the "use Win32::Registry;" command is at the very beginning of the code. :-( Glad my code did have a positive outcome. LOL. Would anyone else like to try to solve this "puzzle"? Regards, Michael Cohen "John_Ramsden" <[EMAIL PROTECTED]To: Michael Cohen/Raleigh/[EMAIL PROTECTED] tta-ps.com> cc: Subject: RE: Registry Updates Not Taking 10/28/2003 04:24 AM Michael, I spent about ten minutes studying your code, and sorry to say I couldn't see anything obviously wrong. (But I did notice that your $process->wait() call takes a millisecond argument, and after checking this was correct realized that one of my service scripts is wrong, as I had assumed the argument was seconds! So I guess my time wasn't wasted ;-) Cheers John Ramsden ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Perl Script Running Silent InstallShield (Yet Again)
Jan, >> If you wait long enough, does InstallShield continue? No. I have waited upwards of 20 minutes before killing the Perl/Tk program, only to have the InstallShield program pick up immediately afterwards. :-( Regards, Michael Cohen ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Perl Script Running Silent InstallShield (Yet Again)
Has anyone found a viable solution to executing an InstallShield "setup" program from within a Perl, or more specifically a Perl/Tk, program? I have the following program I cannot get to work. InstallShield is trying to say it is not their problem. === Cut Here - Begin #! /usr/local/bin/perl -w use Tk; use Win32::Process; use Win32; use strict; sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } my $mw = MainWindow->new; $mw->destroy; my $ProcessObj; Win32::Process::Create($ProcessObj, "T:\\tools\\cad\\v150_rel\\CLIENT_SETUP\\setup.exe", "setup", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); $ProcessObj->Wait(INFINITE); exit; === Cut Here - End Once I start a simple Tk session (in this case, it is very simple, but in my real program, it is much more elaborate), the setup program will stall out. If I don't start Tk, or I kill the Perl program, the setup program will continue as expected. Funny thing: If I start a Perl/Tk program completely independent of the InstallShield program, the setup program will still stall out until the Perl/Tk program ends. (???) Any help would be greatly appreciated! Regards, Michael Cohen ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help Requested: Identify Users of Shared Resources
Paul, Where does one get LanMan? Regards, Michael Cohen Paul Popour <[EMAIL PROTECTED]> on 11/30/2000 10:00:45 PM Please respond to Paul Popour <[EMAIL PROTECTED]> To: Michael Cohen/Raleigh/IBM@IBMUS, [EMAIL PROTECTED] cc: Subject: Re: Help Requested: Identify Users of Shared Resources - Original Message - From: "Michael Cohen" <[EMAIL PROTECTED]>To: <[EMAIL PROTECTED]>Sent: Thursday, November 30, 2000 2:39 PMSubject: Help Requested: Identify Users of Shared Resources> Hello all.> > I have been attempting to find a way to identify and list all users of> various shared resources on my Windows NT machine, as well as another> Windows NT machine that I control on the network. I have been looking at> various packages, but the only thing I see is the Win32::NetResource> package. Unfortunately, the "NetShareGetInfo()" method only returns the> NUMBER of users, not WHO is using the resource.> > Is there anything that I am overlooking? Is there a way within Perl to get> this information? Is there some Win32 API that I need to use that I am> unaware of?> > FWIW: If I use the "NetWatch" program fromt the Windows NT Resource Kit, I> can see who is using any given resource, specifically the ID of the person,> and the UNC pathname to the machine. Unfortunately, there is no logging> capability to NetWatch, which is what I am trying to perform.> Take a look at the Win32::Lanman module's NetUseEnum function Enumerates all connections to shared resources. if(!Win32::Lanman::NetUseEnum(\@uses)) { print "Sorry, something went wrong; error: "; # get the error code print Win32::Lanman::GetLastError(); exit 1; } foreach $use (@uses) { foreach (sort keys %$use) { print "$_=${$use}{$_}\n"; } } ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users