What do you have for an operating system ?
Mit freundlichen Gr�ssen Joachim G�rner Informationsverarbeitung Systemtechnik Basisdienste (ISB) ADAC e.V., Am Westpark 8, 81373 M�nchen Tel.: (089) 76 76 27 83 Fax: (089) 76 76 28 82 <mailto:[EMAIL PROTECTED]> www.adac.de -----Urspr�ngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 23. September 2003 17:06 An: [EMAIL PROTECTED] Betreff: Win32::NetResource and CancelConnection I am having some problems with the Win32::NetResource module (v0.053) that I am hoping someone can help me with as it is driving me crazy. I have a script that accepts incoming connections from a client run on users workstations. This "server" app will then connect up to the calling workstation and attempt to make a connection to the IPC$ share as the workstations local administrator, this way the server has admin rights so that it can make some changes. Once the changes are made the connection to the workstation is killed and the server waits for the next incoming connection. All this works great, except when I get to the part where I want to cancel the IPC$ connection as it is no longer needed. When I attempt to do this, the IPC$ connection does not get killed until the "server" application is killed off, even if I set it to force a disconnect. Some psudo-code is below. If anyone can give me some help as to why this does not work I would be GREATLY appreciative as it is causing some issues as the "server" part is run on a workstation and I am running out of incoming connections. Thanks. Len. -------------- while ( 1 ) { <wait for incoming connection>; $user = "foo"; $pass = "bar"; make_changes_to_workstation(); <close socket and wait for next connection>; } sub make_changes_to_workstation ( if ( check_for_admin_rights() ) { <make appropriate changes>; } Win32::NetResources::CancelConnection ("\\\\$machine", 0, 1); } sub check_for_admin_rights { my %resource = (RemoteName => "\\\\$machine\\ipc\$"); if ( ! $Registry->{"//$machine/LMachine/Software"} ) { # if we cannt connect to the machine we dont have admin rights # so try and get them. if ( Win32::NetResource::AddConnection(\%resource, $pass, $user, 0) ) { return 1; } else { return 0; } } return 1; } _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
