| [ CnUnix ] in KIDS 글 쓴 이(By): ksangeun (우주인) 날 짜 (Date): 2003년 9월 1일 월요일 오후 11시 46분 41초 제 목(Title): Re: [또질문]WinNT서비스에서 사용자계정가 서비스가 현재 로그인 한 유져의 Login name을 알고싶은 것이죠? 그럼 아무도 Login하지 않으면?? Terminal Service로 로그인 한 유져가 있으면 그 user id를 가져와야 하나요? 아마도 알기가 힘들 것 같은데.. Current process의 Owner는 Win32 API GetUserName()으로 가져올 수 있습니다. 아래는 MSDN의 GetUserName 설명.. GetUserName The GetUserName function retrieves the user name of the current thread. This is the name of the user currently logged onto the system. BOOL GetUserName( LPTSTR lpBuffer, // address of name buffer LPDWORD nSize // address of size of name buffer ); Parameters lpBuffer Pointer to the buffer to receive the null-terminated string containing the user's logon name. If this buffer is not large enough to contain the entire user name, the function fails. A buffer size of (UNLEN + 1) characters will hold the maximum length user name including the terminating null character. UNLEN is defined in LMCONS.H. nSize Pointer to a DWORD variable that, on input, specifies the maximum size, in characters, of the buffer specified by the lpBuffer parameter. If the function succeeds, the variable receives the number of characters copied to the buffer. If the buffer is not large enough, the function fails and the variable receives the required buffer size, in characters, including the terminating null character. Return Values If the function succeeds, the return value is nonzero, and the variable pointed to by nSize contains the number of characters copied to the buffer specified by lpBuffer, including the terminating null character. If the function fails, the return value is zero. To get extended error information, callGetLastError. Remarks If the current thread is impersonating another client, the GetUserName function returns the user name of the client that the thread is impersonating. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Unsupported. Header: Declared in winbase.h. Import Library: Use advapi32.lib. Unicode: Implemented as Unicode and ANSI versions on Windows NT. ======================================================================= main(){int a=107,j=2;while(a>-5000){a=a>0?a:99;putchar(a); a=j==49?46:a-j;j*=j;j=j%256?j:7;j*=j%16?1:-1;};printf("%cm\n",111);}; ======================================================================= |