Пример #1
0
 public bool TmcGetUserInfoEx(int cid,
                              uint userId,
                              ref TmNativeDefs.TUserInfo userInfo,
                              ref byte[]                 appxBuf,
                              uint cbAppx)
 {
     return(tmcGetUserInfoEx(cid, userId, ref userInfo, appxBuf, cbAppx));
 }
Пример #2
0
 public TmUserInfo(int id,
                   TmNativeDefs.TUserInfo tUserInfo,
                   string additionalParametersString)
 {
     Id                         = id;
     Name                       = EncodingUtil.Win1251BytesToUtf8(tUserInfo.UserName);
     NtName                     = EncodingUtil.Win1251BytesToUtf8(tUserInfo.NtUserName);
     AuthorizationName          = EncodingUtil.Win1251BytesToUtf8(tUserInfo.OldUserName);
     Comment                    = EncodingUtil.Win1251BytesToUtf8(tUserInfo.UserComment);
     AccessFlags                = (TmSecurityAccessFlags)tUserInfo.AccessMask;
     ConnectionTime             = DateUtil.GetDateTimeFromTimestampWithEpochCheck(tUserInfo.ConnectTime);
     Category                   = EncodingUtil.Win1251BytesToUtf8(tUserInfo.UserCategory);
     AdditionalParametersString = additionalParametersString;
 }
Пример #3
0
        public static TmUserInfo GetUserInfo(int tmCid,
                                             string serverName)
        {
            var nativeUserInfoSize = Marshal.SizeOf(typeof(TmNativeDefs.TExtendedUserInfo));
            var nativeUserInfoPtr  = Marshal.AllocHGlobal(nativeUserInfoSize);

            var cfCid = Native.TmcGetCfsHandle(tmCid);

            if (cfCid == IntPtr.Zero)
            {
                return(null);
            }

            var fetchResult = Native.CfsGetExtendedUserData(cfCid,
                                                            "tms$",
                                                            serverName,
                                                            nativeUserInfoPtr,
                                                            (uint)nativeUserInfoSize);

            if (fetchResult == 0)
            {
                return(null);
            }

            var extendedUserInfo = Marshal.PtrToStructure <TmNativeDefs.TExtendedUserInfo>(nativeUserInfoPtr);

            var userInfo = new TmNativeDefs.TUserInfo();

            if (!Native.TmcGetUserInfo(tmCid, 0, ref userInfo))
            {
                return(null);
            }

            return(new TmUserInfo(extendedUserInfo.UserId,
                                  Encoding.GetEncoding(1251).GetString(extendedUserInfo.UserName).Trim('\0'),
                                  Encoding.GetEncoding(1251).GetString(userInfo.UserCategory).Trim('\0'),
                                  Encoding.GetEncoding(1251).GetString(extendedUserInfo.KeyId).Trim('\0'),
                                  extendedUserInfo.Group,
                                  extendedUserInfo.Rights));
        }
 public static extern Boolean tmcGetUserInfoEx(Int32 cid,
                                               UInt32 userId,
                                               [In, Out] ref TmNativeDefs.TUserInfo userInfo,
                                               [In, Out]     byte[]                 appxBuf,
                                               uint cbAppx);
 public static extern Boolean tmcGetUserInfo(Int32 cid,
                                             UInt32 usid,
                                             [In, Out] ref TmNativeDefs.TUserInfo userInfo);
Пример #6
0
 public Boolean TmcGetUserInfo(Int32 cid,
                               UInt32 usid,
                               ref TmNativeDefs.TUserInfo userInfo)
 {
     return(tmcGetUserInfo(cid, usid, ref userInfo));
 }