GD
I am trying to install GD on a Windows 2000 machine and have had nothing but problems doing so. I have tried following all installation instructions but have still not be able to figure this out. I know this is kind of a broad question to ask but can anyone suggest the best places to get help to install GD, or who has any tips on how to procede? Thanks * Eric Hawley, Network Support Programmer > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Determine if client has a dialup connection
Does anyone know of a way to determine if when a client logs on, they are logging on via a dialup connection? Thanks * Eric Hawley, Network Support Programmer > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Disk Space Question
Don't know if any of you have a good ideas for this but here goes. I have written a Perl program that will run on a Windows 2000 server to get disk space off of all NT servers using WMI. Now since our network consists of NT and Linux machines I would like to get disk space off Linux machines as well but I want the program to run on one of the NT servers. Does anyone have a good suggestion as to how I should go about obtaining the disk space information from a linux machine. What I have thought of so far is to use SSH to and issue the 'df' command. The downfall to this solution is that it requires me to hard code a username and password to logon to the machine, and I would like to try to avoid this if possible. I know this is a Win32 mailing list but I thought maybe some of you have had experience with this type of work before. Thanks in advance for your hekp * Eric Hawley, Network Support Programmer > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Security Access question
no not yet, I guess I could give those a try. * Eric Hawley, Network Support Programmer * Office of Information Technology * Ohio Department of Natural Resources * Phone: (614) 265-1028 * Mailto:[EMAIL PROTECTED] > -Original Message- > From: Wiechel, Ben [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 25, 2003 12:49 PM > To: 'Hawley, Eric'; Perl-Win32 (E-mail) > Subject: RE: Security Access question > > > Have you tried using the LogonAsUser method in > Win32::AdminMisc, or using > the RUNAS executable? > > -- > Benjamin D. Wiechel > Xerox Connect > [EMAIL PROTECTED] > Phone: 937-221-3443 > Fax: 937-221-4499 > Pager: 888-733-8075 / [EMAIL PROTECTED] > Mobile: 513-254-7071 > > > > -Original Message- > From: Hawley, Eric [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 25, 2003 12:16 PM > To: Perl-Win32 (E-mail) > Subject: Security Access question > > > I need to be able to get the size of certain directories off > of other nodes > throughout our network and have a program that will be > running in the users > login scripts, so the user is the one actually executing the > program. The > problem that I am encountering is that if they do not have > Administrator > Privileges to the machine the program will fail when it trys to open a > folder that only has Local Adminstrator privileges. So what > I need to do is > somehow impersonate a local admin on the machine for this > recursive search, > any suggestions? I tried using API but haven't found the > right Account > Rights yet for it. Code for the search is down below along > with my attempt > to get admin access. > > Thanks > Eric > > sub DirSize { > my($dir) = shift @_; > my($file); > opendir(DIR, "$dir") || die "Unable to open $dir :$!"; > #fails here if > dir only has Admin access > my(@files) = grep {!/^\.\.?$/ } readdir(DIR); > closedir(DIR); > foreach ( @files ) { > if( -d ($file = "$dir\\$_")){ DirSize($file); } > elsif( -f $file ){ $s += (stat $file)[7]; } > } > return $s; > } > > > sub Get_Privilege{ > my $GetCurrentProcess = new > Win32::API("kernel32","GetCurrentProcess",[],"L"); > my $OpenProcessToken = new > Win32::API("advapi32","OpenProcessToken",["L","L","P"],"I"); > my $LookupPrivilegeValue = new > Win32::API("advapi32","LookupPrivilegeValue",["L","P","P"],"I"); > my $AdjustTokenPrivileges = new > Win32::API("advapi32","AdjustTokenPrivileges",["L","I","P","L" > ,"L","L"],"I") > ; > > my $Handle = pack("L",0); > if > ($OpenProcessToken->Call($GetCurrentProcess->Call(),0x0028,$Handle)) { > > my $id = pack("LL",0,0); > $LookupPrivilegeValue->Call(0,"SeTcbPrivilege",$id); > #not sure what > privilege can go here. > my $Privileges = pack("",1,unpack("LL",$id),0x0002); > > $AdjustTokenPrivileges->Call(unpack("L",$Handle),0,$Privileges,0,0,0); > } > } > > * Eric Hawley, Network Support Programmer > > * Office of Information Technology > > * Ohio Department of Natural Resources > > * Phone: (614) 265-1028 > > * Mailto:[EMAIL PROTECTED] > > > > > > > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Security Access question
I need to be able to get the size of certain directories off of other nodes throughout our network and have a program that will be running in the users login scripts, so the user is the one actually executing the program. The problem that I am encountering is that if they do not have Administrator Privileges to the machine the program will fail when it trys to open a folder that only has Local Adminstrator privileges. So what I need to do is somehow impersonate a local admin on the machine for this recursive search, any suggestions? I tried using API but haven't found the right Account Rights yet for it. Code for the search is down below along with my attempt to get admin access. Thanks Eric sub DirSize { my($dir) = shift @_; my($file); opendir(DIR, "$dir") || die "Unable to open $dir :$!"; #fails here if dir only has Admin access my(@files) = grep {!/^\.\.?$/ } readdir(DIR); closedir(DIR); foreach ( @files ) { if( -d ($file = "$dir\\$_")){ DirSize($file); } elsif( -f $file ){ $s += (stat $file)[7]; } } return $s; } sub Get_Privilege{ my $GetCurrentProcess = new Win32::API("kernel32","GetCurrentProcess",[],"L"); my $OpenProcessToken = new Win32::API("advapi32","OpenProcessToken",["L","L","P"],"I"); my $LookupPrivilegeValue = new Win32::API("advapi32","LookupPrivilegeValue",["L","P","P"],"I"); my $AdjustTokenPrivileges = new Win32::API("advapi32","AdjustTokenPrivileges",["L","I","P","L","L","L"],"I") ; my $Handle = pack("L",0); if ($OpenProcessToken->Call($GetCurrentProcess->Call(),0x0028,$Handle)) { my $id = pack("LL",0,0); $LookupPrivilegeValue->Call(0,"SeTcbPrivilege",$id);#not sure what privilege can go here. my $Privileges = pack("",1,unpack("LL",$id),0x0002); $AdjustTokenPrivileges->Call(unpack("L",$Handle),0,$Privileges,0,0,0); } } * Eric Hawley, Network Support Programmer > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
API question
Just got a quick question on a api program that I am trying to write to mess with Windows services. The program will run but will Give me a "Program Error" box telling me that perl has generated errors and is exiting. I put in some debug statements to assist myself but that I couldn't make sense of the errors. Could someone help me out with this, code and output of errors is below use strict; use Win32::Service; use Win32::API; #Get file handle to Service Manager my $openscmanager = new Win32::API('advapi32.dll','OpenSCManager',['P','P','L'],'L') or die Win32::FormatMessage(Win32::GetLastError); print "$^E\n"; #Get file handle to a service my $openservice = new Win32::API('advapi32.dll','OpenService',['L','P','L'],'L') or die Win32::FormatMessage(Win32::GetLastError); print "$^E\n"; #close service handle my $closeservice = new Win32::API('advapi32.dll','CloseServiceHandle',['L'],'I') or die Win32::FormatMessage(Win32::GetLastError); print "$^E\n"; #Get a services configuration my $queryservice = new Win32::API('advapi32.dll','QueryServiceConfig',['L','P','L','P'],'I') or die Win32::FormatMessage(Win32::GetLastError); print "$^E\n"; #Get service file handle for host $host, 0x000F003F = full access my $SCHandle = $openscmanager->Call("nr729hawley2k2", 0, 0x000F003F) or die Win32::FormatMessage(Win32::GetLastError); print "$^E\n"; my %hash; Win32::Service::GetServices( "nr729hawley2k2", \%hash ); foreach my $service ( sort keys %hash ){ if( $service eq "Alerter"){ #0xC000 = GENERIC_READ and GENERIC_WRITE my $service_handle = $openservice->Call( $SCHandle,$service,0xC000) or die Win32::FormatMessage(Win32::GetLastError); my %hash_storage; my $hash_pack; $hash_pack = pack('LLLPPLPPP',0,0,0,0,0,0,0,0,0); #not sure really what I should have for the last two parameters, just made up some numbers my $query = $queryservice->Call( $service_handle, $hash_pack,195,400) or die Win32::FormatMessage(Win32::GetLastError); %hash_storage = unpack('LLLPPLPPP', $hash_pack); foreach my $print (sort keys %hash ){ print "key = $print; value = $hash{$print}\n"; } my %ref; Win32::Service::GetStatus("nr729hawley2k2", $hash{$service}, \%ref ); $closeservice->Call($service_handle); } } output from print"$^E\n"; The specified procedure could not be found The specified procedure could not be found The specified procedure could not be found The specified procedure could not be found Overlapped I/O operation is in progress Thanks -Eric > * Eric Hawley, Network Support Programmer > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: threads question
want to say thanks for your input, later this evening I will be getting back to working on this project. I will definetly look into your suggestions and once I find the solution I can repost so that everyone can take a look at it if they so wish to. Once again thanks for your suggestions. -Eric -Original Message- From: Jonathan Epstein To: Hawley, Eric; '[EMAIL PROTECTED] ' Sent: 2/24/03 10:28 AM Subject: Re: threads question Following up on my own message ... from: http://search.cpan.org/author/BBIRTH/Win32-SerialPort-0.19/lib/Win32/Ser ialPort.pm "Asynchronous (Background) I/O The module handles Polling (do if Ready), Synchronous (block until Ready), and Asynchronous Modes (begin and test if Ready) with the timeout choices provided by the API. No effort has yet been made to interact with Windows events. But background I/O has been used successfully with the Perl Tk modules and callbacks from the event loop." So it seems that this approach (using asynchronous I/O with Tk callbacks) is blessed by the author of Win32::SerialPort. Jonathan At 10:12 AM 2/24/2003 -0500, Jonathan Epstein wrote: >Eric, > >Being curious about this question (and a related one a few days ago), I did some google searches and learned about Tk::after. > >See: > http://www.mathematik.uni-ulm.de/help/perl5/doc/Tk/after.html > >Since apparently Tk itself isn't considered to be thread-safe, I wonder whether in this case you should forget about threads and just use one of these 'after' callback routines to perform all your serial port processing. > >Good luck ... let us know if you come up with a solution. > >Another (somewhat inconsistent) suggestion: since most of us can't really run your serial port code, if you're still running into trouble you might produce some sample code where the temperature and heart rate are generated pseudo-randomly, rather than getting the data from the serial port. Of course then it won't have any Win32 component, so it will be out of scope for this list ;-) But you can try reposting it here as well as on PerlMonks, where there seems to be a lot of knowledge base on topics like these. > >Good luck, > >Jonathan > >At 05:03 PM 2/22/2003 -0500, Hawley, Eric wrote: > >>I have created this gui application which when selecting the Start button >>from the menu will continue to run (infinite) until someone stops the >>processing. What I have is once the Start button is click it creates a >>thread where the while loop will be executed (so that the user can still >>interact with the GUI) and information will read in from a serial port and >>processed. Once this information is processed I would like it to update the >>GUI display for $temperature and $heart_rate and I can't seem to figure this >>out. If someone can point out my faults I would apperciate it. >> >>Code is attached >>Thanks >>Eric >> ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: question about grep
actually I think I see what is wrong with the code. At first I was reading the wrong variable which was producing just the word "Status" and second after looking at the grep function again it looks as though I will have to store the file into a data structure and grep from that data structure to get the desired results. Thanks for your input Eric -Original Message- From: Peter Guzis To: Perl-Win32 (E-mail) Sent: 2/13/03 1:32 PM Subject: RE: question about grep @matches = grep /^Status/, @data; If this doesn't do it you might consider posting some sample data. Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message----- From: Hawley, Eric [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 10:23 AM To: Perl-Win32 (E-mail) Subject: question about grep I got a question concerning grep. I would like to use it to pull out all full lines of text, that starts with the word "Status", from a list of files. I am not really too experienced with using Metacharacters and Metasymbols and do not know how to go about doing this with grep. Can someone help me out with this? Thanks in advanced Eric ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: question about grep
I tried what you did suggested and it only pulled out the word Status, here is the code below; #location contains the path for the report to be stored $report_location = $location; $report_location =~ s/\//\\/; $report_location = "$report_location" . "\\Reports"; unless( -e $report_location) ){ mkdir( $report_location ) or die "died creating Report Directory"; } #open Report HTML file open( FILE, "> $report_location\\$year_$month_$date_Report.htm" ) or die "Dead creating Report"; #print intial html to report file print FILE "\n\n$year_$month_$date_report\n\n\n "; #file paths include paths to the files, that Status should be greped from #ex) C:\\Test.htm foreach $project_file ( @file_paths ){ #grep Status line from $project_file @status_line = grep /^Status/, $project_file; } print FILE "\n\n"; close(FILE); Hope this can point to any failures. Thanks Eric -- -Original Message- From: Peter Guzis [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 1:33 PM To: Perl-Win32 (E-mail) Subject: RE: question about grep @matches = grep /^Status/, @data; If this doesn't do it you might consider posting some sample data. Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Hawley, Eric [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 10:23 AM To: Perl-Win32 (E-mail) Subject: question about grep I got a question concerning grep. I would like to use it to pull out all full lines of text, that starts with the word "Status", from a list of files. I am not really too experienced with using Metacharacters and Metasymbols and do not know how to go about doing this with grep. Can someone help me out with this? Thanks in advanced Eric ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
question about grep
I got a question concerning grep. I would like to use it to pull out all full lines of text, that starts with the word "Status", from a list of files. I am not really too experienced with using Metacharacters and Metasymbols and do not know how to go about doing this with grep. Can someone help me out with this? Thanks in advanced Eric ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
inserting text into word with OLE
I have been trying to figure out a way to insert text at the end of a Word document. I know you can insert with $word->Selection->TypeText("text here"); but if I am correct I need to place the cursor at the end of the file in order to insert there. I have tried looking for the control to place the text cursor at the end of the file but have been unsuccessful, does anyone know how to do this or is there a better way to insert text at the end of a file? Thanks in advance Eric ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Creating directories
Title: Creating directories I was wondering if someone knows a good way to create directories for Windows and Linux using Perl. Thanks Eric Eric Hawley Office of Information Technology Ohio Department of Natural Resources Phone: (614) 265-1028 Mailto:Eric.Hawley@dnr.state.oh.us
DNS and WINS question
Would I want to do is to connect remotely to other machines on the network and establish if they have a DNS or WINS addresses hard coded, if they do I would like to change the DNS setting so that It will obtain the server address automatically, and if there are WINS addresses hard coded I would like to delete these. Does anyone know of a module or modules that can help me with these tasks? Thanks * Eric Hawley, Network Support Programmer > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Determining if a Windows Server?
I need to be able to determine whether or not the computer that a script is running on is a Windows NT or 2000 server or if it is not. Does anyone know how to do this? I tried looking at Win32::GetOSVersion() but this won't work. I have tried searching on CPAN but haven't found anything. Thanks * Eric Hawley, Network Services Intern > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Adding a Timer in Win32::GUI
Okay I have been attempting to add a timer to a message box and have been unsuccessful in being able to do so. I want to have it so that after the message box displays the user has 10 seconds to either click YES or NO with default as YES. If after 10 seconds the user has failed to make a selection YES will be automatically choosen. can someone help me out with this. Down below is some code that I have from the script. my $choice = GUI::MessageBox(GUI::GetForegroundWindow(), "Windows could not finish a system task and needs to restart.\n\nNOTE: You MUST reboot Windows so that this task may finish.\nReboot Windows now?", "Error", MB_YESNO | MB_ICONINFORMATION | MB_DEFBUTTON1); $Window->Addtimer( "Timer", 1 ); #Need advice as to how to get the correct value for $Window Does anyone know what else I need to add to get this to work? Thanks for your help * Eric Hawley, Network Services Intern > * Office of Information Technology > * Ohio Department of Natural Resources > * Phone: (614) 265-1028 > * Mailto:[EMAIL PROTECTED] > > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs