/* ****************************************************************************** * SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipcom_getuid.c,v $ $Revision: 1.11 $ * $Source: /home/interpeak/CVSRoot/ipcom/port/src/ipcom_getuid.c,v $ * $Author: lob $ $Date: 2004-11-26 10:29:59 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Lennart Bang ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipcom_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #if defined(IP_PORT_OSE) || defined(IP_PORT_OSE5) #ifdef USE_OSEDEF_H #undef USE_OSEDEF_H #endif #include #endif #include "ipcom_type.h" #include "ipcom_cstyle.h" #include "ipcom_clib.h" #ifdef IP_PORT_WIN32 #define WIN32_LEAN_AND_MEAN #include #include #endif /* **************************************************************************** * 4 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 5 DEFINES **************************************************************************** */ /* **************************************************************************** * 6 TYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipcom_getuid *=========================================================================== * Description: * Parameters: * Returns: * */ #if defined(IPCOM_GETUID) && IPCOM_GETUID == 1 IP_PUBLIC Ip_uid_t ipcom_getuid(void) { #if defined(IP_PORT_OSE) || defined(IP_PORT_OSE5) return (Ip_uid_t)get_uid(current_process()); #elif defined(IP_PORT_WIN32) Ip_uid_t uid = 0; TCHAR buf[UNLEN + 1]; char* pbuf = buf; DWORD size = UNLEN + 1; GetUserName(buf, &size); while (*pbuf++ != '\0') uid += ((*pbuf + uid) * 5213577) % 76942543 + 9871451; return uid; #else return 0; #endif } #else int ipcom_getuid_empty_file; #endif /* **************************************************************************** * END OF FILE **************************************************************************** */