delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/10/10/13:38:14

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <30BDEE18E474D511BB0A00D0B7BB87AF09294C@camel.mha.ca>
From: Kris Erickson <kris AT mha DOT ca>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: RE: Perl 5.7.2 (GDB breaks in 1.3.3-2 on certain Win2000 machines
)
Date: Wed, 10 Oct 2001 10:36:32 -0700
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

>
>Let's try and at least document what systems are exhibiting this 
>behavior.  My setup:
>
>-Win2k workstation with Service pack 1
Yes.
>-Logged into NT domain (NOT ActiveDirectory!)
Yes.
>-Running Novell Client against Netware 5.1 server(s)
No.
>-Running lots of services (Watchguard, Rational ClearCaseLT, etc.)
No.

I have administrator privledges on the local box, but not on the
network, and I am not logged in as administrator (although Cygwin
has always set the USER to administrator -- which may give a hint
to why the old version was working).  However, the NetUserGetInfo
is calling with 'kris' the right user name...

I wrote a quick and dirty MSVC app that made the same call, and it
didn't crash, however it returned an error. 
(see http://www.cygwin.com/ml/cygwin/2001-10/msg00489.html)

I get error 2221 (but no crash or anything), when it is run...
Perhaps other people who have the same problem can compile this
with MSVC or ming and see what they get...

Note:  You have to add the library netapi32.lib to get it to link. 

------------------------

#ifndef UNICODE
#define UNICODE
#endif

#include <stdio.h>
#include <windows.h> 
#include <lm.h>

#define LEVEL 3

int wmain(int argc, wchar_t *argv[]) { 
   LPUSER_INFO_3 res = NULL;
   NET_API_STATUS error;

   if (argc == 2) {
       error = NetUserGetInfo(NULL, argv[1], LEVEL, (LPBYTE *)&res);
   } else if (argc == 3) {
       error = NetUserGetInfo(argv[1], argv[2], LEVEL, (LPBYTE *)&res);
   } else {
       wprintf(L"\nUsage:\n%s [servername] username\n", argv[0]);
	   return 0;
   }
   if (error == NERR_Success){
    if (res != NULL) {
         wprintf(L"\n\tAccount:      %s\n", res->usri3_name);
         wprintf(L"\tComment:      %s\n", res->usri3_comment);
         wprintf(L"\tUser comment: %s\n", res->usri3_usr_comment);
         wprintf(L"\tFull name:    %s\n", res->usri3_full_name);
      }
   } else {
      fprintf(stderr, "A system error has occurred: %d\n", error);
   }

   if (res != NULL) {
      NetApiBufferFree(res); 
   }

   return 0;
}

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019